@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,329 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ERROR_CODES,
|
|
3
|
+
formatErrorMessage,
|
|
4
|
+
getErrorCategory,
|
|
5
|
+
getHttpStatus
|
|
6
|
+
} from "./chunk-Y3OTJH2S.js";
|
|
7
|
+
|
|
8
|
+
// src/error/app-error.ts
|
|
9
|
+
var AppError = class _AppError extends Error {
|
|
10
|
+
constructor(code, message, details, requestId) {
|
|
11
|
+
const formattedMessage = formatErrorMessage(code, message);
|
|
12
|
+
super(formattedMessage);
|
|
13
|
+
this.name = "AppError";
|
|
14
|
+
this.code = code;
|
|
15
|
+
this.status = getHttpStatus(code);
|
|
16
|
+
this.key = this.findErrorKey(code);
|
|
17
|
+
this.category = getErrorCategory(code);
|
|
18
|
+
this.details = details;
|
|
19
|
+
this.timestamp = /* @__PURE__ */ new Date();
|
|
20
|
+
this.requestId = requestId;
|
|
21
|
+
Object.setPrototypeOf(this, _AppError.prototype);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 에러 코드로 에러 키 찾기
|
|
25
|
+
*/
|
|
26
|
+
findErrorKey(code) {
|
|
27
|
+
const entry = Object.entries(ERROR_CODES).find(([, v]) => v.code === code);
|
|
28
|
+
return entry ? entry[0] : "UNKNOWN";
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* JSON 직렬화
|
|
32
|
+
*/
|
|
33
|
+
toJSON() {
|
|
34
|
+
return {
|
|
35
|
+
code: this.code,
|
|
36
|
+
message: this.message,
|
|
37
|
+
status: this.status,
|
|
38
|
+
key: this.key,
|
|
39
|
+
category: this.category,
|
|
40
|
+
details: this.details,
|
|
41
|
+
timestamp: this.timestamp.toISOString(),
|
|
42
|
+
requestId: this.requestId
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* 사용자 친화적 메시지 반환
|
|
47
|
+
*/
|
|
48
|
+
toFriendlyMessage() {
|
|
49
|
+
return this.message;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* 에러가 특정 카테고리인지 확인
|
|
53
|
+
*/
|
|
54
|
+
isCategory(category) {
|
|
55
|
+
return this.category === category;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 로깅용 문자열 반환
|
|
59
|
+
*/
|
|
60
|
+
toLogString() {
|
|
61
|
+
return `[${this.code}] ${this.message} | ${this.category} | ${this.requestId || "no-request-id"}`;
|
|
62
|
+
}
|
|
63
|
+
// ============================================
|
|
64
|
+
// 정적 팩토리 메서드
|
|
65
|
+
// ============================================
|
|
66
|
+
/**
|
|
67
|
+
* 에러 코드 키로 에러 생성
|
|
68
|
+
*/
|
|
69
|
+
static fromKey(key, customMessage, details) {
|
|
70
|
+
const errorInfo = ERROR_CODES[key];
|
|
71
|
+
return new _AppError(
|
|
72
|
+
errorInfo.code,
|
|
73
|
+
customMessage || errorInfo.message,
|
|
74
|
+
details
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* 에러 정보로 에러 생성
|
|
79
|
+
*/
|
|
80
|
+
static fromErrorInfo(errorInfo, customMessage, details) {
|
|
81
|
+
return new _AppError(
|
|
82
|
+
errorInfo.code,
|
|
83
|
+
customMessage || errorInfo.message,
|
|
84
|
+
details
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* 알 수 없는 에러를 AppError로 변환
|
|
89
|
+
*/
|
|
90
|
+
static from(error, fallbackMessage) {
|
|
91
|
+
if (error instanceof _AppError) {
|
|
92
|
+
return error;
|
|
93
|
+
}
|
|
94
|
+
if (error instanceof Error) {
|
|
95
|
+
const codeMatch = error.message.match(/\[(\d{5})\]/);
|
|
96
|
+
if (codeMatch) {
|
|
97
|
+
const code = parseInt(codeMatch[1], 10);
|
|
98
|
+
return new _AppError(code, error.message.replace(/\s*\[\d{5}\]$/, ""));
|
|
99
|
+
}
|
|
100
|
+
return new _AppError(
|
|
101
|
+
ERROR_CODES.SERVER_ERROR.code,
|
|
102
|
+
fallbackMessage || ERROR_CODES.SERVER_ERROR.message
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
return new _AppError(
|
|
106
|
+
ERROR_CODES.INTERNAL_SERVER_ERROR.code,
|
|
107
|
+
fallbackMessage || ERROR_CODES.INTERNAL_SERVER_ERROR.message
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
// ============================================
|
|
111
|
+
// 검증 에러 (400xx)
|
|
112
|
+
// ============================================
|
|
113
|
+
static validation(message, details) {
|
|
114
|
+
return _AppError.fromKey("VALIDATION_ERROR", message, details);
|
|
115
|
+
}
|
|
116
|
+
static badRequest(message, details) {
|
|
117
|
+
return _AppError.fromKey("BAD_REQUEST", message, details);
|
|
118
|
+
}
|
|
119
|
+
static invalidInput(message, details) {
|
|
120
|
+
return _AppError.fromKey("INVALID_INPUT", message, details);
|
|
121
|
+
}
|
|
122
|
+
static missingField(fieldName) {
|
|
123
|
+
return _AppError.fromKey(
|
|
124
|
+
"MISSING_REQUIRED_FIELD",
|
|
125
|
+
`\uD544\uC218 \uD56D\uBAA9 '${fieldName}'\uC774(\uAC00) \uB204\uB77D\uB418\uC5C8\uC2B5\uB2C8\uB2E4.`,
|
|
126
|
+
{ field: fieldName }
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
static invalidUrl(url) {
|
|
130
|
+
return _AppError.fromKey("INVALID_URL_FORMAT", void 0, { value: url });
|
|
131
|
+
}
|
|
132
|
+
static invalidEmail(email) {
|
|
133
|
+
return _AppError.fromKey("INVALID_EMAIL_FORMAT", void 0, {
|
|
134
|
+
value: email
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
static weakPassword() {
|
|
138
|
+
return _AppError.fromKey("PASSWORD_TOO_WEAK");
|
|
139
|
+
}
|
|
140
|
+
static invalidAlias(alias) {
|
|
141
|
+
return _AppError.fromKey("INVALID_ALIAS_FORMAT", void 0, {
|
|
142
|
+
value: alias
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
// ============================================
|
|
146
|
+
// 인증 에러 (401xx)
|
|
147
|
+
// ============================================
|
|
148
|
+
static unauthorized(message) {
|
|
149
|
+
return _AppError.fromKey("UNAUTHORIZED", message);
|
|
150
|
+
}
|
|
151
|
+
static invalidToken() {
|
|
152
|
+
return _AppError.fromKey("INVALID_TOKEN");
|
|
153
|
+
}
|
|
154
|
+
static tokenExpired() {
|
|
155
|
+
return _AppError.fromKey("TOKEN_EXPIRED");
|
|
156
|
+
}
|
|
157
|
+
static invalidCredentials() {
|
|
158
|
+
return _AppError.fromKey("INVALID_CREDENTIALS");
|
|
159
|
+
}
|
|
160
|
+
static sessionExpired() {
|
|
161
|
+
return _AppError.fromKey("SESSION_EXPIRED");
|
|
162
|
+
}
|
|
163
|
+
// ============================================
|
|
164
|
+
// 권한 에러 (403xx)
|
|
165
|
+
// ============================================
|
|
166
|
+
static forbidden(message) {
|
|
167
|
+
return _AppError.fromKey("FORBIDDEN", message);
|
|
168
|
+
}
|
|
169
|
+
static emailNotVerified() {
|
|
170
|
+
return _AppError.fromKey("EMAIL_NOT_VERIFIED");
|
|
171
|
+
}
|
|
172
|
+
static accountDisabled() {
|
|
173
|
+
return _AppError.fromKey("ACCOUNT_DISABLED");
|
|
174
|
+
}
|
|
175
|
+
static accountLocked() {
|
|
176
|
+
return _AppError.fromKey("ACCOUNT_LOCKED");
|
|
177
|
+
}
|
|
178
|
+
// ============================================
|
|
179
|
+
// 리소스 에러 (404xx)
|
|
180
|
+
// ============================================
|
|
181
|
+
static notFound(message) {
|
|
182
|
+
return _AppError.fromKey("NOT_FOUND", message);
|
|
183
|
+
}
|
|
184
|
+
static userNotFound() {
|
|
185
|
+
return _AppError.fromKey("USER_NOT_FOUND");
|
|
186
|
+
}
|
|
187
|
+
static linkNotFound() {
|
|
188
|
+
return _AppError.fromKey("LINK_NOT_FOUND");
|
|
189
|
+
}
|
|
190
|
+
static tagNotFound() {
|
|
191
|
+
return _AppError.fromKey("TAG_NOT_FOUND");
|
|
192
|
+
}
|
|
193
|
+
static favoriteNotFound() {
|
|
194
|
+
return _AppError.fromKey("FAVORITE_NOT_FOUND");
|
|
195
|
+
}
|
|
196
|
+
static groupNotFound() {
|
|
197
|
+
return _AppError.fromKey("GROUP_NOT_FOUND");
|
|
198
|
+
}
|
|
199
|
+
// ============================================
|
|
200
|
+
// 충돌 에러 (409xx)
|
|
201
|
+
// ============================================
|
|
202
|
+
static conflict(message) {
|
|
203
|
+
return _AppError.fromKey("CONFLICT", message);
|
|
204
|
+
}
|
|
205
|
+
static duplicate(resourceName) {
|
|
206
|
+
const message = resourceName ? `'${resourceName}'\uC740(\uB294) \uC774\uBBF8 \uC874\uC7AC\uD569\uB2C8\uB2E4.` : void 0;
|
|
207
|
+
return _AppError.fromKey("DUPLICATE_RESOURCE", message);
|
|
208
|
+
}
|
|
209
|
+
static emailExists(email) {
|
|
210
|
+
return _AppError.fromKey("EMAIL_ALREADY_EXISTS", void 0, {
|
|
211
|
+
value: email
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
static aliasExists(alias) {
|
|
215
|
+
return _AppError.fromKey("ALIAS_ALREADY_EXISTS", void 0, {
|
|
216
|
+
value: alias
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
// ============================================
|
|
220
|
+
// 비즈니스 로직 에러 (422xx)
|
|
221
|
+
// ============================================
|
|
222
|
+
static businessRule(message, details) {
|
|
223
|
+
return _AppError.fromKey("BUSINESS_RULE_VIOLATION", message, details);
|
|
224
|
+
}
|
|
225
|
+
static invalidOperation(message) {
|
|
226
|
+
return _AppError.fromKey("INVALID_OPERATION", message);
|
|
227
|
+
}
|
|
228
|
+
static quotaExceeded(quotaType) {
|
|
229
|
+
const message = quotaType ? `${quotaType} \uC0AC\uC6A9\uB7C9\uC744 \uCD08\uACFC\uD588\uC2B5\uB2C8\uB2E4.` : void 0;
|
|
230
|
+
return _AppError.fromKey("QUOTA_EXCEEDED", message);
|
|
231
|
+
}
|
|
232
|
+
static linkExpired() {
|
|
233
|
+
return _AppError.fromKey("LINK_EXPIRED");
|
|
234
|
+
}
|
|
235
|
+
static linkInactive() {
|
|
236
|
+
return _AppError.fromKey("LINK_INACTIVE");
|
|
237
|
+
}
|
|
238
|
+
static linkPasswordRequired() {
|
|
239
|
+
return _AppError.fromKey("LINK_PASSWORD_REQUIRED");
|
|
240
|
+
}
|
|
241
|
+
static linkPasswordIncorrect() {
|
|
242
|
+
return _AppError.fromKey("LINK_PASSWORD_INCORRECT");
|
|
243
|
+
}
|
|
244
|
+
static reservedWord(word) {
|
|
245
|
+
return _AppError.fromKey("RESERVED_WORD_USED", void 0, { value: word });
|
|
246
|
+
}
|
|
247
|
+
static alreadyFavorited() {
|
|
248
|
+
return _AppError.fromKey("ALREADY_FAVORITED");
|
|
249
|
+
}
|
|
250
|
+
static cannotDeleteOwnAccount() {
|
|
251
|
+
return _AppError.fromKey("CANNOT_DELETE_OWN_ACCOUNT");
|
|
252
|
+
}
|
|
253
|
+
static fileTooLarge(maxSize) {
|
|
254
|
+
const message = maxSize ? `\uD30C\uC77C \uD06C\uAE30\uAC00 ${maxSize}\uB97C \uCD08\uACFC\uD588\uC2B5\uB2C8\uB2E4.` : void 0;
|
|
255
|
+
return _AppError.fromKey("FILE_TOO_LARGE", message);
|
|
256
|
+
}
|
|
257
|
+
static unsupportedFileType(fileType) {
|
|
258
|
+
const message = fileType ? `'${fileType}' \uD615\uC2DD\uC740 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.` : void 0;
|
|
259
|
+
return _AppError.fromKey("UNSUPPORTED_FILE_TYPE", message);
|
|
260
|
+
}
|
|
261
|
+
// ============================================
|
|
262
|
+
// Rate Limiting (429xx)
|
|
263
|
+
// ============================================
|
|
264
|
+
static rateLimit(retryAfter) {
|
|
265
|
+
const details = retryAfter ? { retryAfter } : void 0;
|
|
266
|
+
return _AppError.fromKey("RATE_LIMIT_EXCEEDED", void 0, details);
|
|
267
|
+
}
|
|
268
|
+
static dailyLimit() {
|
|
269
|
+
return _AppError.fromKey("DAILY_LIMIT_EXCEEDED");
|
|
270
|
+
}
|
|
271
|
+
static apiQuotaExceeded() {
|
|
272
|
+
return _AppError.fromKey("API_QUOTA_EXCEEDED");
|
|
273
|
+
}
|
|
274
|
+
// ============================================
|
|
275
|
+
// 서버 에러 (500xx)
|
|
276
|
+
// ============================================
|
|
277
|
+
static serverError(message) {
|
|
278
|
+
return _AppError.fromKey("SERVER_ERROR", message);
|
|
279
|
+
}
|
|
280
|
+
static internalError(message) {
|
|
281
|
+
return _AppError.fromKey("INTERNAL_SERVER_ERROR", message);
|
|
282
|
+
}
|
|
283
|
+
static databaseError(message) {
|
|
284
|
+
return _AppError.fromKey("DATABASE_ERROR", message);
|
|
285
|
+
}
|
|
286
|
+
static emailSendFailed() {
|
|
287
|
+
return _AppError.fromKey("EMAIL_SEND_FAILED");
|
|
288
|
+
}
|
|
289
|
+
static cacheError() {
|
|
290
|
+
return _AppError.fromKey("CACHE_ERROR");
|
|
291
|
+
}
|
|
292
|
+
static fileUploadFailed() {
|
|
293
|
+
return _AppError.fromKey("FILE_UPLOAD_FAILED");
|
|
294
|
+
}
|
|
295
|
+
// ============================================
|
|
296
|
+
// 서비스 불가 (503xx)
|
|
297
|
+
// ============================================
|
|
298
|
+
static externalServiceError(serviceName) {
|
|
299
|
+
const message = serviceName ? `'${serviceName}' \uC11C\uBE44\uC2A4\uC5D0 \uC5F0\uACB0\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.` : void 0;
|
|
300
|
+
return _AppError.fromKey("EXTERNAL_SERVICE_ERROR", message);
|
|
301
|
+
}
|
|
302
|
+
static serviceUnavailable(message) {
|
|
303
|
+
return _AppError.fromKey("SERVICE_UNAVAILABLE", message);
|
|
304
|
+
}
|
|
305
|
+
// ============================================
|
|
306
|
+
// 보안 에러 (403xx - 71~79)
|
|
307
|
+
// ============================================
|
|
308
|
+
static accessBlocked(reason) {
|
|
309
|
+
return _AppError.fromKey("ACCESS_BLOCKED", reason);
|
|
310
|
+
}
|
|
311
|
+
static securityValidationFailed() {
|
|
312
|
+
return _AppError.fromKey("SECURITY_VALIDATION_FAILED");
|
|
313
|
+
}
|
|
314
|
+
static blockedUrl(url) {
|
|
315
|
+
return _AppError.fromKey("BLOCKED_URL", void 0, { value: url });
|
|
316
|
+
}
|
|
317
|
+
static suspiciousActivity() {
|
|
318
|
+
return _AppError.fromKey("SUSPICIOUS_ACTIVITY");
|
|
319
|
+
}
|
|
320
|
+
static ipBlocked(ip) {
|
|
321
|
+
return _AppError.fromKey("IP_BLOCKED", void 0, { value: ip });
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
var app_error_default = AppError;
|
|
325
|
+
|
|
326
|
+
export {
|
|
327
|
+
AppError,
|
|
328
|
+
app_error_default
|
|
329
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-62FLBG6B.js";
|
|
4
|
+
|
|
5
|
+
// src/components/ui/Skeleton.tsx
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
function Skeleton({ className, children }) {
|
|
8
|
+
return /* @__PURE__ */ jsx(
|
|
9
|
+
"div",
|
|
10
|
+
{
|
|
11
|
+
className: cn(
|
|
12
|
+
"animate-pulse rounded-md bg-muted",
|
|
13
|
+
className
|
|
14
|
+
),
|
|
15
|
+
children
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
Skeleton
|
|
22
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// src/error/recovery/fallback.ts
|
|
2
|
+
async function withFallback(fn, fallbackValue, options = {}) {
|
|
3
|
+
const { onError, logError = true } = options;
|
|
4
|
+
try {
|
|
5
|
+
return await fn();
|
|
6
|
+
} catch (error) {
|
|
7
|
+
if (logError) {
|
|
8
|
+
console.error("[withFallback] Error occurred, using fallback:", error);
|
|
9
|
+
}
|
|
10
|
+
onError == null ? void 0 : onError(error);
|
|
11
|
+
return fallbackValue;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
async function withFallbackFn(primaryFn, fallbackFn, options = {}) {
|
|
15
|
+
const { onError, logError = true } = options;
|
|
16
|
+
try {
|
|
17
|
+
return await primaryFn();
|
|
18
|
+
} catch (error) {
|
|
19
|
+
if (logError) {
|
|
20
|
+
console.error("[withFallbackFn] Primary failed, trying fallback:", error);
|
|
21
|
+
}
|
|
22
|
+
onError == null ? void 0 : onError(error);
|
|
23
|
+
try {
|
|
24
|
+
return await fallbackFn();
|
|
25
|
+
} catch (fallbackError) {
|
|
26
|
+
console.error("[withFallbackFn] Fallback also failed:", fallbackError);
|
|
27
|
+
throw fallbackError;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
async function withFallbackChain(fns, options = {}) {
|
|
32
|
+
const { onError, logError = true } = options;
|
|
33
|
+
const errors = [];
|
|
34
|
+
for (let i = 0; i < fns.length; i++) {
|
|
35
|
+
try {
|
|
36
|
+
return await fns[i]();
|
|
37
|
+
} catch (error) {
|
|
38
|
+
errors.push(error);
|
|
39
|
+
if (logError) {
|
|
40
|
+
console.error(`[withFallbackChain] Attempt ${i + 1} failed:`, error);
|
|
41
|
+
}
|
|
42
|
+
onError == null ? void 0 : onError(error);
|
|
43
|
+
if (i === fns.length - 1) {
|
|
44
|
+
throw new Error(
|
|
45
|
+
`All ${fns.length} attempts failed. Last error: ${error}`
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
throw new Error("No functions provided");
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export {
|
|
54
|
+
withFallback,
|
|
55
|
+
withFallbackFn,
|
|
56
|
+
withFallbackChain
|
|
57
|
+
};
|