raiton 1.1.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (436) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/README.md +97 -1
  3. package/build/bin/index.mjs +7012 -47
  4. package/deno.json +9 -0
  5. package/package.json +28 -44
  6. package/scripts/update-version.ts +97 -0
  7. package/source/bin/bootstrapper.ts +15 -0
  8. package/source/bin/cli-tools.ts +68 -0
  9. package/source/bin/cli.ts +12 -0
  10. package/source/bin/constants.ts +5 -0
  11. package/source/bin/index.ts +6 -0
  12. package/source/commands/artifact.command.ts +28 -0
  13. package/source/commands/build.command.ts +31 -0
  14. package/source/commands/develop.command.ts +47 -0
  15. package/source/commands/grafts.command.ts +27 -0
  16. package/source/commands/start.command.ts +28 -0
  17. package/source/core/application.ts +163 -0
  18. package/source/core/builder.ts +144 -0
  19. package/source/core/bytes.util.ts +17 -0
  20. package/source/core/command.ts +24 -0
  21. package/source/core/commands.ts +44 -0
  22. package/source/core/config/config.ts +51 -0
  23. package/source/core/config/define.ts +13 -0
  24. package/source/core/config/index.ts +2 -0
  25. package/source/core/context.ts +33 -0
  26. package/source/core/controller/builder.ts +41 -0
  27. package/source/core/controller/compiler.ts +22 -0
  28. package/source/core/controller/index.ts +3 -0
  29. package/source/core/controller/metadata.ts +13 -0
  30. package/source/core/directories.ts +30 -0
  31. package/source/core/helpers/index.ts +1 -0
  32. package/source/core/helpers/raiton.ts +3 -0
  33. package/source/core/hooks.ts +28 -0
  34. package/source/core/index.ts +14 -0
  35. package/source/core/injection/index.ts +1 -0
  36. package/source/core/injection/injection.ts +219 -0
  37. package/source/core/middleware/compose.ts +40 -0
  38. package/source/core/middleware/index.ts +2 -0
  39. package/source/core/middleware/pipeline.ts +27 -0
  40. package/source/core/plugins/index.ts +2 -0
  41. package/source/core/plugins/plugin.ts +8 -0
  42. package/source/core/plugins/scope.ts +46 -0
  43. package/source/core/process.util.ts +12 -0
  44. package/source/core/raiton.ts +20 -0
  45. package/source/core/router/handler.ts +115 -0
  46. package/source/core/router/index.ts +4 -0
  47. package/source/core/router/matcher.ts +51 -0
  48. package/source/core/router/route.ts +63 -0
  49. package/source/core/router/router.ts +31 -0
  50. package/source/core/server.ts +26 -0
  51. package/source/core/thread.ts +112 -0
  52. package/source/env.d.ts +3 -0
  53. package/source/requirements.ts +27 -0
  54. package/source/sdk/artifacts.ts +79 -0
  55. package/source/sdk/constants/decorators.constant.ts +8 -0
  56. package/source/sdk/constants/index.ts +2 -0
  57. package/source/sdk/constants/microservices.constant.ts +4 -0
  58. package/source/sdk/controllers.ts +4 -0
  59. package/source/sdk/data-transfer-object.ts +15 -0
  60. package/source/sdk/decorators/access-guard.decorator.ts +9 -0
  61. package/source/sdk/decorators/controllable.decorator.ts +20 -0
  62. package/source/sdk/decorators/index.ts +5 -0
  63. package/source/sdk/decorators/injection.decorator.ts +46 -0
  64. package/source/sdk/decorators/middleware.decorator.ts +15 -0
  65. package/source/sdk/decorators/parametrable.ts +28 -0
  66. package/source/sdk/decorators/routable.decorator.ts +45 -0
  67. package/source/sdk/encryption.ts +157 -0
  68. package/source/sdk/enums/encrypted.enum.ts +23 -0
  69. package/source/sdk/enums/event.message.enum.ts +4 -0
  70. package/source/sdk/enums/http-method.enum.ts +10 -0
  71. package/{build/sdk/enums/http-parameters.enum.d.ts → source/sdk/enums/http-parameters.enum.ts} +3 -5
  72. package/source/sdk/enums/http-status.enum.ts +73 -0
  73. package/source/sdk/enums/index.ts +7 -0
  74. package/{build/sdk/enums/runtime.enum.d.ts → source/sdk/enums/runtime.enum.ts} +2 -4
  75. package/{build/sdk/enums/timestamp.enum.d.ts → source/sdk/enums/timestamp.enum.ts} +2 -4
  76. package/source/sdk/env.ts +40 -0
  77. package/source/sdk/exceptions/http-exception.ts +28 -0
  78. package/source/sdk/exceptions/index.ts +2 -0
  79. package/{build/sdk/throwable.d.ts → source/sdk/exceptions/throwable.ts} +35 -12
  80. package/source/sdk/index.ts +14 -0
  81. package/source/sdk/parameter-bag.ts +55 -0
  82. package/source/sdk/plugins/body-parser.plugin.ts +160 -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/responses/error.ts +52 -0
  92. package/source/sdk/responses/helpers.ts +28 -0
  93. package/source/sdk/responses/http-throwable.ts +28 -0
  94. package/source/sdk/responses/http.ts +48 -0
  95. package/source/sdk/responses/index.ts +4 -0
  96. package/source/sdk/runtime/bun/server.ts +73 -0
  97. package/source/sdk/runtime/deno/server.ts +53 -0
  98. package/source/sdk/runtime/index.ts +47 -0
  99. package/source/sdk/runtime/node/server.ts +60 -0
  100. package/source/sdk/runtime/web/server.ts +57 -0
  101. package/source/sdk/services.ts +9 -0
  102. package/source/sdk/utilities/alias-path.util.ts +49 -0
  103. package/source/sdk/utilities/artifact.util.ts +18 -0
  104. package/source/sdk/utilities/callable.util.ts +27 -0
  105. package/source/sdk/utilities/index.ts +5 -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 +44 -0
  113. package/source/types/builder.ts +44 -0
  114. package/source/types/config.ts +7 -0
  115. package/source/types/controller.ts +33 -0
  116. package/source/types/contruct.ts +3 -0
  117. package/source/types/core.ts +28 -0
  118. package/{build/types/directory.d.ts → source/types/directory.ts} +4 -4
  119. package/source/types/encryption.ts +17 -0
  120. package/source/types/generic.ts +3 -0
  121. package/source/types/http-responses.ts +8 -0
  122. package/source/types/index.ts +25 -0
  123. package/source/types/injection.ts +13 -0
  124. package/source/types/lifecycle.ts +11 -0
  125. package/source/types/middleware.ts +18 -0
  126. package/source/types/parseable.ts +7 -0
  127. package/source/types/plugin.ts +10 -0
  128. package/source/types/raiton.ts +7 -0
  129. package/source/types/responses.ts +20 -0
  130. package/source/types/router.ts +11 -0
  131. package/source/types/runtime.ts +56 -0
  132. package/{build/types/scheme.d.ts → source/types/scheme.ts} +33 -8
  133. package/source/types/server.ts +12 -0
  134. package/source/types/thread.ts +31 -0
  135. package/source/types/utilities.ts +4 -0
  136. package/source/types/values.ts +3 -0
  137. package/.releaserc.json +0 -39
  138. package/build/bin/bootstrapper.d.ts +0 -5
  139. package/build/bin/bootstrapper.mjs +0 -46
  140. package/build/bin/cli.d.ts +0 -5
  141. package/build/bin/cli.mjs +0 -6
  142. package/build/bin/index.d.ts +0 -1
  143. package/build/chunk-3PWMRP6G.mjs +0 -16
  144. package/build/chunk-52JR26TI.mjs +0 -29
  145. package/build/chunk-5LNOA4SK.mjs +0 -16
  146. package/build/chunk-AUGL35CF.mjs +0 -24
  147. package/build/chunk-BYYJRCB4.mjs +0 -10
  148. package/build/chunk-FFRJ4AUA.mjs +0 -16
  149. package/build/chunk-GPJSLV3Q.mjs +0 -50
  150. package/build/chunk-HVFHDVAH.mjs +0 -20
  151. package/build/chunk-IOCHNQMF.mjs +0 -13
  152. package/build/chunk-JATYBWHL.mjs +0 -36
  153. package/build/chunk-JWNBO7XV.mjs +0 -53
  154. package/build/chunk-K4IQQ2KF.mjs +0 -55
  155. package/build/chunk-K4KLOLSO.mjs +0 -645
  156. package/build/chunk-M2RZZJQR.mjs +0 -27
  157. package/build/chunk-MLFGBJDV.mjs +0 -12
  158. package/build/chunk-NB62GSFI.mjs +0 -27
  159. package/build/chunk-O7R3NJQN.mjs +0 -19
  160. package/build/chunk-P2YCCBFR.mjs +0 -14
  161. package/build/chunk-P3IRIFPT.mjs +0 -53
  162. package/build/chunk-QFSXFOEN.mjs +0 -56
  163. package/build/chunk-QHCQ4AUA.mjs +0 -14
  164. package/build/chunk-QI7OFSXB.mjs +0 -37
  165. package/build/chunk-RVH2YBNU.mjs +0 -111
  166. package/build/chunk-RXG7754R.mjs +0 -25
  167. package/build/chunk-S3ONGVNZ.mjs +0 -11
  168. package/build/chunk-SRR4467I.mjs +0 -29
  169. package/build/chunk-T6L55AUG.mjs +0 -32
  170. package/build/chunk-TOJFTPAY.mjs +0 -83
  171. package/build/chunk-UAPCBU3J.mjs +0 -12
  172. package/build/chunk-UCHBN3DV.mjs +0 -52
  173. package/build/chunk-UWM46HLZ.mjs +0 -18
  174. package/build/chunk-UZFCGVHP.mjs +0 -8
  175. package/build/chunk-VQINCGLQ.mjs +0 -59
  176. package/build/chunk-VRL4S7UF.mjs +0 -74
  177. package/build/chunk-WAWFDMOH.mjs +0 -72
  178. package/build/chunk-X3JFRRRQ.mjs +0 -45
  179. package/build/chunk-XFBLELHI.mjs +0 -34
  180. package/build/chunk-XIGE72LC.mjs +0 -34
  181. package/build/chunk-XW7EPAD7.mjs +0 -0
  182. package/build/chunk-YGIZFKLJ.mjs +0 -20
  183. package/build/chunk-YRVIAORI.mjs +0 -8
  184. package/build/chunk-YXU5W2CB.mjs +0 -12
  185. package/build/commands/artifact.command.d.ts +0 -14
  186. package/build/commands/artifact.command.mjs +0 -59
  187. package/build/commands/build.command.d.ts +0 -14
  188. package/build/commands/build.command.mjs +0 -65
  189. package/build/commands/develop.command.d.ts +0 -13
  190. package/build/commands/develop.command.mjs +0 -75
  191. package/build/commands/grafts.command.d.ts +0 -12
  192. package/build/commands/grafts.command.mjs +0 -58
  193. package/build/commands/start.command.d.ts +0 -12
  194. package/build/commands/start.command.mjs +0 -64
  195. package/build/core/application.d.ts +0 -27
  196. package/build/core/application.mjs +0 -124
  197. package/build/core/artifact.d.ts +0 -19
  198. package/build/core/artifact.mjs +0 -133
  199. package/build/core/builder.d.ts +0 -35
  200. package/build/core/builder.mjs +0 -45
  201. package/build/core/bytes.util.d.ts +0 -6
  202. package/build/core/bytes.util.mjs +0 -8
  203. package/build/core/command.d.ts +0 -15
  204. package/build/core/command.mjs +0 -6
  205. package/build/core/commands.d.ts +0 -13
  206. package/build/core/commands.mjs +0 -7
  207. package/build/core/config.d.ts +0 -10
  208. package/build/core/config.mjs +0 -7
  209. package/build/core/context.d.ts +0 -15
  210. package/build/core/context.mjs +0 -6
  211. package/build/core/controller/builder.d.ts +0 -10
  212. package/build/core/controller/builder.mjs +0 -45
  213. package/build/core/controller/compiler.d.ts +0 -6
  214. package/build/core/controller/compiler.mjs +0 -45
  215. package/build/core/controller/index.d.ts +0 -13
  216. package/build/core/controller/index.mjs +0 -50
  217. package/build/core/controller/metadata.d.ts +0 -10
  218. package/build/core/controller/metadata.mjs +0 -6
  219. package/build/core/directories.d.ts +0 -11
  220. package/build/core/directories.mjs +0 -8
  221. package/build/core/hmr.d.ts +0 -22
  222. package/build/core/hmr.mjs +0 -6
  223. package/build/core/hooks.d.ts +0 -12
  224. package/build/core/hooks.mjs +0 -6
  225. package/build/core/index.d.ts +0 -41
  226. package/build/core/index.mjs +0 -100
  227. package/build/core/middleware/compose.d.ts +0 -8
  228. package/build/core/middleware/compose.mjs +0 -6
  229. package/build/core/middleware/index.d.ts +0 -6
  230. package/build/core/middleware/index.mjs +0 -11
  231. package/build/core/middleware/pipeline.d.ts +0 -14
  232. package/build/core/middleware/pipeline.mjs +0 -7
  233. package/build/core/plugins/index.d.ts +0 -14
  234. package/build/core/plugins/index.mjs +0 -48
  235. package/build/core/plugins/plugin.d.ts +0 -17
  236. package/build/core/plugins/plugin.mjs +0 -6
  237. package/build/core/plugins/scope.d.ts +0 -24
  238. package/build/core/plugins/scope.mjs +0 -45
  239. package/build/core/process.util.d.ts +0 -3
  240. package/build/core/process.util.mjs +0 -6
  241. package/build/core/raiton.d.ts +0 -20
  242. package/build/core/raiton.mjs +0 -6
  243. package/build/core/router/handler.d.ts +0 -10
  244. package/build/core/router/handler.mjs +0 -45
  245. package/build/core/router/index.d.ts +0 -12
  246. package/build/core/router/index.mjs +0 -54
  247. package/build/core/router/matcher.d.ts +0 -21
  248. package/build/core/router/matcher.mjs +0 -6
  249. package/build/core/router/route.d.ts +0 -20
  250. package/build/core/router/route.mjs +0 -6
  251. package/build/core/router/router.d.ts +0 -16
  252. package/build/core/router/router.mjs +0 -8
  253. package/build/core/thread.d.ts +0 -30
  254. package/build/core/thread.mjs +0 -45
  255. package/build/env.d.d.ts +0 -2
  256. package/build/env.d.mjs +0 -0
  257. package/build/raiton-1.1.1.tgz +0 -0
  258. package/build/requirements.d.ts +0 -2
  259. package/build/requirements.mjs +0 -19
  260. package/build/sdk/artifacts.d.ts +0 -13
  261. package/build/sdk/artifacts.mjs +0 -45
  262. package/build/sdk/constants/decorators.constant.d.ts +0 -11
  263. package/build/sdk/constants/decorators.constant.mjs +0 -6
  264. package/build/sdk/constants/index.d.ts +0 -2
  265. package/build/sdk/constants/index.mjs +0 -11
  266. package/build/sdk/constants/microservices.constant.d.ts +0 -5
  267. package/build/sdk/constants/microservices.constant.mjs +0 -6
  268. package/build/sdk/controllers.d.ts +0 -4
  269. package/build/sdk/controllers.mjs +0 -6
  270. package/build/sdk/data-transfer-object.d.ts +0 -7
  271. package/build/sdk/data-transfer-object.mjs +0 -7
  272. package/build/sdk/decorators/access-guard.decorator.d.ts +0 -2
  273. package/build/sdk/decorators/access-guard.decorator.mjs +0 -0
  274. package/build/sdk/decorators/controllable.d.ts +0 -3
  275. package/build/sdk/decorators/controllable.mjs +0 -45
  276. package/build/sdk/decorators/controllers.decorator.d.ts +0 -2
  277. package/build/sdk/decorators/controllers.decorator.mjs +0 -0
  278. package/build/sdk/decorators/grafts.decorator.d.ts +0 -2
  279. package/build/sdk/decorators/grafts.decorator.mjs +0 -0
  280. package/build/sdk/decorators/index.d.ts +0 -3
  281. package/build/sdk/decorators/index.mjs +0 -75
  282. package/build/sdk/decorators/parameters.decorator.d.ts +0 -2
  283. package/build/sdk/decorators/parameters.decorator.mjs +0 -0
  284. package/build/sdk/decorators/parametrable.d.ts +0 -9
  285. package/build/sdk/decorators/parametrable.mjs +0 -57
  286. package/build/sdk/decorators/payload.decorator.d.ts +0 -2
  287. package/build/sdk/decorators/payload.decorator.mjs +0 -0
  288. package/build/sdk/decorators/routable.d.ts +0 -10
  289. package/build/sdk/decorators/routable.mjs +0 -59
  290. package/build/sdk/dependency-container.d.ts +0 -19
  291. package/build/sdk/dependency-container.mjs +0 -46
  292. package/build/sdk/encryption.d.ts +0 -27
  293. package/build/sdk/encryption.mjs +0 -141
  294. package/build/sdk/enums/encrypted.enum.d.ts +0 -15
  295. package/build/sdk/enums/encrypted.enum.mjs +0 -6
  296. package/build/sdk/enums/event.message.enum.d.ts +0 -6
  297. package/build/sdk/enums/event.message.enum.mjs +0 -6
  298. package/build/sdk/enums/http-parameters.enum.mjs +0 -6
  299. package/build/sdk/enums/http.enum.d.ts +0 -12
  300. package/build/sdk/enums/http.enum.mjs +0 -6
  301. package/build/sdk/enums/index.d.ts +0 -6
  302. package/build/sdk/enums/index.mjs +0 -27
  303. package/build/sdk/enums/runtime.enum.mjs +0 -6
  304. package/build/sdk/enums/timestamp.enum.mjs +0 -6
  305. package/build/sdk/env.d.ts +0 -6
  306. package/build/sdk/env.mjs +0 -74
  307. package/build/sdk/fastify.d.ts +0 -11
  308. package/build/sdk/fastify.mjs +0 -9
  309. package/build/sdk/grafts.d.ts +0 -15
  310. package/build/sdk/grafts.mjs +0 -71
  311. package/build/sdk/index.d.ts +0 -34
  312. package/build/sdk/index.mjs +0 -126
  313. package/build/sdk/json.d.ts +0 -17
  314. package/build/sdk/json.mjs +0 -87
  315. package/build/sdk/plugins/body-parser.plugin.d.ts +0 -17
  316. package/build/sdk/plugins/body-parser.plugin.mjs +0 -7
  317. package/build/sdk/plugins/index.d.ts +0 -17
  318. package/build/sdk/plugins/index.mjs +0 -48
  319. package/build/sdk/plugins/security/body-limit.d.ts +0 -17
  320. package/build/sdk/plugins/security/body-limit.mjs +0 -45
  321. package/build/sdk/plugins/security/cors.d.ts +0 -22
  322. package/build/sdk/plugins/security/cors.mjs +0 -45
  323. package/build/sdk/plugins/security/headers.d.ts +0 -17
  324. package/build/sdk/plugins/security/headers.mjs +0 -45
  325. package/build/sdk/plugins/security/index.d.ts +0 -25
  326. package/build/sdk/plugins/security/index.mjs +0 -45
  327. package/build/sdk/plugins/security/method-guard.d.ts +0 -17
  328. package/build/sdk/plugins/security/method-guard.mjs +0 -45
  329. package/build/sdk/plugins/security/rate-limit.d.ts +0 -21
  330. package/build/sdk/plugins/security/rate-limit.mjs +0 -45
  331. package/build/sdk/repositories.d.ts +0 -7
  332. package/build/sdk/repositories.mjs +0 -17
  333. package/build/sdk/request.d.ts +0 -4
  334. package/build/sdk/request.mjs +0 -6
  335. package/build/sdk/responses.d.ts +0 -8
  336. package/build/sdk/responses.mjs +0 -20
  337. package/build/sdk/routes.d.ts +0 -7
  338. package/build/sdk/routes.mjs +0 -61
  339. package/build/sdk/runtime/bun/server.d.ts +0 -6
  340. package/build/sdk/runtime/bun/server.mjs +0 -6
  341. package/build/sdk/runtime/deno/server.d.ts +0 -6
  342. package/build/sdk/runtime/deno/server.mjs +0 -6
  343. package/build/sdk/runtime/index.d.ts +0 -15
  344. package/build/sdk/runtime/index.mjs +0 -11
  345. package/build/sdk/runtime/node/reply.d.ts +0 -2
  346. package/build/sdk/runtime/node/reply.mjs +0 -0
  347. package/build/sdk/runtime/node/request.d.ts +0 -2
  348. package/build/sdk/runtime/node/request.mjs +0 -0
  349. package/build/sdk/runtime/node/server.d.ts +0 -6
  350. package/build/sdk/runtime/node/server.mjs +0 -6
  351. package/build/sdk/runtime/web/server.d.ts +0 -6
  352. package/build/sdk/runtime/web/server.mjs +0 -6
  353. package/build/sdk/schemes.d.ts +0 -120
  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.d.ts +0 -25
  401. package/build/types/hmr.mjs +0 -0
  402. package/build/types/http-responses.d.ts +0 -10
  403. package/build/types/http-responses.mjs +0 -0
  404. package/build/types/index.d.ts +0 -45
  405. package/build/types/index.mjs +0 -0
  406. package/build/types/middleware.d.ts +0 -12
  407. package/build/types/middleware.mjs +0 -0
  408. package/build/types/parameters.d.ts +0 -19
  409. package/build/types/parameters.mjs +0 -0
  410. package/build/types/parseable.d.ts +0 -5
  411. package/build/types/parseable.mjs +0 -0
  412. package/build/types/payload.d.ts +0 -6
  413. package/build/types/payload.mjs +0 -0
  414. package/build/types/plugin.d.ts +0 -20
  415. package/build/types/plugin.mjs +0 -0
  416. package/build/types/raiton.d.ts +0 -12
  417. package/build/types/raiton.mjs +0 -0
  418. package/build/types/repositories.d.ts +0 -8
  419. package/build/types/repositories.mjs +0 -0
  420. package/build/types/router.d.ts +0 -14
  421. package/build/types/router.mjs +0 -0
  422. package/build/types/runtime.d.ts +0 -37
  423. package/build/types/runtime.mjs +0 -0
  424. package/build/types/scheme.mjs +0 -0
  425. package/build/types/server.d.ts +0 -57
  426. package/build/types/server.mjs +0 -0
  427. package/build/types/services.d.ts +0 -8
  428. package/build/types/services.mjs +0 -0
  429. package/build/types/thread.d.ts +0 -24
  430. package/build/types/thread.mjs +0 -0
  431. package/build/types/utilities.d.ts +0 -6
  432. package/build/types/utilities.mjs +0 -0
  433. package/build/types/values.d.ts +0 -4
  434. package/build/types/values.mjs +0 -0
  435. /package/{build/chunk-4OWCGDUD.mjs → source/sdk/runtime/node/reply.ts} +0 -0
  436. /package/{build/chunk-DIWD7ZCJ.mjs → source/sdk/runtime/node/request.ts} +0 -0
