@spfn/auth 0.2.0-beta.6 → 0.2.0-beta.60
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 +831 -198
- package/dist/{dto-Bb2qFUO6.d.ts → authenticate-B_HkYBzq.d.ts} +449 -199
- package/dist/config.d.ts +176 -44
- package/dist/config.js +99 -35
- package/dist/config.js.map +1 -1
- package/dist/errors.d.ts +30 -2
- package/dist/errors.js +24 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +289 -113
- package/dist/index.js +59 -1
- package/dist/index.js.map +1 -1
- package/dist/nextjs/api.js +547 -47
- package/dist/nextjs/api.js.map +1 -1
- package/dist/nextjs/client.d.ts +28 -0
- package/dist/nextjs/client.js +80 -0
- package/dist/nextjs/client.js.map +1 -0
- package/dist/nextjs/server.d.ts +92 -3
- package/dist/nextjs/server.js +282 -22
- package/dist/nextjs/server.js.map +1 -1
- package/dist/server.d.ts +860 -468
- package/dist/server.js +1454 -607
- package/dist/server.js.map +1 -1
- package/dist/session-Dbvz9Sdp.d.ts +53 -0
- package/dist/types-B1CzVZkU.d.ts +45 -0
- package/migrations/0001_smooth_the_fury.sql +3 -0
- package/migrations/0002_deep_iceman.sql +11 -0
- package/migrations/0003_perfect_deathbird.sql +3 -0
- package/migrations/0004_concerned_rawhide_kid.sql +5 -0
- package/migrations/meta/0001_snapshot.json +1660 -0
- package/migrations/meta/0002_snapshot.json +1660 -0
- package/migrations/meta/0003_snapshot.json +1689 -0
- package/migrations/meta/0004_snapshot.json +1721 -0
- package/migrations/meta/_journal.json +28 -0
- package/package.json +15 -11
package/dist/server.d.ts
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { i as AuthInitOptions, d as VerificationPurpose, h as PermissionCategory, j as AuthContext } from './authenticate-B_HkYBzq.js';
|
|
2
|
+
export { u as ChangePasswordParams, p as CheckAccountExistsParams, C as CheckAccountExistsResult, a1 as EmailSchema, I as IssueOneTimeTokenResult, s as LoginParams, L as LoginResult, t as LogoutParams, Z as OAuthCallbackParams, _ as OAuthCallbackResult, Y as OAuthStartParams, O as OAuthStartResult, a3 as PasswordSchema, a2 as PhoneSchema, q as RegisterParams, F as RegisterPublicKeyParams, a as RegisterResult, H as RevokeKeyParams, G as RotateKeyParams, b as RotateKeyResult, x as SendVerificationCodeParams, S as SendVerificationCodeResult, a4 as TargetTypeSchema, f as VERIFICATION_PURPOSES, e as VERIFICATION_TARGET_TYPES, a5 as VerificationPurposeSchema, V as VerificationTargetType, y as VerifyCodeParams, z as VerifyCodeResult, m as authRouter, $ as authenticate, Q as buildOAuthErrorUrl, o as changePasswordService, k as checkAccountExistsService, W as getEnabledOAuthProviders, X as getGoogleAccessToken, T as isOAuthProviderEnabled, J as issueOneTimeTokenService, l as loginService, n as logoutService, N as oauthCallbackService, M as oauthStartService, a0 as optionalAuth, B as registerPublicKeyService, r as registerService, E as revokeKeyService, D as rotateKeyService, v as sendVerificationCodeService, w as verifyCodeService, K as verifyOneTimeTokenService } from './authenticate-B_HkYBzq.js';
|
|
3
3
|
import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
|
|
4
|
+
import { K as KeyAlgorithmType, b as InvitationStatus, d as SocialProvider } from './types-B1CzVZkU.js';
|
|
5
|
+
export { I as INVITATION_STATUSES, a as KEY_ALGORITHM, S as SOCIAL_PROVIDERS, U as USER_STATUSES, c as UserStatus } from './types-B1CzVZkU.js';
|
|
4
6
|
import { UserProfile as UserProfile$1, ProfileInfo } from '@spfn/auth';
|
|
5
7
|
import { BaseRepository } from '@spfn/core/db';
|
|
6
8
|
import { Context } from 'hono';
|
|
7
9
|
import * as _spfn_core_route from '@spfn/core/route';
|
|
8
10
|
import { Algorithm } from 'jsonwebtoken';
|
|
11
|
+
export { S as SessionData, g as getSessionInfo, s as sealSession, a as shouldRefreshSession, u as unsealSession } from './session-Dbvz9Sdp.js';
|
|
12
|
+
import { SSETokenStore, SSETokenManager } from '@spfn/core/event/sse';
|
|
9
13
|
import * as _spfn_core_logger from '@spfn/core/logger';
|
|
10
|
-
import '@
|
|
14
|
+
import * as _spfn_core_event from '@spfn/core/event';
|
|
15
|
+
import * as _sinclair_typebox from '@sinclair/typebox';
|
|
11
16
|
import '@spfn/auth/server';
|
|
12
17
|
|
|
13
18
|
/**
|
|
@@ -78,6 +83,23 @@ declare const users: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
78
83
|
identity: undefined;
|
|
79
84
|
generated: undefined;
|
|
80
85
|
}, {}, {}>;
|
|
86
|
+
publicId: drizzle_orm_pg_core.PgColumn<{
|
|
87
|
+
name: "public_id";
|
|
88
|
+
tableName: "users";
|
|
89
|
+
dataType: "string";
|
|
90
|
+
columnType: "PgUUID";
|
|
91
|
+
data: string;
|
|
92
|
+
driverParam: string;
|
|
93
|
+
notNull: true;
|
|
94
|
+
hasDefault: true;
|
|
95
|
+
isPrimaryKey: false;
|
|
96
|
+
isAutoincrement: false;
|
|
97
|
+
hasRuntimeDefault: false;
|
|
98
|
+
enumValues: undefined;
|
|
99
|
+
baseColumn: never;
|
|
100
|
+
identity: undefined;
|
|
101
|
+
generated: undefined;
|
|
102
|
+
}, {}, {}>;
|
|
81
103
|
email: drizzle_orm_pg_core.PgColumn<{
|
|
82
104
|
name: "email";
|
|
83
105
|
tableName: "users";
|
|
@@ -112,6 +134,23 @@ declare const users: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
112
134
|
identity: undefined;
|
|
113
135
|
generated: undefined;
|
|
114
136
|
}, {}, {}>;
|
|
137
|
+
username: drizzle_orm_pg_core.PgColumn<{
|
|
138
|
+
name: "username";
|
|
139
|
+
tableName: "users";
|
|
140
|
+
dataType: "string";
|
|
141
|
+
columnType: "PgText";
|
|
142
|
+
data: string;
|
|
143
|
+
driverParam: string;
|
|
144
|
+
notNull: false;
|
|
145
|
+
hasDefault: false;
|
|
146
|
+
isPrimaryKey: false;
|
|
147
|
+
isAutoincrement: false;
|
|
148
|
+
hasRuntimeDefault: false;
|
|
149
|
+
enumValues: [string, ...string[]];
|
|
150
|
+
baseColumn: never;
|
|
151
|
+
identity: undefined;
|
|
152
|
+
generated: undefined;
|
|
153
|
+
}, {}, {}>;
|
|
115
154
|
passwordHash: drizzle_orm_pg_core.PgColumn<{
|
|
116
155
|
name: "password_hash";
|
|
117
156
|
tableName: "users";
|
|
@@ -150,11 +189,11 @@ declare const users: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
150
189
|
name: `${string}_id`;
|
|
151
190
|
tableName: "users";
|
|
152
191
|
dataType: "number";
|
|
153
|
-
columnType: "
|
|
192
|
+
columnType: "PgBigInt53";
|
|
154
193
|
data: number;
|
|
155
|
-
driverParam: number;
|
|
194
|
+
driverParam: string | number;
|
|
156
195
|
notNull: true;
|
|
157
|
-
hasDefault:
|
|
196
|
+
hasDefault: false;
|
|
158
197
|
isPrimaryKey: false;
|
|
159
198
|
isAutoincrement: false;
|
|
160
199
|
hasRuntimeDefault: false;
|
|
@@ -250,8 +289,10 @@ declare function getUserByIdService(userId: number): Promise<{
|
|
|
250
289
|
createdAt: Date;
|
|
251
290
|
updatedAt: Date;
|
|
252
291
|
id: number;
|
|
292
|
+
publicId: string;
|
|
253
293
|
email: string | null;
|
|
254
294
|
phone: string | null;
|
|
295
|
+
username: string | null;
|
|
255
296
|
passwordHash: string | null;
|
|
256
297
|
passwordChangeRequired: boolean;
|
|
257
298
|
roleId: number;
|
|
@@ -267,8 +308,10 @@ declare function getUserByEmailService(email: string): Promise<{
|
|
|
267
308
|
createdAt: Date;
|
|
268
309
|
updatedAt: Date;
|
|
269
310
|
id: number;
|
|
311
|
+
publicId: string;
|
|
270
312
|
email: string | null;
|
|
271
313
|
phone: string | null;
|
|
314
|
+
username: string | null;
|
|
272
315
|
passwordHash: string | null;
|
|
273
316
|
passwordChangeRequired: boolean;
|
|
274
317
|
roleId: number;
|
|
@@ -284,8 +327,10 @@ declare function getUserByPhoneService(phone: string): Promise<{
|
|
|
284
327
|
createdAt: Date;
|
|
285
328
|
updatedAt: Date;
|
|
286
329
|
id: number;
|
|
330
|
+
publicId: string;
|
|
287
331
|
email: string | null;
|
|
288
332
|
phone: string | null;
|
|
333
|
+
username: string | null;
|
|
289
334
|
passwordHash: string | null;
|
|
290
335
|
passwordChangeRequired: boolean;
|
|
291
336
|
roleId: number;
|
|
@@ -302,17 +347,49 @@ declare function updateLastLoginService(userId: number): Promise<void>;
|
|
|
302
347
|
* Update user data
|
|
303
348
|
*/
|
|
304
349
|
declare function updateUserService(userId: number, updates: Partial<NewUser>): Promise<void>;
|
|
350
|
+
/**
|
|
351
|
+
* Check if username is available
|
|
352
|
+
*
|
|
353
|
+
* @returns true if the username is available (not taken and not reserved)
|
|
354
|
+
*/
|
|
355
|
+
declare function checkUsernameAvailableService(username: string): Promise<boolean>;
|
|
356
|
+
/**
|
|
357
|
+
* Update username with reserved word and duplicate check
|
|
358
|
+
*
|
|
359
|
+
* @param userId - User ID (string, number, or bigint)
|
|
360
|
+
* @param username - New username or null to clear
|
|
361
|
+
* @throws ReservedUsernameError if username is reserved
|
|
362
|
+
* @throws UsernameAlreadyTakenError if username is already in use by another user
|
|
363
|
+
*/
|
|
364
|
+
declare function updateUsernameService(userId: string | number | bigint, username: string | null): Promise<{
|
|
365
|
+
createdAt: Date;
|
|
366
|
+
updatedAt: Date;
|
|
367
|
+
id: number;
|
|
368
|
+
publicId: string;
|
|
369
|
+
email: string | null;
|
|
370
|
+
phone: string | null;
|
|
371
|
+
username: string | null;
|
|
372
|
+
passwordHash: string | null;
|
|
373
|
+
passwordChangeRequired: boolean;
|
|
374
|
+
roleId: number;
|
|
375
|
+
status: "active" | "inactive" | "suspended";
|
|
376
|
+
emailVerifiedAt: Date | null;
|
|
377
|
+
phoneVerifiedAt: Date | null;
|
|
378
|
+
lastLoginAt: Date | null;
|
|
379
|
+
}>;
|
|
305
380
|
|
|
306
381
|
/**
|
|
307
382
|
* @spfn/auth - RBAC Initialization Service
|
|
308
383
|
*
|
|
309
384
|
* Initialize roles, permissions, and their mappings
|
|
385
|
+
* Uses hash-based change detection to skip unnecessary DB operations
|
|
310
386
|
*/
|
|
311
387
|
|
|
312
388
|
/**
|
|
313
389
|
* Initialize auth package with RBAC system
|
|
314
390
|
*
|
|
315
|
-
* Creates built-in roles, permissions, and custom configurations
|
|
391
|
+
* Creates built-in roles, permissions, and custom configurations.
|
|
392
|
+
* Uses hash-based change detection - skips DB operations when config is unchanged.
|
|
316
393
|
*
|
|
317
394
|
* @param options - Initialization options
|
|
318
395
|
*
|
|
@@ -880,11 +957,11 @@ declare const userInvitations: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
880
957
|
name: `${string}_id`;
|
|
881
958
|
tableName: "user_invitations";
|
|
882
959
|
dataType: "number";
|
|
883
|
-
columnType: "
|
|
960
|
+
columnType: "PgBigInt53";
|
|
884
961
|
data: number;
|
|
885
|
-
driverParam: number;
|
|
962
|
+
driverParam: string | number;
|
|
886
963
|
notNull: true;
|
|
887
|
-
hasDefault:
|
|
964
|
+
hasDefault: false;
|
|
888
965
|
isPrimaryKey: false;
|
|
889
966
|
isAutoincrement: false;
|
|
890
967
|
hasRuntimeDefault: false;
|
|
@@ -897,11 +974,11 @@ declare const userInvitations: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
897
974
|
name: `${string}_id`;
|
|
898
975
|
tableName: "user_invitations";
|
|
899
976
|
dataType: "number";
|
|
900
|
-
columnType: "
|
|
977
|
+
columnType: "PgBigInt53";
|
|
901
978
|
data: number;
|
|
902
|
-
driverParam: number;
|
|
979
|
+
driverParam: string | number;
|
|
903
980
|
notNull: true;
|
|
904
|
-
hasDefault:
|
|
981
|
+
hasDefault: false;
|
|
905
982
|
isPrimaryKey: false;
|
|
906
983
|
isAutoincrement: false;
|
|
907
984
|
hasRuntimeDefault: false;
|
|
@@ -1032,6 +1109,7 @@ declare function createInvitation(params: {
|
|
|
1032
1109
|
roleId: number;
|
|
1033
1110
|
invitedBy: number;
|
|
1034
1111
|
expiresInDays?: number;
|
|
1112
|
+
expiresAt?: Date;
|
|
1035
1113
|
metadata?: Record<string, any>;
|
|
1036
1114
|
}): Promise<Invitation>;
|
|
1037
1115
|
/**
|
|
@@ -1258,9 +1336,11 @@ declare function getAuthSessionService(userId: string | number | bigint): Promis
|
|
|
1258
1336
|
category: "auth" | "custom" | "user" | "rbac" | "system" | undefined;
|
|
1259
1337
|
}[];
|
|
1260
1338
|
userId: number;
|
|
1339
|
+
publicId: string;
|
|
1261
1340
|
email: string | null;
|
|
1262
1341
|
emailVerified: boolean;
|
|
1263
1342
|
phoneVerified: boolean;
|
|
1343
|
+
hasPassword: boolean;
|
|
1264
1344
|
}>;
|
|
1265
1345
|
|
|
1266
1346
|
/**
|
|
@@ -1305,6 +1385,16 @@ interface UpdateProfileParams {
|
|
|
1305
1385
|
* ```
|
|
1306
1386
|
*/
|
|
1307
1387
|
declare function getUserProfileService(userId: string | number | bigint): Promise<UserProfile$1>;
|
|
1388
|
+
/**
|
|
1389
|
+
* Update user locale
|
|
1390
|
+
*
|
|
1391
|
+
* @param userId - User ID
|
|
1392
|
+
* @param locale - Locale code (e.g., 'en', 'ko', 'ja')
|
|
1393
|
+
* @returns Updated locale
|
|
1394
|
+
*/
|
|
1395
|
+
declare function updateLocaleService(userId: string | number | bigint, locale: string): Promise<{
|
|
1396
|
+
locale: string;
|
|
1397
|
+
}>;
|
|
1308
1398
|
/**
|
|
1309
1399
|
* Update user profile (upsert)
|
|
1310
1400
|
*
|
|
@@ -1326,369 +1416,6 @@ declare function getUserProfileService(userId: string | number | bigint): Promis
|
|
|
1326
1416
|
*/
|
|
1327
1417
|
declare function updateUserProfileService(userId: string | number | bigint, params: UpdateProfileParams): Promise<ProfileInfo>;
|
|
1328
1418
|
|
|
1329
|
-
/**
|
|
1330
|
-
* @spfn/auth - Email Template Types
|
|
1331
|
-
*
|
|
1332
|
-
* Type definitions for customizable email templates
|
|
1333
|
-
*/
|
|
1334
|
-
/**
|
|
1335
|
-
* Common template result
|
|
1336
|
-
*/
|
|
1337
|
-
interface EmailTemplateResult {
|
|
1338
|
-
subject: string;
|
|
1339
|
-
text: string;
|
|
1340
|
-
html: string;
|
|
1341
|
-
}
|
|
1342
|
-
/**
|
|
1343
|
-
* Verification code template parameters
|
|
1344
|
-
*/
|
|
1345
|
-
interface VerificationCodeParams {
|
|
1346
|
-
code: string;
|
|
1347
|
-
purpose: 'registration' | 'login' | 'password_reset' | string;
|
|
1348
|
-
expiresInMinutes?: number;
|
|
1349
|
-
appName?: string;
|
|
1350
|
-
}
|
|
1351
|
-
/**
|
|
1352
|
-
* Email template provider interface
|
|
1353
|
-
*
|
|
1354
|
-
* Implement this interface to create custom email templates
|
|
1355
|
-
*
|
|
1356
|
-
* @example
|
|
1357
|
-
* ```typescript
|
|
1358
|
-
* import { registerEmailTemplates } from '@spfn/auth/server';
|
|
1359
|
-
*
|
|
1360
|
-
* registerEmailTemplates({
|
|
1361
|
-
* verificationCode: (params) => ({
|
|
1362
|
-
* subject: 'Your Code',
|
|
1363
|
-
* text: `Code: ${params.code}`,
|
|
1364
|
-
* html: `<h1>Code: ${params.code}</h1>`,
|
|
1365
|
-
* }),
|
|
1366
|
-
* });
|
|
1367
|
-
* ```
|
|
1368
|
-
*/
|
|
1369
|
-
interface EmailTemplateProvider {
|
|
1370
|
-
/**
|
|
1371
|
-
* Verification code email template
|
|
1372
|
-
*/
|
|
1373
|
-
verificationCode?(params: VerificationCodeParams): EmailTemplateResult;
|
|
1374
|
-
/**
|
|
1375
|
-
* Welcome email template (after registration)
|
|
1376
|
-
*/
|
|
1377
|
-
welcome?(params: {
|
|
1378
|
-
email: string;
|
|
1379
|
-
appName?: string;
|
|
1380
|
-
}): EmailTemplateResult;
|
|
1381
|
-
/**
|
|
1382
|
-
* Password reset email template
|
|
1383
|
-
*/
|
|
1384
|
-
passwordReset?(params: {
|
|
1385
|
-
resetLink: string;
|
|
1386
|
-
expiresInMinutes?: number;
|
|
1387
|
-
appName?: string;
|
|
1388
|
-
}): EmailTemplateResult;
|
|
1389
|
-
/**
|
|
1390
|
-
* Invitation email template
|
|
1391
|
-
*/
|
|
1392
|
-
invitation?(params: {
|
|
1393
|
-
inviteLink: string;
|
|
1394
|
-
inviterName?: string;
|
|
1395
|
-
roleName?: string;
|
|
1396
|
-
appName?: string;
|
|
1397
|
-
}): EmailTemplateResult;
|
|
1398
|
-
}
|
|
1399
|
-
|
|
1400
|
-
/**
|
|
1401
|
-
* @spfn/auth - Email Template Registry
|
|
1402
|
-
*
|
|
1403
|
-
* Manages custom email template registration and fallback to defaults
|
|
1404
|
-
*/
|
|
1405
|
-
|
|
1406
|
-
/**
|
|
1407
|
-
* Register custom email templates
|
|
1408
|
-
*
|
|
1409
|
-
* Templates not provided will fall back to defaults
|
|
1410
|
-
*
|
|
1411
|
-
* @param templates - Custom template implementations
|
|
1412
|
-
*
|
|
1413
|
-
* @example
|
|
1414
|
-
* ```typescript
|
|
1415
|
-
* import { registerEmailTemplates } from '@spfn/auth/server';
|
|
1416
|
-
*
|
|
1417
|
-
* // Override verification code template with custom design
|
|
1418
|
-
* registerEmailTemplates({
|
|
1419
|
-
* verificationCode: ({ code, purpose, expiresInMinutes }) => ({
|
|
1420
|
-
* subject: `[MyApp] Your verification code`,
|
|
1421
|
-
* text: `Your code is: ${code}`,
|
|
1422
|
-
* html: `
|
|
1423
|
-
* <div style="font-family: Arial;">
|
|
1424
|
-
* <h1>Welcome to MyApp!</h1>
|
|
1425
|
-
* <p>Your code: <strong>${code}</strong></p>
|
|
1426
|
-
* </div>
|
|
1427
|
-
* `,
|
|
1428
|
-
* }),
|
|
1429
|
-
* });
|
|
1430
|
-
* ```
|
|
1431
|
-
*/
|
|
1432
|
-
declare function registerEmailTemplates(templates: Partial<EmailTemplateProvider>): void;
|
|
1433
|
-
/**
|
|
1434
|
-
* Get verification code template
|
|
1435
|
-
*
|
|
1436
|
-
* Uses custom template if registered, otherwise falls back to default
|
|
1437
|
-
*/
|
|
1438
|
-
declare function getVerificationCodeTemplate(params: VerificationCodeParams): EmailTemplateResult;
|
|
1439
|
-
/**
|
|
1440
|
-
* Get welcome template
|
|
1441
|
-
*/
|
|
1442
|
-
declare function getWelcomeTemplate(params: {
|
|
1443
|
-
email: string;
|
|
1444
|
-
appName?: string;
|
|
1445
|
-
}): EmailTemplateResult;
|
|
1446
|
-
/**
|
|
1447
|
-
* Get password reset template
|
|
1448
|
-
*/
|
|
1449
|
-
declare function getPasswordResetTemplate(params: {
|
|
1450
|
-
resetLink: string;
|
|
1451
|
-
expiresInMinutes?: number;
|
|
1452
|
-
appName?: string;
|
|
1453
|
-
}): EmailTemplateResult;
|
|
1454
|
-
/**
|
|
1455
|
-
* Get invitation template
|
|
1456
|
-
*/
|
|
1457
|
-
declare function getInvitationTemplate(params: {
|
|
1458
|
-
inviteLink: string;
|
|
1459
|
-
inviterName?: string;
|
|
1460
|
-
roleName?: string;
|
|
1461
|
-
appName?: string;
|
|
1462
|
-
}): EmailTemplateResult;
|
|
1463
|
-
|
|
1464
|
-
/**
|
|
1465
|
-
* @spfn/auth - Email Service Types
|
|
1466
|
-
*
|
|
1467
|
-
* Type definitions for email sending service
|
|
1468
|
-
*/
|
|
1469
|
-
/**
|
|
1470
|
-
* Parameters for sending email
|
|
1471
|
-
*/
|
|
1472
|
-
interface SendEmailParams {
|
|
1473
|
-
/**
|
|
1474
|
-
* Recipient email address
|
|
1475
|
-
*/
|
|
1476
|
-
to: string;
|
|
1477
|
-
/**
|
|
1478
|
-
* Email subject
|
|
1479
|
-
*/
|
|
1480
|
-
subject: string;
|
|
1481
|
-
/**
|
|
1482
|
-
* Plain text content
|
|
1483
|
-
*/
|
|
1484
|
-
text?: string;
|
|
1485
|
-
/**
|
|
1486
|
-
* HTML content
|
|
1487
|
-
*/
|
|
1488
|
-
html?: string;
|
|
1489
|
-
/**
|
|
1490
|
-
* Purpose of the email (for logging)
|
|
1491
|
-
*/
|
|
1492
|
-
purpose?: string;
|
|
1493
|
-
}
|
|
1494
|
-
/**
|
|
1495
|
-
* Result of sending email
|
|
1496
|
-
*/
|
|
1497
|
-
interface SendEmailResult {
|
|
1498
|
-
/**
|
|
1499
|
-
* Whether email was sent successfully
|
|
1500
|
-
*/
|
|
1501
|
-
success: boolean;
|
|
1502
|
-
/**
|
|
1503
|
-
* Message ID from email provider (if successful)
|
|
1504
|
-
*/
|
|
1505
|
-
messageId?: string;
|
|
1506
|
-
/**
|
|
1507
|
-
* Error message (if failed)
|
|
1508
|
-
*/
|
|
1509
|
-
error?: string;
|
|
1510
|
-
}
|
|
1511
|
-
/**
|
|
1512
|
-
* Email Provider Interface
|
|
1513
|
-
*
|
|
1514
|
-
* Implement this interface to create custom email providers
|
|
1515
|
-
*
|
|
1516
|
-
* @example
|
|
1517
|
-
* ```typescript
|
|
1518
|
-
* import { EmailProvider, registerEmailProvider } from '@spfn/auth/server/services/email';
|
|
1519
|
-
*
|
|
1520
|
-
* const sendgridProvider: EmailProvider = {
|
|
1521
|
-
* name: 'sendgrid',
|
|
1522
|
-
* sendEmail: async (params) => {
|
|
1523
|
-
* // Your SendGrid implementation
|
|
1524
|
-
* return { success: true, messageId: '...' };
|
|
1525
|
-
* }
|
|
1526
|
-
* };
|
|
1527
|
-
*
|
|
1528
|
-
* registerEmailProvider(sendgridProvider);
|
|
1529
|
-
* ```
|
|
1530
|
-
*/
|
|
1531
|
-
interface EmailProvider {
|
|
1532
|
-
/**
|
|
1533
|
-
* Provider name (e.g., 'aws-ses', 'sendgrid', 'custom')
|
|
1534
|
-
*/
|
|
1535
|
-
name: string;
|
|
1536
|
-
/**
|
|
1537
|
-
* Send email via this provider
|
|
1538
|
-
*
|
|
1539
|
-
* @param params - Email parameters
|
|
1540
|
-
* @returns Send result
|
|
1541
|
-
*/
|
|
1542
|
-
sendEmail(params: SendEmailParams): Promise<SendEmailResult>;
|
|
1543
|
-
}
|
|
1544
|
-
|
|
1545
|
-
/**
|
|
1546
|
-
* @spfn/auth - Email Provider Management
|
|
1547
|
-
*
|
|
1548
|
-
* Manages email provider registration and fallback behavior
|
|
1549
|
-
*/
|
|
1550
|
-
|
|
1551
|
-
/**
|
|
1552
|
-
* Register a custom email provider
|
|
1553
|
-
*
|
|
1554
|
-
* @param provider - Custom email provider implementation
|
|
1555
|
-
*
|
|
1556
|
-
* @example
|
|
1557
|
-
* ```typescript
|
|
1558
|
-
* import { registerEmailProvider } from '@spfn/auth/server/services/email';
|
|
1559
|
-
*
|
|
1560
|
-
* const sendgridProvider = {
|
|
1561
|
-
* name: 'sendgrid',
|
|
1562
|
-
* sendEmail: async (params) => {
|
|
1563
|
-
* // SendGrid implementation
|
|
1564
|
-
* return { success: true, messageId: '...' };
|
|
1565
|
-
* }
|
|
1566
|
-
* };
|
|
1567
|
-
*
|
|
1568
|
-
* registerEmailProvider(sendgridProvider);
|
|
1569
|
-
* ```
|
|
1570
|
-
*/
|
|
1571
|
-
declare function registerEmailProvider(provider: EmailProvider): void;
|
|
1572
|
-
/**
|
|
1573
|
-
* Send email using the registered provider
|
|
1574
|
-
*
|
|
1575
|
-
* Falls back to development mode (console only) if no provider is registered
|
|
1576
|
-
*
|
|
1577
|
-
* @param params - Email parameters
|
|
1578
|
-
* @returns Send result
|
|
1579
|
-
*/
|
|
1580
|
-
declare function sendEmail(params: SendEmailParams): Promise<SendEmailResult>;
|
|
1581
|
-
|
|
1582
|
-
/**
|
|
1583
|
-
* @spfn/auth - SMS Service Types
|
|
1584
|
-
*
|
|
1585
|
-
* Type definitions for SMS sending service
|
|
1586
|
-
*/
|
|
1587
|
-
/**
|
|
1588
|
-
* Parameters for sending SMS
|
|
1589
|
-
*/
|
|
1590
|
-
interface SendSMSParams {
|
|
1591
|
-
/**
|
|
1592
|
-
* Phone number in E.164 format (e.g., +821012345678)
|
|
1593
|
-
*/
|
|
1594
|
-
phone: string;
|
|
1595
|
-
/**
|
|
1596
|
-
* SMS message content
|
|
1597
|
-
*/
|
|
1598
|
-
message: string;
|
|
1599
|
-
/**
|
|
1600
|
-
* Purpose of the SMS (for logging)
|
|
1601
|
-
*/
|
|
1602
|
-
purpose?: string;
|
|
1603
|
-
}
|
|
1604
|
-
/**
|
|
1605
|
-
* Result of sending SMS
|
|
1606
|
-
*/
|
|
1607
|
-
interface SendSMSResult {
|
|
1608
|
-
/**
|
|
1609
|
-
* Whether SMS was sent successfully
|
|
1610
|
-
*/
|
|
1611
|
-
success: boolean;
|
|
1612
|
-
/**
|
|
1613
|
-
* Message ID from SMS provider (if successful)
|
|
1614
|
-
*/
|
|
1615
|
-
messageId?: string;
|
|
1616
|
-
/**
|
|
1617
|
-
* Error message (if failed)
|
|
1618
|
-
*/
|
|
1619
|
-
error?: string;
|
|
1620
|
-
}
|
|
1621
|
-
/**
|
|
1622
|
-
* SMS Provider Interface
|
|
1623
|
-
*
|
|
1624
|
-
* Implement this interface to create custom SMS providers
|
|
1625
|
-
*
|
|
1626
|
-
* @example
|
|
1627
|
-
* ```typescript
|
|
1628
|
-
* import { SMSProvider, registerSMSProvider } from '@spfn/auth/server/services/sms';
|
|
1629
|
-
*
|
|
1630
|
-
* const twilioProvider: SMSProvider = {
|
|
1631
|
-
* name: 'twilio',
|
|
1632
|
-
* sendSMS: async (params) => {
|
|
1633
|
-
* // Your Twilio implementation
|
|
1634
|
-
* return { success: true, messageId: '...' };
|
|
1635
|
-
* }
|
|
1636
|
-
* };
|
|
1637
|
-
*
|
|
1638
|
-
* registerSMSProvider(twilioProvider);
|
|
1639
|
-
* ```
|
|
1640
|
-
*/
|
|
1641
|
-
interface SMSProvider {
|
|
1642
|
-
/**
|
|
1643
|
-
* Provider name (e.g., 'aws-sns', 'twilio', 'custom')
|
|
1644
|
-
*/
|
|
1645
|
-
name: string;
|
|
1646
|
-
/**
|
|
1647
|
-
* Send SMS via this provider
|
|
1648
|
-
*
|
|
1649
|
-
* @param params - SMS parameters
|
|
1650
|
-
* @returns Send result
|
|
1651
|
-
*/
|
|
1652
|
-
sendSMS(params: SendSMSParams): Promise<SendSMSResult>;
|
|
1653
|
-
}
|
|
1654
|
-
|
|
1655
|
-
/**
|
|
1656
|
-
* @spfn/auth - SMS Provider Management
|
|
1657
|
-
*
|
|
1658
|
-
* Manages SMS provider registration and fallback behavior
|
|
1659
|
-
*/
|
|
1660
|
-
|
|
1661
|
-
/**
|
|
1662
|
-
* Register a custom SMS provider
|
|
1663
|
-
*
|
|
1664
|
-
* @param provider - Custom SMS provider implementation
|
|
1665
|
-
*
|
|
1666
|
-
* @example
|
|
1667
|
-
* ```typescript
|
|
1668
|
-
* import { registerSMSProvider } from '@spfn/auth/server/services/sms';
|
|
1669
|
-
*
|
|
1670
|
-
* const twilioProvider = {
|
|
1671
|
-
* name: 'twilio',
|
|
1672
|
-
* sendSMS: async (params) => {
|
|
1673
|
-
* // Twilio implementation
|
|
1674
|
-
* return { success: true, messageId: '...' };
|
|
1675
|
-
* }
|
|
1676
|
-
* };
|
|
1677
|
-
*
|
|
1678
|
-
* registerSMSProvider(twilioProvider);
|
|
1679
|
-
* ```
|
|
1680
|
-
*/
|
|
1681
|
-
declare function registerSMSProvider(provider: SMSProvider): void;
|
|
1682
|
-
/**
|
|
1683
|
-
* Send SMS using the registered provider
|
|
1684
|
-
*
|
|
1685
|
-
* Falls back to development mode (console only) if no provider is registered
|
|
1686
|
-
*
|
|
1687
|
-
* @param params - SMS parameters
|
|
1688
|
-
* @returns Send result
|
|
1689
|
-
*/
|
|
1690
|
-
declare function sendSMS(params: SendSMSParams): Promise<SendSMSResult>;
|
|
1691
|
-
|
|
1692
1419
|
/**
|
|
1693
1420
|
* @spfn/auth - Database Schema Definition
|
|
1694
1421
|
*
|
|
@@ -1771,11 +1498,11 @@ declare const userProfiles: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1771
1498
|
name: `${string}_id`;
|
|
1772
1499
|
tableName: "user_profiles";
|
|
1773
1500
|
dataType: "number";
|
|
1774
|
-
columnType: "
|
|
1501
|
+
columnType: "PgBigInt53";
|
|
1775
1502
|
data: number;
|
|
1776
|
-
driverParam: number;
|
|
1503
|
+
driverParam: string | number;
|
|
1777
1504
|
notNull: true;
|
|
1778
|
-
hasDefault:
|
|
1505
|
+
hasDefault: false;
|
|
1779
1506
|
isPrimaryKey: false;
|
|
1780
1507
|
isAutoincrement: false;
|
|
1781
1508
|
hasRuntimeDefault: false;
|
|
@@ -1791,7 +1518,7 @@ declare const userProfiles: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
1791
1518
|
columnType: "PgText";
|
|
1792
1519
|
data: string;
|
|
1793
1520
|
driverParam: string;
|
|
1794
|
-
notNull:
|
|
1521
|
+
notNull: false;
|
|
1795
1522
|
hasDefault: false;
|
|
1796
1523
|
isPrimaryKey: false;
|
|
1797
1524
|
isAutoincrement: false;
|
|
@@ -2065,11 +1792,11 @@ declare const userPublicKeys: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
2065
1792
|
name: `${string}_id`;
|
|
2066
1793
|
tableName: "user_public_keys";
|
|
2067
1794
|
dataType: "number";
|
|
2068
|
-
columnType: "
|
|
1795
|
+
columnType: "PgBigInt53";
|
|
2069
1796
|
data: number;
|
|
2070
|
-
driverParam: number;
|
|
1797
|
+
driverParam: string | number;
|
|
2071
1798
|
notNull: true;
|
|
2072
|
-
hasDefault:
|
|
1799
|
+
hasDefault: false;
|
|
2073
1800
|
isPrimaryKey: false;
|
|
2074
1801
|
isAutoincrement: false;
|
|
2075
1802
|
hasRuntimeDefault: false;
|
|
@@ -2318,11 +2045,11 @@ declare const userSocialAccounts: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
2318
2045
|
name: `${string}_id`;
|
|
2319
2046
|
tableName: "user_social_accounts";
|
|
2320
2047
|
dataType: "number";
|
|
2321
|
-
columnType: "
|
|
2048
|
+
columnType: "PgBigInt53";
|
|
2322
2049
|
data: number;
|
|
2323
|
-
driverParam: number;
|
|
2050
|
+
driverParam: string | number;
|
|
2324
2051
|
notNull: true;
|
|
2325
|
-
hasDefault:
|
|
2052
|
+
hasDefault: false;
|
|
2326
2053
|
isPrimaryKey: false;
|
|
2327
2054
|
isAutoincrement: false;
|
|
2328
2055
|
hasRuntimeDefault: false;
|
|
@@ -2905,11 +2632,11 @@ declare const rolePermissions: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
2905
2632
|
name: `${string}_id`;
|
|
2906
2633
|
tableName: "role_permissions";
|
|
2907
2634
|
dataType: "number";
|
|
2908
|
-
columnType: "
|
|
2635
|
+
columnType: "PgBigInt53";
|
|
2909
2636
|
data: number;
|
|
2910
|
-
driverParam: number;
|
|
2637
|
+
driverParam: string | number;
|
|
2911
2638
|
notNull: true;
|
|
2912
|
-
hasDefault:
|
|
2639
|
+
hasDefault: false;
|
|
2913
2640
|
isPrimaryKey: false;
|
|
2914
2641
|
isAutoincrement: false;
|
|
2915
2642
|
hasRuntimeDefault: false;
|
|
@@ -2922,11 +2649,11 @@ declare const rolePermissions: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
2922
2649
|
name: `${string}_id`;
|
|
2923
2650
|
tableName: "role_permissions";
|
|
2924
2651
|
dataType: "number";
|
|
2925
|
-
columnType: "
|
|
2652
|
+
columnType: "PgBigInt53";
|
|
2926
2653
|
data: number;
|
|
2927
|
-
driverParam: number;
|
|
2654
|
+
driverParam: string | number;
|
|
2928
2655
|
notNull: true;
|
|
2929
|
-
hasDefault:
|
|
2656
|
+
hasDefault: false;
|
|
2930
2657
|
isPrimaryKey: false;
|
|
2931
2658
|
isAutoincrement: false;
|
|
2932
2659
|
hasRuntimeDefault: false;
|
|
@@ -3014,11 +2741,11 @@ declare const userPermissions: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
3014
2741
|
name: `${string}_id`;
|
|
3015
2742
|
tableName: "user_permissions";
|
|
3016
2743
|
dataType: "number";
|
|
3017
|
-
columnType: "
|
|
2744
|
+
columnType: "PgBigInt53";
|
|
3018
2745
|
data: number;
|
|
3019
|
-
driverParam: number;
|
|
2746
|
+
driverParam: string | number;
|
|
3020
2747
|
notNull: true;
|
|
3021
|
-
hasDefault:
|
|
2748
|
+
hasDefault: false;
|
|
3022
2749
|
isPrimaryKey: false;
|
|
3023
2750
|
isAutoincrement: false;
|
|
3024
2751
|
hasRuntimeDefault: false;
|
|
@@ -3031,11 +2758,11 @@ declare const userPermissions: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
3031
2758
|
name: `${string}_id`;
|
|
3032
2759
|
tableName: "user_permissions";
|
|
3033
2760
|
dataType: "number";
|
|
3034
|
-
columnType: "
|
|
2761
|
+
columnType: "PgBigInt53";
|
|
3035
2762
|
data: number;
|
|
3036
|
-
driverParam: number;
|
|
2763
|
+
driverParam: string | number;
|
|
3037
2764
|
notNull: true;
|
|
3038
|
-
hasDefault:
|
|
2765
|
+
hasDefault: false;
|
|
3039
2766
|
isPrimaryKey: false;
|
|
3040
2767
|
isAutoincrement: false;
|
|
3041
2768
|
hasRuntimeDefault: false;
|
|
@@ -3101,6 +2828,73 @@ declare const userPermissions: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
|
3101
2828
|
type UserPermission = typeof userPermissions.$inferSelect;
|
|
3102
2829
|
type NewUserPermission = typeof userPermissions.$inferInsert;
|
|
3103
2830
|
|
|
2831
|
+
/**
|
|
2832
|
+
* @spfn/auth - Auth Metadata Entity
|
|
2833
|
+
*
|
|
2834
|
+
* Key-value store for auth system metadata
|
|
2835
|
+
* Used for storing RBAC config hash and other system-level settings
|
|
2836
|
+
*/
|
|
2837
|
+
declare const authMetadata: drizzle_orm_pg_core.PgTableWithColumns<{
|
|
2838
|
+
name: "auth_metadata";
|
|
2839
|
+
schema: string;
|
|
2840
|
+
columns: {
|
|
2841
|
+
key: drizzle_orm_pg_core.PgColumn<{
|
|
2842
|
+
name: "key";
|
|
2843
|
+
tableName: "auth_metadata";
|
|
2844
|
+
dataType: "string";
|
|
2845
|
+
columnType: "PgText";
|
|
2846
|
+
data: string;
|
|
2847
|
+
driverParam: string;
|
|
2848
|
+
notNull: true;
|
|
2849
|
+
hasDefault: false;
|
|
2850
|
+
isPrimaryKey: true;
|
|
2851
|
+
isAutoincrement: false;
|
|
2852
|
+
hasRuntimeDefault: false;
|
|
2853
|
+
enumValues: [string, ...string[]];
|
|
2854
|
+
baseColumn: never;
|
|
2855
|
+
identity: undefined;
|
|
2856
|
+
generated: undefined;
|
|
2857
|
+
}, {}, {}>;
|
|
2858
|
+
value: drizzle_orm_pg_core.PgColumn<{
|
|
2859
|
+
name: "value";
|
|
2860
|
+
tableName: "auth_metadata";
|
|
2861
|
+
dataType: "string";
|
|
2862
|
+
columnType: "PgText";
|
|
2863
|
+
data: string;
|
|
2864
|
+
driverParam: string;
|
|
2865
|
+
notNull: true;
|
|
2866
|
+
hasDefault: false;
|
|
2867
|
+
isPrimaryKey: false;
|
|
2868
|
+
isAutoincrement: false;
|
|
2869
|
+
hasRuntimeDefault: false;
|
|
2870
|
+
enumValues: [string, ...string[]];
|
|
2871
|
+
baseColumn: never;
|
|
2872
|
+
identity: undefined;
|
|
2873
|
+
generated: undefined;
|
|
2874
|
+
}, {}, {}>;
|
|
2875
|
+
updatedAt: drizzle_orm_pg_core.PgColumn<{
|
|
2876
|
+
name: "updated_at";
|
|
2877
|
+
tableName: "auth_metadata";
|
|
2878
|
+
dataType: "date";
|
|
2879
|
+
columnType: "PgTimestamp";
|
|
2880
|
+
data: Date;
|
|
2881
|
+
driverParam: string;
|
|
2882
|
+
notNull: true;
|
|
2883
|
+
hasDefault: true;
|
|
2884
|
+
isPrimaryKey: false;
|
|
2885
|
+
isAutoincrement: false;
|
|
2886
|
+
hasRuntimeDefault: false;
|
|
2887
|
+
enumValues: undefined;
|
|
2888
|
+
baseColumn: never;
|
|
2889
|
+
identity: undefined;
|
|
2890
|
+
generated: undefined;
|
|
2891
|
+
}, {}, {}>;
|
|
2892
|
+
};
|
|
2893
|
+
dialect: "pg";
|
|
2894
|
+
}>;
|
|
2895
|
+
type AuthMetadataEntity = typeof authMetadata.$inferSelect;
|
|
2896
|
+
type NewAuthMetadataEntity = typeof authMetadata.$inferInsert;
|
|
2897
|
+
|
|
3104
2898
|
/**
|
|
3105
2899
|
* Users Repository
|
|
3106
2900
|
*
|
|
@@ -3125,8 +2919,10 @@ declare class UsersRepository extends BaseRepository {
|
|
|
3125
2919
|
createdAt: Date;
|
|
3126
2920
|
updatedAt: Date;
|
|
3127
2921
|
id: number;
|
|
2922
|
+
publicId: string;
|
|
3128
2923
|
email: string | null;
|
|
3129
2924
|
phone: string | null;
|
|
2925
|
+
username: string | null;
|
|
3130
2926
|
passwordHash: string | null;
|
|
3131
2927
|
passwordChangeRequired: boolean;
|
|
3132
2928
|
roleId: number;
|
|
@@ -3143,8 +2939,10 @@ declare class UsersRepository extends BaseRepository {
|
|
|
3143
2939
|
createdAt: Date;
|
|
3144
2940
|
updatedAt: Date;
|
|
3145
2941
|
id: number;
|
|
2942
|
+
publicId: string;
|
|
3146
2943
|
email: string | null;
|
|
3147
2944
|
phone: string | null;
|
|
2945
|
+
username: string | null;
|
|
3148
2946
|
passwordHash: string | null;
|
|
3149
2947
|
passwordChangeRequired: boolean;
|
|
3150
2948
|
roleId: number;
|
|
@@ -3161,8 +2959,50 @@ declare class UsersRepository extends BaseRepository {
|
|
|
3161
2959
|
createdAt: Date;
|
|
3162
2960
|
updatedAt: Date;
|
|
3163
2961
|
id: number;
|
|
2962
|
+
publicId: string;
|
|
2963
|
+
email: string | null;
|
|
2964
|
+
phone: string | null;
|
|
2965
|
+
username: string | null;
|
|
2966
|
+
passwordHash: string | null;
|
|
2967
|
+
passwordChangeRequired: boolean;
|
|
2968
|
+
roleId: number;
|
|
2969
|
+
status: "active" | "inactive" | "suspended";
|
|
2970
|
+
emailVerifiedAt: Date | null;
|
|
2971
|
+
phoneVerifiedAt: Date | null;
|
|
2972
|
+
lastLoginAt: Date | null;
|
|
2973
|
+
}>;
|
|
2974
|
+
/**
|
|
2975
|
+
* 사용자명으로 사용자 조회
|
|
2976
|
+
* Read replica 사용
|
|
2977
|
+
*/
|
|
2978
|
+
findByUsername(username: string): Promise<{
|
|
2979
|
+
createdAt: Date;
|
|
2980
|
+
updatedAt: Date;
|
|
2981
|
+
id: number;
|
|
2982
|
+
publicId: string;
|
|
3164
2983
|
email: string | null;
|
|
3165
2984
|
phone: string | null;
|
|
2985
|
+
username: string | null;
|
|
2986
|
+
passwordHash: string | null;
|
|
2987
|
+
passwordChangeRequired: boolean;
|
|
2988
|
+
roleId: number;
|
|
2989
|
+
status: "active" | "inactive" | "suspended";
|
|
2990
|
+
emailVerifiedAt: Date | null;
|
|
2991
|
+
phoneVerifiedAt: Date | null;
|
|
2992
|
+
lastLoginAt: Date | null;
|
|
2993
|
+
}>;
|
|
2994
|
+
/**
|
|
2995
|
+
* Public ID(UUID)로 사용자 조회
|
|
2996
|
+
* Read replica 사용
|
|
2997
|
+
*/
|
|
2998
|
+
findByPublicId(publicId: string): Promise<{
|
|
2999
|
+
createdAt: Date;
|
|
3000
|
+
updatedAt: Date;
|
|
3001
|
+
id: number;
|
|
3002
|
+
publicId: string;
|
|
3003
|
+
email: string | null;
|
|
3004
|
+
phone: string | null;
|
|
3005
|
+
username: string | null;
|
|
3166
3006
|
passwordHash: string | null;
|
|
3167
3007
|
passwordChangeRequired: boolean;
|
|
3168
3008
|
roleId: number;
|
|
@@ -3179,8 +3019,10 @@ declare class UsersRepository extends BaseRepository {
|
|
|
3179
3019
|
createdAt: Date;
|
|
3180
3020
|
updatedAt: Date;
|
|
3181
3021
|
id: number;
|
|
3022
|
+
publicId: string;
|
|
3182
3023
|
email: string | null;
|
|
3183
3024
|
phone: string | null;
|
|
3025
|
+
username: string | null;
|
|
3184
3026
|
passwordHash: string | null;
|
|
3185
3027
|
passwordChangeRequired: boolean;
|
|
3186
3028
|
roleId: number;
|
|
@@ -3189,6 +3031,35 @@ declare class UsersRepository extends BaseRepository {
|
|
|
3189
3031
|
phoneVerifiedAt: Date | null;
|
|
3190
3032
|
lastLoginAt: Date | null;
|
|
3191
3033
|
} | null>;
|
|
3034
|
+
/**
|
|
3035
|
+
* ID로 사용자 + Role 조회 (leftJoin)
|
|
3036
|
+
* Read replica 사용
|
|
3037
|
+
*
|
|
3038
|
+
* roleId가 null인 유저는 role: null 반환
|
|
3039
|
+
*/
|
|
3040
|
+
findByIdWithRole(id: number): Promise<{
|
|
3041
|
+
user: {
|
|
3042
|
+
createdAt: Date;
|
|
3043
|
+
updatedAt: Date;
|
|
3044
|
+
id: number;
|
|
3045
|
+
publicId: string;
|
|
3046
|
+
email: string | null;
|
|
3047
|
+
phone: string | null;
|
|
3048
|
+
username: string | null;
|
|
3049
|
+
passwordHash: string | null;
|
|
3050
|
+
passwordChangeRequired: boolean;
|
|
3051
|
+
roleId: number;
|
|
3052
|
+
status: "active" | "inactive" | "suspended";
|
|
3053
|
+
emailVerifiedAt: Date | null;
|
|
3054
|
+
phoneVerifiedAt: Date | null;
|
|
3055
|
+
lastLoginAt: Date | null;
|
|
3056
|
+
};
|
|
3057
|
+
role: {
|
|
3058
|
+
name: string;
|
|
3059
|
+
displayName: string;
|
|
3060
|
+
priority: number;
|
|
3061
|
+
} | null;
|
|
3062
|
+
} | null>;
|
|
3192
3063
|
/**
|
|
3193
3064
|
* 사용자 생성
|
|
3194
3065
|
* Write primary 사용
|
|
@@ -3197,6 +3068,8 @@ declare class UsersRepository extends BaseRepository {
|
|
|
3197
3068
|
email: string | null;
|
|
3198
3069
|
phone: string | null;
|
|
3199
3070
|
id: number;
|
|
3071
|
+
publicId: string;
|
|
3072
|
+
username: string | null;
|
|
3200
3073
|
passwordHash: string | null;
|
|
3201
3074
|
passwordChangeRequired: boolean;
|
|
3202
3075
|
roleId: number;
|
|
@@ -3215,8 +3088,10 @@ declare class UsersRepository extends BaseRepository {
|
|
|
3215
3088
|
createdAt: Date;
|
|
3216
3089
|
updatedAt: Date;
|
|
3217
3090
|
id: number;
|
|
3091
|
+
publicId: string;
|
|
3218
3092
|
email: string | null;
|
|
3219
3093
|
phone: string | null;
|
|
3094
|
+
username: string | null;
|
|
3220
3095
|
passwordHash: string | null;
|
|
3221
3096
|
passwordChangeRequired: boolean;
|
|
3222
3097
|
roleId: number;
|
|
@@ -3233,8 +3108,10 @@ declare class UsersRepository extends BaseRepository {
|
|
|
3233
3108
|
createdAt: Date;
|
|
3234
3109
|
updatedAt: Date;
|
|
3235
3110
|
id: number;
|
|
3111
|
+
publicId: string;
|
|
3236
3112
|
email: string | null;
|
|
3237
3113
|
phone: string | null;
|
|
3114
|
+
username: string | null;
|
|
3238
3115
|
passwordHash: string | null;
|
|
3239
3116
|
passwordChangeRequired: boolean;
|
|
3240
3117
|
roleId: number;
|
|
@@ -3251,8 +3128,10 @@ declare class UsersRepository extends BaseRepository {
|
|
|
3251
3128
|
createdAt: Date;
|
|
3252
3129
|
updatedAt: Date;
|
|
3253
3130
|
id: number;
|
|
3131
|
+
publicId: string;
|
|
3254
3132
|
email: string | null;
|
|
3255
3133
|
phone: string | null;
|
|
3134
|
+
username: string | null;
|
|
3256
3135
|
passwordHash: string | null;
|
|
3257
3136
|
passwordChangeRequired: boolean;
|
|
3258
3137
|
roleId: number;
|
|
@@ -3269,6 +3148,8 @@ declare class UsersRepository extends BaseRepository {
|
|
|
3269
3148
|
email: string | null;
|
|
3270
3149
|
phone: string | null;
|
|
3271
3150
|
id: number;
|
|
3151
|
+
publicId: string;
|
|
3152
|
+
username: string | null;
|
|
3272
3153
|
passwordHash: string | null;
|
|
3273
3154
|
passwordChangeRequired: boolean;
|
|
3274
3155
|
roleId: number;
|
|
@@ -3309,9 +3190,12 @@ declare class UsersRepository extends BaseRepository {
|
|
|
3309
3190
|
*/
|
|
3310
3191
|
fetchMinimalUserData(userId: number): Promise<{
|
|
3311
3192
|
userId: number;
|
|
3193
|
+
publicId: string;
|
|
3312
3194
|
email: string | null;
|
|
3195
|
+
username: string | null;
|
|
3313
3196
|
isEmailVerified: boolean;
|
|
3314
3197
|
isPhoneVerified: boolean;
|
|
3198
|
+
hasPassword: boolean;
|
|
3315
3199
|
}>;
|
|
3316
3200
|
/**
|
|
3317
3201
|
* Full user data 조회 (user profile용)
|
|
@@ -3322,7 +3206,9 @@ declare class UsersRepository extends BaseRepository {
|
|
|
3322
3206
|
*/
|
|
3323
3207
|
fetchFullUserData(userId: number): Promise<{
|
|
3324
3208
|
userId: number;
|
|
3209
|
+
publicId: string;
|
|
3325
3210
|
email: string | null;
|
|
3211
|
+
username: string | null;
|
|
3326
3212
|
isEmailVerified: boolean;
|
|
3327
3213
|
isPhoneVerified: boolean;
|
|
3328
3214
|
lastLoginAt: Date | null;
|
|
@@ -3830,6 +3716,7 @@ declare class PermissionsRepository extends BaseRepository {
|
|
|
3830
3716
|
*/
|
|
3831
3717
|
deleteById(id: number): Promise<{
|
|
3832
3718
|
description: string | null;
|
|
3719
|
+
metadata: Record<string, any> | null;
|
|
3833
3720
|
id: number;
|
|
3834
3721
|
name: string;
|
|
3835
3722
|
displayName: string;
|
|
@@ -3839,7 +3726,6 @@ declare class PermissionsRepository extends BaseRepository {
|
|
|
3839
3726
|
createdAt: Date;
|
|
3840
3727
|
updatedAt: Date;
|
|
3841
3728
|
category: "auth" | "custom" | "user" | "rbac" | "system" | null;
|
|
3842
|
-
metadata: Record<string, any> | null;
|
|
3843
3729
|
}>;
|
|
3844
3730
|
}
|
|
3845
3731
|
declare const permissionsRepository: PermissionsRepository;
|
|
@@ -4030,7 +3916,7 @@ declare class UserProfilesRepository extends BaseRepository {
|
|
|
4030
3916
|
updatedAt: Date;
|
|
4031
3917
|
id: number;
|
|
4032
3918
|
userId: number;
|
|
4033
|
-
displayName: string;
|
|
3919
|
+
displayName: string | null;
|
|
4034
3920
|
firstName: string | null;
|
|
4035
3921
|
lastName: string | null;
|
|
4036
3922
|
avatarUrl: string | null;
|
|
@@ -4045,6 +3931,10 @@ declare class UserProfilesRepository extends BaseRepository {
|
|
|
4045
3931
|
jobTitle: string | null;
|
|
4046
3932
|
metadata: Record<string, any> | null;
|
|
4047
3933
|
}>;
|
|
3934
|
+
/**
|
|
3935
|
+
* User ID로 locale만 조회 (경량)
|
|
3936
|
+
*/
|
|
3937
|
+
findLocaleByUserId(userId: number): Promise<string>;
|
|
4048
3938
|
/**
|
|
4049
3939
|
* User ID로 프로필 조회
|
|
4050
3940
|
*/
|
|
@@ -4053,7 +3943,7 @@ declare class UserProfilesRepository extends BaseRepository {
|
|
|
4053
3943
|
updatedAt: Date;
|
|
4054
3944
|
id: number;
|
|
4055
3945
|
userId: number;
|
|
4056
|
-
displayName: string;
|
|
3946
|
+
displayName: string | null;
|
|
4057
3947
|
firstName: string | null;
|
|
4058
3948
|
lastName: string | null;
|
|
4059
3949
|
avatarUrl: string | null;
|
|
@@ -4072,12 +3962,12 @@ declare class UserProfilesRepository extends BaseRepository {
|
|
|
4072
3962
|
* 프로필 생성
|
|
4073
3963
|
*/
|
|
4074
3964
|
create(data: NewUserProfile): Promise<{
|
|
3965
|
+
metadata: Record<string, any> | null;
|
|
4075
3966
|
userId: number;
|
|
4076
3967
|
id: number;
|
|
4077
|
-
displayName: string;
|
|
3968
|
+
displayName: string | null;
|
|
4078
3969
|
createdAt: Date;
|
|
4079
3970
|
updatedAt: Date;
|
|
4080
|
-
metadata: Record<string, any> | null;
|
|
4081
3971
|
firstName: string | null;
|
|
4082
3972
|
lastName: string | null;
|
|
4083
3973
|
avatarUrl: string | null;
|
|
@@ -4099,7 +3989,7 @@ declare class UserProfilesRepository extends BaseRepository {
|
|
|
4099
3989
|
updatedAt: Date;
|
|
4100
3990
|
id: number;
|
|
4101
3991
|
userId: number;
|
|
4102
|
-
displayName: string;
|
|
3992
|
+
displayName: string | null;
|
|
4103
3993
|
firstName: string | null;
|
|
4104
3994
|
lastName: string | null;
|
|
4105
3995
|
avatarUrl: string | null;
|
|
@@ -4122,7 +4012,7 @@ declare class UserProfilesRepository extends BaseRepository {
|
|
|
4122
4012
|
updatedAt: Date;
|
|
4123
4013
|
id: number;
|
|
4124
4014
|
userId: number;
|
|
4125
|
-
displayName: string;
|
|
4015
|
+
displayName: string | null;
|
|
4126
4016
|
firstName: string | null;
|
|
4127
4017
|
lastName: string | null;
|
|
4128
4018
|
avatarUrl: string | null;
|
|
@@ -4141,12 +4031,12 @@ declare class UserProfilesRepository extends BaseRepository {
|
|
|
4141
4031
|
* 프로필 삭제 (by ID)
|
|
4142
4032
|
*/
|
|
4143
4033
|
deleteById(id: number): Promise<{
|
|
4034
|
+
metadata: Record<string, any> | null;
|
|
4144
4035
|
userId: number;
|
|
4145
4036
|
id: number;
|
|
4146
|
-
displayName: string;
|
|
4037
|
+
displayName: string | null;
|
|
4147
4038
|
createdAt: Date;
|
|
4148
4039
|
updatedAt: Date;
|
|
4149
|
-
metadata: Record<string, any> | null;
|
|
4150
4040
|
firstName: string | null;
|
|
4151
4041
|
lastName: string | null;
|
|
4152
4042
|
avatarUrl: string | null;
|
|
@@ -4164,12 +4054,12 @@ declare class UserProfilesRepository extends BaseRepository {
|
|
|
4164
4054
|
* 프로필 삭제 (by User ID)
|
|
4165
4055
|
*/
|
|
4166
4056
|
deleteByUserId(userId: number): Promise<{
|
|
4057
|
+
metadata: Record<string, any> | null;
|
|
4167
4058
|
userId: number;
|
|
4168
4059
|
id: number;
|
|
4169
|
-
displayName: string;
|
|
4060
|
+
displayName: string | null;
|
|
4170
4061
|
createdAt: Date;
|
|
4171
4062
|
updatedAt: Date;
|
|
4172
|
-
metadata: Record<string, any> | null;
|
|
4173
4063
|
firstName: string | null;
|
|
4174
4064
|
lastName: string | null;
|
|
4175
4065
|
avatarUrl: string | null;
|
|
@@ -4190,12 +4080,12 @@ declare class UserProfilesRepository extends BaseRepository {
|
|
|
4190
4080
|
* 새로 생성 시 displayName은 필수 (없으면 'User'로 설정)
|
|
4191
4081
|
*/
|
|
4192
4082
|
upsertByUserId(userId: number, data: Partial<Omit<NewUserProfile, 'userId'>>): Promise<{
|
|
4083
|
+
metadata: Record<string, any> | null;
|
|
4193
4084
|
userId: number;
|
|
4194
4085
|
id: number;
|
|
4195
|
-
displayName: string;
|
|
4086
|
+
displayName: string | null;
|
|
4196
4087
|
createdAt: Date;
|
|
4197
4088
|
updatedAt: Date;
|
|
4198
|
-
metadata: Record<string, any> | null;
|
|
4199
4089
|
firstName: string | null;
|
|
4200
4090
|
lastName: string | null;
|
|
4201
4091
|
avatarUrl: string | null;
|
|
@@ -4216,7 +4106,7 @@ declare class UserProfilesRepository extends BaseRepository {
|
|
|
4216
4106
|
*/
|
|
4217
4107
|
fetchProfileData(userId: number): Promise<{
|
|
4218
4108
|
profileId: number;
|
|
4219
|
-
displayName: string;
|
|
4109
|
+
displayName: string | null;
|
|
4220
4110
|
firstName: string | null;
|
|
4221
4111
|
lastName: string | null;
|
|
4222
4112
|
avatarUrl: string | null;
|
|
@@ -4335,12 +4225,12 @@ declare class InvitationsRepository extends BaseRepository {
|
|
|
4335
4225
|
*/
|
|
4336
4226
|
create(data: NewInvitation): Promise<{
|
|
4337
4227
|
email: string;
|
|
4228
|
+
metadata: Record<string, any> | null;
|
|
4338
4229
|
id: number;
|
|
4339
4230
|
roleId: number;
|
|
4340
4231
|
createdAt: Date;
|
|
4341
4232
|
updatedAt: Date;
|
|
4342
4233
|
status: "pending" | "accepted" | "expired" | "cancelled";
|
|
4343
|
-
metadata: Record<string, any> | null;
|
|
4344
4234
|
token: string;
|
|
4345
4235
|
invitedBy: number;
|
|
4346
4236
|
expiresAt: Date;
|
|
@@ -4369,12 +4259,12 @@ declare class InvitationsRepository extends BaseRepository {
|
|
|
4369
4259
|
*/
|
|
4370
4260
|
deleteById(id: number): Promise<{
|
|
4371
4261
|
email: string;
|
|
4262
|
+
metadata: Record<string, any> | null;
|
|
4372
4263
|
id: number;
|
|
4373
4264
|
roleId: number;
|
|
4374
4265
|
createdAt: Date;
|
|
4375
4266
|
updatedAt: Date;
|
|
4376
4267
|
status: "pending" | "accepted" | "expired" | "cancelled";
|
|
4377
|
-
metadata: Record<string, any> | null;
|
|
4378
4268
|
token: string;
|
|
4379
4269
|
invitedBy: number;
|
|
4380
4270
|
expiresAt: Date;
|
|
@@ -4502,6 +4392,155 @@ declare class InvitationsRepository extends BaseRepository {
|
|
|
4502
4392
|
}
|
|
4503
4393
|
declare const invitationsRepository: InvitationsRepository;
|
|
4504
4394
|
|
|
4395
|
+
/**
|
|
4396
|
+
* Social Accounts Repository
|
|
4397
|
+
*
|
|
4398
|
+
* OAuth 소셜 계정 데이터 관리를 위한 Repository
|
|
4399
|
+
* BaseRepository를 상속받아 자동 트랜잭션 컨텍스트 지원 및 Read/Write 분리
|
|
4400
|
+
*/
|
|
4401
|
+
|
|
4402
|
+
/**
|
|
4403
|
+
* Social Accounts Repository 클래스
|
|
4404
|
+
*/
|
|
4405
|
+
declare class SocialAccountsRepository extends BaseRepository {
|
|
4406
|
+
/**
|
|
4407
|
+
* provider와 providerUserId로 소셜 계정 조회
|
|
4408
|
+
* Read replica 사용
|
|
4409
|
+
*/
|
|
4410
|
+
findByProviderAndProviderId(provider: SocialProvider, providerUserId: string): Promise<{
|
|
4411
|
+
createdAt: Date;
|
|
4412
|
+
updatedAt: Date;
|
|
4413
|
+
id: number;
|
|
4414
|
+
userId: number;
|
|
4415
|
+
provider: "google" | "github" | "kakao" | "naver";
|
|
4416
|
+
providerUserId: string;
|
|
4417
|
+
providerEmail: string | null;
|
|
4418
|
+
accessToken: string | null;
|
|
4419
|
+
refreshToken: string | null;
|
|
4420
|
+
tokenExpiresAt: Date | null;
|
|
4421
|
+
}>;
|
|
4422
|
+
/**
|
|
4423
|
+
* userId로 모든 소셜 계정 조회
|
|
4424
|
+
* Read replica 사용
|
|
4425
|
+
*/
|
|
4426
|
+
findByUserId(userId: number): Promise<{
|
|
4427
|
+
createdAt: Date;
|
|
4428
|
+
updatedAt: Date;
|
|
4429
|
+
id: number;
|
|
4430
|
+
userId: number;
|
|
4431
|
+
provider: "google" | "github" | "kakao" | "naver";
|
|
4432
|
+
providerUserId: string;
|
|
4433
|
+
providerEmail: string | null;
|
|
4434
|
+
accessToken: string | null;
|
|
4435
|
+
refreshToken: string | null;
|
|
4436
|
+
tokenExpiresAt: Date | null;
|
|
4437
|
+
}[]>;
|
|
4438
|
+
/**
|
|
4439
|
+
* userId와 provider로 소셜 계정 조회
|
|
4440
|
+
* Read replica 사용
|
|
4441
|
+
*/
|
|
4442
|
+
findByUserIdAndProvider(userId: number, provider: SocialProvider): Promise<{
|
|
4443
|
+
createdAt: Date;
|
|
4444
|
+
updatedAt: Date;
|
|
4445
|
+
id: number;
|
|
4446
|
+
userId: number;
|
|
4447
|
+
provider: "google" | "github" | "kakao" | "naver";
|
|
4448
|
+
providerUserId: string;
|
|
4449
|
+
providerEmail: string | null;
|
|
4450
|
+
accessToken: string | null;
|
|
4451
|
+
refreshToken: string | null;
|
|
4452
|
+
tokenExpiresAt: Date | null;
|
|
4453
|
+
}>;
|
|
4454
|
+
/**
|
|
4455
|
+
* 소셜 계정 생성
|
|
4456
|
+
* Write primary 사용
|
|
4457
|
+
*/
|
|
4458
|
+
create(data: NewUserSocialAccount): Promise<{
|
|
4459
|
+
userId: number;
|
|
4460
|
+
id: number;
|
|
4461
|
+
createdAt: Date;
|
|
4462
|
+
updatedAt: Date;
|
|
4463
|
+
provider: "google" | "github" | "kakao" | "naver";
|
|
4464
|
+
providerUserId: string;
|
|
4465
|
+
providerEmail: string | null;
|
|
4466
|
+
accessToken: string | null;
|
|
4467
|
+
refreshToken: string | null;
|
|
4468
|
+
tokenExpiresAt: Date | null;
|
|
4469
|
+
}>;
|
|
4470
|
+
/**
|
|
4471
|
+
* 토큰 정보 업데이트
|
|
4472
|
+
* Write primary 사용
|
|
4473
|
+
*/
|
|
4474
|
+
updateTokens(id: number, data: {
|
|
4475
|
+
accessToken?: string | null;
|
|
4476
|
+
refreshToken?: string | null;
|
|
4477
|
+
tokenExpiresAt?: Date | null;
|
|
4478
|
+
}): Promise<{
|
|
4479
|
+
createdAt: Date;
|
|
4480
|
+
updatedAt: Date;
|
|
4481
|
+
id: number;
|
|
4482
|
+
userId: number;
|
|
4483
|
+
provider: "google" | "github" | "kakao" | "naver";
|
|
4484
|
+
providerUserId: string;
|
|
4485
|
+
providerEmail: string | null;
|
|
4486
|
+
accessToken: string | null;
|
|
4487
|
+
refreshToken: string | null;
|
|
4488
|
+
tokenExpiresAt: Date | null;
|
|
4489
|
+
}>;
|
|
4490
|
+
/**
|
|
4491
|
+
* 소셜 계정 삭제
|
|
4492
|
+
* Write primary 사용
|
|
4493
|
+
*/
|
|
4494
|
+
deleteById(id: number): Promise<{
|
|
4495
|
+
userId: number;
|
|
4496
|
+
id: number;
|
|
4497
|
+
createdAt: Date;
|
|
4498
|
+
updatedAt: Date;
|
|
4499
|
+
provider: "google" | "github" | "kakao" | "naver";
|
|
4500
|
+
providerUserId: string;
|
|
4501
|
+
providerEmail: string | null;
|
|
4502
|
+
accessToken: string | null;
|
|
4503
|
+
refreshToken: string | null;
|
|
4504
|
+
tokenExpiresAt: Date | null;
|
|
4505
|
+
}>;
|
|
4506
|
+
/**
|
|
4507
|
+
* userId와 provider로 소셜 계정 삭제
|
|
4508
|
+
* Write primary 사용
|
|
4509
|
+
*/
|
|
4510
|
+
deleteByUserIdAndProvider(userId: number, provider: SocialProvider): Promise<{
|
|
4511
|
+
userId: number;
|
|
4512
|
+
id: number;
|
|
4513
|
+
createdAt: Date;
|
|
4514
|
+
updatedAt: Date;
|
|
4515
|
+
provider: "google" | "github" | "kakao" | "naver";
|
|
4516
|
+
providerUserId: string;
|
|
4517
|
+
providerEmail: string | null;
|
|
4518
|
+
accessToken: string | null;
|
|
4519
|
+
refreshToken: string | null;
|
|
4520
|
+
tokenExpiresAt: Date | null;
|
|
4521
|
+
}>;
|
|
4522
|
+
}
|
|
4523
|
+
declare const socialAccountsRepository: SocialAccountsRepository;
|
|
4524
|
+
|
|
4525
|
+
/**
|
|
4526
|
+
* Auth Metadata Repository
|
|
4527
|
+
*
|
|
4528
|
+
* Key-value 기반 시스템 메타데이터 저장소
|
|
4529
|
+
* RBAC 설정 해시 등 시스템 설정값 관리
|
|
4530
|
+
*/
|
|
4531
|
+
|
|
4532
|
+
declare class AuthMetadataRepository extends BaseRepository {
|
|
4533
|
+
/**
|
|
4534
|
+
* 키로 값 조회
|
|
4535
|
+
*/
|
|
4536
|
+
get(key: string): Promise<string | null>;
|
|
4537
|
+
/**
|
|
4538
|
+
* 키-값 저장 (upsert)
|
|
4539
|
+
*/
|
|
4540
|
+
set(key: string, value: string): Promise<void>;
|
|
4541
|
+
}
|
|
4542
|
+
declare const authMetadataRepository: AuthMetadataRepository;
|
|
4543
|
+
|
|
4505
4544
|
/**
|
|
4506
4545
|
* @spfn/auth - Password Helpers
|
|
4507
4546
|
*
|
|
@@ -4846,6 +4885,29 @@ interface RoleGuardOptions {
|
|
|
4846
4885
|
*/
|
|
4847
4886
|
declare const roleGuard: _spfn_core_route.NamedMiddlewareFactory<"roleGuard", [options: RoleGuardOptions]>;
|
|
4848
4887
|
|
|
4888
|
+
/**
|
|
4889
|
+
* One-Time Token Authentication Middleware
|
|
4890
|
+
*
|
|
4891
|
+
* Authenticates requests using a one-time token instead of JWT.
|
|
4892
|
+
* Extracts token from query parameter `?token=xxx` or `Authorization: OTT xxx` header.
|
|
4893
|
+
*
|
|
4894
|
+
* On success, injects AuthContext identical to the `authenticate` middleware,
|
|
4895
|
+
* making it transparent to downstream handlers using `getAuth(c)`.
|
|
4896
|
+
*
|
|
4897
|
+
* Auto-skips the global 'auth' middleware.
|
|
4898
|
+
*
|
|
4899
|
+
* @example
|
|
4900
|
+
* ```typescript
|
|
4901
|
+
* export const uploadFile = route.post('/files/upload')
|
|
4902
|
+
* .use([oneTimeTokenAuth])
|
|
4903
|
+
* .handler(async (c) => {
|
|
4904
|
+
* const { userId } = getAuth(c);
|
|
4905
|
+
* // handle file upload...
|
|
4906
|
+
* });
|
|
4907
|
+
* ```
|
|
4908
|
+
*/
|
|
4909
|
+
declare const oneTimeTokenAuth: _spfn_core_route.NamedMiddleware<"oneTimeTokenAuth">;
|
|
4910
|
+
|
|
4849
4911
|
/**
|
|
4850
4912
|
* Auth Context Helpers
|
|
4851
4913
|
*
|
|
@@ -4872,6 +4934,32 @@ declare const roleGuard: _spfn_core_route.NamedMiddlewareFactory<"roleGuard", [o
|
|
|
4872
4934
|
declare function getAuth(c: Context | {
|
|
4873
4935
|
raw: Context;
|
|
4874
4936
|
}): AuthContext;
|
|
4937
|
+
/**
|
|
4938
|
+
* Get optional auth context from route context
|
|
4939
|
+
*
|
|
4940
|
+
* Returns AuthContext if authenticated, undefined otherwise.
|
|
4941
|
+
* Use with `optionalAuth` middleware for routes that serve both
|
|
4942
|
+
* authenticated and unauthenticated users.
|
|
4943
|
+
*
|
|
4944
|
+
* @example
|
|
4945
|
+
* ```typescript
|
|
4946
|
+
* export const getProducts = route.get('/products')
|
|
4947
|
+
* .use([optionalAuth])
|
|
4948
|
+
* .handler(async (c) => {
|
|
4949
|
+
* const auth = getOptionalAuth(c);
|
|
4950
|
+
*
|
|
4951
|
+
* if (auth)
|
|
4952
|
+
* {
|
|
4953
|
+
* return getPersonalizedProducts(auth.userId);
|
|
4954
|
+
* }
|
|
4955
|
+
*
|
|
4956
|
+
* return getPublicProducts();
|
|
4957
|
+
* });
|
|
4958
|
+
* ```
|
|
4959
|
+
*/
|
|
4960
|
+
declare function getOptionalAuth(c: Context | {
|
|
4961
|
+
raw: Context;
|
|
4962
|
+
}): AuthContext | undefined;
|
|
4875
4963
|
/**
|
|
4876
4964
|
* Get authenticated user from route context
|
|
4877
4965
|
*
|
|
@@ -4889,6 +4977,8 @@ declare function getUser(c: Context | {
|
|
|
4889
4977
|
email: string | null;
|
|
4890
4978
|
phone: string | null;
|
|
4891
4979
|
id: number;
|
|
4980
|
+
publicId: string;
|
|
4981
|
+
username: string | null;
|
|
4892
4982
|
passwordHash: string | null;
|
|
4893
4983
|
passwordChangeRequired: boolean;
|
|
4894
4984
|
roleId: number;
|
|
@@ -4913,6 +5003,38 @@ declare function getUser(c: Context | {
|
|
|
4913
5003
|
declare function getUserId(c: Context | {
|
|
4914
5004
|
raw: Context;
|
|
4915
5005
|
}): string;
|
|
5006
|
+
/**
|
|
5007
|
+
* Get authenticated user's role from route context
|
|
5008
|
+
*
|
|
5009
|
+
* @returns Role name or null if user has no role
|
|
5010
|
+
*
|
|
5011
|
+
* @example
|
|
5012
|
+
* ```typescript
|
|
5013
|
+
* app.bind(adminContract, [authenticate], async (c) => {
|
|
5014
|
+
* const role = getRole(c);
|
|
5015
|
+
* // 'admin' | 'superadmin' | null
|
|
5016
|
+
* });
|
|
5017
|
+
* ```
|
|
5018
|
+
*/
|
|
5019
|
+
declare function getRole(c: Context | {
|
|
5020
|
+
raw: Context;
|
|
5021
|
+
}): string | null;
|
|
5022
|
+
/**
|
|
5023
|
+
* Get authenticated user's locale from route context
|
|
5024
|
+
*
|
|
5025
|
+
* @returns Locale string (e.g., 'en', 'ko')
|
|
5026
|
+
*
|
|
5027
|
+
* @example
|
|
5028
|
+
* ```typescript
|
|
5029
|
+
* app.bind(contract, [authenticate], async (c) => {
|
|
5030
|
+
* const locale = getLocale(c);
|
|
5031
|
+
* // 'en' | 'ko' | ...
|
|
5032
|
+
* });
|
|
5033
|
+
* ```
|
|
5034
|
+
*/
|
|
5035
|
+
declare function getLocale(c: Context | {
|
|
5036
|
+
raw: Context;
|
|
5037
|
+
}): string;
|
|
4916
5038
|
/**
|
|
4917
5039
|
* Get current key ID from route context
|
|
4918
5040
|
*
|
|
@@ -4985,56 +5107,6 @@ declare function shouldRotateKey(createdAt: Date, rotationDays?: number): {
|
|
|
4985
5107
|
daysRemaining: number;
|
|
4986
5108
|
};
|
|
4987
5109
|
|
|
4988
|
-
/**
|
|
4989
|
-
* @spfn/auth - Client Session Management
|
|
4990
|
-
*
|
|
4991
|
-
* Uses Jose JWE (JSON Web Encryption) to securely store session data in cookies
|
|
4992
|
-
* More efficient than Iron Session with better Edge Runtime support
|
|
4993
|
-
*/
|
|
4994
|
-
|
|
4995
|
-
interface SessionData {
|
|
4996
|
-
userId: string;
|
|
4997
|
-
privateKey: string;
|
|
4998
|
-
keyId: string;
|
|
4999
|
-
algorithm: KeyAlgorithmType;
|
|
5000
|
-
}
|
|
5001
|
-
/**
|
|
5002
|
-
* Seal session data into encrypted JWT (JWE)
|
|
5003
|
-
*
|
|
5004
|
-
* @param data - Session data to encrypt
|
|
5005
|
-
* @param ttl - Time to live in seconds (default: 7 days)
|
|
5006
|
-
* @returns Encrypted JWT string
|
|
5007
|
-
*/
|
|
5008
|
-
declare function sealSession(data: SessionData, ttl?: number): Promise<string>;
|
|
5009
|
-
/**
|
|
5010
|
-
* Unseal encrypted JWT (JWE) to session data
|
|
5011
|
-
*
|
|
5012
|
-
* @param jwt - Encrypted JWT string
|
|
5013
|
-
* @returns Session data
|
|
5014
|
-
* @throws Error if session is invalid or expired
|
|
5015
|
-
*/
|
|
5016
|
-
declare function unsealSession(jwt: string): Promise<SessionData>;
|
|
5017
|
-
/**
|
|
5018
|
-
* Get session metadata without decrypting
|
|
5019
|
-
*
|
|
5020
|
-
* @param jwt - Encrypted JWT string
|
|
5021
|
-
* @returns Session metadata or null if invalid
|
|
5022
|
-
*/
|
|
5023
|
-
declare function getSessionInfo(jwt: string): Promise<{
|
|
5024
|
-
issuedAt: Date;
|
|
5025
|
-
expiresAt: Date;
|
|
5026
|
-
issuer: string;
|
|
5027
|
-
audience: string;
|
|
5028
|
-
} | null>;
|
|
5029
|
-
/**
|
|
5030
|
-
* Check if session is about to expire (within threshold)
|
|
5031
|
-
*
|
|
5032
|
-
* @param jwt - Encrypted JWT string
|
|
5033
|
-
* @param thresholdHours - Hours before expiry to trigger refresh (default: 24)
|
|
5034
|
-
* @returns True if session should be refreshed
|
|
5035
|
-
*/
|
|
5036
|
-
declare function shouldRefreshSession(jwt: string, thresholdHours?: number): Promise<boolean>;
|
|
5037
|
-
|
|
5038
5110
|
/**
|
|
5039
5111
|
* @spfn/auth - Global Configuration
|
|
5040
5112
|
*
|
|
@@ -5042,12 +5114,17 @@ declare function shouldRefreshSession(jwt: string, thresholdHours?: number): Pro
|
|
|
5042
5114
|
*/
|
|
5043
5115
|
/**
|
|
5044
5116
|
* Cookie names used by SPFN Auth
|
|
5117
|
+
*
|
|
5118
|
+
* Names include a port-based suffix so that multiple dev instances
|
|
5119
|
+
* on different ports don't overwrite each other's cookies.
|
|
5045
5120
|
*/
|
|
5046
5121
|
declare const COOKIE_NAMES: {
|
|
5047
5122
|
/** Encrypted session data (userId, privateKey, keyId, algorithm) */
|
|
5048
|
-
readonly SESSION:
|
|
5123
|
+
readonly SESSION: string;
|
|
5049
5124
|
/** Current key ID (for key rotation) */
|
|
5050
|
-
readonly SESSION_KEY_ID:
|
|
5125
|
+
readonly SESSION_KEY_ID: string;
|
|
5126
|
+
/** Pending OAuth session (privateKey, keyId, algorithm) - temporary during OAuth flow */
|
|
5127
|
+
readonly OAUTH_PENDING: string;
|
|
5051
5128
|
};
|
|
5052
5129
|
/**
|
|
5053
5130
|
* Parse duration string to seconds
|
|
@@ -5104,6 +5181,157 @@ declare function getAuthConfig(): AuthConfig;
|
|
|
5104
5181
|
*/
|
|
5105
5182
|
declare function getSessionTtl(override?: string | number): number;
|
|
5106
5183
|
|
|
5184
|
+
/**
|
|
5185
|
+
* Google OAuth 2.0 Client
|
|
5186
|
+
*
|
|
5187
|
+
* Authorization Code Flow 구현
|
|
5188
|
+
* - getGoogleAuthUrl: Google 로그인 URL 생성
|
|
5189
|
+
* - exchangeCodeForTokens: Code를 Token으로 교환
|
|
5190
|
+
* - getGoogleUserInfo: 사용자 정보 조회
|
|
5191
|
+
*/
|
|
5192
|
+
interface GoogleTokenResponse {
|
|
5193
|
+
access_token: string;
|
|
5194
|
+
expires_in: number;
|
|
5195
|
+
refresh_token?: string;
|
|
5196
|
+
scope: string;
|
|
5197
|
+
token_type: string;
|
|
5198
|
+
id_token?: string;
|
|
5199
|
+
}
|
|
5200
|
+
interface GoogleUserInfo {
|
|
5201
|
+
id: string;
|
|
5202
|
+
email: string;
|
|
5203
|
+
verified_email: boolean;
|
|
5204
|
+
name?: string;
|
|
5205
|
+
given_name?: string;
|
|
5206
|
+
family_name?: string;
|
|
5207
|
+
picture?: string;
|
|
5208
|
+
locale?: string;
|
|
5209
|
+
}
|
|
5210
|
+
/**
|
|
5211
|
+
* Google OAuth가 활성화되어 있는지 확인
|
|
5212
|
+
*/
|
|
5213
|
+
declare function isGoogleOAuthEnabled(): boolean;
|
|
5214
|
+
/**
|
|
5215
|
+
* Google OAuth 설정 가져오기
|
|
5216
|
+
*/
|
|
5217
|
+
declare function getGoogleOAuthConfig(): {
|
|
5218
|
+
clientId: string;
|
|
5219
|
+
clientSecret: string;
|
|
5220
|
+
redirectUri: string;
|
|
5221
|
+
};
|
|
5222
|
+
/**
|
|
5223
|
+
* Google 로그인 URL 생성
|
|
5224
|
+
*
|
|
5225
|
+
* @param state - CSRF 방지용 state 파라미터 (암호화된 returnUrl + nonce 포함)
|
|
5226
|
+
* @param scopes - 요청할 OAuth scopes (기본: env 또는 email, profile)
|
|
5227
|
+
*/
|
|
5228
|
+
declare function getGoogleAuthUrl(state: string, scopes?: string[]): string;
|
|
5229
|
+
/**
|
|
5230
|
+
* Authorization Code를 Token으로 교환
|
|
5231
|
+
*
|
|
5232
|
+
* @param code - Google에서 받은 authorization code
|
|
5233
|
+
*/
|
|
5234
|
+
declare function exchangeCodeForTokens(code: string): Promise<GoogleTokenResponse>;
|
|
5235
|
+
/**
|
|
5236
|
+
* Access Token으로 Google 사용자 정보 조회
|
|
5237
|
+
*
|
|
5238
|
+
* @param accessToken - Google access token
|
|
5239
|
+
*/
|
|
5240
|
+
declare function getGoogleUserInfo(accessToken: string): Promise<GoogleUserInfo>;
|
|
5241
|
+
/**
|
|
5242
|
+
* Refresh Token으로 새 Access Token 획득
|
|
5243
|
+
*
|
|
5244
|
+
* @param refreshToken - Google refresh token
|
|
5245
|
+
*/
|
|
5246
|
+
declare function refreshAccessToken(refreshToken: string): Promise<GoogleTokenResponse>;
|
|
5247
|
+
|
|
5248
|
+
/**
|
|
5249
|
+
* OAuth State Management
|
|
5250
|
+
*
|
|
5251
|
+
* CSRF 방지를 위한 state 파라미터 암호화/복호화
|
|
5252
|
+
* - returnUrl: OAuth 성공 후 리다이렉트할 URL
|
|
5253
|
+
* - nonce: CSRF 방지용 일회용 토큰
|
|
5254
|
+
* - provider: OAuth provider (google, github 등)
|
|
5255
|
+
* - publicKey, keyId, fingerprint, algorithm: 클라이언트 키 정보
|
|
5256
|
+
* - expiresAt: state 만료 시간
|
|
5257
|
+
*/
|
|
5258
|
+
|
|
5259
|
+
interface OAuthState {
|
|
5260
|
+
returnUrl: string;
|
|
5261
|
+
nonce: string;
|
|
5262
|
+
provider: string;
|
|
5263
|
+
publicKey: string;
|
|
5264
|
+
keyId: string;
|
|
5265
|
+
fingerprint: string;
|
|
5266
|
+
algorithm: KeyAlgorithmType;
|
|
5267
|
+
metadata?: Record<string, unknown>;
|
|
5268
|
+
}
|
|
5269
|
+
interface CreateOAuthStateParams {
|
|
5270
|
+
provider: string;
|
|
5271
|
+
returnUrl: string;
|
|
5272
|
+
publicKey: string;
|
|
5273
|
+
keyId: string;
|
|
5274
|
+
fingerprint: string;
|
|
5275
|
+
algorithm: KeyAlgorithmType;
|
|
5276
|
+
metadata?: Record<string, unknown>;
|
|
5277
|
+
}
|
|
5278
|
+
/**
|
|
5279
|
+
* OAuth state 생성 및 암호화
|
|
5280
|
+
*
|
|
5281
|
+
* @param params - state 생성에 필요한 파라미터
|
|
5282
|
+
* @returns 암호화된 state 문자열
|
|
5283
|
+
*/
|
|
5284
|
+
declare function createOAuthState(params: CreateOAuthStateParams): Promise<string>;
|
|
5285
|
+
/**
|
|
5286
|
+
* OAuth state 복호화 및 검증
|
|
5287
|
+
*
|
|
5288
|
+
* @param encryptedState - 암호화된 state 문자열
|
|
5289
|
+
* @returns 복호화된 state 객체
|
|
5290
|
+
* @throws Error if state is invalid or expired (JWE exp claim으로 자동 검증)
|
|
5291
|
+
*/
|
|
5292
|
+
declare function verifyOAuthState(encryptedState: string): Promise<OAuthState>;
|
|
5293
|
+
|
|
5294
|
+
/**
|
|
5295
|
+
* One-Time Token Manager
|
|
5296
|
+
*
|
|
5297
|
+
* Singleton wrapper around SSETokenManager for one-time token authentication.
|
|
5298
|
+
* Used for direct API access (file uploads, SSE streaming, etc.) bypassing RPC proxy.
|
|
5299
|
+
*/
|
|
5300
|
+
|
|
5301
|
+
/**
|
|
5302
|
+
* Initialize the one-time token manager
|
|
5303
|
+
*
|
|
5304
|
+
* Called during auth lifecycle initialization.
|
|
5305
|
+
* Creates a singleton SSETokenManager instance.
|
|
5306
|
+
*
|
|
5307
|
+
* @param config - Optional configuration
|
|
5308
|
+
* @param config.ttl - Token time-to-live in milliseconds (default: 30000)
|
|
5309
|
+
* @param config.store - Custom token store (e.g., CacheTokenStore for Redis)
|
|
5310
|
+
*/
|
|
5311
|
+
declare function initOneTimeTokenManager(config?: {
|
|
5312
|
+
ttl?: number;
|
|
5313
|
+
store?: SSETokenStore;
|
|
5314
|
+
}): void;
|
|
5315
|
+
/**
|
|
5316
|
+
* Get the one-time token manager instance
|
|
5317
|
+
*
|
|
5318
|
+
* @throws Error if initOneTimeTokenManager() has not been called
|
|
5319
|
+
*
|
|
5320
|
+
* @example
|
|
5321
|
+
* ```typescript
|
|
5322
|
+
* import { getOneTimeTokenManager } from '@spfn/auth/server';
|
|
5323
|
+
*
|
|
5324
|
+
* // Use as SSE tokenManager
|
|
5325
|
+
* .eventsConfig({
|
|
5326
|
+
* auth: {
|
|
5327
|
+
* enabled: true,
|
|
5328
|
+
* tokenManager: getOneTimeTokenManager(),
|
|
5329
|
+
* },
|
|
5330
|
+
* })
|
|
5331
|
+
* ```
|
|
5332
|
+
*/
|
|
5333
|
+
declare function getOneTimeTokenManager(): SSETokenManager;
|
|
5334
|
+
|
|
5107
5335
|
/**
|
|
5108
5336
|
* @spfn/auth - Centralized Logger
|
|
5109
5337
|
*
|
|
@@ -5116,7 +5344,9 @@ declare const authLogger: {
|
|
|
5116
5344
|
general: _spfn_core_logger.Logger;
|
|
5117
5345
|
login: _spfn_core_logger.Logger;
|
|
5118
5346
|
keyRotation: _spfn_core_logger.Logger;
|
|
5347
|
+
oauth: _spfn_core_logger.Logger;
|
|
5119
5348
|
};
|
|
5349
|
+
session: _spfn_core_logger.Logger;
|
|
5120
5350
|
service: _spfn_core_logger.Logger;
|
|
5121
5351
|
setup: _spfn_core_logger.Logger;
|
|
5122
5352
|
email: _spfn_core_logger.Logger;
|
|
@@ -5197,6 +5427,168 @@ interface AuthLifecycleConfig {
|
|
|
5197
5427
|
* .build();
|
|
5198
5428
|
* ```
|
|
5199
5429
|
*/
|
|
5200
|
-
|
|
5430
|
+
/**
|
|
5431
|
+
* Options for createAuthLifecycle
|
|
5432
|
+
*/
|
|
5433
|
+
interface AuthLifecycleOptions extends AuthInitOptions {
|
|
5434
|
+
/**
|
|
5435
|
+
* One-time token configuration
|
|
5436
|
+
*
|
|
5437
|
+
* Enables one-time token issuance for direct API access
|
|
5438
|
+
* (file uploads, SSE streaming, etc.)
|
|
5439
|
+
*
|
|
5440
|
+
* @example
|
|
5441
|
+
* ```typescript
|
|
5442
|
+
* createAuthLifecycle({
|
|
5443
|
+
* oneTimeToken: { ttl: 60000 }, // 60 seconds
|
|
5444
|
+
* })
|
|
5445
|
+
* ```
|
|
5446
|
+
*/
|
|
5447
|
+
oneTimeToken?: {
|
|
5448
|
+
/**
|
|
5449
|
+
* Token time-to-live in milliseconds
|
|
5450
|
+
* @default 30000
|
|
5451
|
+
*/
|
|
5452
|
+
ttl?: number;
|
|
5453
|
+
/**
|
|
5454
|
+
* Custom token store (e.g., CacheTokenStore for Redis/Valkey)
|
|
5455
|
+
*
|
|
5456
|
+
* When provided, tokens are stored in the external store instead of in-memory Map.
|
|
5457
|
+
* Required for multi-instance deployments where token issuance and verification
|
|
5458
|
+
* may happen on different server instances.
|
|
5459
|
+
*
|
|
5460
|
+
* @example
|
|
5461
|
+
* ```typescript
|
|
5462
|
+
* import { CacheTokenStore } from '@spfn/core/event/sse';
|
|
5463
|
+
* import { getCache } from '@spfn/core/cache';
|
|
5464
|
+
*
|
|
5465
|
+
* createAuthLifecycle({
|
|
5466
|
+
* oneTimeToken: {
|
|
5467
|
+
* store: new CacheTokenStore(getCache()),
|
|
5468
|
+
* },
|
|
5469
|
+
* })
|
|
5470
|
+
* ```
|
|
5471
|
+
*/
|
|
5472
|
+
store?: SSETokenStore;
|
|
5473
|
+
};
|
|
5474
|
+
}
|
|
5475
|
+
declare function createAuthLifecycle(options?: AuthLifecycleOptions): AuthLifecycleConfig;
|
|
5476
|
+
|
|
5477
|
+
/**
|
|
5478
|
+
* @spfn/auth - Auth Events
|
|
5479
|
+
*
|
|
5480
|
+
* 인증 관련 이벤트 정의
|
|
5481
|
+
* - auth.login: 로그인 성공 시 (기존 사용자만)
|
|
5482
|
+
* - auth.register: 회원가입 성공 시 (OAuth 신규 가입 포함)
|
|
5483
|
+
*/
|
|
5484
|
+
/**
|
|
5485
|
+
* Auth provider type
|
|
5486
|
+
*/
|
|
5487
|
+
declare const AuthProviderSchema: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"email">, _sinclair_typebox.TLiteral<"phone">, _sinclair_typebox.TLiteral<"google">]>;
|
|
5488
|
+
/**
|
|
5489
|
+
* auth.login - 로그인 성공 이벤트
|
|
5490
|
+
*
|
|
5491
|
+
* 발행 시점:
|
|
5492
|
+
* - 이메일/전화 로그인 성공 시
|
|
5493
|
+
* - OAuth 기존 사용자 로그인 시
|
|
5494
|
+
*
|
|
5495
|
+
* @example
|
|
5496
|
+
* ```typescript
|
|
5497
|
+
* authLoginEvent.subscribe(async (payload) => {
|
|
5498
|
+
* await analytics.trackLogin(payload.userId, payload.provider);
|
|
5499
|
+
* });
|
|
5500
|
+
* ```
|
|
5501
|
+
*/
|
|
5502
|
+
declare const authLoginEvent: _spfn_core_event.EventDef<{
|
|
5503
|
+
email?: string | undefined;
|
|
5504
|
+
phone?: string | undefined;
|
|
5505
|
+
userId: string;
|
|
5506
|
+
provider: "email" | "phone" | "google";
|
|
5507
|
+
}>;
|
|
5508
|
+
/**
|
|
5509
|
+
* auth.register - 회원가입 성공 이벤트
|
|
5510
|
+
*
|
|
5511
|
+
* 발행 시점:
|
|
5512
|
+
* - 이메일/전화 회원가입 성공 시
|
|
5513
|
+
* - OAuth 신규 사용자 가입 시
|
|
5514
|
+
*
|
|
5515
|
+
* @example
|
|
5516
|
+
* ```typescript
|
|
5517
|
+
* authRegisterEvent.subscribe(async (payload) => {
|
|
5518
|
+
* await emailService.sendWelcome(payload.email);
|
|
5519
|
+
* });
|
|
5520
|
+
* ```
|
|
5521
|
+
*/
|
|
5522
|
+
declare const authRegisterEvent: _spfn_core_event.EventDef<{
|
|
5523
|
+
email?: string | undefined;
|
|
5524
|
+
phone?: string | undefined;
|
|
5525
|
+
metadata?: {
|
|
5526
|
+
[x: string]: unknown;
|
|
5527
|
+
} | undefined;
|
|
5528
|
+
userId: string;
|
|
5529
|
+
provider: "email" | "phone" | "google";
|
|
5530
|
+
}>;
|
|
5531
|
+
/**
|
|
5532
|
+
* auth.invitation.created - 초대 생성 이벤트
|
|
5533
|
+
*
|
|
5534
|
+
* 발행 시점:
|
|
5535
|
+
* - createInvitation() 성공 시
|
|
5536
|
+
* - resendInvitation() 성공 시
|
|
5537
|
+
*
|
|
5538
|
+
* @example
|
|
5539
|
+
* ```typescript
|
|
5540
|
+
* invitationCreatedEvent.subscribe(async (payload) => {
|
|
5541
|
+
* const inviteUrl = `${APP_URL}/invite/${payload.token}`;
|
|
5542
|
+
* await notificationService.send({
|
|
5543
|
+
* channel: 'email',
|
|
5544
|
+
* to: payload.email,
|
|
5545
|
+
* subject: 'You are invited!',
|
|
5546
|
+
* html: renderInviteEmail({ inviteUrl, ...payload.metadata }),
|
|
5547
|
+
* });
|
|
5548
|
+
* });
|
|
5549
|
+
* ```
|
|
5550
|
+
*/
|
|
5551
|
+
declare const invitationCreatedEvent: _spfn_core_event.EventDef<{
|
|
5552
|
+
metadata?: {
|
|
5553
|
+
[x: string]: unknown;
|
|
5554
|
+
} | undefined;
|
|
5555
|
+
email: string;
|
|
5556
|
+
roleId: number;
|
|
5557
|
+
token: string;
|
|
5558
|
+
invitedBy: string;
|
|
5559
|
+
expiresAt: string;
|
|
5560
|
+
invitationId: string;
|
|
5561
|
+
isResend: boolean;
|
|
5562
|
+
}>;
|
|
5563
|
+
/**
|
|
5564
|
+
* auth.invitation.accepted - 초대 수락 이벤트
|
|
5565
|
+
*
|
|
5566
|
+
* 발행 시점:
|
|
5567
|
+
* - acceptInvitation() 성공 시
|
|
5568
|
+
*
|
|
5569
|
+
* @example
|
|
5570
|
+
* ```typescript
|
|
5571
|
+
* invitationAcceptedEvent.subscribe(async (payload) => {
|
|
5572
|
+
* await onboardingService.start(payload.userId);
|
|
5573
|
+
* });
|
|
5574
|
+
* ```
|
|
5575
|
+
*/
|
|
5576
|
+
declare const invitationAcceptedEvent: _spfn_core_event.EventDef<{
|
|
5577
|
+
metadata?: {
|
|
5578
|
+
[x: string]: unknown;
|
|
5579
|
+
} | undefined;
|
|
5580
|
+
email: string;
|
|
5581
|
+
userId: string;
|
|
5582
|
+
roleId: number;
|
|
5583
|
+
invitedBy: string;
|
|
5584
|
+
invitationId: string;
|
|
5585
|
+
}>;
|
|
5586
|
+
/**
|
|
5587
|
+
* Auth event payload types
|
|
5588
|
+
*/
|
|
5589
|
+
type AuthLoginPayload = typeof authLoginEvent._payload;
|
|
5590
|
+
type AuthRegisterPayload = typeof authRegisterEvent._payload;
|
|
5591
|
+
type InvitationCreatedPayload = typeof invitationCreatedEvent._payload;
|
|
5592
|
+
type InvitationAcceptedPayload = typeof invitationAcceptedEvent._payload;
|
|
5201
5593
|
|
|
5202
|
-
export { type AuthConfig, AuthContext, COOKIE_NAMES, type
|
|
5594
|
+
export { type AuthConfig, AuthContext, type AuthLifecycleConfig, type AuthLifecycleOptions, type AuthLoginPayload, type AuthMetadataEntity, AuthMetadataRepository, AuthProviderSchema, type AuthRegisterPayload, COOKIE_NAMES, type CreateOAuthStateParams, type GoogleTokenResponse, type GoogleUserInfo, type Invitation, type InvitationAcceptedPayload, type InvitationCreatedPayload, InvitationStatus, InvitationsRepository, KeyAlgorithmType, type KeyPair, KeysRepository, type NewAuthMetadataEntity, 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 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, authMetadata, authMetadataRepository, 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, getOneTimeTokenManager, getOptionalAuth, getRole, getRoleByName, getRolePermissions, getSessionTtl, getUser, getUserByEmailService, getUserByIdService, getUserByPhoneService, getUserId, getUserPermissions, getUserProfileService, getUserRole, hasAllPermissions, hasAnyPermission, hasAnyRole, hasPermission, hasRole, hashPassword, initOneTimeTokenManager, initializeAuth, invitationAcceptedEvent, invitationCreatedEvent, invitationsRepository, isGoogleOAuthEnabled, keysRepository, listInvitations, oneTimeTokenAuth, parseDuration, permissions, permissionsRepository, refreshAccessToken, removePermissionFromRole, requireAnyPermission, requirePermissions, requireRole, resendInvitation, roleGuard, rolePermissions, rolePermissionsRepository, roles, rolesRepository, setRolePermissions, shouldRotateKey, socialAccountsRepository, updateLastLoginService, updateLocaleService, updateRole, updateUserProfileService, updateUserService, updateUsernameService, userInvitations, userPermissions, userPermissionsRepository, userProfiles, userProfilesRepository, userPublicKeys, userSocialAccounts, users, usersRepository, validateInvitation, validatePasswordStrength, verificationCodes, verificationCodesRepository, verifyClientToken, verifyKeyFingerprint, verifyOAuthState, verifyPassword, verifyToken };
|