@withwiz/toolkit 0.4.1 → 0.5.0
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/dist/auth/adapters/prisma/index.d.ts +20 -4
- package/dist/auth/adapters/prisma/index.js +51 -61
- package/dist/auth/config.js +2 -2
- package/dist/auth/core/jwt/cookie.d.ts +1 -0
- package/dist/auth/core/jwt/cookie.js +3 -3
- package/dist/auth/core/jwt/index.d.ts +1 -1
- package/dist/auth/core/jwt/index.js +3 -3
- package/dist/auth/core/jwt/types.js +5 -7
- package/dist/auth/core/oauth/index.d.ts +17 -27
- package/dist/auth/core/oauth/index.js +18 -5
- package/dist/auth/core/oauth/providers/github.d.ts +12 -0
- package/dist/auth/core/oauth/providers/github.js +8 -0
- package/dist/auth/core/oauth/providers/google.d.ts +12 -0
- package/dist/auth/core/oauth/providers/google.js +8 -0
- package/dist/auth/core/oauth/providers/index.d.ts +3 -0
- package/dist/auth/core/oauth/providers/index.js +17 -0
- package/dist/auth/core/oauth/providers/kakao.d.ts +12 -0
- package/dist/auth/core/oauth/providers/kakao.js +8 -0
- package/dist/auth/core/password/client-helper.js +1 -1
- package/dist/auth/core/password/index.js +1 -1
- package/dist/auth/index.d.ts +2 -3
- package/dist/auth/index.js +23 -12
- package/dist/auth/types/index.d.ts +31 -31
- package/dist/auth/types/index.js +5 -7
- package/dist/cache/cache-config.js +4 -4
- package/dist/cache/cache-env.js +3 -3
- package/dist/cache/cache-factory.js +12 -12
- package/dist/cache/cache-invalidation.js +13 -13
- package/dist/cache/cache-redis.js +6 -6
- package/dist/cache/cache-wrapper.js +13 -13
- package/dist/cache/cache.js +20 -20
- package/dist/cache/hybrid-cache-manager.js +8 -8
- package/dist/cache/index.js +20 -20
- package/dist/cache/inmemory-cache-manager.js +5 -5
- package/dist/cache/noop-cache-manager.js +5 -5
- package/dist/cache/redis-cache-manager.js +7 -7
- package/dist/chunk-2QQNL4ND.js +62 -0
- package/dist/{chunk-5WP57PJK.js → chunk-3OZH2AMD.js} +7 -7
- package/dist/{chunk-WMQE2YK7.js → chunk-3WS5MO6P.js} +1 -1
- package/dist/{chunk-N3TAGJHR.js → chunk-4OCGUJL5.js} +2 -2
- package/dist/{chunk-GFAD4UAT.js → chunk-5HSGNXQ3.js} +1 -1
- package/dist/{chunk-NQQU6UFE.js → chunk-6OYE5XKI.js} +3 -3
- package/dist/{chunk-FD2TXDTO.js → chunk-6WI4HNAF.js} +2 -2
- package/dist/{chunk-J4TTSXDN.js → chunk-6XDE62WQ.js} +1 -1
- package/dist/{chunk-2VMTIYLX.js → chunk-7ZQQ6PJ4.js} +2 -2
- package/dist/{chunk-FUDEEQR3.js → chunk-D46PE6MU.js} +6 -6
- package/dist/{chunk-2F6KNGOD.js → chunk-DANUXNQU.js} +1 -1
- package/dist/{chunk-CRWMULHR.js → chunk-DSRRNRZW.js} +2 -2
- package/dist/{chunk-BJLLMVWW.js → chunk-ET6RH4LB.js} +1 -1
- package/dist/{chunk-OIRAH57Y.js → chunk-FNKFQFZJ.js} +1 -1
- package/dist/{chunk-S5UCZ2T3.js → chunk-G5WP3MJG.js} +1 -1
- package/dist/chunk-GBLNXNEH.js +64 -0
- package/dist/{chunk-HHCDMWEF.js → chunk-GCR4PGRY.js} +1 -1
- package/dist/{chunk-4HBAPPB2.js → chunk-HGLQXH4D.js} +2 -2
- package/dist/chunk-HZLJYEOO.js +92 -0
- package/dist/{chunk-LX2EYD74.js → chunk-I7NVWJ72.js} +2 -2
- package/dist/{chunk-X5RMDLLM.js → chunk-IEFYARHC.js} +2 -2
- package/dist/{chunk-3YUKCYHI.js → chunk-JY62DSMP.js} +8 -8
- package/dist/{chunk-G5OMETUS.js → chunk-LCKQOHXI.js} +1 -1
- package/dist/{chunk-GGSFZP6T.js → chunk-MF4CWGMB.js} +12 -12
- package/dist/{chunk-J5AISIJS.js → chunk-NDET73GO.js} +22 -18
- package/dist/{chunk-JOM3N4EJ.js → chunk-NGV527RO.js} +1 -1
- package/dist/{chunk-YSUL3SLC.js → chunk-OSDAP24S.js} +4 -4
- package/dist/{chunk-CUZPD3BF.js → chunk-PAYLVMZN.js} +2 -2
- package/dist/{chunk-6SOQUYOU.js → chunk-PYTRCD33.js} +2 -2
- package/dist/{chunk-6D3HHYER.js → chunk-QKC73SWB.js} +6 -12
- package/dist/{chunk-LFQ3IQQB.js → chunk-QO27AXIH.js} +2 -2
- package/dist/chunk-RVL5ROWQ.js +62 -0
- package/dist/{chunk-AQJAY5FA.js → chunk-S5KJZZKU.js} +1 -1
- package/dist/{chunk-K3HAYBWX.js → chunk-SNKCKED5.js} +1 -1
- package/dist/{chunk-N4D6OPPP.js → chunk-SUA4WQRN.js} +5 -3
- package/dist/chunk-T4MDCVUQ.js +0 -0
- package/dist/{chunk-L6AU74EI.js → chunk-TOVBPLHD.js} +3 -3
- package/dist/{chunk-7LJWRKDT.js → chunk-VIWM2ZZH.js} +1 -1
- package/dist/{chunk-KGHWGLED.js → chunk-W3IVVPS5.js} +4 -4
- package/dist/{chunk-3J7FDOCU.js → chunk-WBU53USI.js} +4 -4
- package/dist/{chunk-FPESPW6P.js → chunk-XA32Z2OV.js} +1 -1
- package/dist/{chunk-GQVBWZLH.js → chunk-Y22GDIM6.js} +2 -2
- package/dist/components/ui/DataTable.js +5 -5
- package/dist/components/ui/data-table/DataTable.js +5 -5
- package/dist/components/ui/data-table/DataTableFilters.js +2 -2
- package/dist/components/ui/data-table/DataTableSearch.js +2 -2
- package/dist/config/common.js +2 -2
- package/dist/constants/index.js +15 -15
- package/dist/error/error-display.js +2 -2
- package/dist/error/error-handler.js +5 -5
- package/dist/error/index.js +15 -15
- package/dist/geolocation/batch-processor.js +5 -5
- package/dist/geolocation/config.js +2 -2
- package/dist/geolocation/index.js +9 -9
- package/dist/geolocation/providers/index.js +5 -5
- package/dist/geolocation/providers/ipgeolocation-provider.js +3 -3
- package/dist/geolocation/providers/maxmind-provider.js +3 -3
- package/dist/initialize.js +9 -9
- package/dist/logger/config.js +2 -2
- package/dist/logger/logger.js +4 -4
- package/dist/middleware/auth.d.ts +1 -0
- package/dist/middleware/auth.js +9 -7
- package/dist/middleware/cors-config.js +2 -2
- package/dist/middleware/cors.js +6 -6
- package/dist/middleware/error-handler.js +7 -7
- package/dist/middleware/index.d.ts +1 -1
- package/dist/middleware/index.js +19 -17
- package/dist/middleware/middleware-chain.js +5 -5
- package/dist/middleware/rate-limit.d.ts +3 -7
- package/dist/middleware/rate-limit.js +5 -5
- package/dist/middleware/response-logger.js +5 -5
- package/dist/middleware/security.js +5 -5
- package/dist/middleware/types.d.ts +1 -1
- package/dist/middleware/wrappers.js +17 -17
- package/dist/storage/config.js +2 -2
- package/dist/storage/r2-storage.js +2 -2
- package/dist/system/cpu.js +6 -6
- package/dist/system/disk.js +6 -6
- package/dist/system/environment.js +8 -8
- package/dist/system/health-check.js +6 -6
- package/dist/system/index.js +13 -13
- package/dist/system/memory.js +6 -6
- package/dist/system/network.js +6 -6
- package/dist/system/utils.js +5 -5
- package/dist/types/geoip.d.ts +4 -4
- package/dist/types/qr-code.d.ts +20 -20
- package/dist/types/qr-code.js +4 -4
- package/dist/utils/cors.js +4 -4
- package/dist/utils/csv-export.js +5 -5
- package/dist/utils/error-processor.js +5 -5
- package/dist/utils/index.js +8 -8
- package/package.json +5 -1
- package/dist/chunk-V5K5FYU7.js +0 -200
- package/dist/{chunk-GFWGLWTS.js → chunk-23LXAAMU.js} +3 -3
- package/dist/{chunk-3CBGGMIY.js → chunk-2VNDWG6P.js} +3 -3
- package/dist/{chunk-OZE5KUS3.js → chunk-52BIDTZH.js} +3 -3
- package/dist/{chunk-OHBAELPZ.js → chunk-6O3I4ORK.js} +3 -3
- package/dist/{chunk-BJSEYZBH.js → chunk-I4UEUKSB.js} +3 -3
- package/dist/{chunk-SEZJN4TC.js → chunk-LJEGM4OO.js} +3 -3
- package/dist/{chunk-AYZJN32D.js → chunk-PL33DK2X.js} +3 -3
- package/dist/{chunk-KHYY4KCV.js → chunk-TH45RVP7.js} +3 -3
- package/dist/{chunk-SFPMFVSD.js → chunk-XICTHSUH.js} +3 -3
|
@@ -8,10 +8,24 @@
|
|
|
8
8
|
* 패키지 독립성을 위해 덕 타이핑(Duck Typing) 방식으로 PrismaClient를 받습니다.
|
|
9
9
|
*/
|
|
10
10
|
type PrismaClientLike = Record<string, any>;
|
|
11
|
-
import type { UserRepository, OAuthAccountRepository, EmailTokenRepository, BaseUser, CreateUserData, UpdateUserData, OAuthAccount, CreateOAuthAccountData, UpdateOAuthAccountData, EmailToken, TokenType
|
|
11
|
+
import type { UserRepository, OAuthAccountRepository, EmailTokenRepository, BaseUser, CreateUserData, UpdateUserData, OAuthAccount, CreateOAuthAccountData, UpdateOAuthAccountData, EmailToken, TokenType } from '@withwiz/auth/types';
|
|
12
|
+
export interface PrismaAdapterConfig {
|
|
13
|
+
tokenTables?: {
|
|
14
|
+
emailVerification?: string;
|
|
15
|
+
passwordReset?: string;
|
|
16
|
+
magicLink?: string;
|
|
17
|
+
};
|
|
18
|
+
userFields?: {
|
|
19
|
+
password?: string;
|
|
20
|
+
emailVerified?: string;
|
|
21
|
+
role?: string;
|
|
22
|
+
image?: string;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
12
25
|
export declare class PrismaUserRepository implements UserRepository {
|
|
13
26
|
private prisma;
|
|
14
|
-
|
|
27
|
+
private config;
|
|
28
|
+
constructor(prisma: PrismaClientLike, config?: PrismaAdapterConfig);
|
|
15
29
|
findById(id: string): Promise<BaseUser | null>;
|
|
16
30
|
findByEmail(email: string): Promise<BaseUser | null>;
|
|
17
31
|
create(data: CreateUserData): Promise<BaseUser>;
|
|
@@ -24,7 +38,7 @@ export declare class PrismaUserRepository implements UserRepository {
|
|
|
24
38
|
export declare class PrismaOAuthAccountRepository implements OAuthAccountRepository {
|
|
25
39
|
private prisma;
|
|
26
40
|
constructor(prisma: PrismaClientLike);
|
|
27
|
-
findByProvider(provider:
|
|
41
|
+
findByProvider(provider: string, providerAccountId: string): Promise<OAuthAccount | null>;
|
|
28
42
|
findByUserId(userId: string): Promise<OAuthAccount[]>;
|
|
29
43
|
create(data: CreateOAuthAccountData): Promise<OAuthAccount>;
|
|
30
44
|
update(id: string, data: UpdateOAuthAccountData): Promise<OAuthAccount>;
|
|
@@ -33,7 +47,9 @@ export declare class PrismaOAuthAccountRepository implements OAuthAccountReposit
|
|
|
33
47
|
}
|
|
34
48
|
export declare class PrismaEmailTokenRepository implements EmailTokenRepository {
|
|
35
49
|
private prisma;
|
|
36
|
-
|
|
50
|
+
private config;
|
|
51
|
+
constructor(prisma: PrismaClientLike, config?: PrismaAdapterConfig);
|
|
52
|
+
private getTokenTable;
|
|
37
53
|
create(email: string, token: string, type: TokenType, expiresAt: Date): Promise<EmailToken>;
|
|
38
54
|
findByEmailAndToken(email: string, token: string, type: TokenType): Promise<EmailToken | null>;
|
|
39
55
|
delete(email: string, token: string, type: TokenType): Promise<void>;
|
|
@@ -1,9 +1,31 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
__spreadValues
|
|
3
|
+
} from "../../../chunk-ORMEWXMH.js";
|
|
2
4
|
|
|
3
5
|
// src/auth/adapters/prisma/index.ts
|
|
6
|
+
var DEFAULT_CONFIG = {
|
|
7
|
+
tokenTables: {
|
|
8
|
+
emailVerification: "emailVerificationToken",
|
|
9
|
+
passwordReset: "passwordResetToken",
|
|
10
|
+
magicLink: "magicLinkToken"
|
|
11
|
+
},
|
|
12
|
+
userFields: {
|
|
13
|
+
password: "password",
|
|
14
|
+
emailVerified: "emailVerified",
|
|
15
|
+
role: "role",
|
|
16
|
+
image: "image"
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
function mergeConfig(config) {
|
|
20
|
+
return {
|
|
21
|
+
tokenTables: __spreadValues(__spreadValues({}, DEFAULT_CONFIG.tokenTables), config == null ? void 0 : config.tokenTables),
|
|
22
|
+
userFields: __spreadValues(__spreadValues({}, DEFAULT_CONFIG.userFields), config == null ? void 0 : config.userFields)
|
|
23
|
+
};
|
|
24
|
+
}
|
|
4
25
|
var PrismaUserRepository = class {
|
|
5
|
-
constructor(prisma) {
|
|
26
|
+
constructor(prisma, config) {
|
|
6
27
|
this.prisma = prisma;
|
|
28
|
+
this.config = mergeConfig(config);
|
|
7
29
|
}
|
|
8
30
|
async findById(id) {
|
|
9
31
|
const user = await this.prisma.user.findUnique({ where: { id } });
|
|
@@ -61,10 +83,10 @@ var PrismaUserRepository = class {
|
|
|
61
83
|
id: user.id,
|
|
62
84
|
email: user.email,
|
|
63
85
|
name: user.name,
|
|
64
|
-
role: user.role,
|
|
65
|
-
emailVerified: user.emailVerified,
|
|
86
|
+
role: user[this.config.userFields.role],
|
|
87
|
+
emailVerified: user[this.config.userFields.emailVerified],
|
|
66
88
|
isActive: user.isActive,
|
|
67
|
-
image: user.image,
|
|
89
|
+
image: user[this.config.userFields.image],
|
|
68
90
|
createdAt: user.createdAt,
|
|
69
91
|
updatedAt: user.updatedAt
|
|
70
92
|
};
|
|
@@ -171,30 +193,27 @@ var PrismaOAuthAccountRepository = class {
|
|
|
171
193
|
}
|
|
172
194
|
};
|
|
173
195
|
var PrismaEmailTokenRepository = class {
|
|
174
|
-
constructor(prisma) {
|
|
196
|
+
constructor(prisma, config) {
|
|
175
197
|
this.prisma = prisma;
|
|
198
|
+
this.config = mergeConfig(config);
|
|
176
199
|
}
|
|
177
|
-
|
|
178
|
-
let result;
|
|
200
|
+
getTokenTable(type) {
|
|
179
201
|
switch (type) {
|
|
180
202
|
case "EMAIL_VERIFICATION":
|
|
181
|
-
|
|
182
|
-
data: { email, token, expires: expiresAt }
|
|
183
|
-
});
|
|
184
|
-
break;
|
|
203
|
+
return this.config.tokenTables.emailVerification;
|
|
185
204
|
case "PASSWORD_RESET":
|
|
186
|
-
|
|
187
|
-
data: { email, token, expires: expiresAt }
|
|
188
|
-
});
|
|
189
|
-
break;
|
|
205
|
+
return this.config.tokenTables.passwordReset;
|
|
190
206
|
case "MAGIC_LINK":
|
|
191
|
-
|
|
192
|
-
data: { email, token, expires: expiresAt, used: false }
|
|
193
|
-
});
|
|
194
|
-
break;
|
|
207
|
+
return this.config.tokenTables.magicLink;
|
|
195
208
|
default:
|
|
196
209
|
throw new Error(`Unsupported token type: ${type}`);
|
|
197
210
|
}
|
|
211
|
+
}
|
|
212
|
+
async create(email, token, type, expiresAt) {
|
|
213
|
+
const tableName = this.getTokenTable(type);
|
|
214
|
+
const data = { email, token, expires: expiresAt };
|
|
215
|
+
if (type === "MAGIC_LINK") data.used = false;
|
|
216
|
+
const result = await this.prisma[tableName].create({ data });
|
|
198
217
|
return {
|
|
199
218
|
id: result.id,
|
|
200
219
|
email: result.email,
|
|
@@ -206,26 +225,10 @@ var PrismaEmailTokenRepository = class {
|
|
|
206
225
|
};
|
|
207
226
|
}
|
|
208
227
|
async findByEmailAndToken(email, token, type) {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
where: { email, token }
|
|
214
|
-
});
|
|
215
|
-
break;
|
|
216
|
-
case "PASSWORD_RESET":
|
|
217
|
-
result = await this.prisma.passwordResetToken.findFirst({
|
|
218
|
-
where: { email, token }
|
|
219
|
-
});
|
|
220
|
-
break;
|
|
221
|
-
case "MAGIC_LINK":
|
|
222
|
-
result = await this.prisma.magicLinkToken.findFirst({
|
|
223
|
-
where: { email, token }
|
|
224
|
-
});
|
|
225
|
-
break;
|
|
226
|
-
default:
|
|
227
|
-
throw new Error(`Unsupported token type: ${type}`);
|
|
228
|
-
}
|
|
228
|
+
const tableName = this.getTokenTable(type);
|
|
229
|
+
const result = await this.prisma[tableName].findFirst({
|
|
230
|
+
where: { email, token }
|
|
231
|
+
});
|
|
229
232
|
if (!result) return null;
|
|
230
233
|
return {
|
|
231
234
|
id: result.id,
|
|
@@ -238,40 +241,27 @@ var PrismaEmailTokenRepository = class {
|
|
|
238
241
|
};
|
|
239
242
|
}
|
|
240
243
|
async delete(email, token, type) {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
});
|
|
246
|
-
break;
|
|
247
|
-
case "PASSWORD_RESET":
|
|
248
|
-
await this.prisma.passwordResetToken.deleteMany({
|
|
249
|
-
where: { email, token }
|
|
250
|
-
});
|
|
251
|
-
break;
|
|
252
|
-
case "MAGIC_LINK":
|
|
253
|
-
await this.prisma.magicLinkToken.deleteMany({
|
|
254
|
-
where: { email, token }
|
|
255
|
-
});
|
|
256
|
-
break;
|
|
257
|
-
}
|
|
244
|
+
const tableName = this.getTokenTable(type);
|
|
245
|
+
await this.prisma[tableName].deleteMany({
|
|
246
|
+
where: { email, token }
|
|
247
|
+
});
|
|
258
248
|
}
|
|
259
249
|
async deleteExpired() {
|
|
260
250
|
const now = /* @__PURE__ */ new Date();
|
|
261
251
|
await Promise.all([
|
|
262
|
-
this.prisma.
|
|
252
|
+
this.prisma[this.config.tokenTables.emailVerification].deleteMany({
|
|
263
253
|
where: { expires: { lt: now } }
|
|
264
254
|
}),
|
|
265
|
-
this.prisma.
|
|
255
|
+
this.prisma[this.config.tokenTables.passwordReset].deleteMany({
|
|
266
256
|
where: { expires: { lt: now } }
|
|
267
257
|
}),
|
|
268
|
-
this.prisma.
|
|
258
|
+
this.prisma[this.config.tokenTables.magicLink].deleteMany({
|
|
269
259
|
where: { expires: { lt: now } }
|
|
270
260
|
})
|
|
271
261
|
]);
|
|
272
262
|
}
|
|
273
263
|
async markAsUsed(id) {
|
|
274
|
-
await this.prisma.
|
|
264
|
+
await this.prisma[this.config.tokenTables.magicLink].update({
|
|
275
265
|
where: { id },
|
|
276
266
|
data: { used: true }
|
|
277
267
|
});
|
package/dist/auth/config.js
CHANGED
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
getAuthConfig,
|
|
3
3
|
initializeAuth,
|
|
4
4
|
resetAuth
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-K25ICPU4.js";
|
|
5
|
+
} from "../chunk-52BIDTZH.js";
|
|
7
6
|
import "../chunk-2QH66EVQ.js";
|
|
7
|
+
import "../chunk-K25ICPU4.js";
|
|
8
8
|
import "../chunk-ORMEWXMH.js";
|
|
9
9
|
export {
|
|
10
10
|
getAuthConfig,
|
|
@@ -15,6 +15,7 @@ export interface CookieOptions {
|
|
|
15
15
|
secure?: boolean;
|
|
16
16
|
sameSite?: 'lax' | 'strict' | 'none';
|
|
17
17
|
domain?: string;
|
|
18
|
+
refreshTokenPath?: string;
|
|
18
19
|
}
|
|
19
20
|
export declare function setTokenCookies<T extends CookieSettableResponse>(response: T, tokenPair: TokenPair, options?: CookieOptions): T;
|
|
20
21
|
export declare function clearTokenCookies<T extends CookieSettableResponse>(response: T, options?: CookieOptions): T;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
clearTokenCookies,
|
|
3
3
|
setTokenCookies
|
|
4
|
-
} from "../../../chunk-
|
|
5
|
-
import "../../../chunk-
|
|
6
|
-
import "../../../chunk-K25ICPU4.js";
|
|
4
|
+
} from "../../../chunk-SUA4WQRN.js";
|
|
5
|
+
import "../../../chunk-XICTHSUH.js";
|
|
7
6
|
import "../../../chunk-2QH66EVQ.js";
|
|
7
|
+
import "../../../chunk-K25ICPU4.js";
|
|
8
8
|
import "../../../chunk-ORMEWXMH.js";
|
|
9
9
|
export {
|
|
10
10
|
clearTokenCookies,
|
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
clearTokenCookies,
|
|
7
7
|
setTokenCookies
|
|
8
|
-
} from "../../../chunk-
|
|
8
|
+
} from "../../../chunk-SUA4WQRN.js";
|
|
9
9
|
import "../../../chunk-AIH3F7JV.js";
|
|
10
|
-
import "../../../chunk-
|
|
11
|
-
import "../../../chunk-K25ICPU4.js";
|
|
10
|
+
import "../../../chunk-XICTHSUH.js";
|
|
12
11
|
import "../../../chunk-2QH66EVQ.js";
|
|
12
|
+
import "../../../chunk-K25ICPU4.js";
|
|
13
13
|
import "../../../chunk-ORMEWXMH.js";
|
|
14
14
|
export {
|
|
15
15
|
JWTManager,
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
OAUTH_PROVIDERS,
|
|
3
3
|
PasswordStrength,
|
|
4
|
-
TokenType
|
|
5
|
-
|
|
6
|
-
} from "../../../chunk-6D3HHYER.js";
|
|
4
|
+
TokenType
|
|
5
|
+
} from "../../../chunk-QKC73SWB.js";
|
|
7
6
|
import "../../../chunk-ORMEWXMH.js";
|
|
8
7
|
export {
|
|
9
|
-
|
|
8
|
+
OAUTH_PROVIDERS,
|
|
10
9
|
PasswordStrength,
|
|
11
|
-
TokenType
|
|
12
|
-
UserRole
|
|
10
|
+
TokenType
|
|
13
11
|
};
|
|
@@ -2,50 +2,40 @@
|
|
|
2
2
|
* Shared Auth - OAuth Module
|
|
3
3
|
*
|
|
4
4
|
* OAuth 2.0 인증 모듈 (프레임워크 독립적)
|
|
5
|
-
*
|
|
5
|
+
* 플러그인 기반 프로바이더 레지스트리 패턴
|
|
6
6
|
*/
|
|
7
|
-
import type { OAuthConfig, OAuthUserInfo, Logger } from '@withwiz/auth/types';
|
|
8
|
-
import {
|
|
9
|
-
export {
|
|
7
|
+
import type { OAuthConfig, OAuthUserInfo, Logger, IOAuthProviderAdapter } from '@withwiz/auth/types';
|
|
8
|
+
import { OAUTH_PROVIDERS } from '@withwiz/auth/types';
|
|
9
|
+
export { OAUTH_PROVIDERS };
|
|
10
|
+
export { GoogleOAuthProvider, GitHubOAuthProvider, KakaoOAuthProvider } from './providers';
|
|
10
11
|
export declare class OAuthManager {
|
|
11
12
|
private config;
|
|
12
13
|
private logger;
|
|
14
|
+
private providers;
|
|
13
15
|
constructor(config: OAuthConfig, logger: Logger);
|
|
14
16
|
/**
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
getLoginUrl(provider: OAuthProvider, state: string): string;
|
|
18
|
-
/**
|
|
19
|
-
* Google OAuth 로그인 URL
|
|
17
|
+
* 프로바이더 어댑터 등록
|
|
20
18
|
*/
|
|
21
|
-
|
|
19
|
+
registerProvider(provider: IOAuthProviderAdapter): void;
|
|
22
20
|
/**
|
|
23
|
-
*
|
|
21
|
+
* OAuth 로그인 URL 생성
|
|
24
22
|
*/
|
|
25
|
-
|
|
23
|
+
getLoginUrl(providerName: string, state: string): string;
|
|
26
24
|
/**
|
|
27
25
|
* 인증 코드를 액세스 토큰으로 교환
|
|
28
26
|
*/
|
|
29
|
-
exchangeCodeForToken(
|
|
30
|
-
/**
|
|
31
|
-
* Google 코드 교환
|
|
32
|
-
*/
|
|
33
|
-
private exchangeGoogleCode;
|
|
34
|
-
/**
|
|
35
|
-
* GitHub 코드 교환
|
|
36
|
-
*/
|
|
37
|
-
private exchangeGitHubCode;
|
|
27
|
+
exchangeCodeForToken(providerName: string, code: string): Promise<string>;
|
|
38
28
|
/**
|
|
39
29
|
* 사용자 정보 가져오기
|
|
40
30
|
*/
|
|
41
|
-
getUserInfo(
|
|
31
|
+
getUserInfo(providerName: string, accessToken: string): Promise<OAuthUserInfo>;
|
|
42
32
|
/**
|
|
43
|
-
*
|
|
33
|
+
* 프로바이더 어댑터 조회
|
|
44
34
|
*/
|
|
45
|
-
private
|
|
35
|
+
private getProvider;
|
|
46
36
|
/**
|
|
47
|
-
*
|
|
37
|
+
* 프로바이더 설정 조회
|
|
48
38
|
*/
|
|
49
|
-
private
|
|
39
|
+
private getProviderConfig;
|
|
50
40
|
}
|
|
51
|
-
export type { OAuthConfig, OAuthUserInfo, OAuthTokenResponse } from '@withwiz/auth/types';
|
|
41
|
+
export type { OAuthConfig, OAuthUserInfo, OAuthTokenResponse, IOAuthProviderAdapter, OAuthProviderConfig } from '@withwiz/auth/types';
|
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OAuthManager
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-HZLJYEOO.js";
|
|
4
|
+
import "../../../chunk-T4MDCVUQ.js";
|
|
4
5
|
import {
|
|
5
|
-
|
|
6
|
-
} from "../../../chunk-
|
|
6
|
+
KakaoOAuthProvider
|
|
7
|
+
} from "../../../chunk-2QQNL4ND.js";
|
|
8
|
+
import {
|
|
9
|
+
GitHubOAuthProvider
|
|
10
|
+
} from "../../../chunk-GBLNXNEH.js";
|
|
11
|
+
import {
|
|
12
|
+
GoogleOAuthProvider
|
|
13
|
+
} from "../../../chunk-RVL5ROWQ.js";
|
|
14
|
+
import {
|
|
15
|
+
OAUTH_PROVIDERS
|
|
16
|
+
} from "../../../chunk-QKC73SWB.js";
|
|
7
17
|
import "../../../chunk-AIH3F7JV.js";
|
|
8
18
|
import "../../../chunk-ORMEWXMH.js";
|
|
9
19
|
export {
|
|
10
|
-
|
|
11
|
-
|
|
20
|
+
GitHubOAuthProvider,
|
|
21
|
+
GoogleOAuthProvider,
|
|
22
|
+
KakaoOAuthProvider,
|
|
23
|
+
OAUTH_PROVIDERS,
|
|
24
|
+
OAuthManager
|
|
12
25
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub OAuth Provider Adapter
|
|
3
|
+
*
|
|
4
|
+
* GitHub OAuth 2.0 인증 어댑터
|
|
5
|
+
*/
|
|
6
|
+
import type { IOAuthProviderAdapter, OAuthProviderConfig, OAuthUserInfo, OAuthTokenResponse } from '@withwiz/auth/types';
|
|
7
|
+
export declare class GitHubOAuthProvider implements IOAuthProviderAdapter {
|
|
8
|
+
readonly name = "github";
|
|
9
|
+
getLoginUrl(config: OAuthProviderConfig, state?: string): string;
|
|
10
|
+
exchangeCodeForToken(config: OAuthProviderConfig, code: string): Promise<OAuthTokenResponse>;
|
|
11
|
+
getUserInfo(accessToken: string): Promise<OAuthUserInfo>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Google OAuth Provider Adapter
|
|
3
|
+
*
|
|
4
|
+
* Google OAuth 2.0 인증 어댑터
|
|
5
|
+
*/
|
|
6
|
+
import type { IOAuthProviderAdapter, OAuthProviderConfig, OAuthUserInfo, OAuthTokenResponse } from '@withwiz/auth/types';
|
|
7
|
+
export declare class GoogleOAuthProvider implements IOAuthProviderAdapter {
|
|
8
|
+
readonly name = "google";
|
|
9
|
+
getLoginUrl(config: OAuthProviderConfig, state?: string): string;
|
|
10
|
+
exchangeCodeForToken(config: OAuthProviderConfig, code: string): Promise<OAuthTokenResponse>;
|
|
11
|
+
getUserInfo(accessToken: string): Promise<OAuthUserInfo>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import "../../../../chunk-T4MDCVUQ.js";
|
|
2
|
+
import {
|
|
3
|
+
KakaoOAuthProvider
|
|
4
|
+
} from "../../../../chunk-2QQNL4ND.js";
|
|
5
|
+
import {
|
|
6
|
+
GitHubOAuthProvider
|
|
7
|
+
} from "../../../../chunk-GBLNXNEH.js";
|
|
8
|
+
import {
|
|
9
|
+
GoogleOAuthProvider
|
|
10
|
+
} from "../../../../chunk-RVL5ROWQ.js";
|
|
11
|
+
import "../../../../chunk-AIH3F7JV.js";
|
|
12
|
+
import "../../../../chunk-ORMEWXMH.js";
|
|
13
|
+
export {
|
|
14
|
+
GitHubOAuthProvider,
|
|
15
|
+
GoogleOAuthProvider,
|
|
16
|
+
KakaoOAuthProvider
|
|
17
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kakao OAuth Provider Adapter
|
|
3
|
+
*
|
|
4
|
+
* Kakao OAuth 2.0 인증 어댑터
|
|
5
|
+
*/
|
|
6
|
+
import type { IOAuthProviderAdapter, OAuthProviderConfig, OAuthUserInfo, OAuthTokenResponse } from '@withwiz/auth/types';
|
|
7
|
+
export declare class KakaoOAuthProvider implements IOAuthProviderAdapter {
|
|
8
|
+
readonly name = "kakao";
|
|
9
|
+
getLoginUrl(config: OAuthProviderConfig, state?: string): string;
|
|
10
|
+
exchangeCodeForToken(config: OAuthProviderConfig, code: string): Promise<OAuthTokenResponse>;
|
|
11
|
+
getUserInfo(accessToken: string): Promise<OAuthUserInfo>;
|
|
12
|
+
}
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ export { JWTClientManager, getStoredTokens, storeTokens, clearStoredTokens, clea
|
|
|
15
15
|
export { PasswordValidator, PasswordHasher, defaultPasswordSchema, strongPasswordSchema, } from './core/password';
|
|
16
16
|
export type { PasswordValidationResult, PasswordConfig } from './core/password';
|
|
17
17
|
export { DEFAULT_PASSWORD_CONFIG, createPasswordValidator, validatePassword, getPasswordStrength, createPasswordSchema, passwordValidator, createPasswordHasher, } from './core/password/client-helper';
|
|
18
|
-
export { OAuthManager } from './core/oauth';
|
|
19
|
-
export type { OAuthConfig, OAuthUserInfo, OAuthTokenResponse } from './core/oauth';
|
|
18
|
+
export { OAuthManager, GoogleOAuthProvider, GitHubOAuthProvider, KakaoOAuthProvider } from './core/oauth';
|
|
20
19
|
export { TokenGenerator } from './core/email/token-generator';
|
|
21
|
-
export {
|
|
20
|
+
export { PasswordStrength, OAUTH_PROVIDERS, TokenType } from './types';
|
package/dist/auth/index.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
OAuthManager
|
|
3
|
-
} from "../chunk-V5K5FYU7.js";
|
|
4
1
|
import {
|
|
5
2
|
DEFAULT_PASSWORD_CONFIG,
|
|
6
3
|
createPasswordHasher,
|
|
@@ -16,6 +13,19 @@ import {
|
|
|
16
13
|
defaultPasswordSchema,
|
|
17
14
|
strongPasswordSchema
|
|
18
15
|
} from "../chunk-IHXRF3BH.js";
|
|
16
|
+
import {
|
|
17
|
+
OAuthManager
|
|
18
|
+
} from "../chunk-HZLJYEOO.js";
|
|
19
|
+
import "../chunk-T4MDCVUQ.js";
|
|
20
|
+
import {
|
|
21
|
+
KakaoOAuthProvider
|
|
22
|
+
} from "../chunk-2QQNL4ND.js";
|
|
23
|
+
import {
|
|
24
|
+
GitHubOAuthProvider
|
|
25
|
+
} from "../chunk-GBLNXNEH.js";
|
|
26
|
+
import {
|
|
27
|
+
GoogleOAuthProvider
|
|
28
|
+
} from "../chunk-RVL5ROWQ.js";
|
|
19
29
|
import {
|
|
20
30
|
JWTClientManager,
|
|
21
31
|
clearStoredTokens,
|
|
@@ -36,16 +46,15 @@ import {
|
|
|
36
46
|
TokenGenerator
|
|
37
47
|
} from "../chunk-GDWEDUHO.js";
|
|
38
48
|
import {
|
|
39
|
-
|
|
49
|
+
OAUTH_PROVIDERS,
|
|
40
50
|
PasswordStrength,
|
|
41
|
-
TokenType
|
|
42
|
-
|
|
43
|
-
} from "../chunk-6D3HHYER.js";
|
|
51
|
+
TokenType
|
|
52
|
+
} from "../chunk-QKC73SWB.js";
|
|
44
53
|
import {
|
|
45
54
|
JWTManager,
|
|
46
55
|
JWTService
|
|
47
56
|
} from "../chunk-3GAY2T2A.js";
|
|
48
|
-
import "../chunk-
|
|
57
|
+
import "../chunk-SUA4WQRN.js";
|
|
49
58
|
import {
|
|
50
59
|
AUTH_ERROR_CODES,
|
|
51
60
|
AuthError,
|
|
@@ -54,29 +63,31 @@ import {
|
|
|
54
63
|
OAuthError,
|
|
55
64
|
PasswordError
|
|
56
65
|
} from "../chunk-AIH3F7JV.js";
|
|
57
|
-
import "../chunk-
|
|
58
|
-
import "../chunk-K25ICPU4.js";
|
|
66
|
+
import "../chunk-XICTHSUH.js";
|
|
59
67
|
import "../chunk-2QH66EVQ.js";
|
|
68
|
+
import "../chunk-K25ICPU4.js";
|
|
60
69
|
import "../chunk-ORMEWXMH.js";
|
|
61
70
|
export {
|
|
62
71
|
AUTH_ERROR_CODES,
|
|
63
72
|
AuthError,
|
|
64
73
|
DEFAULT_PASSWORD_CONFIG,
|
|
65
74
|
EmailError,
|
|
75
|
+
GitHubOAuthProvider,
|
|
76
|
+
GoogleOAuthProvider,
|
|
66
77
|
JWTClientManager,
|
|
67
78
|
JWTError,
|
|
68
79
|
JWTManager,
|
|
69
80
|
JWTService,
|
|
81
|
+
KakaoOAuthProvider,
|
|
82
|
+
OAUTH_PROVIDERS,
|
|
70
83
|
OAuthError,
|
|
71
84
|
OAuthManager,
|
|
72
|
-
OAuthProvider,
|
|
73
85
|
PasswordError,
|
|
74
86
|
PasswordHasher,
|
|
75
87
|
PasswordStrength,
|
|
76
88
|
PasswordValidator,
|
|
77
89
|
TokenGenerator,
|
|
78
90
|
TokenType,
|
|
79
|
-
UserRole,
|
|
80
91
|
clearStoredTokens,
|
|
81
92
|
clearTokens,
|
|
82
93
|
createApiHeaders,
|