@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,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hybrid Cache Manager
|
|
3
|
+
*
|
|
4
|
+
* Redis + 인메모리 하이브리드 캐시 매니저
|
|
5
|
+
* - Redis 우선 사용
|
|
6
|
+
* - Redis 실패 시 인메모리 폴백
|
|
7
|
+
* - 백엔드 모드에 따른 동적 전환
|
|
8
|
+
* - 전역 Redis 에러 상태와 연동
|
|
9
|
+
*/
|
|
10
|
+
import type { CacheBackendType, HybridCacheMetrics, HybridConnectionStatus, IUnifiedCacheManager, InMemoryCacheConfig } from './cache-types';
|
|
11
|
+
/**
|
|
12
|
+
* Redis 캐시 매니저 인터페이스 (RedisCacheManager와 호환)
|
|
13
|
+
*/
|
|
14
|
+
interface IRedisCacheManager {
|
|
15
|
+
get<T>(key: string): Promise<T | null>;
|
|
16
|
+
set<T>(key: string, value: T, ttl?: number): Promise<void>;
|
|
17
|
+
delete(key: string): Promise<void>;
|
|
18
|
+
deletePattern(pattern: string): Promise<void>;
|
|
19
|
+
exists(key: string): Promise<boolean>;
|
|
20
|
+
increment(key: string, value?: number): Promise<number>;
|
|
21
|
+
expire(key: string, ttl: number): Promise<void>;
|
|
22
|
+
getMetrics(): object;
|
|
23
|
+
getConnectionStatus(): object;
|
|
24
|
+
checkConnection(): Promise<boolean>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* 하이브리드 캐시 매니저 설정
|
|
28
|
+
*/
|
|
29
|
+
export interface HybridCacheManagerConfig {
|
|
30
|
+
/** 캐시 백엔드 타입 */
|
|
31
|
+
backend: CacheBackendType;
|
|
32
|
+
/** Redis 매니저 인스턴스 (null이면 Redis 비활성화) */
|
|
33
|
+
redisManager: IRedisCacheManager | null;
|
|
34
|
+
/** 인메모리 캐시 설정 */
|
|
35
|
+
inmemoryConfig?: Partial<InMemoryCacheConfig>;
|
|
36
|
+
/** Redis 에러 시 인메모리 폴백 여부 */
|
|
37
|
+
fallbackOnRedisError?: boolean;
|
|
38
|
+
/** hybrid 모드에서 인메모리에도 저장 여부 */
|
|
39
|
+
writeToMemory?: boolean;
|
|
40
|
+
/** Redis 에러 임계값 (이 값 이상이면 일시적으로 Redis 비활성화) */
|
|
41
|
+
redisErrorThreshold?: number;
|
|
42
|
+
/** Redis 재연결 시도 간격 (ms) */
|
|
43
|
+
redisReconnectInterval?: number;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* 하이브리드 캐시 매니저
|
|
47
|
+
*/
|
|
48
|
+
export declare class HybridCacheManager implements IUnifiedCacheManager {
|
|
49
|
+
private prefix;
|
|
50
|
+
private config;
|
|
51
|
+
private redisManager;
|
|
52
|
+
private memoryCache;
|
|
53
|
+
private redisErrorCount;
|
|
54
|
+
private lastRedisError;
|
|
55
|
+
private lastRedisErrorMessage;
|
|
56
|
+
private isRedisTemporarilyDisabled;
|
|
57
|
+
private redisReconnectTimer;
|
|
58
|
+
private redisFallbackCount;
|
|
59
|
+
constructor(prefix: string, config: HybridCacheManagerConfig);
|
|
60
|
+
/**
|
|
61
|
+
* 캐시에서 값 조회
|
|
62
|
+
*/
|
|
63
|
+
get<T>(key: string): Promise<T | null>;
|
|
64
|
+
/**
|
|
65
|
+
* 캐시에 값 저장
|
|
66
|
+
*/
|
|
67
|
+
set<T>(key: string, value: T, ttl?: number): Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* 캐시에서 항목 삭제
|
|
70
|
+
*/
|
|
71
|
+
delete(key: string): Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* 패턴 매칭으로 캐시 삭제
|
|
74
|
+
*/
|
|
75
|
+
deletePattern(pattern: string): Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* 키 존재 여부 확인
|
|
78
|
+
*/
|
|
79
|
+
exists(key: string): Promise<boolean>;
|
|
80
|
+
/**
|
|
81
|
+
* 값 증가
|
|
82
|
+
*/
|
|
83
|
+
increment(key: string, value?: number): Promise<number>;
|
|
84
|
+
/**
|
|
85
|
+
* TTL 설정
|
|
86
|
+
*/
|
|
87
|
+
expire(key: string, ttl: number): Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* 하이브리드 캐시 메트릭 조회
|
|
90
|
+
*/
|
|
91
|
+
getMetrics(): HybridCacheMetrics;
|
|
92
|
+
/**
|
|
93
|
+
* 연결 상태 조회
|
|
94
|
+
*/
|
|
95
|
+
getConnectionStatus(): HybridConnectionStatus;
|
|
96
|
+
/**
|
|
97
|
+
* 연결 체크
|
|
98
|
+
*/
|
|
99
|
+
checkConnection(): Promise<boolean>;
|
|
100
|
+
/**
|
|
101
|
+
* 설정 조회
|
|
102
|
+
*/
|
|
103
|
+
getConfig(): object;
|
|
104
|
+
/**
|
|
105
|
+
* 실제 사용할 백엔드 결정
|
|
106
|
+
* - 전역 Redis 비활성화 상태도 확인
|
|
107
|
+
*/
|
|
108
|
+
private getEffectiveBackend;
|
|
109
|
+
/**
|
|
110
|
+
* Redis 에러 처리
|
|
111
|
+
* - 전역 Redis 상태도 함께 업데이트
|
|
112
|
+
*/
|
|
113
|
+
private handleRedisError;
|
|
114
|
+
/**
|
|
115
|
+
* Redis 일시 비활성화
|
|
116
|
+
*/
|
|
117
|
+
private disableRedisTemporarily;
|
|
118
|
+
/**
|
|
119
|
+
* Redis 재연결 시도
|
|
120
|
+
*/
|
|
121
|
+
private tryReconnectRedis;
|
|
122
|
+
/**
|
|
123
|
+
* Redis 에러 상태 초기화 (로컬 상태만)
|
|
124
|
+
* - 전역 상태는 cache-redis.ts에서 관리 (Redis 성공 시 자동 리셋)
|
|
125
|
+
*/
|
|
126
|
+
private resetRedisErrorState;
|
|
127
|
+
/**
|
|
128
|
+
* 리소스 정리
|
|
129
|
+
*/
|
|
130
|
+
destroy(): void;
|
|
131
|
+
/**
|
|
132
|
+
* 전역 인스턴스 맵 가져오기 (HMR 안전)
|
|
133
|
+
*/
|
|
134
|
+
private static getGlobalInstances;
|
|
135
|
+
/**
|
|
136
|
+
* 싱글톤 인스턴스 가져오기
|
|
137
|
+
*/
|
|
138
|
+
static getInstance(prefix: string, config: HybridCacheManagerConfig): HybridCacheManager;
|
|
139
|
+
/**
|
|
140
|
+
* 모든 인스턴스 종료
|
|
141
|
+
*/
|
|
142
|
+
static destroyAll(): void;
|
|
143
|
+
/**
|
|
144
|
+
* 인스턴스 초기화 (테스트용)
|
|
145
|
+
*/
|
|
146
|
+
static clearInstances(): void;
|
|
147
|
+
}
|
|
148
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
HybridCacheManager
|
|
3
|
+
} from "../chunk-HV3DGSSH.js";
|
|
4
|
+
import "../chunk-Z4D4CMDA.js";
|
|
5
|
+
import "../chunk-SS56XFLI.js";
|
|
6
|
+
import "../chunk-6LTZCXNC.js";
|
|
7
|
+
import "../chunk-I47QEDTX.js";
|
|
8
|
+
import "../chunk-EZR55KV2.js";
|
|
9
|
+
import "../chunk-IQQKKUAV.js";
|
|
10
|
+
import "../chunk-ORMEWXMH.js";
|
|
11
|
+
export {
|
|
12
|
+
HybridCacheManager
|
|
13
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cache Module Entry Point
|
|
3
|
+
*
|
|
4
|
+
* 캐시 모듈의 통합 진입점
|
|
5
|
+
* - 모든 캐시 관련 기능을 re-export
|
|
6
|
+
*/
|
|
7
|
+
export { initializeCache, isCacheEnabled, getEnv, getENV, getConfig, getDefaultConfig, validateRedisEnvironment, } from './cache-env';
|
|
8
|
+
export { checkRedisConnection, isRedisAvailableNow, getRedisClient, logRedisInitialization, isRedisGloballyDisabled, notifyRedisError, resetRedisGlobalState, getRedisGlobalStatus, } from './cache-redis';
|
|
9
|
+
export type { CacheMetrics, RedisConnectionStatus } from './cache-redis';
|
|
10
|
+
export { getCacheConfig, getCacheTTL } from './cache-config';
|
|
11
|
+
export type { CacheOptions } from './cache-config';
|
|
12
|
+
export { INMEMORY_CACHE_DEFAULTS, CACHE_TTL_DEFAULTS, CACHE_DURATION_DEFAULTS, CACHE_ENV_VARS, ONE_MINUTE, FIVE_MINUTES, TEN_MINUTES, FIFTEEN_MINUTES, THIRTY_MINUTES, ONE_HOUR, ONE_DAY, THIRTY_DAYS, } from './cache-defaults';
|
|
13
|
+
export { RedisCacheManager } from './redis-cache-manager';
|
|
14
|
+
export { NoopCacheManager } from './noop-cache-manager';
|
|
15
|
+
export { getCacheManager, getEffectiveCacheBackend, cache, geoCache, } from './cache-factory';
|
|
16
|
+
export { cacheKeys } from './cache-keys-legacy';
|
|
17
|
+
export { invalidateCache } from './cache-invalidation';
|
|
18
|
+
export { withCache, cacheMetrics } from './cache-wrapper';
|
|
19
|
+
export { InMemoryCacheManager } from './inmemory-cache-manager';
|
|
20
|
+
export { HybridCacheManager } from './hybrid-cache-manager';
|
|
21
|
+
export type { InMemoryCacheConfig, CacheBackendType, HybridCacheMetrics, CacheEntry, InMemoryCacheMetrics, InMemoryCacheStats, HybridCacheConfig, HybridConnectionStatus, IUnifiedCacheManager, } from './cache-types';
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import "../chunk-EBUEBEJX.js";
|
|
2
|
+
import {
|
|
3
|
+
cacheMetrics,
|
|
4
|
+
withCache
|
|
5
|
+
} from "../chunk-YBSHN67U.js";
|
|
6
|
+
import {
|
|
7
|
+
invalidateCache
|
|
8
|
+
} from "../chunk-4KJXENRM.js";
|
|
9
|
+
import {
|
|
10
|
+
cache,
|
|
11
|
+
geoCache,
|
|
12
|
+
getCacheManager,
|
|
13
|
+
getEffectiveCacheBackend
|
|
14
|
+
} from "../chunk-AIHQBQ3E.js";
|
|
15
|
+
import {
|
|
16
|
+
HybridCacheManager
|
|
17
|
+
} from "../chunk-HV3DGSSH.js";
|
|
18
|
+
import {
|
|
19
|
+
InMemoryCacheManager
|
|
20
|
+
} from "../chunk-Z4D4CMDA.js";
|
|
21
|
+
import "../chunk-SS56XFLI.js";
|
|
22
|
+
import {
|
|
23
|
+
NoopCacheManager
|
|
24
|
+
} from "../chunk-Q7IP4JMW.js";
|
|
25
|
+
import {
|
|
26
|
+
RedisCacheManager
|
|
27
|
+
} from "../chunk-GL2NANFH.js";
|
|
28
|
+
import {
|
|
29
|
+
getCacheConfig,
|
|
30
|
+
getCacheTTL
|
|
31
|
+
} from "../chunk-TXGNSECL.js";
|
|
32
|
+
import {
|
|
33
|
+
cacheKeys
|
|
34
|
+
} from "../chunk-JBCDEAMW.js";
|
|
35
|
+
import {
|
|
36
|
+
checkRedisConnection,
|
|
37
|
+
getRedisClient,
|
|
38
|
+
getRedisGlobalStatus,
|
|
39
|
+
isRedisAvailableNow,
|
|
40
|
+
isRedisGloballyDisabled,
|
|
41
|
+
logRedisInitialization,
|
|
42
|
+
notifyRedisError,
|
|
43
|
+
resetRedisGlobalState
|
|
44
|
+
} from "../chunk-6LTZCXNC.js";
|
|
45
|
+
import {
|
|
46
|
+
getConfig,
|
|
47
|
+
getDefaultConfig,
|
|
48
|
+
getENV,
|
|
49
|
+
getEnv,
|
|
50
|
+
initializeCache,
|
|
51
|
+
isCacheEnabled,
|
|
52
|
+
validateRedisEnvironment
|
|
53
|
+
} from "../chunk-I47QEDTX.js";
|
|
54
|
+
import "../chunk-EZR55KV2.js";
|
|
55
|
+
import {
|
|
56
|
+
CACHE_DURATION_DEFAULTS,
|
|
57
|
+
CACHE_ENV_VARS,
|
|
58
|
+
CACHE_TTL_DEFAULTS,
|
|
59
|
+
FIFTEEN_MINUTES,
|
|
60
|
+
FIVE_MINUTES,
|
|
61
|
+
INMEMORY_CACHE_DEFAULTS,
|
|
62
|
+
ONE_DAY,
|
|
63
|
+
ONE_HOUR,
|
|
64
|
+
ONE_MINUTE,
|
|
65
|
+
TEN_MINUTES,
|
|
66
|
+
THIRTY_DAYS,
|
|
67
|
+
THIRTY_MINUTES
|
|
68
|
+
} from "../chunk-IQQKKUAV.js";
|
|
69
|
+
import "../chunk-ORMEWXMH.js";
|
|
70
|
+
export {
|
|
71
|
+
CACHE_DURATION_DEFAULTS,
|
|
72
|
+
CACHE_ENV_VARS,
|
|
73
|
+
CACHE_TTL_DEFAULTS,
|
|
74
|
+
FIFTEEN_MINUTES,
|
|
75
|
+
FIVE_MINUTES,
|
|
76
|
+
HybridCacheManager,
|
|
77
|
+
INMEMORY_CACHE_DEFAULTS,
|
|
78
|
+
InMemoryCacheManager,
|
|
79
|
+
NoopCacheManager,
|
|
80
|
+
ONE_DAY,
|
|
81
|
+
ONE_HOUR,
|
|
82
|
+
ONE_MINUTE,
|
|
83
|
+
RedisCacheManager,
|
|
84
|
+
TEN_MINUTES,
|
|
85
|
+
THIRTY_DAYS,
|
|
86
|
+
THIRTY_MINUTES,
|
|
87
|
+
cache,
|
|
88
|
+
cacheKeys,
|
|
89
|
+
cacheMetrics,
|
|
90
|
+
checkRedisConnection,
|
|
91
|
+
geoCache,
|
|
92
|
+
getCacheConfig,
|
|
93
|
+
getCacheManager,
|
|
94
|
+
getCacheTTL,
|
|
95
|
+
getConfig,
|
|
96
|
+
getDefaultConfig,
|
|
97
|
+
getENV,
|
|
98
|
+
getEffectiveCacheBackend,
|
|
99
|
+
getEnv,
|
|
100
|
+
getRedisClient,
|
|
101
|
+
getRedisGlobalStatus,
|
|
102
|
+
initializeCache,
|
|
103
|
+
invalidateCache,
|
|
104
|
+
isCacheEnabled,
|
|
105
|
+
isRedisAvailableNow,
|
|
106
|
+
isRedisGloballyDisabled,
|
|
107
|
+
logRedisInitialization,
|
|
108
|
+
notifyRedisError,
|
|
109
|
+
resetRedisGlobalState,
|
|
110
|
+
validateRedisEnvironment,
|
|
111
|
+
withCache
|
|
112
|
+
};
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In-Memory Cache Manager
|
|
3
|
+
*
|
|
4
|
+
* LRU + TTL 기반 인메모리 캐시 매니저
|
|
5
|
+
* - LRU (Least Recently Used): 가장 오래 접근되지 않은 항목 제거
|
|
6
|
+
* - TTL (Time To Live): 만료 시간 기반 항목 제거
|
|
7
|
+
* - 메모리 제한: 최대 항목 수 및 메모리 크기 제한
|
|
8
|
+
*/
|
|
9
|
+
import type { InMemoryCacheConfig, InMemoryCacheMetrics, InMemoryCacheStats, IUnifiedCacheManager } from './cache-types';
|
|
10
|
+
/**
|
|
11
|
+
* 인메모리 캐시 매니저 클래스
|
|
12
|
+
* RedisCacheManager와 동일한 인터페이스를 구현하여 호환성 보장
|
|
13
|
+
*/
|
|
14
|
+
export declare class InMemoryCacheManager implements IUnifiedCacheManager {
|
|
15
|
+
private cache;
|
|
16
|
+
private accessOrder;
|
|
17
|
+
private config;
|
|
18
|
+
private currentMemoryBytes;
|
|
19
|
+
private cleanupTimer;
|
|
20
|
+
private metrics;
|
|
21
|
+
private prefix;
|
|
22
|
+
constructor(prefix: string, config?: Partial<InMemoryCacheConfig>);
|
|
23
|
+
/**
|
|
24
|
+
* 캐시에서 값 조회
|
|
25
|
+
*/
|
|
26
|
+
get<T>(key: string): Promise<T | null>;
|
|
27
|
+
/**
|
|
28
|
+
* 캐시에 값 저장
|
|
29
|
+
*/
|
|
30
|
+
set<T>(key: string, value: T, ttl?: number): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* 캐시에서 항목 삭제
|
|
33
|
+
*/
|
|
34
|
+
delete(key: string): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* 패턴 매칭으로 캐시 삭제
|
|
37
|
+
* 간단한 glob 패턴 지원 (* 와일드카드)
|
|
38
|
+
*/
|
|
39
|
+
deletePattern(pattern: string): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* 키 존재 여부 확인
|
|
42
|
+
*/
|
|
43
|
+
exists(key: string): Promise<boolean>;
|
|
44
|
+
/**
|
|
45
|
+
* 값 증가 (카운터용)
|
|
46
|
+
*/
|
|
47
|
+
increment(key: string, value?: number): Promise<number>;
|
|
48
|
+
/**
|
|
49
|
+
* TTL 설정/갱신
|
|
50
|
+
*/
|
|
51
|
+
expire(key: string, ttl: number): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* 전체 캐시 초기화
|
|
54
|
+
*/
|
|
55
|
+
clear(): void;
|
|
56
|
+
/**
|
|
57
|
+
* 리소스 정리 (서버 종료 시 호출)
|
|
58
|
+
*/
|
|
59
|
+
destroy(): void;
|
|
60
|
+
/**
|
|
61
|
+
* 캐시 메트릭 조회
|
|
62
|
+
*/
|
|
63
|
+
getMetrics(): InMemoryCacheMetrics;
|
|
64
|
+
/**
|
|
65
|
+
* 캐시 통계 조회
|
|
66
|
+
*/
|
|
67
|
+
getStats(): InMemoryCacheStats;
|
|
68
|
+
/**
|
|
69
|
+
* 연결 상태 조회 (인메모리는 항상 연결됨)
|
|
70
|
+
*/
|
|
71
|
+
getConnectionStatus(): object;
|
|
72
|
+
/**
|
|
73
|
+
* 연결 체크 (인메모리는 항상 true)
|
|
74
|
+
*/
|
|
75
|
+
checkConnection(): Promise<boolean>;
|
|
76
|
+
/**
|
|
77
|
+
* 설정 조회
|
|
78
|
+
*/
|
|
79
|
+
getConfig(): InMemoryCacheConfig & {
|
|
80
|
+
prefix: string;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* 전체 키 생성 (prefix 포함)
|
|
84
|
+
*/
|
|
85
|
+
private getFullKey;
|
|
86
|
+
/**
|
|
87
|
+
* 항목 만료 여부 확인
|
|
88
|
+
*/
|
|
89
|
+
private isExpired;
|
|
90
|
+
/**
|
|
91
|
+
* 항목 삭제 (내부용)
|
|
92
|
+
*/
|
|
93
|
+
private deleteEntry;
|
|
94
|
+
/**
|
|
95
|
+
* 메모리 크기 추정
|
|
96
|
+
* JSON 직렬화 크기 * 2 (UTF-16) + 객체 오버헤드
|
|
97
|
+
*/
|
|
98
|
+
private estimateSize;
|
|
99
|
+
/**
|
|
100
|
+
* eviction 필요 여부 확인
|
|
101
|
+
*/
|
|
102
|
+
private needsEviction;
|
|
103
|
+
/**
|
|
104
|
+
* 교체 정책에 따른 항목 제거
|
|
105
|
+
*/
|
|
106
|
+
private evict;
|
|
107
|
+
/**
|
|
108
|
+
* LRU 교체: 가장 오래 접근되지 않은 항목 제거
|
|
109
|
+
*/
|
|
110
|
+
private evictLRU;
|
|
111
|
+
/**
|
|
112
|
+
* FIFO 교체: 가장 먼저 들어온 항목 제거
|
|
113
|
+
*/
|
|
114
|
+
private evictFIFO;
|
|
115
|
+
/**
|
|
116
|
+
* TTL 교체: 가장 빨리 만료될 항목 제거
|
|
117
|
+
*/
|
|
118
|
+
private evictTTL;
|
|
119
|
+
/**
|
|
120
|
+
* 접근 순서 업데이트 (LRU용)
|
|
121
|
+
*/
|
|
122
|
+
private updateAccessOrder;
|
|
123
|
+
/**
|
|
124
|
+
* 접근 순서에서 제거
|
|
125
|
+
*/
|
|
126
|
+
private removeFromAccessOrder;
|
|
127
|
+
/**
|
|
128
|
+
* 히트율 업데이트
|
|
129
|
+
*/
|
|
130
|
+
private updateHitRate;
|
|
131
|
+
/**
|
|
132
|
+
* glob 패턴을 정규식으로 변환
|
|
133
|
+
*/
|
|
134
|
+
private patternToRegex;
|
|
135
|
+
/**
|
|
136
|
+
* 만료 항목 정리 타이머 시작
|
|
137
|
+
*/
|
|
138
|
+
private startCleanupTimer;
|
|
139
|
+
/**
|
|
140
|
+
* 만료된 항목 일괄 정리
|
|
141
|
+
*/
|
|
142
|
+
private cleanupExpired;
|
|
143
|
+
/**
|
|
144
|
+
* 전역 인스턴스 맵 가져오기 (HMR 안전)
|
|
145
|
+
*/
|
|
146
|
+
private static getGlobalInstances;
|
|
147
|
+
/**
|
|
148
|
+
* 싱글톤 인스턴스 가져오기
|
|
149
|
+
*/
|
|
150
|
+
static getInstance(prefix: string, config?: Partial<InMemoryCacheConfig>): InMemoryCacheManager;
|
|
151
|
+
/**
|
|
152
|
+
* 모든 인스턴스 종료
|
|
153
|
+
*/
|
|
154
|
+
static destroyAll(): void;
|
|
155
|
+
/**
|
|
156
|
+
* 인스턴스 초기화 (테스트용)
|
|
157
|
+
*/
|
|
158
|
+
static clearInstances(): void;
|
|
159
|
+
/**
|
|
160
|
+
* 모든 인스턴스의 통계 조회
|
|
161
|
+
*/
|
|
162
|
+
static getAllStats(): Record<string, InMemoryCacheStats>;
|
|
163
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { IUnifiedCacheManager } from './cache-types';
|
|
2
|
+
export declare class NoopCacheManager implements IUnifiedCacheManager {
|
|
3
|
+
private prefix;
|
|
4
|
+
constructor(prefix: string);
|
|
5
|
+
get<T>(_key: string): Promise<T | null>;
|
|
6
|
+
set<T>(_key: string, _value: T, _ttl?: number): Promise<void>;
|
|
7
|
+
delete(_key: string): Promise<void>;
|
|
8
|
+
deletePattern(_pattern: string): Promise<void>;
|
|
9
|
+
exists(_key: string): Promise<boolean>;
|
|
10
|
+
increment(): Promise<number>;
|
|
11
|
+
expire(): Promise<void>;
|
|
12
|
+
getMetrics(): {
|
|
13
|
+
hits: number;
|
|
14
|
+
misses: number;
|
|
15
|
+
errors: number;
|
|
16
|
+
totalRequests: number;
|
|
17
|
+
hitRate: number;
|
|
18
|
+
averageResponseTime: number;
|
|
19
|
+
};
|
|
20
|
+
getConnectionStatus(): {
|
|
21
|
+
isConnected: boolean;
|
|
22
|
+
connectionErrors: number;
|
|
23
|
+
};
|
|
24
|
+
checkConnection(): Promise<boolean>;
|
|
25
|
+
getConfig(): {
|
|
26
|
+
prefix: string;
|
|
27
|
+
enabled: boolean;
|
|
28
|
+
reason: string;
|
|
29
|
+
envVars: {
|
|
30
|
+
[x: string]: string;
|
|
31
|
+
CACHE_ENABLED: string;
|
|
32
|
+
UPSTASH_REDIS_REST_URL: string;
|
|
33
|
+
UPSTASH_REDIS_REST_TOKEN: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
NoopCacheManager
|
|
3
|
+
} from "../chunk-Q7IP4JMW.js";
|
|
4
|
+
import "../chunk-TXGNSECL.js";
|
|
5
|
+
import "../chunk-I47QEDTX.js";
|
|
6
|
+
import "../chunk-EZR55KV2.js";
|
|
7
|
+
import "../chunk-IQQKKUAV.js";
|
|
8
|
+
import "../chunk-ORMEWXMH.js";
|
|
9
|
+
export {
|
|
10
|
+
NoopCacheManager
|
|
11
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { CacheMetrics, RedisConnectionStatus } from "./cache-redis";
|
|
2
|
+
import type { IUnifiedCacheManager } from "./cache-types";
|
|
3
|
+
export declare class RedisCacheManager implements IUnifiedCacheManager {
|
|
4
|
+
private prefix;
|
|
5
|
+
private metrics;
|
|
6
|
+
private connectionStatus;
|
|
7
|
+
private constructor();
|
|
8
|
+
private static getGlobalInstances;
|
|
9
|
+
static getInstance(prefix: string): RedisCacheManager;
|
|
10
|
+
static clearInstances(): void;
|
|
11
|
+
private updateMetrics;
|
|
12
|
+
getMetrics(): CacheMetrics;
|
|
13
|
+
getConnectionStatus(): RedisConnectionStatus;
|
|
14
|
+
checkConnection(): Promise<boolean>;
|
|
15
|
+
getConfig(): {
|
|
16
|
+
prefix: string;
|
|
17
|
+
enabled: boolean;
|
|
18
|
+
redisAvailable: boolean;
|
|
19
|
+
envVars: {
|
|
20
|
+
CACHE_ENABLED: string;
|
|
21
|
+
UPSTASH_REDIS_REST_URL: string;
|
|
22
|
+
UPSTASH_REDIS_REST_TOKEN: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
private getKey;
|
|
26
|
+
private serializeData;
|
|
27
|
+
get<T>(key: string): Promise<T | null>;
|
|
28
|
+
set<T>(key: string, value: T, ttl?: number): Promise<void>;
|
|
29
|
+
delete(key: string): Promise<void>;
|
|
30
|
+
deletePattern(pattern: string): Promise<void>;
|
|
31
|
+
exists(key: string): Promise<boolean>;
|
|
32
|
+
increment(key: string, value?: number): Promise<number>;
|
|
33
|
+
expire(key: string, ttl: number): Promise<void>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RedisCacheManager
|
|
3
|
+
} from "../chunk-GL2NANFH.js";
|
|
4
|
+
import "../chunk-6LTZCXNC.js";
|
|
5
|
+
import "../chunk-I47QEDTX.js";
|
|
6
|
+
import "../chunk-EZR55KV2.js";
|
|
7
|
+
import "../chunk-IQQKKUAV.js";
|
|
8
|
+
import "../chunk-ORMEWXMH.js";
|
|
9
|
+
export {
|
|
10
|
+
RedisCacheManager
|
|
11
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getPlatform
|
|
3
|
+
} from "./chunk-KWTBD4CM.js";
|
|
4
|
+
|
|
5
|
+
// src/system/environment.ts
|
|
6
|
+
import os from "os";
|
|
7
|
+
function checkEnvironmentVariables() {
|
|
8
|
+
const platform = getPlatform();
|
|
9
|
+
const requiredVars = [
|
|
10
|
+
"DATABASE_URL",
|
|
11
|
+
"NEXT_PUBLIC_BASE_URL",
|
|
12
|
+
"JWT_SECRET",
|
|
13
|
+
"UPSTASH_REDIS_REST_URL",
|
|
14
|
+
"UPSTASH_REDIS_REST_TOKEN"
|
|
15
|
+
];
|
|
16
|
+
const optionalVars = [
|
|
17
|
+
"IPGEOLOCATION_API_KEY",
|
|
18
|
+
"MAXMIND_LICENSE_KEY",
|
|
19
|
+
"CACHE_ENABLED"
|
|
20
|
+
];
|
|
21
|
+
const results = [];
|
|
22
|
+
for (const key of requiredVars) {
|
|
23
|
+
const value = process.env[key];
|
|
24
|
+
const ok = !!value;
|
|
25
|
+
results.push({
|
|
26
|
+
key,
|
|
27
|
+
ok,
|
|
28
|
+
value: ok ? value.length > 20 ? value.substring(0, 20) + "..." : value : void 0
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
for (const key of optionalVars) {
|
|
32
|
+
const value = process.env[key];
|
|
33
|
+
const ok = !!value;
|
|
34
|
+
results.push({
|
|
35
|
+
key,
|
|
36
|
+
ok,
|
|
37
|
+
value: ok ? value.length > 20 ? value.substring(0, 20) + "..." : value : void 0
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
results.push({
|
|
41
|
+
key: "PLATFORM",
|
|
42
|
+
ok: true,
|
|
43
|
+
value: platform === "darwin" ? "macOS" : "Linux"
|
|
44
|
+
});
|
|
45
|
+
results.push({
|
|
46
|
+
key: "NODE_ENV",
|
|
47
|
+
ok: true,
|
|
48
|
+
value: process.env.NODE_ENV || "development"
|
|
49
|
+
});
|
|
50
|
+
results.push({
|
|
51
|
+
key: "ARCHITECTURE",
|
|
52
|
+
ok: true,
|
|
53
|
+
value: process.arch
|
|
54
|
+
});
|
|
55
|
+
results.push({
|
|
56
|
+
key: "NODE_VERSION",
|
|
57
|
+
ok: true,
|
|
58
|
+
value: process.version
|
|
59
|
+
});
|
|
60
|
+
results.push({
|
|
61
|
+
key: "HOSTNAME",
|
|
62
|
+
ok: true,
|
|
63
|
+
value: os.hostname()
|
|
64
|
+
});
|
|
65
|
+
results.push({
|
|
66
|
+
key: "USER_HOME",
|
|
67
|
+
ok: true,
|
|
68
|
+
value: os.homedir()
|
|
69
|
+
});
|
|
70
|
+
results.push({
|
|
71
|
+
key: "TEMP_DIR",
|
|
72
|
+
ok: true,
|
|
73
|
+
value: os.tmpdir()
|
|
74
|
+
});
|
|
75
|
+
if (platform === "darwin") {
|
|
76
|
+
results.push({
|
|
77
|
+
key: "MACOS_VERSION",
|
|
78
|
+
ok: true,
|
|
79
|
+
value: os.release()
|
|
80
|
+
});
|
|
81
|
+
} else {
|
|
82
|
+
results.push({
|
|
83
|
+
key: "LINUX_DISTRO",
|
|
84
|
+
ok: true,
|
|
85
|
+
value: os.release()
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return results;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export {
|
|
92
|
+
checkEnvironmentVariables
|
|
93
|
+
};
|