@withwiz/toolkit 0.4.0 → 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 +4 -1
- package/dist/auth/core/jwt/index.d.ts +1 -1
- package/dist/auth/core/jwt/index.js +4 -1
- 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 +27 -13
- package/dist/auth/types/index.d.ts +31 -31
- package/dist/auth/types/index.js +5 -7
- package/dist/cache/cache-config.d.ts +0 -32
- package/dist/cache/cache-config.js +6 -6
- package/dist/cache/cache-defaults.d.ts +2 -28
- package/dist/cache/cache-defaults.js +1 -1
- package/dist/cache/cache-env.js +5 -5
- package/dist/cache/cache-factory.js +14 -14
- package/dist/cache/cache-invalidation.js +15 -15
- package/dist/cache/cache-redis.js +8 -8
- package/dist/cache/cache-wrapper.js +15 -15
- package/dist/cache/cache.js +22 -26
- package/dist/cache/config.d.ts +0 -8
- package/dist/cache/config.js +2 -2
- package/dist/cache/hybrid-cache-manager.js +10 -10
- package/dist/cache/index.d.ts +0 -1
- package/dist/cache/index.js +22 -26
- package/dist/cache/inmemory-cache-manager.js +5 -5
- package/dist/cache/noop-cache-manager.d.ts +2 -2
- package/dist/cache/noop-cache-manager.js +7 -7
- package/dist/cache/redis-cache-manager.d.ts +2 -2
- package/dist/cache/redis-cache-manager.js +9 -9
- package/dist/chunk-2QQNL4ND.js +62 -0
- package/dist/{chunk-YP5SAHAP.js → chunk-3OZH2AMD.js} +10 -10
- package/dist/{chunk-WMQE2YK7.js → chunk-3WS5MO6P.js} +1 -1
- package/dist/{chunk-BYCFXGQL.js → chunk-4OCGUJL5.js} +4 -4
- package/dist/{chunk-IQQKKUAV.js → chunk-57W32BFZ.js} +4 -30
- package/dist/{chunk-VF4EVAMV.js → chunk-5HSGNXQ3.js} +1 -1
- package/dist/{chunk-KZUBO2IL.js → chunk-6OYE5XKI.js} +5 -5
- package/dist/{chunk-FD2TXDTO.js → chunk-6WI4HNAF.js} +2 -2
- package/dist/{chunk-J4TTSXDN.js → chunk-6XDE62WQ.js} +1 -1
- package/dist/{chunk-TO5CMMQC.js → chunk-7ZQQ6PJ4.js} +4 -17
- package/dist/{chunk-JLLMTTQ4.js → chunk-C4TSQUFA.js} +0 -7
- package/dist/{chunk-SV7X6HEN.js → chunk-D46PE6MU.js} +4 -4
- package/dist/{chunk-2F6KNGOD.js → chunk-DANUXNQU.js} +1 -1
- package/dist/{chunk-FDRIFPG6.js → chunk-DSRRNRZW.js} +4 -4
- package/dist/{chunk-XI4MRH5P.js → chunk-ET6RH4LB.js} +12 -40
- 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-AXCB7SKY.js → chunk-IEFYARHC.js} +16 -16
- package/dist/{chunk-3YUKCYHI.js → chunk-JY62DSMP.js} +8 -8
- package/dist/{chunk-G5OMETUS.js → chunk-LCKQOHXI.js} +1 -1
- package/dist/{chunk-7IN4WRSO.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-RWVGJUON.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-AJLUPYCQ.js → chunk-SUA4WQRN.js} +20 -8
- package/dist/chunk-T4MDCVUQ.js +0 -0
- package/dist/{chunk-L6AU74EI.js → chunk-TOVBPLHD.js} +3 -3
- package/dist/{chunk-TFD3DSM2.js → chunk-UCIUAZQT.js} +14 -18
- package/dist/chunk-VIWM2ZZH.js +45 -0
- package/dist/{chunk-KGHWGLED.js → chunk-W3IVVPS5.js} +4 -4
- package/dist/{chunk-WNF2RKFA.js → chunk-WBU53USI.js} +13 -13
- package/dist/{chunk-FPESPW6P.js → chunk-XA32Z2OV.js} +1 -1
- package/dist/{chunk-GQVBWZLH.js → chunk-Y22GDIM6.js} +2 -2
- package/dist/{chunk-OIVXOT2X.js → chunk-YUBXS7YI.js} +2 -3
- package/dist/{chunk-VDXB5DCY.js → chunk-ZRDPJORV.js} +0 -10
- 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 +11 -13
- package/dist/constants/pagination.d.ts +0 -5
- package/dist/constants/pagination.js +1 -1
- package/dist/constants/security.d.ts +0 -6
- package/dist/constants/security.js +1 -3
- package/dist/constants/validation.d.ts +1 -3
- 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 +12 -12
- 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 +22 -20
- 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 +10 -10
- package/dist/system/health-check.js +9 -9
- package/dist/system/index.js +16 -16
- package/dist/system/memory.js +6 -6
- package/dist/system/network.js +6 -6
- package/dist/system/utils.js +5 -5
- package/dist/types/env.d.ts +2 -13
- 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.d.ts +6 -4
- package/dist/utils/cors.js +4 -4
- package/dist/utils/csv-export.js +5 -5
- package/dist/utils/error-message-formatter.js +1 -1
- package/dist/utils/error-processor.js +5 -5
- package/dist/utils/index.js +8 -8
- package/dist/utils/optimistic-lock.d.ts +4 -4
- package/package.json +5 -1
- package/dist/cache/cache-keys-legacy.d.ts +0 -35
- package/dist/cache/cache-keys-legacy.js +0 -7
- package/dist/chunk-JBCDEAMW.js +0 -35
- package/dist/chunk-O7CK3CKJ.js +0 -84
- 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-QMCOX3DP.js → chunk-EBUEBEJX.js} +0 -0
- 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
package/dist/cache/index.js
CHANGED
|
@@ -1,32 +1,29 @@
|
|
|
1
|
-
import "../chunk-
|
|
1
|
+
import "../chunk-EBUEBEJX.js";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "../chunk-
|
|
3
|
+
invalidateCache
|
|
4
|
+
} from "../chunk-5HSGNXQ3.js";
|
|
5
5
|
import {
|
|
6
6
|
cacheMetrics,
|
|
7
7
|
withCache
|
|
8
|
-
} from "../chunk-
|
|
9
|
-
import {
|
|
10
|
-
invalidateCache
|
|
11
|
-
} from "../chunk-VF4EVAMV.js";
|
|
8
|
+
} from "../chunk-OSDAP24S.js";
|
|
12
9
|
import {
|
|
13
10
|
cache,
|
|
14
11
|
geoCache,
|
|
15
12
|
getCacheManager,
|
|
16
13
|
getEffectiveCacheBackend
|
|
17
|
-
} from "../chunk-
|
|
18
|
-
import {
|
|
19
|
-
NoopCacheManager
|
|
20
|
-
} from "../chunk-FDRIFPG6.js";
|
|
21
|
-
import {
|
|
22
|
-
RedisCacheManager
|
|
23
|
-
} from "../chunk-KZUBO2IL.js";
|
|
14
|
+
} from "../chunk-MF4CWGMB.js";
|
|
24
15
|
import {
|
|
25
16
|
HybridCacheManager
|
|
26
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-D46PE6MU.js";
|
|
27
18
|
import {
|
|
28
19
|
InMemoryCacheManager
|
|
29
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-6XDE62WQ.js";
|
|
21
|
+
import {
|
|
22
|
+
NoopCacheManager
|
|
23
|
+
} from "../chunk-DSRRNRZW.js";
|
|
24
|
+
import {
|
|
25
|
+
RedisCacheManager
|
|
26
|
+
} from "../chunk-6OYE5XKI.js";
|
|
30
27
|
import {
|
|
31
28
|
checkRedisConnection,
|
|
32
29
|
getRedisClient,
|
|
@@ -36,29 +33,29 @@ import {
|
|
|
36
33
|
logRedisInitialization,
|
|
37
34
|
notifyRedisError,
|
|
38
35
|
resetRedisGlobalState
|
|
39
|
-
} from "../chunk-
|
|
40
|
-
import "../chunk-
|
|
36
|
+
} from "../chunk-IEFYARHC.js";
|
|
37
|
+
import "../chunk-Y22GDIM6.js";
|
|
41
38
|
import "../chunk-SS56XFLI.js";
|
|
42
|
-
import "../chunk-
|
|
39
|
+
import "../chunk-6O3I4ORK.js";
|
|
43
40
|
import {
|
|
44
41
|
getCacheConfig,
|
|
45
42
|
getCacheTTL
|
|
46
|
-
} from "../chunk-
|
|
43
|
+
} from "../chunk-VIWM2ZZH.js";
|
|
47
44
|
import {
|
|
48
45
|
getConfig,
|
|
49
46
|
getENV,
|
|
50
47
|
getEnv,
|
|
51
48
|
isCacheEnabled,
|
|
52
49
|
validateRedisEnvironment
|
|
53
|
-
} from "../chunk-
|
|
54
|
-
import "../chunk-SFPMFVSD.js";
|
|
50
|
+
} from "../chunk-ET6RH4LB.js";
|
|
55
51
|
import {
|
|
56
52
|
getResolvedCacheConfig,
|
|
57
53
|
initializeCache,
|
|
58
54
|
resetCache
|
|
59
|
-
} from "../chunk-
|
|
60
|
-
import "../chunk-
|
|
55
|
+
} from "../chunk-UCIUAZQT.js";
|
|
56
|
+
import "../chunk-XICTHSUH.js";
|
|
61
57
|
import "../chunk-2QH66EVQ.js";
|
|
58
|
+
import "../chunk-K25ICPU4.js";
|
|
62
59
|
import {
|
|
63
60
|
CACHE_DURATION_DEFAULTS,
|
|
64
61
|
CACHE_ENV_VARS,
|
|
@@ -72,7 +69,7 @@ import {
|
|
|
72
69
|
TEN_MINUTES,
|
|
73
70
|
THIRTY_DAYS,
|
|
74
71
|
THIRTY_MINUTES
|
|
75
|
-
} from "../chunk-
|
|
72
|
+
} from "../chunk-57W32BFZ.js";
|
|
76
73
|
import "../chunk-ORMEWXMH.js";
|
|
77
74
|
export {
|
|
78
75
|
CACHE_DURATION_DEFAULTS,
|
|
@@ -92,7 +89,6 @@ export {
|
|
|
92
89
|
THIRTY_DAYS,
|
|
93
90
|
THIRTY_MINUTES,
|
|
94
91
|
cache,
|
|
95
|
-
cacheKeys,
|
|
96
92
|
cacheMetrics,
|
|
97
93
|
checkRedisConnection,
|
|
98
94
|
geoCache,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
InMemoryCacheManager
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-6XDE62WQ.js";
|
|
4
|
+
import "../chunk-Y22GDIM6.js";
|
|
5
5
|
import "../chunk-SS56XFLI.js";
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-K25ICPU4.js";
|
|
6
|
+
import "../chunk-6O3I4ORK.js";
|
|
7
|
+
import "../chunk-XICTHSUH.js";
|
|
9
8
|
import "../chunk-2QH66EVQ.js";
|
|
9
|
+
import "../chunk-K25ICPU4.js";
|
|
10
10
|
import "../chunk-ORMEWXMH.js";
|
|
11
11
|
export {
|
|
12
12
|
InMemoryCacheManager
|
|
@@ -29,8 +29,8 @@ export declare class NoopCacheManager implements IUnifiedCacheManager {
|
|
|
29
29
|
envVars: {
|
|
30
30
|
[x: string]: string;
|
|
31
31
|
CACHE_ENABLED: string;
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
REDIS_REST_URL: string;
|
|
33
|
+
REDIS_REST_TOKEN: string;
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
36
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NoopCacheManager
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-K25ICPU4.js";
|
|
3
|
+
} from "../chunk-DSRRNRZW.js";
|
|
4
|
+
import "../chunk-VIWM2ZZH.js";
|
|
5
|
+
import "../chunk-ET6RH4LB.js";
|
|
6
|
+
import "../chunk-UCIUAZQT.js";
|
|
7
|
+
import "../chunk-XICTHSUH.js";
|
|
9
8
|
import "../chunk-2QH66EVQ.js";
|
|
10
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-K25ICPU4.js";
|
|
10
|
+
import "../chunk-57W32BFZ.js";
|
|
11
11
|
import "../chunk-ORMEWXMH.js";
|
|
12
12
|
export {
|
|
13
13
|
NoopCacheManager
|
|
@@ -18,8 +18,8 @@ export declare class RedisCacheManager implements IUnifiedCacheManager {
|
|
|
18
18
|
redisAvailable: boolean;
|
|
19
19
|
envVars: {
|
|
20
20
|
CACHE_ENABLED: string;
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
REDIS_REST_URL: string;
|
|
22
|
+
REDIS_REST_TOKEN: string;
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
25
|
private getKey;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RedisCacheManager
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-K25ICPU4.js";
|
|
3
|
+
} from "../chunk-6OYE5XKI.js";
|
|
4
|
+
import "../chunk-IEFYARHC.js";
|
|
5
|
+
import "../chunk-Y22GDIM6.js";
|
|
6
|
+
import "../chunk-6O3I4ORK.js";
|
|
7
|
+
import "../chunk-ET6RH4LB.js";
|
|
8
|
+
import "../chunk-UCIUAZQT.js";
|
|
9
|
+
import "../chunk-XICTHSUH.js";
|
|
11
10
|
import "../chunk-2QH66EVQ.js";
|
|
12
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-K25ICPU4.js";
|
|
12
|
+
import "../chunk-57W32BFZ.js";
|
|
13
13
|
import "../chunk-ORMEWXMH.js";
|
|
14
14
|
export {
|
|
15
15
|
RedisCacheManager
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import {
|
|
2
|
+
OAuthError
|
|
3
|
+
} from "./chunk-AIH3F7JV.js";
|
|
4
|
+
|
|
5
|
+
// src/auth/core/oauth/providers/kakao.ts
|
|
6
|
+
var KakaoOAuthProvider = class {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.name = "kakao";
|
|
9
|
+
}
|
|
10
|
+
getLoginUrl(config, state) {
|
|
11
|
+
const params = new URLSearchParams({
|
|
12
|
+
client_id: config.clientId,
|
|
13
|
+
redirect_uri: config.redirectUri,
|
|
14
|
+
response_type: "code",
|
|
15
|
+
scope: "profile_nickname profile_image account_email"
|
|
16
|
+
});
|
|
17
|
+
if (state) {
|
|
18
|
+
params.set("state", state);
|
|
19
|
+
}
|
|
20
|
+
return `https://kauth.kakao.com/oauth/authorize?${params.toString()}`;
|
|
21
|
+
}
|
|
22
|
+
async exchangeCodeForToken(config, code) {
|
|
23
|
+
const response = await fetch("https://kauth.kakao.com/oauth/token", {
|
|
24
|
+
method: "POST",
|
|
25
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
26
|
+
body: new URLSearchParams({
|
|
27
|
+
client_id: config.clientId,
|
|
28
|
+
client_secret: config.clientSecret,
|
|
29
|
+
code,
|
|
30
|
+
grant_type: "authorization_code",
|
|
31
|
+
redirect_uri: config.redirectUri
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
if (!response.ok) {
|
|
35
|
+
const errorData = await response.text();
|
|
36
|
+
throw new OAuthError(`Kakao token exchange failed: ${errorData}`, "TOKEN_EXCHANGE_FAILED");
|
|
37
|
+
}
|
|
38
|
+
return response.json();
|
|
39
|
+
}
|
|
40
|
+
async getUserInfo(accessToken) {
|
|
41
|
+
const response = await fetch("https://kapi.kakao.com/v2/user/me", {
|
|
42
|
+
headers: { Authorization: `Bearer ${accessToken}` }
|
|
43
|
+
});
|
|
44
|
+
if (!response.ok) {
|
|
45
|
+
throw new OAuthError("Failed to get Kakao user info", "USER_INFO_FAILED");
|
|
46
|
+
}
|
|
47
|
+
const data = await response.json();
|
|
48
|
+
const account = data.kakao_account || {};
|
|
49
|
+
const profile = account.profile || {};
|
|
50
|
+
return {
|
|
51
|
+
id: data.id.toString(),
|
|
52
|
+
email: account.email,
|
|
53
|
+
name: profile.nickname || null,
|
|
54
|
+
image: profile.profile_image_url || null,
|
|
55
|
+
emailVerified: account.is_email_verified || false
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export {
|
|
61
|
+
KakaoOAuthProvider
|
|
62
|
+
};
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
initRequestMiddleware
|
|
3
|
-
} from "./chunk-62Q7DN5G.js";
|
|
4
1
|
import {
|
|
5
2
|
MiddlewareChain
|
|
6
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XA32Z2OV.js";
|
|
7
4
|
import {
|
|
8
5
|
rateLimitMiddleware
|
|
9
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-S5KJZZKU.js";
|
|
10
7
|
import {
|
|
11
8
|
responseLoggerMiddleware
|
|
12
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-FNKFQFZJ.js";
|
|
13
10
|
import {
|
|
14
11
|
securityMiddleware
|
|
15
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-3WS5MO6P.js";
|
|
16
13
|
import {
|
|
17
14
|
adminMiddleware,
|
|
18
15
|
authMiddleware,
|
|
19
16
|
optionalAuthMiddleware
|
|
20
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-NDET73GO.js";
|
|
21
18
|
import {
|
|
22
19
|
corsMiddleware
|
|
23
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-W3IVVPS5.js";
|
|
24
21
|
import {
|
|
25
22
|
errorHandlerMiddleware
|
|
26
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-JY62DSMP.js";
|
|
24
|
+
import {
|
|
25
|
+
initRequestMiddleware
|
|
26
|
+
} from "./chunk-62Q7DN5G.js";
|
|
27
27
|
|
|
28
28
|
// src/middleware/wrappers.ts
|
|
29
29
|
function withPublicApi(handler) {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
formatDatabaseError,
|
|
3
3
|
formatRedisError
|
|
4
|
-
} from "./chunk-
|
|
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
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-UCIUAZQT.js";
|
|
14
14
|
|
|
15
15
|
// src/system/health-check.ts
|
|
16
16
|
async function checkServiceHealth(prismaClient) {
|
|
@@ -31,15 +31,7 @@ var CACHE_TTL_DEFAULTS = {
|
|
|
31
31
|
/** 분석 데이터 TTL (30분) */
|
|
32
32
|
ANALYTICS: THIRTY_MINUTES,
|
|
33
33
|
/** 사용자 데이터 TTL (30분) */
|
|
34
|
-
USER: THIRTY_MINUTES
|
|
35
|
-
/** 링크 데이터 TTL (30분) */
|
|
36
|
-
LINK: THIRTY_MINUTES,
|
|
37
|
-
/** 별칭 TTL (5분) - 자주 확인되는 데이터 */
|
|
38
|
-
ALIAS: FIVE_MINUTES,
|
|
39
|
-
/** 커뮤니티 TTL (15분) */
|
|
40
|
-
COMMUNITY: FIFTEEN_MINUTES,
|
|
41
|
-
/** 예약어 TTL (30분) */
|
|
42
|
-
RESERVED_WORDS: THIRTY_MINUTES
|
|
34
|
+
USER: THIRTY_MINUTES
|
|
43
35
|
};
|
|
44
36
|
var CACHE_DURATION_DEFAULTS = {
|
|
45
37
|
/** 분석 데이터 (30분) */
|
|
@@ -50,22 +42,8 @@ var CACHE_DURATION_DEFAULTS = {
|
|
|
50
42
|
GEOIP: THIRTY_DAYS,
|
|
51
43
|
/** 설정 데이터 (30분) */
|
|
52
44
|
SETTINGS: THIRTY_MINUTES,
|
|
53
|
-
/** 예약어 데이터 (30분) */
|
|
54
|
-
RESERVED_WORDS: THIRTY_MINUTES,
|
|
55
|
-
/** 별칭 데이터 (5분) */
|
|
56
|
-
ALIAS: FIVE_MINUTES,
|
|
57
|
-
/** 커뮤니티 데이터 (15분) */
|
|
58
|
-
COMMUNITY: FIFTEEN_MINUTES,
|
|
59
|
-
/** 링크 데이터 (30분) */
|
|
60
|
-
LINK: THIRTY_MINUTES,
|
|
61
45
|
/** Rate Limit (1분) */
|
|
62
|
-
RATE_LIMIT: ONE_MINUTE
|
|
63
|
-
/** URL 토큰 (5분) */
|
|
64
|
-
URL_TOKEN: FIVE_MINUTES,
|
|
65
|
-
/** API 키 (5분) */
|
|
66
|
-
API_KEY: FIVE_MINUTES,
|
|
67
|
-
/** API 설정 (10분) */
|
|
68
|
-
API_CONFIG: TEN_MINUTES
|
|
46
|
+
RATE_LIMIT: ONE_MINUTE
|
|
69
47
|
};
|
|
70
48
|
var CACHE_FALLBACK_DEFAULTS = {
|
|
71
49
|
/** 전역 Redis 에러 임계값 (이 값 이상이면 즉시 전역 비활성화) */
|
|
@@ -104,8 +82,8 @@ var CACHE_ENV_VARS = {
|
|
|
104
82
|
CACHE_INMEMORY_EVICTION: "CACHE_INMEMORY_EVICTION",
|
|
105
83
|
CACHE_INMEMORY_CLEANUP_INTERVAL: "CACHE_INMEMORY_CLEANUP_INTERVAL",
|
|
106
84
|
// Redis 설정
|
|
107
|
-
|
|
108
|
-
|
|
85
|
+
REDIS_REST_URL: "REDIS_REST_URL",
|
|
86
|
+
REDIS_REST_TOKEN: "REDIS_REST_TOKEN",
|
|
109
87
|
// TTL 설정
|
|
110
88
|
CACHE_TTL_DEFAULT: "CACHE_TTL_DEFAULT",
|
|
111
89
|
CACHE_TTL_SHORT: "CACHE_TTL_SHORT",
|
|
@@ -114,10 +92,6 @@ var CACHE_ENV_VARS = {
|
|
|
114
92
|
CACHE_TTL_SETTINGS: "CACHE_TTL_SETTINGS",
|
|
115
93
|
CACHE_TTL_ANALYTICS: "CACHE_TTL_ANALYTICS",
|
|
116
94
|
CACHE_TTL_USER: "CACHE_TTL_USER",
|
|
117
|
-
CACHE_TTL_LINK: "CACHE_TTL_LINK",
|
|
118
|
-
CACHE_TTL_ALIAS: "CACHE_TTL_ALIAS",
|
|
119
|
-
CACHE_TTL_COMMUNITY: "CACHE_TTL_COMMUNITY",
|
|
120
|
-
CACHE_TTL_RESERVED_WORDS: "CACHE_TTL_RESERVED_WORDS",
|
|
121
95
|
// 폴백 설정
|
|
122
96
|
CACHE_REDIS_ERROR_THRESHOLD_GLOBAL: "CACHE_REDIS_ERROR_THRESHOLD_GLOBAL",
|
|
123
97
|
CACHE_REDIS_ERROR_THRESHOLD_LOCAL: "CACHE_REDIS_ERROR_THRESHOLD_LOCAL",
|
|
@@ -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";
|
|
@@ -105,8 +105,8 @@ var RedisCacheManager = class _RedisCacheManager {
|
|
|
105
105
|
redisAvailable: !!getRedisClient(),
|
|
106
106
|
envVars: {
|
|
107
107
|
CACHE_ENABLED: ENV.CACHE.ENABLED ? "true" : "false",
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
REDIS_REST_URL: ENV.REDIS.URL ? "\uC124\uC815\uB428" : "\uBBF8\uC124\uC815",
|
|
109
|
+
REDIS_REST_TOKEN: ENV.REDIS.TOKEN ? "\uC124\uC815\uB428" : "\uBBF8\uC124\uC815"
|
|
110
110
|
}
|
|
111
111
|
};
|
|
112
112
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getCorsConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-23LXAAMU.js";
|
|
4
4
|
import {
|
|
5
5
|
getCommonConfig
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-XICTHSUH.js";
|
|
7
7
|
import {
|
|
8
8
|
__spreadValues
|
|
9
9
|
} from "./chunk-ORMEWXMH.js";
|
|
@@ -51,10 +51,9 @@ function getBaseUrl() {
|
|
|
51
51
|
}
|
|
52
52
|
} catch (e) {
|
|
53
53
|
}
|
|
54
|
-
return "
|
|
54
|
+
return "";
|
|
55
55
|
}
|
|
56
56
|
function getAllowedOrigins() {
|
|
57
|
-
var _a;
|
|
58
57
|
const origins = /* @__PURE__ */ new Set();
|
|
59
58
|
try {
|
|
60
59
|
const middlewareCorsConfig = getCorsConfig();
|
|
@@ -62,25 +61,13 @@ function getAllowedOrigins() {
|
|
|
62
61
|
} catch (e) {
|
|
63
62
|
}
|
|
64
63
|
const baseUrl = getBaseUrl();
|
|
65
|
-
if (baseUrl
|
|
64
|
+
if (baseUrl) {
|
|
66
65
|
const extractedDomains = extractDomainsFromUrl(baseUrl);
|
|
67
66
|
extractedDomains.forEach((domain) => origins.add(domain));
|
|
68
67
|
}
|
|
69
68
|
if (globalCorsConfig.additionalOrigins) {
|
|
70
69
|
globalCorsConfig.additionalOrigins.forEach((origin) => origins.add(origin));
|
|
71
70
|
}
|
|
72
|
-
let isDev = (_a = globalCorsConfig.isDevelopment) != null ? _a : false;
|
|
73
|
-
if (!isDev) {
|
|
74
|
-
try {
|
|
75
|
-
isDev = getCommonConfig().nodeEnv === "development";
|
|
76
|
-
} catch (e) {
|
|
77
|
-
isDev = false;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
if (isDev) {
|
|
81
|
-
origins.add("http://localhost:3000");
|
|
82
|
-
origins.add("http://127.0.0.1:3000");
|
|
83
|
-
}
|
|
84
71
|
return Array.from(origins).filter(Boolean);
|
|
85
72
|
}
|
|
86
73
|
function isOriginAllowed(origin) {
|
|
@@ -27,12 +27,6 @@ var MAGIC_LINK = {
|
|
|
27
27
|
/** 토큰 길이 (바이트) */
|
|
28
28
|
TOKEN_LENGTH: 32
|
|
29
29
|
};
|
|
30
|
-
var API_KEY = {
|
|
31
|
-
/** 키 길이 (문자) */
|
|
32
|
-
LENGTH: 32,
|
|
33
|
-
/** 키 접두사 */
|
|
34
|
-
PREFIX: "tlog_"
|
|
35
|
-
};
|
|
36
30
|
var SESSION = {
|
|
37
31
|
/** 세션 쿠키 이름 */
|
|
38
32
|
COOKIE_NAME: "session",
|
|
@@ -67,7 +61,6 @@ export {
|
|
|
67
61
|
EMAIL_VERIFICATION,
|
|
68
62
|
PASSWORD_RESET,
|
|
69
63
|
MAGIC_LINK,
|
|
70
|
-
API_KEY,
|
|
71
64
|
SESSION,
|
|
72
65
|
OAUTH,
|
|
73
66
|
CSRF,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
InMemoryCacheManager
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6XDE62WQ.js";
|
|
4
4
|
import {
|
|
5
5
|
isRedisGloballyDisabled,
|
|
6
6
|
notifyRedisError
|
|
7
|
-
} from "./chunk-
|
|
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";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getCacheConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VIWM2ZZH.js";
|
|
4
4
|
import {
|
|
5
5
|
getENV
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ET6RH4LB.js";
|
|
7
7
|
|
|
8
8
|
// src/cache/noop-cache-manager.ts
|
|
9
9
|
var NoopCacheManager = class {
|
|
@@ -57,8 +57,8 @@ var NoopCacheManager = class {
|
|
|
57
57
|
envVars: {
|
|
58
58
|
CACHE_ENABLED: ENV.CACHE.ENABLED ? "true" : "false",
|
|
59
59
|
[envVarName]: "disabled",
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
REDIS_REST_URL: ENV.REDIS.URL ? "\uC124\uC815\uB428" : "\uBBF8\uC124\uC815",
|
|
61
|
+
REDIS_REST_TOKEN: ENV.REDIS.TOKEN ? "\uC124\uC815\uB428" : "\uBBF8\uC124\uC815"
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
64
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getCommonConfig
|
|
3
|
-
} from "./chunk-SFPMFVSD.js";
|
|
4
1
|
import {
|
|
5
2
|
getResolvedCacheConfig
|
|
6
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-UCIUAZQT.js";
|
|
4
|
+
import {
|
|
5
|
+
getCommonConfig
|
|
6
|
+
} from "./chunk-XICTHSUH.js";
|
|
7
7
|
|
|
8
8
|
// src/cache/cache-env.ts
|
|
9
9
|
function _getNodeEnv() {
|
|
@@ -14,14 +14,14 @@ function _getNodeEnv() {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
function getConfig() {
|
|
17
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B
|
|
17
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B;
|
|
18
18
|
const cc = getResolvedCacheConfig();
|
|
19
19
|
const nodeEnv = _getNodeEnv();
|
|
20
20
|
return {
|
|
21
21
|
env: {
|
|
22
22
|
NODE_ENV: nodeEnv,
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
REDIS_REST_URL: (_a = cc.redis) == null ? void 0 : _a.url,
|
|
24
|
+
REDIS_REST_TOKEN: (_b = cc.redis) == null ? void 0 : _b.token,
|
|
25
25
|
CACHE_ENABLED: cc.enabled
|
|
26
26
|
},
|
|
27
27
|
ENV: {
|
|
@@ -58,37 +58,9 @@ function getConfig() {
|
|
|
58
58
|
ENABLED: (_x = (_w = cc.categories.SETTINGS) == null ? void 0 : _w.enabled) != null ? _x : true,
|
|
59
59
|
DURATION: (_z = (_y = cc.categories.SETTINGS) == null ? void 0 : _y.duration) != null ? _z : 1800
|
|
60
60
|
},
|
|
61
|
-
RESERVED_WORDS: {
|
|
62
|
-
ENABLED: (_B = (_A = cc.categories.RESERVED_WORDS) == null ? void 0 : _A.enabled) != null ? _B : true,
|
|
63
|
-
DURATION: (_D = (_C = cc.categories.RESERVED_WORDS) == null ? void 0 : _C.duration) != null ? _D : 1800
|
|
64
|
-
},
|
|
65
|
-
ALIAS: {
|
|
66
|
-
ENABLED: (_F = (_E = cc.categories.ALIAS) == null ? void 0 : _E.enabled) != null ? _F : true,
|
|
67
|
-
DURATION: (_H = (_G = cc.categories.ALIAS) == null ? void 0 : _G.duration) != null ? _H : 300
|
|
68
|
-
},
|
|
69
|
-
COMMUNITY: {
|
|
70
|
-
ENABLED: (_J = (_I = cc.categories.COMMUNITY) == null ? void 0 : _I.enabled) != null ? _J : true,
|
|
71
|
-
DURATION: (_L = (_K = cc.categories.COMMUNITY) == null ? void 0 : _K.duration) != null ? _L : 900
|
|
72
|
-
},
|
|
73
|
-
LINK: {
|
|
74
|
-
ENABLED: (_N = (_M = cc.categories.LINK) == null ? void 0 : _M.enabled) != null ? _N : true,
|
|
75
|
-
DURATION: (_P = (_O = cc.categories.LINK) == null ? void 0 : _O.duration) != null ? _P : 1800
|
|
76
|
-
},
|
|
77
61
|
RATE_LIMIT: {
|
|
78
62
|
ENABLED: true,
|
|
79
|
-
DURATION: (
|
|
80
|
-
},
|
|
81
|
-
URL_TOKEN: {
|
|
82
|
-
ENABLED: (_T = (_S = cc.categories.URL_TOKEN) == null ? void 0 : _S.enabled) != null ? _T : true,
|
|
83
|
-
DURATION: (_V = (_U = cc.categories.URL_TOKEN) == null ? void 0 : _U.duration) != null ? _V : 300
|
|
84
|
-
},
|
|
85
|
-
API_KEY: {
|
|
86
|
-
ENABLED: (_X = (_W = cc.categories.API_KEY) == null ? void 0 : _W.enabled) != null ? _X : true,
|
|
87
|
-
DURATION: (_Z = (_Y = cc.categories.API_KEY) == null ? void 0 : _Y.duration) != null ? _Z : 300
|
|
88
|
-
},
|
|
89
|
-
API_CONFIG: {
|
|
90
|
-
ENABLED: (_$ = (__ = cc.categories.API_CONFIG) == null ? void 0 : __.enabled) != null ? _$ : true,
|
|
91
|
-
DURATION: (_ba = (_aa = cc.categories.API_CONFIG) == null ? void 0 : _aa.duration) != null ? _ba : 600
|
|
63
|
+
DURATION: (_B = (_A = cc.categories.RATE_LIMIT) == null ? void 0 : _A.duration) != null ? _B : 60
|
|
92
64
|
}
|
|
93
65
|
}
|
|
94
66
|
},
|
|
@@ -109,14 +81,14 @@ function validateRedisEnvironment() {
|
|
|
109
81
|
const redisUrl = (_a = cc.redis) == null ? void 0 : _a.url;
|
|
110
82
|
const redisToken = (_b = cc.redis) == null ? void 0 : _b.token;
|
|
111
83
|
if (!redisUrl) {
|
|
112
|
-
errors.push("
|
|
84
|
+
errors.push("Redis URL is not configured.");
|
|
113
85
|
} else if (redisUrl.trim() === "") {
|
|
114
|
-
errors.push("
|
|
86
|
+
errors.push("Redis URL is an empty string.");
|
|
115
87
|
}
|
|
116
88
|
if (!redisToken) {
|
|
117
|
-
errors.push("
|
|
89
|
+
errors.push("Redis token is not configured.");
|
|
118
90
|
} else if (redisToken.trim() === "") {
|
|
119
|
-
errors.push("
|
|
91
|
+
errors.push("Redis token is an empty string.");
|
|
120
92
|
}
|
|
121
93
|
return {
|
|
122
94
|
isValid: errors.length === 0,
|