@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,54 @@
1
+ import {
2
+ enMessages
3
+ } from "./chunk-N4YGR5WH.js";
4
+ import {
5
+ koMessages
6
+ } from "./chunk-KXAWBFJN.js";
7
+
8
+ // src/error/messages/index.ts
9
+ var messageRegistry = {
10
+ ko: koMessages,
11
+ en: enMessages,
12
+ ja: koMessages
13
+ // Fallback to Korean for now
14
+ };
15
+ var defaultMessages = {
16
+ ko: {
17
+ title: "\uBB38\uC81C\uAC00 \uBC1C\uC0DD\uD588\uC5B4\uC694",
18
+ description: "\uC608\uC0C1\uCE58 \uBABB\uD55C \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.",
19
+ action: "\uC7A0\uC2DC \uD6C4 \uB2E4\uC2DC \uC2DC\uB3C4\uD574 \uC8FC\uC138\uC694."
20
+ },
21
+ en: {
22
+ title: "Something went wrong",
23
+ description: "An unexpected error occurred.",
24
+ action: "Please try again later."
25
+ },
26
+ ja: {
27
+ title: "\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F",
28
+ description: "\u4E88\u671F\u3057\u306A\u3044\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002",
29
+ action: "\u3057\u3070\u3089\u304F\u3057\u3066\u304B\u3089\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002"
30
+ }
31
+ };
32
+ function getErrorMessage(code, locale = "ko") {
33
+ const messages = messageRegistry[locale] || messageRegistry.ko;
34
+ return messages[code] || defaultMessages[locale] || defaultMessages.ko;
35
+ }
36
+ function getAllMessages(locale = "ko") {
37
+ return messageRegistry[locale] || messageRegistry.ko;
38
+ }
39
+ function hasMessage(code, locale = "ko") {
40
+ const messages = messageRegistry[locale] || messageRegistry.ko;
41
+ return code in messages;
42
+ }
43
+ var supportedLocales = ["ko", "en", "ja"];
44
+ function isLocaleSupported(locale) {
45
+ return supportedLocales.includes(locale);
46
+ }
47
+
48
+ export {
49
+ getErrorMessage,
50
+ getAllMessages,
51
+ hasMessage,
52
+ supportedLocales,
53
+ isLocaleSupported
54
+ };
@@ -0,0 +1,139 @@
1
+ import {
2
+ BaseTransport
3
+ } from "./chunk-HGC4CCKB.js";
4
+
5
+ // src/error/logging/transports/slack.ts
6
+ var LEVEL_COLORS = {
7
+ ["debug" /* DEBUG */]: "#36a64f",
8
+ // Green
9
+ ["info" /* INFO */]: "#2196F3",
10
+ // Blue
11
+ ["warn" /* WARN */]: "#FFC107",
12
+ // Amber
13
+ ["error" /* ERROR */]: "#F44336",
14
+ // Red
15
+ ["critical" /* CRITICAL */]: "#9C27B0"
16
+ // Purple
17
+ };
18
+ var SlackTransport = class extends BaseTransport {
19
+ constructor(options = {}) {
20
+ const webhookUrl = options.webhookUrl || process.env.SLACK_WEBHOOK_URL;
21
+ super("slack", Boolean(webhookUrl) && options.enabled !== false);
22
+ this.webhookUrl = webhookUrl;
23
+ this.minLevel = options.minLevel || "critical" /* CRITICAL */;
24
+ this.channel = options.channel;
25
+ this.username = options.username || "Error Logger";
26
+ this.iconEmoji = options.iconEmoji || ":rotating_light:";
27
+ }
28
+ async log(entry) {
29
+ if (!this.webhookUrl) {
30
+ return;
31
+ }
32
+ if (!this.shouldLog(entry.level)) {
33
+ return;
34
+ }
35
+ try {
36
+ const payload = this.buildPayload(entry);
37
+ const response = await fetch(this.webhookUrl, {
38
+ method: "POST",
39
+ headers: {
40
+ "Content-Type": "application/json"
41
+ },
42
+ body: JSON.stringify(payload)
43
+ });
44
+ if (!response.ok) {
45
+ throw new Error(`Slack webhook failed: ${response.statusText}`);
46
+ }
47
+ } catch (error) {
48
+ console.error("[SlackTransport] Failed to send to Slack:", error);
49
+ }
50
+ }
51
+ /**
52
+ * Slack 메시지 페이로드 생성
53
+ */
54
+ buildPayload(entry) {
55
+ const payload = {
56
+ username: this.username,
57
+ icon_emoji: this.iconEmoji
58
+ };
59
+ if (this.channel) {
60
+ payload.channel = this.channel;
61
+ }
62
+ const attachment = {
63
+ color: LEVEL_COLORS[entry.level],
64
+ title: `${entry.level.toUpperCase()}: ${entry.message}`,
65
+ timestamp: Math.floor(entry.timestamp.getTime() / 1e3),
66
+ fields: []
67
+ };
68
+ if (entry.context.requestId) {
69
+ attachment.fields.push({
70
+ title: "Request ID",
71
+ value: entry.context.requestId,
72
+ short: true
73
+ });
74
+ }
75
+ if (entry.context.errorCode) {
76
+ attachment.fields.push({
77
+ title: "Error Code",
78
+ value: entry.context.errorCode,
79
+ short: true
80
+ });
81
+ }
82
+ if (entry.context.userId) {
83
+ attachment.fields.push({
84
+ title: "User ID",
85
+ value: entry.context.userId,
86
+ short: true
87
+ });
88
+ }
89
+ if (entry.context.environment) {
90
+ attachment.fields.push({
91
+ title: "Environment",
92
+ value: entry.context.environment,
93
+ short: true
94
+ });
95
+ }
96
+ if (entry.context.path) {
97
+ attachment.fields.push({
98
+ title: "Path",
99
+ value: entry.context.path,
100
+ short: false
101
+ });
102
+ }
103
+ if (entry.error && entry.error.stack) {
104
+ attachment.fields.push({
105
+ title: "Stack Trace",
106
+ value: `\`\`\`${this.truncate(entry.error.stack, 1e3)}\`\`\``,
107
+ short: false
108
+ });
109
+ }
110
+ payload.attachments = [attachment];
111
+ return payload;
112
+ }
113
+ /**
114
+ * 문자열 자르기
115
+ */
116
+ truncate(str, maxLength) {
117
+ if (str.length <= maxLength) {
118
+ return str;
119
+ }
120
+ return str.substring(0, maxLength) + "...";
121
+ }
122
+ /**
123
+ * 로그 레벨 체크
124
+ */
125
+ shouldLog(level) {
126
+ const LOG_LEVEL_PRIORITY = {
127
+ ["debug" /* DEBUG */]: 0,
128
+ ["info" /* INFO */]: 1,
129
+ ["warn" /* WARN */]: 2,
130
+ ["error" /* ERROR */]: 3,
131
+ ["critical" /* CRITICAL */]: 4
132
+ };
133
+ return LOG_LEVEL_PRIORITY[level] >= LOG_LEVEL_PRIORITY[this.minLevel];
134
+ }
135
+ };
136
+
137
+ export {
138
+ SlackTransport
139
+ };
@@ -0,0 +1,180 @@
1
+ // src/utils/type-guards.ts
2
+ function isNotNull(value) {
3
+ return value !== null;
4
+ }
5
+ function isDefined(value) {
6
+ return value !== void 0;
7
+ }
8
+ function isPresent(value) {
9
+ return value !== null && value !== void 0;
10
+ }
11
+ function isString(value) {
12
+ return typeof value === "string";
13
+ }
14
+ function isNumber(value) {
15
+ return typeof value === "number" && !isNaN(value);
16
+ }
17
+ function isBoolean(value) {
18
+ return typeof value === "boolean";
19
+ }
20
+ function isObject(value) {
21
+ return typeof value === "object" && value !== null && !Array.isArray(value);
22
+ }
23
+ function isArray(value) {
24
+ return Array.isArray(value);
25
+ }
26
+ function isFunction(value) {
27
+ return typeof value === "function";
28
+ }
29
+ function isValidEmail(value) {
30
+ if (typeof value !== "string") return false;
31
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
32
+ return emailRegex.test(value);
33
+ }
34
+ function isValidUrl(value) {
35
+ if (typeof value !== "string") return false;
36
+ try {
37
+ new URL(value);
38
+ return true;
39
+ } catch (e) {
40
+ return false;
41
+ }
42
+ }
43
+ function isIPv4(value) {
44
+ if (typeof value !== "string") return false;
45
+ const ipv4Regex = /^(\d{1,3}\.){3}\d{1,3}$/;
46
+ if (!ipv4Regex.test(value)) return false;
47
+ const parts = value.split(".");
48
+ return parts.every((part) => {
49
+ const num = parseInt(part, 10);
50
+ return num >= 0 && num <= 255;
51
+ });
52
+ }
53
+ function isIPv6(value) {
54
+ if (typeof value !== "string") return false;
55
+ const ipv6Regex = /^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$|^(([0-9a-fA-F]{1,4}:)*)?::([0-9a-fA-F]{1,4}:)*[0-9a-fA-F]{1,4}$/;
56
+ return ipv6Regex.test(value);
57
+ }
58
+ function isIPAddress(value) {
59
+ return isIPv4(value) || isIPv6(value);
60
+ }
61
+ function isValidDate(value) {
62
+ return value instanceof Date && !isNaN(value.getTime());
63
+ }
64
+ function isISODateString(value) {
65
+ if (typeof value !== "string") return false;
66
+ const date = new Date(value);
67
+ return !isNaN(date.getTime()) && value === date.toISOString();
68
+ }
69
+ function isDateParseable(value) {
70
+ if (value instanceof Date) return isValidDate(value);
71
+ if (typeof value === "number") return !isNaN(new Date(value).getTime());
72
+ if (typeof value === "string") return !isNaN(new Date(value).getTime());
73
+ return false;
74
+ }
75
+ function isSortOrder(value) {
76
+ return value === "asc" || value === "desc";
77
+ }
78
+ function isApiSuccessResponse(response) {
79
+ return response.success === true;
80
+ }
81
+ function isApiErrorResponse(response) {
82
+ return response.success === false;
83
+ }
84
+ function isValidJSON(value) {
85
+ if (typeof value !== "string") return false;
86
+ try {
87
+ JSON.parse(value);
88
+ return true;
89
+ } catch (e) {
90
+ return false;
91
+ }
92
+ }
93
+ function isJSONSerializable(value) {
94
+ try {
95
+ JSON.stringify(value);
96
+ return true;
97
+ } catch (e) {
98
+ return false;
99
+ }
100
+ }
101
+ function isEmptyString(value) {
102
+ return value === "";
103
+ }
104
+ function isEmptyArray(value) {
105
+ return Array.isArray(value) && value.length === 0;
106
+ }
107
+ function isEmptyObject(value) {
108
+ return isObject(value) && Object.keys(value).length === 0;
109
+ }
110
+ function isEmpty(value) {
111
+ if (value === null || value === void 0) return true;
112
+ if (isEmptyString(value)) return true;
113
+ if (isEmptyArray(value)) return true;
114
+ if (isEmptyObject(value)) return true;
115
+ return false;
116
+ }
117
+ var type_guards_default = {
118
+ // Utility Types
119
+ isNotNull,
120
+ isDefined,
121
+ isPresent,
122
+ isString,
123
+ isNumber,
124
+ isBoolean,
125
+ isObject,
126
+ isArray,
127
+ isFunction,
128
+ // Validation
129
+ isValidEmail,
130
+ isValidUrl,
131
+ isIPv4,
132
+ isIPv6,
133
+ isIPAddress,
134
+ isValidDate,
135
+ isISODateString,
136
+ isDateParseable,
137
+ // Sort Order
138
+ isSortOrder,
139
+ // API Response
140
+ isApiSuccessResponse,
141
+ isApiErrorResponse,
142
+ // JSON
143
+ isValidJSON,
144
+ isJSONSerializable,
145
+ // Empty checks
146
+ isEmptyString,
147
+ isEmptyArray,
148
+ isEmptyObject,
149
+ isEmpty
150
+ };
151
+
152
+ export {
153
+ isNotNull,
154
+ isDefined,
155
+ isPresent,
156
+ isString,
157
+ isNumber,
158
+ isBoolean,
159
+ isObject,
160
+ isArray,
161
+ isFunction,
162
+ isValidEmail,
163
+ isValidUrl,
164
+ isIPv4,
165
+ isIPv6,
166
+ isIPAddress,
167
+ isValidDate,
168
+ isISODateString,
169
+ isDateParseable,
170
+ isSortOrder,
171
+ isApiSuccessResponse,
172
+ isApiErrorResponse,
173
+ isValidJSON,
174
+ isJSONSerializable,
175
+ isEmptyString,
176
+ isEmptyArray,
177
+ isEmptyObject,
178
+ isEmpty,
179
+ type_guards_default
180
+ };
@@ -0,0 +1,80 @@
1
+ import {
2
+ getTimezoneOffset,
3
+ getUserTimezone
4
+ } from "./chunk-TRBKJ7JT.js";
5
+ import {
6
+ __spreadProps,
7
+ __spreadValues
8
+ } from "./chunk-ORMEWXMH.js";
9
+
10
+ // src/hooks/useTimezone.ts
11
+ import { useState, useEffect, useCallback } from "react";
12
+ function useTimezone() {
13
+ const [timezoneInfo, setTimezoneInfo] = useState({
14
+ timezone: "UTC",
15
+ offset: 0,
16
+ offsetFormatted: "+00:00"
17
+ });
18
+ const [isLoading, setIsLoading] = useState(true);
19
+ useEffect(() => {
20
+ try {
21
+ const timezone = getUserTimezone();
22
+ const offset = getTimezoneOffset();
23
+ const offsetFormatted = formatOffset(offset);
24
+ setTimezoneInfo({
25
+ timezone,
26
+ offset,
27
+ offsetFormatted
28
+ });
29
+ } catch (error) {
30
+ console.warn("Cannot get timezone information:", error);
31
+ setTimezoneInfo({
32
+ timezone: "UTC",
33
+ offset: 0,
34
+ offsetFormatted: "+00:00"
35
+ });
36
+ } finally {
37
+ setIsLoading(false);
38
+ }
39
+ }, []);
40
+ const formatOffset = useCallback((offsetMinutes) => {
41
+ const absOffset = Math.abs(offsetMinutes);
42
+ const hours = Math.floor(absOffset / 60);
43
+ const minutes = absOffset % 60;
44
+ const sign = offsetMinutes <= 0 ? "+" : "-";
45
+ return `${sign}${hours.toString().padStart(2, "0")}:${minutes.toString().padStart(2, "0")}`;
46
+ }, []);
47
+ const refreshTimezone = useCallback(() => {
48
+ try {
49
+ const timezone = getUserTimezone();
50
+ const offset = getTimezoneOffset();
51
+ const offsetFormatted = formatOffset(offset);
52
+ setTimezoneInfo({
53
+ timezone,
54
+ offset,
55
+ offsetFormatted
56
+ });
57
+ } catch (error) {
58
+ console.error("Failed to refresh timezone information:", error);
59
+ }
60
+ }, [formatOffset]);
61
+ return __spreadProps(__spreadValues({}, timezoneInfo), {
62
+ isLoading,
63
+ refreshTimezone
64
+ });
65
+ }
66
+ function useSimpleTimezone() {
67
+ const { timezone, offsetFormatted, isLoading } = useTimezone();
68
+ return {
69
+ timezone,
70
+ offsetFormatted,
71
+ isLoading,
72
+ // 간단한 표시용
73
+ display: `${timezone} (${offsetFormatted})`
74
+ };
75
+ }
76
+
77
+ export {
78
+ useTimezone,
79
+ useSimpleTimezone
80
+ };
@@ -0,0 +1,249 @@
1
+ import {
2
+ __spreadProps,
3
+ __spreadValues
4
+ } from "./chunk-ORMEWXMH.js";
5
+
6
+ // src/logger/logger.ts
7
+ import fs from "fs";
8
+ import winston from "winston";
9
+ import DailyRotateFile from "winston-daily-rotate-file";
10
+ if (typeof process !== "undefined" && process.setMaxListeners) {
11
+ if (!globalThis.__maxListenersSet) {
12
+ process.setMaxListeners(20);
13
+ globalThis.__maxListenersSet = true;
14
+ }
15
+ }
16
+ var { combine, timestamp, printf, colorize } = winston.format;
17
+ var {
18
+ LOG_DIR = "./logs",
19
+ LOG_FILE = "app.log",
20
+ LOG_PATH = "",
21
+ LOG_FILE_ENABLED = "true",
22
+ LOG_CONSOLE_ENABLED = "true",
23
+ LOG_LEVEL = "info"
24
+ } = process.env;
25
+ var colors = {
26
+ error: "red",
27
+ warn: "yellow",
28
+ info: "green",
29
+ http: "magenta",
30
+ debug: "blue"
31
+ };
32
+ winston.addColors(colors);
33
+ var isTestEnv = process.env.NODE_ENV === "test" || process.env.JEST_WORKER_ID !== void 0;
34
+ var isBuildTime = process.env.NEXT_PHASE === "phase-production-build" || process.argv.some((arg) => arg.includes("build"));
35
+ var canWriteToLogDir = (() => {
36
+ if (isTestEnv || isBuildTime) return false;
37
+ try {
38
+ const logDir = LOG_PATH || LOG_DIR;
39
+ if (fs.existsSync(logDir)) {
40
+ fs.accessSync(logDir, fs.constants.W_OK);
41
+ return true;
42
+ }
43
+ fs.mkdirSync(logDir, { recursive: true });
44
+ return true;
45
+ } catch (e) {
46
+ return false;
47
+ }
48
+ })();
49
+ var fileLoggingEnabled = !isTestEnv && !isBuildTime && canWriteToLogDir && LOG_FILE_ENABLED === "true";
50
+ var consoleLoggingEnabled = LOG_CONSOLE_ENABLED === "true";
51
+ var datePatternString = "YYYY-MM-DD";
52
+ var logLevel = LOG_LEVEL;
53
+ var transports = [];
54
+ var logFormat = combine(
55
+ timestamp({ format: "YYYY-MM-DD HH:mm:ss:ms" }),
56
+ printf((info) => {
57
+ if (info.stack) {
58
+ return `${info.level}: ${info.timestamp} ${info.message}
59
+ Error Stack: ${info.stack}`;
60
+ }
61
+ const winstonStandardKeys = ["level", "message", "timestamp", "stack", "splat", "symbol"];
62
+ const metaKeys = Object.keys(info).filter((key) => !winstonStandardKeys.includes(key));
63
+ const rawLevel = info.level.replace(/\u001b\[\d+m/g, "");
64
+ const isInfoLevel = rawLevel === "info";
65
+ if (metaKeys.length > 0) {
66
+ const meta = {};
67
+ metaKeys.forEach((key) => {
68
+ meta[key] = info[key];
69
+ });
70
+ const metaStr = isInfoLevel ? JSON.stringify(meta) : JSON.stringify(meta, null, 2);
71
+ return `${info.level}: ${info.timestamp} ${info.message} ${metaStr}`;
72
+ }
73
+ if (info.meta && typeof info.meta === "object") {
74
+ const metaStr = isInfoLevel ? JSON.stringify(info.meta) : JSON.stringify(info.meta, null, 2);
75
+ return `${info.level}: ${info.timestamp} ${info.message} ${metaStr}`;
76
+ }
77
+ return `${info.level}: ${info.timestamp} ${info.message}`;
78
+ })
79
+ );
80
+ var consoleOpts = {
81
+ handleExceptions: true,
82
+ // level: process.env.NODE_ENV === 'production' ? 'error' : 'debug',
83
+ format: combine(
84
+ colorize({ all: true }),
85
+ timestamp({ format: "YYYY-MM-DD HH:mm:ss:ms" })
86
+ )
87
+ };
88
+ if (consoleLoggingEnabled) {
89
+ transports.push(
90
+ new winston.transports.Console({
91
+ format: winston.format.combine(
92
+ winston.format.colorize(),
93
+ winston.format.timestamp({ format: "YYYY-MM-DD HH:mm:ss:ms" }),
94
+ winston.format.printf((info) => {
95
+ if (info.stack) {
96
+ return `${info.level}: ${info.timestamp} ${info.message}
97
+ Error Stack: ${info.stack}`;
98
+ }
99
+ const winstonStandardKeys = ["level", "message", "timestamp", "stack", "splat", "symbol"];
100
+ const metaKeys = Object.keys(info).filter((key) => !winstonStandardKeys.includes(key));
101
+ const rawLevel = info.level.replace(/\u001b\[\d+m/g, "");
102
+ const isInfoLevel = rawLevel === "info";
103
+ if (metaKeys.length > 0) {
104
+ const meta = {};
105
+ metaKeys.forEach((key) => {
106
+ meta[key] = info[key];
107
+ });
108
+ const metaStr = isInfoLevel ? JSON.stringify(meta) : JSON.stringify(meta, null, 2);
109
+ return `${info.level}: ${info.timestamp} ${info.message} ${metaStr}`;
110
+ }
111
+ if (info.meta && typeof info.meta === "object") {
112
+ const metaStr = isInfoLevel ? JSON.stringify(info.meta) : JSON.stringify(info.meta, null, 2);
113
+ return `${info.level}: ${info.timestamp} ${info.message} ${metaStr}`;
114
+ }
115
+ return `${info.level}: ${info.timestamp} ${info.message}`;
116
+ })
117
+ ),
118
+ level: logLevel,
119
+ handleExceptions: true
120
+ })
121
+ );
122
+ }
123
+ if (fileLoggingEnabled) {
124
+ transports.push(
125
+ new DailyRotateFile({
126
+ filename: LOG_PATH || `${LOG_DIR}/${LOG_FILE.replace(/\.log$/, "")}-%DATE%.log`,
127
+ zippedArchive: true,
128
+ maxFiles: "14d",
129
+ // Keep for 14 days
130
+ datePattern: datePatternString,
131
+ level: logLevel,
132
+ handleExceptions: true,
133
+ json: false,
134
+ dirname: LOG_PATH ? void 0 : LOG_DIR
135
+ })
136
+ );
137
+ }
138
+ var _a;
139
+ var logger = (_a = globalThis.__winstonLoggerInstance) != null ? _a : (() => {
140
+ const instance = winston.createLogger({
141
+ level: "info",
142
+ format: winston.format.combine(
143
+ winston.format.timestamp(),
144
+ winston.format.errors({ stack: true }),
145
+ winston.format.splat(),
146
+ logFormat
147
+ ),
148
+ transports,
149
+ exitOnError: false
150
+ });
151
+ globalThis.__winstonLoggerInstance = instance;
152
+ return instance;
153
+ })();
154
+ function logDebug(message, meta) {
155
+ logger.debug(message, meta);
156
+ }
157
+ function logInfo(message, meta) {
158
+ logger.info(message, meta);
159
+ }
160
+ function logError(message, meta) {
161
+ logger.error(message, meta);
162
+ }
163
+ var MASK_KEYS = ["password", "token", "secret", "accessToken", "refreshToken"];
164
+ var MAX_BODY_LENGTH = 1024;
165
+ function maskSensitiveData(obj) {
166
+ if (typeof obj !== "object" || obj === null) return obj;
167
+ const masked = __spreadValues({}, obj);
168
+ for (const key of MASK_KEYS) {
169
+ if (key in masked) {
170
+ masked[key] = "[MASKED]";
171
+ }
172
+ }
173
+ return masked;
174
+ }
175
+ function truncateBody(body) {
176
+ if (typeof body === "string") {
177
+ return body.length > MAX_BODY_LENGTH ? body.slice(0, MAX_BODY_LENGTH) + "... [TRUNCATED]" : body;
178
+ }
179
+ if (typeof body === "object") {
180
+ const str = JSON.stringify(body);
181
+ return str.length > MAX_BODY_LENGTH ? str.slice(0, MAX_BODY_LENGTH) + "... [TRUNCATED]" : body;
182
+ }
183
+ return body;
184
+ }
185
+ async function getSafeBody(req) {
186
+ try {
187
+ const cloned = req.clone();
188
+ const contentType = cloned.headers.get("content-type") || "";
189
+ let body = null;
190
+ if (contentType.includes("application/json")) {
191
+ body = await cloned.json();
192
+ } else if (contentType.includes("text/")) {
193
+ body = await cloned.text();
194
+ } else {
195
+ return "[non-text body]";
196
+ }
197
+ if (typeof body === "object" && body !== null) {
198
+ body = maskSensitiveData(body);
199
+ }
200
+ return truncateBody(body);
201
+ } catch (e) {
202
+ return "[unreadable body]";
203
+ }
204
+ }
205
+ function logApiRequest(request, extra) {
206
+ const baseLog = __spreadValues({
207
+ method: request.method,
208
+ url: request.url
209
+ }, extra);
210
+ const contentType = request.headers.get("content-type") || "";
211
+ if (contentType.includes("application/json") || contentType.includes("text/")) {
212
+ getSafeBody(request).then((body) => {
213
+ const fullLog = __spreadProps(__spreadValues({}, baseLog), { body });
214
+ logDebug("[API Req] " + JSON.stringify(fullLog, null, 2));
215
+ }).catch(() => {
216
+ logDebug("[API Req] " + JSON.stringify(baseLog, null, 2));
217
+ });
218
+ } else {
219
+ logDebug("[API Req] " + JSON.stringify(baseLog, null, 2));
220
+ }
221
+ }
222
+ function logApiResponse(request, response, extra) {
223
+ const baseLog = __spreadValues({
224
+ method: request.method,
225
+ url: request.url,
226
+ status: response.status,
227
+ headers: Object.fromEntries(response.headers.entries())
228
+ }, extra);
229
+ const contentType = response.headers.get("content-type") || "";
230
+ if (contentType.includes("application/json") || contentType.includes("text/")) {
231
+ getSafeBody(response).then((body) => {
232
+ const fullLog = __spreadProps(__spreadValues({}, baseLog), { body });
233
+ logDebug("[API Res] " + JSON.stringify(fullLog, null, 2));
234
+ }).catch(() => {
235
+ logDebug("[API Res] " + JSON.stringify(baseLog, null, 2));
236
+ });
237
+ } else {
238
+ logDebug("[API Res] " + JSON.stringify(baseLog, null, 2));
239
+ }
240
+ }
241
+
242
+ export {
243
+ logger,
244
+ logDebug,
245
+ logInfo,
246
+ logError,
247
+ logApiRequest,
248
+ logApiResponse
249
+ };