@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.
Files changed (380) hide show
  1. package/README.md +162 -0
  2. package/dist/auth/adapters/prisma/index.d.ts +43 -0
  3. package/dist/auth/adapters/prisma/index.js +284 -0
  4. package/dist/auth/core/email/token-generator.d.ts +43 -0
  5. package/dist/auth/core/email/token-generator.js +7 -0
  6. package/dist/auth/core/jwt/client.d.ts +87 -0
  7. package/dist/auth/core/jwt/client.js +36 -0
  8. package/dist/auth/core/jwt/index.d.ts +110 -0
  9. package/dist/auth/core/jwt/index.js +10 -0
  10. package/dist/auth/core/jwt/types.d.ts +6 -0
  11. package/dist/auth/core/jwt/types.js +13 -0
  12. package/dist/auth/core/oauth/index.d.ts +51 -0
  13. package/dist/auth/core/oauth/index.js +12 -0
  14. package/dist/auth/core/password/client-helper.d.ts +44 -0
  15. package/dist/auth/core/password/client-helper.js +28 -0
  16. package/dist/auth/core/password/index.d.ts +71 -0
  17. package/dist/auth/core/password/index.js +14 -0
  18. package/dist/auth/errors/index.d.ts +49 -0
  19. package/dist/auth/errors/index.js +17 -0
  20. package/dist/auth/index.d.ts +21 -0
  21. package/dist/auth/index.js +97 -0
  22. package/dist/auth/types/index.d.ts +213 -0
  23. package/dist/auth/types/index.js +13 -0
  24. package/dist/cache/cache-config.d.ts +73 -0
  25. package/dist/cache/cache-config.js +12 -0
  26. package/dist/cache/cache-defaults.d.ts +141 -0
  27. package/dist/cache/cache-defaults.js +33 -0
  28. package/dist/cache/cache-env.d.ts +75 -0
  29. package/dist/cache/cache-env.js +25 -0
  30. package/dist/cache/cache-factory.d.ts +34 -0
  31. package/dist/cache/cache-factory.js +28 -0
  32. package/dist/cache/cache-invalidation.d.ts +90 -0
  33. package/dist/cache/cache-invalidation.js +24 -0
  34. package/dist/cache/cache-keys-legacy.d.ts +35 -0
  35. package/dist/cache/cache-keys-legacy.js +7 -0
  36. package/dist/cache/cache-redis.d.ts +74 -0
  37. package/dist/cache/cache-redis.js +24 -0
  38. package/dist/cache/cache-types.d.ts +151 -0
  39. package/dist/cache/cache-types.js +9 -0
  40. package/dist/cache/cache-wrapper.d.ts +27 -0
  41. package/dist/cache/cache-wrapper.js +22 -0
  42. package/dist/cache/cache.d.ts +14 -0
  43. package/dist/cache/cache.js +112 -0
  44. package/dist/cache/hybrid-cache-manager.d.ts +148 -0
  45. package/dist/cache/hybrid-cache-manager.js +13 -0
  46. package/dist/cache/index.d.ts +21 -0
  47. package/dist/cache/index.js +112 -0
  48. package/dist/cache/inmemory-cache-manager.d.ts +163 -0
  49. package/dist/cache/inmemory-cache-manager.js +9 -0
  50. package/dist/cache/noop-cache-manager.d.ts +36 -0
  51. package/dist/cache/noop-cache-manager.js +11 -0
  52. package/dist/cache/redis-cache-manager.d.ts +34 -0
  53. package/dist/cache/redis-cache-manager.js +11 -0
  54. package/dist/chunk-26Y7VEYG.js +93 -0
  55. package/dist/chunk-2DVWSDST.js +119 -0
  56. package/dist/chunk-2KAPUVIS.js +155 -0
  57. package/dist/chunk-2TO7WUKK.js +93 -0
  58. package/dist/chunk-34WAGUT5.js +117 -0
  59. package/dist/chunk-3DZA6AGS.js +120 -0
  60. package/dist/chunk-4DPSCTX4.js +212 -0
  61. package/dist/chunk-4KJXENRM.js +64 -0
  62. package/dist/chunk-4NWJ3WCZ.js +28 -0
  63. package/dist/chunk-4ODT3Q4A.js +86 -0
  64. package/dist/chunk-5ATB5D6S.js +40 -0
  65. package/dist/chunk-62FLBG6B.js +34 -0
  66. package/dist/chunk-62Q7DN5G.js +25 -0
  67. package/dist/chunk-65LHDFU3.js +242 -0
  68. package/dist/chunk-6C7HQIX4.js +13 -0
  69. package/dist/chunk-6D3HHYER.js +32 -0
  70. package/dist/chunk-6LTZCXNC.js +326 -0
  71. package/dist/chunk-7VJNLGAS.js +110 -0
  72. package/dist/chunk-7XFHGAJP.js +0 -0
  73. package/dist/chunk-A6EAAWMK.js +50 -0
  74. package/dist/chunk-AHDPGRXS.js +51 -0
  75. package/dist/chunk-AIH3F7JV.js +76 -0
  76. package/dist/chunk-AIHQBQ3E.js +109 -0
  77. package/dist/chunk-BKGVSC6S.js +152 -0
  78. package/dist/chunk-COK4ZXNG.js +0 -0
  79. package/dist/chunk-DEEJBDJE.js +47 -0
  80. package/dist/chunk-DH2ZHGW2.js +53 -0
  81. package/dist/chunk-EBUEBEJX.js +0 -0
  82. package/dist/chunk-EEUBKZV4.js +54 -0
  83. package/dist/chunk-EQYTE7WD.js +139 -0
  84. package/dist/chunk-EUQATJLI.js +180 -0
  85. package/dist/chunk-EZC6ETFW.js +80 -0
  86. package/dist/chunk-EZR55KV2.js +249 -0
  87. package/dist/chunk-F6LCSFSU.js +31 -0
  88. package/dist/chunk-FOKAATUQ.js +62 -0
  89. package/dist/chunk-FW3IEJ7H.js +71 -0
  90. package/dist/chunk-G26T2PRQ.js +53 -0
  91. package/dist/chunk-G4NI37NN.js +257 -0
  92. package/dist/chunk-GCZOXUDV.js +132 -0
  93. package/dist/chunk-GDWEDUHO.js +55 -0
  94. package/dist/chunk-GL2NANFH.js +434 -0
  95. package/dist/chunk-GPBOMJSZ.js +136 -0
  96. package/dist/chunk-H5I5GWAA.js +94 -0
  97. package/dist/chunk-HGC4CCKB.js +29 -0
  98. package/dist/chunk-HV3DGSSH.js +447 -0
  99. package/dist/chunk-I47QEDTX.js +193 -0
  100. package/dist/chunk-IAJNC34M.js +102 -0
  101. package/dist/chunk-IHXRF3BH.js +215 -0
  102. package/dist/chunk-IJEZ7G7S.js +26 -0
  103. package/dist/chunk-IQQKKUAV.js +151 -0
  104. package/dist/chunk-JBCDEAMW.js +35 -0
  105. package/dist/chunk-JLLMTTQ4.js +75 -0
  106. package/dist/chunk-JS5VI3OW.js +143 -0
  107. package/dist/chunk-KAWVMIRJ.js +44 -0
  108. package/dist/chunk-KMCJIL57.js +214 -0
  109. package/dist/chunk-KWTBD4CM.js +145 -0
  110. package/dist/chunk-KXAWBFJN.js +310 -0
  111. package/dist/chunk-L25BNU3E.js +56 -0
  112. package/dist/chunk-L76O3X3D.js +197 -0
  113. package/dist/chunk-LNV2E4I6.js +63 -0
  114. package/dist/chunk-MLGO3HLS.js +329 -0
  115. package/dist/chunk-MRJE6OX5.js +22 -0
  116. package/dist/chunk-MYLGYX4K.js +57 -0
  117. package/dist/chunk-N4YGR5WH.js +310 -0
  118. package/dist/chunk-OIVXOT2X.js +80 -0
  119. package/dist/chunk-ORMEWXMH.js +37 -0
  120. package/dist/chunk-POKGHK3L.js +57 -0
  121. package/dist/chunk-Q7IP4JMW.js +69 -0
  122. package/dist/chunk-RJUVBBZG.js +27 -0
  123. package/dist/chunk-S73334QY.js +89 -0
  124. package/dist/chunk-SLG26KHZ.js +101 -0
  125. package/dist/chunk-SR65BF6X.js +82 -0
  126. package/dist/chunk-SS56XFLI.js +19 -0
  127. package/dist/chunk-T3LJYAMO.js +277 -0
  128. package/dist/chunk-TDZJ6SAI.js +34 -0
  129. package/dist/chunk-TEIYA7U4.js +72 -0
  130. package/dist/chunk-TMVS4F7E.js +88 -0
  131. package/dist/chunk-TRBKJ7JT.js +137 -0
  132. package/dist/chunk-TXGNSECL.js +84 -0
  133. package/dist/chunk-TZAP5T4N.js +188 -0
  134. package/dist/chunk-UCYQNHST.js +24 -0
  135. package/dist/chunk-ULF5RDDX.js +0 -0
  136. package/dist/chunk-UXQRU3EM.js +167 -0
  137. package/dist/chunk-V5K5FYU7.js +200 -0
  138. package/dist/chunk-VDXB5DCY.js +68 -0
  139. package/dist/chunk-VSGKVZB4.js +47 -0
  140. package/dist/chunk-VWODEQ5C.js +204 -0
  141. package/dist/chunk-WDUFQFDP.js +193 -0
  142. package/dist/chunk-WHR7HPWF.js +126 -0
  143. package/dist/chunk-WSQMXMTL.js +122 -0
  144. package/dist/chunk-XHZ5L4FO.js +103 -0
  145. package/dist/chunk-XPASCCUA.js +404 -0
  146. package/dist/chunk-XRRPEBKB.js +231 -0
  147. package/dist/chunk-Y2TUZFCP.js +0 -0
  148. package/dist/chunk-Y3OTJH2S.js +473 -0
  149. package/dist/chunk-YBSHN67U.js +161 -0
  150. package/dist/chunk-YJ3TLEW3.js +100 -0
  151. package/dist/chunk-YJWLWUFK.js +105 -0
  152. package/dist/chunk-Z4D4CMDA.js +488 -0
  153. package/dist/chunk-ZHVUK5OY.js +314 -0
  154. package/dist/chunk-ZTN4X5FN.js +29 -0
  155. package/dist/chunk-ZZIKRBJU.js +96 -0
  156. package/dist/components/ui/Alert.d.ts +12 -0
  157. package/dist/components/ui/Alert.js +10 -0
  158. package/dist/components/ui/Badge.d.ts +7 -0
  159. package/dist/components/ui/Badge.js +8 -0
  160. package/dist/components/ui/Button.d.ts +7 -0
  161. package/dist/components/ui/Button.js +8 -0
  162. package/dist/components/ui/DataTable.d.ts +103 -0
  163. package/dist/components/ui/DataTable.js +606 -0
  164. package/dist/components/ui/DomainDisplay.d.ts +12 -0
  165. package/dist/components/ui/DomainDisplay.js +31 -0
  166. package/dist/components/ui/Input.d.ts +5 -0
  167. package/dist/components/ui/Input.js +8 -0
  168. package/dist/components/ui/Label.d.ts +5 -0
  169. package/dist/components/ui/Label.js +8 -0
  170. package/dist/components/ui/Pagination.d.ts +42 -0
  171. package/dist/components/ui/Pagination.js +20 -0
  172. package/dist/components/ui/Select.d.ts +15 -0
  173. package/dist/components/ui/Select.js +27 -0
  174. package/dist/components/ui/Skeleton.d.ts +6 -0
  175. package/dist/components/ui/Skeleton.js +8 -0
  176. package/dist/components/ui/TimezoneDisplay.d.ts +22 -0
  177. package/dist/components/ui/TimezoneDisplay.js +83 -0
  178. package/dist/components/ui/Tooltip.d.ts +21 -0
  179. package/dist/components/ui/Tooltip.js +94 -0
  180. package/dist/components/ui/WorldMapChart.d.ts +17 -0
  181. package/dist/components/ui/WorldMapChart.js +250 -0
  182. package/dist/components/ui/loading-bar.d.ts +20 -0
  183. package/dist/components/ui/loading-bar.js +15 -0
  184. package/dist/constants/error-codes.d.ts +389 -0
  185. package/dist/constants/error-codes.js +27 -0
  186. package/dist/constants/index.d.ts +11 -0
  187. package/dist/constants/index.js +85 -0
  188. package/dist/constants/messages.d.ts +83 -0
  189. package/dist/constants/messages.js +13 -0
  190. package/dist/constants/pagination.d.ts +43 -0
  191. package/dist/constants/pagination.js +15 -0
  192. package/dist/constants/security.d.ts +66 -0
  193. package/dist/constants/security.js +23 -0
  194. package/dist/constants/validation.d.ts +60 -0
  195. package/dist/constants/validation.js +19 -0
  196. package/dist/error/ErrorBoundary.d.ts +47 -0
  197. package/dist/error/app-error.d.ts +144 -0
  198. package/dist/error/app-error.js +10 -0
  199. package/dist/error/components/EmptyState.d.ts +50 -0
  200. package/dist/error/components/ErrorAlert.d.ts +50 -0
  201. package/dist/error/components/ErrorPage.d.ts +39 -0
  202. package/dist/error/components/LoadingState.d.ts +37 -0
  203. package/dist/error/components/index.d.ts +13 -0
  204. package/dist/error/components/index.js +18 -0
  205. package/dist/error/core/locale-detector.d.ts +44 -0
  206. package/dist/error/core/locale-detector.js +9 -0
  207. package/dist/error/error-display.d.ts +55 -0
  208. package/dist/error/error-display.js +24 -0
  209. package/dist/error/error-handler.d.ts +118 -0
  210. package/dist/error/error-handler.js +18 -0
  211. package/dist/error/friendly-messages-v2.d.ts +46 -0
  212. package/dist/error/friendly-messages-v2.js +15 -0
  213. package/dist/error/friendly-messages.d.ts +22 -0
  214. package/dist/error/friendly-messages.js +12 -0
  215. package/dist/error/hooks/index.d.ts +7 -0
  216. package/dist/error/hooks/index.js +14 -0
  217. package/dist/error/hooks/useErrorHandler.d.ts +67 -0
  218. package/dist/error/hooks/useErrorHandler.js +14 -0
  219. package/dist/error/index.d.ts +26 -0
  220. package/dist/error/index.js +289 -0
  221. package/dist/error/logging/error-logger.d.ts +77 -0
  222. package/dist/error/logging/error-logger.js +10 -0
  223. package/dist/error/logging/index.d.ts +9 -0
  224. package/dist/error/logging/index.js +35 -0
  225. package/dist/error/logging/transports/base.d.ts +30 -0
  226. package/dist/error/logging/transports/base.js +7 -0
  227. package/dist/error/logging/transports/console.d.ts +40 -0
  228. package/dist/error/logging/transports/console.js +9 -0
  229. package/dist/error/logging/transports/file.d.ts +49 -0
  230. package/dist/error/logging/transports/file.js +8 -0
  231. package/dist/error/logging/transports/index.d.ts +12 -0
  232. package/dist/error/logging/transports/index.js +25 -0
  233. package/dist/error/logging/transports/sentry.d.ts +44 -0
  234. package/dist/error/logging/transports/sentry.js +9 -0
  235. package/dist/error/logging/transports/slack.d.ts +51 -0
  236. package/dist/error/logging/transports/slack.js +9 -0
  237. package/dist/error/logging/types.d.ts +83 -0
  238. package/dist/error/logging/types.js +7 -0
  239. package/dist/error/messages/en.d.ts +5 -0
  240. package/dist/error/messages/en.js +7 -0
  241. package/dist/error/messages/index.d.ts +40 -0
  242. package/dist/error/messages/index.js +17 -0
  243. package/dist/error/messages/ko.d.ts +5 -0
  244. package/dist/error/messages/ko.js +7 -0
  245. package/dist/error/messages/types.d.ts +30 -0
  246. package/dist/error/messages/types.js +0 -0
  247. package/dist/error/recovery/circuit-breaker.d.ts +85 -0
  248. package/dist/error/recovery/circuit-breaker.js +9 -0
  249. package/dist/error/recovery/degradation.d.ts +56 -0
  250. package/dist/error/recovery/degradation.js +7 -0
  251. package/dist/error/recovery/fallback.d.ts +55 -0
  252. package/dist/error/recovery/fallback.js +11 -0
  253. package/dist/error/recovery/index.d.ts +12 -0
  254. package/dist/error/recovery/index.js +26 -0
  255. package/dist/error/recovery/retry.d.ts +44 -0
  256. package/dist/error/recovery/retry.js +7 -0
  257. package/dist/geolocation/batch-processor.d.ts +33 -0
  258. package/dist/geolocation/batch-processor.js +10 -0
  259. package/dist/geolocation/index.d.ts +14 -0
  260. package/dist/geolocation/index.js +36 -0
  261. package/dist/geolocation/providers/base-provider.d.ts +33 -0
  262. package/dist/geolocation/providers/base-provider.js +9 -0
  263. package/dist/geolocation/providers/index.d.ts +54 -0
  264. package/dist/geolocation/providers/index.js +29 -0
  265. package/dist/geolocation/providers/ip-api-provider.d.ts +17 -0
  266. package/dist/geolocation/providers/ip-api-provider.js +8 -0
  267. package/dist/geolocation/providers/ipapi-co-provider.d.ts +17 -0
  268. package/dist/geolocation/providers/ipapi-co-provider.js +8 -0
  269. package/dist/geolocation/providers/ipgeolocation-provider.d.ts +18 -0
  270. package/dist/geolocation/providers/ipgeolocation-provider.js +8 -0
  271. package/dist/geolocation/providers/maxmind-provider.d.ts +18 -0
  272. package/dist/geolocation/providers/maxmind-provider.js +8 -0
  273. package/dist/hooks/useDataTable.d.ts +51 -0
  274. package/dist/hooks/useDataTable.js +149 -0
  275. package/dist/hooks/useDebounce.d.ts +7 -0
  276. package/dist/hooks/useDebounce.js +7 -0
  277. package/dist/hooks/useExitIntent.d.ts +35 -0
  278. package/dist/hooks/useExitIntent.js +72 -0
  279. package/dist/hooks/useTimezone.d.ts +19 -0
  280. package/dist/hooks/useTimezone.js +11 -0
  281. package/dist/logger/logger.d.ts +11 -0
  282. package/dist/logger/logger.js +17 -0
  283. package/dist/middleware/auth.d.ts +87 -0
  284. package/dist/middleware/auth.js +20 -0
  285. package/dist/middleware/cors.d.ts +30 -0
  286. package/dist/middleware/cors.js +10 -0
  287. package/dist/middleware/error-handler.d.ts +23 -0
  288. package/dist/middleware/error-handler.js +13 -0
  289. package/dist/middleware/index.d.ts +16 -0
  290. package/dist/middleware/index.js +72 -0
  291. package/dist/middleware/init-request.d.ts +18 -0
  292. package/dist/middleware/init-request.js +8 -0
  293. package/dist/middleware/middleware-chain.d.ts +53 -0
  294. package/dist/middleware/middleware-chain.js +8 -0
  295. package/dist/middleware/rate-limit.d.ts +82 -0
  296. package/dist/middleware/rate-limit.js +14 -0
  297. package/dist/middleware/response-logger.d.ts +22 -0
  298. package/dist/middleware/response-logger.js +8 -0
  299. package/dist/middleware/security.d.ts +31 -0
  300. package/dist/middleware/security.js +9 -0
  301. package/dist/middleware/types.d.ts +45 -0
  302. package/dist/middleware/types.js +0 -0
  303. package/dist/middleware/wrappers.d.ts +91 -0
  304. package/dist/middleware/wrappers.js +32 -0
  305. package/dist/storage/r2-storage.d.ts +38 -0
  306. package/dist/storage/r2-storage.js +105 -0
  307. package/dist/system/cpu.d.ts +2 -0
  308. package/dist/system/cpu.js +9 -0
  309. package/dist/system/disk.d.ts +2 -0
  310. package/dist/system/disk.js +9 -0
  311. package/dist/system/environment.d.ts +8 -0
  312. package/dist/system/environment.js +9 -0
  313. package/dist/system/health-check.d.ts +26 -0
  314. package/dist/system/health-check.js +10 -0
  315. package/dist/system/index.d.ts +51 -0
  316. package/dist/system/index.js +194 -0
  317. package/dist/system/memory.d.ts +2 -0
  318. package/dist/system/memory.js +9 -0
  319. package/dist/system/network.d.ts +2 -0
  320. package/dist/system/network.js +9 -0
  321. package/dist/system/types.d.ts +93 -0
  322. package/dist/system/types.js +0 -0
  323. package/dist/system/utils.d.ts +12 -0
  324. package/dist/system/utils.js +26 -0
  325. package/dist/types/api.d.ts +80 -0
  326. package/dist/types/api.js +0 -0
  327. package/dist/types/database.d.ts +38 -0
  328. package/dist/types/database.js +0 -0
  329. package/dist/types/env.d.ts +105 -0
  330. package/dist/types/env.js +0 -0
  331. package/dist/types/geoip.d.ts +152 -0
  332. package/dist/types/geoip.js +0 -0
  333. package/dist/types/i18n.d.ts +11 -0
  334. package/dist/types/i18n.js +0 -0
  335. package/dist/types/qr-code.d.ts +139 -0
  336. package/dist/types/qr-code.js +75 -0
  337. package/dist/types/user.d.ts +54 -0
  338. package/dist/types/user.js +0 -0
  339. package/dist/utils/api-helpers.d.ts +147 -0
  340. package/dist/utils/api-helpers.js +30 -0
  341. package/dist/utils/client/client-utils.d.ts +3 -0
  342. package/dist/utils/client/client-utils.js +9 -0
  343. package/dist/utils/client/qr-code.d.ts +16 -0
  344. package/dist/utils/client/qr-code.js +215 -0
  345. package/dist/utils/cors.d.ts +40 -0
  346. package/dist/utils/cors.js +21 -0
  347. package/dist/utils/csv-export.d.ts +97 -0
  348. package/dist/utils/csv-export.js +20 -0
  349. package/dist/utils/error-message-formatter.d.ts +17 -0
  350. package/dist/utils/error-message-formatter.js +11 -0
  351. package/dist/utils/error-processor.d.ts +70 -0
  352. package/dist/utils/error-processor.js +34 -0
  353. package/dist/utils/format-number.d.ts +17 -0
  354. package/dist/utils/format-number.js +9 -0
  355. package/dist/utils/index.d.ts +13 -0
  356. package/dist/utils/index.js +160 -0
  357. package/dist/utils/input-validation.d.ts +88 -0
  358. package/dist/utils/input-validation.js +223 -0
  359. package/dist/utils/ip-utils.d.ts +15 -0
  360. package/dist/utils/ip-utils.js +91 -0
  361. package/dist/utils/optimistic-lock.d.ts +27 -0
  362. package/dist/utils/optimistic-lock.js +16 -0
  363. package/dist/utils/sanitizer.d.ts +72 -0
  364. package/dist/utils/sanitizer.js +19 -0
  365. package/dist/utils/shared-utils.d.ts +25 -0
  366. package/dist/utils/shared-utils.js +43 -0
  367. package/dist/utils/short-code-generator.d.ts +24 -0
  368. package/dist/utils/short-code-generator.js +9 -0
  369. package/dist/utils/timezone.d.ts +56 -0
  370. package/dist/utils/timezone.js +29 -0
  371. package/dist/utils/type-guards.d.ts +164 -0
  372. package/dist/utils/type-guards.js +59 -0
  373. package/dist/utils/url-normalizer.d.ts +53 -0
  374. package/dist/utils/url-normalizer.js +21 -0
  375. package/dist/validators/index.d.ts +7 -0
  376. package/dist/validators/index.js +13 -0
  377. package/dist/validators/password-validator.d.ts +86 -0
  378. package/dist/validators/password-validator.js +13 -0
  379. package/dist/world_countries-C2WUL2CQ.js +279 -0
  380. package/package.json +129 -0
