raiton 0.0.2 → 1.0.0-alpha.1

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 (435) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +20 -0
  3. package/build/bin/index.mjs +6788 -47
  4. package/build/raiton-1.0.0-alpha.1.tgz +0 -0
  5. package/package.json +21 -36
  6. package/source/bin/bootstrapper.ts +15 -0
  7. package/source/bin/cli-tools.ts +43 -0
  8. package/source/bin/cli.ts +12 -0
  9. package/source/bin/index.ts +6 -0
  10. package/source/commands/artifact.command.ts +28 -0
  11. package/source/commands/build.command.ts +31 -0
  12. package/source/commands/develop.command.ts +47 -0
  13. package/source/commands/grafts.command.ts +27 -0
  14. package/source/commands/start.command.ts +28 -0
  15. package/source/core/application.ts +115 -0
  16. package/source/core/artifacts/artifact.ts +109 -0
  17. package/source/core/artifacts/artifacts.ts +10 -0
  18. package/source/core/artifacts/index.ts +1 -0
  19. package/source/core/artifacts/runner.ts +3 -0
  20. package/source/core/builder.ts +138 -0
  21. package/source/core/bytes.util.ts +17 -0
  22. package/source/core/command.ts +24 -0
  23. package/source/core/commands.ts +44 -0
  24. package/source/core/config/config.ts +51 -0
  25. package/source/core/config/define.ts +13 -0
  26. package/source/core/config/index.ts +2 -0
  27. package/source/core/context.ts +33 -0
  28. package/source/core/controller/builder.ts +38 -0
  29. package/source/core/controller/compiler.ts +22 -0
  30. package/source/core/controller/index.ts +3 -0
  31. package/source/core/controller/metadata.ts +13 -0
  32. package/source/core/directories.ts +30 -0
  33. package/source/core/helpers/index.ts +1 -0
  34. package/source/core/helpers/raiton.ts +3 -0
  35. package/source/core/hmr.ts +106 -0
  36. package/source/core/hooks.ts +28 -0
  37. package/source/core/index.ts +13 -0
  38. package/source/core/injection/index.ts +1 -0
  39. package/source/core/injection/injection.ts +157 -0
  40. package/source/core/middleware/compose.ts +40 -0
  41. package/source/core/middleware/index.ts +2 -0
  42. package/source/core/middleware/pipeline.ts +27 -0
  43. package/source/core/plugins/index.ts +2 -0
  44. package/source/core/plugins/plugin.ts +8 -0
  45. package/source/core/plugins/scope.ts +46 -0
  46. package/source/core/process.util.ts +12 -0
  47. package/source/core/raiton.ts +21 -0
  48. package/source/core/router/handler.ts +59 -0
  49. package/source/core/router/index.ts +4 -0
  50. package/source/core/router/matcher.ts +51 -0
  51. package/source/core/router/route.ts +63 -0
  52. package/source/core/router/router.ts +31 -0
  53. package/source/core/server.ts +26 -0
  54. package/source/core/thread.ts +87 -0
  55. package/source/env.d.ts +3 -0
  56. package/source/requirements.ts +27 -0
  57. package/source/sdk/artifacts.ts +55 -0
  58. package/source/sdk/constants/decorators.constant.ts +7 -0
  59. package/source/sdk/constants/index.ts +2 -0
  60. package/source/sdk/constants/microservices.constant.ts +4 -0
  61. package/source/sdk/controllers.ts +4 -0
  62. package/source/sdk/data-transfer-object.ts +7 -0
  63. package/source/sdk/decorators/access-guard.decorator.ts +9 -0
  64. package/source/sdk/decorators/controllable.decorator.ts +20 -0
  65. package/source/sdk/decorators/index.ts +5 -0
  66. package/source/sdk/decorators/injection.decorator.ts +46 -0
  67. package/source/sdk/decorators/middleware.decorator.ts +15 -0
  68. package/source/sdk/decorators/parametrable.ts +24 -0
  69. package/source/sdk/decorators/payload.decorator.ts +77 -0
  70. package/source/sdk/decorators/routable.decorator.ts +48 -0
  71. package/source/sdk/encryption.ts +155 -0
  72. package/source/sdk/enums/encrypted.enum.ts +13 -0
  73. package/source/sdk/enums/event.message.enum.ts +4 -0
  74. package/{build/sdk/enums/http-parameters.enum.d.ts → source/sdk/enums/http-parameters.enum.ts} +3 -5
  75. package/source/sdk/enums/http.enum.ts +10 -0
  76. package/source/sdk/enums/index.ts +6 -0
  77. package/{build/sdk/enums/runtime.enum.d.ts → source/sdk/enums/runtime.enum.ts} +2 -4
  78. package/{build/sdk/enums/timestamp.enum.d.ts → source/sdk/enums/timestamp.enum.ts} +2 -4
  79. package/source/sdk/env.ts +40 -0
  80. package/source/sdk/index.ts +6 -0
  81. package/source/sdk/json.ts +55 -0
  82. package/source/sdk/plugins/body-parser.plugin.ts +119 -0
  83. package/source/sdk/plugins/index.ts +2 -0
  84. package/source/sdk/plugins/security/body-limit.ts +19 -0
  85. package/source/sdk/plugins/security/cors.ts +44 -0
  86. package/source/sdk/plugins/security/headers.ts +14 -0
  87. package/source/sdk/plugins/security/index.ts +13 -0
  88. package/source/sdk/plugins/security/method-guard.ts +14 -0
  89. package/source/sdk/plugins/security/rate-limit.ts +42 -0
  90. package/source/sdk/repositories.ts +14 -0
  91. package/source/sdk/request.ts +3 -0
  92. package/source/sdk/responses.ts +45 -0
  93. package/source/sdk/runtime/bun/server.ts +72 -0
  94. package/source/sdk/runtime/deno/server.ts +53 -0
  95. package/source/sdk/runtime/index.ts +47 -0
  96. package/source/sdk/runtime/node/server.ts +60 -0
  97. package/source/sdk/runtime/web/server.ts +57 -0
  98. package/{build/sdk/schemes.d.ts → source/sdk/schemes.ts} +91 -33
  99. package/source/sdk/services.ts +9 -0
  100. package/{build/sdk/throwable.d.ts → source/sdk/throwable.ts} +35 -12
  101. package/source/sdk/utilities/alias-path.util.ts +49 -0
  102. package/source/sdk/utilities/artifacts.util.ts +62 -0
  103. package/source/sdk/utilities/callable.util.ts +27 -0
  104. package/source/sdk/utilities/controller.util.ts +8 -0
  105. package/source/sdk/utilities/index.ts +7 -0
  106. package/source/sdk/utilities/json.util.ts +21 -0
  107. package/source/sdk/utilities/path.util.ts +19 -0
  108. package/source/sdk/utilities/url.ts +5 -0
  109. package/source/sdk/utilities/utilities.util.ts +25 -0
  110. package/source/types/access-guards.ts +4 -0
  111. package/{build/types/application.d.ts → source/types/application.ts} +23 -7
  112. package/source/types/artifact.ts +40 -0
  113. package/source/types/builder.ts +48 -0
  114. package/source/types/config.ts +7 -0
  115. package/source/types/controller.ts +34 -0
  116. package/source/types/contruct.ts +3 -0
  117. package/source/types/core.ts +28 -0
  118. package/source/types/data-transfer-object.ts +4 -0
  119. package/{build/types/directory.d.ts → source/types/directory.ts} +4 -4
  120. package/source/types/encryption.ts +17 -0
  121. package/source/types/generic.ts +3 -0
  122. package/{build/types/hmr.d.ts → source/types/hmr.ts} +19 -5
  123. package/source/types/http-responses.ts +8 -0
  124. package/source/types/index.ts +26 -0
  125. package/source/types/injection.ts +13 -0
  126. package/source/types/middleware.ts +18 -0
  127. package/source/types/parseable.ts +7 -0
  128. package/source/types/plugin.ts +10 -0
  129. package/source/types/raiton.ts +9 -0
  130. package/source/types/responses.ts +10 -0
  131. package/source/types/router.ts +11 -0
  132. package/source/types/runtime.ts +53 -0
  133. package/{build/types/scheme.d.ts → source/types/scheme.ts} +33 -8
  134. package/source/types/server.ts +12 -0
  135. package/source/types/thread.ts +31 -0
  136. package/source/types/utilities.ts +4 -0
  137. package/source/types/values.ts +3 -0
  138. package/.releaserc.json +0 -45
  139. package/build/bin/bootstrapper.d.ts +0 -5
  140. package/build/bin/bootstrapper.mjs +0 -46
  141. package/build/bin/cli.d.ts +0 -5
  142. package/build/bin/cli.mjs +0 -6
  143. package/build/bin/index.d.ts +0 -1
  144. package/build/chunk-3PWMRP6G.mjs +0 -16
  145. package/build/chunk-52JR26TI.mjs +0 -29
  146. package/build/chunk-5LNOA4SK.mjs +0 -16
  147. package/build/chunk-AUGL35CF.mjs +0 -24
  148. package/build/chunk-BVILWYAP.mjs +0 -14
  149. package/build/chunk-BYYJRCB4.mjs +0 -10
  150. package/build/chunk-FFRJ4AUA.mjs +0 -16
  151. package/build/chunk-GPJSLV3Q.mjs +0 -50
  152. package/build/chunk-HVFHDVAH.mjs +0 -20
  153. package/build/chunk-IOCHNQMF.mjs +0 -13
  154. package/build/chunk-JATYBWHL.mjs +0 -36
  155. package/build/chunk-JWNBO7XV.mjs +0 -53
  156. package/build/chunk-K4IQQ2KF.mjs +0 -55
  157. package/build/chunk-K4KLOLSO.mjs +0 -645
  158. package/build/chunk-M2RZZJQR.mjs +0 -27
  159. package/build/chunk-MLFGBJDV.mjs +0 -12
  160. package/build/chunk-NB62GSFI.mjs +0 -27
  161. package/build/chunk-O7R3NJQN.mjs +0 -19
  162. package/build/chunk-P3IRIFPT.mjs +0 -53
  163. package/build/chunk-QFSXFOEN.mjs +0 -56
  164. package/build/chunk-QHCQ4AUA.mjs +0 -14
  165. package/build/chunk-QI7OFSXB.mjs +0 -37
  166. package/build/chunk-RVH2YBNU.mjs +0 -111
  167. package/build/chunk-RXG7754R.mjs +0 -25
  168. package/build/chunk-S3ONGVNZ.mjs +0 -11
  169. package/build/chunk-SRR4467I.mjs +0 -29
  170. package/build/chunk-T6L55AUG.mjs +0 -32
  171. package/build/chunk-TOJFTPAY.mjs +0 -83
  172. package/build/chunk-UAPCBU3J.mjs +0 -12
  173. package/build/chunk-UCHBN3DV.mjs +0 -52
  174. package/build/chunk-UWM46HLZ.mjs +0 -18
  175. package/build/chunk-UZFCGVHP.mjs +0 -8
  176. package/build/chunk-VQINCGLQ.mjs +0 -59
  177. package/build/chunk-VRL4S7UF.mjs +0 -74
  178. package/build/chunk-WAWFDMOH.mjs +0 -72
  179. package/build/chunk-X3JFRRRQ.mjs +0 -45
  180. package/build/chunk-XFBLELHI.mjs +0 -34
  181. package/build/chunk-XIGE72LC.mjs +0 -34
  182. package/build/chunk-XW7EPAD7.mjs +0 -0
  183. package/build/chunk-YGIZFKLJ.mjs +0 -20
  184. package/build/chunk-YRVIAORI.mjs +0 -8
  185. package/build/chunk-YXU5W2CB.mjs +0 -12
  186. package/build/commands/artifact.command.d.ts +0 -14
  187. package/build/commands/artifact.command.mjs +0 -59
  188. package/build/commands/build.command.d.ts +0 -14
  189. package/build/commands/build.command.mjs +0 -65
  190. package/build/commands/develop.command.d.ts +0 -13
  191. package/build/commands/develop.command.mjs +0 -75
  192. package/build/commands/grafts.command.d.ts +0 -12
  193. package/build/commands/grafts.command.mjs +0 -58
  194. package/build/commands/start.command.d.ts +0 -12
  195. package/build/commands/start.command.mjs +0 -64
  196. package/build/core/application.d.ts +0 -27
  197. package/build/core/application.mjs +0 -124
  198. package/build/core/artifact.d.ts +0 -19
  199. package/build/core/artifact.mjs +0 -133
  200. package/build/core/builder.d.ts +0 -35
  201. package/build/core/builder.mjs +0 -45
  202. package/build/core/bytes.util.d.ts +0 -6
  203. package/build/core/bytes.util.mjs +0 -8
  204. package/build/core/command.d.ts +0 -15
  205. package/build/core/command.mjs +0 -6
  206. package/build/core/commands.d.ts +0 -13
  207. package/build/core/commands.mjs +0 -7
  208. package/build/core/config.d.ts +0 -10
  209. package/build/core/config.mjs +0 -7
  210. package/build/core/context.d.ts +0 -15
  211. package/build/core/context.mjs +0 -6
  212. package/build/core/controller/builder.d.ts +0 -10
  213. package/build/core/controller/builder.mjs +0 -45
  214. package/build/core/controller/compiler.d.ts +0 -6
  215. package/build/core/controller/compiler.mjs +0 -45
  216. package/build/core/controller/index.d.ts +0 -13
  217. package/build/core/controller/index.mjs +0 -50
  218. package/build/core/controller/metadata.d.ts +0 -10
  219. package/build/core/controller/metadata.mjs +0 -6
  220. package/build/core/directories.d.ts +0 -11
  221. package/build/core/directories.mjs +0 -8
  222. package/build/core/hmr.d.ts +0 -22
  223. package/build/core/hmr.mjs +0 -6
  224. package/build/core/hooks.d.ts +0 -12
  225. package/build/core/hooks.mjs +0 -6
  226. package/build/core/index.d.ts +0 -41
  227. package/build/core/index.mjs +0 -100
  228. package/build/core/middleware/compose.d.ts +0 -8
  229. package/build/core/middleware/compose.mjs +0 -6
  230. package/build/core/middleware/index.d.ts +0 -6
  231. package/build/core/middleware/index.mjs +0 -11
  232. package/build/core/middleware/pipeline.d.ts +0 -14
  233. package/build/core/middleware/pipeline.mjs +0 -7
  234. package/build/core/plugins/index.d.ts +0 -14
  235. package/build/core/plugins/index.mjs +0 -48
  236. package/build/core/plugins/plugin.d.ts +0 -17
  237. package/build/core/plugins/plugin.mjs +0 -6
  238. package/build/core/plugins/scope.d.ts +0 -24
  239. package/build/core/plugins/scope.mjs +0 -45
  240. package/build/core/process.util.d.ts +0 -3
  241. package/build/core/process.util.mjs +0 -6
  242. package/build/core/raiton.d.ts +0 -20
  243. package/build/core/raiton.mjs +0 -6
  244. package/build/core/router/handler.d.ts +0 -10
  245. package/build/core/router/handler.mjs +0 -45
  246. package/build/core/router/index.d.ts +0 -12
  247. package/build/core/router/index.mjs +0 -54
  248. package/build/core/router/matcher.d.ts +0 -21
  249. package/build/core/router/matcher.mjs +0 -6
  250. package/build/core/router/route.d.ts +0 -20
  251. package/build/core/router/route.mjs +0 -6
  252. package/build/core/router/router.d.ts +0 -16
  253. package/build/core/router/router.mjs +0 -8
  254. package/build/core/thread.d.ts +0 -30
  255. package/build/core/thread.mjs +0 -45
  256. package/build/env.d.d.ts +0 -2
  257. package/build/env.d.mjs +0 -0
  258. package/build/raiton-0.0.2.tgz +0 -0
  259. package/build/requirements.d.ts +0 -2
  260. package/build/requirements.mjs +0 -19
  261. package/build/sdk/artifacts.d.ts +0 -13
  262. package/build/sdk/artifacts.mjs +0 -45
  263. package/build/sdk/constants/decorators.constant.d.ts +0 -11
  264. package/build/sdk/constants/decorators.constant.mjs +0 -6
  265. package/build/sdk/constants/index.d.ts +0 -2
  266. package/build/sdk/constants/index.mjs +0 -11
  267. package/build/sdk/constants/microservices.constant.d.ts +0 -5
  268. package/build/sdk/constants/microservices.constant.mjs +0 -6
  269. package/build/sdk/controllers.d.ts +0 -4
  270. package/build/sdk/controllers.mjs +0 -6
  271. package/build/sdk/data-transfer-object.d.ts +0 -7
  272. package/build/sdk/data-transfer-object.mjs +0 -7
  273. package/build/sdk/decorators/access-guard.decorator.d.ts +0 -2
  274. package/build/sdk/decorators/access-guard.decorator.mjs +0 -0
  275. package/build/sdk/decorators/controllable.d.ts +0 -3
  276. package/build/sdk/decorators/controllable.mjs +0 -45
  277. package/build/sdk/decorators/controllers.decorator.d.ts +0 -2
  278. package/build/sdk/decorators/controllers.decorator.mjs +0 -0
  279. package/build/sdk/decorators/grafts.decorator.d.ts +0 -2
  280. package/build/sdk/decorators/grafts.decorator.mjs +0 -0
  281. package/build/sdk/decorators/index.d.ts +0 -3
  282. package/build/sdk/decorators/index.mjs +0 -75
  283. package/build/sdk/decorators/parameters.decorator.d.ts +0 -2
  284. package/build/sdk/decorators/parameters.decorator.mjs +0 -0
  285. package/build/sdk/decorators/parametrable.d.ts +0 -9
  286. package/build/sdk/decorators/parametrable.mjs +0 -57
  287. package/build/sdk/decorators/payload.decorator.d.ts +0 -2
  288. package/build/sdk/decorators/payload.decorator.mjs +0 -0
  289. package/build/sdk/decorators/routable.d.ts +0 -10
  290. package/build/sdk/decorators/routable.mjs +0 -59
  291. package/build/sdk/dependency-container.d.ts +0 -19
  292. package/build/sdk/dependency-container.mjs +0 -46
  293. package/build/sdk/encryption.d.ts +0 -27
  294. package/build/sdk/encryption.mjs +0 -141
  295. package/build/sdk/enums/encrypted.enum.d.ts +0 -15
  296. package/build/sdk/enums/encrypted.enum.mjs +0 -6
  297. package/build/sdk/enums/event.message.enum.d.ts +0 -6
  298. package/build/sdk/enums/event.message.enum.mjs +0 -6
  299. package/build/sdk/enums/http-parameters.enum.mjs +0 -6
  300. package/build/sdk/enums/http.enum.d.ts +0 -12
  301. package/build/sdk/enums/http.enum.mjs +0 -6
  302. package/build/sdk/enums/index.d.ts +0 -6
  303. package/build/sdk/enums/index.mjs +0 -27
  304. package/build/sdk/enums/runtime.enum.mjs +0 -6
  305. package/build/sdk/enums/timestamp.enum.mjs +0 -6
  306. package/build/sdk/env.d.ts +0 -6
  307. package/build/sdk/env.mjs +0 -74
  308. package/build/sdk/fastify.d.ts +0 -11
  309. package/build/sdk/fastify.mjs +0 -9
  310. package/build/sdk/grafts.d.ts +0 -15
  311. package/build/sdk/grafts.mjs +0 -71
  312. package/build/sdk/index.d.ts +0 -34
  313. package/build/sdk/index.mjs +0 -126
  314. package/build/sdk/json.d.ts +0 -17
  315. package/build/sdk/json.mjs +0 -87
  316. package/build/sdk/plugins/body-parser.plugin.d.ts +0 -17
  317. package/build/sdk/plugins/body-parser.plugin.mjs +0 -7
  318. package/build/sdk/plugins/index.d.ts +0 -17
  319. package/build/sdk/plugins/index.mjs +0 -48
  320. package/build/sdk/plugins/security/body-limit.d.ts +0 -17
  321. package/build/sdk/plugins/security/body-limit.mjs +0 -45
  322. package/build/sdk/plugins/security/cors.d.ts +0 -22
  323. package/build/sdk/plugins/security/cors.mjs +0 -45
  324. package/build/sdk/plugins/security/headers.d.ts +0 -17
  325. package/build/sdk/plugins/security/headers.mjs +0 -45
  326. package/build/sdk/plugins/security/index.d.ts +0 -25
  327. package/build/sdk/plugins/security/index.mjs +0 -45
  328. package/build/sdk/plugins/security/method-guard.d.ts +0 -17
  329. package/build/sdk/plugins/security/method-guard.mjs +0 -45
  330. package/build/sdk/plugins/security/rate-limit.d.ts +0 -21
  331. package/build/sdk/plugins/security/rate-limit.mjs +0 -45
  332. package/build/sdk/repositories.d.ts +0 -7
  333. package/build/sdk/repositories.mjs +0 -17
  334. package/build/sdk/request.d.ts +0 -4
  335. package/build/sdk/request.mjs +0 -6
  336. package/build/sdk/responses.d.ts +0 -8
  337. package/build/sdk/responses.mjs +0 -20
  338. package/build/sdk/routes.d.ts +0 -7
  339. package/build/sdk/routes.mjs +0 -61
  340. package/build/sdk/runtime/bun/server.d.ts +0 -6
  341. package/build/sdk/runtime/bun/server.mjs +0 -6
  342. package/build/sdk/runtime/deno/server.d.ts +0 -6
  343. package/build/sdk/runtime/deno/server.mjs +0 -6
  344. package/build/sdk/runtime/index.d.ts +0 -15
  345. package/build/sdk/runtime/index.mjs +0 -11
  346. package/build/sdk/runtime/node/reply.d.ts +0 -2
  347. package/build/sdk/runtime/node/reply.mjs +0 -0
  348. package/build/sdk/runtime/node/request.d.ts +0 -2
  349. package/build/sdk/runtime/node/request.mjs +0 -0
  350. package/build/sdk/runtime/node/server.d.ts +0 -6
  351. package/build/sdk/runtime/node/server.mjs +0 -6
  352. package/build/sdk/runtime/web/server.d.ts +0 -6
  353. package/build/sdk/runtime/web/server.mjs +0 -6
  354. package/build/sdk/schemes.mjs +0 -129
  355. package/build/sdk/services.d.ts +0 -8
  356. package/build/sdk/services.mjs +0 -10
  357. package/build/sdk/throwable.mjs +0 -14
  358. package/build/sdk/utilities/alias-path.util.d.ts +0 -9
  359. package/build/sdk/utilities/alias-path.util.mjs +0 -6
  360. package/build/sdk/utilities/artifacts.util.d.ts +0 -3
  361. package/build/sdk/utilities/artifacts.util.mjs +0 -45
  362. package/build/sdk/utilities/callable.util.d.ts +0 -3
  363. package/build/sdk/utilities/callable.util.mjs +0 -6
  364. package/build/sdk/utilities/controller.util.d.ts +0 -3
  365. package/build/sdk/utilities/controller.util.mjs +0 -6
  366. package/build/sdk/utilities/index.d.ts +0 -7
  367. package/build/sdk/utilities/index.mjs +0 -62
  368. package/build/sdk/utilities/json.util.d.ts +0 -3
  369. package/build/sdk/utilities/json.util.mjs +0 -6
  370. package/build/sdk/utilities/parameters-arguments.util.d.ts +0 -2
  371. package/build/sdk/utilities/parameters-arguments.util.mjs +0 -0
  372. package/build/sdk/utilities/url.d.ts +0 -3
  373. package/build/sdk/utilities/url.mjs +0 -7
  374. package/build/sdk/utilities/utilities.util.d.ts +0 -6
  375. package/build/sdk/utilities/utilities.util.mjs +0 -8
  376. package/build/types/access-guards.d.ts +0 -6
  377. package/build/types/access-guards.mjs +0 -0
  378. package/build/types/application.mjs +0 -0
  379. package/build/types/artifact.d.ts +0 -21
  380. package/build/types/artifact.mjs +0 -0
  381. package/build/types/builder.d.ts +0 -32
  382. package/build/types/builder.mjs +0 -0
  383. package/build/types/config.d.ts +0 -6
  384. package/build/types/config.mjs +0 -0
  385. package/build/types/controller.d.ts +0 -25
  386. package/build/types/controller.mjs +0 -0
  387. package/build/types/contruct.d.ts +0 -3
  388. package/build/types/contruct.mjs +0 -0
  389. package/build/types/core.d.ts +0 -15
  390. package/build/types/core.mjs +0 -0
  391. package/build/types/data-transfer-object.d.ts +0 -5
  392. package/build/types/data-transfer-object.mjs +0 -0
  393. package/build/types/dependency-container.d.ts +0 -20
  394. package/build/types/dependency-container.mjs +0 -0
  395. package/build/types/directory.mjs +0 -0
  396. package/build/types/encryption.d.ts +0 -16
  397. package/build/types/encryption.mjs +0 -0
  398. package/build/types/generic.d.ts +0 -4
  399. package/build/types/generic.mjs +0 -0
  400. package/build/types/hmr.mjs +0 -0
  401. package/build/types/http-responses.d.ts +0 -10
  402. package/build/types/http-responses.mjs +0 -0
  403. package/build/types/index.d.ts +0 -45
  404. package/build/types/index.mjs +0 -0
  405. package/build/types/middleware.d.ts +0 -12
  406. package/build/types/middleware.mjs +0 -0
  407. package/build/types/parameters.d.ts +0 -19
  408. package/build/types/parameters.mjs +0 -0
  409. package/build/types/parseable.d.ts +0 -5
  410. package/build/types/parseable.mjs +0 -0
  411. package/build/types/payload.d.ts +0 -6
  412. package/build/types/payload.mjs +0 -0
  413. package/build/types/plugin.d.ts +0 -20
  414. package/build/types/plugin.mjs +0 -0
  415. package/build/types/raiton.d.ts +0 -12
  416. package/build/types/raiton.mjs +0 -0
  417. package/build/types/repositories.d.ts +0 -8
  418. package/build/types/repositories.mjs +0 -0
  419. package/build/types/router.d.ts +0 -14
  420. package/build/types/router.mjs +0 -0
  421. package/build/types/runtime.d.ts +0 -37
  422. package/build/types/runtime.mjs +0 -0
  423. package/build/types/scheme.mjs +0 -0
  424. package/build/types/server.d.ts +0 -57
  425. package/build/types/server.mjs +0 -0
  426. package/build/types/services.d.ts +0 -8
  427. package/build/types/services.mjs +0 -0
  428. package/build/types/thread.d.ts +0 -24
  429. package/build/types/thread.mjs +0 -0
  430. package/build/types/utilities.d.ts +0 -6
  431. package/build/types/utilities.mjs +0 -0
  432. package/build/types/values.d.ts +0 -4
  433. package/build/types/values.mjs +0 -0
  434. /package/{build/chunk-4OWCGDUD.mjs → source/sdk/runtime/node/reply.ts} +0 -0
  435. /package/{build/chunk-DIWD7ZCJ.mjs → source/sdk/runtime/node/request.ts} +0 -0
