@withwiz/toolkit 0.3.3 → 0.4.1
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/core/jwt/cookie.js +4 -1
- package/dist/auth/core/jwt/index.js +4 -1
- package/dist/auth/index.js +9 -6
- package/dist/cache/cache-config.d.ts +0 -32
- package/dist/cache/cache-config.js +4 -4
- package/dist/cache/cache-defaults.d.ts +2 -28
- package/dist/cache/cache-defaults.js +1 -1
- package/dist/cache/cache-env.js +3 -3
- package/dist/cache/cache-factory.js +10 -10
- package/dist/cache/cache-invalidation.js +10 -10
- package/dist/cache/cache-redis.js +4 -4
- package/dist/cache/cache-wrapper.js +10 -10
- package/dist/cache/cache.js +16 -20
- package/dist/cache/config.d.ts +0 -8
- package/dist/cache/config.js +2 -2
- package/dist/cache/hybrid-cache-manager.js +5 -5
- package/dist/cache/index.d.ts +0 -1
- package/dist/cache/index.js +16 -20
- package/dist/cache/noop-cache-manager.d.ts +2 -2
- package/dist/cache/noop-cache-manager.js +5 -5
- package/dist/cache/redis-cache-manager.d.ts +2 -2
- package/dist/cache/redis-cache-manager.js +5 -5
- package/dist/{chunk-E54MAI4I.js → chunk-2F6KNGOD.js} +2 -2
- package/dist/{chunk-TO5CMMQC.js → chunk-2VMTIYLX.js} +2 -15
- package/dist/{chunk-WNF2RKFA.js → chunk-3J7FDOCU.js} +9 -9
- package/dist/{chunk-BKJPYZYO.js → chunk-3YUKCYHI.js} +4 -4
- package/dist/{chunk-IQQKKUAV.js → chunk-57W32BFZ.js} +4 -30
- package/dist/{chunk-JJ3I57N2.js → chunk-5WP57PJK.js} +6 -6
- package/dist/chunk-7LJWRKDT.js +45 -0
- package/dist/{chunk-S54PFAEU.js → chunk-7VTBRP5M.js} +2 -2
- package/dist/{chunk-HCF3C3AQ.js → chunk-AKD4YMJU.js} +0 -61
- package/dist/{chunk-6MI4XLWC.js → chunk-AQJAY5FA.js} +2 -2
- package/dist/{chunk-XI4MRH5P.js → chunk-BJLLMVWW.js} +11 -39
- package/dist/{chunk-TQJDNWBL.js → chunk-BJSEYZBH.js} +3 -3
- package/dist/{chunk-JLLMTTQ4.js → chunk-C4TSQUFA.js} +0 -7
- package/dist/{chunk-FDRIFPG6.js → chunk-CRWMULHR.js} +4 -4
- package/dist/{chunk-KXXROUA5.js → chunk-EOEMOXNT.js} +1 -44
- package/dist/{chunk-SV7X6HEN.js → chunk-FUDEEQR3.js} +5 -5
- package/dist/{chunk-VF4EVAMV.js → chunk-GFAD4UAT.js} +1 -1
- package/dist/{chunk-7IN4WRSO.js → chunk-GGSFZP6T.js} +9 -9
- package/dist/{chunk-HUDWNKGY.js → chunk-J5AISIJS.js} +2 -2
- package/dist/{chunk-Y2JYA2AR.js → chunk-JNJALNRR.js} +2 -2
- package/dist/{chunk-2KDLKHTO.js → chunk-L6AU74EI.js} +2 -14
- package/dist/{chunk-BYCFXGQL.js → chunk-N3TAGJHR.js} +2 -2
- package/dist/{chunk-AJLUPYCQ.js → chunk-N4D6OPPP.js} +16 -6
- package/dist/{chunk-KZUBO2IL.js → chunk-NQQU6UFE.js} +4 -4
- package/dist/{chunk-IYXMGIEP.js → chunk-ON4ENPUS.js} +0 -61
- package/dist/{chunk-SNVGJPPX.js → chunk-SNTLJ646.js} +0 -80
- package/dist/{chunk-TFD3DSM2.js → chunk-UCIUAZQT.js} +14 -18
- package/dist/{chunk-7JWIX5BS.js → chunk-WMJ5M45N.js} +1 -1
- package/dist/{chunk-AXCB7SKY.js → chunk-X5RMDLLM.js} +15 -15
- package/dist/{chunk-RWVGJUON.js → chunk-YSUL3SLC.js} +3 -3
- 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 +2 -2
- package/dist/components/ui/data-table/DataTable.js +2 -2
- package/dist/constants/error-codes.d.ts +0 -78
- package/dist/constants/error-codes.js +1 -1
- package/dist/constants/index.js +9 -11
- 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/app-error.d.ts +3 -16
- package/dist/error/app-error.js +2 -2
- package/dist/error/error-display.js +7 -7
- package/dist/error/error-handler.d.ts +0 -24
- package/dist/error/error-handler.js +3 -3
- package/dist/error/friendly-messages-v2.js +5 -5
- package/dist/error/friendly-messages.js +1 -15
- package/dist/error/index.js +8 -8
- package/dist/error/messages/en.js +1 -1
- package/dist/error/messages/index.js +3 -3
- package/dist/error/messages/ko.js +1 -1
- package/dist/initialize.js +4 -4
- package/dist/middleware/auth.js +4 -4
- package/dist/middleware/error-handler.js +7 -7
- package/dist/middleware/index.js +14 -14
- package/dist/middleware/rate-limit.d.ts +1 -1
- package/dist/middleware/rate-limit.js +3 -3
- package/dist/middleware/wrappers.js +12 -12
- package/dist/storage/r2-storage.js +2 -2
- package/dist/system/environment.js +3 -3
- package/dist/system/health-check.js +4 -4
- package/dist/system/index.js +5 -5
- package/dist/types/env.d.ts +2 -13
- package/dist/types/qr-code.d.ts +1 -1
- package/dist/utils/api-helpers.js +2 -2
- package/dist/utils/cors.d.ts +6 -4
- package/dist/utils/cors.js +1 -1
- package/dist/utils/error-message-formatter.js +1 -1
- package/dist/utils/error-processor.js +3 -3
- package/dist/utils/index.js +5 -5
- package/dist/utils/optimistic-lock.d.ts +4 -4
- package/dist/utils/optimistic-lock.js +2 -2
- package/package.json +1 -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-QMCOX3DP.js → chunk-EBUEBEJX.js} +0 -0
- package/dist/{chunk-HB5GFTFD.js → chunk-LX2EYD74.js} +3 -3
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RedisCacheManager
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-NQQU6UFE.js";
|
|
4
|
+
import "../chunk-X5RMDLLM.js";
|
|
5
5
|
import "../chunk-GQVBWZLH.js";
|
|
6
6
|
import "../chunk-OHBAELPZ.js";
|
|
7
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-BJLLMVWW.js";
|
|
8
|
+
import "../chunk-UCIUAZQT.js";
|
|
8
9
|
import "../chunk-SFPMFVSD.js";
|
|
9
|
-
import "../chunk-TFD3DSM2.js";
|
|
10
10
|
import "../chunk-K25ICPU4.js";
|
|
11
11
|
import "../chunk-2QH66EVQ.js";
|
|
12
|
-
import "../chunk-
|
|
12
|
+
import "../chunk-57W32BFZ.js";
|
|
13
13
|
import "../chunk-ORMEWXMH.js";
|
|
14
14
|
export {
|
|
15
15
|
RedisCacheManager
|
|
@@ -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) {
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
getAuthConfig
|
|
9
9
|
} from "./chunk-OZE5KUS3.js";
|
|
10
|
+
import {
|
|
11
|
+
getResolvedCacheConfig
|
|
12
|
+
} from "./chunk-UCIUAZQT.js";
|
|
10
13
|
import {
|
|
11
14
|
getCommonConfig
|
|
12
15
|
} from "./chunk-SFPMFVSD.js";
|
|
13
|
-
import {
|
|
14
|
-
getResolvedCacheConfig
|
|
15
|
-
} from "./chunk-TFD3DSM2.js";
|
|
16
16
|
|
|
17
17
|
// src/system/environment.ts
|
|
18
18
|
import os from "os";
|
|
@@ -38,19 +38,19 @@ function checkEnvironmentVariables() {
|
|
|
38
38
|
});
|
|
39
39
|
if (cache.redis) {
|
|
40
40
|
results.push({
|
|
41
|
-
key: "
|
|
41
|
+
key: "REDIS_REST_URL",
|
|
42
42
|
ok: true,
|
|
43
43
|
value: cache.redis.url.length > 20 ? cache.redis.url.substring(0, 20) + "..." : cache.redis.url
|
|
44
44
|
});
|
|
45
|
-
results.push({ key: "
|
|
45
|
+
results.push({ key: "REDIS_REST_TOKEN", ok: true, value: "***" });
|
|
46
46
|
} else {
|
|
47
|
-
results.push({ key: "
|
|
48
|
-
results.push({ key: "
|
|
47
|
+
results.push({ key: "REDIS_REST_URL", ok: false });
|
|
48
|
+
results.push({ key: "REDIS_REST_TOKEN", ok: false });
|
|
49
49
|
}
|
|
50
50
|
} catch (e) {
|
|
51
51
|
results.push({ key: "CACHE_ENABLED", ok: false });
|
|
52
|
-
results.push({ key: "
|
|
53
|
-
results.push({ key: "
|
|
52
|
+
results.push({ key: "REDIS_REST_URL", ok: false });
|
|
53
|
+
results.push({ key: "REDIS_REST_TOKEN", ok: false });
|
|
54
54
|
}
|
|
55
55
|
try {
|
|
56
56
|
const geo = getGeolocationConfig();
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AUTH_ERROR_CODE_MAP
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-L6AU74EI.js";
|
|
4
4
|
import {
|
|
5
5
|
AppError
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-EOEMOXNT.js";
|
|
7
7
|
import {
|
|
8
8
|
getErrorMessage
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-JNJALNRR.js";
|
|
10
10
|
import {
|
|
11
11
|
ERROR_CODES,
|
|
12
12
|
classifyError
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-SNTLJ646.js";
|
|
14
14
|
import {
|
|
15
15
|
AuthError
|
|
16
16
|
} from "./chunk-AIH3F7JV.js";
|
|
@@ -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",
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
initRequestMiddleware
|
|
3
|
-
} from "./chunk-62Q7DN5G.js";
|
|
4
1
|
import {
|
|
5
2
|
MiddlewareChain
|
|
6
3
|
} from "./chunk-FPESPW6P.js";
|
|
7
4
|
import {
|
|
8
5
|
rateLimitMiddleware
|
|
9
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-AQJAY5FA.js";
|
|
10
7
|
import {
|
|
11
8
|
responseLoggerMiddleware
|
|
12
9
|
} from "./chunk-OIRAH57Y.js";
|
|
@@ -17,13 +14,16 @@ import {
|
|
|
17
14
|
adminMiddleware,
|
|
18
15
|
authMiddleware,
|
|
19
16
|
optionalAuthMiddleware
|
|
20
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-J5AISIJS.js";
|
|
21
18
|
import {
|
|
22
19
|
corsMiddleware
|
|
23
20
|
} from "./chunk-KGHWGLED.js";
|
|
24
21
|
import {
|
|
25
22
|
errorHandlerMiddleware
|
|
26
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-3YUKCYHI.js";
|
|
24
|
+
import {
|
|
25
|
+
initRequestMiddleware
|
|
26
|
+
} from "./chunk-62Q7DN5G.js";
|
|
27
27
|
|
|
28
28
|
// src/middleware/wrappers.ts
|
|
29
29
|
function withPublicApi(handler) {
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getENV,
|
|
3
|
+
isCacheEnabled
|
|
4
|
+
} from "./chunk-BJLLMVWW.js";
|
|
5
|
+
|
|
6
|
+
// src/cache/cache-config.ts
|
|
7
|
+
var getCacheConfig = {
|
|
8
|
+
// Analytics 캐시 설정
|
|
9
|
+
analytics: {
|
|
10
|
+
enabled: () => getENV().CACHE.ANALYTICS.ENABLED && isCacheEnabled(),
|
|
11
|
+
duration: () => getENV().CACHE.ANALYTICS.DURATION
|
|
12
|
+
},
|
|
13
|
+
// User 캐시 설정
|
|
14
|
+
user: {
|
|
15
|
+
enabled: () => getENV().CACHE.USER.ENABLED && isCacheEnabled(),
|
|
16
|
+
duration: () => getENV().CACHE.USER.DURATION
|
|
17
|
+
},
|
|
18
|
+
// GeoIP 캐시 설정
|
|
19
|
+
geoip: {
|
|
20
|
+
enabled: () => getENV().CACHE.GEOIP.ENABLED && isCacheEnabled(),
|
|
21
|
+
duration: () => getENV().CACHE.GEOIP.DURATION
|
|
22
|
+
},
|
|
23
|
+
// Settings 캐시 설정
|
|
24
|
+
settings: {
|
|
25
|
+
enabled: () => getENV().CACHE.SETTINGS.ENABLED && isCacheEnabled(),
|
|
26
|
+
duration: () => getENV().CACHE.SETTINGS.DURATION
|
|
27
|
+
},
|
|
28
|
+
// Rate Limiter 캐시 설정
|
|
29
|
+
rateLimit: {
|
|
30
|
+
enabled: () => getENV().CACHE.RATE_LIMIT.ENABLED && isCacheEnabled(),
|
|
31
|
+
duration: () => getENV().CACHE.RATE_LIMIT.DURATION
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var getCacheTTL = {
|
|
35
|
+
settings: () => getCacheConfig.settings.duration(),
|
|
36
|
+
user: () => getCacheConfig.user.duration(),
|
|
37
|
+
analytics: () => getCacheConfig.analytics.duration(),
|
|
38
|
+
geoip: () => getCacheConfig.geoip.duration(),
|
|
39
|
+
default: () => getCacheConfig.analytics.duration()
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export {
|
|
43
|
+
getCacheConfig,
|
|
44
|
+
getCacheTTL
|
|
45
|
+
};
|
|
@@ -38,11 +38,6 @@ var enMessages = {
|
|
|
38
38
|
description: "8+ characters with letters, numbers, and symbols",
|
|
39
39
|
action: "Please set a more complex password."
|
|
40
40
|
},
|
|
41
|
-
40008: {
|
|
42
|
-
title: "Please check alias format",
|
|
43
|
-
description: "Only letters, numbers, and hyphens (-) allowed",
|
|
44
|
-
action: "Example: my-link-123"
|
|
45
|
-
},
|
|
46
41
|
// ============================================
|
|
47
42
|
// Authentication Errors (401xx)
|
|
48
43
|
// ============================================
|
|
@@ -61,16 +56,6 @@ var enMessages = {
|
|
|
61
56
|
description: "Your session has expired for security.",
|
|
62
57
|
action: "Please login again."
|
|
63
58
|
},
|
|
64
|
-
40104: {
|
|
65
|
-
title: "Password required",
|
|
66
|
-
description: "You must enter a password.",
|
|
67
|
-
action: "Please enter the password."
|
|
68
|
-
},
|
|
69
|
-
40105: {
|
|
70
|
-
title: "Incorrect password",
|
|
71
|
-
description: "The password is incorrect.",
|
|
72
|
-
action: "Please check again."
|
|
73
|
-
},
|
|
74
59
|
40106: {
|
|
75
60
|
title: "Login failed",
|
|
76
61
|
description: "Email or password is incorrect.",
|
|
@@ -116,23 +101,6 @@ var enMessages = {
|
|
|
116
101
|
title: "User not found",
|
|
117
102
|
description: "The user does not exist."
|
|
118
103
|
},
|
|
119
|
-
40403: {
|
|
120
|
-
title: "Link not found",
|
|
121
|
-
description: "The shortened link does not exist.",
|
|
122
|
-
action: "Please check the link address."
|
|
123
|
-
},
|
|
124
|
-
40408: {
|
|
125
|
-
title: "Tag not found",
|
|
126
|
-
description: "The tag does not exist."
|
|
127
|
-
},
|
|
128
|
-
40409: {
|
|
129
|
-
title: "Favorite not found",
|
|
130
|
-
description: "The item does not exist."
|
|
131
|
-
},
|
|
132
|
-
40410: {
|
|
133
|
-
title: "Group not found",
|
|
134
|
-
description: "The group does not exist."
|
|
135
|
-
},
|
|
136
104
|
// ============================================
|
|
137
105
|
// Conflict Errors (409xx)
|
|
138
106
|
// ============================================
|
|
@@ -151,11 +119,6 @@ var enMessages = {
|
|
|
151
119
|
description: "This email is already in use by another account.",
|
|
152
120
|
action: "Please use a different email."
|
|
153
121
|
},
|
|
154
|
-
40907: {
|
|
155
|
-
title: "Alias already in use",
|
|
156
|
-
description: "This alias is being used by another link.",
|
|
157
|
-
action: "Please enter a different alias."
|
|
158
|
-
},
|
|
159
122
|
// ============================================
|
|
160
123
|
// Business Logic Errors (422xx)
|
|
161
124
|
// ============================================
|
|
@@ -173,30 +136,6 @@ var enMessages = {
|
|
|
173
136
|
description: "You have exceeded the limit.",
|
|
174
137
|
action: "Please consider upgrading your plan."
|
|
175
138
|
},
|
|
176
|
-
42204: {
|
|
177
|
-
title: "Link expired",
|
|
178
|
-
description: "The validity period has passed.",
|
|
179
|
-
action: "Please create a new link."
|
|
180
|
-
},
|
|
181
|
-
42205: {
|
|
182
|
-
title: "Link disabled",
|
|
183
|
-
description: "Usage has been stopped.",
|
|
184
|
-
action: "Please contact the owner."
|
|
185
|
-
},
|
|
186
|
-
// 42206, 42207: moved to 401xx → see 40104, 40105 below
|
|
187
|
-
42208: {
|
|
188
|
-
title: "Alias not allowed",
|
|
189
|
-
description: "This is a system reserved word.",
|
|
190
|
-
action: "Please choose a different alias."
|
|
191
|
-
},
|
|
192
|
-
42209: {
|
|
193
|
-
title: "Already in favorites",
|
|
194
|
-
description: "Already added."
|
|
195
|
-
},
|
|
196
|
-
42210: {
|
|
197
|
-
title: "Cannot delete",
|
|
198
|
-
description: "Cannot delete your own admin account."
|
|
199
|
-
},
|
|
200
139
|
42211: {
|
|
201
140
|
title: "File too large",
|
|
202
141
|
description: "The maximum size has been exceeded.",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getResolvedCacheConfig
|
|
3
|
+
} from "./chunk-UCIUAZQT.js";
|
|
1
4
|
import {
|
|
2
5
|
getCommonConfig
|
|
3
6
|
} from "./chunk-SFPMFVSD.js";
|
|
4
|
-
import {
|
|
5
|
-
getResolvedCacheConfig
|
|
6
|
-
} from "./chunk-TFD3DSM2.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,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AppError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-EOEMOXNT.js";
|
|
4
4
|
import {
|
|
5
5
|
getErrorDisplayInfo,
|
|
6
6
|
getFriendlyMessage
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-7VTBRP5M.js";
|
|
8
8
|
import {
|
|
9
9
|
getErrorCategory
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-SNTLJ646.js";
|
|
11
11
|
|
|
12
12
|
// src/error/error-display.ts
|
|
13
13
|
import { toast } from "sonner";
|
|
@@ -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,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getCacheConfig
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7LJWRKDT.js";
|
|
4
4
|
import {
|
|
5
5
|
getENV
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-BJLLMVWW.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
|
}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
formatErrorMessage,
|
|
5
5
|
getErrorCategory,
|
|
6
6
|
getHttpStatus
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-SNTLJ646.js";
|
|
8
8
|
|
|
9
9
|
// src/error/app-error.ts
|
|
10
10
|
var AppError = class _AppError extends Error {
|
|
@@ -149,11 +149,6 @@ var AppError = class _AppError extends Error {
|
|
|
149
149
|
static weakPassword() {
|
|
150
150
|
return _AppError.fromKey("PASSWORD_TOO_WEAK");
|
|
151
151
|
}
|
|
152
|
-
static invalidAlias(alias) {
|
|
153
|
-
return _AppError.fromKey("INVALID_ALIAS_FORMAT", void 0, {
|
|
154
|
-
value: alias
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
152
|
// ============================================
|
|
158
153
|
// 인증 에러 (401xx)
|
|
159
154
|
// ============================================
|
|
@@ -196,18 +191,6 @@ var AppError = class _AppError extends Error {
|
|
|
196
191
|
static userNotFound() {
|
|
197
192
|
return _AppError.fromKey("USER_NOT_FOUND");
|
|
198
193
|
}
|
|
199
|
-
static linkNotFound() {
|
|
200
|
-
return _AppError.fromKey("LINK_NOT_FOUND");
|
|
201
|
-
}
|
|
202
|
-
static tagNotFound() {
|
|
203
|
-
return _AppError.fromKey("TAG_NOT_FOUND");
|
|
204
|
-
}
|
|
205
|
-
static favoriteNotFound() {
|
|
206
|
-
return _AppError.fromKey("FAVORITE_NOT_FOUND");
|
|
207
|
-
}
|
|
208
|
-
static groupNotFound() {
|
|
209
|
-
return _AppError.fromKey("GROUP_NOT_FOUND");
|
|
210
|
-
}
|
|
211
194
|
// ============================================
|
|
212
195
|
// 충돌 에러 (409xx)
|
|
213
196
|
// ============================================
|
|
@@ -223,11 +206,6 @@ var AppError = class _AppError extends Error {
|
|
|
223
206
|
value: email
|
|
224
207
|
});
|
|
225
208
|
}
|
|
226
|
-
static aliasExists(alias) {
|
|
227
|
-
return _AppError.fromKey("ALIAS_ALREADY_EXISTS", void 0, {
|
|
228
|
-
value: alias
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
209
|
// ============================================
|
|
232
210
|
// 비즈니스 로직 에러 (422xx)
|
|
233
211
|
// ============================================
|
|
@@ -241,27 +219,6 @@ var AppError = class _AppError extends Error {
|
|
|
241
219
|
const message = quotaType ? `${quotaType} \uC0AC\uC6A9\uB7C9\uC744 \uCD08\uACFC\uD588\uC2B5\uB2C8\uB2E4.` : void 0;
|
|
242
220
|
return _AppError.fromKey("QUOTA_EXCEEDED", message);
|
|
243
221
|
}
|
|
244
|
-
static linkExpired() {
|
|
245
|
-
return _AppError.fromKey("LINK_EXPIRED");
|
|
246
|
-
}
|
|
247
|
-
static linkInactive() {
|
|
248
|
-
return _AppError.fromKey("LINK_INACTIVE");
|
|
249
|
-
}
|
|
250
|
-
static linkPasswordRequired() {
|
|
251
|
-
return _AppError.fromKey("LINK_PASSWORD_REQUIRED");
|
|
252
|
-
}
|
|
253
|
-
static linkPasswordIncorrect() {
|
|
254
|
-
return _AppError.fromKey("LINK_PASSWORD_INCORRECT");
|
|
255
|
-
}
|
|
256
|
-
static reservedWord(word) {
|
|
257
|
-
return _AppError.fromKey("RESERVED_WORD_USED", void 0, { value: word });
|
|
258
|
-
}
|
|
259
|
-
static alreadyFavorited() {
|
|
260
|
-
return _AppError.fromKey("ALREADY_FAVORITED");
|
|
261
|
-
}
|
|
262
|
-
static cannotDeleteOwnAccount() {
|
|
263
|
-
return _AppError.fromKey("CANNOT_DELETE_OWN_ACCOUNT");
|
|
264
|
-
}
|
|
265
222
|
static fileTooLarge(maxSize) {
|
|
266
223
|
const message = maxSize ? `\uD30C\uC77C \uD06C\uAE30\uAC00 ${maxSize}\uB97C \uCD08\uACFC\uD588\uC2B5\uB2C8\uB2E4.` : void 0;
|
|
267
224
|
return _AppError.fromKey("FILE_TOO_LARGE", message);
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
InMemoryCacheManager
|
|
3
|
-
} from "./chunk-J4TTSXDN.js";
|
|
4
1
|
import {
|
|
5
2
|
isRedisGloballyDisabled,
|
|
6
3
|
notifyRedisError
|
|
7
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-X5RMDLLM.js";
|
|
5
|
+
import {
|
|
6
|
+
InMemoryCacheManager
|
|
7
|
+
} from "./chunk-J4TTSXDN.js";
|
|
8
8
|
import {
|
|
9
9
|
logger
|
|
10
10
|
} from "./chunk-GQVBWZLH.js";
|
|
11
11
|
import {
|
|
12
12
|
getCacheFallbackConfig
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-BJLLMVWW.js";
|
|
14
14
|
import {
|
|
15
15
|
__spreadValues
|
|
16
16
|
} from "./chunk-ORMEWXMH.js";
|