@withwiz/toolkit 0.2.3 → 0.2.5
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/index.d.ts +1 -1
- package/dist/auth/core/jwt/index.js +1 -1
- package/dist/auth/index.js +19 -19
- package/dist/cache/cache-config.js +3 -3
- package/dist/cache/cache-env.js +2 -2
- package/dist/cache/cache-factory.js +9 -9
- package/dist/cache/cache-invalidation.js +10 -10
- package/dist/cache/cache-redis.js +3 -3
- package/dist/cache/cache-wrapper.js +10 -10
- package/dist/cache/cache.js +11 -11
- package/dist/cache/hybrid-cache-manager.js +5 -5
- package/dist/cache/index.js +11 -11
- package/dist/cache/inmemory-cache-manager.js +2 -2
- package/dist/cache/noop-cache-manager.js +4 -4
- package/dist/cache/redis-cache-manager.js +4 -4
- package/dist/{chunk-T3LJYAMO.js → chunk-2ATBAIRL.js} +5 -9
- package/dist/{chunk-XPASCCUA.js → chunk-45PS6FPL.js} +3 -3
- package/dist/{chunk-4KJXENRM.js → chunk-56BKKJOG.js} +1 -1
- package/dist/{chunk-HV3DGSSH.js → chunk-6FDDVTJY.js} +4 -4
- package/dist/{chunk-2KAPUVIS.js → chunk-7JWIX5BS.js} +1 -1
- package/dist/{chunk-TMVS4F7E.js → chunk-7T6EAU4I.js} +33 -8
- package/dist/{chunk-26Y7VEYG.js → chunk-BCCXV7VY.js} +1 -1
- package/dist/{chunk-6LTZCXNC.js → chunk-BYQ6VG44.js} +2 -2
- package/dist/{chunk-Q7IP4JMW.js → chunk-DM6ANZVI.js} +2 -2
- package/dist/chunk-ELD6UH57.js +68 -0
- package/dist/{chunk-KAWVMIRJ.js → chunk-GJGLG2MN.js} +1 -1
- package/dist/{chunk-4DPSCTX4.js → chunk-HC7574TB.js} +2 -2
- package/dist/{chunk-N4YGR5WH.js → chunk-HCF3C3AQ.js} +11 -10
- package/dist/{chunk-EZR55KV2.js → chunk-HJIKCR6I.js} +1 -1
- package/dist/{chunk-I47QEDTX.js → chunk-HJL63P7P.js} +1 -1
- package/dist/{chunk-YBSHN67U.js → chunk-HWIINS3Q.js} +4 -4
- package/dist/{chunk-3DZA6AGS.js → chunk-IJCVFLEY.js} +11 -4
- package/dist/{chunk-AIHQBQ3E.js → chunk-IVL62PFY.js} +8 -8
- package/dist/{chunk-KXAWBFJN.js → chunk-IYXMGIEP.js} +11 -10
- package/dist/{chunk-GPBOMJSZ.js → chunk-JVDJKMEF.js} +75 -17
- package/dist/{chunk-MLGO3HLS.js → chunk-KXXROUA5.js} +20 -5
- package/dist/{chunk-TXGNSECL.js → chunk-L26D4FDX.js} +1 -1
- package/dist/{chunk-G4NI37NN.js → chunk-L7AJJ3LC.js} +2 -2
- package/dist/{chunk-UXQRU3EM.js → chunk-MNORDAW2.js} +4 -4
- package/dist/{chunk-BKGVSC6S.js → chunk-MP66AGW5.js} +1 -1
- package/dist/{chunk-KWTBD4CM.js → chunk-P62T7AWY.js} +1 -1
- package/dist/{chunk-SLG26KHZ.js → chunk-PDQCJR4E.js} +10 -10
- package/dist/{chunk-WHR7HPWF.js → chunk-PJMXRAHZ.js} +2 -2
- package/dist/{chunk-Z4D4CMDA.js → chunk-PQ6GH2RP.js} +1 -1
- package/dist/{chunk-POKGHK3L.js → chunk-S54PFAEU.js} +2 -2
- package/dist/{chunk-WSQMXMTL.js → chunk-SKCYXBDR.js} +6 -2
- package/dist/{chunk-Y3OTJH2S.js → chunk-SNVGJPPX.js} +36 -13
- package/dist/{chunk-TZAP5T4N.js → chunk-T7J2OS63.js} +1 -1
- package/dist/{chunk-H5I5GWAA.js → chunk-UZDNS7TE.js} +3 -3
- package/dist/{chunk-GL2NANFH.js → chunk-VK23K5W7.js} +3 -3
- package/dist/{chunk-65LHDFU3.js → chunk-VQCW6FKJ.js} +2 -2
- package/dist/{chunk-L76O3X3D.js → chunk-WVPCER6E.js} +2 -2
- package/dist/{chunk-EEUBKZV4.js → chunk-Y2JYA2AR.js} +2 -2
- package/dist/{chunk-4ODT3Q4A.js → chunk-YGZBEEW2.js} +1 -1
- package/dist/constants/error-codes.d.ts +19 -12
- package/dist/constants/error-codes.js +3 -1
- package/dist/constants/index.js +3 -1
- package/dist/error/app-error.d.ts +1 -0
- package/dist/error/app-error.js +2 -2
- package/dist/error/error-display.d.ts +1 -1
- package/dist/error/error-display.js +7 -3
- package/dist/error/error-handler.d.ts +51 -12
- package/dist/error/error-handler.js +7 -4
- package/dist/error/friendly-messages-v2.js +5 -5
- package/dist/error/friendly-messages.d.ts +3 -0
- package/dist/error/friendly-messages.js +113 -5
- package/dist/error/index.js +23 -21
- 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/geolocation/batch-processor.js +2 -2
- package/dist/geolocation/index.js +2 -2
- package/dist/logger/logger.js +1 -1
- package/dist/middleware/auth.js +5 -5
- package/dist/middleware/cors.d.ts +39 -6
- package/dist/middleware/cors.js +4 -2
- package/dist/middleware/error-handler.js +9 -7
- package/dist/middleware/index.js +19 -18
- package/dist/middleware/middleware-chain.js +2 -2
- package/dist/middleware/rate-limit.js +4 -4
- package/dist/middleware/response-logger.js +2 -2
- package/dist/middleware/security.js +2 -1
- package/dist/middleware/wrappers.js +16 -15
- package/dist/storage/r2-storage.js +7 -3
- package/dist/system/cpu.js +3 -3
- package/dist/system/disk.js +3 -3
- package/dist/system/environment.js +3 -3
- package/dist/system/health-check.js +3 -3
- package/dist/system/index.js +10 -10
- package/dist/system/memory.js +3 -3
- package/dist/system/network.js +3 -3
- package/dist/system/utils.js +2 -2
- package/dist/utils/api-helpers.js +2 -2
- package/dist/utils/csv-export.js +2 -2
- package/dist/utils/error-processor.js +4 -4
- package/dist/utils/index.js +19 -19
- package/dist/utils/input-validation.d.ts +2 -0
- package/dist/utils/input-validation.js +4 -5
- package/dist/utils/optimistic-lock.js +2 -2
- package/package.json +2 -1
- package/dist/chunk-2DVWSDST.js +0 -119
- package/dist/chunk-FOKAATUQ.js +0 -62
|
@@ -92,6 +92,18 @@ var ERROR_CODES = {
|
|
|
92
92
|
status: HTTP_STATUS.UNAUTHORIZED,
|
|
93
93
|
message: "Invalid email or password."
|
|
94
94
|
},
|
|
95
|
+
LINK_PASSWORD_REQUIRED: {
|
|
96
|
+
code: 40104,
|
|
97
|
+
key: "LINK_PASSWORD_REQUIRED",
|
|
98
|
+
status: HTTP_STATUS.UNAUTHORIZED,
|
|
99
|
+
message: "Link password is required."
|
|
100
|
+
},
|
|
101
|
+
LINK_PASSWORD_INCORRECT: {
|
|
102
|
+
code: 40105,
|
|
103
|
+
key: "LINK_PASSWORD_INCORRECT",
|
|
104
|
+
status: HTTP_STATUS.UNAUTHORIZED,
|
|
105
|
+
message: "Incorrect link password."
|
|
106
|
+
},
|
|
95
107
|
SESSION_EXPIRED: {
|
|
96
108
|
code: 40107,
|
|
97
109
|
key: "SESSION_EXPIRED",
|
|
@@ -100,6 +112,7 @@ var ERROR_CODES = {
|
|
|
100
112
|
},
|
|
101
113
|
// ============================================
|
|
102
114
|
// Permissions Related (403xx - 01~09)
|
|
115
|
+
// Reserved: 40301~40303 (미사용, 향후 세분화 확장용)
|
|
103
116
|
// ============================================
|
|
104
117
|
FORBIDDEN: {
|
|
105
118
|
code: 40304,
|
|
@@ -113,6 +126,7 @@ var ERROR_CODES = {
|
|
|
113
126
|
status: HTTP_STATUS.FORBIDDEN,
|
|
114
127
|
message: "Email verification required."
|
|
115
128
|
},
|
|
129
|
+
// Reserved: 40306~40307 (미사용, 향후 확장용)
|
|
116
130
|
ACCOUNT_DISABLED: {
|
|
117
131
|
code: 40308,
|
|
118
132
|
key: "ACCOUNT_DISABLED",
|
|
@@ -127,6 +141,7 @@ var ERROR_CODES = {
|
|
|
127
141
|
},
|
|
128
142
|
// ============================================
|
|
129
143
|
// Resource Not Found (404xx)
|
|
144
|
+
// Reserved: 40404~40407 (미사용, 향후 리소스 타입 확장용)
|
|
130
145
|
// ============================================
|
|
131
146
|
NOT_FOUND: {
|
|
132
147
|
code: 40401,
|
|
@@ -166,6 +181,7 @@ var ERROR_CODES = {
|
|
|
166
181
|
},
|
|
167
182
|
// ============================================
|
|
168
183
|
// Conflict (409xx)
|
|
184
|
+
// Reserved: 40901~40903 (미사용, 향후 확장용)
|
|
169
185
|
// ============================================
|
|
170
186
|
CONFLICT: {
|
|
171
187
|
code: 40904,
|
|
@@ -224,18 +240,8 @@ var ERROR_CODES = {
|
|
|
224
240
|
status: HTTP_STATUS.UNPROCESSABLE_ENTITY,
|
|
225
241
|
message: "Link is inactive."
|
|
226
242
|
},
|
|
227
|
-
LINK_PASSWORD_REQUIRED:
|
|
228
|
-
|
|
229
|
-
key: "LINK_PASSWORD_REQUIRED",
|
|
230
|
-
status: HTTP_STATUS.UNPROCESSABLE_ENTITY,
|
|
231
|
-
message: "Link password is required."
|
|
232
|
-
},
|
|
233
|
-
LINK_PASSWORD_INCORRECT: {
|
|
234
|
-
code: 42207,
|
|
235
|
-
key: "LINK_PASSWORD_INCORRECT",
|
|
236
|
-
status: HTTP_STATUS.UNPROCESSABLE_ENTITY,
|
|
237
|
-
message: "Incorrect link password."
|
|
238
|
-
},
|
|
243
|
+
// LINK_PASSWORD_REQUIRED: 401xx로 이동 (40104)
|
|
244
|
+
// LINK_PASSWORD_INCORRECT: 401xx로 이동 (40105)
|
|
239
245
|
RESERVED_WORD_USED: {
|
|
240
246
|
code: 42208,
|
|
241
247
|
key: "RESERVED_WORD_USED",
|
|
@@ -308,6 +314,7 @@ var ERROR_CODES = {
|
|
|
308
314
|
status: HTTP_STATUS.INTERNAL_SERVER_ERROR,
|
|
309
315
|
message: "An error occurred during data processing."
|
|
310
316
|
},
|
|
317
|
+
// Reserved: 50004~50005 (미사용, 향후 서버 에러 세분화용)
|
|
311
318
|
EMAIL_SEND_FAILED: {
|
|
312
319
|
code: 50006,
|
|
313
320
|
key: "EMAIL_SEND_FAILED",
|
|
@@ -328,6 +335,7 @@ var ERROR_CODES = {
|
|
|
328
335
|
},
|
|
329
336
|
// ============================================
|
|
330
337
|
// Service Unavailable (503xx)
|
|
338
|
+
// Reserved: 50301~50303 (미사용, 향후 확장용)
|
|
331
339
|
// ============================================
|
|
332
340
|
EXTERNAL_SERVICE_ERROR: {
|
|
333
341
|
code: 50304,
|
|
@@ -457,6 +465,20 @@ function formatErrorMessage(code, customMessage) {
|
|
|
457
465
|
const errorInfo = getErrorByCode(code);
|
|
458
466
|
return customMessage || (errorInfo == null ? void 0 : errorInfo.message) || getDefaultErrorMessage(getHttpStatus(code));
|
|
459
467
|
}
|
|
468
|
+
function classifyError(error) {
|
|
469
|
+
const msg = error.message.toLowerCase();
|
|
470
|
+
const errCode = error.code;
|
|
471
|
+
if (msg.includes("not found")) return ERROR_CODES.NOT_FOUND;
|
|
472
|
+
if (msg.includes("unauthorized")) return ERROR_CODES.UNAUTHORIZED;
|
|
473
|
+
if (msg.includes("forbidden") || msg.includes("access denied")) return ERROR_CODES.FORBIDDEN;
|
|
474
|
+
if (msg.includes("too many request") || msg.includes("rate limit")) return ERROR_CODES.RATE_LIMIT_EXCEEDED;
|
|
475
|
+
if (error.message.match(/P\d{4}/) || msg.includes("database") || msg.includes("prisma")) return ERROR_CODES.DATABASE_ERROR;
|
|
476
|
+
if (errCode === "ECONNREFUSED" || errCode === "ECONNRESET" || errCode === "ETIMEDOUT" || errCode === "ENOTFOUND" || msg.includes("fetch failed") || msg.includes("network")) return ERROR_CODES.EXTERNAL_SERVICE_ERROR;
|
|
477
|
+
if (msg.includes("redis") || msg.includes("cache") || msg.includes("upstash")) return ERROR_CODES.CACHE_ERROR;
|
|
478
|
+
if (msg.includes("email") && (msg.includes("send") || msg.includes("smtp"))) return ERROR_CODES.EMAIL_SEND_FAILED;
|
|
479
|
+
if (msg.includes("upload") || msg.includes("s3") || msg.includes("r2")) return ERROR_CODES.FILE_UPLOAD_FAILED;
|
|
480
|
+
return ERROR_CODES.SERVER_ERROR;
|
|
481
|
+
}
|
|
460
482
|
|
|
461
483
|
export {
|
|
462
484
|
HTTP_STATUS,
|
|
@@ -469,5 +491,6 @@ export {
|
|
|
469
491
|
getLogLevel,
|
|
470
492
|
getAllErrorCodes,
|
|
471
493
|
getErrorCodesByCategory,
|
|
472
|
-
formatErrorMessage
|
|
494
|
+
formatErrorMessage,
|
|
495
|
+
classifyError
|
|
473
496
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AppError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KXXROUA5.js";
|
|
4
4
|
import {
|
|
5
5
|
ERROR_CODES
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-SNVGJPPX.js";
|
|
7
7
|
import {
|
|
8
8
|
logger
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-HJIKCR6I.js";
|
|
10
10
|
|
|
11
11
|
// src/middleware/rate-limit.ts
|
|
12
12
|
var _rateLimitAdapter = null;
|
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
isRedisGloballyDisabled,
|
|
4
4
|
notifyRedisError,
|
|
5
5
|
resetRedisGlobalState
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-BYQ6VG44.js";
|
|
7
7
|
import {
|
|
8
8
|
getENV,
|
|
9
9
|
isCacheEnabled
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-HJL63P7P.js";
|
|
11
11
|
import {
|
|
12
12
|
logger
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-HJIKCR6I.js";
|
|
14
14
|
import {
|
|
15
15
|
__spreadValues
|
|
16
16
|
} from "./chunk-ORMEWXMH.js";
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
formatBytesPerSec,
|
|
4
4
|
runCommand,
|
|
5
5
|
runMacCommand
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-P62T7AWY.js";
|
|
7
7
|
import {
|
|
8
8
|
logger
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-HJIKCR6I.js";
|
|
10
10
|
|
|
11
11
|
// src/system/network.ts
|
|
12
12
|
async function getNetworkInfo() {
|
|
@@ -105,6 +105,18 @@ export declare const ERROR_CODES: {
|
|
|
105
105
|
readonly status: 401;
|
|
106
106
|
readonly message: "Invalid email or password.";
|
|
107
107
|
};
|
|
108
|
+
readonly LINK_PASSWORD_REQUIRED: {
|
|
109
|
+
readonly code: 40104;
|
|
110
|
+
readonly key: "LINK_PASSWORD_REQUIRED";
|
|
111
|
+
readonly status: 401;
|
|
112
|
+
readonly message: "Link password is required.";
|
|
113
|
+
};
|
|
114
|
+
readonly LINK_PASSWORD_INCORRECT: {
|
|
115
|
+
readonly code: 40105;
|
|
116
|
+
readonly key: "LINK_PASSWORD_INCORRECT";
|
|
117
|
+
readonly status: 401;
|
|
118
|
+
readonly message: "Incorrect link password.";
|
|
119
|
+
};
|
|
108
120
|
readonly SESSION_EXPIRED: {
|
|
109
121
|
readonly code: 40107;
|
|
110
122
|
readonly key: "SESSION_EXPIRED";
|
|
@@ -225,18 +237,6 @@ export declare const ERROR_CODES: {
|
|
|
225
237
|
readonly status: 422;
|
|
226
238
|
readonly message: "Link is inactive.";
|
|
227
239
|
};
|
|
228
|
-
readonly LINK_PASSWORD_REQUIRED: {
|
|
229
|
-
readonly code: 42206;
|
|
230
|
-
readonly key: "LINK_PASSWORD_REQUIRED";
|
|
231
|
-
readonly status: 422;
|
|
232
|
-
readonly message: "Link password is required.";
|
|
233
|
-
};
|
|
234
|
-
readonly LINK_PASSWORD_INCORRECT: {
|
|
235
|
-
readonly code: 42207;
|
|
236
|
-
readonly key: "LINK_PASSWORD_INCORRECT";
|
|
237
|
-
readonly status: 422;
|
|
238
|
-
readonly message: "Incorrect link password.";
|
|
239
|
-
};
|
|
240
240
|
readonly RESERVED_WORD_USED: {
|
|
241
241
|
readonly code: 42208;
|
|
242
242
|
readonly key: "RESERVED_WORD_USED";
|
|
@@ -387,3 +387,10 @@ export declare function getLogLevel(status: number): "debug" | "info" | "warn" |
|
|
|
387
387
|
export declare function getAllErrorCodes(): IErrorCodeInfo[];
|
|
388
388
|
export declare function getErrorCodesByCategory(category: "validation" | "auth" | "permission" | "resource" | "conflict" | "business" | "rateLimit" | "server" | "security"): IErrorCodeInfo[];
|
|
389
389
|
export declare function formatErrorMessage(code: number, customMessage?: string): string;
|
|
390
|
+
/**
|
|
391
|
+
* 알 수 없는 Error 인스턴스에서 에러 메시지/코드 패턴을 분석하여
|
|
392
|
+
* 가장 적합한 에러코드를 반환하는 공통 함수.
|
|
393
|
+
*
|
|
394
|
+
* AppError.from(), processError(), resolveErrorCode() 등에서 공유.
|
|
395
|
+
*/
|
|
396
|
+
export declare function classifyError(error: Error): IErrorCodeInfo;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ERROR_CODES,
|
|
3
3
|
HTTP_STATUS,
|
|
4
|
+
classifyError,
|
|
4
5
|
formatErrorMessage,
|
|
5
6
|
getAllErrorCodes,
|
|
6
7
|
getDefaultErrorMessage,
|
|
@@ -10,11 +11,12 @@ import {
|
|
|
10
11
|
getErrorInfo,
|
|
11
12
|
getHttpStatus,
|
|
12
13
|
getLogLevel
|
|
13
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-SNVGJPPX.js";
|
|
14
15
|
import "../chunk-ORMEWXMH.js";
|
|
15
16
|
export {
|
|
16
17
|
ERROR_CODES,
|
|
17
18
|
HTTP_STATUS,
|
|
19
|
+
classifyError,
|
|
18
20
|
formatErrorMessage,
|
|
19
21
|
getAllErrorCodes,
|
|
20
22
|
getDefaultErrorMessage,
|
package/dist/constants/index.js
CHANGED
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
import {
|
|
35
35
|
ERROR_CODES,
|
|
36
36
|
HTTP_STATUS,
|
|
37
|
+
classifyError,
|
|
37
38
|
formatErrorMessage,
|
|
38
39
|
getAllErrorCodes,
|
|
39
40
|
getDefaultErrorMessage,
|
|
@@ -43,7 +44,7 @@ import {
|
|
|
43
44
|
getErrorInfo,
|
|
44
45
|
getHttpStatus,
|
|
45
46
|
getLogLevel
|
|
46
|
-
} from "../chunk-
|
|
47
|
+
} from "../chunk-SNVGJPPX.js";
|
|
47
48
|
import "../chunk-ORMEWXMH.js";
|
|
48
49
|
export {
|
|
49
50
|
API_KEY,
|
|
@@ -73,6 +74,7 @@ export {
|
|
|
73
74
|
TEXT,
|
|
74
75
|
URL,
|
|
75
76
|
USER_INPUT,
|
|
77
|
+
classifyError,
|
|
76
78
|
formatErrorMessage,
|
|
77
79
|
getAllErrorCodes,
|
|
78
80
|
getDefaultErrorMessage,
|
|
@@ -140,5 +140,6 @@ export declare class AppError extends Error {
|
|
|
140
140
|
static blockedUrl(url?: string): AppError;
|
|
141
141
|
static suspiciousActivity(): AppError;
|
|
142
142
|
static ipBlocked(ip?: string): AppError;
|
|
143
|
+
static corsViolation(origin?: string): AppError;
|
|
143
144
|
}
|
|
144
145
|
export default AppError;
|
package/dist/error/app-error.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* 프론트엔드 에러 표시 유틸리티
|
|
3
3
|
* Toast 알림, 에러 UI 표시 등
|
|
4
4
|
*/
|
|
5
|
-
export { getFriendlyMessage, getErrorDisplayInfo, type IErrorDisplay } from './friendly-messages';
|
|
5
|
+
export { getFriendlyMessage, getErrorDisplayInfo, type IErrorDisplay } from './friendly-messages-v2';
|
|
6
6
|
type TLocale = 'ko' | 'en';
|
|
7
7
|
/**
|
|
8
8
|
* API 에러 응답 인터페이스
|
|
@@ -5,12 +5,16 @@ import {
|
|
|
5
5
|
getErrorIcon,
|
|
6
6
|
handleApiResponse,
|
|
7
7
|
showFriendlyError
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-IJCVFLEY.js";
|
|
9
9
|
import {
|
|
10
10
|
getErrorDisplayInfo,
|
|
11
11
|
getFriendlyMessage
|
|
12
|
-
} from "../chunk-
|
|
13
|
-
import "../chunk-
|
|
12
|
+
} from "../chunk-S54PFAEU.js";
|
|
13
|
+
import "../chunk-Y2JYA2AR.js";
|
|
14
|
+
import "../chunk-HCF3C3AQ.js";
|
|
15
|
+
import "../chunk-IYXMGIEP.js";
|
|
16
|
+
import "../chunk-KXXROUA5.js";
|
|
17
|
+
import "../chunk-SNVGJPPX.js";
|
|
14
18
|
import "../chunk-ORMEWXMH.js";
|
|
15
19
|
export {
|
|
16
20
|
extractErrorInfo,
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* API 라우트 및 미들웨어에서 발생하는 모든 에러를 처리
|
|
4
4
|
*/
|
|
5
5
|
import { NextRequest, NextResponse } from 'next/server';
|
|
6
|
+
export declare const AUTH_ERROR_CODE_MAP: Record<string, number>;
|
|
6
7
|
/**
|
|
7
8
|
* 에러 응답 형식
|
|
8
9
|
*/
|
|
@@ -37,12 +38,17 @@ export declare function withErrorHandler<T extends unknown[]>(handler: (request:
|
|
|
37
38
|
export declare const ErrorResponse: {
|
|
38
39
|
validation: (message?: string, details?: unknown) => NextResponse<IErrorResponse>;
|
|
39
40
|
badRequest: (message?: string) => NextResponse<IErrorResponse>;
|
|
41
|
+
invalidInput: (message?: string) => NextResponse<IErrorResponse>;
|
|
42
|
+
missingField: (fieldName: string) => NextResponse<IErrorResponse>;
|
|
40
43
|
invalidUrl: () => NextResponse<IErrorResponse>;
|
|
41
44
|
invalidEmail: () => NextResponse<IErrorResponse>;
|
|
45
|
+
weakPassword: () => NextResponse<IErrorResponse>;
|
|
42
46
|
invalidAlias: () => NextResponse<IErrorResponse>;
|
|
43
47
|
unauthorized: (message?: string) => NextResponse<IErrorResponse>;
|
|
44
48
|
invalidToken: () => NextResponse<IErrorResponse>;
|
|
45
49
|
tokenExpired: () => NextResponse<IErrorResponse>;
|
|
50
|
+
linkPasswordRequired: () => NextResponse<IErrorResponse>;
|
|
51
|
+
linkPasswordIncorrect: () => NextResponse<IErrorResponse>;
|
|
46
52
|
invalidCredentials: () => NextResponse<IErrorResponse>;
|
|
47
53
|
sessionExpired: () => NextResponse<IErrorResponse>;
|
|
48
54
|
forbidden: (message?: string) => NextResponse<IErrorResponse>;
|
|
@@ -52,25 +58,39 @@ export declare const ErrorResponse: {
|
|
|
52
58
|
notFound: (message?: string) => NextResponse<IErrorResponse>;
|
|
53
59
|
userNotFound: () => NextResponse<IErrorResponse>;
|
|
54
60
|
linkNotFound: () => NextResponse<IErrorResponse>;
|
|
61
|
+
tagNotFound: () => NextResponse<IErrorResponse>;
|
|
62
|
+
favoriteNotFound: () => NextResponse<IErrorResponse>;
|
|
63
|
+
groupNotFound: () => NextResponse<IErrorResponse>;
|
|
55
64
|
conflict: (message?: string) => NextResponse<IErrorResponse>;
|
|
56
65
|
duplicate: (resource?: string) => NextResponse<IErrorResponse>;
|
|
57
66
|
emailExists: () => NextResponse<IErrorResponse>;
|
|
58
67
|
aliasExists: () => NextResponse<IErrorResponse>;
|
|
59
68
|
businessRule: (message?: string) => NextResponse<IErrorResponse>;
|
|
69
|
+
invalidOperation: (message?: string) => NextResponse<IErrorResponse>;
|
|
60
70
|
linkExpired: () => NextResponse<IErrorResponse>;
|
|
61
71
|
linkInactive: () => NextResponse<IErrorResponse>;
|
|
62
|
-
linkPasswordRequired: () => NextResponse<IErrorResponse>;
|
|
63
|
-
linkPasswordIncorrect: () => NextResponse<IErrorResponse>;
|
|
64
72
|
reservedWord: () => NextResponse<IErrorResponse>;
|
|
65
73
|
quotaExceeded: () => NextResponse<IErrorResponse>;
|
|
74
|
+
alreadyFavorited: () => NextResponse<IErrorResponse>;
|
|
75
|
+
fileTooLarge: (maxSize?: string) => NextResponse<IErrorResponse>;
|
|
76
|
+
unsupportedFileType: (fileType?: string) => NextResponse<IErrorResponse>;
|
|
66
77
|
rateLimit: () => NextResponse<IErrorResponse>;
|
|
67
78
|
dailyLimit: () => NextResponse<IErrorResponse>;
|
|
79
|
+
apiQuotaExceeded: () => NextResponse<IErrorResponse>;
|
|
68
80
|
serverError: (message?: string) => NextResponse<IErrorResponse>;
|
|
69
|
-
|
|
70
|
-
|
|
81
|
+
internalError: (message?: string) => NextResponse<IErrorResponse>;
|
|
82
|
+
databaseError: (message?: string) => NextResponse<IErrorResponse>;
|
|
83
|
+
emailSendFailed: () => NextResponse<IErrorResponse>;
|
|
84
|
+
cacheError: () => NextResponse<IErrorResponse>;
|
|
85
|
+
fileUploadFailed: () => NextResponse<IErrorResponse>;
|
|
86
|
+
serviceUnavailable: (message?: string) => NextResponse<IErrorResponse>;
|
|
71
87
|
externalServiceError: (service?: string) => NextResponse<IErrorResponse>;
|
|
72
|
-
accessBlocked: () => NextResponse<IErrorResponse>;
|
|
73
|
-
|
|
88
|
+
accessBlocked: (reason?: string) => NextResponse<IErrorResponse>;
|
|
89
|
+
securityValidationFailed: () => NextResponse<IErrorResponse>;
|
|
90
|
+
blockedUrl: (url?: string) => NextResponse<IErrorResponse>;
|
|
91
|
+
suspiciousActivity: () => NextResponse<IErrorResponse>;
|
|
92
|
+
ipBlocked: (ip?: string) => NextResponse<IErrorResponse>;
|
|
93
|
+
corsViolation: (origin?: string) => NextResponse<IErrorResponse>;
|
|
74
94
|
};
|
|
75
95
|
declare const _default: {
|
|
76
96
|
errorToResponse: typeof errorToResponse;
|
|
@@ -79,12 +99,17 @@ declare const _default: {
|
|
|
79
99
|
ErrorResponse: {
|
|
80
100
|
validation: (message?: string, details?: unknown) => NextResponse<IErrorResponse>;
|
|
81
101
|
badRequest: (message?: string) => NextResponse<IErrorResponse>;
|
|
102
|
+
invalidInput: (message?: string) => NextResponse<IErrorResponse>;
|
|
103
|
+
missingField: (fieldName: string) => NextResponse<IErrorResponse>;
|
|
82
104
|
invalidUrl: () => NextResponse<IErrorResponse>;
|
|
83
105
|
invalidEmail: () => NextResponse<IErrorResponse>;
|
|
106
|
+
weakPassword: () => NextResponse<IErrorResponse>;
|
|
84
107
|
invalidAlias: () => NextResponse<IErrorResponse>;
|
|
85
108
|
unauthorized: (message?: string) => NextResponse<IErrorResponse>;
|
|
86
109
|
invalidToken: () => NextResponse<IErrorResponse>;
|
|
87
110
|
tokenExpired: () => NextResponse<IErrorResponse>;
|
|
111
|
+
linkPasswordRequired: () => NextResponse<IErrorResponse>;
|
|
112
|
+
linkPasswordIncorrect: () => NextResponse<IErrorResponse>;
|
|
88
113
|
invalidCredentials: () => NextResponse<IErrorResponse>;
|
|
89
114
|
sessionExpired: () => NextResponse<IErrorResponse>;
|
|
90
115
|
forbidden: (message?: string) => NextResponse<IErrorResponse>;
|
|
@@ -94,25 +119,39 @@ declare const _default: {
|
|
|
94
119
|
notFound: (message?: string) => NextResponse<IErrorResponse>;
|
|
95
120
|
userNotFound: () => NextResponse<IErrorResponse>;
|
|
96
121
|
linkNotFound: () => NextResponse<IErrorResponse>;
|
|
122
|
+
tagNotFound: () => NextResponse<IErrorResponse>;
|
|
123
|
+
favoriteNotFound: () => NextResponse<IErrorResponse>;
|
|
124
|
+
groupNotFound: () => NextResponse<IErrorResponse>;
|
|
97
125
|
conflict: (message?: string) => NextResponse<IErrorResponse>;
|
|
98
126
|
duplicate: (resource?: string) => NextResponse<IErrorResponse>;
|
|
99
127
|
emailExists: () => NextResponse<IErrorResponse>;
|
|
100
128
|
aliasExists: () => NextResponse<IErrorResponse>;
|
|
101
129
|
businessRule: (message?: string) => NextResponse<IErrorResponse>;
|
|
130
|
+
invalidOperation: (message?: string) => NextResponse<IErrorResponse>;
|
|
102
131
|
linkExpired: () => NextResponse<IErrorResponse>;
|
|
103
132
|
linkInactive: () => NextResponse<IErrorResponse>;
|
|
104
|
-
linkPasswordRequired: () => NextResponse<IErrorResponse>;
|
|
105
|
-
linkPasswordIncorrect: () => NextResponse<IErrorResponse>;
|
|
106
133
|
reservedWord: () => NextResponse<IErrorResponse>;
|
|
107
134
|
quotaExceeded: () => NextResponse<IErrorResponse>;
|
|
135
|
+
alreadyFavorited: () => NextResponse<IErrorResponse>;
|
|
136
|
+
fileTooLarge: (maxSize?: string) => NextResponse<IErrorResponse>;
|
|
137
|
+
unsupportedFileType: (fileType?: string) => NextResponse<IErrorResponse>;
|
|
108
138
|
rateLimit: () => NextResponse<IErrorResponse>;
|
|
109
139
|
dailyLimit: () => NextResponse<IErrorResponse>;
|
|
140
|
+
apiQuotaExceeded: () => NextResponse<IErrorResponse>;
|
|
110
141
|
serverError: (message?: string) => NextResponse<IErrorResponse>;
|
|
111
|
-
|
|
112
|
-
|
|
142
|
+
internalError: (message?: string) => NextResponse<IErrorResponse>;
|
|
143
|
+
databaseError: (message?: string) => NextResponse<IErrorResponse>;
|
|
144
|
+
emailSendFailed: () => NextResponse<IErrorResponse>;
|
|
145
|
+
cacheError: () => NextResponse<IErrorResponse>;
|
|
146
|
+
fileUploadFailed: () => NextResponse<IErrorResponse>;
|
|
147
|
+
serviceUnavailable: (message?: string) => NextResponse<IErrorResponse>;
|
|
113
148
|
externalServiceError: (service?: string) => NextResponse<IErrorResponse>;
|
|
114
|
-
accessBlocked: () => NextResponse<IErrorResponse>;
|
|
115
|
-
|
|
149
|
+
accessBlocked: (reason?: string) => NextResponse<IErrorResponse>;
|
|
150
|
+
securityValidationFailed: () => NextResponse<IErrorResponse>;
|
|
151
|
+
blockedUrl: (url?: string) => NextResponse<IErrorResponse>;
|
|
152
|
+
suspiciousActivity: () => NextResponse<IErrorResponse>;
|
|
153
|
+
ipBlocked: (ip?: string) => NextResponse<IErrorResponse>;
|
|
154
|
+
corsViolation: (origin?: string) => NextResponse<IErrorResponse>;
|
|
116
155
|
};
|
|
117
156
|
};
|
|
118
157
|
export default _default;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AUTH_ERROR_CODE_MAP,
|
|
2
3
|
ErrorResponse,
|
|
3
4
|
errorToResponse,
|
|
4
5
|
error_handler_default,
|
|
5
6
|
processError,
|
|
6
7
|
withErrorHandler
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
8
|
+
} from "../chunk-JVDJKMEF.js";
|
|
9
|
+
import "../chunk-KXXROUA5.js";
|
|
10
|
+
import "../chunk-SNVGJPPX.js";
|
|
11
|
+
import "../chunk-AIH3F7JV.js";
|
|
12
|
+
import "../chunk-HJIKCR6I.js";
|
|
11
13
|
import "../chunk-ORMEWXMH.js";
|
|
12
14
|
export {
|
|
15
|
+
AUTH_ERROR_CODE_MAP,
|
|
13
16
|
ErrorResponse,
|
|
14
17
|
error_handler_default as default,
|
|
15
18
|
errorToResponse,
|
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
formatFriendlyError,
|
|
3
3
|
getErrorDisplayInfo,
|
|
4
4
|
getFriendlyMessage
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-S54PFAEU.js";
|
|
6
|
+
import "../chunk-Y2JYA2AR.js";
|
|
7
|
+
import "../chunk-HCF3C3AQ.js";
|
|
8
|
+
import "../chunk-IYXMGIEP.js";
|
|
9
|
+
import "../chunk-SNVGJPPX.js";
|
|
10
10
|
import "../chunk-ORMEWXMH.js";
|
|
11
11
|
export {
|
|
12
12
|
formatFriendlyError,
|