Binary file
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "raiton",
3
- "version": "0.0.2",
3
+ "version": "1.0.0-alpha.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Protorians Raiton Development Kit",
7
+ "main": "./source/core/index.ts",
8
+ "module": "./source/core/index.ts",
9
+ "types": "./source/core/index.d.ts",
7
10
  "bin": {
8
- "raiton": "build/bin/index.mjs"
11
+ "raiton": "source/bin/index.ts"
9
12
  },
10
13
  "keywords": [
11
14
  "protorians",
@@ -13,7 +16,7 @@
13
16
  "development",
14
17
  "kit",
15
18
  "typescript",
16
- "node",
19
+ "bun",
17
20
  "backend"
18
21
  ],
19
22
  "author": "Y. Yannick GOBOU",
@@ -23,36 +26,22 @@
23
26
  "url": "git+https://github.com/protorians/raiton.git"
24
27
  },
25
28
  "exports": {
26
- "./core/*": {
27
- "types": "./build/core/*.d.ts",
28
- "import": "./build/core/*.mjs"
29
- },
30
- ".": {
31
- "types": "./build/core/index.d.ts",
32
- "import": "./build/core/index.mjs"
33
- },
34
- "./commands/*": {
35
- "types": "./build/commands/*.d.ts",
36
- "import": "./build/commands/*.mjs"
37
- },
38
- "./sdk/*": {
39
- "types": "./build/sdk/*.d.ts",
40
- "import": "./build/sdk/*.mjs"
41
- },
42
- "./sdk": {
43
- "types": "./build/sdk/index.d.ts",
44
- "import": "./build/sdk/index.mjs"
45
- },
46
- "./types/*": {
47
- "types": "./build/types/index.d.ts",
48
- "import": "./build/types/index.mjs"
49
- }
29
+ ".": "./source/core/index.ts",
30
+ "./core/*": "./source/core/*.ts",
31
+ "./commands/*": "./source/commands/*.ts",
32
+ "./sdk": "./source/sdk/index.ts",
33
+ "./sdk/*": "./source/sdk/*.ts",
34
+ "./types": "./source/types/index.ts",
35
+ "./types/*": "./source/types/*.ts"
50
36
  },
