@withwiz/toolkit 0.1.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/README.md +162 -0
- package/dist/auth/adapters/prisma/index.d.ts +43 -0
- package/dist/auth/adapters/prisma/index.js +284 -0
- package/dist/auth/core/email/token-generator.d.ts +43 -0
- package/dist/auth/core/email/token-generator.js +7 -0
- package/dist/auth/core/jwt/client.d.ts +87 -0
- package/dist/auth/core/jwt/client.js +36 -0
- package/dist/auth/core/jwt/index.d.ts +110 -0
- package/dist/auth/core/jwt/index.js +10 -0
- package/dist/auth/core/jwt/types.d.ts +6 -0
- package/dist/auth/core/jwt/types.js +13 -0
- package/dist/auth/core/oauth/index.d.ts +51 -0
- package/dist/auth/core/oauth/index.js +12 -0
- package/dist/auth/core/password/client-helper.d.ts +44 -0
- package/dist/auth/core/password/client-helper.js +28 -0
- package/dist/auth/core/password/index.d.ts +71 -0
- package/dist/auth/core/password/index.js +14 -0
- package/dist/auth/errors/index.d.ts +49 -0
- package/dist/auth/errors/index.js +17 -0
- package/dist/auth/index.d.ts +21 -0
- package/dist/auth/index.js +97 -0
- package/dist/auth/types/index.d.ts +213 -0
- package/dist/auth/types/index.js +13 -0
- package/dist/cache/cache-config.d.ts +73 -0
- package/dist/cache/cache-config.js +12 -0
- package/dist/cache/cache-defaults.d.ts +141 -0
- package/dist/cache/cache-defaults.js +33 -0
- package/dist/cache/cache-env.d.ts +75 -0
- package/dist/cache/cache-env.js +25 -0
- package/dist/cache/cache-factory.d.ts +34 -0
- package/dist/cache/cache-factory.js +28 -0
- package/dist/cache/cache-invalidation.d.ts +90 -0
- package/dist/cache/cache-invalidation.js +24 -0
- package/dist/cache/cache-keys-legacy.d.ts +35 -0
- package/dist/cache/cache-keys-legacy.js +7 -0
- package/dist/cache/cache-redis.d.ts +74 -0
- package/dist/cache/cache-redis.js +24 -0
- package/dist/cache/cache-types.d.ts +151 -0
- package/dist/cache/cache-types.js +9 -0
- package/dist/cache/cache-wrapper.d.ts +27 -0
- package/dist/cache/cache-wrapper.js +22 -0
- package/dist/cache/cache.d.ts +14 -0
- package/dist/cache/cache.js +112 -0
- package/dist/cache/hybrid-cache-manager.d.ts +148 -0
- package/dist/cache/hybrid-cache-manager.js +13 -0
- package/dist/cache/index.d.ts +21 -0
- package/dist/cache/index.js +112 -0
- package/dist/cache/inmemory-cache-manager.d.ts +163 -0
- package/dist/cache/inmemory-cache-manager.js +9 -0
- package/dist/cache/noop-cache-manager.d.ts +36 -0
- package/dist/cache/noop-cache-manager.js +11 -0
- package/dist/cache/redis-cache-manager.d.ts +34 -0
- package/dist/cache/redis-cache-manager.js +11 -0
- package/dist/chunk-26Y7VEYG.js +93 -0
- package/dist/chunk-2DVWSDST.js +119 -0
- package/dist/chunk-2KAPUVIS.js +155 -0
- package/dist/chunk-2TO7WUKK.js +93 -0
- package/dist/chunk-34WAGUT5.js +117 -0
- package/dist/chunk-3DZA6AGS.js +120 -0
- package/dist/chunk-4DPSCTX4.js +212 -0
- package/dist/chunk-4KJXENRM.js +64 -0
- package/dist/chunk-4NWJ3WCZ.js +28 -0
- package/dist/chunk-4ODT3Q4A.js +86 -0
- package/dist/chunk-5ATB5D6S.js +40 -0
- package/dist/chunk-62FLBG6B.js +34 -0
- package/dist/chunk-62Q7DN5G.js +25 -0
- package/dist/chunk-65LHDFU3.js +242 -0
- package/dist/chunk-6C7HQIX4.js +13 -0
- package/dist/chunk-6D3HHYER.js +32 -0
- package/dist/chunk-6LTZCXNC.js +326 -0
- package/dist/chunk-7VJNLGAS.js +110 -0
- package/dist/chunk-7XFHGAJP.js +0 -0
- package/dist/chunk-A6EAAWMK.js +50 -0
- package/dist/chunk-AHDPGRXS.js +51 -0
- package/dist/chunk-AIH3F7JV.js +76 -0
- package/dist/chunk-AIHQBQ3E.js +109 -0
- package/dist/chunk-BKGVSC6S.js +152 -0
- package/dist/chunk-COK4ZXNG.js +0 -0
- package/dist/chunk-DEEJBDJE.js +47 -0
- package/dist/chunk-DH2ZHGW2.js +53 -0
- package/dist/chunk-EBUEBEJX.js +0 -0
- package/dist/chunk-EEUBKZV4.js +54 -0
- package/dist/chunk-EQYTE7WD.js +139 -0
- package/dist/chunk-EUQATJLI.js +180 -0
- package/dist/chunk-EZC6ETFW.js +80 -0
- package/dist/chunk-EZR55KV2.js +249 -0
- package/dist/chunk-F6LCSFSU.js +31 -0
- package/dist/chunk-FOKAATUQ.js +62 -0
- package/dist/chunk-FW3IEJ7H.js +71 -0
- package/dist/chunk-G26T2PRQ.js +53 -0
- package/dist/chunk-G4NI37NN.js +257 -0
- package/dist/chunk-GCZOXUDV.js +132 -0
- package/dist/chunk-GDWEDUHO.js +55 -0
- package/dist/chunk-GL2NANFH.js +434 -0
- package/dist/chunk-GPBOMJSZ.js +136 -0
- package/dist/chunk-H5I5GWAA.js +94 -0
- package/dist/chunk-HGC4CCKB.js +29 -0
- package/dist/chunk-HV3DGSSH.js +447 -0
- package/dist/chunk-I47QEDTX.js +193 -0
- package/dist/chunk-IAJNC34M.js +102 -0
- package/dist/chunk-IHXRF3BH.js +215 -0
- package/dist/chunk-IJEZ7G7S.js +26 -0
- package/dist/chunk-IQQKKUAV.js +151 -0
- package/dist/chunk-JBCDEAMW.js +35 -0
- package/dist/chunk-JLLMTTQ4.js +75 -0
- package/dist/chunk-JS5VI3OW.js +143 -0
- package/dist/chunk-KAWVMIRJ.js +44 -0
- package/dist/chunk-KMCJIL57.js +214 -0
- package/dist/chunk-KWTBD4CM.js +145 -0
- package/dist/chunk-KXAWBFJN.js +310 -0
- package/dist/chunk-L25BNU3E.js +56 -0
- package/dist/chunk-L76O3X3D.js +197 -0
- package/dist/chunk-LNV2E4I6.js +63 -0
- package/dist/chunk-MLGO3HLS.js +329 -0
- package/dist/chunk-MRJE6OX5.js +22 -0
- package/dist/chunk-MYLGYX4K.js +57 -0
- package/dist/chunk-N4YGR5WH.js +310 -0
- package/dist/chunk-OIVXOT2X.js +80 -0
- package/dist/chunk-ORMEWXMH.js +37 -0
- package/dist/chunk-POKGHK3L.js +57 -0
- package/dist/chunk-Q7IP4JMW.js +69 -0
- package/dist/chunk-RJUVBBZG.js +27 -0
- package/dist/chunk-S73334QY.js +89 -0
- package/dist/chunk-SLG26KHZ.js +101 -0
- package/dist/chunk-SR65BF6X.js +82 -0
- package/dist/chunk-SS56XFLI.js +19 -0
- package/dist/chunk-T3LJYAMO.js +277 -0
- package/dist/chunk-TDZJ6SAI.js +34 -0
- package/dist/chunk-TEIYA7U4.js +72 -0
- package/dist/chunk-TMVS4F7E.js +88 -0
- package/dist/chunk-TRBKJ7JT.js +137 -0
- package/dist/chunk-TXGNSECL.js +84 -0
- package/dist/chunk-TZAP5T4N.js +188 -0
- package/dist/chunk-UCYQNHST.js +24 -0
- package/dist/chunk-ULF5RDDX.js +0 -0
- package/dist/chunk-UXQRU3EM.js +167 -0
- package/dist/chunk-V5K5FYU7.js +200 -0
- package/dist/chunk-VDXB5DCY.js +68 -0
- package/dist/chunk-VSGKVZB4.js +47 -0
- package/dist/chunk-VWODEQ5C.js +204 -0
- package/dist/chunk-WDUFQFDP.js +193 -0
- package/dist/chunk-WHR7HPWF.js +126 -0
- package/dist/chunk-WSQMXMTL.js +122 -0
- package/dist/chunk-XHZ5L4FO.js +103 -0
- package/dist/chunk-XPASCCUA.js +404 -0
- package/dist/chunk-XRRPEBKB.js +231 -0
- package/dist/chunk-Y2TUZFCP.js +0 -0
- package/dist/chunk-Y3OTJH2S.js +473 -0
- package/dist/chunk-YBSHN67U.js +161 -0
- package/dist/chunk-YJ3TLEW3.js +100 -0
- package/dist/chunk-YJWLWUFK.js +105 -0
- package/dist/chunk-Z4D4CMDA.js +488 -0
- package/dist/chunk-ZHVUK5OY.js +314 -0
- package/dist/chunk-ZTN4X5FN.js +29 -0
- package/dist/chunk-ZZIKRBJU.js +96 -0
- package/dist/components/ui/Alert.d.ts +12 -0
- package/dist/components/ui/Alert.js +10 -0
- package/dist/components/ui/Badge.d.ts +7 -0
- package/dist/components/ui/Badge.js +8 -0
- package/dist/components/ui/Button.d.ts +7 -0
- package/dist/components/ui/Button.js +8 -0
- package/dist/components/ui/DataTable.d.ts +103 -0
- package/dist/components/ui/DataTable.js +606 -0
- package/dist/components/ui/DomainDisplay.d.ts +12 -0
- package/dist/components/ui/DomainDisplay.js +31 -0
- package/dist/components/ui/Input.d.ts +5 -0
- package/dist/components/ui/Input.js +8 -0
- package/dist/components/ui/Label.d.ts +5 -0
- package/dist/components/ui/Label.js +8 -0
- package/dist/components/ui/Pagination.d.ts +42 -0
- package/dist/components/ui/Pagination.js +20 -0
- package/dist/components/ui/Select.d.ts +15 -0
- package/dist/components/ui/Select.js +27 -0
- package/dist/components/ui/Skeleton.d.ts +6 -0
- package/dist/components/ui/Skeleton.js +8 -0
- package/dist/components/ui/TimezoneDisplay.d.ts +22 -0
- package/dist/components/ui/TimezoneDisplay.js +83 -0
- package/dist/components/ui/Tooltip.d.ts +21 -0
- package/dist/components/ui/Tooltip.js +94 -0
- package/dist/components/ui/WorldMapChart.d.ts +17 -0
- package/dist/components/ui/WorldMapChart.js +250 -0
- package/dist/components/ui/loading-bar.d.ts +20 -0
- package/dist/components/ui/loading-bar.js +15 -0
- package/dist/constants/error-codes.d.ts +389 -0
- package/dist/constants/error-codes.js +27 -0
- package/dist/constants/index.d.ts +11 -0
- package/dist/constants/index.js +85 -0
- package/dist/constants/messages.d.ts +83 -0
- package/dist/constants/messages.js +13 -0
- package/dist/constants/pagination.d.ts +43 -0
- package/dist/constants/pagination.js +15 -0
- package/dist/constants/security.d.ts +66 -0
- package/dist/constants/security.js +23 -0
- package/dist/constants/validation.d.ts +60 -0
- package/dist/constants/validation.js +19 -0
- package/dist/error/ErrorBoundary.d.ts +47 -0
- package/dist/error/app-error.d.ts +144 -0
- package/dist/error/app-error.js +10 -0
- package/dist/error/components/EmptyState.d.ts +50 -0
- package/dist/error/components/ErrorAlert.d.ts +50 -0
- package/dist/error/components/ErrorPage.d.ts +39 -0
- package/dist/error/components/LoadingState.d.ts +37 -0
- package/dist/error/components/index.d.ts +13 -0
- package/dist/error/components/index.js +18 -0
- package/dist/error/core/locale-detector.d.ts +44 -0
- package/dist/error/core/locale-detector.js +9 -0
- package/dist/error/error-display.d.ts +55 -0
- package/dist/error/error-display.js +24 -0
- package/dist/error/error-handler.d.ts +118 -0
- package/dist/error/error-handler.js +18 -0
- package/dist/error/friendly-messages-v2.d.ts +46 -0
- package/dist/error/friendly-messages-v2.js +15 -0
- package/dist/error/friendly-messages.d.ts +22 -0
- package/dist/error/friendly-messages.js +12 -0
- package/dist/error/hooks/index.d.ts +7 -0
- package/dist/error/hooks/index.js +14 -0
- package/dist/error/hooks/useErrorHandler.d.ts +67 -0
- package/dist/error/hooks/useErrorHandler.js +14 -0
- package/dist/error/index.d.ts +26 -0
- package/dist/error/index.js +289 -0
- package/dist/error/logging/error-logger.d.ts +77 -0
- package/dist/error/logging/error-logger.js +10 -0
- package/dist/error/logging/index.d.ts +9 -0
- package/dist/error/logging/index.js +35 -0
- package/dist/error/logging/transports/base.d.ts +30 -0
- package/dist/error/logging/transports/base.js +7 -0
- package/dist/error/logging/transports/console.d.ts +40 -0
- package/dist/error/logging/transports/console.js +9 -0
- package/dist/error/logging/transports/file.d.ts +49 -0
- package/dist/error/logging/transports/file.js +8 -0
- package/dist/error/logging/transports/index.d.ts +12 -0
- package/dist/error/logging/transports/index.js +25 -0
- package/dist/error/logging/transports/sentry.d.ts +44 -0
- package/dist/error/logging/transports/sentry.js +9 -0
- package/dist/error/logging/transports/slack.d.ts +51 -0
- package/dist/error/logging/transports/slack.js +9 -0
- package/dist/error/logging/types.d.ts +83 -0
- package/dist/error/logging/types.js +7 -0
- package/dist/error/messages/en.d.ts +5 -0
- package/dist/error/messages/en.js +7 -0
- package/dist/error/messages/index.d.ts +40 -0
- package/dist/error/messages/index.js +17 -0
- package/dist/error/messages/ko.d.ts +5 -0
- package/dist/error/messages/ko.js +7 -0
- package/dist/error/messages/types.d.ts +30 -0
- package/dist/error/messages/types.js +0 -0
- package/dist/error/recovery/circuit-breaker.d.ts +85 -0
- package/dist/error/recovery/circuit-breaker.js +9 -0
- package/dist/error/recovery/degradation.d.ts +56 -0
- package/dist/error/recovery/degradation.js +7 -0
- package/dist/error/recovery/fallback.d.ts +55 -0
- package/dist/error/recovery/fallback.js +11 -0
- package/dist/error/recovery/index.d.ts +12 -0
- package/dist/error/recovery/index.js +26 -0
- package/dist/error/recovery/retry.d.ts +44 -0
- package/dist/error/recovery/retry.js +7 -0
- package/dist/geolocation/batch-processor.d.ts +33 -0
- package/dist/geolocation/batch-processor.js +10 -0
- package/dist/geolocation/index.d.ts +14 -0
- package/dist/geolocation/index.js +36 -0
- package/dist/geolocation/providers/base-provider.d.ts +33 -0
- package/dist/geolocation/providers/base-provider.js +9 -0
- package/dist/geolocation/providers/index.d.ts +54 -0
- package/dist/geolocation/providers/index.js +29 -0
- package/dist/geolocation/providers/ip-api-provider.d.ts +17 -0
- package/dist/geolocation/providers/ip-api-provider.js +8 -0
- package/dist/geolocation/providers/ipapi-co-provider.d.ts +17 -0
- package/dist/geolocation/providers/ipapi-co-provider.js +8 -0
- package/dist/geolocation/providers/ipgeolocation-provider.d.ts +18 -0
- package/dist/geolocation/providers/ipgeolocation-provider.js +8 -0
- package/dist/geolocation/providers/maxmind-provider.d.ts +18 -0
- package/dist/geolocation/providers/maxmind-provider.js +8 -0
- package/dist/hooks/useDataTable.d.ts +51 -0
- package/dist/hooks/useDataTable.js +149 -0
- package/dist/hooks/useDebounce.d.ts +7 -0
- package/dist/hooks/useDebounce.js +7 -0
- package/dist/hooks/useExitIntent.d.ts +35 -0
- package/dist/hooks/useExitIntent.js +72 -0
- package/dist/hooks/useTimezone.d.ts +19 -0
- package/dist/hooks/useTimezone.js +11 -0
- package/dist/logger/logger.d.ts +11 -0
- package/dist/logger/logger.js +17 -0
- package/dist/middleware/auth.d.ts +87 -0
- package/dist/middleware/auth.js +20 -0
- package/dist/middleware/cors.d.ts +30 -0
- package/dist/middleware/cors.js +10 -0
- package/dist/middleware/error-handler.d.ts +23 -0
- package/dist/middleware/error-handler.js +13 -0
- package/dist/middleware/index.d.ts +16 -0
- package/dist/middleware/index.js +72 -0
- package/dist/middleware/init-request.d.ts +18 -0
- package/dist/middleware/init-request.js +8 -0
- package/dist/middleware/middleware-chain.d.ts +53 -0
- package/dist/middleware/middleware-chain.js +8 -0
- package/dist/middleware/rate-limit.d.ts +82 -0
- package/dist/middleware/rate-limit.js +14 -0
- package/dist/middleware/response-logger.d.ts +22 -0
- package/dist/middleware/response-logger.js +8 -0
- package/dist/middleware/security.d.ts +31 -0
- package/dist/middleware/security.js +9 -0
- package/dist/middleware/types.d.ts +45 -0
- package/dist/middleware/types.js +0 -0
- package/dist/middleware/wrappers.d.ts +91 -0
- package/dist/middleware/wrappers.js +32 -0
- package/dist/storage/r2-storage.d.ts +38 -0
- package/dist/storage/r2-storage.js +105 -0
- package/dist/system/cpu.d.ts +2 -0
- package/dist/system/cpu.js +9 -0
- package/dist/system/disk.d.ts +2 -0
- package/dist/system/disk.js +9 -0
- package/dist/system/environment.d.ts +8 -0
- package/dist/system/environment.js +9 -0
- package/dist/system/health-check.d.ts +26 -0
- package/dist/system/health-check.js +10 -0
- package/dist/system/index.d.ts +51 -0
- package/dist/system/index.js +194 -0
- package/dist/system/memory.d.ts +2 -0
- package/dist/system/memory.js +9 -0
- package/dist/system/network.d.ts +2 -0
- package/dist/system/network.js +9 -0
- package/dist/system/types.d.ts +93 -0
- package/dist/system/types.js +0 -0
- package/dist/system/utils.d.ts +12 -0
- package/dist/system/utils.js +26 -0
- package/dist/types/api.d.ts +80 -0
- package/dist/types/api.js +0 -0
- package/dist/types/database.d.ts +38 -0
- package/dist/types/database.js +0 -0
- package/dist/types/env.d.ts +105 -0
- package/dist/types/env.js +0 -0
- package/dist/types/geoip.d.ts +152 -0
- package/dist/types/geoip.js +0 -0
- package/dist/types/i18n.d.ts +11 -0
- package/dist/types/i18n.js +0 -0
- package/dist/types/qr-code.d.ts +139 -0
- package/dist/types/qr-code.js +75 -0
- package/dist/types/user.d.ts +54 -0
- package/dist/types/user.js +0 -0
- package/dist/utils/api-helpers.d.ts +147 -0
- package/dist/utils/api-helpers.js +30 -0
- package/dist/utils/client/client-utils.d.ts +3 -0
- package/dist/utils/client/client-utils.js +9 -0
- package/dist/utils/client/qr-code.d.ts +16 -0
- package/dist/utils/client/qr-code.js +215 -0
- package/dist/utils/cors.d.ts +40 -0
- package/dist/utils/cors.js +21 -0
- package/dist/utils/csv-export.d.ts +97 -0
- package/dist/utils/csv-export.js +20 -0
- package/dist/utils/error-message-formatter.d.ts +17 -0
- package/dist/utils/error-message-formatter.js +11 -0
- package/dist/utils/error-processor.d.ts +70 -0
- package/dist/utils/error-processor.js +34 -0
- package/dist/utils/format-number.d.ts +17 -0
- package/dist/utils/format-number.js +9 -0
- package/dist/utils/index.d.ts +13 -0
- package/dist/utils/index.js +160 -0
- package/dist/utils/input-validation.d.ts +88 -0
- package/dist/utils/input-validation.js +223 -0
- package/dist/utils/ip-utils.d.ts +15 -0
- package/dist/utils/ip-utils.js +91 -0
- package/dist/utils/optimistic-lock.d.ts +27 -0
- package/dist/utils/optimistic-lock.js +16 -0
- package/dist/utils/sanitizer.d.ts +72 -0
- package/dist/utils/sanitizer.js +19 -0
- package/dist/utils/shared-utils.d.ts +25 -0
- package/dist/utils/shared-utils.js +43 -0
- package/dist/utils/short-code-generator.d.ts +24 -0
- package/dist/utils/short-code-generator.js +9 -0
- package/dist/utils/timezone.d.ts +56 -0
- package/dist/utils/timezone.js +29 -0
- package/dist/utils/type-guards.d.ts +164 -0
- package/dist/utils/type-guards.js +59 -0
- package/dist/utils/url-normalizer.d.ts +53 -0
- package/dist/utils/url-normalizer.js +21 -0
- package/dist/validators/index.d.ts +7 -0
- package/dist/validators/index.js +13 -0
- package/dist/validators/password-validator.d.ts +86 -0
- package/dist/validators/password-validator.js +13 -0
- package/dist/world_countries-C2WUL2CQ.js +279 -0
- package/package.json +129 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 프론트엔드 에러 표시 유틸리티
|
|
3
|
+
* Toast 알림, 에러 UI 표시 등
|
|
4
|
+
*/
|
|
5
|
+
export { getFriendlyMessage, getErrorDisplayInfo, type IErrorDisplay } from './friendly-messages';
|
|
6
|
+
type TLocale = 'ko' | 'en';
|
|
7
|
+
/**
|
|
8
|
+
* API 에러 응답 인터페이스
|
|
9
|
+
*/
|
|
10
|
+
export interface IApiErrorResponse {
|
|
11
|
+
success: false;
|
|
12
|
+
error: {
|
|
13
|
+
code: number;
|
|
14
|
+
message: string;
|
|
15
|
+
details?: unknown;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 에러 코드로 친화적 토스트 표시
|
|
20
|
+
*/
|
|
21
|
+
export declare function showFriendlyError(errorOrCode: number | IApiErrorResponse | Error, options?: {
|
|
22
|
+
locale?: TLocale;
|
|
23
|
+
duration?: number;
|
|
24
|
+
showCode?: boolean;
|
|
25
|
+
onAuthError?: () => void;
|
|
26
|
+
onRateLimitError?: () => void;
|
|
27
|
+
}): void;
|
|
28
|
+
/**
|
|
29
|
+
* API 응답에서 에러 처리
|
|
30
|
+
*/
|
|
31
|
+
export declare function handleApiResponse<T>(response: Response, options?: {
|
|
32
|
+
showToast?: boolean;
|
|
33
|
+
locale?: TLocale;
|
|
34
|
+
onAuthError?: () => void;
|
|
35
|
+
}): Promise<T>;
|
|
36
|
+
/**
|
|
37
|
+
* 에러 메시지 포맷 (인라인 표시용)
|
|
38
|
+
*/
|
|
39
|
+
export declare function formatInlineError(code: number, locale?: TLocale): string;
|
|
40
|
+
/**
|
|
41
|
+
* 에러 아이콘 가져오기
|
|
42
|
+
*/
|
|
43
|
+
export declare function getErrorIcon(code: number): string;
|
|
44
|
+
/**
|
|
45
|
+
* HTTP 상태 코드에서 기본 에러 코드 가져오기
|
|
46
|
+
*/
|
|
47
|
+
export declare function getDefaultErrorCode(status: number): number;
|
|
48
|
+
/**
|
|
49
|
+
* 에러 바운더리용 에러 정보 추출
|
|
50
|
+
*/
|
|
51
|
+
export declare function extractErrorInfo(error: Error | unknown): {
|
|
52
|
+
code: number;
|
|
53
|
+
message: string;
|
|
54
|
+
stack?: string;
|
|
55
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
extractErrorInfo,
|
|
3
|
+
formatInlineError,
|
|
4
|
+
getDefaultErrorCode,
|
|
5
|
+
getErrorIcon,
|
|
6
|
+
handleApiResponse,
|
|
7
|
+
showFriendlyError
|
|
8
|
+
} from "../chunk-3DZA6AGS.js";
|
|
9
|
+
import {
|
|
10
|
+
getErrorDisplayInfo,
|
|
11
|
+
getFriendlyMessage
|
|
12
|
+
} from "../chunk-2DVWSDST.js";
|
|
13
|
+
import "../chunk-Y3OTJH2S.js";
|
|
14
|
+
import "../chunk-ORMEWXMH.js";
|
|
15
|
+
export {
|
|
16
|
+
extractErrorInfo,
|
|
17
|
+
formatInlineError,
|
|
18
|
+
getDefaultErrorCode,
|
|
19
|
+
getErrorDisplayInfo,
|
|
20
|
+
getErrorIcon,
|
|
21
|
+
getFriendlyMessage,
|
|
22
|
+
handleApiResponse,
|
|
23
|
+
showFriendlyError
|
|
24
|
+
};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 통합 에러 핸들러
|
|
3
|
+
* API 라우트 및 미들웨어에서 발생하는 모든 에러를 처리
|
|
4
|
+
*/
|
|
5
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
6
|
+
/**
|
|
7
|
+
* 에러 응답 형식
|
|
8
|
+
*/
|
|
9
|
+
export interface IErrorResponse {
|
|
10
|
+
success: false;
|
|
11
|
+
error: {
|
|
12
|
+
code: number;
|
|
13
|
+
message: string;
|
|
14
|
+
details?: unknown;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 에러를 NextResponse로 변환
|
|
19
|
+
*/
|
|
20
|
+
export declare function errorToResponse(error: unknown, requestPath?: string): NextResponse<IErrorResponse>;
|
|
21
|
+
/**
|
|
22
|
+
* 에러 처리 및 표준화
|
|
23
|
+
*/
|
|
24
|
+
export declare function processError(error: unknown): {
|
|
25
|
+
code: number;
|
|
26
|
+
message: string;
|
|
27
|
+
status: number;
|
|
28
|
+
details?: unknown;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* 에러 핸들링 미들웨어 래퍼
|
|
32
|
+
*/
|
|
33
|
+
export declare function withErrorHandler<T extends unknown[]>(handler: (request: NextRequest, ...args: T) => Promise<NextResponse>): (request: NextRequest, ...args: T) => Promise<NextResponse>;
|
|
34
|
+
/**
|
|
35
|
+
* 에러 응답 생성 유틸리티
|
|
36
|
+
*/
|
|
37
|
+
export declare const ErrorResponse: {
|
|
38
|
+
validation: (message?: string, details?: unknown) => NextResponse<IErrorResponse>;
|
|
39
|
+
badRequest: (message?: string) => NextResponse<IErrorResponse>;
|
|
40
|
+
invalidUrl: () => NextResponse<IErrorResponse>;
|
|
41
|
+
invalidEmail: () => NextResponse<IErrorResponse>;
|
|
42
|
+
invalidAlias: () => NextResponse<IErrorResponse>;
|
|
43
|
+
unauthorized: (message?: string) => NextResponse<IErrorResponse>;
|
|
44
|
+
invalidToken: () => NextResponse<IErrorResponse>;
|
|
45
|
+
tokenExpired: () => NextResponse<IErrorResponse>;
|
|
46
|
+
invalidCredentials: () => NextResponse<IErrorResponse>;
|
|
47
|
+
sessionExpired: () => NextResponse<IErrorResponse>;
|
|
48
|
+
forbidden: (message?: string) => NextResponse<IErrorResponse>;
|
|
49
|
+
emailNotVerified: () => NextResponse<IErrorResponse>;
|
|
50
|
+
accountDisabled: () => NextResponse<IErrorResponse>;
|
|
51
|
+
accountLocked: () => NextResponse<IErrorResponse>;
|
|
52
|
+
notFound: (message?: string) => NextResponse<IErrorResponse>;
|
|
53
|
+
userNotFound: () => NextResponse<IErrorResponse>;
|
|
54
|
+
linkNotFound: () => NextResponse<IErrorResponse>;
|
|
55
|
+
conflict: (message?: string) => NextResponse<IErrorResponse>;
|
|
56
|
+
duplicate: (resource?: string) => NextResponse<IErrorResponse>;
|
|
57
|
+
emailExists: () => NextResponse<IErrorResponse>;
|
|
58
|
+
aliasExists: () => NextResponse<IErrorResponse>;
|
|
59
|
+
businessRule: (message?: string) => NextResponse<IErrorResponse>;
|
|
60
|
+
linkExpired: () => NextResponse<IErrorResponse>;
|
|
61
|
+
linkInactive: () => NextResponse<IErrorResponse>;
|
|
62
|
+
linkPasswordRequired: () => NextResponse<IErrorResponse>;
|
|
63
|
+
linkPasswordIncorrect: () => NextResponse<IErrorResponse>;
|
|
64
|
+
reservedWord: () => NextResponse<IErrorResponse>;
|
|
65
|
+
quotaExceeded: () => NextResponse<IErrorResponse>;
|
|
66
|
+
rateLimit: () => NextResponse<IErrorResponse>;
|
|
67
|
+
dailyLimit: () => NextResponse<IErrorResponse>;
|
|
68
|
+
serverError: (message?: string) => NextResponse<IErrorResponse>;
|
|
69
|
+
databaseError: () => NextResponse<IErrorResponse>;
|
|
70
|
+
serviceUnavailable: () => NextResponse<IErrorResponse>;
|
|
71
|
+
externalServiceError: (service?: string) => NextResponse<IErrorResponse>;
|
|
72
|
+
accessBlocked: () => NextResponse<IErrorResponse>;
|
|
73
|
+
ipBlocked: () => NextResponse<IErrorResponse>;
|
|
74
|
+
};
|
|
75
|
+
declare const _default: {
|
|
76
|
+
errorToResponse: typeof errorToResponse;
|
|
77
|
+
processError: typeof processError;
|
|
78
|
+
withErrorHandler: typeof withErrorHandler;
|
|
79
|
+
ErrorResponse: {
|
|
80
|
+
validation: (message?: string, details?: unknown) => NextResponse<IErrorResponse>;
|
|
81
|
+
badRequest: (message?: string) => NextResponse<IErrorResponse>;
|
|
82
|
+
invalidUrl: () => NextResponse<IErrorResponse>;
|
|
83
|
+
invalidEmail: () => NextResponse<IErrorResponse>;
|
|
84
|
+
invalidAlias: () => NextResponse<IErrorResponse>;
|
|
85
|
+
unauthorized: (message?: string) => NextResponse<IErrorResponse>;
|
|
86
|
+
invalidToken: () => NextResponse<IErrorResponse>;
|
|
87
|
+
tokenExpired: () => NextResponse<IErrorResponse>;
|
|
88
|
+
invalidCredentials: () => NextResponse<IErrorResponse>;
|
|
89
|
+
sessionExpired: () => NextResponse<IErrorResponse>;
|
|
90
|
+
forbidden: (message?: string) => NextResponse<IErrorResponse>;
|
|
91
|
+
emailNotVerified: () => NextResponse<IErrorResponse>;
|
|
92
|
+
accountDisabled: () => NextResponse<IErrorResponse>;
|
|
93
|
+
accountLocked: () => NextResponse<IErrorResponse>;
|
|
94
|
+
notFound: (message?: string) => NextResponse<IErrorResponse>;
|
|
95
|
+
userNotFound: () => NextResponse<IErrorResponse>;
|
|
96
|
+
linkNotFound: () => NextResponse<IErrorResponse>;
|
|
97
|
+
conflict: (message?: string) => NextResponse<IErrorResponse>;
|
|
98
|
+
duplicate: (resource?: string) => NextResponse<IErrorResponse>;
|
|
99
|
+
emailExists: () => NextResponse<IErrorResponse>;
|
|
100
|
+
aliasExists: () => NextResponse<IErrorResponse>;
|
|
101
|
+
businessRule: (message?: string) => NextResponse<IErrorResponse>;
|
|
102
|
+
linkExpired: () => NextResponse<IErrorResponse>;
|
|
103
|
+
linkInactive: () => NextResponse<IErrorResponse>;
|
|
104
|
+
linkPasswordRequired: () => NextResponse<IErrorResponse>;
|
|
105
|
+
linkPasswordIncorrect: () => NextResponse<IErrorResponse>;
|
|
106
|
+
reservedWord: () => NextResponse<IErrorResponse>;
|
|
107
|
+
quotaExceeded: () => NextResponse<IErrorResponse>;
|
|
108
|
+
rateLimit: () => NextResponse<IErrorResponse>;
|
|
109
|
+
dailyLimit: () => NextResponse<IErrorResponse>;
|
|
110
|
+
serverError: (message?: string) => NextResponse<IErrorResponse>;
|
|
111
|
+
databaseError: () => NextResponse<IErrorResponse>;
|
|
112
|
+
serviceUnavailable: () => NextResponse<IErrorResponse>;
|
|
113
|
+
externalServiceError: (service?: string) => NextResponse<IErrorResponse>;
|
|
114
|
+
accessBlocked: () => NextResponse<IErrorResponse>;
|
|
115
|
+
ipBlocked: () => NextResponse<IErrorResponse>;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ErrorResponse,
|
|
3
|
+
errorToResponse,
|
|
4
|
+
error_handler_default,
|
|
5
|
+
processError,
|
|
6
|
+
withErrorHandler
|
|
7
|
+
} from "../chunk-GPBOMJSZ.js";
|
|
8
|
+
import "../chunk-MLGO3HLS.js";
|
|
9
|
+
import "../chunk-Y3OTJH2S.js";
|
|
10
|
+
import "../chunk-EZR55KV2.js";
|
|
11
|
+
import "../chunk-ORMEWXMH.js";
|
|
12
|
+
export {
|
|
13
|
+
ErrorResponse,
|
|
14
|
+
error_handler_default as default,
|
|
15
|
+
errorToResponse,
|
|
16
|
+
processError,
|
|
17
|
+
withErrorHandler
|
|
18
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 사용자 친화적 에러 메시지 (v2)
|
|
3
|
+
* 새로운 다중 언어 메시지 시스템 사용
|
|
4
|
+
*
|
|
5
|
+
* 이 파일은 기존 friendly-messages.ts를 대체하며,
|
|
6
|
+
* messages/ 폴더의 다중 언어 시스템을 활용합니다.
|
|
7
|
+
*/
|
|
8
|
+
import { type IErrorMessage, type TLocale } from './messages';
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated Use IErrorMessage from './messages' instead
|
|
11
|
+
*/
|
|
12
|
+
export interface IFriendlyMessage extends IErrorMessage {
|
|
13
|
+
}
|
|
14
|
+
export interface IErrorDisplay {
|
|
15
|
+
code: number;
|
|
16
|
+
title: string;
|
|
17
|
+
description: string;
|
|
18
|
+
action?: string;
|
|
19
|
+
icon: string;
|
|
20
|
+
severity: 'info' | 'warning' | 'error' | 'critical';
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 에러 코드에 해당하는 친화적 메시지 가져오기
|
|
24
|
+
*
|
|
25
|
+
* @param code - 에러 코드
|
|
26
|
+
* @param locale - 언어 (기본값: 'ko')
|
|
27
|
+
* @returns 친화적 메시지
|
|
28
|
+
*/
|
|
29
|
+
export declare function getFriendlyMessage(code: number, locale?: TLocale): IErrorMessage;
|
|
30
|
+
/**
|
|
31
|
+
* 에러 표시 정보 가져오기 (아이콘, 심각도 포함)
|
|
32
|
+
*
|
|
33
|
+
* @param code - 에러 코드
|
|
34
|
+
* @param locale - 언어 (기본값: 'ko')
|
|
35
|
+
* @returns 에러 표시 정보
|
|
36
|
+
*/
|
|
37
|
+
export declare function getErrorDisplayInfo(code: number, locale?: TLocale): IErrorDisplay;
|
|
38
|
+
/**
|
|
39
|
+
* 친화적 에러 메시지 포맷팅 (한 줄)
|
|
40
|
+
*
|
|
41
|
+
* @param code - 에러 코드
|
|
42
|
+
* @param locale - 언어 (기본값: 'ko')
|
|
43
|
+
* @returns 포맷된 에러 메시지
|
|
44
|
+
*/
|
|
45
|
+
export declare function formatFriendlyError(code: number, locale?: TLocale): string;
|
|
46
|
+
export type { IErrorMessage, TLocale } from './messages';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
formatFriendlyError,
|
|
3
|
+
getErrorDisplayInfo,
|
|
4
|
+
getFriendlyMessage
|
|
5
|
+
} from "../chunk-POKGHK3L.js";
|
|
6
|
+
import "../chunk-EEUBKZV4.js";
|
|
7
|
+
import "../chunk-N4YGR5WH.js";
|
|
8
|
+
import "../chunk-KXAWBFJN.js";
|
|
9
|
+
import "../chunk-Y3OTJH2S.js";
|
|
10
|
+
import "../chunk-ORMEWXMH.js";
|
|
11
|
+
export {
|
|
12
|
+
formatFriendlyError,
|
|
13
|
+
getErrorDisplayInfo,
|
|
14
|
+
getFriendlyMessage
|
|
15
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 사용자 친화적 에러 메시지 정의
|
|
3
|
+
* 5자리 HTTP 확장 에러 코드별 프렌들리 메시지
|
|
4
|
+
*/
|
|
5
|
+
export interface IFriendlyMessage {
|
|
6
|
+
title: string;
|
|
7
|
+
description: string;
|
|
8
|
+
action?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface IErrorDisplay {
|
|
11
|
+
code: number;
|
|
12
|
+
title: string;
|
|
13
|
+
description: string;
|
|
14
|
+
action?: string;
|
|
15
|
+
icon: string;
|
|
16
|
+
severity: 'info' | 'warning' | 'error' | 'critical';
|
|
17
|
+
}
|
|
18
|
+
type TLocale = 'ko' | 'en';
|
|
19
|
+
export declare function getFriendlyMessage(code: number, locale?: TLocale): IFriendlyMessage;
|
|
20
|
+
export declare function getErrorDisplayInfo(code: number, locale?: TLocale): IErrorDisplay;
|
|
21
|
+
export declare function formatFriendlyError(code: number, locale?: TLocale): string;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
formatFriendlyError,
|
|
3
|
+
getErrorDisplayInfo,
|
|
4
|
+
getFriendlyMessage
|
|
5
|
+
} from "../chunk-2DVWSDST.js";
|
|
6
|
+
import "../chunk-Y3OTJH2S.js";
|
|
7
|
+
import "../chunk-ORMEWXMH.js";
|
|
8
|
+
export {
|
|
9
|
+
formatFriendlyError,
|
|
10
|
+
getErrorDisplayInfo,
|
|
11
|
+
getFriendlyMessage
|
|
12
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "../../chunk-Y2TUZFCP.js";
|
|
2
|
+
import {
|
|
3
|
+
useErrorHandler
|
|
4
|
+
} from "../../chunk-IAJNC34M.js";
|
|
5
|
+
import "../../chunk-POKGHK3L.js";
|
|
6
|
+
import "../../chunk-EEUBKZV4.js";
|
|
7
|
+
import "../../chunk-N4YGR5WH.js";
|
|
8
|
+
import "../../chunk-KXAWBFJN.js";
|
|
9
|
+
import "../../chunk-MLGO3HLS.js";
|
|
10
|
+
import "../../chunk-Y3OTJH2S.js";
|
|
11
|
+
import "../../chunk-ORMEWXMH.js";
|
|
12
|
+
export {
|
|
13
|
+
useErrorHandler
|
|
14
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useErrorHandler Hook
|
|
3
|
+
*
|
|
4
|
+
* 에러 상태 관리 및 처리
|
|
5
|
+
*/
|
|
6
|
+
import type { TLocale } from '@withwiz/error/messages';
|
|
7
|
+
import type { IErrorDisplay } from '@withwiz/error/friendly-messages-v2';
|
|
8
|
+
/**
|
|
9
|
+
* 에러 상태
|
|
10
|
+
*/
|
|
11
|
+
export interface IErrorState {
|
|
12
|
+
/** 에러 발생 여부 */
|
|
13
|
+
hasError: boolean;
|
|
14
|
+
/** 에러 코드 */
|
|
15
|
+
code?: number;
|
|
16
|
+
/** 에러 메시지 */
|
|
17
|
+
message?: string;
|
|
18
|
+
/** 에러 표시 정보 */
|
|
19
|
+
displayInfo?: IErrorDisplay;
|
|
20
|
+
/** 에러 발생 시간 */
|
|
21
|
+
timestamp?: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* useErrorHandler Hook 반환 타입
|
|
25
|
+
*/
|
|
26
|
+
export interface IUseErrorHandler {
|
|
27
|
+
/** 에러 상태 */
|
|
28
|
+
errorState: IErrorState;
|
|
29
|
+
/** 에러 처리 */
|
|
30
|
+
handleError: (error: unknown) => void;
|
|
31
|
+
/** 에러 초기화 */
|
|
32
|
+
clearError: () => void;
|
|
33
|
+
/** 인증 에러 처리 (자동 리다이렉트) */
|
|
34
|
+
handleAuthError: (error: unknown, redirectUrl?: string) => void;
|
|
35
|
+
/** 에러 여부 확인 */
|
|
36
|
+
hasError: boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* useErrorHandler Hook
|
|
40
|
+
*
|
|
41
|
+
* @param locale - 로케일 (기본값: 'ko')
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```tsx
|
|
45
|
+
* function MyComponent() {
|
|
46
|
+
* const { errorState, handleError, clearError } = useErrorHandler('ko');
|
|
47
|
+
*
|
|
48
|
+
* const fetchData = async () => {
|
|
49
|
+
* try {
|
|
50
|
+
* const res = await fetch('/api/data');
|
|
51
|
+
* if (!res.ok) {
|
|
52
|
+
* throw new AppError(40401);
|
|
53
|
+
* }
|
|
54
|
+
* } catch (error) {
|
|
55
|
+
* handleError(error);
|
|
56
|
+
* }
|
|
57
|
+
* };
|
|
58
|
+
*
|
|
59
|
+
* if (errorState.hasError) {
|
|
60
|
+
* return <ErrorAlert code={errorState.code!} />;
|
|
61
|
+
* }
|
|
62
|
+
*
|
|
63
|
+
* return <div>...</div>;
|
|
64
|
+
* }
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export declare function useErrorHandler(locale?: TLocale): IUseErrorHandler;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
useErrorHandler
|
|
4
|
+
} from "../../chunk-IAJNC34M.js";
|
|
5
|
+
import "../../chunk-POKGHK3L.js";
|
|
6
|
+
import "../../chunk-EEUBKZV4.js";
|
|
7
|
+
import "../../chunk-N4YGR5WH.js";
|
|
8
|
+
import "../../chunk-KXAWBFJN.js";
|
|
9
|
+
import "../../chunk-MLGO3HLS.js";
|
|
10
|
+
import "../../chunk-Y3OTJH2S.js";
|
|
11
|
+
import "../../chunk-ORMEWXMH.js";
|
|
12
|
+
export {
|
|
13
|
+
useErrorHandler
|
|
14
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 통합 에러 처리 시스템
|
|
3
|
+
*
|
|
4
|
+
* 모든 에러, 예외 상황을 통합 처리하는 중앙 집중식 시스템
|
|
5
|
+
* 에러코드는 HTTP status를 확장한 5자리 형식 (XXXYY)
|
|
6
|
+
* 사용자 UI에 표시할 문구는 프렌들리하게 제공 (다중 언어 지원)
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* // API 라우트에서 에러 발생
|
|
10
|
+
* throw AppError.notFound('링크를 찾을 수 없습니다');
|
|
11
|
+
*
|
|
12
|
+
* // 프론트엔드에서 에러 표시
|
|
13
|
+
* showFriendlyError(error, { locale: 'ko' });
|
|
14
|
+
*/
|
|
15
|
+
export * from "@withwiz/constants/error-codes";
|
|
16
|
+
export * from "./messages";
|
|
17
|
+
export { LocaleDetector } from "./core/locale-detector";
|
|
18
|
+
export * from "./app-error";
|
|
19
|
+
export * from "./error-handler";
|
|
20
|
+
export { getFriendlyMessage, getErrorDisplayInfo, formatFriendlyError, type IFriendlyMessage, type IErrorDisplay, } from "./friendly-messages-v2";
|
|
21
|
+
export * from "./error-display";
|
|
22
|
+
export * from "./ErrorBoundary";
|
|
23
|
+
export * from "./components";
|
|
24
|
+
export * from "./hooks";
|
|
25
|
+
export * from "./logging";
|
|
26
|
+
export * from "./recovery";
|