@withwiz/toolkit 0.7.0 → 0.8.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 (383) hide show
  1. package/README.ko.md +235 -0
  2. package/README.md +57 -26
  3. package/dist/{chunk-V6YD53NH.js → chunk-23LQJYZN.js} +5 -2
  4. package/dist/{chunk-ZTRASVGZ.js → chunk-34L7HTM7.js} +1 -1
  5. package/dist/{chunk-GSUCBWML.js → chunk-3RK3MKAR.js} +5 -2
  6. package/dist/{chunk-6JXHXIEH.js → chunk-3UIKCS56.js} +2 -2
  7. package/dist/{chunk-MNYVAEXK.js → chunk-4ROIPF33.js} +16 -3
  8. package/dist/{chunk-DUIQUAHR.js → chunk-4TGPAUJV.js} +4 -4
  9. package/dist/{chunk-P4CZVRSG.js → chunk-4XPXZNBX.js} +18 -11
  10. package/dist/{chunk-LG3KM5V3.js → chunk-5I3EQHR4.js} +6 -2
  11. package/dist/chunk-63EKUOJH.js +72 -0
  12. package/dist/{chunk-N5VOFGF3.js → chunk-75UDFONR.js} +5 -4
  13. package/dist/{chunk-T4643SEW.js → chunk-7KIM5MHV.js} +4 -4
  14. package/dist/{chunk-TF5RJ5Q2.js → chunk-7S2PCYNT.js} +5 -5
  15. package/dist/{chunk-2SIBG5BG.js → chunk-7YWUKMZD.js} +7 -0
  16. package/dist/{chunk-7X2N4VZM.js → chunk-ATBYGPLP.js} +1 -1
  17. package/dist/{chunk-A74POWYY.js → chunk-B7AJJKOY.js} +1 -1
  18. package/dist/{chunk-HKW4JA45.js → chunk-BRBOGLFT.js} +10 -10
  19. package/dist/{chunk-ZFNIHVVA.js → chunk-BRFW2LL2.js} +5 -5
  20. package/dist/{chunk-I4NT6G2T.js → chunk-DRTJSTEV.js} +2 -2
  21. package/dist/{chunk-H5KYXSYZ.js → chunk-DVCGAI5N.js} +2 -12
  22. package/dist/{chunk-AV7ELXHG.js → chunk-E5TDIRBJ.js} +2 -2
  23. package/dist/{chunk-Q5ERE4M3.js → chunk-HGVPZSWW.js} +18 -13
  24. package/dist/{chunk-2QVDB6UO.js → chunk-HV6A6Z5R.js} +1 -1
  25. package/dist/chunk-ILMPKSWS.js +125 -0
  26. package/dist/{chunk-J5NLAZV2.js → chunk-JHUWZ6YW.js} +2 -2
  27. package/dist/{chunk-LON5THYQ.js → chunk-KLMKCYIN.js} +1 -1
  28. package/dist/{chunk-4KJZRI74.js → chunk-KWUOLKDO.js} +1 -1
  29. package/dist/{chunk-GJO2MPC3.js → chunk-LCYDMYZS.js} +1 -1
  30. package/dist/{chunk-UP3VFIVQ.js → chunk-LL3VWKY4.js} +1 -1
  31. package/dist/{chunk-IMAFMUZ7.js → chunk-LSS3GJUE.js} +3 -2
  32. package/dist/{chunk-2PFSRVVD.js → chunk-LWHLB2Y6.js} +84 -18
  33. package/dist/{chunk-BBE4RXR7.js → chunk-MTZXWVW3.js} +17 -6
  34. package/dist/{chunk-ORMEWXMH.js → chunk-N3ETBM74.js} +1 -14
  35. package/dist/{chunk-UKPMQBU2.js → chunk-N3TCQ5BF.js} +6 -5
  36. package/dist/{chunk-TMTN7H46.js → chunk-NLV7IEYM.js} +7 -6
  37. package/dist/{chunk-P2VPYAJZ.js → chunk-NTZBMWB6.js} +6 -6
  38. package/dist/{chunk-ZVGEGDYF.js → chunk-OII5BXCZ.js} +1 -1
  39. package/dist/{chunk-2JGSS4RM.js → chunk-PRPMEHRE.js} +2 -2
  40. package/dist/{chunk-KG65BFPK.js → chunk-QAIN3WNN.js} +1 -1
  41. package/dist/{chunk-2MYD2BFJ.js → chunk-R7EFDSPZ.js} +7 -7
  42. package/dist/{chunk-VJE4HA2C.js → chunk-RWCPRPEP.js} +3 -2
  43. package/dist/{chunk-4YDBQZ5M.js → chunk-SCAFDDJP.js} +14 -14
  44. package/dist/{chunk-KXYDTC4A.js → chunk-SNFPZD6L.js} +11 -2
  45. package/dist/{chunk-BL6QHL5L.js → chunk-SXBDP3CK.js} +3 -3
  46. package/dist/{chunk-B5VRZ2VJ.js → chunk-TNDEYJEL.js} +25 -6
  47. package/dist/{chunk-Q4XDPK5B.js → chunk-TRGFXIEF.js} +3 -3
  48. package/dist/{chunk-VNDL2E44.js → chunk-U52U5SK7.js} +2 -2
  49. package/dist/{chunk-3KYSGBVF.js → chunk-UWOWKOOQ.js} +5 -3
  50. package/dist/{chunk-TQ3XHHZK.js → chunk-V3WZFUY3.js} +9 -9
  51. package/dist/{chunk-5BBVV2EX.js → chunk-VH57Y5Z4.js} +1 -1
  52. package/dist/{chunk-5S7M2AJL.js → chunk-VWAB4PM7.js} +1 -1
  53. package/dist/{chunk-AQZPGOEZ.js → chunk-VWKZMGPJ.js} +5 -4
  54. package/dist/{chunk-4K27YLAE.js → chunk-VZ2PQA4U.js} +2 -2
  55. package/dist/{chunk-ZOWEW4GY.js → chunk-WBHX4MJV.js} +2 -2
  56. package/dist/{chunk-UMRKMF3E.js → chunk-WXOWI7BJ.js} +2 -2
  57. package/dist/chunk-XAGPZLRK.js +106 -0
  58. package/dist/{chunk-AWIORJAI.js → chunk-XF3WUF3F.js} +2 -2
  59. package/dist/{chunk-M5ZYAQBB.js → chunk-XKIBJJA3.js} +28 -24
  60. package/dist/{chunk-ZLYBY3R4.js → chunk-XTGS6JJB.js} +10 -5
  61. package/dist/{chunk-KCDJIW2F.js → chunk-XXPB4C37.js} +5 -5
  62. package/dist/{chunk-LUIYCIF7.js → chunk-Y4ME3Q5K.js} +2 -2
  63. package/dist/{chunk-Q66VOVGN.js → chunk-Y4WPEIKW.js} +1 -1
  64. package/dist/{chunk-TUA5XW5Z.js → chunk-Y6CPPBJI.js} +1 -1
  65. package/dist/{chunk-PRWWB4QY.js → chunk-ZEHNCHIV.js} +2 -2
  66. package/dist/{chunk-D73ZJQMX.js → chunk-ZZABL54F.js} +13 -0
  67. package/dist/core/auth/config.d.ts +3 -0
  68. package/dist/core/auth/config.js +3 -3
  69. package/dist/core/auth/email/index.d.ts +3 -3
  70. package/dist/core/auth/email/index.js +3 -3
  71. package/dist/core/auth/email/sender.d.ts +1 -1
  72. package/dist/core/auth/email/sender.js +2 -2
  73. package/dist/core/auth/email/token-generator.d.ts +11 -0
  74. package/dist/core/auth/email/token-generator.js +2 -2
  75. package/dist/core/auth/errors/index.js +1 -1
  76. package/dist/core/auth/index.d.ts +11 -11
  77. package/dist/core/auth/index.js +24 -16
  78. package/dist/core/auth/jwt/client.js +3 -2
  79. package/dist/core/auth/jwt/cookie.d.ts +1 -1
  80. package/dist/core/auth/jwt/cookie.js +4 -4
  81. package/dist/core/auth/jwt/index.d.ts +41 -9
  82. package/dist/core/auth/jwt/index.js +6 -6
  83. package/dist/core/auth/jwt/types.d.ts +1 -1
  84. package/dist/core/auth/jwt/types.js +1 -1
  85. package/dist/core/auth/oauth/index.d.ts +6 -6
  86. package/dist/core/auth/oauth/index.js +5 -5
  87. package/dist/core/auth/oauth/providers/github.d.ts +1 -1
  88. package/dist/core/auth/oauth/providers/github.js +1 -1
  89. package/dist/core/auth/oauth/providers/google.d.ts +1 -1
  90. package/dist/core/auth/oauth/providers/google.js +1 -1
  91. package/dist/core/auth/oauth/providers/index.d.ts +5 -5
  92. package/dist/core/auth/oauth/providers/index.js +4 -4
  93. package/dist/core/auth/oauth/providers/kakao.d.ts +1 -1
  94. package/dist/core/auth/oauth/providers/kakao.js +1 -1
  95. package/dist/core/auth/oauth/providers/meta.d.ts +1 -1
  96. package/dist/core/auth/oauth/providers/meta.js +1 -1
  97. package/dist/core/auth/oauth/providers/microsoft.d.ts +1 -1
  98. package/dist/core/auth/oauth/providers/microsoft.js +1 -1
  99. package/dist/core/auth/oauth/state-cookie.js +1 -1
  100. package/dist/core/auth/password/client-helper.d.ts +9 -9
  101. package/dist/core/auth/password/client-helper.js +5 -3
  102. package/dist/core/auth/password/hasher.d.ts +83 -0
  103. package/dist/core/auth/password/hasher.js +14 -0
  104. package/dist/core/auth/password/index.d.ts +8 -6
  105. package/dist/core/auth/password/index.js +11 -2
  106. package/dist/core/auth/services/email-verification.service.d.ts +1 -1
  107. package/dist/core/auth/services/email-verification.service.js +3 -3
  108. package/dist/core/auth/services/index.d.ts +13 -12
  109. package/dist/core/auth/services/index.js +16 -16
  110. package/dist/core/auth/services/login.service.d.ts +15 -1
  111. package/dist/core/auth/services/login.service.js +6 -6
  112. package/dist/core/auth/services/oauth-callback.service.d.ts +7 -1
  113. package/dist/core/auth/services/oauth-callback.service.js +6 -6
  114. package/dist/core/auth/services/password-reset.service.d.ts +1 -1
  115. package/dist/core/auth/services/password-reset.service.js +3 -3
  116. package/dist/core/auth/services/refresh-token-store.d.ts +39 -0
  117. package/dist/core/auth/services/register.service.d.ts +1 -1
  118. package/dist/core/auth/services/register.service.js +3 -3
  119. package/dist/core/auth/services/token-refresh.service.d.ts +27 -1
  120. package/dist/core/auth/services/token-refresh.service.js +6 -6
  121. package/dist/core/auth/token-delivery.d.ts +47 -0
  122. package/dist/core/auth/token-delivery.js +14 -0
  123. package/dist/core/auth/types/index.d.ts +38 -4
  124. package/dist/core/auth/types/index.js +1 -1
  125. package/dist/core/cache/cache-config.js +5 -5
  126. package/dist/core/cache/cache-defaults.js +1 -1
  127. package/dist/core/cache/cache-env.d.ts +3 -3
  128. package/dist/core/cache/cache-env.js +4 -4
  129. package/dist/core/cache/cache-factory.d.ts +6 -6
  130. package/dist/core/cache/cache-factory.js +12 -12
  131. package/dist/core/cache/cache-invalidation.d.ts +4 -4
  132. package/dist/core/cache/cache-invalidation.js +13 -13
  133. package/dist/core/cache/cache-redis.js +6 -6
  134. package/dist/core/cache/cache-types.js +1 -1
  135. package/dist/core/cache/cache-wrapper.d.ts +1 -1
  136. package/dist/core/cache/cache-wrapper.js +13 -13
  137. package/dist/core/cache/cache.d.ts +2 -2
  138. package/dist/core/cache/cache.js +25 -25
  139. package/dist/core/cache/config.js +3 -3
  140. package/dist/core/cache/hybrid-cache-manager.d.ts +1 -1
  141. package/dist/core/cache/hybrid-cache-manager.js +8 -8
  142. package/dist/core/cache/index.d.ts +15 -15
  143. package/dist/core/cache/index.js +25 -25
  144. package/dist/core/cache/inmemory-cache-manager.d.ts +1 -1
  145. package/dist/core/cache/inmemory-cache-manager.js +3 -3
  146. package/dist/core/cache/noop-cache-manager.d.ts +1 -1
  147. package/dist/core/cache/noop-cache-manager.js +6 -6
  148. package/dist/core/cache/redis-cache-manager.d.ts +2 -2
  149. package/dist/core/cache/redis-cache-manager.js +7 -7
  150. package/dist/core/config/common.js +1 -1
  151. package/dist/core/config/errors.js +1 -1
  152. package/dist/core/config/registry.d.ts +7 -7
  153. package/dist/core/config/registry.js +1 -1
  154. package/dist/core/config/warn.js +1 -1
  155. package/dist/core/constants/error-codes.js +1 -1
  156. package/dist/core/constants/index.d.ts +5 -5
  157. package/dist/core/constants/index.js +17 -15
  158. package/dist/core/constants/messages.js +1 -1
  159. package/dist/core/constants/pagination.js +1 -1
  160. package/dist/core/constants/security.d.ts +15 -0
  161. package/dist/core/constants/security.js +4 -2
  162. package/dist/core/constants/validation.js +1 -1
  163. package/dist/core/cors/index.js +1 -1
  164. package/dist/core/error/app-error.d.ts +2 -2
  165. package/dist/core/error/app-error.js +1 -1
  166. package/dist/core/error/extract-error-info.js +1 -1
  167. package/dist/core/error/friendly-messages-v2.d.ts +3 -3
  168. package/dist/core/error/friendly-messages-v2.js +4 -4
  169. package/dist/core/error/friendly-messages.js +1 -1
  170. package/dist/core/error/index.d.ts +6 -6
  171. package/dist/core/error/index.js +7 -7
  172. package/dist/core/error/messages/en.d.ts +1 -1
  173. package/dist/core/error/messages/en.js +1 -1
  174. package/dist/core/error/messages/index.d.ts +2 -2
  175. package/dist/core/error/messages/index.js +3 -3
  176. package/dist/core/error/messages/ko.d.ts +1 -1
  177. package/dist/core/error/messages/ko.js +1 -1
  178. package/dist/core/geolocation/batch-processor.d.ts +1 -1
  179. package/dist/core/geolocation/batch-processor.js +3 -3
  180. package/dist/core/geolocation/config.js +1 -1
  181. package/dist/core/geolocation/index.d.ts +5 -5
  182. package/dist/core/geolocation/index.js +3 -3
  183. package/dist/core/geolocation/providers/base-provider.d.ts +2 -2
  184. package/dist/core/geolocation/providers/base-provider.js +1 -1
  185. package/dist/core/geolocation/providers/index.d.ts +6 -6
  186. package/dist/core/geolocation/providers/index.js +1 -1
  187. package/dist/core/geolocation/providers/ip-api-provider.d.ts +3 -3
  188. package/dist/core/geolocation/providers/ip-api-provider.js +1 -1
  189. package/dist/core/geolocation/providers/ipapi-co-provider.d.ts +3 -3
  190. package/dist/core/geolocation/providers/ipapi-co-provider.js +1 -1
  191. package/dist/core/geolocation/providers/ipgeolocation-provider.d.ts +3 -3
  192. package/dist/core/geolocation/providers/ipgeolocation-provider.js +1 -1
  193. package/dist/core/geolocation/providers/maxmind-provider.d.ts +3 -3
  194. package/dist/core/geolocation/providers/maxmind-provider.js +1 -1
  195. package/dist/core/logger/config.js +1 -1
  196. package/dist/core/logger/logger.js +2 -2
  197. package/dist/core/storage/config.js +1 -1
  198. package/dist/core/storage/r2-storage.js +2 -2
  199. package/dist/core/system/cpu.d.ts +1 -1
  200. package/dist/core/system/cpu.js +4 -4
  201. package/dist/core/system/disk.d.ts +1 -1
  202. package/dist/core/system/disk.js +4 -4
  203. package/dist/core/system/environment.d.ts +1 -1
  204. package/dist/core/system/environment.js +8 -8
  205. package/dist/core/system/health-check.d.ts +2 -2
  206. package/dist/core/system/health-check.js +6 -6
  207. package/dist/core/system/index.d.ts +7 -7
  208. package/dist/core/system/index.js +16 -16
  209. package/dist/core/system/memory.d.ts +1 -1
  210. package/dist/core/system/memory.js +4 -4
  211. package/dist/core/system/network.d.ts +1 -1
  212. package/dist/core/system/network.js +4 -4
  213. package/dist/core/system/utils.js +3 -3
  214. package/dist/core/types/geoip.d.ts +1 -1
  215. package/dist/core/types/qr-code.js +1 -1
  216. package/dist/core/utils/error-message-formatter.js +1 -1
  217. package/dist/core/utils/format-number.js +1 -1
  218. package/dist/core/utils/index.d.ts +3 -3
  219. package/dist/core/utils/index.js +2 -2
  220. package/dist/core/utils/input-validation.js +52 -16
  221. package/dist/core/utils/ip-utils.js +1 -1
  222. package/dist/core/utils/optimistic-lock.js +1 -1
  223. package/dist/core/utils/sanitizer.js +2 -2
  224. package/dist/core/utils/short-code-generator.js +1 -1
  225. package/dist/core/utils/timezone.js +121 -14
  226. package/dist/core/utils/type-guards.js +1 -1
  227. package/dist/core/utils/url-normalizer.js +1 -1
  228. package/dist/core/validators/index.d.ts +1 -1
  229. package/dist/core/validators/index.js +2 -2
  230. package/dist/core/validators/password-validator.d.ts +3 -3
  231. package/dist/core/validators/password-validator.js +2 -2
  232. package/dist/initialize.d.ts +10 -10
  233. package/dist/initialize.js +9 -9
  234. package/dist/next/auth-handlers/forgot-password.handler.d.ts +1 -1
  235. package/dist/next/auth-handlers/forgot-password.handler.js +4 -4
  236. package/dist/next/auth-handlers/index.d.ts +11 -11
  237. package/dist/next/auth-handlers/index.js +28 -27
  238. package/dist/next/auth-handlers/login.handler.d.ts +1 -1
  239. package/dist/next/auth-handlers/login.handler.js +7 -6
  240. package/dist/next/auth-handlers/logout.handler.d.ts +1 -1
  241. package/dist/next/auth-handlers/logout.handler.js +5 -5
  242. package/dist/next/auth-handlers/me.handler.d.ts +1 -1
  243. package/dist/next/auth-handlers/me.handler.js +7 -6
  244. package/dist/next/auth-handlers/oauth-authorize.handler.d.ts +1 -1
  245. package/dist/next/auth-handlers/oauth-authorize.handler.js +4 -4
  246. package/dist/next/auth-handlers/oauth-callback.handler.d.ts +1 -1
  247. package/dist/next/auth-handlers/oauth-callback.handler.js +9 -9
  248. package/dist/next/auth-handlers/refresh.handler.d.ts +1 -1
  249. package/dist/next/auth-handlers/refresh.handler.js +8 -7
  250. package/dist/next/auth-handlers/register.handler.d.ts +1 -1
  251. package/dist/next/auth-handlers/register.handler.js +4 -4
  252. package/dist/next/auth-handlers/reset-password.handler.d.ts +1 -1
  253. package/dist/next/auth-handlers/reset-password.handler.js +4 -4
  254. package/dist/next/auth-handlers/verify-email.handler.d.ts +1 -1
  255. package/dist/next/auth-handlers/verify-email.handler.js +4 -4
  256. package/dist/next/auth-types/handler-types.d.ts +5 -1
  257. package/dist/next/auth-types/handler-types.js +13 -1
  258. package/dist/next/auth-types/index.d.ts +1 -1
  259. package/dist/next/auth-types/index.js +13 -1
  260. package/dist/next/error/error-handler.js +5 -5
  261. package/dist/next/error/index.d.ts +3 -3
  262. package/dist/next/error/index.js +9 -9
  263. package/dist/next/error/locale-detector.d.ts +1 -1
  264. package/dist/next/error/locale-detector.js +1 -1
  265. package/dist/next/middleware/auth.d.ts +3 -3
  266. package/dist/next/middleware/auth.js +10 -9
  267. package/dist/next/middleware/cors.d.ts +2 -2
  268. package/dist/next/middleware/cors.js +3 -3
  269. package/dist/next/middleware/error-handler.d.ts +1 -1
  270. package/dist/next/middleware/error-handler.js +9 -9
  271. package/dist/next/middleware/index.d.ts +11 -11
  272. package/dist/next/middleware/index.js +23 -22
  273. package/dist/next/middleware/init-request.d.ts +1 -1
  274. package/dist/next/middleware/init-request.js +1 -1
  275. package/dist/next/middleware/middleware-chain.d.ts +1 -1
  276. package/dist/next/middleware/middleware-chain.js +3 -3
  277. package/dist/next/middleware/rate-limit.d.ts +2 -2
  278. package/dist/next/middleware/rate-limit.js +4 -4
  279. package/dist/next/middleware/response-logger.d.ts +1 -1
  280. package/dist/next/middleware/response-logger.js +3 -3
  281. package/dist/next/middleware/security.d.ts +1 -1
  282. package/dist/next/middleware/security.js +3 -3
  283. package/dist/next/middleware/types.d.ts +6 -3
  284. package/dist/next/middleware/wrappers.d.ts +2 -2
  285. package/dist/next/middleware/wrappers.js +21 -20
  286. package/dist/next/utils/api-helpers.d.ts +6 -2
  287. package/dist/next/utils/api-helpers.js +3 -2
  288. package/dist/next/utils/cors.js +2 -2
  289. package/dist/next/utils/csv-export-format.d.ts +11 -0
  290. package/dist/next/utils/csv-export-format.js +15 -0
  291. package/dist/next/utils/csv-export.d.ts +0 -2
  292. package/dist/next/utils/csv-export.js +3 -3
  293. package/dist/next/utils/error-processor.d.ts +1 -1
  294. package/dist/next/utils/error-processor.js +4 -4
  295. package/dist/next/utils/index.d.ts +5 -5
  296. package/dist/next/utils/index.js +21 -20
  297. package/dist/prisma/auth-adapter/index.d.ts +1 -1
  298. package/dist/prisma/auth-adapter/index.js +1 -1
  299. package/package.json +95 -51
  300. package/dist/chunk-2P4N4OK2.js +0 -150
  301. package/dist/chunk-4IQWQSEV.js +0 -27
  302. package/dist/chunk-4K76HG4V.js +0 -34
  303. package/dist/chunk-7EXSMZ2O.js +0 -29
  304. package/dist/chunk-7VXRBTRF.js +0 -110
  305. package/dist/chunk-ARXUKGZI.js +0 -58
  306. package/dist/chunk-B5OH43PR.js +0 -31
  307. package/dist/chunk-BW4QO7T6.js +0 -56
  308. package/dist/chunk-C6WH7RF5.js +0 -117
  309. package/dist/chunk-EK4TL7VW.js +0 -22
  310. package/dist/chunk-GPOSTBDQ.js +0 -193
  311. package/dist/chunk-IRUFNC4L.js +0 -26
  312. package/dist/chunk-J2MAXMIP.js +0 -105
  313. package/dist/chunk-MFMQO6IS.js +0 -127
  314. package/dist/chunk-NIWVKN6A.js +0 -81
  315. package/dist/chunk-OO2XOASJ.js +0 -240
  316. package/dist/chunk-PBQGXOVX.js +0 -31
  317. package/dist/chunk-STMAKLLG.js +0 -24
  318. package/dist/chunk-WP233RH2.js +0 -80
  319. package/dist/chunk-WWOYFWFB.js +0 -137
  320. package/dist/chunk-X7FGBUA4.js +0 -117
  321. package/dist/chunk-YSPIFSDI.js +0 -136
  322. package/dist/react/components/ui/Alert.d.ts +0 -12
  323. package/dist/react/components/ui/Alert.js +0 -10
  324. package/dist/react/components/ui/Badge.d.ts +0 -7
  325. package/dist/react/components/ui/Badge.js +0 -8
  326. package/dist/react/components/ui/Button.d.ts +0 -7
  327. package/dist/react/components/ui/Button.js +0 -8
  328. package/dist/react/components/ui/DataTable.d.ts +0 -8
  329. package/dist/react/components/ui/DataTable.js +0 -22
  330. package/dist/react/components/ui/DomainDisplay.d.ts +0 -12
  331. package/dist/react/components/ui/DomainDisplay.js +0 -31
  332. package/dist/react/components/ui/Input.d.ts +0 -5
  333. package/dist/react/components/ui/Input.js +0 -8
  334. package/dist/react/components/ui/Label.d.ts +0 -5
  335. package/dist/react/components/ui/Label.js +0 -8
  336. package/dist/react/components/ui/Pagination.d.ts +0 -42
  337. package/dist/react/components/ui/Pagination.js +0 -20
  338. package/dist/react/components/ui/Select.d.ts +0 -15
  339. package/dist/react/components/ui/Select.js +0 -27
  340. package/dist/react/components/ui/Skeleton.d.ts +0 -6
  341. package/dist/react/components/ui/Skeleton.js +0 -8
  342. package/dist/react/components/ui/TimezoneDisplay.d.ts +0 -22
  343. package/dist/react/components/ui/TimezoneDisplay.js +0 -83
  344. package/dist/react/components/ui/Tooltip.d.ts +0 -21
  345. package/dist/react/components/ui/Tooltip.js +0 -94
  346. package/dist/react/components/ui/data-table/DataTable.d.ts +0 -2
  347. package/dist/react/components/ui/data-table/DataTable.js +0 -22
  348. package/dist/react/components/ui/data-table/DataTableBody.d.ts +0 -19
  349. package/dist/react/components/ui/data-table/DataTableBody.js +0 -10
  350. package/dist/react/components/ui/data-table/DataTableBulkActions.d.ts +0 -17
  351. package/dist/react/components/ui/data-table/DataTableBulkActions.js +0 -12
  352. package/dist/react/components/ui/data-table/DataTableFilters.d.ts +0 -15
  353. package/dist/react/components/ui/data-table/DataTableFilters.js +0 -13
  354. package/dist/react/components/ui/data-table/DataTablePagination.d.ts +0 -10
  355. package/dist/react/components/ui/data-table/DataTablePagination.js +0 -11
  356. package/dist/react/components/ui/data-table/DataTableSearch.d.ts +0 -24
  357. package/dist/react/components/ui/data-table/DataTableSearch.js +0 -12
  358. package/dist/react/components/ui/data-table/index.d.ts +0 -13
  359. package/dist/react/components/ui/data-table/index.js +0 -42
  360. package/dist/react/components/ui/data-table/types.d.ts +0 -120
  361. package/dist/react/components/ui/data-table/types.js +0 -9
  362. package/dist/react/components/ui/loading-bar.d.ts +0 -20
  363. package/dist/react/components/ui/loading-bar.js +0 -15
  364. package/dist/react/error/error-display.d.ts +0 -48
  365. package/dist/react/error/error-display.js +0 -30
  366. package/dist/react/error/index.d.ts +0 -6
  367. package/dist/react/error/index.js +0 -30
  368. package/dist/react/hooks/useDataTable.d.ts +0 -96
  369. package/dist/react/hooks/useDataTable.js +0 -151
  370. package/dist/react/hooks/useDebounce.d.ts +0 -7
  371. package/dist/react/hooks/useDebounce.js +0 -7
  372. package/dist/react/hooks/useExitIntent.d.ts +0 -35
  373. package/dist/react/hooks/useExitIntent.js +0 -72
  374. package/dist/react/hooks/useTimezone.d.ts +0 -19
  375. package/dist/react/hooks/useTimezone.js +0 -11
  376. package/dist/react/utils/client-utils.d.ts +0 -3
  377. package/dist/react/utils/client-utils.js +0 -9
  378. package/dist/react/utils/qr-code.d.ts +0 -16
  379. package/dist/react/utils/qr-code.js +0 -215
  380. package/dist/{chunk-7PEVOMBO.js → chunk-AOWUPAPS.js} +0 -0
  381. package/dist/{chunk-V3GEYUBG.js → chunk-ER6LSA4M.js} +3 -3
  382. package/dist/{chunk-7WG7XPXC.js → chunk-KKZCNF6U.js} +3 -3
  383. /package/dist/{chunk-M22Z2NO6.js → core/auth/services/refresh-token-store.js} +0 -0
