@buenojs/bueno 0.8.10 → 0.8.11

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 (699) hide show
  1. package/dist/cache/index.d.ts +187 -0
  2. package/dist/cache/index.d.ts.map +1 -0
  3. package/dist/cache/index.js +595 -0
  4. package/dist/cache/index.js.map +1 -0
  5. package/dist/cli/bin.d.ts +8 -0
  6. package/dist/cli/bin.d.ts.map +1 -0
  7. package/dist/cli/bin.js +9 -9
  8. package/dist/cli/bin.js.map +1 -0
  9. package/dist/cli/commands/add-frontend.d.ts +7 -0
  10. package/dist/cli/commands/add-frontend.d.ts.map +1 -0
  11. package/dist/cli/commands/add-frontend.js +376 -0
  12. package/dist/cli/commands/add-frontend.js.map +1 -0
  13. package/dist/cli/commands/build.d.ts +7 -0
  14. package/dist/cli/commands/build.d.ts.map +1 -0
  15. package/dist/cli/commands/build.js +347 -0
  16. package/dist/cli/commands/build.js.map +1 -0
  17. package/dist/cli/commands/dev.d.ts +7 -0
  18. package/dist/cli/commands/dev.d.ts.map +1 -0
  19. package/dist/cli/commands/dev.js +205 -0
  20. package/dist/cli/commands/dev.js.map +1 -0
  21. package/dist/cli/commands/generate.d.ts +7 -0
  22. package/dist/cli/commands/generate.d.ts.map +1 -0
  23. package/dist/cli/commands/generate.js +491 -0
  24. package/dist/cli/commands/generate.js.map +1 -0
  25. package/dist/cli/commands/help.d.ts +7 -0
  26. package/dist/cli/commands/help.d.ts.map +1 -0
  27. package/dist/cli/commands/help.js +51 -0
  28. package/dist/cli/commands/help.js.map +1 -0
  29. package/dist/cli/commands/index.d.ts +59 -0
  30. package/dist/cli/commands/index.d.ts.map +1 -0
  31. package/dist/cli/commands/index.js +77 -0
  32. package/dist/cli/commands/index.js.map +1 -0
  33. package/dist/cli/commands/migration.d.ts +7 -0
  34. package/dist/cli/commands/migration.d.ts.map +1 -0
  35. package/dist/cli/commands/migration.js +295 -0
  36. package/dist/cli/commands/migration.js.map +1 -0
  37. package/dist/cli/commands/new.d.ts +7 -0
  38. package/dist/cli/commands/new.d.ts.map +1 -0
  39. package/dist/cli/commands/new.js +641 -0
  40. package/dist/cli/commands/new.js.map +1 -0
  41. package/dist/cli/commands/start.d.ts +7 -0
  42. package/dist/cli/commands/start.d.ts.map +1 -0
  43. package/dist/cli/commands/start.js +171 -0
  44. package/dist/cli/commands/start.js.map +1 -0
  45. package/dist/cli/core/args.d.ts +61 -0
  46. package/dist/cli/core/args.d.ts.map +1 -0
  47. package/dist/cli/core/args.js +224 -0
  48. package/dist/cli/core/args.js.map +1 -0
  49. package/dist/cli/core/console.d.ts +135 -0
  50. package/dist/cli/core/console.d.ts.map +1 -0
  51. package/dist/cli/core/console.js +268 -0
  52. package/dist/cli/core/console.js.map +1 -0
  53. package/dist/cli/core/index.d.ts +10 -0
  54. package/dist/cli/core/index.d.ts.map +1 -0
  55. package/dist/cli/core/index.js +10 -0
  56. package/dist/cli/core/index.js.map +1 -0
  57. package/dist/cli/core/prompt.d.ts +63 -0
  58. package/dist/cli/core/prompt.d.ts.map +1 -0
  59. package/dist/cli/core/prompt.js +338 -0
  60. package/dist/cli/core/prompt.js.map +1 -0
  61. package/dist/cli/core/spinner.d.ts +111 -0
  62. package/dist/cli/core/spinner.d.ts.map +1 -0
  63. package/dist/cli/core/spinner.js +208 -0
  64. package/dist/cli/core/spinner.js.map +1 -0
  65. package/dist/cli/index.d.ts +47 -0
  66. package/dist/cli/index.d.ts.map +1 -0
  67. package/dist/cli/index.js +127 -0
  68. package/dist/cli/index.js.map +1 -0
  69. package/dist/cli/templates/database/index.d.ts +24 -0
  70. package/dist/cli/templates/database/index.d.ts.map +1 -0
  71. package/dist/cli/templates/database/index.js +49 -0
  72. package/dist/cli/templates/database/index.js.map +1 -0
  73. package/dist/cli/templates/database/mysql.d.ts +6 -0
  74. package/dist/cli/templates/database/mysql.d.ts.map +1 -0
  75. package/dist/cli/templates/database/mysql.js +12 -0
  76. package/dist/cli/templates/database/mysql.js.map +1 -0
  77. package/dist/cli/templates/database/none.d.ts +8 -0
  78. package/dist/cli/templates/database/none.d.ts.map +1 -0
  79. package/dist/cli/templates/database/none.js +14 -0
  80. package/dist/cli/templates/database/none.js.map +1 -0
  81. package/dist/cli/templates/database/postgresql.d.ts +6 -0
  82. package/dist/cli/templates/database/postgresql.d.ts.map +1 -0
  83. package/dist/cli/templates/database/postgresql.js +12 -0
  84. package/dist/cli/templates/database/postgresql.js.map +1 -0
  85. package/dist/cli/templates/database/sqlite.d.ts +6 -0
  86. package/dist/cli/templates/database/sqlite.d.ts.map +1 -0
  87. package/dist/cli/templates/database/sqlite.js +12 -0
  88. package/dist/cli/templates/database/sqlite.js.map +1 -0
  89. package/dist/cli/templates/deploy.d.ts +41 -0
  90. package/dist/cli/templates/deploy.d.ts.map +1 -0
  91. package/dist/cli/templates/deploy.js +278 -0
  92. package/dist/cli/templates/deploy.js.map +1 -0
  93. package/dist/cli/templates/docker.d.ts +30 -0
  94. package/dist/cli/templates/docker.d.ts.map +1 -0
  95. package/dist/cli/templates/docker.js +298 -0
  96. package/dist/cli/templates/docker.js.map +1 -0
  97. package/dist/cli/templates/frontend/index.d.ts +25 -0
  98. package/dist/cli/templates/frontend/index.d.ts.map +1 -0
  99. package/dist/cli/templates/frontend/index.js +40 -0
  100. package/dist/cli/templates/frontend/index.js.map +1 -0
  101. package/dist/cli/templates/frontend/none.d.ts +8 -0
  102. package/dist/cli/templates/frontend/none.d.ts.map +1 -0
  103. package/dist/cli/templates/frontend/none.js +15 -0
  104. package/dist/cli/templates/frontend/none.js.map +1 -0
  105. package/dist/cli/templates/frontend/react.d.ts +6 -0
  106. package/dist/cli/templates/frontend/react.d.ts.map +1 -0
  107. package/dist/cli/templates/frontend/react.js +139 -0
  108. package/dist/cli/templates/frontend/react.js.map +1 -0
  109. package/dist/cli/templates/frontend/solid.d.ts +6 -0
  110. package/dist/cli/templates/frontend/solid.d.ts.map +1 -0
  111. package/dist/cli/templates/frontend/solid.js +133 -0
  112. package/dist/cli/templates/frontend/solid.js.map +1 -0
  113. package/dist/cli/templates/frontend/svelte.d.ts +6 -0
  114. package/dist/cli/templates/frontend/svelte.d.ts.map +1 -0
  115. package/dist/cli/templates/frontend/svelte.js +130 -0
  116. package/dist/cli/templates/frontend/svelte.js.map +1 -0
  117. package/dist/cli/templates/frontend/vue.d.ts +6 -0
  118. package/dist/cli/templates/frontend/vue.d.ts.map +1 -0
  119. package/dist/cli/templates/frontend/vue.js +129 -0
  120. package/dist/cli/templates/frontend/vue.js.map +1 -0
  121. package/dist/cli/templates/generators/index.d.ts +29 -0
  122. package/dist/cli/templates/generators/index.d.ts.map +1 -0
  123. package/dist/cli/templates/generators/index.js +308 -0
  124. package/dist/cli/templates/generators/index.js.map +1 -0
  125. package/dist/cli/templates/generators/types.d.ts +32 -0
  126. package/dist/cli/templates/generators/types.d.ts.map +1 -0
  127. package/dist/cli/templates/generators/types.js +21 -0
  128. package/dist/cli/templates/generators/types.js.map +1 -0
  129. package/dist/cli/templates/index.d.ts +12 -0
  130. package/dist/cli/templates/index.d.ts.map +1 -0
  131. package/dist/cli/templates/index.js +18 -0
  132. package/dist/cli/templates/index.js.map +1 -0
  133. package/dist/cli/templates/project/api.d.ts +6 -0
  134. package/dist/cli/templates/project/api.d.ts.map +1 -0
  135. package/dist/cli/templates/project/api.js +79 -0
  136. package/dist/cli/templates/project/api.js.map +1 -0
  137. package/dist/cli/templates/project/default.d.ts +6 -0
  138. package/dist/cli/templates/project/default.d.ts.map +1 -0
  139. package/dist/cli/templates/project/default.js +136 -0
  140. package/dist/cli/templates/project/default.js.map +1 -0
  141. package/dist/cli/templates/project/fullstack.d.ts +14 -0
  142. package/dist/cli/templates/project/fullstack.d.ts.map +1 -0
  143. package/dist/cli/templates/project/fullstack.js +19 -0
  144. package/dist/cli/templates/project/fullstack.js.map +1 -0
  145. package/dist/cli/templates/project/index.d.ts +26 -0
  146. package/dist/cli/templates/project/index.d.ts.map +1 -0
  147. package/dist/cli/templates/project/index.js +60 -0
  148. package/dist/cli/templates/project/index.js.map +1 -0
  149. package/dist/cli/templates/project/minimal.d.ts +6 -0
  150. package/dist/cli/templates/project/minimal.d.ts.map +1 -0
  151. package/dist/cli/templates/project/minimal.js +43 -0
  152. package/dist/cli/templates/project/minimal.js.map +1 -0
  153. package/dist/cli/templates/project/types.d.ts +80 -0
  154. package/dist/cli/templates/project/types.d.ts.map +1 -0
  155. package/dist/cli/templates/project/types.js +7 -0
  156. package/dist/cli/templates/project/types.js.map +1 -0
  157. package/dist/cli/templates/project/website.d.ts +8 -0
  158. package/dist/cli/templates/project/website.d.ts.map +1 -0
  159. package/dist/cli/templates/project/website.js +312 -0
  160. package/dist/cli/templates/project/website.js.map +1 -0
  161. package/dist/cli/utils/fs.d.ts +137 -0
  162. package/dist/cli/utils/fs.d.ts.map +1 -0
  163. package/dist/cli/utils/fs.js +350 -0
  164. package/dist/cli/utils/fs.js.map +1 -0
  165. package/dist/cli/utils/index.d.ts +9 -0
  166. package/dist/cli/utils/index.d.ts.map +1 -0
  167. package/dist/cli/utils/index.js +9 -0
  168. package/dist/cli/utils/index.js.map +1 -0
  169. package/dist/cli/utils/strings.d.ts +86 -0
  170. package/dist/cli/utils/strings.d.ts.map +1 -0
  171. package/dist/cli/utils/strings.js +190 -0
  172. package/dist/cli/utils/strings.js.map +1 -0
  173. package/dist/cli/utils/version.d.ts +15 -0
  174. package/dist/cli/utils/version.d.ts.map +1 -0
  175. package/dist/cli/utils/version.js +38 -0
  176. package/dist/cli/utils/version.js.map +1 -0
  177. package/dist/config/env-validation.d.ts +49 -0
  178. package/dist/config/env-validation.d.ts.map +1 -0
  179. package/dist/config/env-validation.js +77 -0
  180. package/dist/config/env-validation.js.map +1 -0
  181. package/dist/config/env.d.ts +167 -0
  182. package/dist/config/env.d.ts.map +1 -0
  183. package/dist/config/env.js +392 -0
  184. package/dist/config/env.js.map +1 -0
  185. package/dist/config/index.d.ts +168 -0
  186. package/dist/config/index.d.ts.map +1 -0
  187. package/dist/config/index.js +329 -0
  188. package/dist/config/index.js.map +1 -0
  189. package/dist/config/loader.d.ts +81 -0
  190. package/dist/config/loader.d.ts.map +1 -0
  191. package/dist/config/loader.js +242 -0
  192. package/dist/config/loader.js.map +1 -0
  193. package/dist/config/merge.d.ts +66 -0
  194. package/dist/config/merge.d.ts.map +1 -0
  195. package/dist/config/merge.js +226 -0
  196. package/dist/config/merge.js.map +1 -0
  197. package/dist/config/types.d.ts +322 -0
  198. package/dist/config/types.d.ts.map +1 -0
  199. package/dist/config/types.js +443 -0
  200. package/dist/config/types.js.map +1 -0
  201. package/dist/config/validation.d.ts +100 -0
  202. package/dist/config/validation.d.ts.map +1 -0
  203. package/dist/config/validation.js +548 -0
  204. package/dist/config/validation.js.map +1 -0
  205. package/dist/container/forward-ref.d.ts +116 -0
  206. package/dist/container/forward-ref.d.ts.map +1 -0
  207. package/dist/container/forward-ref.js +105 -0
  208. package/dist/container/forward-ref.js.map +1 -0
  209. package/dist/container/index.d.ts +95 -0
  210. package/dist/container/index.d.ts.map +1 -0
  211. package/dist/container/index.js.map +1 -0
  212. package/dist/context/index.d.ts +143 -0
  213. package/dist/context/index.d.ts.map +1 -0
  214. package/dist/context/index.js.map +1 -0
  215. package/dist/database/index.d.ts +219 -0
  216. package/dist/database/index.d.ts.map +1 -0
  217. package/dist/database/index.js.map +1 -0
  218. package/dist/database/migrations/index.d.ts +151 -0
  219. package/dist/database/migrations/index.d.ts.map +1 -0
  220. package/dist/database/migrations/index.js +258 -0
  221. package/dist/database/migrations/index.js.map +1 -0
  222. package/dist/database/orm/builder.d.ts +122 -0
  223. package/dist/database/orm/builder.d.ts.map +1 -0
  224. package/dist/database/orm/builder.js +355 -0
  225. package/dist/database/orm/builder.js.map +1 -0
  226. package/dist/database/orm/casts/index.d.ts +16 -0
  227. package/dist/database/orm/casts/index.d.ts.map +1 -0
  228. package/dist/database/orm/casts/index.js +131 -0
  229. package/dist/database/orm/casts/index.js.map +1 -0
  230. package/dist/database/orm/casts/types.d.ts +16 -0
  231. package/dist/database/orm/casts/types.d.ts.map +1 -0
  232. package/dist/database/orm/casts/types.js +5 -0
  233. package/dist/database/orm/casts/types.js.map +1 -0
  234. package/dist/database/orm/compiler.d.ts +90 -0
  235. package/dist/database/orm/compiler.d.ts.map +1 -0
  236. package/dist/database/orm/compiler.js +218 -0
  237. package/dist/database/orm/compiler.js.map +1 -0
  238. package/dist/database/orm/hooks/index.d.ts +53 -0
  239. package/dist/database/orm/hooks/index.d.ts.map +1 -0
  240. package/dist/database/orm/hooks/index.js +81 -0
  241. package/dist/database/orm/hooks/index.js.map +1 -0
  242. package/dist/database/orm/index.d.ts +21 -0
  243. package/dist/database/orm/index.d.ts.map +1 -0
  244. package/dist/database/orm/index.js +23 -0
  245. package/dist/database/orm/index.js.map +1 -0
  246. package/dist/database/orm/model-registry.d.ts +33 -0
  247. package/dist/database/orm/model-registry.d.ts.map +1 -0
  248. package/dist/database/orm/model-registry.js +49 -0
  249. package/dist/database/orm/model-registry.js.map +1 -0
  250. package/dist/database/orm/model.d.ts +245 -0
  251. package/dist/database/orm/model.d.ts.map +1 -0
  252. package/dist/database/orm/model.js +599 -0
  253. package/dist/database/orm/model.js.map +1 -0
  254. package/dist/database/orm/relationships/base.d.ts +69 -0
  255. package/dist/database/orm/relationships/base.d.ts.map +1 -0
  256. package/dist/database/orm/relationships/base.js +84 -0
  257. package/dist/database/orm/relationships/base.js.map +1 -0
  258. package/dist/database/orm/relationships/belongs-to-many.d.ts +47 -0
  259. package/dist/database/orm/relationships/belongs-to-many.d.ts.map +1 -0
  260. package/dist/database/orm/relationships/belongs-to-many.js +136 -0
  261. package/dist/database/orm/relationships/belongs-to-many.js.map +1 -0
  262. package/dist/database/orm/relationships/belongs-to.d.ts +17 -0
  263. package/dist/database/orm/relationships/belongs-to.d.ts.map +1 -0
  264. package/dist/database/orm/relationships/belongs-to.js +38 -0
  265. package/dist/database/orm/relationships/belongs-to.js.map +1 -0
  266. package/dist/database/orm/relationships/has-many.d.ts +14 -0
  267. package/dist/database/orm/relationships/has-many.d.ts.map +1 -0
  268. package/dist/database/orm/relationships/has-many.js +35 -0
  269. package/dist/database/orm/relationships/has-many.js.map +1 -0
  270. package/dist/database/orm/relationships/has-one.d.ts +14 -0
  271. package/dist/database/orm/relationships/has-one.d.ts.map +1 -0
  272. package/dist/database/orm/relationships/has-one.js +32 -0
  273. package/dist/database/orm/relationships/has-one.js.map +1 -0
  274. package/dist/database/orm/relationships/index.d.ts +10 -0
  275. package/dist/database/orm/relationships/index.d.ts.map +1 -0
  276. package/dist/database/orm/relationships/index.js +9 -0
  277. package/dist/database/orm/relationships/index.js.map +1 -0
  278. package/dist/database/orm/scopes/index.d.ts +36 -0
  279. package/dist/database/orm/scopes/index.d.ts.map +1 -0
  280. package/dist/database/orm/scopes/index.js +47 -0
  281. package/dist/database/orm/scopes/index.js.map +1 -0
  282. package/dist/database/schema/index.d.ts +155 -0
  283. package/dist/database/schema/index.d.ts.map +1 -0
  284. package/dist/database/schema/index.js +401 -0
  285. package/dist/database/schema/index.js.map +1 -0
  286. package/dist/frontend/api-routes.d.ts +189 -0
  287. package/dist/frontend/api-routes.d.ts.map +1 -0
  288. package/dist/frontend/api-routes.js +548 -0
  289. package/dist/frontend/api-routes.js.map +1 -0
  290. package/dist/frontend/bundler.d.ts +99 -0
  291. package/dist/frontend/bundler.d.ts.map +1 -0
  292. package/dist/frontend/bundler.js +555 -0
  293. package/dist/frontend/bundler.js.map +1 -0
  294. package/dist/frontend/console-client.d.ts +11 -0
  295. package/dist/frontend/console-client.d.ts.map +1 -0
  296. package/dist/frontend/console-client.js +414 -0
  297. package/dist/frontend/console-client.js.map +1 -0
  298. package/dist/frontend/console-stream.d.ts +138 -0
  299. package/dist/frontend/console-stream.d.ts.map +1 -0
  300. package/dist/frontend/console-stream.js +535 -0
  301. package/dist/frontend/console-stream.js.map +1 -0
  302. package/dist/frontend/dev-server.d.ts +174 -0
  303. package/dist/frontend/dev-server.d.ts.map +1 -0
  304. package/dist/frontend/dev-server.js +735 -0
  305. package/dist/frontend/dev-server.js.map +1 -0
  306. package/dist/frontend/file-router.d.ts +170 -0
  307. package/dist/frontend/file-router.d.ts.map +1 -0
  308. package/dist/frontend/file-router.js +531 -0
  309. package/dist/frontend/file-router.js.map +1 -0
  310. package/dist/frontend/frameworks/index.d.ts +41 -0
  311. package/dist/frontend/frameworks/index.d.ts.map +1 -0
  312. package/dist/frontend/frameworks/index.js +87 -0
  313. package/dist/frontend/frameworks/index.js.map +1 -0
  314. package/dist/frontend/frameworks/react.d.ts +32 -0
  315. package/dist/frontend/frameworks/react.d.ts.map +1 -0
  316. package/dist/frontend/frameworks/react.js +66 -0
  317. package/dist/frontend/frameworks/react.js.map +1 -0
  318. package/dist/frontend/frameworks/solid.d.ts +42 -0
  319. package/dist/frontend/frameworks/solid.d.ts.map +1 -0
  320. package/dist/frontend/frameworks/solid.js +84 -0
  321. package/dist/frontend/frameworks/solid.js.map +1 -0
  322. package/dist/frontend/frameworks/svelte.d.ts +57 -0
  323. package/dist/frontend/frameworks/svelte.d.ts.map +1 -0
  324. package/dist/frontend/frameworks/svelte.js +90 -0
  325. package/dist/frontend/frameworks/svelte.js.map +1 -0
  326. package/dist/frontend/frameworks/vue.d.ts +36 -0
  327. package/dist/frontend/frameworks/vue.d.ts.map +1 -0
  328. package/dist/frontend/frameworks/vue.js +72 -0
  329. package/dist/frontend/frameworks/vue.js.map +1 -0
  330. package/dist/frontend/hmr-client.d.ts +22 -0
  331. package/dist/frontend/hmr-client.d.ts.map +1 -0
  332. package/dist/frontend/hmr-client.js +654 -0
  333. package/dist/frontend/hmr-client.js.map +1 -0
  334. package/dist/frontend/hmr.d.ts +185 -0
  335. package/dist/frontend/hmr.d.ts.map +1 -0
  336. package/dist/frontend/hmr.js +619 -0
  337. package/dist/frontend/hmr.js.map +1 -0
  338. package/dist/frontend/index.d.ts +34 -0
  339. package/dist/frontend/index.d.ts.map +1 -0
  340. package/dist/frontend/index.js.map +1 -0
  341. package/dist/frontend/islands.d.ts +135 -0
  342. package/dist/frontend/islands.d.ts.map +1 -0
  343. package/dist/frontend/islands.js +455 -0
  344. package/dist/frontend/islands.js.map +1 -0
  345. package/dist/frontend/isr.d.ts +143 -0
  346. package/dist/frontend/isr.d.ts.map +1 -0
  347. package/dist/frontend/isr.js +440 -0
  348. package/dist/frontend/isr.js.map +1 -0
  349. package/dist/frontend/layout.d.ts +140 -0
  350. package/dist/frontend/layout.d.ts.map +1 -0
  351. package/dist/frontend/layout.js +392 -0
  352. package/dist/frontend/layout.js.map +1 -0
  353. package/dist/frontend/ssr/react.d.ts +118 -0
  354. package/dist/frontend/ssr/react.d.ts.map +1 -0
  355. package/dist/frontend/ssr/react.js +373 -0
  356. package/dist/frontend/ssr/react.js.map +1 -0
  357. package/dist/frontend/ssr/solid.d.ts +141 -0
  358. package/dist/frontend/ssr/solid.d.ts.map +1 -0
  359. package/dist/frontend/ssr/solid.js +440 -0
  360. package/dist/frontend/ssr/solid.js.map +1 -0
  361. package/dist/frontend/ssr/svelte.d.ts +158 -0
  362. package/dist/frontend/ssr/svelte.d.ts.map +1 -0
  363. package/dist/frontend/ssr/svelte.js +439 -0
  364. package/dist/frontend/ssr/svelte.js.map +1 -0
  365. package/dist/frontend/ssr/vue.d.ts +161 -0
  366. package/dist/frontend/ssr/vue.d.ts.map +1 -0
  367. package/dist/frontend/ssr/vue.js +385 -0
  368. package/dist/frontend/ssr/vue.js.map +1 -0
  369. package/dist/frontend/ssr.d.ts +147 -0
  370. package/dist/frontend/ssr.d.ts.map +1 -0
  371. package/dist/frontend/ssr.js +609 -0
  372. package/dist/frontend/ssr.js.map +1 -0
  373. package/dist/frontend/types.d.ts +1902 -0
  374. package/dist/frontend/types.d.ts.map +1 -0
  375. package/dist/frontend/types.js +8 -0
  376. package/dist/frontend/types.js.map +1 -0
  377. package/dist/graphql/built-in-engine.d.ts +36 -0
  378. package/dist/graphql/built-in-engine.d.ts.map +1 -0
  379. package/dist/graphql/built-in-engine.js +443 -0
  380. package/dist/graphql/built-in-engine.js.map +1 -0
  381. package/dist/graphql/context-builder.d.ts +44 -0
  382. package/dist/graphql/context-builder.d.ts.map +1 -0
  383. package/dist/graphql/context-builder.js +91 -0
  384. package/dist/graphql/context-builder.js.map +1 -0
  385. package/dist/graphql/decorators.d.ts +162 -0
  386. package/dist/graphql/decorators.d.ts.map +1 -0
  387. package/dist/graphql/decorators.js +291 -0
  388. package/dist/graphql/decorators.js.map +1 -0
  389. package/dist/graphql/execution-pipeline.d.ts +67 -0
  390. package/dist/graphql/execution-pipeline.d.ts.map +1 -0
  391. package/dist/graphql/execution-pipeline.js +127 -0
  392. package/dist/graphql/execution-pipeline.js.map +1 -0
  393. package/dist/graphql/graphql-module.d.ts +70 -0
  394. package/dist/graphql/graphql-module.d.ts.map +1 -0
  395. package/dist/graphql/graphql-module.js +442 -0
  396. package/dist/graphql/graphql-module.js.map +1 -0
  397. package/dist/graphql/index.d.ts +48 -0
  398. package/dist/graphql/index.d.ts.map +1 -0
  399. package/dist/graphql/index.js.map +1 -0
  400. package/dist/graphql/metadata.d.ts +37 -0
  401. package/dist/graphql/metadata.d.ts.map +1 -0
  402. package/dist/graphql/metadata.js +130 -0
  403. package/dist/graphql/metadata.js.map +1 -0
  404. package/dist/graphql/schema-builder.d.ts +34 -0
  405. package/dist/graphql/schema-builder.d.ts.map +1 -0
  406. package/dist/graphql/schema-builder.js +251 -0
  407. package/dist/graphql/schema-builder.js.map +1 -0
  408. package/dist/graphql/subscription-handler.d.ts +47 -0
  409. package/dist/graphql/subscription-handler.d.ts.map +1 -0
  410. package/dist/graphql/subscription-handler.js +201 -0
  411. package/dist/graphql/subscription-handler.js.map +1 -0
  412. package/dist/graphql/types.d.ts +252 -0
  413. package/dist/graphql/types.d.ts.map +1 -0
  414. package/dist/graphql/types.js +28 -0
  415. package/dist/graphql/types.js.map +1 -0
  416. package/dist/health/index.d.ts +176 -0
  417. package/dist/health/index.d.ts.map +1 -0
  418. package/dist/health/index.js.map +1 -0
  419. package/dist/i18n/engine.d.ts +105 -0
  420. package/dist/i18n/engine.d.ts.map +1 -0
  421. package/dist/i18n/engine.js +248 -0
  422. package/dist/i18n/engine.js.map +1 -0
  423. package/dist/i18n/index.d.ts +13 -0
  424. package/dist/i18n/index.d.ts.map +1 -0
  425. package/dist/i18n/index.js.map +1 -0
  426. package/dist/i18n/loader.d.ts +79 -0
  427. package/dist/i18n/loader.d.ts.map +1 -0
  428. package/dist/i18n/loader.js +192 -0
  429. package/dist/i18n/loader.js.map +1 -0
  430. package/dist/i18n/middleware.d.ts +96 -0
  431. package/dist/i18n/middleware.d.ts.map +1 -0
  432. package/dist/i18n/middleware.js +126 -0
  433. package/dist/i18n/middleware.js.map +1 -0
  434. package/dist/i18n/negotiator.d.ts +84 -0
  435. package/dist/i18n/negotiator.d.ts.map +1 -0
  436. package/dist/i18n/negotiator.js +139 -0
  437. package/dist/i18n/negotiator.js.map +1 -0
  438. package/dist/i18n/types.d.ts +129 -0
  439. package/dist/i18n/types.d.ts.map +1 -0
  440. package/dist/i18n/types.js +8 -0
  441. package/dist/i18n/types.js.map +1 -0
  442. package/dist/index.d.ts +48 -0
  443. package/dist/index.d.ts.map +1 -0
  444. package/dist/index.js.map +1 -0
  445. package/dist/jobs/drivers/memory.d.ts +38 -0
  446. package/dist/jobs/drivers/memory.d.ts.map +1 -0
  447. package/dist/jobs/drivers/memory.js +246 -0
  448. package/dist/jobs/drivers/memory.js.map +1 -0
  449. package/dist/jobs/drivers/redis.d.ts +34 -0
  450. package/dist/jobs/drivers/redis.d.ts.map +1 -0
  451. package/dist/jobs/drivers/redis.js +355 -0
  452. package/dist/jobs/drivers/redis.js.map +1 -0
  453. package/dist/jobs/index.d.ts +12 -0
  454. package/dist/jobs/index.d.ts.map +1 -0
  455. package/dist/jobs/index.js.map +1 -0
  456. package/dist/jobs/queue.d.ts +93 -0
  457. package/dist/jobs/queue.d.ts.map +1 -0
  458. package/dist/jobs/queue.js +233 -0
  459. package/dist/jobs/queue.js.map +1 -0
  460. package/dist/jobs/types.d.ts +193 -0
  461. package/dist/jobs/types.d.ts.map +1 -0
  462. package/dist/jobs/types.js +8 -0
  463. package/dist/jobs/types.js.map +1 -0
  464. package/dist/jobs/worker.d.ts +91 -0
  465. package/dist/jobs/worker.d.ts.map +1 -0
  466. package/dist/jobs/worker.js +300 -0
  467. package/dist/jobs/worker.js.map +1 -0
  468. package/dist/lock/index.d.ts +141 -0
  469. package/dist/lock/index.d.ts.map +1 -0
  470. package/dist/lock/index.js.map +1 -0
  471. package/dist/logger/index.d.ts +156 -0
  472. package/dist/logger/index.d.ts.map +1 -0
  473. package/dist/logger/index.js.map +1 -0
  474. package/dist/logger/transports/index.d.ts +371 -0
  475. package/dist/logger/transports/index.d.ts.map +1 -0
  476. package/dist/logger/transports/index.js +740 -0
  477. package/dist/logger/transports/index.js.map +1 -0
  478. package/dist/metrics/index.d.ts +163 -0
  479. package/dist/metrics/index.d.ts.map +1 -0
  480. package/dist/metrics/index.js.map +1 -0
  481. package/dist/middleware/built-in.d.ts +50 -0
  482. package/dist/middleware/built-in.d.ts.map +1 -0
  483. package/dist/middleware/built-in.js +220 -0
  484. package/dist/middleware/built-in.js.map +1 -0
  485. package/dist/middleware/index.d.ts +40 -0
  486. package/dist/middleware/index.d.ts.map +1 -0
  487. package/dist/middleware/index.js.map +1 -0
  488. package/dist/migrations/index.d.ts +48 -0
  489. package/dist/migrations/index.d.ts.map +1 -0
  490. package/dist/migrations/index.js +3 -0
  491. package/dist/migrations/index.js.map +1 -0
  492. package/dist/modules/filters.d.ts +150 -0
  493. package/dist/modules/filters.d.ts.map +1 -0
  494. package/dist/modules/filters.js +338 -0
  495. package/dist/modules/filters.js.map +1 -0
  496. package/dist/modules/guards.d.ts +188 -0
  497. package/dist/modules/guards.d.ts.map +1 -0
  498. package/dist/modules/guards.js +278 -0
  499. package/dist/modules/guards.js.map +1 -0
  500. package/dist/modules/index.d.ts +266 -0
  501. package/dist/modules/index.d.ts.map +1 -0
  502. package/dist/modules/index.js.map +1 -0
  503. package/dist/modules/interceptors.d.ts +242 -0
  504. package/dist/modules/interceptors.d.ts.map +1 -0
  505. package/dist/modules/interceptors.js +407 -0
  506. package/dist/modules/interceptors.js.map +1 -0
  507. package/dist/modules/lazy.d.ts +187 -0
  508. package/dist/modules/lazy.d.ts.map +1 -0
  509. package/dist/modules/lazy.js +305 -0
  510. package/dist/modules/lazy.js.map +1 -0
  511. package/dist/modules/lifecycle.d.ts +221 -0
  512. package/dist/modules/lifecycle.d.ts.map +1 -0
  513. package/dist/modules/lifecycle.js +314 -0
  514. package/dist/modules/lifecycle.js.map +1 -0
  515. package/dist/modules/metadata.d.ts +32 -0
  516. package/dist/modules/metadata.d.ts.map +1 -0
  517. package/dist/modules/metadata.js +59 -0
  518. package/dist/modules/metadata.js.map +1 -0
  519. package/dist/modules/pipes.d.ts +287 -0
  520. package/dist/modules/pipes.d.ts.map +1 -0
  521. package/dist/modules/pipes.js +443 -0
  522. package/dist/modules/pipes.js.map +1 -0
  523. package/dist/notification/channels/base.d.ts +32 -0
  524. package/dist/notification/channels/base.d.ts.map +1 -0
  525. package/dist/notification/channels/base.js +37 -0
  526. package/dist/notification/channels/base.js.map +1 -0
  527. package/dist/notification/channels/email.d.ts +37 -0
  528. package/dist/notification/channels/email.d.ts.map +1 -0
  529. package/dist/notification/channels/email.js +85 -0
  530. package/dist/notification/channels/email.js.map +1 -0
  531. package/dist/notification/channels/push.d.ts +37 -0
  532. package/dist/notification/channels/push.d.ts.map +1 -0
  533. package/dist/notification/channels/push.js +84 -0
  534. package/dist/notification/channels/push.js.map +1 -0
  535. package/dist/notification/channels/sms.d.ts +37 -0
  536. package/dist/notification/channels/sms.d.ts.map +1 -0
  537. package/dist/notification/channels/sms.js +83 -0
  538. package/dist/notification/channels/sms.js.map +1 -0
  539. package/dist/notification/channels/whatsapp.d.ts +37 -0
  540. package/dist/notification/channels/whatsapp.d.ts.map +1 -0
  541. package/dist/notification/channels/whatsapp.js +81 -0
  542. package/dist/notification/channels/whatsapp.js.map +1 -0
  543. package/dist/notification/index.d.ts +15 -0
  544. package/dist/notification/index.d.ts.map +1 -0
  545. package/dist/notification/index.js.map +1 -0
  546. package/dist/notification/service.d.ts +100 -0
  547. package/dist/notification/service.d.ts.map +1 -0
  548. package/dist/notification/service.js +279 -0
  549. package/dist/notification/service.js.map +1 -0
  550. package/dist/notification/types.d.ts +253 -0
  551. package/dist/notification/types.d.ts.map +1 -0
  552. package/dist/notification/types.js +14 -0
  553. package/dist/notification/types.js.map +1 -0
  554. package/dist/observability/__tests__/observability.test.d.ts +2 -0
  555. package/dist/observability/__tests__/observability.test.d.ts.map +1 -0
  556. package/dist/observability/__tests__/observability.test.js +404 -0
  557. package/dist/observability/__tests__/observability.test.js.map +1 -0
  558. package/dist/observability/breadcrumbs.d.ts +48 -0
  559. package/dist/observability/breadcrumbs.d.ts.map +1 -0
  560. package/dist/observability/breadcrumbs.js +97 -0
  561. package/dist/observability/breadcrumbs.js.map +1 -0
  562. package/dist/observability/index.d.ts +95 -0
  563. package/dist/observability/index.d.ts.map +1 -0
  564. package/dist/observability/index.js.map +1 -0
  565. package/dist/observability/interceptor.d.ts +19 -0
  566. package/dist/observability/interceptor.d.ts.map +1 -0
  567. package/dist/observability/interceptor.js +67 -0
  568. package/dist/observability/interceptor.js.map +1 -0
  569. package/dist/observability/service.d.ts +101 -0
  570. package/dist/observability/service.d.ts.map +1 -0
  571. package/dist/observability/service.js +249 -0
  572. package/dist/observability/service.js.map +1 -0
  573. package/dist/observability/trace.d.ts +21 -0
  574. package/dist/observability/trace.d.ts.map +1 -0
  575. package/dist/observability/trace.js +35 -0
  576. package/dist/observability/trace.js.map +1 -0
  577. package/dist/observability/types.d.ts +172 -0
  578. package/dist/observability/types.d.ts.map +1 -0
  579. package/dist/observability/types.js +8 -0
  580. package/dist/observability/types.js.map +1 -0
  581. package/dist/openapi/decorators.d.ts +173 -0
  582. package/dist/openapi/decorators.d.ts.map +1 -0
  583. package/dist/openapi/decorators.js +276 -0
  584. package/dist/openapi/decorators.js.map +1 -0
  585. package/dist/openapi/document-builder.d.ts +82 -0
  586. package/dist/openapi/document-builder.d.ts.map +1 -0
  587. package/dist/openapi/document-builder.js +228 -0
  588. package/dist/openapi/document-builder.js.map +1 -0
  589. package/dist/openapi/index.d.ts +48 -0
  590. package/dist/openapi/index.d.ts.map +1 -0
  591. package/dist/openapi/index.js.map +1 -0
  592. package/dist/openapi/metadata.d.ts +36 -0
  593. package/dist/openapi/metadata.d.ts.map +1 -0
  594. package/dist/openapi/metadata.js +78 -0
  595. package/dist/openapi/metadata.js.map +1 -0
  596. package/dist/openapi/route-scanner.d.ts +34 -0
  597. package/dist/openapi/route-scanner.d.ts.map +1 -0
  598. package/dist/openapi/route-scanner.js +174 -0
  599. package/dist/openapi/route-scanner.js.map +1 -0
  600. package/dist/openapi/schema-generator.d.ts +53 -0
  601. package/dist/openapi/schema-generator.d.ts.map +1 -0
  602. package/dist/openapi/schema-generator.js +236 -0
  603. package/dist/openapi/schema-generator.js.map +1 -0
  604. package/dist/openapi/swagger-module.d.ts +57 -0
  605. package/dist/openapi/swagger-module.d.ts.map +1 -0
  606. package/dist/openapi/swagger-module.js +143 -0
  607. package/dist/openapi/swagger-module.js.map +1 -0
  608. package/dist/openapi/types.d.ts +344 -0
  609. package/dist/openapi/types.d.ts.map +1 -0
  610. package/dist/openapi/types.js +7 -0
  611. package/dist/openapi/types.js.map +1 -0
  612. package/dist/orm/index.d.ts +10 -0
  613. package/dist/orm/index.d.ts.map +1 -0
  614. package/dist/orm/index.js.map +1 -0
  615. package/dist/router/index.d.ts +73 -0
  616. package/dist/router/index.d.ts.map +1 -0
  617. package/dist/router/index.js.map +1 -0
  618. package/dist/router/linear.d.ts +54 -0
  619. package/dist/router/linear.d.ts.map +1 -0
  620. package/dist/router/linear.js +261 -0
  621. package/dist/router/linear.js.map +1 -0
  622. package/dist/router/regex.d.ts +49 -0
  623. package/dist/router/regex.d.ts.map +1 -0
  624. package/dist/router/regex.js +201 -0
  625. package/dist/router/regex.js.map +1 -0
  626. package/dist/router/tree.d.ts +112 -0
  627. package/dist/router/tree.d.ts.map +1 -0
  628. package/dist/router/tree.js +360 -0
  629. package/dist/router/tree.js.map +1 -0
  630. package/dist/rpc/index.d.ts +321 -0
  631. package/dist/rpc/index.d.ts.map +1 -0
  632. package/dist/rpc/index.js.map +1 -0
  633. package/dist/schema/index.d.ts +10 -0
  634. package/dist/schema/index.d.ts.map +1 -0
  635. package/dist/schema/index.js.map +1 -0
  636. package/dist/security/index.d.ts +126 -0
  637. package/dist/security/index.d.ts.map +1 -0
  638. package/dist/security/index.js +309 -0
  639. package/dist/security/index.js.map +1 -0
  640. package/dist/ssg/index.d.ts +73 -0
  641. package/dist/ssg/index.d.ts.map +1 -0
  642. package/dist/ssg/index.js +464 -0
  643. package/dist/ssg/index.js.map +1 -0
  644. package/dist/storage/index.d.ts +99 -0
  645. package/dist/storage/index.d.ts.map +1 -0
  646. package/dist/storage/index.js +338 -0
  647. package/dist/storage/index.js.map +1 -0
  648. package/dist/telemetry/index.d.ts +376 -0
  649. package/dist/telemetry/index.d.ts.map +1 -0
  650. package/dist/telemetry/index.js.map +1 -0
  651. package/dist/template/index.d.ts +7 -0
  652. package/dist/template/index.d.ts.map +1 -0
  653. package/dist/template/index.js.map +1 -0
  654. package/dist/templates/engine.d.ts +60 -0
  655. package/dist/templates/engine.d.ts.map +1 -0
  656. package/dist/templates/engine.js +177 -0
  657. package/dist/templates/engine.js.map +1 -0
  658. package/dist/templates/index.d.ts +9 -0
  659. package/dist/templates/index.d.ts.map +1 -0
  660. package/dist/templates/index.js.map +1 -0
  661. package/dist/templates/loader.d.ts +45 -0
  662. package/dist/templates/loader.d.ts.map +1 -0
  663. package/dist/templates/loader.js +274 -0
  664. package/dist/templates/loader.js.map +1 -0
  665. package/dist/templates/renderers/markdown.d.ts +46 -0
  666. package/dist/templates/renderers/markdown.d.ts.map +1 -0
  667. package/dist/templates/renderers/markdown.js +181 -0
  668. package/dist/templates/renderers/markdown.js.map +1 -0
  669. package/dist/templates/renderers/simple.d.ts +35 -0
  670. package/dist/templates/renderers/simple.d.ts.map +1 -0
  671. package/dist/templates/renderers/simple.js +245 -0
  672. package/dist/templates/renderers/simple.js.map +1 -0
  673. package/dist/templates/types.d.ts +138 -0
  674. package/dist/templates/types.d.ts.map +1 -0
  675. package/dist/templates/types.js +8 -0
  676. package/dist/templates/types.js.map +1 -0
  677. package/dist/testing/index.d.ts +539 -0
  678. package/dist/testing/index.d.ts.map +1 -0
  679. package/dist/testing/index.js.map +1 -0
  680. package/dist/types/index.d.ts +116 -0
  681. package/dist/types/index.d.ts.map +1 -0
  682. package/dist/types/index.js.map +1 -0
  683. package/dist/validation/index.d.ts +89 -0
  684. package/dist/validation/index.d.ts.map +1 -0
  685. package/dist/validation/index.js +276 -0
  686. package/dist/validation/index.js.map +1 -0
  687. package/dist/validation/schemas.d.ts +283 -0
  688. package/dist/validation/schemas.d.ts.map +1 -0
  689. package/dist/validation/schemas.js +407 -0
  690. package/dist/validation/schemas.js.map +1 -0
  691. package/dist/websocket/index.d.ts +252 -0
  692. package/dist/websocket/index.d.ts.map +1 -0
  693. package/dist/websocket/index.js +749 -0
  694. package/dist/websocket/index.js.map +1 -0
  695. package/package.json +3 -3
  696. package/src/database/migrations/index.ts +8 -0
  697. package/src/migrations/index.ts +40 -1
  698. package/src/types/index.ts +1 -1
  699. package/tsconfig.json +2 -6