@@ -1,645 +0,0 @@
1
- import {
2
- isControllerFile
3
- } from "./chunk-IOCHNQMF.mjs";
4
- import {
5
- bodyParserPlugin
6
- } from "./chunk-RVH2YBNU.mjs";
7
- import {
8
- Runtime
9
- } from "./chunk-GPJSLV3Q.mjs";
10
- import {
11
- definePlugin
12
- } from "./chunk-UZFCGVHP.mjs";
13
- import {
14
- Router
15
- } from "./chunk-XIGE72LC.mjs";
16
- import {
17
- getControllerMetadata
18
- } from "./chunk-S3ONGVNZ.mjs";
19
- import {
20
- MiddlewarePipeline
21
- } from "./chunk-52JR26TI.mjs";
22
- import {
23
- Throwable
24
- } from "./chunk-VQINCGLQ.mjs";
25
- import {
26
- RaitonDirectories
27
- } from "./chunk-T6L55AUG.mjs";
28
- import {
29
- RaitonConfig
30
- } from "./chunk-QI7OFSXB.mjs";
31
- import {
32
- Hmr
33
- } from "./chunk-TOJFTPAY.mjs";
34
- import {
35
- HookStore
36
- } from "./chunk-NB62GSFI.mjs";
37
- import {
38
- until
39
- } from "./chunk-5LNOA4SK.mjs";
40
- import {
41
- Raiton
42
- } from "./chunk-YGIZFKLJ.mjs";
43
-
44
- // source/core/builder.ts
45
- import { context, build } from "esbuild";
46
- import path3 from "path";
47
- import { Logger as Logger5 } from "@protorians/logger";
48
- import fs3 from "fs";
49
- import { ProcessUtility as ProcessUtility2 } from "@protorians/core";
50
-
51
- // source/core/thread.ts
52
- import { ProcessUtility } from "@protorians/core";
53
- import { LBadge, Logger } from "@protorians/logger";
54
- var RaitonThread = class _RaitonThread {
55
- constructor(builder, _options = {}) {
56
- this.builder = builder;
57
- this._options = _options;
58
- this.appDir = process.cwd();
59
- _RaitonThread.instance = this;
60
- }
61
- static instance = null;
62
- static get current() {
63
- if (!_RaitonThread.instance) throw new Throwable("Thread not initialized");
64
- return _RaitonThread.instance;
65
- }
66
- application = null;
67
- runtime = null;
68
- server = null;
69
- appDir;
70
- restart() {
71
- process.send?.(":restart" /* RESTART */);
72
- }
73
- stop() {
74
- process.exit(0);
75
- }
76
- async sleep(milliseconds) {
77
- return await ProcessUtility.sleep(milliseconds);
78
- }
79
- async wait(condition) {
80
- return await until(condition);
81
- }
82
- setup({ application, runtime }) {
83
- this.runtime = new Runtime(runtime || "node" /* Node */);
84
- this.application = application;
85
- this.application.use(bodyParserPlugin());
86
- return this;
87
- }
88
- async run() {
89
- if (!this.application)
90
- throw new Throwable("Application not defined");
91
- if (!this.runtime)
92
- throw new Throwable("Runtime not defined");
93
- const port = this.application.config.port || 5712;
94
- this.server = this.runtime.createServer(this.application.handle.bind(this.application));
95
- await this.server.listen(port);
96
- if (this.builder.out)
97
- await ControllerBuilder.scan(this.builder.out);
98
- Logger.log(LBadge.info("Server Started"), `http://localhost:${port}`);
99
- return this;
100
- }
101
- };
102
-
103
- // source/sdk/decorators/routable.ts
104
- function createRoutableMethod(method) {
105
- return (path5 = "") => (target, propertyKey) => {
106
- const meta = getControllerMetadata(target);
107
- meta.routes.push({
108
- method,
109
- path: path5,
110
- propertyKey,
111
- params: meta.params[propertyKey] || []
112
- });
113
- };
114
- }
115
- var Get = createRoutableMethod("GET" /* GET */);
116
- var Post = createRoutableMethod("POST" /* POST */);
117
- var Put = createRoutableMethod("PUT" /* PUT */);
118
- var Patch = createRoutableMethod("PATCH" /* PATCH */);
119
- var Options = createRoutableMethod("OPTIONS" /* OPTIONS */);
120
- var Trace = createRoutableMethod("TRACE" /* TRACE */);
121
- var Delete = createRoutableMethod("DELETE" /* DELETE */);
122
- var Head = createRoutableMethod("HEAD" /* HEAD */);
123
-
124
- // source/sdk/decorators/parametrable.ts
125
- function createParametrable(type, callable) {
126
- return (key) => {
127
- return (target, propertyKey, index) => {
128
- const meta = getControllerMetadata(target);
129
- if (!meta.params[propertyKey])
130
- meta.params[propertyKey] = [];
131
- meta.params[propertyKey].push({ index, type, key, callable });
132
- };
133
- };
134
- }
135
- var Query = createParametrable("query" /* QUERY */);
136
- var Param = createParametrable("param" /* PARAM */);
137
- var Body = createParametrable("body" /* BODY */);
138
- var UploadedFile = createParametrable("upload" /* UPLOAD_FILE */);
139
- var Headers = createParametrable("header" /* HEADER */);
140
- var Req = createParametrable("req" /* REQ */);
141
- var Reply = createParametrable("reply" /* REPLY */);
142
-
143
- // source/core/router/handler.ts
144
- import { Logger as Logger2 } from "@protorians/logger";
145
- function createHandler(instance, metadata) {
146
- return async (ctx) => {
147
- const args = [];
148
- Logger2.debug("Metadata:", metadata);
149
- for (const p of metadata.params) {
150
- switch (p.type) {
151
- case "query" /* QUERY */:
152
- args[p.index] = ctx.req.query?.[p.key];
153
- break;
154
- case "param" /* PARAM */:
155
- args[p.index] = ctx.req.params?.[p.key] ?? ctx.params?.[p.key];
156
- break;
157
- case "body" /* BODY */:
158
- args[p.index] = ctx.req.body;
159
- break;
160
- case "header" /* HEADER */:
161
- args[p.index] = ctx.req.headers[p.key.toLowerCase()];
162
- break;
163
- case "req" /* REQ */:
164
- args[p.index] = ctx.req;
165
- break;
166
- case "reply" /* REPLY */:
167
- args[p.index] = ctx.REPLY;
168
- break;
169
- case "upload" /* UPLOAD_FILE */:
170
- args[p.index] = ctx.req.file;
171
- break;
172
- case "custom" /* CUSTOM */:
173
- args[p.index] = p.callable?.(ctx) ?? null;
174
- break;
175
- }
176
- }
177
- return instance[metadata.propertyKey](...args);
178
- };
179
- }
180
-
181
- // source/core/plugins/scope.ts
182
- var PluginScope = class _PluginScope {
183
- hooks;
184
- middleware;
185
- router;
186
- constructor(parent) {
187
- this.hooks = parent ? parent.hooks.clone() : new HookStore();
188
- this.middleware = parent ? parent.middleware.clone() : new MiddlewarePipeline();
189
- this.router = parent ? parent.router : new Router();
190
- }
191
- addHook(name, fn) {
192
- this.hooks.add(name, fn);
193
- return this;
194
- }
195
- use(mw) {
196
- if (typeof mw === "object" && mw !== null && "setup" in mw && typeof mw.setup === "function" && mw.setup.length === 1) {
197
- mw.setup(this);
198
- return this;
199
- }
200
- this.middleware.use(mw);
201
- return this;
202
- }
203
- route(method, path5, handler, version) {
204
- return this.router.add(method, path5, handler, version);
205
- }
206
- register(plugin) {
207
- const child = new _PluginScope(this);
208
- plugin.setup(child);
209
- return child;
210
- }
211
- };
212
-
213
- // source/sdk/plugins/security/headers.ts
214
- var secureHeaders = definePlugin((scope) => {
215
- scope.use(async (ctx, next) => {
216
- ctx.reply.header("X-Content-Type-Options", "nosniff");
217
- ctx.reply.header("X-Frame-Options", "DENY");
218
- ctx.reply.header("Referrer-Policy", "no-referrer");
219
- ctx.reply.header("X-XSS-Protection", "1; mode=block");
220
- await next();
221
- });
222
- }, "security-headers");
223
-
224
- // source/sdk/plugins/security/cors.ts
225
- var secureCors = (opts = {}) => definePlugin((scope) => {
226
- scope.use(async (ctx, next) => {
227
- const origin = ctx.req.headers.get("origin");
228
- if (opts.origin) {
229
- const allowed = Array.isArray(opts.origin) ? opts.origin.includes(origin) : opts.origin === origin;
230
- if (allowed) {
231
- ctx.reply.header("Access-Control-Allow-Origin", origin);
232
- }
233
- } else {
234
- ctx.reply.header("Access-Control-Allow-Origin", "*");
235
- }
236
- ctx.reply.header(
237
- "Access-Control-Allow-Methods",
238
- (opts.methods ?? ["GET", "POST", "PUT", "DELETE"]).join(",")
239
- );
240
- ctx.reply.header(
241
- "Access-Control-Allow-Headers",
242
- (opts.headers ?? ["Content-Type", "Authorization"]).join(",")
243
- );
244
- if (ctx.req.method === "OPTIONS") {
245
- ctx.reply.status(204);
246
- return ctx.send(null);
247
- }
248
- await next();
249
- });
250
- }, "cors");
251
-
252
- // source/sdk/plugins/security/rate-limit.ts
253
- var secureRateLimit = (opts = {}) => definePlugin((scope) => {
254
- const hits = /* @__PURE__ */ new Map();
255
- const windowMs = opts.windowMs ?? 6e4;
256
- const max = opts.max ?? 100;
257
- scope.use(async (ctx, next) => {
258
- const ip = ctx.req.remoteAddress ?? "unknown";
259
- const now = Date.now();
260
- const entry = hits.get(ip) ?? { count: 0, ts: now };
261
- if (now - entry.ts > windowMs) {
262
- entry.count = 0;
263
- entry.ts = now;
264
- }
265
- entry.count++;
266
- hits.set(ip, entry);
267
- if (entry.count > max) {
268
- ctx.reply.status(429);
269
- return ctx.send({ error: "Too many requests" });
270
- }
271
- await next();
272
- });
273
- }, "rate-limit");
274
-
275
- // source/sdk/plugins/security/body-limit.ts
276
- var secureBodyLimit = (maxBytes = 1e6) => definePlugin((scope) => {
277
- scope.use(async (ctx, next) => {
278
- const len = Number(
279
- ctx.req.headers.get("content-length") ?? 0
280
- );
281
- if (len > maxBytes) {
282
- ctx.reply.status(413);
283
- return ctx.send({ error: "Payload too large" });
284
- }
285
- await next();
286
- });
287
- }, "body-limit");
288
-
289
- // source/sdk/plugins/security/method-guard.ts
290
- var secureMethodGuard = (allowed) => definePlugin((scope) => {
291
- scope.use(async (ctx, next) => {
292
- if (!allowed.includes(ctx.req.method)) {
293
- ctx.reply.status(405);
294
- return ctx.send({ error: "Method not allowed" });
295
- }
296
- await next();
297
- });
298
- }, "method-guard");
299
-
300
- // source/sdk/plugins/security/index.ts
301
- var SecureApp = class {
302
- static headers = secureHeaders;
303
- static cors = secureCors;
304
- static rateLimit = secureRateLimit;
305
- static bodyLimit = secureBodyLimit;
306
- static methodGuard = secureMethodGuard;
307
- };
308
-
309
- // source/sdk/utilities/artifacts.util.ts
310
- import path2 from "path";
311
- import fs2 from "fs";
312
- import { LBadge as LBadge2, Logger as Logger4 } from "@protorians/logger";
313
-
314
- // source/sdk/artifacts.ts
315
- import path from "path";
316
- import fs from "fs";
317
- import { Logger as Logger3 } from "@protorians/logger";
318
- var ArtifactFactory = class {
319
- static stack = /* @__PURE__ */ new Map();
320
- static getSource(key) {
321
- return path.join(
322
- RaitonDirectories.artifacts(Raiton.thread.builder.workdir),
323
- `${key}.json`
324
- );
325
- }
326
- static add(key, file) {
327
- if (!this.stack.has(key)) this.stack.set(key, /* @__PURE__ */ new Set());
328
- this.stack.get(key)?.add(file);
329
- }
330
- static get(key) {
331
- return this.stack.get(key);
332
- }
333
- static has(key) {
334
- return this.stack.has(key);
335
- }
336
- static load(key) {
337
- const outputFile = this.getSource(key);
338
- if (!fs.existsSync(outputFile)) return this;
339
- const content = fs.readFileSync(outputFile, "utf-8");
340
- const files = JSON.parse(content);
341
- files.forEach((file) => this.add(key, file));
342
- return this;
343
- }
344
- static save(key) {
345
- try {
346
- const set = this.stack.get(key);
347
- if (!set) return;
348
- const content = JSON.stringify([...set.values()]);
349
- const outputFile = this.getSource(key);
350
- const dir = path.dirname(outputFile);
351
- if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
352
- fs.writeFileSync(outputFile, content, "utf-8");
353
- return true;
354
- } catch (e) {
355
- Logger3.error(`Failed to save artifacts for key ${key}:`, e);
356
- return false;
357
- }
358
- }
359
- };
360
-
361
- // source/sdk/utilities/artifacts.util.ts
362
- function generateArtifacts(artifact, interfaceName, decoratorSyntax, verbose = false) {
363
- const artifacts = RaitonDirectories.artifacts(Raiton.thread.builder.workdir);
364
- const dir = Raiton.thread.builder.source;
365
- const outputFile = path2.join(artifacts, `${artifact}.d.ts`);
366
- if (!dir) return;
367
- const files = fs2.readdirSync(dir, { recursive: true }).filter((f) => [`.ts`, `.js`, `.mjs`, `.cjs`].some((ext) => f.toString().endsWith(ext))).map((f) => f.toString());
368
- let mappings = "";
369
- for (const file of files) {
370
- const filename = path2.join(dir, file);
371
- const content2 = fs2.readFileSync(filename, "utf-8");
372
- const match = content2.match(decoratorSyntax);
373
- if (!match) continue;
374
- let name = match[3] || match[1] || "";
375
- if (!name) {
376
- const classMatch = content2.match(/export\s+default\s+class\s+([A-Za-z0-9_]+)/);
377
- name = classMatch?.[1] || path2.parse(filename).name;
378
- }
379
- mappings += ` ${name}: InstanceType<typeof import("@/${file}").default>;
380
- `;
381
- if (verbose) Logger4.info(LBadge2.debug(name), `artifact detected`);
382
- ArtifactFactory.add(artifact, {
383
- file,
384
- dir,
385
- relative: file,
386
- absolute: filename
387
- });
388
- }
389
- const content = `// AUTO-GENERATED FILE \u2014 DO NOT EDIT MANUALLY
390
- declare global {
391
- interface ${interfaceName} {
392
- ${mappings} }
393
- }
394
- export {};`;
395
- fs2.writeFileSync(outputFile, content, "utf-8");
396
- if (!ArtifactFactory.save(artifact)) Logger4.error(`Failed to save artifacts for ${artifact}`);
397
- }
398
-
399
- // source/core/builder.ts
400
- var sleep = ProcessUtility2.sleep;
401
- var RaitonBuilder = class {
402
- // signal: ISignalStack<ServerSignalMap> = new Signal.Stack()
403
- constructor(workdir, options = {}) {
404
- this.workdir = workdir;
405
- this.options = options;
406
- }
407
- _context = null;
408
- _source = null;
409
- _out = null;
410
- _bootstrapper = null;
411
- _bootstrapperIndex = null;
412
- config = null;
413
- _compiledVersionNumber = 1;
414
- _importPattern = /from\s+["'](\.\.?\/[^."'][^"']*)["']/g;
415
- hmr = new Hmr();
416
- get context() {
417
- return this._context;
418
- }
419
- get source() {
420
- return this._source;
421
- }
422
- get out() {
423
- return this._out;
424
- }
425
- get bootstrapper() {
426
- return this._bootstrapper;
427
- }
428
- get bootstrapperIndex() {
429
- return this._bootstrapperIndex;
430
- }
431
- get baseConfig() {
432
- return {
433
- absWorkingDir: this.workdir,
434
- // write: false,
435
- splitting: true,
436
- bundle: false,
437
- // preserveSymlinks: false,
438
- platform: "node",
439
- sourcemap: true,
440
- minify: false,
441
- format: "esm",
442
- target: "node22",
443
- metafile: true,
444
- // bundle: false,
445
- tsconfig: path3.join(this.workdir, "tsconfig.json"),
446
- plugins: [
447
- this.watcher()
448
- ]
449
- };
450
- }
451
- generateUniqueModuleUrl(filename) {
452
- return `${filename}?t=${Date.now()}&v=${this._compiledVersionNumber}&r=${Math.random()}&hmr=1&${Math.random()}`;
453
- }
454
- async refreshFileCached(filename) {
455
- try {
456
- const url = this.generateUniqueModuleUrl(filename);
457
- const mod = await import(url);
458
- if (!mod) throw new Throwable("Module is invalid");
459
- return mod;
460
- } catch (er) {
461
- Logger5.error("Failed to refresh file", filename, er);
462
- return null;
463
- }
464
- }
465
- async fixImports(pathname) {
466
- if (!pathname.endsWith(".js")) return;
467
- let code = await fs3.promises.readFile(pathname, "utf8");
468
- const match = this._importPattern.test(code);
469
- if (!match) return;
470
- this._importPattern.lastIndex = 0;
471
- const updated = code.replace(this._importPattern, (match2, detected) => {
472
- return match2.replace(detected, detected + ".js");
473
- });
474
- return await fs3.promises.writeFile(pathname, updated);
475
- }
476
- watcher() {
477
- const temporary = /* @__PURE__ */ new Map();
478
- const this_ = this;
479
- const importPattern = /from\s+["'](\.\.?\/[^."'][^"']*)["']/g;
480
- const updateVersionNumber = () => this._compiledVersionNumber++;
481
- const getVersionNumber = () => this._compiledVersionNumber;
482
- let hmrMoment = false;
483
- return {
484
- name: `${Raiton.identifier}-build-plugin`,
485
- setup(build2) {
486
- build2.onEnd(async (result) => {
487
- if (result.errors.length) Logger5.error("Errors:\n\u2014", result.errors.join("\n\u2014"));
488
- if (result.warnings.length) Logger5.error("Warnings:\n\u2014", result.warnings.join("\n\u2014"));
489
- if (result.metafile) {
490
- const outputs = Object.keys(result.metafile.outputs);
491
- for (const key of outputs) {
492
- const filename = path3.resolve(key);
493
- await this_.fixImports(filename);
494
- if (isControllerFile(filename)) {
495
- Raiton.signals.dispatch("hmr:controller", {
496
- filename,
497
- timestamp: Date.now(),
498
- version: getVersionNumber()
499
- });
500
- }
501
- }
502
- }
503
- if (hmrMoment) {
504
- updateVersionNumber();
505
- }
506
- hmrMoment = true;
507
- });
508
- }
509
- };
510
- }
511
- async developmentBuild(callable) {
512
- if (!this._context)
513
- throw new Error("Builder not prepared");
514
- this.context?.watch().then(async () => {
515
- await sleep(60);
516
- await until(() => this._bootstrapper ? fs3.existsSync(this._bootstrapper) : false);
517
- callable?.(this);
518
- Raiton.signals.listen(
519
- "hmr:controller",
520
- async ({ filename, version, timestamp }) => await ControllerBuilder.build({ filename, version, timestamp })
521
- );
522
- }).catch((err) => Logger5.error("Stack:\n", err));
523
- return this;
524
- }
525
- async productionBuild(callable) {
526
- if (!this.config)
527
- throw new Error("Builder not prepared");
528
- await build(this.config);
529
- callable?.(this);
530
- return this;
531
- }
532
- async prepare() {
533
- this._source = path3.resolve(this.workdir, RaitonConfig.get("rootDir"));
534
- this._out = path3.resolve(this.workdir, RaitonDirectories.server(this.workdir));
535
- if (!fs3.existsSync(this._source))
536
- throw new Error(`Source directory "${this._source}" does not exists`);
537
- if (!fs3.existsSync(this._out))
538
- fs3.mkdirSync(this._out, { recursive: true });
539
- this._bootstrapper = path3.join(this._out, RaitonDirectories.bootstrapFile);
540
- this._bootstrapperIndex = path3.join(RaitonDirectories.server("./"), RaitonDirectories.bootstrapFile);
541
- this.config = {
542
- ...this.baseConfig,
543
- entryPoints: [`${RaitonConfig.get("rootDir")}/**/*.ts`],
544
- outdir: RaitonDirectories.server("./")
545
- };
546
- if (this.options.development) {
547
- this._context = await context(this.config);
548
- }
549
- if (!this.options.development) {
550
- }
551
- return this;
552
- }
553
- async boot() {
554
- if (!this.bootstrapper) throw new Error("Bootstrapper not found");
555
- if (!fs3.existsSync(this.bootstrapper))
556
- throw new Error(`Bootstrapper file "${this.bootstrapper}" does not exists`);
557
- const bootstrapper = await import(this.bootstrapper);
558
- if (!("default" in bootstrapper))
559
- throw new Error('Bootstrapper not supported! Please export to "default"');
560
- Raiton.thread = new RaitonThread(this, {});
561
- return bootstrapper.default(Raiton.thread);
562
- }
563
- async start(callable) {
564
- return this.options.development ? await this.developmentBuild(callable) : await this.productionBuild(callable);
565
- }
566
- };
567
-
568
- // source/core/controller/compiler.ts
569
- function compileController(ControllerClass, app) {
570
- const instance = new ControllerClass();
571
- const metadata = getControllerMetadata(ControllerClass.prototype);
572
- for (const meta of metadata.routes) {
573
- app.route(
574
- meta.method,
575
- `${metadata.prefix ?? ""}${meta.path}`,
576
- createHandler(instance, meta)
577
- );
578
- }
579
- return instance;
580
- }
581
-
582
- // source/core/controller/builder.ts
583
- import fs4 from "fs";
584
- import { LBadge as LBadge3, Logger as Logger6 } from "@protorians/logger";
585
- import path4 from "path";
586
- var ControllerBuilder = class {
587
- static async scan(workdir) {
588
- const files = fs4.readdirSync(workdir, { recursive: true }).map((file) => file.toString());
589
- const output = [];
590
- for (const file of files)
591
- output.push(await this.build({ filename: path4.join(workdir, file), version: 1, timestamp: Date.now() }));
592
- return output.filter((f) => typeof f !== "undefined");
593
- }
594
- static async build({ filename, version, timestamp }) {
595
- if (!isControllerFile(filename))
596
- return void 0;
597
- const imported = await import(`${filename}?v=${version || 1}&t=${timestamp || Date.now()}`);
598
- const controller = imported.default || imported || void 0;
599
- if (!controller) return void 0;
600
- if (!RaitonThread.current.application) return void 0;
601
- Logger6.log(LBadge3.info("Controller"), controller.name);
602
- return compileController(controller, RaitonThread.current.application);
603
- }
604
- };
605
-
606
- // source/sdk/decorators/controllable.ts
607
- function Controllable(prefix = "") {
608
- return (target) => {
609
- const meta = getControllerMetadata(target.prototype || target);
610
- meta.prefix = prefix;
611
- };
612
- }
613
-
614
- export {
615
- Controllable,
616
- Get,
617
- Post,
618
- Put,
619
- Patch,
620
- Options,
621
- Trace,
622
- Delete,
623
- Head,
624
- Query,
625
- Param,
626
- Body,
627
- UploadedFile,
628
- Headers,
629
- Req,
630
- Reply,
631
- PluginScope,
632
- secureHeaders,
633
- secureCors,
634
- secureRateLimit,
635
- secureBodyLimit,
636
- secureMethodGuard,
637
- SecureApp,
638
- ArtifactFactory,
639
- generateArtifacts,
640
- createHandler,
641
- compileController,
642
- ControllerBuilder,
643
- RaitonThread,
644
- RaitonBuilder
645
- };
@@ -1,27 +0,0 @@
1
- // source/sdk/utilities/utilities.util.ts
2
- function getType(value) {
3
- if (typeof value === "string") return "string";
4
- if (typeof value === "boolean") return "boolean";
5
- if (typeof value === "bigint") return "bigInt";
6
- if (typeof value === "number") {
7
- if (Number.isInteger(value)) return "int";
8
- return "float";
9
- }
10
- return typeof value;
11
- }
12
- function stabilizeJson(json) {
13
- if (!json) return {};
14
- switch (typeof json) {
15
- case "string":
16
- return JSON.parse(json);
17
- case "object":
18
- return json;
19
- default:
20
- throw new Error("Invalid JSON format");
21
- }
22
- }
23
-
24
- export {
25
- getType,
26
- stabilizeJson
27
- };
@@ -1,12 +0,0 @@
1
- // source/sdk/utilities/json.util.ts
2
- function tryParseJson(obj) {
3
- try {
4
- return JSON.parse(obj);
5
- } catch (e) {
6
- return null;
7
- }
8
- }
9
-
10
- export {
11
- tryParseJson
12
- };
@@ -1,27 +0,0 @@
1
- // source/core/hooks.ts
2
- var HookStore = class _HookStore {
3
- hooks = /* @__PURE__ */ new Map();
4
- add(name, handler) {
5
- const list = this.hooks.get(name) ?? [];
6
- list.push(handler);
7
- this.hooks.set(name, list);
8
- }
9
- async run(name, ctx) {
10
- const list = this.hooks.get(name);
11
- if (!list) return;
12
- for (const hook of list) {
13
- await hook(ctx);
14
- }
15
- }
16
- clone() {
17
- const store = new _HookStore();
18
- for (const [key, value] of this.hooks) {
19
- store.hooks.set(key, [...value]);
20
- }
21
- return store;
22
- }
23
- };
24
-
25
- export {
26
- HookStore
27
- };