51
37
  "scripts": {
52
- "dev": "tsup --watch --config tsup.config.ts",
53
- "build": "tsup --config tsup.config.ts",
54
- "commit": "pnpx semantic-release",
55
- "commit:test": "pnpx semantic-release --dry-run"
38
+ "commit": "bun semantic-release",
39
+ "commit:test": "bun semantic-release --dry-run",
40
+ "dev": "bun run --hot source/bin/index.ts",
41
+ "start": "bun run build/bin/index.mjs",
42
+ "build": "bun build source/bin/index.ts --target=node --format=esm --outfile=build/bin/index.mjs",
43
+ "postinstall": "chmod +x source/bin/index.ts",
44
+ "prepublishOnly": "npm run build"
56
45
  },
57
46
  "dependencies": {
58
47
  "@protorians/core": "^0.6.13",
@@ -65,9 +54,6 @@
65
54
  "bcrypt": "^6.0.0",
66
55
  "commander": "^14.0.2",
67
56
  "dotenv": "^17.2.3",
68
- "esbuild": "^0.27.1",
69
- "fastify": "^5.6.2",
70
- "fastify-plugin": "^5.1.0",
71
57
  "reflect-metadata": "^0.2.2"
72
58
  },
73
59
  "devDependencies": {
@@ -82,7 +68,6 @@
82
68
  "conventional-changelog-conventionalcommits": "^9.1.0",
83
69
  "cz-conventional-changelog": "^3.3.0",
84
70
  "semantic-release": "^25.0.2",
85
- "tsup": "^8.3.0",
86
71
  "typescript": "^5.9.3"
87
72
  },