@@ -0,0 +1,740 @@
1
+ /**
2
+ * Log Transport System
3
+ *
4
+ * Provides transport implementations for external log aggregation services
5
+ * like Datadog, generic HTTP webhooks, and console output.
6
+ */
7
+ /**
8
+ * Generic HTTP webhook transport for sending logs to any HTTP endpoint
9
+ */
10
+ export class HTTPWebhookTransport {
11
+ name = "HTTPWebhookTransport";
12
+ url;
13
+ headers;
14
+ batchSize;
15
+ flushInterval;
16
+ retryOptions;
17
+ onError;
18
+ timeout;
19
+ queue = [];
20
+ flushTimer = null;
21
+ isFlushing = false;
22
+ isClosed = false;
23
+ constructor(options) {
24
+ this.url = options.url;
25
+ this.headers = options.headers ?? {};
26
+ this.batchSize = options.batchSize ?? 100;
27
+ this.flushInterval = options.flushInterval ?? 5000;
28
+ this.timeout = options.timeout ?? 30000;
29
+ this.retryOptions = {
30
+ maxRetries: 3,
31
+ initialDelay: 100,
32
+ maxDelay: 10000,
33
+ backoffMultiplier: 2,
34
+ ...options.retries,
35
+ };
36
+ this.onError = options.onError;
37
+ this.startFlushTimer();
38
+ }
39
+ /**
40
+ * Start the flush timer
41
+ */
42
+ startFlushTimer() {
43
+ if (this.flushTimer) {
44
+ clearInterval(this.flushTimer);
45
+ }
46
+ this.flushTimer = setInterval(() => {
47
+ this.flush().catch((err) => this.handleError(err));
48
+ }, this.flushInterval);
49
+ }
50
+ /**
51
+ * Send a single log entry
52
+ */
53
+ async send(entry) {
54
+ if (this.isClosed)
55
+ return;
56
+ this.queue.push(entry);
57
+ if (this.queue.length >= this.batchSize) {
58
+ await this.flush();
59
+ }
60
+ }
61
+ /**
62
+ * Send multiple log entries
63
+ */
64
+ async sendBatch(entries) {
65
+ if (this.isClosed)
66
+ return;
67
+ this.queue.push(...entries);
68
+ if (this.queue.length >= this.batchSize) {
69
+ await this.flush();
70
+ }
71
+ }
72
+ /**
73
+ * Flush pending logs
74
+ */
75
+ async flush() {
76
+ if (this.isFlushing || this.queue.length === 0 || this.isClosed)
77
+ return;
78
+ this.isFlushing = true;
79
+ const entriesToSend = [...this.queue];
80
+ this.queue = [];
81
+ try {
82
+ await this.sendWithRetry(entriesToSend);
83
+ }
84
+ catch (error) {
85
+ // Re-add entries to queue on failure
86
+ this.queue.unshift(...entriesToSend);
87
+ throw error;
88
+ }
89
+ finally {
90
+ this.isFlushing = false;
91
+ }
92
+ }
93
+ /**
94
+ * Send entries with retry logic
95
+ */
96
+ async sendWithRetry(entries) {
97
+ let lastError = null;
98
+ let delay = this.retryOptions.initialDelay;
99
+ for (let attempt = 0; attempt <= this.retryOptions.maxRetries; attempt++) {
100
+ try {
101
+ await this.makeRequest(entries);
102
+ return;
103
+ }
104
+ catch (error) {
105
+ lastError = error instanceof Error ? error : new Error(String(error));
106
+ if (attempt < this.retryOptions.maxRetries) {
107
+ await this.sleep(delay);
108
+ delay = Math.min(delay * this.retryOptions.backoffMultiplier, this.retryOptions.maxDelay);
109
+ }
110
+ }
111
+ }
112
+ throw lastError;
113
+ }
114
+ /**
115
+ * Make HTTP request
116
+ */
117
+ async makeRequest(entries) {
118
+ const controller = new AbortController();
119
+ const timeoutId = setTimeout(() => controller.abort(), this.timeout);
120
+ try {
121
+ const response = await fetch(this.url, {
122
+ method: "POST",
123
+ headers: {
124
+ "Content-Type": "application/json",
125
+ ...this.headers,
126
+ },
127
+ body: JSON.stringify(entries),
128
+ signal: controller.signal,
129
+ });
130
+ if (!response.ok) {
131
+ throw new Error(`HTTP ${response.status}: ${response.statusText}`);
132
+ }
133
+ }
134
+ finally {
135
+ clearTimeout(timeoutId);
136
+ }
137
+ }
138
+ /**
139
+ * Sleep utility
140
+ */
141
+ sleep(ms) {
142
+ return new Promise((resolve) => setTimeout(resolve, ms));
143
+ }
144
+ /**
145
+ * Handle errors
146
+ */
147
+ handleError(error) {
148
+ if (this.onError) {
149
+ this.onError(error, this);
150
+ }
151
+ }
152
+ /**
153
+ * Close the transport
154
+ */
155
+ async close() {
156
+ this.isClosed = true;
157
+ if (this.flushTimer) {
158
+ clearInterval(this.flushTimer);
159
+ this.flushTimer = null;
160
+ }
161
+ // Flush remaining entries
162
+ if (this.queue.length > 0) {
163
+ try {
164
+ await this.flush();
165
+ }
166
+ catch (error) {
167
+ this.handleError(error instanceof Error ? error : new Error(String(error)));
168
+ }
169
+ }
170
+ }
171
+ }
172
+ /**
173
+ * Datadog Logs API transport
174
+ */
175
+ export class DatadogTransport {
176
+ name = "DatadogTransport";
177
+ apiKey;
178
+ service;
179
+ env;
180
+ hostname;
181
+ tags;
182
+ endpoint;
183
+ batchSize;
184
+ flushInterval;
185
+ retryOptions;
186
+ onError;
187
+ timeout;
188
+ queue = [];
189
+ flushTimer = null;
190
+ isFlushing = false;
191
+ isClosed = false;
192
+ constructor(options) {
193
+ this.apiKey = options.apiKey;
194
+ this.service = options.service;
195
+ this.env = options.env ?? process.env.NODE_ENV ?? "development";
196
+ this.hostname = options.hostname ?? this.getDefaultHostname();
197
+ this.tags = options.tags ?? [];
198
+ this.endpoint =
199
+ options.endpoint ?? "https://http-intake.logs.datadoghq.com/v1/input";
200
+ this.batchSize = options.batchSize ?? 100;
201
+ this.flushInterval = options.flushInterval ?? 5000;
202
+ this.timeout = options.timeout ?? 30000;
203
+ this.retryOptions = {
204
+ maxRetries: 3,
205
+ initialDelay: 100,
206
+ maxDelay: 10000,
207
+ backoffMultiplier: 2,
208
+ ...options.retries,
209
+ };
210
+ this.onError = options.onError;
211
+ this.startFlushTimer();
212
+ }
213
+ /**
214
+ * Get default hostname
215
+ */
216
+ getDefaultHostname() {
217
+ try {
218
+ return process.env.HOSTNAME ?? process.env.COMPUTERNAME ?? "unknown";
219
+ }
220
+ catch {
221
+ return "unknown";
222
+ }
223
+ }
224
+ /**
225
+ * Start the flush timer
226
+ */
227
+ startFlushTimer() {
228
+ if (this.flushTimer) {
229
+ clearInterval(this.flushTimer);
230
+ }
231
+ this.flushTimer = setInterval(() => {
232
+ this.flush().catch((err) => this.handleError(err));
233
+ }, this.flushInterval);
234
+ }
235
+ /**
236
+ * Convert log level to Datadog status
237
+ */
238
+ toDatadogStatus(level) {
239
+ const statusMap = {
240
+ debug: "debug",
241
+ info: "info",
242
+ warn: "warn",
243
+ error: "error",
244
+ fatal: "emerg",
245
+ };
246
+ return statusMap[level];
247
+ }
248
+ /**
249
+ * Convert LogEntry to Datadog format
250
+ */
251
+ toDatadogFormat(entry) {
252
+ const allTags = [...this.tags];
253
+ // Add environment tag
254
+ if (this.env) {
255
+ allTags.push(`env:${this.env}`);
256
+ }
257
+ // Add context as tags
258
+ if (entry.context) {
259
+ for (const [key, value] of Object.entries(entry.context)) {
260
+ if (typeof value === "string" ||
261
+ typeof value === "number" ||
262
+ typeof value === "boolean") {
263
+ allTags.push(`${key}:${value}`);
264
+ }
265
+ }
266
+ }
267
+ const datadogEntry = {
268
+ ddsource: "bueno",
269
+ ddsourcecategory: "framework",
270
+ ddtags: allTags.join(","),
271
+ hostname: this.hostname,
272
+ service: this.service,
273
+ status: this.toDatadogStatus(entry.level),
274
+ message: entry.message,
275
+ timestamp: entry.timestamp,
276
+ };
277
+ // Add error details
278
+ if (entry.error) {
279
+ datadogEntry.error = {
280
+ kind: entry.error.name,
281
+ message: entry.error.message,
282
+ stack: entry.error.stack,
283
+ };
284
+ }
285
+ // Add duration if present
286
+ if (entry.duration !== undefined) {
287
+ datadogEntry.duration = entry.duration;
288
+ }
289
+ // Add any additional fields from the entry
290
+ for (const [key, value] of Object.entries(entry)) {
291
+ if (![
292
+ "level",
293
+ "message",
294
+ "timestamp",
295
+ "context",
296
+ "error",
297
+ "duration",
298
+ ].includes(key)) {
299
+ datadogEntry[key] = value;
300
+ }
301
+ }
302
+ return datadogEntry;
303
+ }
304
+ /**
305
+ * Send a single log entry
306
+ */
307
+ async send(entry) {
308
+ if (this.isClosed)
309
+ return;
310
+ this.queue.push(entry);
311
+ if (this.queue.length >= this.batchSize) {
312
+ await this.flush();
313
+ }
314
+ }
315
+ /**
316
+ * Send multiple log entries
317
+ */
318
+ async sendBatch(entries) {
319
+ if (this.isClosed)
320
+ return;
321
+ this.queue.push(...entries);
322
+ if (this.queue.length >= this.batchSize) {
323
+ await this.flush();
324
+ }
325
+ }
326
+ /**
327
+ * Flush pending logs
328
+ */
329
+ async flush() {
330
+ if (this.isFlushing || this.queue.length === 0 || this.isClosed)
331
+ return;
332
+ this.isFlushing = true;
333
+ const entriesToSend = [...this.queue];
334
+ this.queue = [];
335
+ try {
336
+ await this.sendWithRetry(entriesToSend);
337
+ }
338
+ catch (error) {
339
+ // Re-add entries to queue on failure
340
+ this.queue.unshift(...entriesToSend);
341
+ throw error;
342
+ }
343
+ finally {
344
+ this.isFlushing = false;
345
+ }
346
+ }
347
+ /**
348
+ * Send entries with retry logic
349
+ */
350
+ async sendWithRetry(entries) {
351
+ let lastError = null;
352
+ let delay = this.retryOptions.initialDelay;
353
+ for (let attempt = 0; attempt <= this.retryOptions.maxRetries; attempt++) {
354
+ try {
355
+ await this.makeRequest(entries);
356
+ return;
357
+ }
358
+ catch (error) {
359
+ lastError = error instanceof Error ? error : new Error(String(error));
360
+ if (attempt < this.retryOptions.maxRetries) {
361
+ await this.sleep(delay);
362
+ delay = Math.min(delay * this.retryOptions.backoffMultiplier, this.retryOptions.maxDelay);
363
+ }
364
+ }
365
+ }
366
+ throw lastError;
367
+ }
368
+ /**
369
+ * Make HTTP request to Datadog
370
+ */
371
+ async makeRequest(entries) {
372
+ const datadogEntries = entries.map((e) => this.toDatadogFormat(e));
373
+ const controller = new AbortController();
374
+ const timeoutId = setTimeout(() => controller.abort(), this.timeout);
375
+ try {
376
+ const response = await fetch(this.endpoint, {
377
+ method: "POST",
378
+ headers: {
379
+ "Content-Type": "application/json",
380
+ "DD-API-KEY": this.apiKey,
381
+ },
382
+ body: datadogEntries.map((e) => JSON.stringify(e)).join("\n"),
383
+ signal: controller.signal,
384
+ });
385
+ if (!response.ok) {
386
+ throw new Error(`Datadog API error: HTTP ${response.status}: ${response.statusText}`);
387
+ }
388
+ }
389
+ finally {
390
+ clearTimeout(timeoutId);
391
+ }
392
+ }
393
+ /**
394
+ * Sleep utility
395
+ */
396
+ sleep(ms) {
397
+ return new Promise((resolve) => setTimeout(resolve, ms));
398
+ }
399
+ /**
400
+ * Handle errors
401
+ */
402
+ handleError(error) {
403
+ if (this.onError) {
404
+ this.onError(error, this);
405
+ }
406
+ }
407
+ /**
408
+ * Close the transport
409
+ */
410
+ async close() {
411
+ this.isClosed = true;
412
+ if (this.flushTimer) {
413
+ clearInterval(this.flushTimer);
414
+ this.flushTimer = null;
415
+ }
416
+ // Flush remaining entries
417
+ if (this.queue.length > 0) {
418
+ try {
419
+ await this.flush();
420
+ }
421
+ catch (error) {
422
+ this.handleError(error instanceof Error ? error : new Error(String(error)));
423
+ }
424
+ }
425
+ }
426
+ }
427
+ /**
428
+ * Enhanced console transport for local development
429
+ */
430
+ export class ConsoleTransport {
431
+ name = "ConsoleTransport";
432
+ pretty;
433
+ stream;
434
+ onError;
435
+ constructor(options = {}) {
436
+ this.pretty = options.pretty ?? process.env.NODE_ENV !== "production";
437
+ this.stream = options.stream ?? "stdout";
438
+ this.onError = options.onError;
439
+ }
440
+ /**
441
+ * Get level color for pretty printing
442
+ */
443
+ getLevelColor(level) {
444
+ const colors = {
445
+ debug: "\x1b[36m", // cyan
446
+ info: "\x1b[32m", // green
447
+ warn: "\x1b[33m", // yellow
448
+ error: "\x1b[31m", // red
449
+ fatal: "\x1b[35m", // magenta
450
+ };
451
+ return colors[level];
452
+ }
453
+ /**
454
+ * Format log entry for console output
455
+ */
456
+ formatEntry(entry) {
457
+ if (this.pretty) {
458
+ const color = this.getLevelColor(entry.level);
459
+ const reset = "\x1b[0m";
460
+ let output = `${entry.timestamp} ${color}[${entry.level.toUpperCase()}]${reset} ${entry.message}`;
461
+ if (entry.context && Object.keys(entry.context).length > 0) {
462
+ output += ` ${reset}\x1b[90m${JSON.stringify(entry.context)}\x1b[0m`;
463
+ }
464
+ if (entry.duration !== undefined) {
465
+ output += ` \x1b[90m(${entry.duration}ms)\x1b[0m`;
466
+ }
467
+ if (entry.error) {
468
+ output += `\n \x1b[31m${entry.error.name}: ${entry.error.message}\x1b[0m`;
469
+ if (entry.error.stack) {
470
+ output += `\n \x1b[90m${entry.error.stack}\x1b[0m`;
471
+ }
472
+ }
473
+ return output;
474
+ }
475
+ return JSON.stringify(entry);
476
+ }
477
+ /**
478
+ * Output to console
479
+ */
480
+ output(formatted, level) {
481
+ if (this.stream === "stderr" || level === "error" || level === "fatal") {
482
+ console.error(formatted);
483
+ }
484
+ else if (level === "warn") {
485
+ console.warn(formatted);
486
+ }
487
+ else {
488
+ console.log(formatted);
489
+ }
490
+ }
491
+ /**
492
+ * Send a single log entry
493
+ */
494
+ async send(entry) {
495
+ try {
496
+ const formatted = this.formatEntry(entry);
497
+ this.output(formatted, entry.level);
498
+ }
499
+ catch (error) {
500
+ if (this.onError) {
501
+ this.onError(error instanceof Error ? error : new Error(String(error)), this);
502
+ }
503
+ }
504
+ }
505
+ /**
506
+ * Send multiple log entries
507
+ */
508
+ async sendBatch(entries) {
509
+ for (const entry of entries) {
510
+ await this.send(entry);
511
+ }
512
+ }
513
+ /**
514
+ * Flush (no-op for console)
515
+ */
516
+ async flush() {
517
+ // Console transport doesn't buffer
518
+ }
519
+ /**
520
+ * Close (no-op for console)
521
+ */
522
+ async close() {
523
+ // Console transport doesn't need cleanup
524
+ }
525
+ }
526
+ // ============= Transport Manager =============
527
+ /**
528
+ * Manages multiple log transports
529
+ */
530
+ export class TransportManager {
531
+ transports = new Set();
532
+ onError;
533
+ constructor(options) {
534
+ this.onError = options?.onError;
535
+ }
536
+ /**
537
+ * Add a transport
538
+ */
539
+ addTransport(transport) {
540
+ this.transports.add(transport);
541
+ }
542
+ /**
543
+ * Remove a transport
544
+ */
545
+ removeTransport(transport) {
546
+ return this.transports.delete(transport);
547
+ }
548
+ /**
549
+ * Get all transports
550
+ */
551
+ getTransports() {
552
+ return [...this.transports];
553
+ }
554
+ /**
555
+ * Check if a transport is registered
556
+ */
557
+ hasTransport(transport) {
558
+ return this.transports.has(transport);
559
+ }
560
+ /**
561
+ * Clear all transports
562
+ */
563
+ clearTransports() {
564
+ this.transports.clear();
565
+ }
566
+ /**
567
+ * Broadcast a log entry to all transports
568
+ */
569
+ async broadcast(entry) {
570
+ const promises = [...this.transports].map(async (transport) => {
571
+ try {
572
+ await transport.send(entry);
573
+ }
574
+ catch (error) {
575
+ if (this.onError) {
576
+ this.onError(error instanceof Error ? error : new Error(String(error)), transport);
577
+ }
578
+ }
579
+ });
580
+ await Promise.allSettled(promises);
581
+ }
582
+ /**
583
+ * Broadcast multiple entries to all transports
584
+ */
585
+ async broadcastBatch(entries) {
586
+ const promises = [...this.transports].map(async (transport) => {
587
+ try {
588
+ await transport.sendBatch(entries);
589
+ }
590
+ catch (error) {
591
+ if (this.onError) {
592
+ this.onError(error instanceof Error ? error : new Error(String(error)), transport);
593
+ }
594
+ }
595
+ });
596
+ await Promise.allSettled(promises);
597
+ }
598
+ /**
599
+ * Flush all transports
600
+ */
601
+ async flushAll() {
602
+ const promises = [...this.transports].map(async (transport) => {
603
+ if (transport.flush) {
604
+ try {
605
+ await transport.flush();
606
+ }
607
+ catch (error) {
608
+ if (this.onError) {
609
+ this.onError(error instanceof Error ? error : new Error(String(error)), transport);
610
+ }
611
+ }
612
+ }
613
+ });
614
+ await Promise.allSettled(promises);
615
+ }
616
+ /**
617
+ * Close all transports
618
+ */
619
+ async closeAll() {
620
+ const promises = [...this.transports].map(async (transport) => {
621
+ if (transport.close) {
622
+ try {
623
+ await transport.close();
624
+ }
625
+ catch (error) {
626
+ if (this.onError) {
627
+ this.onError(error instanceof Error ? error : new Error(String(error)), transport);
628
+ }
629
+ }
630
+ }
631
+ });
632
+ await Promise.allSettled(promises);
633
+ this.transports.clear();
634
+ }
635
+ }
636
+ // ============= Logger Integration =============
637
+ import { Logger } from "../index";
638
+ /**
639
+ * Logger with transport support
640
+ */
641
+ export class LoggerWithTransports extends Logger {
642
+ transportManager;
643
+ constructor(config = {}) {
644
+ const { transports, onTransportError, ...loggerConfig } = config;
645
+ // Create transport manager
646
+ const transportManager = new TransportManager({
647
+ onError: onTransportError,
648
+ });
649
+ // Add transports
650
+ if (transports) {
651
+ for (const transport of transports) {
652
+ transportManager.addTransport(transport);
653
+ }
654
+ }
655
+ // Create output function that broadcasts to transports
656
+ const originalOutput = loggerConfig.output;
657
+ const outputFn = (entry) => {
658
+ // Call original output if specified
659
+ if (originalOutput) {
660
+ if (typeof originalOutput === "function") {
661
+ originalOutput(entry);
662
+ }
663
+ }
664
+ else {
665
+ // Default console output
666
+ console.log(JSON.stringify(entry));
667
+ }
668
+ // Broadcast to transports (async, fire-and-forget)
669
+ transportManager.broadcast(entry).catch(() => {
670
+ // Errors are handled by the transport manager
671
+ });
672
+ };
673
+ super({
674
+ ...loggerConfig,
675
+ output: outputFn,
676
+ });
677
+ this.transportManager = transportManager;
678
+ }
679
+ /**
680
+ * Add a transport
681
+ */
682
+ addTransport(transport) {
683
+ this.transportManager.addTransport(transport);
684
+ }
685
+ /**
686
+ * Remove a transport
687
+ */
688
+ removeTransport(transport) {
689
+ return this.transportManager.removeTransport(transport);
690
+ }
691
+ /**
692
+ * Get all transports
693
+ */
694
+ getTransports() {
695
+ return this.transportManager.getTransports();
696
+ }
697
+ /**
698
+ * Flush all transports
699
+ */
700
+ async flushTransports() {
701
+ await this.transportManager.flushAll();
702
+ }
703
+ /**
704
+ * Close all transports
705
+ */
706
+ async closeTransports() {
707
+ await this.transportManager.closeAll();
708
+ }
709
+ }
710
+ /**
711
+ * Create a logger with transports
712
+ */
713
+ export function createLoggerWithTransports(config = {}) {
714
+ return new LoggerWithTransports(config);
715
+ }
716
+ /**
717
+ * Create a transport output function for use with existing Logger
718
+ */
719
+ export function createTransportOutput(transports, options) {
720
+ const manager = new TransportManager({ onError: options?.onError });
721
+ for (const transport of transports) {
722
+ manager.addTransport(transport);
723
+ }
724
+ return (entry) => {
725
+ manager.broadcast(entry).catch(() => {
726
+ // Errors are handled by the transport manager
727
+ });
728
+ };
729
+ }
730
+ // ============= Exports =============
731
+ export default {
732
+ HTTPWebhookTransport,
733
+ DatadogTransport,
734
+ ConsoleTransport,
735
+ TransportManager,
736
+ LoggerWithTransports,
737
+ createLoggerWithTransports,
738
+ createTransportOutput,
739
+ };
740
+ //# sourceMappingURL=index.js.map