@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,31 @@
1
+ import {
2
+ cn
3
+ } from "./chunk-62FLBG6B.js";
4
+
5
+ // src/components/ui/Alert.tsx
6
+ import { jsx } from "react/jsx-runtime";
7
+ function Alert({ variant = "default", children, className }) {
8
+ const variantClasses = {
9
+ default: "bg-background text-foreground",
10
+ destructive: "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"
11
+ };
12
+ return /* @__PURE__ */ jsx(
13
+ "div",
14
+ {
15
+ className: cn(
16
+ "relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",
17
+ variantClasses[variant],
18
+ className
19
+ ),
20
+ children
21
+ }
22
+ );
23
+ }
24
+ function AlertDescription({ children, className }) {
25
+ return /* @__PURE__ */ jsx("div", { className: cn("text-sm [&_p]:leading-relaxed", className), children });
26
+ }
27
+
28
+ export {
29
+ Alert,
30
+ AlertDescription
31
+ };
@@ -0,0 +1,62 @@
1
+ import {
2
+ logger
3
+ } from "./chunk-EZR55KV2.js";
4
+
5
+ // src/middleware/cors.ts
6
+ import { NextResponse } from "next/server";
7
+ var getAllowedOrigins = () => {
8
+ const nodeEnv = process.env.NODE_ENV;
9
+ if (nodeEnv === "production") {
10
+ return [
11
+ process.env.NEXT_PUBLIC_APP_URL || "https://tlog.net",
12
+ "https://www.tlog.net"
13
+ ].filter(Boolean);
14
+ }
15
+ return [
16
+ "http://localhost:3000",
17
+ "http://localhost:3001",
18
+ "http://127.0.0.1:3000",
19
+ process.env.NEXT_PUBLIC_APP_URL
20
+ ].filter(Boolean);
21
+ };
22
+ var corsMiddleware = async (context, next) => {
23
+ const { request } = context;
24
+ const origin = request.headers.get("origin");
25
+ const allowedOrigins = getAllowedOrigins();
26
+ if (request.method === "OPTIONS") {
27
+ const response2 = new NextResponse(null, { status: 204 });
28
+ if (origin && allowedOrigins.includes(origin)) {
29
+ response2.headers.set("Access-Control-Allow-Origin", origin);
30
+ } else if (allowedOrigins.includes("*")) {
31
+ response2.headers.set("Access-Control-Allow-Origin", "*");
32
+ }
33
+ response2.headers.set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, PATCH, OPTIONS");
34
+ response2.headers.set("Access-Control-Allow-Headers", "Content-Type, Authorization, X-Requested-With, X-API-Key");
35
+ response2.headers.set("Access-Control-Max-Age", "86400");
36
+ response2.headers.set("Access-Control-Allow-Credentials", "true");
37
+ return response2;
38
+ }
39
+ const response = await next();
40
+ if (origin && allowedOrigins.includes(origin)) {
41
+ response.headers.set("Access-Control-Allow-Origin", origin);
42
+ response.headers.set("Access-Control-Allow-Credentials", "true");
43
+ } else if (allowedOrigins.includes("*") || process.env.NODE_ENV === "test") {
44
+ response.headers.set("Access-Control-Allow-Origin", origin || "*");
45
+ response.headers.set("Access-Control-Allow-Credentials", "true");
46
+ }
47
+ response.headers.set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, PATCH, OPTIONS");
48
+ response.headers.set("Access-Control-Allow-Headers", "Content-Type, Authorization, X-Requested-With, X-API-Key");
49
+ return response;
50
+ };
51
+ function validateCorsConfiguration() {
52
+ const allowedOrigins = getAllowedOrigins();
53
+ const nodeEnv = process.env.NODE_ENV;
54
+ logger.info(
55
+ `[CORS Middleware] \u2705 Initialized - Environment: ${nodeEnv}, Allowed Origins: [${allowedOrigins.join(", ")}]`
56
+ );
57
+ }
58
+
59
+ export {
60
+ corsMiddleware,
61
+ validateCorsConfiguration
62
+ };
@@ -0,0 +1,71 @@
1
+ import {
2
+ BaseTransport
3
+ } from "./chunk-HGC4CCKB.js";
4
+
5
+ // src/error/logging/transports/console.ts
6
+ var COLORS = {
7
+ ["debug" /* DEBUG */]: "\x1B[36m",
8
+ // Cyan
9
+ ["info" /* INFO */]: "\x1B[32m",
10
+ // Green
11
+ ["warn" /* WARN */]: "\x1B[33m",
12
+ // Yellow
13
+ ["error" /* ERROR */]: "\x1B[31m",
14
+ // Red
15
+ ["critical" /* CRITICAL */]: "\x1B[35m",
16
+ // Magenta
17
+ reset: "\x1B[0m"
18
+ };
19
+ var ConsoleTransport = class extends BaseTransport {
20
+ constructor(options = {}) {
21
+ super("console", options.enabled !== false);
22
+ this.colorize = options.colorize !== false;
23
+ this.includeTimestamp = options.includeTimestamp !== false;
24
+ }
25
+ async log(entry) {
26
+ const formatted = this.format(entry);
27
+ this.output(entry.level, formatted);
28
+ }
29
+ /**
30
+ * 로그 포맷팅
31
+ */
32
+ format(entry) {
33
+ const parts = [];
34
+ if (this.includeTimestamp) {
35
+ parts.push(`[${entry.timestamp.toISOString()}]`);
36
+ }
37
+ const levelText = this.colorize ? `${COLORS[entry.level]}${entry.level.toUpperCase()}${COLORS.reset}` : entry.level.toUpperCase();
38
+ parts.push(`[${levelText}]`);
39
+ parts.push(entry.message);
40
+ if (Object.keys(entry.context).length > 0) {
41
+ parts.push(JSON.stringify(entry.context, null, 2));
42
+ }
43
+ if (entry.error && entry.error.stack) {
44
+ parts.push(`
45
+ Stack: ${entry.error.stack}`);
46
+ }
47
+ return parts.join(" ");
48
+ }
49
+ /**
50
+ * 콘솔 출력
51
+ */
52
+ output(level, message) {
53
+ switch (level) {
54
+ case "debug" /* DEBUG */:
55
+ case "info" /* INFO */:
56
+ console.log(message);
57
+ break;
58
+ case "warn" /* WARN */:
59
+ console.warn(message);
60
+ break;
61
+ case "error" /* ERROR */:
62
+ case "critical" /* CRITICAL */:
63
+ console.error(message);
64
+ break;
65
+ }
66
+ }
67
+ };
68
+
69
+ export {
70
+ ConsoleTransport
71
+ };
@@ -0,0 +1,53 @@
1
+ import {
2
+ PasswordHasher,
3
+ PasswordValidator
4
+ } from "./chunk-IHXRF3BH.js";
5
+ import {
6
+ __spreadValues
7
+ } from "./chunk-ORMEWXMH.js";
8
+
9
+ // src/auth/core/password/client-helper.ts
10
+ var DEFAULT_PASSWORD_CONFIG = {
11
+ minLength: 8,
12
+ maxLength: 128,
13
+ requireNumber: true,
14
+ requireUppercase: true,
15
+ requireLowercase: true,
16
+ requireSpecialChar: true,
17
+ bcryptRounds: 12
18
+ };
19
+ function createPasswordValidator(config) {
20
+ const fullConfig = __spreadValues(__spreadValues({}, DEFAULT_PASSWORD_CONFIG), config);
21
+ return new PasswordValidator(fullConfig);
22
+ }
23
+ function validatePassword(password, config) {
24
+ const validator = createPasswordValidator(config);
25
+ return validator.validate(password);
26
+ }
27
+ function getPasswordStrength(password, config) {
28
+ const validator = createPasswordValidator(config);
29
+ return validator.calculateStrength(password);
30
+ }
31
+ function createPasswordSchema(config) {
32
+ const validator = createPasswordValidator(config);
33
+ return validator.createZodSchema();
34
+ }
35
+ var defaultPasswordSchema = createPasswordSchema(DEFAULT_PASSWORD_CONFIG);
36
+ var passwordValidator = createPasswordValidator(DEFAULT_PASSWORD_CONFIG);
37
+ function createPasswordHasher(rounds = 12) {
38
+ if (typeof window !== "undefined") {
39
+ console.warn("\u26A0\uFE0F WARNING: Password hashing should only be done on the server!");
40
+ }
41
+ return new PasswordHasher(rounds);
42
+ }
43
+
44
+ export {
45
+ DEFAULT_PASSWORD_CONFIG,
46
+ createPasswordValidator,
47
+ validatePassword,
48
+ getPasswordStrength,
49
+ createPasswordSchema,
50
+ defaultPasswordSchema,
51
+ passwordValidator,
52
+ createPasswordHasher
53
+ };
@@ -0,0 +1,257 @@
1
+ import {
2
+ runCommand,
3
+ runMacCommand
4
+ } from "./chunk-KWTBD4CM.js";
5
+ import {
6
+ logger
7
+ } from "./chunk-EZR55KV2.js";
8
+
9
+ // src/system/memory.ts
10
+ import os from "os";
11
+ function bytesToMB(bytes) {
12
+ return Math.round(bytes / 1024 / 1024 * 100) / 100;
13
+ }
14
+ async function getMemoryInfo() {
15
+ try {
16
+ const platform = os.platform();
17
+ let total = 0;
18
+ let free = 0;
19
+ let used = 0;
20
+ let percent = 0;
21
+ let processUsed = 0;
22
+ if (platform === "darwin") {
23
+ try {
24
+ const memsizeOutput = await runMacCommand("sysctl -n hw.memsize");
25
+ total = parseInt(memsizeOutput.trim()) || 0;
26
+ if (total > 0) {
27
+ const vmstatOutput = await runMacCommand("vm_stat");
28
+ const lines = vmstatOutput.split("\n");
29
+ let freePages = 0;
30
+ let activePages = 0;
31
+ let inactivePages = 0;
32
+ let wiredPages = 0;
33
+ let compressedPages = 0;
34
+ let speculativePages = 0;
35
+ let purgeablePages = 0;
36
+ for (const line of lines) {
37
+ if (line.includes("Pages free:")) {
38
+ const match = line.match(/Pages free:\s+(\d+)/);
39
+ if (match) freePages = parseInt(match[1]) || 0;
40
+ } else if (line.includes("Pages active:")) {
41
+ const match = line.match(/Pages active:\s+(\d+)/);
42
+ if (match) activePages = parseInt(match[1]) || 0;
43
+ } else if (line.includes("Pages inactive:")) {
44
+ const match = line.match(/Pages inactive:\s+(\d+)/);
45
+ if (match) inactivePages = parseInt(match[1]) || 0;
46
+ } else if (line.includes("Pages wired down:")) {
47
+ const match = line.match(/Pages wired down:\s+(\d+)/);
48
+ if (match) wiredPages = parseInt(match[1]) || 0;
49
+ } else if (line.includes("Pages occupied by compressor:")) {
50
+ const match = line.match(/Pages occupied by compressor:\s+(\d+)/);
51
+ if (match) compressedPages = parseInt(match[1]) || 0;
52
+ } else if (line.includes("Pages speculative:")) {
53
+ const match = line.match(/Pages speculative:\s+(\d+)/);
54
+ if (match) speculativePages = parseInt(match[1]) || 0;
55
+ } else if (line.includes("Pages purgeable:")) {
56
+ const match = line.match(/Pages purgeable:\s+(\d+)/);
57
+ if (match) purgeablePages = parseInt(match[1]) || 0;
58
+ }
59
+ }
60
+ let pageSize = 16384;
61
+ try {
62
+ const pageSizeOutput = await runMacCommand("sysctl -n hw.pagesize");
63
+ pageSize = parseInt(pageSizeOutput.trim()) || 16384;
64
+ } catch (e) {
65
+ }
66
+ const usedMemory = (activePages + wiredPages + compressedPages + speculativePages) * pageSize;
67
+ const availableMemory = (freePages + inactivePages + purgeablePages) * pageSize;
68
+ free = availableMemory;
69
+ used = usedMemory;
70
+ percent = total > 0 ? used / total * 100 : 0;
71
+ } else {
72
+ throw new Error("Cannot get memory size with sysctl.");
73
+ }
74
+ } catch (error) {
75
+ logger.debug("macOS memory info fetch failed:", error);
76
+ try {
77
+ const topOutput = await runMacCommand("top -l 1 -n 0 | grep 'PhysMem'");
78
+ const memMatch = topOutput.match(/PhysMem:\s+(\d+)G used\s+\((\d+)M wired,\s+(\d+)M compressor\),\s+(\d+)M unused/);
79
+ if (memMatch) {
80
+ const usedGB = parseInt(memMatch[1]) || 0;
81
+ const wiredMB = parseInt(memMatch[2]) || 0;
82
+ const compressorMB = parseInt(memMatch[3]) || 0;
83
+ const unusedMB = parseInt(memMatch[4]) || 0;
84
+ total = (usedGB * 1024 + unusedMB) * 1024 * 1024;
85
+ used = usedGB * 1024 * 1024 * 1024;
86
+ free = unusedMB * 1024 * 1024;
87
+ percent = total > 0 ? used / total * 100 : 0;
88
+ } else {
89
+ const memMatchMB = topOutput.match(/PhysMem:\s+(\d+)M used,\s+(\d+)M wired,\s+(\d+)M unused/);
90
+ if (memMatchMB) {
91
+ const usedMB = parseInt(memMatchMB[1]) || 0;
92
+ const wiredMB = parseInt(memMatchMB[2]) || 0;
93
+ const unusedMB = parseInt(memMatchMB[3]) || 0;
94
+ total = (usedMB + wiredMB + unusedMB) * 1024 * 1024;
95
+ used = (usedMB + wiredMB) * 1024 * 1024;
96
+ free = unusedMB * 1024 * 1024;
97
+ percent = total > 0 ? used / total * 100 : 0;
98
+ } else {
99
+ throw new Error("Cannot parse memory info with top command.");
100
+ }
101
+ }
102
+ } catch (topError) {
103
+ logger.debug("top fallback failed:", topError);
104
+ try {
105
+ const profilerOutput = await runMacCommand("system_profiler SPHardwareDataType | grep 'Memory:'");
106
+ const memMatch = profilerOutput.match(/Memory:\s+(\d+)\s+GB/);
107
+ if (memMatch) {
108
+ const totalGB = parseInt(memMatch[1]) || 0;
109
+ total = totalGB * 1024 * 1024 * 1024;
110
+ free = total * 0.2;
111
+ used = total * 0.8;
112
+ percent = 80;
113
+ } else {
114
+ throw new Error("Cannot parse memory info with system_profiler.");
115
+ }
116
+ } catch (profilerError) {
117
+ logger.debug("system_profiler fallback failed:", profilerError);
118
+ try {
119
+ const osTotal = os.totalmem();
120
+ if (osTotal > 0) {
121
+ total = osTotal;
122
+ const osFree = os.freemem();
123
+ free = osFree;
124
+ used = total - free;
125
+ percent = total > 0 ? used / total * 100 : 0;
126
+ } else {
127
+ throw new Error("Cannot get memory info with os module.");
128
+ }
129
+ } catch (osError) {
130
+ logger.debug("os module fallback failed:", osError);
131
+ throw new Error("All memory info retrieval methods failed.");
132
+ }
133
+ }
134
+ }
135
+ }
136
+ } else {
137
+ try {
138
+ const meminfoOutput = await runCommand("cat /proc/meminfo");
139
+ const lines = meminfoOutput.split("\n");
140
+ let memTotal = 0;
141
+ let memAvailable = 0;
142
+ let memFree = 0;
143
+ let buffers = 0;
144
+ let cached = 0;
145
+ let slab = 0;
146
+ for (const line of lines) {
147
+ if (line.includes("MemTotal:")) {
148
+ const match = line.match(/MemTotal:\s+(\d+)/);
149
+ if (match) memTotal = parseInt(match[1]) * 1024;
150
+ } else if (line.includes("MemAvailable:")) {
151
+ const match = line.match(/MemAvailable:\s+(\d+)/);
152
+ if (match) memAvailable = parseInt(match[1]) * 1024;
153
+ } else if (line.includes("MemFree:")) {
154
+ const match = line.match(/MemFree:\s+(\d+)/);
155
+ if (match) memFree = parseInt(match[1]) * 1024;
156
+ } else if (line.includes("Buffers:")) {
157
+ const match = line.match(/Buffers:\s+(\d+)/);
158
+ if (match) buffers = parseInt(match[1]) * 1024;
159
+ } else if (line.includes("Cached:")) {
160
+ const match = line.match(/Cached:\s+(\d+)/);
161
+ if (match) cached = parseInt(match[1]) * 1024;
162
+ } else if (line.includes("Slab:")) {
163
+ const match = line.match(/Slab:\s+(\d+)/);
164
+ if (match) slab = parseInt(match[1]) * 1024;
165
+ }
166
+ }
167
+ total = memTotal;
168
+ if (memAvailable > 0) {
169
+ free = memAvailable;
170
+ used = total - free;
171
+ } else {
172
+ const reclaimable = buffers + cached + slab;
173
+ free = memFree + reclaimable;
174
+ used = total - free;
175
+ }
176
+ percent = total > 0 ? used / total * 100 : 0;
177
+ } catch (error) {
178
+ logger.debug("Linux memory info fetch failed:", error);
179
+ try {
180
+ const freeOutput = await runCommand("free -b | grep '^Mem:'");
181
+ const parts = freeOutput.trim().split(/\s+/);
182
+ if (parts.length >= 4) {
183
+ total = parseInt(parts[1]) || 0;
184
+ used = parseInt(parts[2]) || 0;
185
+ free = parseInt(parts[3]) || 0;
186
+ percent = total > 0 ? used / total * 100 : 0;
187
+ } else {
188
+ throw new Error("Cannot parse free command output.");
189
+ }
190
+ } catch (freeError) {
191
+ logger.debug("free fallback failed:", freeError);
192
+ try {
193
+ const vmstatOutput = await runCommand("vmstat -s | head -10");
194
+ const lines = vmstatOutput.split("\n");
195
+ let totalKB = 0;
196
+ let freeKB = 0;
197
+ for (const line of lines) {
198
+ if (line.includes("total memory")) {
199
+ const match = line.match(/(\d+)\s+total memory/);
200
+ if (match) totalKB = parseInt(match[1]) || 0;
201
+ } else if (line.includes("free memory")) {
202
+ const match = line.match(/(\d+)\s+free memory/);
203
+ if (match) freeKB = parseInt(match[1]) || 0;
204
+ }
205
+ }
206
+ if (totalKB > 0) {
207
+ total = totalKB * 1024;
208
+ free = freeKB * 1024;
209
+ used = total - free;
210
+ percent = total > 0 ? used / total * 100 : 0;
211
+ } else {
212
+ throw new Error("Cannot parse memory info with vmstat.");
213
+ }
214
+ } catch (vmstatError) {
215
+ logger.debug("vmstat fallback failed:", vmstatError);
216
+ try {
217
+ const osTotal = os.totalmem();
218
+ if (osTotal > 0) {
219
+ total = osTotal;
220
+ const osFree = os.freemem();
221
+ free = osFree;
222
+ used = total - free;
223
+ percent = total > 0 ? used / total * 100 : 0;
224
+ } else {
225
+ throw new Error("Cannot get memory info with os module.");
226
+ }
227
+ } catch (osError) {
228
+ logger.debug("os module fallback failed:", osError);
229
+ throw new Error("All memory info retrieval methods failed.");
230
+ }
231
+ }
232
+ }
233
+ }
234
+ }
235
+ try {
236
+ const memUsage = process.memoryUsage();
237
+ processUsed = memUsage.rss;
238
+ } catch (error) {
239
+ logger.debug("Process memory usage fetch failed:", error);
240
+ processUsed = 0;
241
+ }
242
+ return {
243
+ total: bytesToMB(total),
244
+ free: bytesToMB(free),
245
+ used: bytesToMB(used),
246
+ percent: Math.round(percent * 100) / 100,
247
+ processUsed: bytesToMB(processUsed)
248
+ };
249
+ } catch (error) {
250
+ logger.error("Memory info fetch error:", error);
251
+ throw error;
252
+ }
253
+ }
254
+
255
+ export {
256
+ getMemoryInfo
257
+ };
@@ -0,0 +1,132 @@
1
+ import {
2
+ __spreadValues
3
+ } from "./chunk-ORMEWXMH.js";
4
+
5
+ // src/utils/cors.ts
6
+ import { NextResponse } from "next/server";
7
+ var globalCorsConfig = {
8
+ isDevelopment: process.env.NODE_ENV === "development"
9
+ };
10
+ function initCorsConfig(config) {
11
+ globalCorsConfig = __spreadValues(__spreadValues({}, globalCorsConfig), config);
12
+ }
13
+ function getCorsConfig() {
14
+ return globalCorsConfig;
15
+ }
16
+ function extractDomainsFromUrl(url) {
17
+ try {
18
+ const urlObj = new URL(url);
19
+ const hostname = urlObj.hostname;
20
+ const protocol = urlObj.protocol;
21
+ const port = urlObj.port ? `:${urlObj.port}` : "";
22
+ const domains = [`${protocol}//${hostname}${port}`];
23
+ if (!hostname.startsWith("www.")) {
24
+ domains.push(`${protocol}//www.${hostname}${port}`);
25
+ }
26
+ return domains;
27
+ } catch (e) {
28
+ return [];
29
+ }
30
+ }
31
+ function getBaseUrl() {
32
+ return globalCorsConfig.baseUrl || process.env.BASE_URL || process.env.NEXT_PUBLIC_BASE_URL || "http://localhost:3000";
33
+ }
34
+ function getAllowedOrigins() {
35
+ const origins = /* @__PURE__ */ new Set();
36
+ if (process.env.ALLOWED_ORIGINS) {
37
+ const envOrigins = process.env.ALLOWED_ORIGINS.split(",").map((origin) => origin.trim()).filter(Boolean);
38
+ envOrigins.forEach((origin) => origins.add(origin));
39
+ }
40
+ const baseUrl = getBaseUrl();
41
+ if (baseUrl && baseUrl !== "http://localhost:3000") {
42
+ const extractedDomains = extractDomainsFromUrl(baseUrl);
43
+ extractedDomains.forEach((domain) => origins.add(domain));
44
+ }
45
+ if (globalCorsConfig.additionalOrigins) {
46
+ globalCorsConfig.additionalOrigins.forEach((origin) => origins.add(origin));
47
+ }
48
+ if (globalCorsConfig.isDevelopment || process.env.NODE_ENV === "development") {
49
+ origins.add("http://localhost:3000");
50
+ origins.add("http://127.0.0.1:3000");
51
+ }
52
+ return Array.from(origins).filter(Boolean);
53
+ }
54
+ function isOriginAllowed(origin) {
55
+ if (!origin) return true;
56
+ const isDev = globalCorsConfig.isDevelopment || process.env.NODE_ENV === "development";
57
+ if (isDev && origin.includes("localhost")) {
58
+ return true;
59
+ }
60
+ return getAllowedOrigins().includes(origin);
61
+ }
62
+ function setCorsHeaders(response, request) {
63
+ const origin = request == null ? void 0 : request.headers.get("origin");
64
+ if (isOriginAllowed(origin)) {
65
+ response.headers.set("Access-Control-Allow-Origin", origin || "*");
66
+ }
67
+ response.headers.set("Access-Control-Allow-Methods", "GET, POST, PUT, PATCH, DELETE, OPTIONS");
68
+ response.headers.set(
69
+ "Access-Control-Allow-Headers",
70
+ "Content-Type, Authorization, X-Requested-With, Accept, Origin"
71
+ );
72
+ response.headers.set("Access-Control-Max-Age", "86400");
73
+ response.headers.set("Access-Control-Allow-Credentials", "true");
74
+ return response;
75
+ }
76
+ function withCORS(handler) {
77
+ return async (request) => {
78
+ if (request.method === "OPTIONS") {
79
+ const response2 = new NextResponse(null, { status: 200 });
80
+ return setCorsHeaders(response2, request);
81
+ }
82
+ const response = await handler(request);
83
+ const nextResponse = response instanceof NextResponse ? response : new NextResponse(response.body, response);
84
+ return setCorsHeaders(nextResponse, request);
85
+ };
86
+ }
87
+ function withRestrictedCORS(handler, allowedOrigins = []) {
88
+ return async (request) => {
89
+ const origin = request.headers.get("origin");
90
+ const restrictedAllowedOrigins = [
91
+ ...getAllowedOrigins(),
92
+ ...allowedOrigins
93
+ ];
94
+ if (origin && !restrictedAllowedOrigins.includes(origin)) {
95
+ return new NextResponse("CORS policy violation", { status: 403 });
96
+ }
97
+ if (request.method === "OPTIONS") {
98
+ const response2 = new NextResponse(null, { status: 200 });
99
+ return setCorsHeaders(response2, request);
100
+ }
101
+ const response = await handler(request);
102
+ const nextResponse = response instanceof NextResponse ? response : new NextResponse(response.body, response);
103
+ return setCorsHeaders(nextResponse, request);
104
+ };
105
+ }
106
+ function withPublicCORS(handler) {
107
+ return async (request) => {
108
+ if (request.method === "OPTIONS") {
109
+ const response2 = new NextResponse(null, { status: 200 });
110
+ response2.headers.set("Access-Control-Allow-Origin", "*");
111
+ response2.headers.set("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
112
+ response2.headers.set("Access-Control-Allow-Headers", "Content-Type");
113
+ response2.headers.set("Access-Control-Max-Age", "86400");
114
+ return response2;
115
+ }
116
+ const response = await handler(request);
117
+ const nextResponse = response instanceof NextResponse ? response : new NextResponse(response.body, response);
118
+ nextResponse.headers.set("Access-Control-Allow-Origin", "*");
119
+ return nextResponse;
120
+ };
121
+ }
122
+
123
+ export {
124
+ initCorsConfig,
125
+ getCorsConfig,
126
+ getAllowedOrigins,
127
+ isOriginAllowed,
128
+ setCorsHeaders,
129
+ withCORS,
130
+ withRestrictedCORS,
131
+ withPublicCORS
132
+ };
@@ -0,0 +1,55 @@
1
+ // src/auth/core/email/token-generator.ts
2
+ import crypto from "crypto";
3
+ var TokenGenerator = class {
4
+ /**
5
+ * 안전한 랜덤 토큰 생성
6
+ *
7
+ * @param bytes - 바이트 수 (기본: 32)
8
+ * @returns 16진수 문자열 토큰
9
+ */
10
+ static generate(bytes = 32) {
11
+ return crypto.randomBytes(bytes).toString("hex");
12
+ }
13
+ /**
14
+ * URL-safe 토큰 생성 (Base64URL)
15
+ *
16
+ * @param bytes - 바이트 수 (기본: 32)
17
+ * @returns URL-safe 토큰
18
+ */
19
+ static generateUrlSafe(bytes = 32) {
20
+ return crypto.randomBytes(bytes).toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
21
+ }
22
+ /**
23
+ * 숫자 PIN 코드 생성
24
+ *
25
+ * @param length - PIN 길이 (기본: 6)
26
+ * @returns 숫자 PIN 코드
27
+ */
28
+ static generatePIN(length = 6) {
29
+ const max = Math.pow(10, length);
30
+ const pin = crypto.randomInt(0, max);
31
+ return pin.toString().padStart(length, "0");
32
+ }
33
+ /**
34
+ * 만료 시간 계산
35
+ *
36
+ * @param milliseconds - 만료까지의 밀리초
37
+ * @returns 만료 Date 객체
38
+ */
39
+ static calculateExpiry(milliseconds) {
40
+ return new Date(Date.now() + milliseconds);
41
+ }
42
+ /**
43
+ * 토큰이 만료되었는지 확인
44
+ *
45
+ * @param expiryDate - 만료 Date
46
+ * @returns 만료 여부
47
+ */
48
+ static isExpired(expiryDate) {
49
+ return /* @__PURE__ */ new Date() > expiryDate;
50
+ }
51
+ };
52
+
53
+ export {
54
+ TokenGenerator
55
+ };