@@ -0,0 +1,90 @@
1
+ import type { RedisCacheManager, HybridCacheManager, InMemoryCacheManager, NoopCacheManager } from "./index";
2
+ type CacheManager = RedisCacheManager | HybridCacheManager | InMemoryCacheManager | NoopCacheManager;
3
+ /**
4
+ * 범용 캐시 무효화 헬퍼 함수들
5
+ *
6
+ * @example
7
+ * ```typescript
8
+ * import { invalidateCache } from '@withwiz/cache';
9
+ *
10
+ * // 기본 캐시에서 단일 키 삭제
11
+ * await invalidateCache.byKey('my-key');
12
+ *
13
+ * // 기본 캐시에서 패턴으로 삭제
14
+ * await invalidateCache.byPattern('user:*');
15
+ *
16
+ * // 모든 캐시 삭제
17
+ * await invalidateCache.all();
18
+ * ```
19
+ */
20
+ export declare const invalidateCache: {
21
+ /**
22
+ * 기본 캐시에서 단일 키 삭제
23
+ * @param key - 삭제할 캐시 키
24
+ */
25
+ byKey: (key: string) => Promise<void>;
26
+ /**
27
+ * 기본 캐시에서 패턴으로 삭제
28
+ * @param pattern - 삭제할 캐시 키 패턴 (예: "user:*")
29
+ */
30
+ byPattern: (pattern: string) => Promise<void>;
31
+ /**
32
+ * GeoIP 캐시에서 단일 키 삭제
33
+ * @param key - 삭제할 캐시 키
34
+ */
35
+ geoByKey: (key: string) => Promise<void>;
36
+ /**
37
+ * GeoIP 캐시에서 패턴으로 삭제
38
+ * @param pattern - 삭제할 캐시 키 패턴
39
+ */
40
+ geoByPattern: (pattern: string) => Promise<void>;
41
+ /**
42
+ * 기본 캐시 전체 삭제
43
+ */
44
+ all: () => Promise<void>;
45
+ /**
46
+ * GeoIP 캐시 전체 삭제
47
+ */
48
+ allGeo: () => Promise<void>;
49
+ };
50
+ /**
51
+ * 주어진 캐시 매니저에서 키 삭제
52
+ *
53
+ * @example
54
+ * ```typescript
55
+ * import { getCacheManager } from '@withwiz/cache';
56
+ * import { deleteFromCache } from '@withwiz/cache/cache-invalidation';
57
+ *
58
+ * const myCache = getCacheManager('my-prefix');
59
+ * await deleteFromCache(myCache, 'my-key');
60
+ * ```
61
+ */
62
+ export declare function deleteFromCache(cacheManager: CacheManager, key: string): Promise<void>;
63
+ /**
64
+ * 주어진 캐시 매니저에서 패턴으로 삭제
65
+ *
66
+ * @example
67
+ * ```typescript
68
+ * import { getCacheManager } from '@withwiz/cache';
69
+ * import { deletePatternFromCache } from '@withwiz/cache/cache-invalidation';
70
+ *
71
+ * const myCache = getCacheManager('my-prefix');
72
+ * await deletePatternFromCache(myCache, 'user:*');
73
+ * ```
74
+ */
75
+ export declare function deletePatternFromCache(cacheManager: CacheManager, pattern: string): Promise<void>;
76
+ /**
77
+ * 여러 캐시 매니저에서 동시에 패턴 삭제
78
+ *
79
+ * @example
80
+ * ```typescript
81
+ * import { getCacheManager } from '@withwiz/cache';
82
+ * import { deletePatternFromMultipleCaches } from '@withwiz/cache/cache-invalidation';
83
+ *
84
+ * const cache1 = getCacheManager('prefix1');
85
+ * const cache2 = getCacheManager('prefix2');
86
+ * await deletePatternFromMultipleCaches([cache1, cache2], 'user:*');
87
+ * ```
88
+ */
89
+ export declare function deletePatternFromMultipleCaches(cacheManagers: CacheManager[], pattern: string): Promise<void>;
90
+ export {};
@@ -0,0 +1,24 @@
1
+ import {
2
+ deleteFromCache,
3
+ deletePatternFromCache,
4
+ deletePatternFromMultipleCaches,
5
+ invalidateCache
6
+ } from "../chunk-4KJXENRM.js";
7
+ import "../chunk-AIHQBQ3E.js";
8
+ import "../chunk-HV3DGSSH.js";
9
+ import "../chunk-Z4D4CMDA.js";
10
+ import "../chunk-SS56XFLI.js";
11
+ import "../chunk-Q7IP4JMW.js";
12
+ import "../chunk-GL2NANFH.js";
13
+ import "../chunk-TXGNSECL.js";
14
+ import "../chunk-6LTZCXNC.js";
15
+ import "../chunk-I47QEDTX.js";
16
+ import "../chunk-EZR55KV2.js";
17
+ import "../chunk-IQQKKUAV.js";
18
+ import "../chunk-ORMEWXMH.js";
19
+ export {
20
+ deleteFromCache,
21
+ deletePatternFromCache,
22
+ deletePatternFromMultipleCaches,
23
+ invalidateCache
24
+ };
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Legacy Cache Keys
3
+ *
4
+ * @deprecated CacheKeys (<your-project>/config/cache-keys.ts)를 사용하세요.
5
+ *
6
+ * 캐시 키 생성 헬퍼 함수들 (레거시 호환성 유지)
7
+ */
8
+ /**
9
+ * @deprecated CacheKeys (<your-project>/config/cache-keys.ts)를 사용하세요.
10
+ * 이 객체는 레거시 호환성을 위해 유지됩니다.
11
+ */
12
+ export declare const cacheKeys: {
13
+ geographyStats: (linkId: string) => string;
14
+ timelineStats: (linkId: string) => string;
15
+ deviceStats: (linkId: string) => string;
16
+ browserStats: (linkId: string) => string;
17
+ osStats: (linkId: string) => string;
18
+ adminCountryStats: () => string;
19
+ adminCityStats: () => string;
20
+ adminDailyStats: () => string;
21
+ adminDeviceStats: () => string;
22
+ adminBrowserStats: () => string;
23
+ userLinks: (userId: string) => string;
24
+ userStats: (userId: string) => string;
25
+ linkInfo: (linkId: string) => string;
26
+ linkClicks: (linkId: string) => string;
27
+ geoLocation: (ipAddress: string) => string;
28
+ community: {
29
+ popularTags: (period: string, limit: number) => string;
30
+ tagLinks: (tagId: string, page: number, pageSize: number, sortBy: string, period: string) => string;
31
+ recentLinks: (page: number, pageSize: number) => string;
32
+ trendingLinks: (period: string, algorithm: string, limit: number) => string;
33
+ searchLinks: (query: string, tagIds: string, sortBy: string, page: number, pageSize: number) => string;
34
+ };
35
+ };
@@ -0,0 +1,7 @@
1
+ import {
2
+ cacheKeys
3
+ } from "../chunk-JBCDEAMW.js";
4
+ import "../chunk-ORMEWXMH.js";
5
+ export {
6
+ cacheKeys
7
+ };
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Redis Client Management
3
+ *
4
+ * Redis 클라이언트 초기화 및 연결 상태 관리
5
+ * - 전역 Redis 에러 상태 관리 (싱글톤)
6
+ * - 에러 발생 시 즉시 폴백 지원
7
+ */
8
+ import { Redis } from '@upstash/redis';
9
+ /**
10
+ * Redis가 전역적으로 비활성화되었는지 확인
11
+ */
12
+ export declare function isRedisGloballyDisabled(): boolean;
13
+ /**
14
+ * Redis 에러 발생 시 호출 (전역 상태 업데이트)
15
+ */
16
+ export declare function notifyRedisError(error: Error, source: string): void;
17
+ /**
18
+ * Redis 전역 상태 초기화 (재연결 성공 시)
19
+ */
20
+ export declare function resetRedisGlobalState(): void;
21
+ /**
22
+ * 전역 Redis 상태 조회
23
+ */
24
+ export declare function getRedisGlobalStatus(): {
25
+ isDisabled: boolean;
26
+ errorCount: number;
27
+ lastErrorTime: Date | null;
28
+ lastErrorMessage: string | null;
29
+ };
30
+ /**
31
+ * 캐시 메트릭 인터페이스
32
+ */
33
+ export interface CacheMetrics {
34
+ hits: number;
35
+ misses: number;
36
+ errors: number;
37
+ totalRequests: number;
38
+ hitRate: number;
39
+ averageResponseTime: number;
40
+ lastError?: string;
41
+ lastErrorTime?: Date;
42
+ }
43
+ /**
44
+ * Redis 연결 상태 인터페이스
45
+ */
46
+ export interface RedisConnectionStatus {
47
+ isConnected: boolean;
48
+ lastPingTime?: Date;
49
+ connectionErrors: number;
50
+ lastConnectionError?: string;
51
+ lastConnectionErrorTime?: Date;
52
+ }
53
+ /**
54
+ * Redis 연결 상태 확인
55
+ */
56
+ export declare function checkRedisConnection(): Promise<{
57
+ success: boolean;
58
+ error?: string;
59
+ details?: any;
60
+ }>;
61
+ /**
62
+ * Redis 연결 상태 확인 함수 (지연 평가)
63
+ * - 전역 Redis 비활성화 상태도 확인
64
+ */
65
+ export declare function isRedisAvailableNow(): boolean;
66
+ /**
67
+ * Redis 클라이언트 가져오기 (지연 초기화)
68
+ * - 전역 Redis 비활성화 상태 확인
69
+ */
70
+ export declare function getRedisClient(): Redis | null;
71
+ /**
72
+ * Redis 캐시 초기화 로그 (최초 1회, 지연 실행)
73
+ */
74
+ export declare function logRedisInitialization(): void;
@@ -0,0 +1,24 @@
1
+ import {
2
+ checkRedisConnection,
3
+ getRedisClient,
4
+ getRedisGlobalStatus,
5
+ isRedisAvailableNow,
6
+ isRedisGloballyDisabled,
7
+ logRedisInitialization,
8
+ notifyRedisError,
9
+ resetRedisGlobalState
10
+ } from "../chunk-6LTZCXNC.js";
11
+ import "../chunk-I47QEDTX.js";
12
+ import "../chunk-EZR55KV2.js";
13
+ import "../chunk-IQQKKUAV.js";
14
+ import "../chunk-ORMEWXMH.js";
15
+ export {
16
+ checkRedisConnection,
17
+ getRedisClient,
18
+ getRedisGlobalStatus,
19
+ isRedisAvailableNow,
20
+ isRedisGloballyDisabled,
21
+ logRedisInitialization,
22
+ notifyRedisError,
23
+ resetRedisGlobalState
24
+ };
@@ -0,0 +1,151 @@
1
+ /**
2
+ * In-Memory Cache Types
3
+ *
4
+ * 인메모리 캐시 관련 타입 정의
5
+ */
6
+ /**
7
+ * 인메모리 캐시 설정 인터페이스
8
+ */
9
+ export interface InMemoryCacheConfig {
10
+ /** 최대 항목 수 (기본: 100,000) */
11
+ maxSize: number;
12
+ /** 최대 메모리 MB (기본: 200) */
13
+ maxMemoryMB: number;
14
+ /** 교체 정책: lru | fifo | ttl */
15
+ evictionPolicy: 'lru' | 'fifo' | 'ttl';
16
+ /** 만료 항목 정리 주기 (ms, 기본: 60000) */
17
+ cleanupInterval: number;
18
+ /** 기본 TTL (초, 기본: 3600) */
19
+ defaultTTL: number;
20
+ }
21
+ /**
22
+ * 인메모리 캐시 설정 기본값
23
+ */
24
+ export declare const DEFAULT_INMEMORY_CONFIG: InMemoryCacheConfig;
25
+ /**
26
+ * 캐시 엔트리 인터페이스
27
+ */
28
+ export interface CacheEntry<T> {
29
+ /** 저장된 값 */
30
+ value: T;
31
+ /** 만료 시간 (Unix timestamp, ms) */
32
+ expiresAt: number;
33
+ /** 추정 메모리 크기 (bytes) */
34
+ size: number;
35
+ /** 마지막 접근 시간 (LRU용, Unix timestamp, ms) */
36
+ accessedAt: number;
37
+ /** 생성 시간 (FIFO용, Unix timestamp, ms) */
38
+ createdAt: number;
39
+ }
40
+ /**
41
+ * 인메모리 캐시 메트릭
42
+ */
43
+ export interface InMemoryCacheMetrics {
44
+ /** 캐시 히트 수 */
45
+ hits: number;
46
+ /** 캐시 미스 수 */
47
+ misses: number;
48
+ /** 교체로 인한 제거 수 */
49
+ evictions: number;
50
+ /** TTL 만료로 인한 제거 수 */
51
+ expirations: number;
52
+ /** 총 요청 수 */
53
+ totalRequests: number;
54
+ /** 히트율 (%) */
55
+ hitRate: number;
56
+ }
57
+ /**
58
+ * 인메모리 캐시 통계
59
+ */
60
+ export interface InMemoryCacheStats {
61
+ /** 현재 항목 수 */
62
+ itemCount: number;
63
+ /** 현재 메모리 사용량 (MB) */
64
+ memoryUsageMB: number;
65
+ /** 최대 항목 수 */
66
+ maxSize: number;
67
+ /** 최대 메모리 (MB) */
68
+ maxMemoryMB: number;
69
+ /** 사용률 (%) */
70
+ utilizationPercent: number;
71
+ /** 메모리 사용률 (%) */
72
+ memoryUtilizationPercent: number;
73
+ }
74
+ /**
75
+ * 캐시 백엔드 타입
76
+ */
77
+ export type CacheBackendType = 'redis' | 'memory' | 'hybrid';
78
+ /**
79
+ * 하이브리드 캐시 설정
80
+ */
81
+ export interface HybridCacheConfig {
82
+ /** 백엔드 타입 */
83
+ backend: CacheBackendType;
84
+ /** Redis 에러 시 인메모리 폴백 여부 */
85
+ fallbackOnRedisError: boolean;
86
+ /** Redis 실패 시 인메모리에 저장 여부 */
87
+ writeToMemoryOnRedisError: boolean;
88
+ /** 인메모리 캐시 설정 */
89
+ inmemory: InMemoryCacheConfig;
90
+ }
91
+ /**
92
+ * 하이브리드 캐시 설정 기본값
93
+ */
94
+ export declare const DEFAULT_HYBRID_CONFIG: HybridCacheConfig;
95
+ /**
96
+ * 하이브리드 캐시 메트릭
97
+ */
98
+ export interface HybridCacheMetrics {
99
+ /** Redis 캐시 메트릭 (null이면 Redis 비활성화) */
100
+ redis: {
101
+ hits: number;
102
+ misses: number;
103
+ errors: number;
104
+ totalRequests: number;
105
+ hitRate: number;
106
+ averageResponseTime: number;
107
+ } | null;
108
+ /** 인메모리 캐시 메트릭 */
109
+ memory: InMemoryCacheMetrics;
110
+ /** 통합 메트릭 */
111
+ combined: {
112
+ totalHits: number;
113
+ totalMisses: number;
114
+ /** Redis 실패로 인메모리 폴백한 횟수 */
115
+ redisFallbacks: number;
116
+ hitRate: number;
117
+ };
118
+ }
119
+ /**
120
+ * 하이브리드 캐시 연결 상태
121
+ */
122
+ export interface HybridConnectionStatus {
123
+ /** Redis 연결 상태 */
124
+ redisConnected: boolean;
125
+ /** 인메모리 캐시 활성화 여부 */
126
+ memoryActive: boolean;
127
+ /** 현재 사용 중인 백엔드 */
128
+ currentBackend: CacheBackendType;
129
+ /** Redis 에러 카운트 */
130
+ redisErrorCount: number;
131
+ /** 마지막 Redis 에러 시간 */
132
+ lastRedisError: Date | null;
133
+ /** 마지막 Redis 에러 메시지 */
134
+ lastRedisErrorMessage: string | null;
135
+ /** Redis가 전역적으로 비활성화되었는지 여부 */
136
+ redisGloballyDisabled?: boolean;
137
+ }
138
+ /**
139
+ * 통합 캐시 매니저 인터페이스
140
+ * CacheManager, HybridCacheManager, InMemoryCache 모두 이 인터페이스를 구현
141
+ */
142
+ export interface IUnifiedCacheManager {
143
+ get<T>(key: string): Promise<T | null>;
144
+ set<T>(key: string, value: T, ttl?: number): Promise<void>;
145
+ delete(key: string): Promise<void>;
146
+ deletePattern(pattern: string): Promise<void>;
147
+ exists(key: string): Promise<boolean>;
148
+ getMetrics(): InMemoryCacheMetrics | HybridCacheMetrics | object;
149
+ getConnectionStatus(): HybridConnectionStatus | object;
150
+ checkConnection(): Promise<boolean>;
151
+ }
@@ -0,0 +1,9 @@
1
+ import {
2
+ DEFAULT_HYBRID_CONFIG,
3
+ DEFAULT_INMEMORY_CONFIG
4
+ } from "../chunk-SS56XFLI.js";
5
+ import "../chunk-ORMEWXMH.js";
6
+ export {
7
+ DEFAULT_HYBRID_CONFIG,
8
+ DEFAULT_INMEMORY_CONFIG
9
+ };
@@ -0,0 +1,27 @@
1
+ import { CacheOptions } from './cache-config';
2
+ export declare function getCacheBackendLabel(): string;
3
+ /**
4
+ * 캐시 래퍼 함수 (데이터베이스 쿼리 결과 캐싱)
5
+ *
6
+ * prefix 처리:
7
+ * 1. prefix가 제공된 경우: 최종 키 = prefix:key
8
+ * 예: withCache('recent-links:1:10', fn, { prefix: 'community' })
9
+ * → 캐시 키: community:recent-links:1:10
10
+ *
11
+ * 2. prefix가 없는 경우: 최종 키 = key (그대로 사용)
12
+ * 예: withCache('community:recent-links:1:10', fn)
13
+ * → 캐시 키: community:recent-links:1:10
14
+ */
15
+ export declare function withCache<T>(key: string, fetchFunction: () => Promise<T>, options?: CacheOptions): Promise<T>;
16
+ /**
17
+ * 캐시 성능 메트릭
18
+ */
19
+ export declare const cacheMetrics: {
20
+ hits: number;
21
+ misses: number;
22
+ errors: number;
23
+ totalRequests: number;
24
+ averageResponseTime: number;
25
+ readonly hitRate: number;
26
+ reset(): void;
27
+ };
@@ -0,0 +1,22 @@
1
+ import {
2
+ cacheMetrics,
3
+ getCacheBackendLabel,
4
+ withCache
5
+ } from "../chunk-YBSHN67U.js";
6
+ import "../chunk-AIHQBQ3E.js";
7
+ import "../chunk-HV3DGSSH.js";
8
+ import "../chunk-Z4D4CMDA.js";
9
+ import "../chunk-SS56XFLI.js";
10
+ import "../chunk-Q7IP4JMW.js";
11
+ import "../chunk-GL2NANFH.js";
12
+ import "../chunk-TXGNSECL.js";
13
+ import "../chunk-6LTZCXNC.js";
14
+ import "../chunk-I47QEDTX.js";
15
+ import "../chunk-EZR55KV2.js";
16
+ import "../chunk-IQQKKUAV.js";
17
+ import "../chunk-ORMEWXMH.js";
18
+ export {
19
+ cacheMetrics,
20
+ getCacheBackendLabel,
21
+ withCache
22
+ };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Cache Module - Backward Compatibility Re-export
3
+ *
4
+ * 이 파일은 기존 import 경로 호환성을 위해 유지됩니다.
5
+ * 모든 내용은 index.ts에서 re-export됩니다.
6
+ *
7
+ * @example
8
+ * // 기존 방식 (계속 동작)
9
+ * import { cache, withCache } from '@withwiz/cache/cache';
10
+ *
11
+ * // 신규 권장 방식
12
+ * import { cache, withCache } from '@withwiz/cache';
13
+ */
14
+ export * from './index';
@@ -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
+ };