package/README.ko.md ADDED
@@ -0,0 +1,235 @@
1
+ # @withwiz/toolkit
2
+
3
+ [English](README.md) | **한국어**
4
+
5
+ Shared utility library for [withwiz](https://github.com/greeun) projects — 인증, 캐싱, 에러 처리, 미들웨어, 지오로케이션, 로깅 등 프로덕션 수준의 모듈 모음.
6
+
7
+ ## Features
8
+
9
+ - **Composition root** — 단일 `initialize()`로 모든 티어 설정을 한 번에 조립
10
+ - **Framework tiers** — `core` / `next` / `react` / `prisma` 4개 티어로 의존성 분리 (0.7+)
11
+ - **Auth** — JWT, password hashing, OAuth helpers (Google / GitHub / Kakao / Microsoft / Meta), state-cookie CSRF 바인딩, Prisma adapter
12
+ - **Cache** — Redis / in-memory / hybrid / noop 백엔드, factory, invalidation, defaults
13
+ - **Constants** — Error codes, messages, pagination, security constants
14
+ - **Error** — Typed `AppError`, framework-aware error handler / display (core · next · react)
15
+ - **Geolocation** — GeoIP lookup, batch processing, provider factory
16
+ - **Hooks** — `useDataTable`, `useDebounce`, `useExitIntent`, `useTimezone`
17
+ - **Logger** — Winston-based structured logger with daily rotation
18
+ - **Middleware** — Auth, rate-limiting, CORS, security middleware wrappers (Next.js)
19
+ - **Storage** — Cloudflare R2 (AWS S3-compatible) storage
20
+ - **System** — Health check, system monitoring
21
+ - **Types** — Shared TypeScript types (API, DB, env, GeoIP, user, i18n, QR)
22
+ - **Utils** — Sanitizer, type-guards, CSV export, URL normalizer, timezone, IP utils, ...
23
+ - **Validators** — Password strength validator
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ npm install @withwiz/toolkit
29
+ # or
30
+ pnpm add @withwiz/toolkit
31
+ # or
32
+ yarn add @withwiz/toolkit
33
+ ```
34
+
35
+ ### Peer dependencies (optional)
36
+
37
+ `next` / `react` / `react-dom` 은 **optional** peer입니다 — 사용하는 티어가 요구하는 peer만 설치하세요.
38
+
39
+ ```bash
40
+ # next 티어를 쓸 때
41
+ npm install next
42
+
43
+ # react 티어를 쓸 때
44
+ npm install react react-dom
45
+
46
+ # core 티어만 쓰는 백엔드 / CLI
47
+ # (별도 peer 설치 불필요)
48
+ ```
49
+
50
+ ## Quick start
51
+
52
+ ```ts
53
+ // Auth — JWT
54
+ import { signToken, verifyToken } from '@withwiz/toolkit/core/auth/jwt'
55
+
56
+ const token = await signToken({ userId: 'u_123' })
57
+ const payload = await verifyToken(token)
58
+ ```
59
+
60
+ ```ts
61
+ // Cache — Redis wrapper
62
+ import { withCache } from '@withwiz/toolkit/core/cache'
63
+
64
+ const data = await withCache('my-key', async () => fetchData(), 3600)
65
+ ```
66
+
67
+ ```ts
68
+ // Error — typed error class
69
+ import { AppError } from '@withwiz/toolkit/core/error'
70
+
71
+ throw new AppError('NOT_FOUND', 'Resource not found', 404)
72
+ ```
73
+
74
+ ```ts
75
+ // Logger
76
+ import { logInfo, logError } from '@withwiz/toolkit/core/logger/logger'
77
+
78
+ logInfo('Server started', { port: 3000 })
79
+ logError('Something went wrong', { error })
80
+ ```
81
+
82
+ ```ts
83
+ // Geolocation
84
+ import { getGeoLocation } from '@withwiz/toolkit/core/geolocation'
85
+
86
+ const geo = await getGeoLocation('8.8.8.8')
87
+ // { country: 'US', city: 'Mountain View', ... }
88
+ ```
89
+
90
+ ```tsx
91
+ // Hooks (React)
92
+ import { useDebounce } from '@withwiz/toolkit/react/hooks/useDebounce'
93
+
94
+ const debouncedQuery = useDebounce(query, 300)
95
+ ```
96
+
97
+ ```ts
98
+ // Utils
99
+ import { sanitizeInput } from '@withwiz/toolkit/core/utils/sanitizer'
100
+ import { formatNumber } from '@withwiz/toolkit/core/utils/format-number'
101
+ import { normalizeUrl } from '@withwiz/toolkit/core/utils/url-normalizer'
102
+ ```
103
+
104
+ ### 토큰 전달 모드 (tokenDelivery)
105
+
106
+ 인증 토큰 전달 방식을 초기화 시 선택할 수 있습니다. 기본값은 `'hybrid'`(쿠키 + 헤더 동시 지원, 기존 동작)입니다.
107
+
108
+ ```typescript
109
+ import { initialize } from '@withwiz/toolkit/initialize';
110
+
111
+ initialize({
112
+ auth: {
113
+ jwtSecret: process.env.JWT_SECRET!,
114
+ tokenDelivery: 'cookie', // 'cookie' | 'header' | 'hybrid' (기본)
115
+ },
116
+ });
117
+ ```
118
+
119
+ 핸들러별로 덮어쓸 수도 있습니다 (옵션 > 전역 > `'hybrid'` 순):
120
+
121
+ ```typescript
122
+ createAuthHandlers({ ...options, tokenDelivery: 'header' });
123
+ ```
124
+
125
+ | 모드 | 토큰 위치 | 특징 |
126
+ |---|---|---|
127
+ | `cookie` | HttpOnly 쿠키 전용 | 응답 body 에서 토큰 제거 — XSS 노출 면 최소. 브라우저 앱 권장 |
128
+ | `header` | `Authorization: Bearer` + body | refresh 는 body `{ refreshToken }` 으로 전달. 클라이언트 저장소는 XSS 에 상대적으로 취약 — 비브라우저 클라이언트용 |
129
+ | `hybrid` | 둘 다 | 기존 동작. 쿠키 우선, 헤더/body 폴백 |
130
+
131
+ **제약**: OAuth callback 은 redirect 응답이라 모드와 무관하게 쿠키로만 토큰을 전달합니다. OAuth 를 쓰는 앱은 `'cookie'` 또는 `'hybrid'` 를 사용하세요.
132
+
133
+ ## Module reference
134
+
135
+ 0.7부터 모든 subpath는 프레임워크 의존성에 따라 4개 티어로 분리됩니다.
136
+ 자세한 티어 모델·규칙·마이그레이션 매핑은 [`docs/FRAMEWORK_TIERS.md`](docs/FRAMEWORK_TIERS.md)
137
+ 및 [`CHANGELOG.md`](CHANGELOG.md) 의 0.7.0 항목을 참조하세요.
138
+
139
+ ### Composition root
140
+
141
+ | Subpath | Description |
142
+ |---|---|
143
+ | `/initialize` | 모든 티어 설정을 단일 객체로 조립하는 통합 진입점 |
144
+
145
+ ### `core` — 프레임워크 독립 (pure TS)
146
+
147
+ | Subpath | Description |
148
+ |---|---|
149
+ | `/core/auth` | Full auth (JWT + password + OAuth + services + email + types) |
150
+ | `/core/auth/jwt` | JWT sign / verify |
151
+ | `/core/auth/password` | bcrypt helpers |
152
+ | `/core/auth/oauth` | OAuth utilities (Google / GitHub / Kakao / Microsoft / Meta) |
153
+ | `/core/auth/oauth/providers/{google,github,kakao,microsoft,meta}` | Individual OAuth providers |
154
+ | `/core/auth/services` | Login / token-refresh / oauth-callback services |
155
+ | `/core/auth/email` | Email token generation |
156
+ | `/core/auth/types` | Framework-independent auth types |
157
+ | `/core/cache` | Cache facade (get / set / delete / withCache) |
158
+ | `/core/cache/cache-factory` | Cache backend factory (Redis / in-memory / hybrid / noop) |
159
+ | `/core/cache/cache-invalidation` | Pattern-based cache invalidation |
160
+ | `/core/config` | Config registry |
161
+ | `/core/constants/{error-codes,messages,pagination,security}` | Shared constants |
162
+ | `/core/cors` | Framework-independent CORS config |
163
+ | `/core/error` | `AppError`, error codes, i18n messages, `extractErrorInfo` |
164
+ | `/core/geolocation` | GeoIP lookup, batch processor, provider factory |
165
+ | `/core/logger/logger` | Winston-based structured logger |
166
+ | `/core/storage` | Cloudflare R2 / S3-compatible storage |
167
+ | `/core/system` | Health check, system monitoring |
168
+ | `/core/types/{api,database,env,geoip,i18n,qr-code,user}` | Shared TypeScript types |
169
+ | `/core/utils` | `sanitizer`, `type-guards`, `format-number`, `ip-utils`, `timezone`, ... |
170
+ | `/core/validators` | Password strength validator |
171
+
172
+ ### `next` — Next.js 의존
173
+
174
+ | Subpath | Description |
175
+ |---|---|
176
+ | `/next/middleware` | Auth · rate-limit · CORS · security · wrappers |
177
+ | `/next/auth-handlers` | Route handlers (login / refresh / oauth callback / me) |
178
+ | `/next/auth-types` | Handler types (`NextRequest` signatures) |
179
+ | `/next/error` | `error-handler` (NextResponse), `LocaleDetector`, `ErrorBoundary` |
180
+ | `/next/utils` | `api-helpers`, `cors`, `csv-export`, `error-processor` |
181
+
182
+ ### `react` — React 의존
183
+
184
+ | Subpath | Description |
185
+ |---|---|
186
+ | `/react/components/ui/*` | Button, Table, Badge, DataTable, ... |
187
+ | `/react/hooks/{useDataTable,useDebounce,useExitIntent,useTimezone}` | React hooks |
188
+ | `/react/error` | `error-display` (sonner toast) |
189
+ | `/react/utils/{client-utils,qr-code}` | Browser-context utilities |
190
+
191
+ ### `prisma` — Prisma 의존
192
+
193
+ | Subpath | Description |
194
+ |---|---|
195
+ | `/prisma/auth-adapter` | `UserRepository` / `OAuthAccountRepository` / `EmailTokenRepository` Prisma 구현체 |
196
+
197
+ ## Requirements
198
+
199
+ - Node.js >= 18
200
+ - TypeScript >= 5
201
+
202
+ ### Optional peers
203
+
204
+ `next` / `react` / `react-dom` 은 `optional` peer dependency입니다.
205
+ 사용하는 티어가 요구하는 peer만 설치하세요:
206
+
207
+ - `core` 티어만 쓰는 백엔드 / CLI: peer 불필요
208
+ - `next` 티어: Next.js >= 15
209
+ - `react` 티어: React >= 18, React-DOM >= 18
210
+ - `prisma` 티어: Prisma 호환 클라이언트 (덕 타이핑)
211
+ - Prisma 어댑터의 `EmailTokenRepository` 등 일부 모듈: `date-fns >= 3` (optional)
212
+ - 이메일 전송: `nodemailer >= 6` (optional)
213
+
214
+ ## Development
215
+
216
+ ```bash
217
+ # Install dependencies
218
+ npm install
219
+
220
+ # Build
221
+ npm run build
222
+
223
+ # Run tests
224
+ npm test
225
+
226
+ # Watch mode
227
+ npm run test:watch
228
+
229
+ # Coverage
230
+ npm run test:coverage
231
+ ```
232
+
233
+ ## License
234
+
235
+ MIT © [withwiz](https://github.com/greeun)
package/README.md CHANGED
@@ -1,13 +1,15 @@
1
1
  # @withwiz/toolkit
2
2
 
3
+ **English** | [한국어](README.ko.md)
4
+
3
5
  Shared utility library for [withwiz](https://github.com/greeun) projects — a collection of production-ready modules for authentication, caching, error handling, middleware, geolocation, logging, and more.
4
6
 
5
7
  ## Features
6
8
 
7
- - **Composition root** — 단일 `initialize()`로 모든 티어 설정을 번에 조립
8
- - **Framework tiers** — `core` / `next` / `react` / `prisma` 4개 티어로 의존성 분리 (0.7+)
9
- - **Auth** — JWT, password hashing, OAuth helpers (Google / GitHub / Kakao / Microsoft / Meta), state-cookie CSRF 바인딩, Prisma adapter
10
- - **Cache** — Redis / in-memory / hybrid / noop 백엔드, factory, invalidation, defaults
9
+ - **Composition root** — assemble every tier's configuration at once with a single `initialize()`
10
+ - **Framework tiers** — dependencies split across four tiers: `core` / `next` / `react` / `prisma` (0.7+)
11
+ - **Auth** — JWT, password hashing, OAuth helpers (Google / GitHub / Kakao / Microsoft / Meta), state-cookie CSRF binding, Prisma adapter
12
+ - **Cache** — Redis / in-memory / hybrid / noop backends, factory, invalidation, defaults
11
13
  - **Constants** — Error codes, messages, pagination, security constants
12
14
  - **Error** — Typed `AppError`, framework-aware error handler / display (core · next · react)
13
15
  - **Geolocation** — GeoIP lookup, batch processing, provider factory
@@ -32,17 +34,17 @@ yarn add @withwiz/toolkit
32
34
 
33
35
  ### Peer dependencies (optional)
34
36
 
35
- `next` / `react` / `react-dom` **optional** peer입니다사용하는 티어가 요구하는 peer만 설치하세요.
37
+ `next` / `react` / `react-dom` are **optional** peersinstall only the peers required by the tiers you use.
36
38
 
37
39
  ```bash
38
- # next 티어를
40
+ # When using the next tier
39
41
  npm install next
40
42
 
41
- # react 티어를
43
+ # When using the react tier
42
44
  npm install react react-dom
43
45
 
44
- # core 티어만 쓰는 백엔드 / CLI
45
- # (별도 peer 설치 불필요)
46
+ # Backend / CLI using only the core tier
47
+ # (no extra peers required)
46
48
  ```
47
49
 
48
50
  ## Quick start
@@ -99,19 +101,48 @@ import { formatNumber } from '@withwiz/toolkit/core/utils/format-number'
99
101
  import { normalizeUrl } from '@withwiz/toolkit/core/utils/url-normalizer'
100
102
  ```
101
103
 
104
+ ### Token delivery mode (tokenDelivery)
105
+
106
+ You can choose how authentication tokens are delivered at initialization time. The default is `'hybrid'` (cookie + header support, the legacy behavior).
107
+
108
+ ```typescript
109
+ import { initialize } from '@withwiz/toolkit/initialize';
110
+
111
+ initialize({
112
+ auth: {
113
+ jwtSecret: process.env.JWT_SECRET!,
114
+ tokenDelivery: 'cookie', // 'cookie' | 'header' | 'hybrid' (default)
115
+ },
116
+ });
117
+ ```
118
+
119
+ It can also be overridden per handler (precedence: option > global > `'hybrid'`):
120
+
121
+ ```typescript
122
+ createAuthHandlers({ ...options, tokenDelivery: 'header' });
123
+ ```
124
+
125
+ | Mode | Token location | Notes |
126
+ |---|---|---|
127
+ | `cookie` | HttpOnly cookie only | Token removed from the response body — minimal XSS exposure. Recommended for browser apps |
128
+ | `header` | `Authorization: Bearer` + body | Refresh is passed via the body `{ refreshToken }`. Client-side storage is relatively vulnerable to XSS — for non-browser clients |
129
+ | `hybrid` | Both | Legacy behavior. Cookie first, with header/body fallback |
130
+
131
+ **Constraint**: The OAuth callback is a redirect response, so it always delivers the token via cookie regardless of the mode. Apps that use OAuth should use `'cookie'` or `'hybrid'`.
132
+
102
133
  ## Module reference
103
134
 
104
- 0.7부터 모든 subpath 프레임워크 의존성에 따라 4개 티어로 분리됩니다.
105
- 자세한 티어 모델·규칙·마이그레이션 매핑은 [`docs/FRAMEWORK_TIERS.md`](docs/FRAMEWORK_TIERS.md)
106
- [`CHANGELOG.md`](CHANGELOG.md) 의 0.7.0 항목을 참조하세요.
135
+ Since 0.7, every subpath is split into four tiers based on its framework dependencies.
136
+ For the detailed tier model, rules, and migration mapping, see [`docs/FRAMEWORK_TIERS.md`](docs/FRAMEWORK_TIERS.md)
137
+ and the 0.7.0 entry in [`CHANGELOG.md`](CHANGELOG.md).
107
138
 
108
139
  ### Composition root
109
140
 
110
141
  | Subpath | Description |
111
142
  |---|---|
112
- | `/initialize` | 모든 티어 설정을 단일 객체로 조립하는 통합 진입점 |
143
+ | `/initialize` | Unified entry point that assembles every tier's configuration into a single object |
113
144
 
114
- ### `core` — 프레임워크 독립 (pure TS)
145
+ ### `core` — framework-independent (pure TS)
115
146
 
116
147
  | Subpath | Description |
117
148
  |---|---|
@@ -138,7 +169,7 @@ import { normalizeUrl } from '@withwiz/toolkit/core/utils/url-normalizer'
138
169
  | `/core/utils` | `sanitizer`, `type-guards`, `format-number`, `ip-utils`, `timezone`, ... |
139
170
  | `/core/validators` | Password strength validator |
140
171
 
141
- ### `next` — Next.js 의존
172
+ ### `next` — depends on Next.js
142
173
 
143
174
  | Subpath | Description |
144
175
  |---|---|
@@ -148,7 +179,7 @@ import { normalizeUrl } from '@withwiz/toolkit/core/utils/url-normalizer'
148
179
  | `/next/error` | `error-handler` (NextResponse), `LocaleDetector`, `ErrorBoundary` |
149
180
  | `/next/utils` | `api-helpers`, `cors`, `csv-export`, `error-processor` |
150
181
 
151
- ### `react` — React 의존
182
+ ### `react` — depends on React
152
183
 
153
184
  | Subpath | Description |
154
185
  |---|---|
@@ -157,11 +188,11 @@ import { normalizeUrl } from '@withwiz/toolkit/core/utils/url-normalizer'
157
188
  | `/react/error` | `error-display` (sonner toast) |
158
189
  | `/react/utils/{client-utils,qr-code}` | Browser-context utilities |
159
190
 
160
- ### `prisma` — Prisma 의존
191
+ ### `prisma` — depends on Prisma
161
192
 
162
193
  | Subpath | Description |
163
194
  |---|---|
164
- | `/prisma/auth-adapter` | `UserRepository` / `OAuthAccountRepository` / `EmailTokenRepository` Prisma 구현체 |
195
+ | `/prisma/auth-adapter` | Prisma implementations of `UserRepository` / `OAuthAccountRepository` / `EmailTokenRepository` |
165
196
 
166
197
  ## Requirements
167
198
 
@@ -170,15 +201,15 @@ import { normalizeUrl } from '@withwiz/toolkit/core/utils/url-normalizer'
170
201
 
171
202
  ### Optional peers
172
203
 
173
- `next` / `react` / `react-dom` `optional` peer dependency입니다.
174
- 사용하는 티어가 요구하는 peer만 설치하세요:
204
+ `next` / `react` / `react-dom` are `optional` peer dependencies.
205
+ Install only the peers required by the tiers you use:
175
206
 
176
- - `core` 티어만 쓰는 백엔드 / CLI: peer 불필요
177
- - `next` 티어: Next.js >= 15
178
- - `react` 티어: React >= 18, React-DOM >= 18
179
- - `prisma` 티어: Prisma 호환 클라이언트 (덕 타이핑)
180
- - Prisma 어댑터의 `EmailTokenRepository` 일부 모듈: `date-fns >= 3` (optional)
181
- - 이메일 전송: `nodemailer >= 6` (optional)
207
+ - Backend / CLI using only the `core` tier: no peers required
208
+ - `next` tier: Next.js >= 15
209
+ - `react` tier: React >= 18, React-DOM >= 18
210
+ - `prisma` tier: a Prisma-compatible client (duck-typed)
211
+ - Some modules such as the Prisma adapter's `EmailTokenRepository`: `date-fns >= 3` (optional)
212
+ - Email delivery: `nodemailer >= 6` (optional)
182
213
 
183
214
  ## Development
184
215
 
@@ -2,6 +2,9 @@ import {
2
2
  ERROR_CODES,
3
3
  formatErrorMessage
4
4
  } from "./chunk-XQIAXMRY.js";
5
+ import {
6
+ ROLE_DEFAULTS
7
+ } from "./chunk-7YWUKMZD.js";
5
8
 
6
9
  // src/next/utils/api-helpers.ts
7
10
  import { NextResponse } from "next/server";
@@ -73,8 +76,8 @@ function createPaginatedResponse(data, total, page, limit) {
73
76
  }
74
77
  });
75
78
  }
76
- function requireAdmin(userRole) {
77
- if (userRole !== "ADMIN") {
79
+ function requireAdmin(userRole, adminRole = ROLE_DEFAULTS.ADMIN_ROLE) {
80
+ if (userRole !== adminRole) {
78
81
  return {
79
82
  isAdmin: false,
80
83
  response: NextResponse.json(
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-PX535BHW.js";
7
7
  import {
8
8
  __spreadValues
9
- } from "./chunk-ORMEWXMH.js";
9
+ } from "./chunk-N3ETBM74.js";
10
10
 
11
11
  // src/next/utils/cors.ts
12
12
  import { NextResponse } from "next/server";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __spreadValues
3
- } from "./chunk-ORMEWXMH.js";
3
+ } from "./chunk-N3ETBM74.js";
4
4
 
5
5
  // src/core/utils/sanitizer.ts
6
6
  function sanitizeHtml(input) {
@@ -21,7 +21,10 @@ function removeEventHandlers(input) {
21
21
  if (!input || typeof input !== "string") {
22
22
  return "";
23
23
  }
24
- return input.replace(/\bon\w+\s*=\s*["'][^"']*["']/gi, "");
24
+ return input.replace(
25
+ /\bon\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,
26
+ ""
27
+ );
25
28
  }
26
29
  function sanitizeUrl(url) {
27
30
  if (!url || typeof url !== "string") {
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  PasswordHasher,
3
3
  PasswordValidator
4
- } from "./chunk-MNYVAEXK.js";
4
+ } from "./chunk-4ROIPF33.js";
5
5
  import {
6
6
  __spreadValues
7
- } from "./chunk-ORMEWXMH.js";
7
+ } from "./chunk-N3ETBM74.js";
8
8
 
9
9
  // src/core/auth/password/client-helper.ts
10
10
  var DEFAULT_PASSWORD_CONFIG = {
@@ -1,6 +1,9 @@
1
1
  // src/core/auth/password/index.ts
2
2
  import { z } from "zod";
3
3
  import bcrypt from "bcryptjs";
4
+ var BCRYPT_MAX_PASSWORD_BYTES = 72;
5
+ var utf8ByteLength = (value) => new TextEncoder().encode(value).length;
6
+ var BCRYPT_BYTE_LIMIT_MESSAGE = `Password cannot exceed ${BCRYPT_MAX_PASSWORD_BYTES} bytes`;
4
7
  var _PasswordValidator = class _PasswordValidator {
5
8
  constructor(config) {
6
9
  this.config = config;
@@ -20,6 +23,9 @@ var _PasswordValidator = class _PasswordValidator {
20
23
  `Password cannot exceed ${this.config.maxLength} characters`
21
24
  );
22
25
  }
26
+ if (utf8ByteLength(password) > BCRYPT_MAX_PASSWORD_BYTES) {
27
+ errors.push(BCRYPT_BYTE_LIMIT_MESSAGE);
28
+ }
23
29
  if (this.config.requireNumber && !/\d/.test(password)) {
24
30
  errors.push("Password must contain at least one number");
25
31
  }
@@ -119,7 +125,10 @@ var _PasswordValidator = class _PasswordValidator {
119
125
  "Password must contain at least one special character"
120
126
  );
121
127
  }
122
- return schema;
128
+ return schema.refine(
129
+ (value) => utf8ByteLength(value) <= BCRYPT_MAX_PASSWORD_BYTES,
130
+ { message: BCRYPT_BYTE_LIMIT_MESSAGE }
131
+ );
123
132
  }
124
133
  /**
125
134
  * 비밀번호 힌트 생성
@@ -201,11 +210,15 @@ var PasswordHasher = class {
201
210
  return bcrypt.compare(password, hash);
202
211
  }
203
212
  };
204
- var defaultPasswordSchema = z.string().min(8, "Password must be at least 8 characters long").max(128, "Password cannot exceed 128 characters").regex(/\d/, "Password must contain at least one number");
213
+ var defaultPasswordSchema = z.string().min(8, "Password must be at least 8 characters long").max(128, "Password cannot exceed 128 characters").regex(/\d/, "Password must contain at least one number").refine((value) => utf8ByteLength(value) <= BCRYPT_MAX_PASSWORD_BYTES, {
214
+ message: BCRYPT_BYTE_LIMIT_MESSAGE
215
+ });
205
216
  var strongPasswordSchema = z.string().min(12, "Password must be at least 12 characters long").max(128, "Password cannot exceed 128 characters").regex(/[a-z]/, "Password must contain at least one lowercase letter").regex(/[A-Z]/, "Password must contain at least one uppercase letter").regex(/\d/, "Password must contain at least one number").regex(
206
217
  /[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~`]/,
207
218
  "Password must contain at least one special character"
208
- );
219
+ ).refine((value) => utf8ByteLength(value) <= BCRYPT_MAX_PASSWORD_BYTES, {
220
+ message: BCRYPT_BYTE_LIMIT_MESSAGE
221
+ });
209
222
 
210
223
  export {
211
224
  PasswordValidator,
@@ -3,17 +3,17 @@ import {
3
3
  isRedisGloballyDisabled,
4
4
  notifyRedisError,
5
5
  resetRedisGlobalState
6
- } from "./chunk-PRWWB4QY.js";
6
+ } from "./chunk-ZEHNCHIV.js";
7
7
  import {
8
8
  logger
9
- } from "./chunk-KG65BFPK.js";
9
+ } from "./chunk-QAIN3WNN.js";
10
10
  import {
11
11
  getENV,
12
12
  isCacheEnabled
13
- } from "./chunk-2QVDB6UO.js";
13
+ } from "./chunk-HV6A6Z5R.js";
14
14
  import {
15
15
  __spreadValues
16
- } from "./chunk-ORMEWXMH.js";
16
+ } from "./chunk-N3ETBM74.js";
17
17
 
18
18
  // src/core/cache/redis-cache-manager.ts
19
19
  var RedisCacheManager = class _RedisCacheManager {
@@ -1,18 +1,19 @@
1
1
  import {
2
2
  JWTService
3
- } from "./chunk-2PFSRVVD.js";
4
- import {
5
- setTokenCookies
6
- } from "./chunk-2JGSS4RM.js";
3
+ } from "./chunk-LWHLB2Y6.js";
7
4
  import {
8
5
  AuthError
9
6
  } from "./chunk-5GWGARXI.js";
10
7
  import {
11
- JWT_DEFAULTS
12
- } from "./chunk-2SIBG5BG.js";
8
+ getTokenDeliveryStrategy
9
+ } from "./chunk-63EKUOJH.js";
10
+ import {
11
+ JWT_DEFAULTS,
12
+ ROLE_DEFAULTS
13
+ } from "./chunk-7YWUKMZD.js";
13
14
  import {
14
15
  __spreadValues
15
- } from "./chunk-ORMEWXMH.js";
16
+ } from "./chunk-N3ETBM74.js";
16
17
 
17
18
  // src/next/auth-handlers/login.handler.ts
18
19
  import { NextResponse } from "next/server";
@@ -22,9 +23,10 @@ var loginSchema = z.object({
22
23
  email: z.string().email(),
23
24
  password: z.string().min(1)
24
25
  });
26
+ var DUMMY_PASSWORD_HASH = "$2b$12$/l4jMXYcTL.SQgNWzy1UcuSlrtLlw.GFTpWDYTficzN2kRhN/LwEO";
25
27
  function createLoginHandler(options) {
26
28
  var _a, _b;
27
- const { dependencies, jwt, hooks, features, cookie } = options;
29
+ const { dependencies, jwt, hooks, features, cookie, tokenDelivery } = options;
28
30
  const jwtService = new JWTService({
29
31
  secret: jwt.secret,
30
32
  accessTokenExpiry: (_a = jwt.accessTokenExpiry) != null ? _a : JWT_DEFAULTS.DEFAULT_ACCESS_TOKEN_EXPIRES,
@@ -50,6 +52,7 @@ function createLoginHandler(options) {
50
52
  }
51
53
  const user = await dependencies.userRepository.findByEmail(email);
52
54
  if (!user) {
55
+ await compare(password, DUMMY_PASSWORD_HASH);
53
56
  return NextResponse.json({ success: false, error: "Invalid credentials" }, { status: 401 });
54
57
  }
55
58
  if (user.isActive === false) {
@@ -57,6 +60,7 @@ function createLoginHandler(options) {
57
60
  }
58
61
  const userRecord = user;
59
62
  if (!userRecord.password) {
63
+ await compare(password, DUMMY_PASSWORD_HASH);
60
64
  return NextResponse.json({ success: false, error: "Invalid credentials" }, { status: 401 });
61
65
  }
62
66
  const isValid = await compare(password, userRecord.password);
@@ -72,7 +76,7 @@ function createLoginHandler(options) {
72
76
  const tokens = await jwtService.createTokenPair({
73
77
  id: user.id,
74
78
  email: user.email,
75
- role: (_a2 = user.role) != null ? _a2 : "USER",
79
+ role: (_a2 = user.role) != null ? _a2 : ROLE_DEFAULTS.DEFAULT_ROLE,
76
80
  emailVerified: user.emailVerified
77
81
  });
78
82
  await dependencies.userRepository.updateLastLoginAt(user.id);
@@ -87,8 +91,11 @@ function createLoginHandler(options) {
87
91
  if (hooks == null ? void 0 : hooks.extendUserResponse) {
88
92
  userResponse = __spreadValues(__spreadValues({}, userResponse), await hooks.extendUserResponse(user));
89
93
  }
90
- const response = NextResponse.json({ success: true, user: userResponse, tokens });
91
- setTokenCookies(response, tokens, { secure: cookie == null ? void 0 : cookie.secure });
94
+ const strategy = getTokenDeliveryStrategy(tokenDelivery);
95
+ const response = NextResponse.json(
96
+ strategy.buildTokenResponse({ success: true, user: userResponse }, { tokens })
97
+ );
98
+ strategy.attachCookies(response, tokens, { secure: cookie == null ? void 0 : cookie.secure });
92
99
  return response;
93
100
  } catch (error) {
94
101
  if (error instanceof AuthError) {
@@ -1,3 +1,7 @@
1
+ import {
2
+ ROLE_DEFAULTS
3
+ } from "./chunk-7YWUKMZD.js";
4
+
1
5
  // src/core/auth/jwt/client.ts
2
6
  var JWTClientManager = class {
3
7
  constructor(storageKey = "jwt_tokens") {
@@ -136,10 +140,10 @@ var JWTClientManager = class {
136
140
  */
137
141
  getUserRole(token) {
138
142
  if (!token) {
139
- return "USER";
143
+ return ROLE_DEFAULTS.DEFAULT_ROLE;
140
144
  }
141
145
  const user = this.extractUserFromToken(token);
142
- return (user == null ? void 0 : user.role) || "USER";
146
+ return (user == null ? void 0 : user.role) || ROLE_DEFAULTS.DEFAULT_ROLE;
143
147
  }
144
148
  /**
145
149
  * Authorization 헤더 생성