raiton 0.0.2 → 1.0.0-alpha.2

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 +32 -0
  2. package/README.md +98 -1
  3. package/build/bin/index.mjs +6816 -47
  4. package/build/raiton-1.0.0-alpha.2.tgz +0 -0
  5. package/package.json +22 -35
  6. package/source/bin/bootstrapper.ts +15 -0
  7. package/source/bin/cli-tools.ts +73 -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
@@ -0,0 +1,55 @@
1
+ import path from "node:path";
2
+ import fs from "fs";
3
+ import {Logger} from "@protorians/logger";
4
+ import {IFileStatInfo} from "@/types";
5
+ import {Raiton} from "@/core/raiton";
6
+ import {RaitonDirectories} from "@/core";
7
+
8
+ export class ArtifactFactory {
9
+ protected static readonly stack: Map<string, Set<IFileStatInfo>> = new Map();
10
+
11
+ static getSource(key: string) {
12
+ return path.join(
13
+ RaitonDirectories.artifacts(Raiton.thread.builder.workdir),
14
+ `${key}.json`
15
+ );
16
+ }
17
+
18
+ static add(key: string, file: IFileStatInfo) {
19
+ if (!this.stack.has(key)) this.stack.set(key, new Set());
20
+ this.stack.get(key)?.add(file);
21
+ }
22
+
23
+ static get(key: string): Set<IFileStatInfo> | undefined {
24
+ return this.stack.get(key);
25
+ }
26
+
27
+ static has(key: string): boolean {
28
+ return this.stack.has(key);
29
+ }
30
+
31
+ static load(key: string) {
32
+ const outputFile = this.getSource(key)
33
+ if (!fs.existsSync(outputFile)) return this;
34
+ const content = fs.readFileSync(outputFile, "utf-8");
35
+ const files = JSON.parse(content) as IFileStatInfo[];
36
+ files.forEach(file => this.add(key, file));
37
+ return this;
38
+ }
39
+
40
+ static save(key: string) {
41
+ try {
42
+ const set = this.stack.get(key);
43
+ if (!set) return;
44
+ const content = JSON.stringify([...set.values()]);
45
+ const outputFile = this.getSource(key)
46
+ const dir = path.dirname(outputFile);
47
+ if (!fs.existsSync(dir)) fs.mkdirSync(dir, {recursive: true})
48
+ fs.writeFileSync(outputFile, content, "utf-8");
49
+ return true
50
+ } catch (e) {
51
+ Logger.error(`Failed to save artifacts for key ${key}:`, e);
52
+ return false;
53
+ }
54
+ }
55
+ }
@@ -0,0 +1,7 @@
1
+ export const METADATA_KEYS = {
2
+ CONTROLLERS: Symbol('controller:meta'),
3
+ GRAFTS: Symbol('graft:meta'),
4
+ CONTAINER: Symbol('container:meta'),
5
+ INJECT_PARAMETERS: Symbol('inject:parameters'),
6
+ INJECT_PROPERTIES: Symbol('inject:properties'),
7
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./decorators.constant"
2
+ export * from "./microservices.constant"
@@ -0,0 +1,4 @@
1
+ export const MICROSERVICE_NAME = {
2
+ INDEX: 'Current:Microservice',
3
+ };
4
+
@@ -0,0 +1,4 @@
1
+
2
+ export class DelegateController {
3
+
4
+ }
@@ -0,0 +1,7 @@
1
+ import {DynamicParameter} from "@protorians/parameters";
2
+ import {IDataTransferObject} from "@/types";
3
+
4
+
5
+ export class DataTransferObject<T extends IDataTransferObject<T>> extends DynamicParameter<T> {
6
+
7
+ }
@@ -0,0 +1,9 @@
1
+ // import {IAccessGuardDeclaration} from "../../types";
2
+ // import {SYSTEM_DECORATORS_KEYS} from "../constants";
3
+ //
4
+ // export function AccessGuard(declaration: IAccessGuardDeclaration){
5
+ // return (target: any, methodKey: any)=> {
6
+ // const current: IAccessGuardDeclaration = {...(Reflect.getMetadata(SYSTEM_DECORATORS_KEYS.ACCESS_GUARD, target.constructor, methodKey) || {}), ...declaration};
7
+ // Reflect.defineMetadata(SYSTEM_DECORATORS_KEYS.ACCESS_GUARD, current, target.constructor, methodKey);
8
+ // }
9
+ // }
@@ -0,0 +1,20 @@
1
+ import {getControllerMetadata} from "@/core/controller";
2
+ import {Injectable} from "@/sdk";
3
+ import {LifetimeEnum} from "@protorians/core";
4
+ import {ControllerDecoratorCallable} from "@/types";
5
+
6
+ export function Controllable(prefix = '') {
7
+ return (target: any) => {
8
+ const name = target.name;
9
+ Injectable(LifetimeEnum.TRANSIENT, name,)(target)
10
+
11
+ const meta = getControllerMetadata(target.prototype || target)
12
+ meta.prefix = prefix;
13
+ }
14
+ }
15
+
16
+ export function createControllerDecorator(callable: ControllerDecoratorCallable) {
17
+ return (target: any) => {
18
+ callable(getControllerMetadata(target.prototype || target))
19
+ }
20
+ }
@@ -0,0 +1,5 @@
1
+ export * from "./controllable.decorator"
2
+ export * from "./middleware.decorator"
3
+ export * from "./routable.decorator"
4
+ export * from "./parametrable"
5
+ export * from "./injection.decorator"
@@ -0,0 +1,46 @@
1
+ import "reflect-metadata";
2
+ import type {IConstructor} from "@/types/contruct";
3
+ import {Injection} from "@/core/injection";
4
+ import {LifetimeEnum} from "@protorians/core";
5
+ import {Logger} from "@protorians/logger";
6
+ import {METADATA_KEYS} from "@/sdk/constants";
7
+
8
+
9
+ export function Injectable(lifetime?: LifetimeEnum, name?: string, scope?: any) {
10
+ return function <T extends IConstructor>(target: T) {
11
+ const metadata = {
12
+ name: name || target.name,
13
+ construct: target,
14
+ lifetime: lifetime || LifetimeEnum.TRANSIENT,
15
+ scope
16
+ };
17
+ Reflect.defineMetadata(METADATA_KEYS.CONTAINER, metadata, target);
18
+ Injection.registry(
19
+ metadata.name,
20
+ target,
21
+ metadata.lifetime,
22
+ scope
23
+ );
24
+ };
25
+ }
26
+
27
+ export function Inject(token?: any) {
28
+ return function (target: any, propertyKey: string | symbol | undefined, parameterIndex?: number) {
29
+ if (parameterIndex !== undefined) {
30
+ const parameters = Reflect.getMetadata(METADATA_KEYS.INJECT_PARAMETERS, target) || [];
31
+ parameters[parameterIndex] = token || true;
32
+ Reflect.defineMetadata(METADATA_KEYS.INJECT_PARAMETERS, parameters, target);
33
+ } else if (propertyKey !== undefined) {
34
+ const properties = Reflect.getMetadata(METADATA_KEYS.INJECT_PROPERTIES, target.constructor) || new Map();
35
+ const type = token || Reflect.getMetadata('design:type', target, propertyKey);
36
+
37
+ if (type === undefined || type === Object) {
38
+ Logger.warn(`Injection: impossible de déterminer le type pour la propriété "${String(propertyKey)}" de ${target.constructor.name}. Assurez-vous d'utiliser un token ou que le type est une classe.`);
39
+ }
40
+
41
+ properties.set(propertyKey, type);
42
+ Reflect.defineMetadata(METADATA_KEYS.INJECT_PROPERTIES, properties, target.constructor);
43
+ }
44
+ return target;
45
+ };
46
+ }
@@ -0,0 +1,15 @@
1
+ import {MiddlewareCallable} from "@/types";
2
+ import {getControllerMetadata} from "@/core";
3
+
4
+
5
+ export function Middleware(middleware: MiddlewareCallable) {
6
+ return (target: any, propertyKey?: string) => {
7
+ const meta = getControllerMetadata(target.prototype || target)
8
+ const segment = propertyKey ? propertyKey : '@'
9
+ meta.middlewares[segment] = [...(meta.middlewares[segment] || []), middleware];
10
+ }
11
+ }
12
+
13
+ export function createMiddlewareDecoration(middleware: MiddlewareCallable) {
14
+ return Middleware(middleware);
15
+ }
@@ -0,0 +1,24 @@
1
+ import type {Context, ParamMetaInterface} from "@/types";
2
+ import {getControllerMetadata} from "@/core";
3
+ import {Parametrable} from "@/sdk";
4
+ import {Logger} from "@protorians/logger";
5
+
6
+ function createParametrable(type: ParamMetaInterface['type'], callable?: (context: Context) => any) {
7
+ return (key?: string) => {
8
+ return (target: any, propertyKey: string, index: number) => {
9
+ const meta = getControllerMetadata(target)
10
+ if (!meta.params[propertyKey])
11
+ meta.params[propertyKey] = []
12
+ meta.params[propertyKey].push({index, type, key, callable})
13
+ }
14
+ }
15
+ }
16
+
17
+ export const Query = createParametrable(Parametrable.QUERY)
18
+ export const Param = createParametrable(Parametrable.PARAM)
19
+ export const Body = createParametrable(Parametrable.BODY)
20
+ export const UploadedFile = createParametrable(Parametrable.UPLOAD_FILE)
21
+ export const Headers = createParametrable(Parametrable.HEADER)
22
+ export const Req = createParametrable(Parametrable.REQ)
23
+ export const Reply = createParametrable(Parametrable.REPLY)
24
+
@@ -0,0 +1,77 @@
1
+ // import {IPayload} from "@/types";
2
+ // import {SYSTEM_DECORATORS_KEYS} from "@/sdk/constants";
3
+ //
4
+ // /**
5
+ // * A decorator function that combines and assigns schema-related metadata
6
+ // * to a specific property in the target constructor using reflective metadata.
7
+ // *
8
+ // * @param {IPayload} payload - The schema-related payload to be merged and assigned as metadata.
9
+ // * @return {Function} A decorator function that applies the merged metadata to the property.
10
+ // */
11
+ // export function Schemeable(payload: IPayload): (target: any, propertyKey: (string | symbol)) => void {
12
+ // return (target: any, propertyKey: string | symbol,) => {
13
+ // const current: IPayload = {...(Reflect.getMetadata(SYSTEM_DECORATORS_KEYS.ROUTES_SCHEMES, target.constructor, propertyKey) || {}), ...payload};
14
+ // Reflect.defineMetadata(SYSTEM_DECORATORS_KEYS.ROUTES_SCHEMES, current, target.constructor, propertyKey);
15
+ // };
16
+ // }
17
+ //
18
+ //
19
+ // /**
20
+ // * Constructs a schematizable object for the provided payload body.
21
+ // *
22
+ // * @param {IPayload['body']} payload - The body of the payload to be schematized.
23
+ // * @return {object} Returns a schematized object containing the provided payload body.
24
+ // */
25
+ // export function BodySchemeable(payload: IPayload['body']): (target: any, propertyKey: (string | symbol)) => void {
26
+ // return Schemeable({
27
+ // body: payload
28
+ // });
29
+ // }
30
+ //
31
+ // /**
32
+ // * Transforms the provided headers payload into a schematizable format.
33
+ // *
34
+ // * @param {IPayload['headers']} payload - The headers payload to be processed and transformed.
35
+ // * @return {object} The transformed schematizable object containing the headers.
36
+ // */
37
+ // export function HeadersSchemeable(payload: IPayload['headers']): (target: any, propertyKey: (string | symbol)) => void {
38
+ // return Schemeable({
39
+ // headers: payload
40
+ // });
41
+ // }
42
+ //
43
+ // /**
44
+ // * Constructs a schematizable object using the given query string payload.
45
+ // *
46
+ // * @param {IPayload['querystring']} payload - The query string object to be included in the schematizable configuration.
47
+ // * @return {object} The resulting schematizable object containing the query string.
48
+ // */
49
+ // export function QuerySchemeable(payload: IPayload['querystring']): (target: any, propertyKey: (string | symbol)) => void {
50
+ // return Schemeable({
51
+ // querystring: payload
52
+ // });
53
+ // }
54
+ //
55
+ // /**
56
+ // * Creates a schematizable object using the provided parameters.
57
+ // *
58
+ // * @param {IPayload['params']} payload - The parameters to be used for creating the schematizable object.
59
+ // * @return {Object} The resulting schematizable object containing the specified parameters.
60
+ // */
61
+ // export function ParamsSchemeable(payload: IPayload['params']): (target: any, propertyKey: (string | symbol)) => void {
62
+ // return Schemeable({
63
+ // params: payload
64
+ // });
65
+ // }
66
+ //
67
+ // /**
68
+ // * Constructs a schematized response payload.
69
+ // *
70
+ // * @param {IPayload['response']} payload - The response payload to be schematized.
71
+ // * @return {object} The schematized response object.
72
+ // */
73
+ // export function ResponseSchemeable(payload: IPayload['response']): (target: any, propertyKey: (string | symbol)) => void {
74
+ // return Schemeable({
75
+ // response: payload
76
+ // });
77
+ // }
@@ -0,0 +1,48 @@
1
+ import {getControllerMetadata} from "@/core";
2
+ import {HttpMethod} from "@/sdk";
3
+ import {ControllerMetaInterface, RouteDecoratorCallable, RouteMetaInterface} from "@/types";
4
+ import path from "node:path";
5
+
6
+
7
+ function stabilizeRoute(meta: ControllerMetaInterface, {path, method, propertyKey}: Partial<RouteMetaInterface>) {
8
+ return {
9
+ ...meta.routes.filter(route => (route.path === path && route.method === method) || (route.propertyKey === propertyKey))[0] || {},
10
+ method,
11
+ path,
12
+ propertyKey,
13
+ params: (propertyKey ? meta.params[propertyKey] : []) || [],
14
+ } as RouteMetaInterface;
15
+ }
16
+
17
+ export function createRoutableDecorator(method: HttpMethod) {
18
+ return (path = '') =>
19
+ (target: any, propertyKey: string) => {
20
+ const meta: ControllerMetaInterface = getControllerMetadata(target);
21
+ const route = stabilizeRoute(meta, {
22
+ method,
23
+ path,
24
+ propertyKey,
25
+ params: meta.params[propertyKey] || [],
26
+ });
27
+ meta.routes.push(route)
28
+ }
29
+ }
30
+
31
+ export function createRouteDecorator(callable: RouteDecoratorCallable) {
32
+ return (target: any, propertyKey: string) => {
33
+ const controller: ControllerMetaInterface = getControllerMetadata(target);
34
+ const route: RouteMetaInterface = stabilizeRoute(controller, {propertyKey})
35
+ const index = controller.routes.findIndex(route => route.propertyKey === propertyKey)
36
+
37
+ callable({controller, route, index})
38
+ }
39
+ }
40
+
41
+ export const Get = createRoutableDecorator(HttpMethod.GET)
42
+ export const Post = createRoutableDecorator(HttpMethod.POST)
43
+ export const Put = createRoutableDecorator(HttpMethod.PUT)
44
+ export const Patch = createRoutableDecorator(HttpMethod.PATCH)
45
+ export const Options = createRoutableDecorator(HttpMethod.OPTIONS)
46
+ export const Trace = createRoutableDecorator(HttpMethod.TRACE)
47
+ export const Delete = createRoutableDecorator(HttpMethod.DELETE)
48
+ export const Head = createRoutableDecorator(HttpMethod.HEAD)
@@ -0,0 +1,155 @@
1
+
2
+ import crypto from "node:crypto";
3
+ import argon2, {Options} from "argon2";
4
+ import {HashAlgoEnum} from "./enums";
5
+ import bcrypt from "bcrypt";
6
+ import {IDerivationOptions, IEncryptionResult, IScryptOptions} from "@/types";
7
+
8
+ export class Encryption {
9
+ static get algos() {
10
+ return HashAlgoEnum;
11
+ }
12
+
13
+ static randomAlgo() {
14
+ return Object.values(this.algos)[
15
+ Math.floor(Math.random() * Object.values(this.algos).length)
16
+ ];
17
+ }
18
+
19
+ constructor(public readonly algo: HashAlgoEnum) {
20
+ if (!Object.values(HashAlgoEnum).includes(this.algo)) {
21
+ throw new Error(`Invalid hash algorithm: ${this.algo}`);
22
+ }
23
+ }
24
+
25
+ async make(value: string, options?: IDerivationOptions | IScryptOptions): Promise<IEncryptionResult> {
26
+ if (!value) {
27
+ throw new Error('Value cannot be empty');
28
+ }
29
+
30
+ switch (this.algo) {
31
+ case HashAlgoEnum.SHA256:
32
+ return this.sha256(value);
33
+ case HashAlgoEnum.SHA512:
34
+ return this.sha512(value);
35
+ case HashAlgoEnum.MD5:
36
+ return this.md5(value);
37
+ case HashAlgoEnum.RIPEMD160:
38
+ return this.ripemd160(value);
39
+ case HashAlgoEnum.BLAKE2B:
40
+ return this.blake2b(value);
41
+ case HashAlgoEnum.SHA3_256:
42
+ return this.sha3_256(value);
43
+ case HashAlgoEnum.SHA3_512:
44
+ return this.sha3_512(value);
45
+ case HashAlgoEnum.PBKDF2:
46
+ return this.pbkdf2(value, options as IDerivationOptions | undefined);
47
+ case HashAlgoEnum.SCRYPT:
48
+ return this.scrypt(value, options as IScryptOptions | undefined);
49
+ case HashAlgoEnum.ARGON2ID:
50
+ case HashAlgoEnum.BCRYPT:
51
+ return this.password(value);
52
+ default:
53
+ throw new Error(`Unsupported algorithm: ${this.algo}`);
54
+ }
55
+ }
56
+
57
+ protected sha256(value: string): IEncryptionResult {
58
+ return crypto.createHash("sha256").update(value).digest("hex");
59
+ }
60
+
61
+ protected sha512(value: string): IEncryptionResult {
62
+ return crypto.createHash("sha512").update(value).digest("hex");
63
+ }
64
+
65
+ protected md5(value: string): IEncryptionResult {
66
+ return crypto.createHash("md5").update(value).digest("hex");
67
+ }
68
+
69
+ protected ripemd160(value: string): IEncryptionResult {
70
+ return crypto.createHash("ripemd160").update(value).digest("hex");
71
+ }
72
+
73
+ protected blake2b(value: string): IEncryptionResult {
74
+ return crypto.createHash("blake2b512").update(value).digest("hex");
75
+ }
76
+
77
+ protected sha3_256(value: string): IEncryptionResult {
78
+ return crypto.createHash("sha3-256").update(value).digest("hex");
79
+ }
80
+
81
+ protected sha3_512(value: string): IEncryptionResult {
82
+ return crypto.createHash("sha3-512").update(value).digest("hex");
83
+ }
84
+
85
+ protected pbkdf2(value: string, options?: IDerivationOptions): IEncryptionResult {
86
+ const {salt, iterations, keylen, digest} = options || {};
87
+ const usedSalt = salt ?? crypto.randomBytes(16).toString("hex");
88
+ const usedIterations = iterations ?? 100_000;
89
+ const usedKeylen = keylen ?? 64;
90
+ const usedDigest = digest ?? "sha512";
91
+ const derived = crypto
92
+ .pbkdf2Sync(value, Buffer.from(usedSalt, "hex"), usedIterations, usedKeylen, usedDigest)
93
+ .toString("hex");
94
+ return `pbkdf2$${usedDigest}$${usedIterations}$${usedSalt}$${derived}`;
95
+ }
96
+
97
+ protected scrypt(value: string, options?: IScryptOptions): IEncryptionResult {
98
+ const {salt, keylen, cost, blockSize, parallelization} = options || {} as IScryptOptions;
99
+ const usedSalt = salt ?? crypto.randomBytes(16).toString("hex");
100
+ const usedKeylen = keylen ?? 64;
101
+ const usedCost = cost ?? 16384; // N
102
+ const usedBlockSize = blockSize ?? 8; // r
103
+ const usedParallel = parallelization ?? 1; // p
104
+ const derived = crypto
105
+ .scryptSync(value, Buffer.from(usedSalt, "hex"), usedKeylen, {
106
+ N: usedCost,
107
+ r: usedBlockSize,
108
+ p: usedParallel,
109
+ maxmem: 32 * 1024 * 1024,
110
+ })
111
+ .toString("hex");
112
+ return `scrypt$${usedCost}$${usedBlockSize}$${usedParallel}$${usedSalt}$${derived}`;
113
+ }
114
+
115
+ protected unsupported(): never {
116
+ throw new Error(`${this.algo} not supported without optional dependency`);
117
+ }
118
+
119
+ async password(value: string, options?: (Options & {
120
+ raw?: boolean
121
+ }) | (string | number) | undefined): Promise<IEncryptionResult> {
122
+ switch (this.algo) {
123
+ case HashAlgoEnum.ARGON2ID: {
124
+ return await argon2.hash(value, {
125
+ ...(typeof options === 'object' ? options : {}),
126
+ type: argon2.argon2id
127
+ });
128
+ }
129
+ case HashAlgoEnum.BCRYPT: {
130
+ try {
131
+ const saltRounds = 12;
132
+ return await bcrypt.hash(
133
+ value,
134
+ (typeof options === 'string' || typeof options === 'number') ? options : saltRounds
135
+ );
136
+ } catch (e) {
137
+ throw new Error(`BCRYPT not supported without optional dependency "bcrypt"`);
138
+ }
139
+ }
140
+ default:
141
+ throw new Error(`password() is only available for BCRYPT and ARGON2ID (current: ${this.algo})`);
142
+ }
143
+ }
144
+
145
+ async checkPassword(hash: string, password: string): Promise<boolean> {
146
+ switch (this.algo) {
147
+ case HashAlgoEnum.ARGON2ID:
148
+ return await argon2.verify(hash, password);
149
+ case HashAlgoEnum.BCRYPT:
150
+ return await bcrypt.compare(password, hash);
151
+ }
152
+ return false;
153
+ }
154
+
155
+ }
@@ -0,0 +1,13 @@
1
+ export enum HashAlgoEnum {
2
+ ARGON2ID = 'ARGON2ID',
3
+ BCRYPT = 'BCRYPT',
4
+ PBKDF2 = 'PBKDF2',
5
+ SCRYPT = 'SCRYPT',
6
+ SHA256 = 'SHA256',
7
+ SHA512 = 'SHA512',
8
+ MD5 = 'MD5',
9
+ RIPEMD160 = 'RIPEMD160',
10
+ BLAKE2B = 'BLAKE2B',
11
+ SHA3_256 = 'SHA3_256',
12
+ SHA3_512 = 'SHA3_512',
13
+ }
@@ -0,0 +1,4 @@
1
+ export enum EventMessageEnum {
2
+ RESTART = ":restart",
3
+ STOP = ":stop",
4
+ }
@@ -1,4 +1,4 @@
1
- declare enum Parametrable {
1
+ export enum Parametrable {
2
2
  PARAM = "param",
3
3
  BODY = "body",
4
4
  QUERY = "query",
@@ -6,7 +6,5 @@ declare enum Parametrable {
6
6
  REQ = "req",
7
7
  REPLY = "reply",
8
8
  UPLOAD_FILE = "upload",
9
- CUSTOM = "custom"
10
- }
11
-
12
- export { Parametrable };
9
+ CUSTOM = "custom",
10
+ }
@@ -0,0 +1,10 @@
1
+ export enum HttpMethod {
2
+ GET = 'GET',
3
+ POST = 'POST',
4
+ PUT = 'PUT',
5
+ DELETE = 'DELETE',
6
+ PATCH = 'PATCH',
7
+ OPTIONS = 'OPTIONS',
8
+ HEAD = 'HEAD',
9
+ TRACE = 'TRACE',
10
+ }
@@ -0,0 +1,6 @@
1
+ export * from "./http.enum"
2
+ export * from "./http-parameters.enum"
3
+ export * from "./encrypted.enum"
4
+ export * from "./event.message.enum"
5
+ export * from "./timestamp.enum"
6
+ export * from "./runtime.enum"
@@ -1,8 +1,6 @@
1
- declare enum RuntimeType {
1
+ export enum RuntimeType {
2
2
  Node = "node",
3
3
  Deno = "deno",
4
4
  Bun = "bun",
5
5
  Web = "web"
6
- }
7
-
8
- export { RuntimeType };
6
+ }
@@ -1,8 +1,6 @@
1
- declare enum TimestampEnum {
1
+ export enum TimestampEnum {
2
2
  HH_MM_SS = "HH:mm:ss",
3
3
  HH_MM_SS_SSS = "HH:mm:ss.SSS",
4
4
  DD_MM_YYYY_HH_MM_SS = "DD/MM/YYYY HH:mm:ss",
5
5
  DD_MM_YYYY_HH_MM_SS_SSS = "DD/MM/YYYY HH:mm:ss.SSS"
6
- }
7
-
8
- export { TimestampEnum };
6
+ }
@@ -0,0 +1,40 @@
1
+ import {IGenericValue} from "../types/generic";
2
+ import {getType} from "./utilities";
3
+
4
+ export function env<T>(key: string, type?: IGenericValue): T | undefined {
5
+ const value = process.env[key];
6
+ type = type || getType(value) as IGenericValue;
7
+
8
+ if (value) {
9
+ switch (type) {
10
+
11
+ case "bigInt":
12
+ return BigInt(value) as any;
13
+
14
+ case 'float':
15
+ return parseFloat(value) as any;
16
+
17
+ case 'boolean':
18
+ return Boolean(value) as any;
19
+
20
+ case "int":
21
+ return parseInt(value) as any;
22
+
23
+ default:
24
+ return value as any;
25
+ }
26
+ }
27
+
28
+ return undefined;
29
+ }
30
+
31
+ export function envGroup(key: string): Record<string, IGenericValue | undefined> {
32
+ const filtered = Object.entries(process.env)
33
+ .filter(([index]) => key.startsWith(index))
34
+ const gen: Record<string, IGenericValue | undefined> = {}
35
+
36
+ for (const [index, value] of filtered)
37
+ gen[index] = env(value as any, undefined)
38
+
39
+ return gen;
40
+ }
@@ -0,0 +1,6 @@
1
+ export * from "./enums/index"
2
+ export * from "./constants/index"
3
+ export * from "./decorators/index"
4
+ export * from "./plugins/index"
5
+ export * from "./utilities/index"
6
+ export * from "./runtime/index"