88
73
  "config": {
@@ -92,7 +77,7 @@
92
77
  },
93
78
  "compilerOptions": {
94
79
  "types": [
95
- "node"
80
+ "bun"
96
81
  ]
97
82
  },
98
83
  "publishConfig": {
@@ -0,0 +1,15 @@
1
+ import {Command} from 'commander';
2
+ import {RaitonCommands, RaitonConfig} from "@/core";
3
+ import {getPackageRoot} from "@/sdk";
4
+ import {CliTools} from "@/bin/cli-tools";
5
+
6
+
7
+ export default async function bootstrapper(cli: Command) {
8
+ const appdir = getPackageRoot(import.meta.url);
9
+ const workdir = `${CliTools.cwd || './'}`;
10
+ const capabilities = new RaitonCommands(cli, appdir, workdir)
11
+
12
+ await RaitonConfig.sync(workdir);
13
+ await capabilities.harvest();
14
+ return cli.parse(process.argv)
15
+ }
@@ -0,0 +1,43 @@
1
+ import {spawn} from 'node:child_process';
2
+
3
+ const isBunUsed = typeof Bun !== "undefined";
4
+
5
+ export class CliTools {
6
+ static get cwd() {
7
+ return `${process.cwd()}`;
8
+ }
9
+
10
+ static set cwd(value: string) {
11
+ process.chdir(value)
12
+ }
13
+
14
+ static get argv() {
15
+ return isBunUsed ? Bun.argv : process.argv;
16
+ }
17
+
18
+ static get process() {
19
+ return isBunUsed ? Bun : process;
20
+ }
21
+
22
+ static spawn(command: string | string[], args: string[] = [], options?: Record<string, any>) {
23
+ if (isBunUsed) {
24
+ const cmdArray = [
25
+ ...(typeof command == 'string' ? [command] : (Array.isArray(command) ? command : [])),
26
+ ...args
27
+ ];
28
+ // If the command is a .ts file, prepend bun
29
+ if (typeof command === 'string' && command.endsWith('.ts')) {
30
+ cmdArray.unshift('bun');
31
+ }
32
+ return Bun.spawn(cmdArray, options);
33
+ }
34
+
35
+ const cmd = typeof command == 'string' ? command : command[0];
36
+ // If the command is a .ts file, prepend bun (or npx tsx/ts-node if we wanted to be Node generic, but here we favor Bun)
37
+ if (cmd.endsWith('.ts')) {
38
+ return spawn('bun', [cmd, ...args], options);
39
+ }
40
+
41
+ return spawn(cmd, args, options);
42
+ }
43
+ }
@@ -0,0 +1,12 @@
1
+ import {Command} from "commander";
2
+ import {version} from '../../package.json';
3
+
4
+
5
+ const CLI = new Command();
6
+
7
+ CLI
8
+ .name('raiton')
9
+ .description('Protorians Raiton development kit for backend microservice')
10
+ .version(version);
11
+
12
+ export default CLI;
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bun
2
+ import "reflect-metadata"
3
+ import bootstrapper from "./bootstrapper";
4
+ import CLI from "./cli";
5
+
6
+ bootstrapper(CLI)
@@ -0,0 +1,28 @@
1
+ import {RaitonCommand, RaitonBuilder} from "@/core";
2
+ import {Logger} from "@protorians/logger";
3
+ import type {BuildCommandOptions} from "@/types";
4
+
5
+
6
+ export default class ArtifactCommand extends RaitonCommand {
7
+ public readonly name: string = 'artifact';
8
+ public readonly description: string = 'Manage artifacts';
9
+
10
+ public register(): void {
11
+ this.cli
12
+ .command(this.name)
13
+ .alias("art")
14
+ .description(this.description)
15
+ .option("--dump, -d", "Dump the application artifacts configured")
16
+ .option("--create, -c", "Create an artifact")
17
+ .option("--remove, -r", "Remove an artifact")
18
+ .option("--clear", "Clear all artifacts")
19
+ .action(this.run.bind(this));
20
+ }
21
+
22
+ protected async run(options: BuildCommandOptions): Promise<void> {
23
+
24
+ Logger.notice("Artifact management is not yet implemented");
25
+ Logger.debug('Options:', options, '')
26
+
27
+ }
28
+ }
@@ -0,0 +1,31 @@
1
+ import {RaitonCommand, RaitonBuilder} from "@/core";
2
+ import {LBadge, Logger} from "@protorians/logger";
3
+ import type {BuildCommandOptions} from "@/types";
4
+
5
+
6
+ export default class BuildCommand extends RaitonCommand {
7
+ public readonly name: string = 'build';
8
+ public readonly description: string = 'Build the application';
9
+
10
+ public register(): void {
11
+ this.cli
12
+ .command(this.name)
13
+ .alias("b")
14
+ .description("Build the application")
15
+ .option("--develop, -d", "Build in development mode")
16
+ .option("--bootstrap, -b", "Bootstrap the application")
17
+ .action(this.run.bind(this));
18
+ }
19
+
20
+ protected async run(options: BuildCommandOptions): Promise<void> {
21
+ if (options.develop) Logger.warn(LBadge.log("Dev Mode"),);
22
+
23
+ const builder = new RaitonBuilder(this.workdir, {
24
+ development: options.develop
25
+ });
26
+
27
+ await builder.prepare()
28
+ await builder.boot()
29
+ // await builder.start(async () => (options.develop || options.bootstrap) ? await builder.boot() : void (0))
30
+ }
31
+ }
@@ -0,0 +1,47 @@
1
+ import {Raiton, RaitonCommand} from "@/core";
2
+ import {ChildProcess} from 'node:child_process';
3
+ import {Logger} from "@protorians/logger";
4
+ import {EventMessageEnum} from "@/sdk";
5
+ import {CliTools} from "@/bin/cli-tools";
6
+ import path from "node:path";
7
+
8
+ export default class DevelopCommand extends RaitonCommand {
9
+ public readonly name: string = 'develop';
10
+ public readonly description: string = 'Run the application in development mode';
11
+
12
+ private child: Bun.Subprocess<"ignore", "pipe", "inherit"> | ChildProcess | null = null;
13
+
14
+ public register(): void {
15
+ this.cli
16
+ .command(this.name)
17
+ .alias("dev")
18
+ .description("Start the application in development mode")
19
+ .action(this.run.bind(this));
20
+ }
21
+
22
+ protected async restart(): Promise<void> {
23
+ Logger.info('Reloading...');
24
+ console.clear();
25
+ this.child?.kill('SIGTERM');
26
+
27
+ if (this.child && 'on' in this.child)
28
+ this.child?.on('exit', () => this.run());
29
+ }
30
+
31
+ protected async run(): Promise<void> {
32
+ // Logger.info('Workdir', this.workdir);
33
+
34
+ const entryPoint = path.join(this.appdir, 'bin/index.ts');
35
+ this.child = CliTools.spawn(entryPoint, ['build', '-d'], {
36
+ stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
37
+ cwd: this.workdir
38
+ });
39
+
40
+ if (this.child && 'on' in this.child)
41
+ this.child.on('message', (msg) => {
42
+ if (msg === EventMessageEnum.RESTART) this.restart()
43
+ });
44
+
45
+ Logger.log('PID', this.child.pid)
46
+ }
47
+ }
@@ -0,0 +1,27 @@
1
+ import {RaitonCommand} from "@/core";
2
+
3
+
4
+ export default class GraftsCommand extends RaitonCommand {
5
+
6
+ public readonly name: string = 'grafts';
7
+ public readonly description: string = 'Generates typings grafts';
8
+ public readonly version: string = '0.0.1';
9
+
10
+ public register(): void {
11
+ this.cli
12
+ .command(this.name)
13
+ .description("Generates typings grafts")
14
+ .action(this.generates.bind(this))
15
+ }
16
+
17
+ protected async generates(): Promise<void> {
18
+ console.log("Running grafts generator command");
19
+ // generateArtifacts(
20
+ // "graft",
21
+ // "IGlobalGrafts",
22
+ // /@Graftable\(\s*(?:([A-Za-z0-9_.]+)\s*,\s*)?(?:(["'`])(.*?)\2)?\s*\)/,
23
+ // true,
24
+ // )
25
+ }
26
+
27
+ }
@@ -0,0 +1,28 @@
1
+ import {RaitonCommand} from "@/core";
2
+ import {ChildProcess} from 'node:child_process';
3
+ import {Raiton} from "@/core/raiton";
4
+ import {CliTools} from "@/bin/cli-tools";
5
+ import path from "node:path";
6
+
7
+ export default class StartCommand extends RaitonCommand {
8
+ public readonly name: string = 'start';
9
+ public readonly description: string = 'Run the application in production mode';
10
+
11
+ private child: Bun.Subprocess<"ignore", "pipe", "inherit"> | ChildProcess | null = null;
12
+
13
+ public register(): void {
14
+ this.cli
15
+ .command(this.name)
16
+ .alias("run")
17
+ .description("Start the application in production mode")
18
+ .action(this.run.bind(this));
19
+ }
20
+
21
+ protected async run(): Promise<void> {
22
+ const entryPoint = path.join(this.appdir, 'bin/index.ts');
23
+ this.child = CliTools.spawn(entryPoint, ['build', '--bootstrap'], {
24
+ stdio: 'inherit',
25
+ cwd: this.workdir
26
+ });
27
+ }
28
+ }
@@ -0,0 +1,115 @@
1
+ import {PluginScope} from '@/core/plugins/scope'
2
+ import {RequestContext} from './context'
3
+ import {ApplicationConfig, ApplicationInterface} from "@/types/application";
4
+ import {HttpMethod} from "@/sdk";
5
+ import {RouteHandler} from "@/types";
6
+ import {Logger} from "@protorians/logger";
7
+
8
+ export class Application implements ApplicationInterface {
9
+ private root: PluginScope
10
+
11
+ constructor(
12
+ readonly config: ApplicationConfig
13
+ ) {
14
+ this.root = new PluginScope()
15
+ }
16
+
17
+ public get hostname(): string {
18
+ return `${
19
+ this.config.protocole || 'http'
20
+ }://${
21
+ this.config.hostname || 'localhost'
22
+ }${
23
+ this.config.port ? `:${this.config.port}` : ''
24
+ }${
25
+ this.config.pathname || '/'
26
+ }`
27
+ }
28
+
29
+ // public setOption<K extends keyof ApplicationConfig>(key: K, value: ApplicationConfig[K]): this {
30
+ // this.config[key] = value;
31
+ // return this;
32
+ // }
33
+ //
34
+ // public setOptions(options: ApplicationConfig): this {
35
+ // Object.assign(this.config, options);
36
+ // return this;
37
+ // }
38
+
39
+ register(plugin: any): this {
40
+ this.root.register(plugin)
41
+ return this
42
+ }
43
+
44
+ use(mw: any): this {
45
+ this.root.use(mw)
46
+ return this
47
+ }
48
+
49
+ route(method: HttpMethod, path: string, handler: RouteHandler, version?: string): this {
50
+ this.root.route(method, path, handler, version)
51
+ return this
52
+ }
53
+
54
+ get(path: string, handler: RouteHandler, version?: string): this {
55
+ return this.route(HttpMethod.GET, path, handler, version)
56
+ }
57
+
58
+ post(path: string, handler: RouteHandler, version?: string): this {
59
+ return this.route(HttpMethod.POST, path, handler, version)
60
+ }
61
+
62
+ patch(path: string, handler: RouteHandler, version?: string): this {
63
+ return this.route(HttpMethod.PATCH, path, handler, version)
64
+ }
65
+
66
+ put(path: string, handler: RouteHandler, version?: string): this {
67
+ return this.route(HttpMethod.PUT, path, handler, version)
68
+ }
69
+
70
+ delete(path: string, handler: RouteHandler, version?: string): this {
71
+ return this.route(HttpMethod.DELETE, path, handler, version)
72
+ }
73
+
74
+ options(path: string, handler: RouteHandler, version?: string): this {
75
+ return this.route(HttpMethod.OPTIONS, path, handler, version)
76
+ }
77
+
78
+ head(path: string, handler: RouteHandler, version?: string): this {
79
+ return this.route(HttpMethod.HEAD, path, handler, version)
80
+ }
81
+
82
+ trace(path: string, handler: RouteHandler, version?: string): this {
83
+ return this.route(HttpMethod.TRACE, path, handler, version)
84
+ }
85
+
86
+ async handle(req: any, reply: any): Promise<any> {
87
+ const ctx = new RequestContext(req, reply)
88
+
89
+ await this.root.hooks.run('onRequest', ctx)
90
+
91
+ const route = this.root.router.match(
92
+ req.method,
93
+ new URL(req.url, this.hostname).pathname
94
+ )
95
+
96
+ if (!route) {
97
+ reply.status(404)
98
+ return reply.send({error: false, statusCode: 404})
99
+ }
100
+
101
+ const pipeline = this.root.middleware.clone()
102
+ pipeline.use(async ({context}) => {
103
+ (context as any).params = route.parameters;
104
+
105
+ const responses = await route.handler(context)
106
+
107
+ // Logger.debug('Responses', responses)
108
+ // request.reply.header('Content-Type', 'application/json')
109
+ context.reply.send(responses)
110
+ })
111
+
112
+ await pipeline.run(ctx)
113
+ await this.root.hooks.run('onResponse', ctx)
114
+ }
115
+ }
@@ -0,0 +1,109 @@
1
+ import type {ArtifactEntry, ArtifactInterface, ArtifactOptions} from "@/types/artifact";
2
+ import {RaitonDirectories} from "@/core/directories";
3
+ import {Raiton} from "@/core/raiton";
4
+ import path from "node:path";
5
+ import fs from "node:fs";
6
+ import {LBadge, Logger} from "@protorians/logger";
7
+ import {ArtifactFactory} from "@/sdk/artifacts";
8
+ import {Throwable} from "@/sdk/throwable";
9
+
10
+ export class Artifact implements ArtifactInterface {
11
+ public readonly directory: string;
12
+ public readonly file: string;
13
+ public readonly workdir: string;
14
+
15
+ protected _files: string[] = [];
16
+
17
+ constructor(
18
+ public readonly options: ArtifactOptions,
19
+ ) {
20
+ this.options.verbose = typeof options.verbose === "undefined" ? false : options.verbose;
21
+
22
+ if (!Raiton.thread.builder?.source)
23
+ throw new Throwable("Artifact need project source");
24
+
25
+ this.directory = RaitonDirectories.artifacts(Raiton.thread.builder?.workdir)
26
+ this.workdir = Raiton.thread.builder.source;
27
+ this.file = path.join(this.directory, `${this.options.artifact}.d.ts`);
28
+ }
29
+
30
+ get files(): string[] {
31
+ return this._files;
32
+ }
33
+
34
+ get extensions(): string[] {
35
+ return [
36
+ `${this.options.artifact}.ts`,
37
+ `${this.options.artifact}.js`,
38
+ `${this.options.artifact}.mjs`,
39
+ `${this.options.artifact}.cjs`,
40
+ ]
41
+ }
42
+
43
+ /**
44
+ * Finds all files with end 'artifact.EXT'
45
+ */
46
+ scan(): string[] {
47
+ this._files = [];
48
+
49
+ fs.readdirSync(this.workdir, {recursive: true})
50
+ .forEach(f => {
51
+ this._files = [
52
+ ...this._files,
53
+ ...this.extensions.filter(ext => f.toString().endsWith(ext))
54
+ ];
55
+ })
56
+ ;
57
+
58
+ return this._files;
59
+ }
60
+
61
+ generate(): boolean {
62
+ try {
63
+ let mappings = "";
64
+
65
+ for (const file of this._files) {
66
+ const filename = path.join(this.workdir, file);
67
+ const content = fs.readFileSync(filename, "utf-8");
68
+ const match = content.match(this.options.decorator?.syntax);
69
+
70
+ if (!match) continue;
71
+
72
+ let name = match[3] || match[1] || "";
73
+ if (!name) {
74
+ const classMatch = content.match(/export\s+default\s+class\s+([A-Za-z0-9_]+)/);
75
+ name = classMatch?.[1] || path.parse(filename).name;
76
+ }
77
+
78
+ mappings += ` ${name}: InstanceType<typeof import("@/${file}").default>;\n`;
79
+
80
+ if (this.options.verbose) Logger.info(LBadge.debug(name), `artifact detected`);
81
+
82
+ ArtifactFactory.add(
83
+ this.options.artifact, {
84
+ file,
85
+ dir: this.workdir,
86
+ relative: file,
87
+ absolute: filename
88
+ }
89
+ )
90
+ }
91
+
92
+ const content = `// AUTO-GENERATED FILE — DO NOT EDIT MANUALLY
93
+ declare global {
94
+ interface ${this.options.provider} {
95
+ ${mappings} }
96
+ }
97
+ export {};`;
98
+ fs.writeFileSync(this.file, content, "utf-8");
99
+ if (!ArtifactFactory.save(this.options.artifact))
100
+ throw new Throwable(`Failed to save artifacts for ${this.options.artifact}`);
101
+
102
+ return true;
103
+ } catch (e: any) {
104
+ Logger.error(`Failed to resolve artifacts for ${this.options.artifact}`, e.message ?? e);
105
+ }
106
+ return false;
107
+ }
108
+
109
+ }
@@ -0,0 +1,10 @@
1
+ import {RaitonConfig} from "@/core";
2
+
3
+ export class Artifacts {
4
+
5
+ public static async load(workdir: string) {
6
+ await RaitonConfig.sync(workdir);
7
+ return RaitonConfig.get('artifacts');
8
+ }
9
+
10
+ }
@@ -0,0 +1 @@
1
+ export * from "./artifact";
@@ -0,0 +1,3 @@
1
+ export function artifactRunner () {
2
+
3
+ }