@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
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
} from "./chunk-YUBXS7YI.js";
|
|
5
5
|
import {
|
|
6
6
|
getPlatform
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-G5WP3MJG.js";
|
|
8
8
|
import {
|
|
9
9
|
logger
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-Y22GDIM6.js";
|
|
11
11
|
import {
|
|
12
12
|
getResolvedCacheConfig
|
|
13
13
|
} from "./chunk-UCIUAZQT.js";
|
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
isRedisGloballyDisabled,
|
|
4
4
|
notifyRedisError,
|
|
5
5
|
resetRedisGlobalState
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-IEFYARHC.js";
|
|
7
7
|
import {
|
|
8
8
|
logger
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-Y22GDIM6.js";
|
|
10
10
|
import {
|
|
11
11
|
getENV,
|
|
12
12
|
isCacheEnabled
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-ET6RH4LB.js";
|
|
14
14
|
import {
|
|
15
15
|
__spreadValues
|
|
16
16
|
} from "./chunk-ORMEWXMH.js";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
InMemoryCacheManager
|
|
3
|
+
} from "./chunk-6XDE62WQ.js";
|
|
1
4
|
import {
|
|
2
5
|
isRedisGloballyDisabled,
|
|
3
6
|
notifyRedisError
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import {
|
|
6
|
-
InMemoryCacheManager
|
|
7
|
-
} from "./chunk-J4TTSXDN.js";
|
|
7
|
+
} from "./chunk-IEFYARHC.js";
|
|
8
8
|
import {
|
|
9
9
|
logger
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-Y22GDIM6.js";
|
|
11
11
|
import {
|
|
12
12
|
getCacheFallbackConfig
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-ET6RH4LB.js";
|
|
14
14
|
import {
|
|
15
15
|
__spreadValues
|
|
16
16
|
} from "./chunk-ORMEWXMH.js";
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import {
|
|
2
|
+
OAuthError
|
|
3
|
+
} from "./chunk-AIH3F7JV.js";
|
|
4
|
+
|
|
5
|
+
// src/auth/core/oauth/providers/github.ts
|
|
6
|
+
var GitHubOAuthProvider = class {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.name = "github";
|
|
9
|
+
}
|
|
10
|
+
getLoginUrl(config, state) {
|
|
11
|
+
const params = new URLSearchParams({
|
|
12
|
+
client_id: config.clientId,
|
|
13
|
+
redirect_uri: config.redirectUri,
|
|
14
|
+
scope: "read:user user:email"
|
|
15
|
+
});
|
|
16
|
+
if (state) {
|
|
17
|
+
params.set("state", state);
|
|
18
|
+
}
|
|
19
|
+
return `https://github.com/login/oauth/authorize?${params.toString()}`;
|
|
20
|
+
}
|
|
21
|
+
async exchangeCodeForToken(config, code) {
|
|
22
|
+
const response = await fetch("https://github.com/login/oauth/access_token", {
|
|
23
|
+
method: "POST",
|
|
24
|
+
headers: {
|
|
25
|
+
"Content-Type": "application/json",
|
|
26
|
+
Accept: "application/json"
|
|
27
|
+
},
|
|
28
|
+
body: JSON.stringify({
|
|
29
|
+
client_id: config.clientId,
|
|
30
|
+
client_secret: config.clientSecret,
|
|
31
|
+
code,
|
|
32
|
+
redirect_uri: config.redirectUri
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
if (!response.ok) {
|
|
36
|
+
const errorData = await response.text();
|
|
37
|
+
throw new OAuthError(`GitHub token exchange failed: ${errorData}`, "TOKEN_EXCHANGE_FAILED");
|
|
38
|
+
}
|
|
39
|
+
return response.json();
|
|
40
|
+
}
|
|
41
|
+
async getUserInfo(accessToken) {
|
|
42
|
+
const response = await fetch("https://api.github.com/user", {
|
|
43
|
+
headers: {
|
|
44
|
+
Authorization: `Bearer ${accessToken}`,
|
|
45
|
+
"User-Agent": "Auth-Module"
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
if (!response.ok) {
|
|
49
|
+
throw new OAuthError("Failed to get GitHub user info", "USER_INFO_FAILED");
|
|
50
|
+
}
|
|
51
|
+
const data = await response.json();
|
|
52
|
+
return {
|
|
53
|
+
id: data.id.toString(),
|
|
54
|
+
email: data.email,
|
|
55
|
+
name: data.name || null,
|
|
56
|
+
image: data.avatar_url || null,
|
|
57
|
+
emailVerified: !!data.email
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export {
|
|
63
|
+
GitHubOAuthProvider
|
|
64
|
+
};
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
formatBytesPerSec,
|
|
4
4
|
runCommand,
|
|
5
5
|
runMacCommand
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-G5WP3MJG.js";
|
|
7
7
|
import {
|
|
8
8
|
logger
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-Y22GDIM6.js";
|
|
10
10
|
|
|
11
11
|
// src/system/network.ts
|
|
12
12
|
async function getNetworkInfo() {
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import {
|
|
2
|
+
KakaoOAuthProvider
|
|
3
|
+
} from "./chunk-2QQNL4ND.js";
|
|
4
|
+
import {
|
|
5
|
+
GitHubOAuthProvider
|
|
6
|
+
} from "./chunk-GBLNXNEH.js";
|
|
7
|
+
import {
|
|
8
|
+
GoogleOAuthProvider
|
|
9
|
+
} from "./chunk-RVL5ROWQ.js";
|
|
10
|
+
import {
|
|
11
|
+
OAuthError
|
|
12
|
+
} from "./chunk-AIH3F7JV.js";
|
|
13
|
+
|
|
14
|
+
// src/auth/core/oauth/index.ts
|
|
15
|
+
var OAuthManager = class {
|
|
16
|
+
constructor(config, logger) {
|
|
17
|
+
this.providers = /* @__PURE__ */ new Map();
|
|
18
|
+
this.config = config;
|
|
19
|
+
this.logger = logger;
|
|
20
|
+
this.registerProvider(new GoogleOAuthProvider());
|
|
21
|
+
this.registerProvider(new GitHubOAuthProvider());
|
|
22
|
+
this.registerProvider(new KakaoOAuthProvider());
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* 프로바이더 어댑터 등록
|
|
26
|
+
*/
|
|
27
|
+
registerProvider(provider) {
|
|
28
|
+
this.providers.set(provider.name, provider);
|
|
29
|
+
this.logger.debug(`OAuth provider registered: ${provider.name}`);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* OAuth 로그인 URL 생성
|
|
33
|
+
*/
|
|
34
|
+
getLoginUrl(providerName, state) {
|
|
35
|
+
const provider = this.getProvider(providerName);
|
|
36
|
+
const config = this.getProviderConfig(providerName);
|
|
37
|
+
return provider.getLoginUrl(config, state);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* 인증 코드를 액세스 토큰으로 교환
|
|
41
|
+
*/
|
|
42
|
+
async exchangeCodeForToken(providerName, code) {
|
|
43
|
+
const provider = this.getProvider(providerName);
|
|
44
|
+
const config = this.getProviderConfig(providerName);
|
|
45
|
+
try {
|
|
46
|
+
const tokenResponse = await provider.exchangeCodeForToken(config, code);
|
|
47
|
+
this.logger.debug(`${providerName} token exchange successful`);
|
|
48
|
+
return tokenResponse.access_token;
|
|
49
|
+
} catch (error) {
|
|
50
|
+
this.logger.error(`${providerName} token exchange error`, { error: error.message });
|
|
51
|
+
throw error instanceof OAuthError ? error : new OAuthError(`${providerName} token exchange failed`, "TOKEN_EXCHANGE_FAILED");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* 사용자 정보 가져오기
|
|
56
|
+
*/
|
|
57
|
+
async getUserInfo(providerName, accessToken) {
|
|
58
|
+
const provider = this.getProvider(providerName);
|
|
59
|
+
try {
|
|
60
|
+
const userInfo = await provider.getUserInfo(accessToken);
|
|
61
|
+
this.logger.debug(`${providerName} user info retrieved`, { userId: userInfo.id, email: userInfo.email });
|
|
62
|
+
return userInfo;
|
|
63
|
+
} catch (error) {
|
|
64
|
+
this.logger.error(`${providerName} user info error`, { error: error.message });
|
|
65
|
+
throw error instanceof OAuthError ? error : new OAuthError(`Failed to retrieve ${providerName} user info`, "USER_INFO_FAILED");
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* 프로바이더 어댑터 조회
|
|
70
|
+
*/
|
|
71
|
+
getProvider(name) {
|
|
72
|
+
const provider = this.providers.get(name);
|
|
73
|
+
if (!provider) {
|
|
74
|
+
throw new OAuthError(`Unsupported OAuth provider: ${name}`, "UNSUPPORTED_PROVIDER");
|
|
75
|
+
}
|
|
76
|
+
return provider;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* 프로바이더 설정 조회
|
|
80
|
+
*/
|
|
81
|
+
getProviderConfig(providerName) {
|
|
82
|
+
const config = this.config.providers[providerName];
|
|
83
|
+
if (!config) {
|
|
84
|
+
throw new OAuthError(`${providerName} OAuth not configured`, `${providerName.toUpperCase()}_NOT_CONFIGURED`);
|
|
85
|
+
}
|
|
86
|
+
return config;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export {
|
|
91
|
+
OAuthManager
|
|
92
|
+
};
|
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
} from "./chunk-MAATEX2R.js";
|
|
7
7
|
import {
|
|
8
8
|
DataTableFilters
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-LJEGM4OO.js";
|
|
10
10
|
import {
|
|
11
11
|
DataTablePagination
|
|
12
12
|
} from "./chunk-IPXPCBDO.js";
|
|
13
13
|
import {
|
|
14
14
|
DataTableSearch
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-TH45RVP7.js";
|
|
16
16
|
import {
|
|
17
17
|
DEFAULT_LABELS
|
|
18
18
|
} from "./chunk-NY5QXT33.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
logger
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-Y22GDIM6.js";
|
|
4
4
|
import {
|
|
5
5
|
getCacheFallbackConfig,
|
|
6
6
|
getConfig,
|
|
7
7
|
getEnv,
|
|
8
8
|
isCacheEnabled,
|
|
9
9
|
validateRedisEnvironment
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-ET6RH4LB.js";
|
|
11
11
|
|
|
12
12
|
// src/cache/cache-redis.ts
|
|
13
13
|
import { Redis } from "@upstash/redis";
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getErrorMessage
|
|
3
|
+
} from "./chunk-JNJALNRR.js";
|
|
1
4
|
import {
|
|
2
5
|
AUTH_ERROR_CODE_MAP
|
|
3
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-TOVBPLHD.js";
|
|
4
7
|
import {
|
|
5
8
|
AppError
|
|
6
9
|
} from "./chunk-EOEMOXNT.js";
|
|
7
|
-
import {
|
|
8
|
-
getErrorMessage
|
|
9
|
-
} from "./chunk-JNJALNRR.js";
|
|
10
10
|
import {
|
|
11
11
|
ERROR_CODES,
|
|
12
12
|
classifyError
|
|
13
13
|
} from "./chunk-SNTLJ646.js";
|
|
14
|
+
import {
|
|
15
|
+
logger
|
|
16
|
+
} from "./chunk-Y22GDIM6.js";
|
|
14
17
|
import {
|
|
15
18
|
AuthError
|
|
16
19
|
} from "./chunk-AIH3F7JV.js";
|
|
17
|
-
import {
|
|
18
|
-
logger
|
|
19
|
-
} from "./chunk-GQVBWZLH.js";
|
|
20
20
|
import {
|
|
21
21
|
getCommonConfig
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-XICTHSUH.js";
|
|
23
23
|
import {
|
|
24
24
|
__spreadValues
|
|
25
25
|
} from "./chunk-ORMEWXMH.js";
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
HybridCacheManager
|
|
3
|
+
} from "./chunk-D46PE6MU.js";
|
|
4
|
+
import {
|
|
5
|
+
InMemoryCacheManager
|
|
6
|
+
} from "./chunk-6XDE62WQ.js";
|
|
1
7
|
import {
|
|
2
8
|
NoopCacheManager
|
|
3
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-DSRRNRZW.js";
|
|
4
10
|
import {
|
|
5
11
|
RedisCacheManager
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import {
|
|
8
|
-
HybridCacheManager
|
|
9
|
-
} from "./chunk-FUDEEQR3.js";
|
|
12
|
+
} from "./chunk-6OYE5XKI.js";
|
|
10
13
|
import {
|
|
11
14
|
isRedisAvailableNow,
|
|
12
15
|
isRedisGloballyDisabled
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import {
|
|
15
|
-
InMemoryCacheManager
|
|
16
|
-
} from "./chunk-J4TTSXDN.js";
|
|
16
|
+
} from "./chunk-IEFYARHC.js";
|
|
17
17
|
import {
|
|
18
18
|
logger
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-Y22GDIM6.js";
|
|
20
20
|
import {
|
|
21
21
|
getCacheConfig
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-VIWM2ZZH.js";
|
|
23
23
|
import {
|
|
24
24
|
getENV,
|
|
25
25
|
isCacheEnabled
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-ET6RH4LB.js";
|
|
27
27
|
|
|
28
28
|
// src/cache/cache-factory.ts
|
|
29
29
|
function getInMemoryConfig() {
|
|
@@ -4,15 +4,15 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
ERROR_CODES
|
|
6
6
|
} from "./chunk-SNTLJ646.js";
|
|
7
|
+
import {
|
|
8
|
+
logger
|
|
9
|
+
} from "./chunk-Y22GDIM6.js";
|
|
7
10
|
import {
|
|
8
11
|
getAuthConfig
|
|
9
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-52BIDTZH.js";
|
|
10
13
|
import {
|
|
11
14
|
JWTManager
|
|
12
15
|
} from "./chunk-3GAY2T2A.js";
|
|
13
|
-
import {
|
|
14
|
-
logger
|
|
15
|
-
} from "./chunk-GQVBWZLH.js";
|
|
16
16
|
|
|
17
17
|
// src/middleware/auth.ts
|
|
18
18
|
function setAccessTokenBlacklistChecker(checker) {
|
|
@@ -72,7 +72,7 @@ function initializeAuthMiddleware() {
|
|
|
72
72
|
return jwtManager !== null;
|
|
73
73
|
}
|
|
74
74
|
var authMiddleware = async (context, next) => {
|
|
75
|
-
var _a, _b, _c, _d;
|
|
75
|
+
var _a, _b, _c, _d, _e;
|
|
76
76
|
try {
|
|
77
77
|
const jwtManager = getJWTManager();
|
|
78
78
|
if (!jwtManager) {
|
|
@@ -111,13 +111,13 @@ var authMiddleware = async (context, next) => {
|
|
|
111
111
|
email: (_c = payload.email) != null ? _c : "",
|
|
112
112
|
name: void 0,
|
|
113
113
|
// 필요시 DB에서 조회
|
|
114
|
-
role: payload.role
|
|
114
|
+
role: (_d = payload.role) != null ? _d : "USER"
|
|
115
115
|
};
|
|
116
116
|
} catch (error) {
|
|
117
117
|
if (error instanceof AppError) {
|
|
118
118
|
throw error;
|
|
119
119
|
}
|
|
120
|
-
if (error.code === "TOKEN_EXPIRED" || ((
|
|
120
|
+
if (error.code === "TOKEN_EXPIRED" || ((_e = error.message) == null ? void 0 : _e.includes("expired"))) {
|
|
121
121
|
throw new AppError(ERROR_CODES.TOKEN_EXPIRED.code, error.message);
|
|
122
122
|
}
|
|
123
123
|
throw new AppError(
|
|
@@ -128,7 +128,7 @@ var authMiddleware = async (context, next) => {
|
|
|
128
128
|
return await next();
|
|
129
129
|
};
|
|
130
130
|
var optionalAuthMiddleware = async (context, next) => {
|
|
131
|
-
var _a, _b, _c;
|
|
131
|
+
var _a, _b, _c, _d;
|
|
132
132
|
try {
|
|
133
133
|
const jwtManager = getJWTManager();
|
|
134
134
|
if (jwtManager) {
|
|
@@ -149,7 +149,7 @@ var optionalAuthMiddleware = async (context, next) => {
|
|
|
149
149
|
id: payload.userId,
|
|
150
150
|
email: (_c = payload.email) != null ? _c : "",
|
|
151
151
|
name: void 0,
|
|
152
|
-
role: payload.role
|
|
152
|
+
role: (_d = payload.role) != null ? _d : "USER"
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
155
|
}
|
|
@@ -158,20 +158,24 @@ var optionalAuthMiddleware = async (context, next) => {
|
|
|
158
158
|
}
|
|
159
159
|
return await next();
|
|
160
160
|
};
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
161
|
+
function createRoleMiddleware(...allowedRoles) {
|
|
162
|
+
return async (context, next) => {
|
|
163
|
+
if (!context.user) {
|
|
164
|
+
throw new AppError(ERROR_CODES.UNAUTHORIZED.code);
|
|
165
|
+
}
|
|
166
|
+
if (!allowedRoles.includes(context.user.role)) {
|
|
167
|
+
throw new AppError(ERROR_CODES.FORBIDDEN.code);
|
|
168
|
+
}
|
|
169
|
+
return await next();
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
var adminMiddleware = createRoleMiddleware("ADMIN");
|
|
170
173
|
|
|
171
174
|
export {
|
|
172
175
|
setAccessTokenBlacklistChecker,
|
|
173
176
|
initializeAuthMiddleware,
|
|
174
177
|
authMiddleware,
|
|
175
178
|
optionalAuthMiddleware,
|
|
179
|
+
createRoleMiddleware,
|
|
176
180
|
adminMiddleware
|
|
177
181
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getCacheManager,
|
|
3
3
|
getEffectiveCacheBackend
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MF4CWGMB.js";
|
|
5
5
|
import {
|
|
6
6
|
logger
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-Y22GDIM6.js";
|
|
8
8
|
import {
|
|
9
9
|
getCacheConfig,
|
|
10
10
|
getCacheTTL
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-VIWM2ZZH.js";
|
|
12
12
|
import {
|
|
13
13
|
isCacheEnabled
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-ET6RH4LB.js";
|
|
15
15
|
|
|
16
16
|
// src/cache/cache-wrapper.ts
|
|
17
17
|
function getCacheBackendLabel() {
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
} from "./chunk-VSGKVZB4.js";
|
|
7
7
|
import {
|
|
8
8
|
IPGeolocationProvider
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-GCR4PGRY.js";
|
|
10
10
|
import {
|
|
11
11
|
MaxMindProvider
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-LCKQOHXI.js";
|
|
13
13
|
|
|
14
14
|
// src/geolocation/providers/index.ts
|
|
15
15
|
var GeoIPProviderFactory = class {
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
// src/auth/types/index.ts
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
var OAuthProvider = /* @__PURE__ */ ((OAuthProvider2) => {
|
|
8
|
-
OAuthProvider2["GOOGLE"] = "google";
|
|
9
|
-
OAuthProvider2["GITHUB"] = "github";
|
|
10
|
-
return OAuthProvider2;
|
|
11
|
-
})(OAuthProvider || {});
|
|
2
|
+
var OAUTH_PROVIDERS = {
|
|
3
|
+
GOOGLE: "google",
|
|
4
|
+
GITHUB: "github",
|
|
5
|
+
KAKAO: "kakao"
|
|
6
|
+
};
|
|
12
7
|
var PasswordStrength = /* @__PURE__ */ ((PasswordStrength2) => {
|
|
13
8
|
PasswordStrength2["VERY_WEAK"] = "VERY_WEAK";
|
|
14
9
|
PasswordStrength2["WEAK"] = "WEAK";
|
|
@@ -25,8 +20,7 @@ var TokenType = /* @__PURE__ */ ((TokenType2) => {
|
|
|
25
20
|
})(TokenType || {});
|
|
26
21
|
|
|
27
22
|
export {
|
|
28
|
-
|
|
29
|
-
OAuthProvider,
|
|
23
|
+
OAUTH_PROVIDERS,
|
|
30
24
|
PasswordStrength,
|
|
31
25
|
TokenType
|
|
32
26
|
};
|