@adaas/a-server 0.0.22 → 0.0.23

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 (516) hide show
  1. package/.conf/tsconfig.base.json +79 -0
  2. package/.conf/tsconfig.browser.json +32 -0
  3. package/.conf/tsconfig.node.json +33 -0
  4. package/LICENSE +10 -19
  5. package/dist/browser/index.d.mts +1669 -0
  6. package/dist/browser/index.mjs +2869 -0
  7. package/dist/browser/index.mjs.map +1 -0
  8. package/dist/node/A-Request.entity-8_9MCXT2.d.ts +533 -0
  9. package/dist/node/A-Request.entity-r905O60G.d.mts +533 -0
  10. package/dist/node/A-Response.entity-BVYAc6-8.d.mts +318 -0
  11. package/dist/node/A-Response.entity-CRc-t-vr.d.ts +318 -0
  12. package/dist/node/channels/A-Http/A-Http.channel.constants.d.mts +9 -0
  13. package/dist/node/channels/A-Http/A-Http.channel.constants.d.ts +9 -0
  14. package/dist/node/channels/A-Http/A-Http.channel.constants.js +13 -0
  15. package/dist/node/channels/A-Http/A-Http.channel.constants.js.map +1 -0
  16. package/dist/node/channels/A-Http/A-Http.channel.constants.mjs +12 -0
  17. package/dist/node/channels/A-Http/A-Http.channel.constants.mjs.map +1 -0
  18. package/dist/node/channels/A-Http/A-Http.channel.d.mts +23 -0
  19. package/dist/node/channels/A-Http/A-Http.channel.d.ts +23 -0
  20. package/dist/node/channels/A-Http/A-Http.channel.error.d.mts +7 -0
  21. package/dist/node/channels/A-Http/A-Http.channel.error.d.ts +7 -0
  22. package/dist/node/channels/A-Http/A-Http.channel.error.js +11 -0
  23. package/dist/node/channels/A-Http/A-Http.channel.error.js.map +1 -0
  24. package/dist/node/channels/A-Http/A-Http.channel.error.mjs +10 -0
  25. package/dist/node/channels/A-Http/A-Http.channel.error.mjs.map +1 -0
  26. package/dist/node/channels/A-Http/A-Http.channel.js +122 -0
  27. package/dist/node/channels/A-Http/A-Http.channel.js.map +1 -0
  28. package/dist/node/channels/A-Http/A-Http.channel.mjs +110 -0
  29. package/dist/node/channels/A-Http/A-Http.channel.mjs.map +1 -0
  30. package/dist/node/channels/A-Http/A-Http.channel.types.d.mts +67 -0
  31. package/dist/node/channels/A-Http/A-Http.channel.types.d.ts +67 -0
  32. package/dist/node/channels/A-Http/A-Http.channel.types.js +4 -0
  33. package/dist/node/channels/A-Http/A-Http.channel.types.js.map +1 -0
  34. package/dist/node/channels/A-Http/A-Http.channel.types.mjs +3 -0
  35. package/dist/node/channels/A-Http/A-Http.channel.types.mjs.map +1 -0
  36. package/dist/node/channels/A-Websockets/A-Websockets.channel.d.mts +7 -0
  37. package/dist/node/channels/A-Websockets/A-Websockets.channel.d.ts +7 -0
  38. package/dist/node/channels/A-Websockets/A-Websockets.channel.js +13 -0
  39. package/dist/node/channels/A-Websockets/A-Websockets.channel.js.map +1 -0
  40. package/dist/node/channels/A-Websockets/A-Websockets.channel.mjs +12 -0
  41. package/dist/node/channels/A-Websockets/A-Websockets.channel.mjs.map +1 -0
  42. package/dist/node/chunk-EQQGB2QZ.mjs +15 -0
  43. package/dist/node/chunk-EQQGB2QZ.mjs.map +1 -0
  44. package/dist/node/constants/env.constants.d.mts +12 -0
  45. package/dist/node/constants/env.constants.d.ts +12 -0
  46. package/dist/node/constants/env.constants.js +23 -0
  47. package/dist/node/constants/env.constants.js.map +1 -0
  48. package/dist/node/constants/env.constants.mjs +22 -0
  49. package/dist/node/constants/env.constants.mjs.map +1 -0
  50. package/dist/node/controllers/A-CommandController/A-CommandController.component.d.mts +29 -0
  51. package/dist/node/controllers/A-CommandController/A-CommandController.component.d.ts +29 -0
  52. package/dist/node/controllers/A-CommandController/A-CommandController.component.js +55 -0
  53. package/dist/node/controllers/A-CommandController/A-CommandController.component.js.map +1 -0
  54. package/dist/node/controllers/A-CommandController/A-CommandController.component.mjs +43 -0
  55. package/dist/node/controllers/A-CommandController/A-CommandController.component.mjs.map +1 -0
  56. package/dist/node/controllers/A-EntityController/A-EntityController.component.d.mts +44 -0
  57. package/dist/node/controllers/A-EntityController/A-EntityController.component.d.ts +44 -0
  58. package/dist/node/controllers/A-EntityController/A-EntityController.component.js +189 -0
  59. package/dist/node/controllers/A-EntityController/A-EntityController.component.js.map +1 -0
  60. package/dist/node/controllers/A-EntityController/A-EntityController.component.mjs +177 -0
  61. package/dist/node/controllers/A-EntityController/A-EntityController.component.mjs.map +1 -0
  62. package/dist/node/controllers/A-EntityController/A-EntityController.component.types.d.mts +2 -0
  63. package/dist/node/controllers/A-EntityController/A-EntityController.component.types.d.ts +2 -0
  64. package/dist/node/controllers/A-EntityController/A-EntityController.component.types.js +4 -0
  65. package/dist/node/controllers/A-EntityController/A-EntityController.component.types.js.map +1 -0
  66. package/dist/node/controllers/A-EntityController/A-EntityController.component.types.mjs +3 -0
  67. package/dist/node/controllers/A-EntityController/A-EntityController.component.types.mjs.map +1 -0
  68. package/dist/node/controllers/A-ListingController/A-ListingController.component.d.mts +28 -0
  69. package/dist/node/controllers/A-ListingController/A-ListingController.component.d.ts +28 -0
  70. package/dist/node/controllers/A-ListingController/A-ListingController.component.js +59 -0
  71. package/dist/node/controllers/A-ListingController/A-ListingController.component.js.map +1 -0
  72. package/dist/node/controllers/A-ListingController/A-ListingController.component.mjs +47 -0
  73. package/dist/node/controllers/A-ListingController/A-ListingController.component.mjs.map +1 -0
  74. package/dist/node/controllers/A-ListingController/A-ListingController.types.d.mts +2 -0
  75. package/dist/node/controllers/A-ListingController/A-ListingController.types.d.ts +2 -0
  76. package/dist/node/controllers/A-ListingController/A-ListingController.types.js +4 -0
  77. package/dist/node/controllers/A-ListingController/A-ListingController.types.js.map +1 -0
  78. package/dist/node/controllers/A-ListingController/A-ListingController.types.mjs +3 -0
  79. package/dist/node/controllers/A-ListingController/A-ListingController.types.mjs.map +1 -0
  80. package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.component.d.mts +30 -0
  81. package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.component.d.ts +30 -0
  82. package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.component.js +46 -0
  83. package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.component.js.map +1 -0
  84. package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.component.mjs +34 -0
  85. package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.component.mjs.map +1 -0
  86. package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.types.d.mts +2 -0
  87. package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.types.d.ts +2 -0
  88. package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.types.js +4 -0
  89. package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.types.js.map +1 -0
  90. package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.types.mjs +3 -0
  91. package/dist/node/controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.types.mjs.map +1 -0
  92. package/dist/node/index.d.mts +51 -0
  93. package/dist/node/index.d.ts +51 -0
  94. package/dist/node/index.js +320 -0
  95. package/dist/node/index.js.map +1 -0
  96. package/dist/node/index.mjs +48 -0
  97. package/dist/node/index.mjs.map +1 -0
  98. package/dist/node/lib/A-Request/A-HttpRequestData.context.d.mts +12 -0
  99. package/dist/node/lib/A-Request/A-HttpRequestData.context.d.ts +12 -0
  100. package/dist/node/lib/A-Request/A-HttpRequestData.context.js +25 -0
  101. package/dist/node/lib/A-Request/A-HttpRequestData.context.js.map +1 -0
  102. package/dist/node/lib/A-Request/A-HttpRequestData.context.mjs +24 -0
  103. package/dist/node/lib/A-Request/A-HttpRequestData.context.mjs.map +1 -0
  104. package/dist/node/lib/A-Request/A-HttpServerRequest.context.d.mts +39 -0
  105. package/dist/node/lib/A-Request/A-HttpServerRequest.context.d.ts +39 -0
  106. package/dist/node/lib/A-Request/A-HttpServerRequest.context.js +56 -0
  107. package/dist/node/lib/A-Request/A-HttpServerRequest.context.js.map +1 -0
  108. package/dist/node/lib/A-Request/A-HttpServerRequest.context.mjs +55 -0
  109. package/dist/node/lib/A-Request/A-HttpServerRequest.context.mjs.map +1 -0
  110. package/dist/node/lib/A-Request/A-Request.constants.d.mts +18 -0
  111. package/dist/node/lib/A-Request/A-Request.constants.d.ts +18 -0
  112. package/dist/node/lib/A-Request/A-Request.constants.js +22 -0
  113. package/dist/node/lib/A-Request/A-Request.constants.js.map +1 -0
  114. package/dist/node/lib/A-Request/A-Request.constants.mjs +22 -0
  115. package/dist/node/lib/A-Request/A-Request.constants.mjs.map +1 -0
  116. package/dist/node/lib/A-Request/A-Request.entity.d.mts +17 -0
  117. package/dist/node/lib/A-Request/A-Request.entity.d.ts +17 -0
  118. package/dist/node/lib/A-Request/A-Request.entity.js +651 -0
  119. package/dist/node/lib/A-Request/A-Request.entity.js.map +1 -0
  120. package/dist/node/lib/A-Request/A-Request.entity.mjs +639 -0
  121. package/dist/node/lib/A-Request/A-Request.entity.mjs.map +1 -0
  122. package/dist/node/lib/A-Request/A-Request.env.d.mts +37 -0
  123. package/dist/node/lib/A-Request/A-Request.env.d.ts +37 -0
  124. package/dist/node/lib/A-Request/A-Request.env.js +39 -0
  125. package/dist/node/lib/A-Request/A-Request.env.js.map +1 -0
  126. package/dist/node/lib/A-Request/A-Request.env.mjs +38 -0
  127. package/dist/node/lib/A-Request/A-Request.env.mjs.map +1 -0
  128. package/dist/node/lib/A-Request/A-Request.error.d.mts +11 -0
  129. package/dist/node/lib/A-Request/A-Request.error.d.ts +11 -0
  130. package/dist/node/lib/A-Request/A-Request.error.js +15 -0
  131. package/dist/node/lib/A-Request/A-Request.error.js.map +1 -0
  132. package/dist/node/lib/A-Request/A-Request.error.mjs +14 -0
  133. package/dist/node/lib/A-Request/A-Request.error.mjs.map +1 -0
  134. package/dist/node/lib/A-Request/A-Request.helper.d.mts +105 -0
  135. package/dist/node/lib/A-Request/A-Request.helper.d.ts +105 -0
  136. package/dist/node/lib/A-Request/A-Request.helper.js +181 -0
  137. package/dist/node/lib/A-Request/A-Request.helper.js.map +1 -0
  138. package/dist/node/lib/A-Request/A-Request.helper.mjs +180 -0
  139. package/dist/node/lib/A-Request/A-Request.helper.mjs.map +1 -0
  140. package/dist/node/lib/A-Request/A-Request.types.d.mts +17 -0
  141. package/dist/node/lib/A-Request/A-Request.types.d.ts +17 -0
  142. package/dist/node/lib/A-Request/A-Request.types.js +14 -0
  143. package/dist/node/lib/A-Request/A-Request.types.js.map +1 -0
  144. package/dist/node/lib/A-Request/A-Request.types.mjs +14 -0
  145. package/dist/node/lib/A-Request/A-Request.types.mjs.map +1 -0
  146. package/dist/node/lib/A-Response/A-Response.constants.d.mts +24 -0
  147. package/dist/node/lib/A-Response/A-Response.constants.d.ts +24 -0
  148. package/dist/node/lib/A-Response/A-Response.constants.js +28 -0
  149. package/dist/node/lib/A-Response/A-Response.constants.js.map +1 -0
  150. package/dist/node/lib/A-Response/A-Response.constants.mjs +28 -0
  151. package/dist/node/lib/A-Response/A-Response.constants.mjs.map +1 -0
  152. package/dist/node/lib/A-Response/A-Response.entity.d.mts +20 -0
  153. package/dist/node/lib/A-Response/A-Response.entity.d.ts +20 -0
  154. package/dist/node/lib/A-Response/A-Response.entity.js +544 -0
  155. package/dist/node/lib/A-Response/A-Response.entity.js.map +1 -0
  156. package/dist/node/lib/A-Response/A-Response.entity.mjs +532 -0
  157. package/dist/node/lib/A-Response/A-Response.entity.mjs.map +1 -0
  158. package/dist/node/lib/A-Response/A-Response.env.d.mts +2 -0
  159. package/dist/node/lib/A-Response/A-Response.env.d.ts +2 -0
  160. package/dist/node/lib/A-Response/A-Response.env.js +4 -0
  161. package/dist/node/lib/A-Response/A-Response.env.js.map +1 -0
  162. package/dist/node/lib/A-Response/A-Response.env.mjs +3 -0
  163. package/dist/node/lib/A-Response/A-Response.env.mjs.map +1 -0
  164. package/dist/node/lib/A-Response/A-Response.error.d.mts +6 -0
  165. package/dist/node/lib/A-Response/A-Response.error.d.ts +6 -0
  166. package/dist/node/lib/A-Response/A-Response.error.js +10 -0
  167. package/dist/node/lib/A-Response/A-Response.error.js.map +1 -0
  168. package/dist/node/lib/A-Response/A-Response.error.mjs +9 -0
  169. package/dist/node/lib/A-Response/A-Response.error.mjs.map +1 -0
  170. package/dist/node/lib/A-Response/A-Response.types.d.mts +20 -0
  171. package/dist/node/lib/A-Response/A-Response.types.d.ts +20 -0
  172. package/dist/node/lib/A-Response/A-Response.types.js +4 -0
  173. package/dist/node/lib/A-Response/A-Response.types.js.map +1 -0
  174. package/dist/node/lib/A-Response/A-Response.types.mjs +3 -0
  175. package/dist/node/lib/A-Response/A-Response.types.mjs.map +1 -0
  176. package/dist/node/lib/A-Server/A-HttpServer.constants.d.mts +7 -0
  177. package/dist/node/lib/A-Server/A-HttpServer.constants.d.ts +7 -0
  178. package/dist/node/lib/A-Server/A-HttpServer.constants.js +11 -0
  179. package/dist/node/lib/A-Server/A-HttpServer.constants.js.map +1 -0
  180. package/dist/node/lib/A-Server/A-HttpServer.constants.mjs +11 -0
  181. package/dist/node/lib/A-Server/A-HttpServer.constants.mjs.map +1 -0
  182. package/dist/node/lib/A-Server/A-HttpServer.container.d.mts +50 -0
  183. package/dist/node/lib/A-Server/A-HttpServer.container.d.ts +50 -0
  184. package/dist/node/lib/A-Server/A-HttpServer.container.js +194 -0
  185. package/dist/node/lib/A-Server/A-HttpServer.container.js.map +1 -0
  186. package/dist/node/lib/A-Server/A-HttpServer.container.mjs +182 -0
  187. package/dist/node/lib/A-Server/A-HttpServer.container.mjs.map +1 -0
  188. package/dist/node/lib/A-Server/A-HttpServer.error.d.mts +54 -0
  189. package/dist/node/lib/A-Server/A-HttpServer.error.d.ts +54 -0
  190. package/dist/node/lib/A-Server/A-HttpServer.error.js +118 -0
  191. package/dist/node/lib/A-Server/A-HttpServer.error.js.map +1 -0
  192. package/dist/node/lib/A-Server/A-HttpServer.error.mjs +117 -0
  193. package/dist/node/lib/A-Server/A-HttpServer.error.mjs.map +1 -0
  194. package/dist/node/lib/A-Server/A-HttpServer.types.d.mts +19 -0
  195. package/dist/node/lib/A-Server/A-HttpServer.types.d.ts +19 -0
  196. package/dist/node/lib/A-Server/A-HttpServer.types.js +4 -0
  197. package/dist/node/lib/A-Server/A-HttpServer.types.js.map +1 -0
  198. package/dist/node/lib/A-Server/A-HttpServer.types.mjs +3 -0
  199. package/dist/node/lib/A-Server/A-HttpServer.types.mjs.map +1 -0
  200. package/dist/node/lib/A-Server/A-Server.context.d.mts +22 -0
  201. package/dist/node/lib/A-Server/A-Server.context.d.ts +22 -0
  202. package/dist/node/lib/A-Server/A-Server.context.js +24 -0
  203. package/dist/node/lib/A-Server/A-Server.context.js.map +1 -0
  204. package/dist/node/lib/A-Server/A-Server.context.mjs +23 -0
  205. package/dist/node/lib/A-Server/A-Server.context.mjs.map +1 -0
  206. package/dist/node/lib/A-Server/A-Server.error.d.mts +14 -0
  207. package/dist/node/lib/A-Server/A-Server.error.d.ts +14 -0
  208. package/dist/node/lib/A-Server/A-Server.error.js +26 -0
  209. package/dist/node/lib/A-Server/A-Server.error.js.map +1 -0
  210. package/dist/node/lib/A-Server/A-Server.error.mjs +25 -0
  211. package/dist/node/lib/A-Server/A-Server.error.mjs.map +1 -0
  212. package/dist/node/lib/A-Server/A-Server.types.d.mts +26 -0
  213. package/dist/node/lib/A-Server/A-Server.types.d.ts +26 -0
  214. package/dist/node/lib/A-Server/A-Server.types.js +4 -0
  215. package/dist/node/lib/A-Server/A-Server.types.js.map +1 -0
  216. package/dist/node/lib/A-Server/A-Server.types.mjs +3 -0
  217. package/dist/node/lib/A-Server/A-Server.types.mjs.map +1 -0
  218. package/dist/node/lib/A-ServerController/A-ServerController.component.d.mts +29 -0
  219. package/dist/node/lib/A-ServerController/A-ServerController.component.d.ts +29 -0
  220. package/dist/node/lib/A-ServerController/A-ServerController.component.js +49 -0
  221. package/dist/node/lib/A-ServerController/A-ServerController.component.js.map +1 -0
  222. package/dist/node/lib/A-ServerController/A-ServerController.component.mjs +37 -0
  223. package/dist/node/lib/A-ServerController/A-ServerController.component.mjs.map +1 -0
  224. package/dist/node/lib/A-ServerController/A-ServerController.types.d.mts +2 -0
  225. package/dist/node/lib/A-ServerController/A-ServerController.types.d.ts +2 -0
  226. package/dist/node/lib/A-ServerController/A-ServerController.types.js +4 -0
  227. package/dist/node/lib/A-ServerController/A-ServerController.types.js.map +1 -0
  228. package/dist/node/lib/A-ServerController/A-ServerController.types.mjs +3 -0
  229. package/dist/node/lib/A-ServerController/A-ServerController.types.mjs.map +1 -0
  230. package/dist/node/lib/A-ServerEntityList/A-EntityList.entity.d.mts +49 -0
  231. package/dist/node/lib/A-ServerEntityList/A-EntityList.entity.d.ts +49 -0
  232. package/dist/node/lib/A-ServerEntityList/A-EntityList.entity.js +91 -0
  233. package/dist/node/lib/A-ServerEntityList/A-EntityList.entity.js.map +1 -0
  234. package/dist/node/lib/A-ServerEntityList/A-EntityList.entity.mjs +90 -0
  235. package/dist/node/lib/A-ServerEntityList/A-EntityList.entity.mjs.map +1 -0
  236. package/dist/node/lib/A-ServerEntityList/A-EntityList.types.d.mts +22 -0
  237. package/dist/node/lib/A-ServerEntityList/A-EntityList.types.d.ts +22 -0
  238. package/dist/node/lib/A-ServerEntityList/A-EntityList.types.js +10 -0
  239. package/dist/node/lib/A-ServerEntityList/A-EntityList.types.js.map +1 -0
  240. package/dist/node/lib/A-ServerEntityList/A-EntityList.types.mjs +10 -0
  241. package/dist/node/lib/A-ServerEntityList/A-EntityList.types.mjs.map +1 -0
  242. package/dist/node/lib/A-ServerListQuery/A-ServerListQueryFilter.context.d.mts +13 -0
  243. package/dist/node/lib/A-ServerListQuery/A-ServerListQueryFilter.context.d.ts +13 -0
  244. package/dist/node/lib/A-ServerListQuery/A-ServerListQueryFilter.context.js +32 -0
  245. package/dist/node/lib/A-ServerListQuery/A-ServerListQueryFilter.context.js.map +1 -0
  246. package/dist/node/lib/A-ServerListQuery/A-ServerListQueryFilter.context.mjs +31 -0
  247. package/dist/node/lib/A-ServerListQuery/A-ServerListQueryFilter.context.mjs.map +1 -0
  248. package/dist/node/lib/A-ServerLogger/A-ServerLogger.component.d.mts +48 -0
  249. package/dist/node/lib/A-ServerLogger/A-ServerLogger.component.d.ts +48 -0
  250. package/dist/node/lib/A-ServerLogger/A-ServerLogger.component.js +88 -0
  251. package/dist/node/lib/A-ServerLogger/A-ServerLogger.component.js.map +1 -0
  252. package/dist/node/lib/A-ServerLogger/A-ServerLogger.component.mjs +76 -0
  253. package/dist/node/lib/A-ServerLogger/A-ServerLogger.component.mjs.map +1 -0
  254. package/dist/node/lib/A-ServerLogger/A-ServerLogger.constants.d.mts +24 -0
  255. package/dist/node/lib/A-ServerLogger/A-ServerLogger.constants.d.ts +24 -0
  256. package/dist/node/lib/A-ServerLogger/A-ServerLogger.constants.js +33 -0
  257. package/dist/node/lib/A-ServerLogger/A-ServerLogger.constants.js.map +1 -0
  258. package/dist/node/lib/A-ServerLogger/A-ServerLogger.constants.mjs +33 -0
  259. package/dist/node/lib/A-ServerLogger/A-ServerLogger.constants.mjs.map +1 -0
  260. package/dist/node/lib/A-ServerLogger/A-ServerLogger.types.d.mts +12 -0
  261. package/dist/node/lib/A-ServerLogger/A-ServerLogger.types.d.ts +12 -0
  262. package/dist/node/lib/A-ServerLogger/A-ServerLogger.types.js +4 -0
  263. package/dist/node/lib/A-ServerLogger/A-ServerLogger.types.js.map +1 -0
  264. package/dist/node/lib/A-ServerLogger/A-ServerLogger.types.mjs +3 -0
  265. package/dist/node/lib/A-ServerLogger/A-ServerLogger.types.mjs.map +1 -0
  266. package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.component.d.mts +6 -0
  267. package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.component.d.ts +6 -0
  268. package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.component.js +18 -0
  269. package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.component.js.map +1 -0
  270. package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.component.mjs +17 -0
  271. package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.component.mjs.map +1 -0
  272. package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.constants.d.mts +2 -0
  273. package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.constants.d.ts +2 -0
  274. package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.constants.js +4 -0
  275. package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.constants.js.map +1 -0
  276. package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.constants.mjs +3 -0
  277. package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.constants.mjs.map +1 -0
  278. package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.types.d.mts +2 -0
  279. package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.types.d.ts +2 -0
  280. package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.types.js +4 -0
  281. package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.types.js.map +1 -0
  282. package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.types.mjs +3 -0
  283. package/dist/node/lib/A-ServerMiddleware/A-ServerMiddleware.types.mjs.map +1 -0
  284. package/dist/node/lib/A-ServerProxy/A-ServerProxy.component.d.mts +31 -0
  285. package/dist/node/lib/A-ServerProxy/A-ServerProxy.component.d.ts +31 -0
  286. package/dist/node/lib/A-ServerProxy/A-ServerProxy.component.js +90 -0
  287. package/dist/node/lib/A-ServerProxy/A-ServerProxy.component.js.map +1 -0
  288. package/dist/node/lib/A-ServerProxy/A-ServerProxy.component.mjs +78 -0
  289. package/dist/node/lib/A-ServerProxy/A-ServerProxy.component.mjs.map +1 -0
  290. package/dist/node/lib/A-ServerProxy/A-ServerProxy.constants.d.mts +9 -0
  291. package/dist/node/lib/A-ServerProxy/A-ServerProxy.constants.d.ts +9 -0
  292. package/dist/node/lib/A-ServerProxy/A-ServerProxy.constants.js +14 -0
  293. package/dist/node/lib/A-ServerProxy/A-ServerProxy.constants.js.map +1 -0
  294. package/dist/node/lib/A-ServerProxy/A-ServerProxy.constants.mjs +14 -0
  295. package/dist/node/lib/A-ServerProxy/A-ServerProxy.constants.mjs.map +1 -0
  296. package/dist/node/lib/A-ServerProxy/A-ServerProxy.context.d.mts +36 -0
  297. package/dist/node/lib/A-ServerProxy/A-ServerProxy.context.d.ts +36 -0
  298. package/dist/node/lib/A-ServerProxy/A-ServerProxy.context.js +60 -0
  299. package/dist/node/lib/A-ServerProxy/A-ServerProxy.context.js.map +1 -0
  300. package/dist/node/lib/A-ServerProxy/A-ServerProxy.context.mjs +59 -0
  301. package/dist/node/lib/A-ServerProxy/A-ServerProxy.context.mjs.map +1 -0
  302. package/dist/node/lib/A-ServerProxy/A-ServerProxy.types.d.mts +23 -0
  303. package/dist/node/lib/A-ServerProxy/A-ServerProxy.types.d.ts +23 -0
  304. package/dist/node/lib/A-ServerProxy/A-ServerProxy.types.js +4 -0
  305. package/dist/node/lib/A-ServerProxy/A-ServerProxy.types.js.map +1 -0
  306. package/dist/node/lib/A-ServerProxy/A-ServerProxy.types.mjs +3 -0
  307. package/dist/node/lib/A-ServerProxy/A-ServerProxy.types.mjs.map +1 -0
  308. package/dist/node/lib/A-ServerRoute/A-ServerRoute.constants.d.mts +20 -0
  309. package/dist/node/lib/A-ServerRoute/A-ServerRoute.constants.d.ts +20 -0
  310. package/dist/node/lib/A-ServerRoute/A-ServerRoute.constants.js +25 -0
  311. package/dist/node/lib/A-ServerRoute/A-ServerRoute.constants.js.map +1 -0
  312. package/dist/node/lib/A-ServerRoute/A-ServerRoute.constants.mjs +24 -0
  313. package/dist/node/lib/A-ServerRoute/A-ServerRoute.constants.mjs.map +1 -0
  314. package/dist/node/lib/A-ServerRoute/A-ServerRoute.entity.d.mts +15 -0
  315. package/dist/node/lib/A-ServerRoute/A-ServerRoute.entity.d.ts +15 -0
  316. package/dist/node/lib/A-ServerRoute/A-ServerRoute.entity.js +24 -0
  317. package/dist/node/lib/A-ServerRoute/A-ServerRoute.entity.js.map +1 -0
  318. package/dist/node/lib/A-ServerRoute/A-ServerRoute.entity.mjs +23 -0
  319. package/dist/node/lib/A-ServerRoute/A-ServerRoute.entity.mjs.map +1 -0
  320. package/dist/node/lib/A-ServerRoute/A-ServerRoute.types.d.mts +6 -0
  321. package/dist/node/lib/A-ServerRoute/A-ServerRoute.types.d.ts +6 -0
  322. package/dist/node/lib/A-ServerRoute/A-ServerRoute.types.js +4 -0
  323. package/dist/node/lib/A-ServerRoute/A-ServerRoute.types.js.map +1 -0
  324. package/dist/node/lib/A-ServerRoute/A-ServerRoute.types.mjs +3 -0
  325. package/dist/node/lib/A-ServerRoute/A-ServerRoute.types.mjs.map +1 -0
  326. package/dist/node/lib/A-ServerRouter/A-ServerRouter.component.d.mts +84 -0
  327. package/dist/node/lib/A-ServerRouter/A-ServerRouter.component.d.ts +84 -0
  328. package/dist/node/lib/A-ServerRouter/A-ServerRouter.component.js +194 -0
  329. package/dist/node/lib/A-ServerRouter/A-ServerRouter.component.js.map +1 -0
  330. package/dist/node/lib/A-ServerRouter/A-ServerRouter.component.mjs +184 -0
  331. package/dist/node/lib/A-ServerRouter/A-ServerRouter.component.mjs.map +1 -0
  332. package/dist/node/lib/A-ServerRouter/A-ServerRouter.constants.d.mts +6 -0
  333. package/dist/node/lib/A-ServerRouter/A-ServerRouter.constants.d.ts +6 -0
  334. package/dist/node/lib/A-ServerRouter/A-ServerRouter.constants.js +10 -0
  335. package/dist/node/lib/A-ServerRouter/A-ServerRouter.constants.js.map +1 -0
  336. package/dist/node/lib/A-ServerRouter/A-ServerRouter.constants.mjs +10 -0
  337. package/dist/node/lib/A-ServerRouter/A-ServerRouter.constants.mjs.map +1 -0
  338. package/dist/node/lib/A-ServerRouter/A-ServerRouter.meta.d.mts +16 -0
  339. package/dist/node/lib/A-ServerRouter/A-ServerRouter.meta.d.ts +16 -0
  340. package/dist/node/lib/A-ServerRouter/A-ServerRouter.meta.js +40 -0
  341. package/dist/node/lib/A-ServerRouter/A-ServerRouter.meta.js.map +1 -0
  342. package/dist/node/lib/A-ServerRouter/A-ServerRouter.meta.mjs +39 -0
  343. package/dist/node/lib/A-ServerRouter/A-ServerRouter.meta.mjs.map +1 -0
  344. package/dist/node/lib/A-ServerRouter/A-ServerRouter.types.d.mts +24 -0
  345. package/dist/node/lib/A-ServerRouter/A-ServerRouter.types.d.ts +24 -0
  346. package/dist/node/lib/A-ServerRouter/A-ServerRouter.types.js +4 -0
  347. package/dist/node/lib/A-ServerRouter/A-ServerRouter.types.js.map +1 -0
  348. package/dist/node/lib/A-ServerRouter/A-ServerRouter.types.mjs +3 -0
  349. package/dist/node/lib/A-ServerRouter/A-ServerRouter.types.mjs.map +1 -0
  350. package/dist/node/lib/A-ServerRouter/A-ServerRouterDefine.decorator.d.mts +16 -0
  351. package/dist/node/lib/A-ServerRouter/A-ServerRouterDefine.decorator.d.ts +16 -0
  352. package/dist/node/lib/A-ServerRouter/A-ServerRouterDefine.decorator.js +25 -0
  353. package/dist/node/lib/A-ServerRouter/A-ServerRouterDefine.decorator.js.map +1 -0
  354. package/dist/node/lib/A-ServerRouter/A-ServerRouterDefine.decorator.mjs +24 -0
  355. package/dist/node/lib/A-ServerRouter/A-ServerRouterDefine.decorator.mjs.map +1 -0
  356. package/dist/node/lib/A-ServerStatic/A-ServerStatic.component.d.mts +65 -0
  357. package/dist/node/lib/A-ServerStatic/A-ServerStatic.component.d.ts +65 -0
  358. package/dist/node/lib/A-ServerStatic/A-ServerStatic.component.js +260 -0
  359. package/dist/node/lib/A-ServerStatic/A-ServerStatic.component.js.map +1 -0
  360. package/dist/node/lib/A-ServerStatic/A-ServerStatic.component.mjs +248 -0
  361. package/dist/node/lib/A-ServerStatic/A-ServerStatic.component.mjs.map +1 -0
  362. package/dist/node/lib/A-ServerStatic/A-ServerStatic.context.d.mts +110 -0
  363. package/dist/node/lib/A-ServerStatic/A-ServerStatic.context.d.ts +110 -0
  364. package/dist/node/lib/A-ServerStatic/A-ServerStatic.context.js +180 -0
  365. package/dist/node/lib/A-ServerStatic/A-ServerStatic.context.js.map +1 -0
  366. package/dist/node/lib/A-ServerStatic/A-ServerStatic.context.mjs +179 -0
  367. package/dist/node/lib/A-ServerStatic/A-ServerStatic.context.mjs.map +1 -0
  368. package/dist/node/lib/A-ServerStatic/A-ServerStatic.types.d.mts +8 -0
  369. package/dist/node/lib/A-ServerStatic/A-ServerStatic.types.d.ts +8 -0
  370. package/dist/node/lib/A-ServerStatic/A-ServerStatic.types.js +4 -0
  371. package/dist/node/lib/A-ServerStatic/A-ServerStatic.types.js.map +1 -0
  372. package/dist/node/lib/A-ServerStatic/A-ServerStatic.types.mjs +3 -0
  373. package/dist/node/lib/A-ServerStatic/A-ServerStatic.types.mjs.map +1 -0
  374. package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.component.d.mts +29 -0
  375. package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.component.d.ts +29 -0
  376. package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.component.js +62 -0
  377. package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.component.js.map +1 -0
  378. package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.component.mjs +50 -0
  379. package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.component.mjs.map +1 -0
  380. package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.constants.d.mts +5 -0
  381. package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.constants.d.ts +5 -0
  382. package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.constants.js +14 -0
  383. package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.constants.js.map +1 -0
  384. package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.constants.mjs +14 -0
  385. package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.constants.mjs.map +1 -0
  386. package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.types.d.mts +9 -0
  387. package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.types.d.ts +9 -0
  388. package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.types.js +4 -0
  389. package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.types.js.map +1 -0
  390. package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.types.mjs +3 -0
  391. package/dist/node/middlewares/A-ServerCORS/A_ServerCORS.types.mjs.map +1 -0
  392. package/dist/node/repositories/A-EntityRepository/A-EntityRepository.component.d.mts +24 -0
  393. package/dist/node/repositories/A-EntityRepository/A-EntityRepository.component.d.ts +24 -0
  394. package/dist/node/repositories/A-EntityRepository/A-EntityRepository.component.js +94 -0
  395. package/dist/node/repositories/A-EntityRepository/A-EntityRepository.component.js.map +1 -0
  396. package/dist/node/repositories/A-EntityRepository/A-EntityRepository.component.mjs +82 -0
  397. package/dist/node/repositories/A-EntityRepository/A-EntityRepository.component.mjs.map +1 -0
  398. package/dist/node/repositories/A-EntityRepository/A-EntityRepository.error.d.mts +2 -0
  399. package/dist/node/repositories/A-EntityRepository/A-EntityRepository.error.d.ts +2 -0
  400. package/dist/node/repositories/A-EntityRepository/A-EntityRepository.error.js +4 -0
  401. package/dist/node/repositories/A-EntityRepository/A-EntityRepository.error.js.map +1 -0
  402. package/dist/node/repositories/A-EntityRepository/A-EntityRepository.error.mjs +3 -0
  403. package/dist/node/repositories/A-EntityRepository/A-EntityRepository.error.mjs.map +1 -0
  404. package/dist/node/repositories/A-EntityRepository/A-EntityRepository.types.d.mts +2 -0
  405. package/dist/node/repositories/A-EntityRepository/A-EntityRepository.types.d.ts +2 -0
  406. package/dist/node/repositories/A-EntityRepository/A-EntityRepository.types.js +4 -0
  407. package/dist/node/repositories/A-EntityRepository/A-EntityRepository.types.js.map +1 -0
  408. package/dist/node/repositories/A-EntityRepository/A-EntityRepository.types.mjs +3 -0
  409. package/dist/node/repositories/A-EntityRepository/A-EntityRepository.types.mjs.map +1 -0
  410. package/examples/simple-server/commands/SignIn.command.ts +17 -1
  411. package/examples/simple-server/components/Test.controller.ts +8 -7
  412. package/examples/simple-server/components/Users.repository.ts +28 -26
  413. package/examples/simple-server/concept.ts +56 -66
  414. package/examples/simple-server/entities/User/User.entity.ts +17 -7
  415. package/jest.config.ts +24 -10
  416. package/package.json +267 -25
  417. package/src/channels/A-Http/A-Http.channel.constants.ts +6 -7
  418. package/src/channels/A-Http/A-Http.channel.error.ts +2 -2
  419. package/src/channels/A-Http/A-Http.channel.ts +76 -125
  420. package/src/channels/A-Http/A-Http.channel.types.ts +6 -3
  421. package/src/channels/A-Websockets/A-Websockets.channel.ts +1 -1
  422. package/src/{components → controllers}/A-CommandController/A-CommandController.component.ts +16 -10
  423. package/src/{components → controllers}/A-EntityController/A-EntityController.component.ts +24 -28
  424. package/src/{components → controllers}/A-ListingController/A-ListingController.component.ts +10 -12
  425. package/src/{components → controllers}/A-ServerHealthMonitor/A-ServerHealthMonitor.component.ts +11 -11
  426. package/src/index.ts +58 -63
  427. package/src/lib/A-Request/A-HttpRequestData.context.ts +30 -0
  428. package/src/lib/A-Request/A-HttpServerRequest.context.ts +103 -0
  429. package/src/lib/A-Request/A-Request.constants.ts +30 -0
  430. package/src/lib/A-Request/A-Request.entity.ts +844 -0
  431. package/src/lib/A-Request/A-Request.env.ts +50 -0
  432. package/src/lib/A-Request/A-Request.error.ts +11 -0
  433. package/src/lib/A-Request/A-Request.helper.ts +276 -0
  434. package/src/lib/A-Request/A-Request.types.ts +284 -0
  435. package/src/lib/A-Request/README.md +567 -0
  436. package/src/lib/A-Response/A-Response.constants.ts +24 -0
  437. package/src/lib/A-Response/A-Response.entity.ts +689 -0
  438. package/src/lib/A-Response/A-Response.error.ts +6 -0
  439. package/src/lib/A-Response/A-Response.types.ts +127 -0
  440. package/src/lib/A-Response/README.md +793 -0
  441. package/src/lib/A-Server/A-HttpServer.constants.ts +9 -0
  442. package/src/lib/A-Server/A-HttpServer.container.ts +251 -0
  443. package/src/lib/A-Server/A-HttpServer.error.ts +165 -0
  444. package/src/lib/A-Server/A-HttpServer.types.ts +37 -0
  445. package/src/{context/A-Server/A_Server.context.ts → lib/A-Server/A-Server.context.ts} +6 -7
  446. package/src/lib/A-Server/A-Server.error.ts +26 -0
  447. package/src/{components/A-ServerError/A-ServerError.types.ts → lib/A-Server/A-Server.types.ts} +8 -0
  448. package/src/{components/A-Controller/A-Controller.component.ts → lib/A-ServerController/A-ServerController.component.ts} +5 -5
  449. package/src/{entities/A_EntityList/A_EntityList.entity.ts → lib/A-ServerEntityList/A-EntityList.entity.ts} +2 -2
  450. package/src/{entities/A_EntityList/A_EntityList.entity.types.ts → lib/A-ServerEntityList/A-EntityList.types.ts} +2 -2
  451. package/src/{context/A-ListQueryFilter/A_ListQueryFilter.context.ts → lib/A-ServerListQuery/A-ServerListQueryFilter.context.ts} +1 -1
  452. package/src/lib/A-ServerLogger/A-ServerLogger.component.ts +121 -0
  453. package/src/lib/A-ServerLogger/A-ServerLogger.types.ts +13 -0
  454. package/src/lib/A-ServerMiddleware/A-ServerMiddleware.component.ts +17 -0
  455. package/src/{components → lib}/A-ServerProxy/A-ServerProxy.component.ts +17 -12
  456. package/src/{context/A-ProxyConfig/A_ProxyConfig.constants.ts → lib/A-ServerProxy/A-ServerProxy.constants.ts} +1 -1
  457. package/src/{context/A-ProxyConfig/A_ProxyConfig.context.ts → lib/A-ServerProxy/A-ServerProxy.context.ts} +4 -4
  458. package/src/{context/A-ProxyConfig/A_ProxyConfig.types.ts → lib/A-ServerProxy/A-ServerProxy.types.ts} +4 -4
  459. package/src/lib/A-ServerRoute/A-ServerRoute.constants.ts +20 -0
  460. package/src/lib/A-ServerRoute/A-ServerRoute.entity.ts +48 -0
  461. package/src/lib/A-ServerRoute/A-ServerRoute.types.ts +6 -0
  462. package/src/{components/A-Router/A-Router.component.ts → lib/A-ServerRouter/A-ServerRouter.component.ts} +77 -97
  463. package/src/lib/A-ServerRouter/A-ServerRouter.constants.ts +8 -0
  464. package/src/lib/A-ServerRouter/A-ServerRouter.meta.ts +48 -0
  465. package/src/lib/A-ServerRouter/A-ServerRouter.types.ts +27 -0
  466. package/src/lib/A-ServerRouter/A-ServerRouterDefine.decorator.ts +37 -0
  467. package/src/{components/A-StaticLoader/A-StaticLoader.component.ts → lib/A-ServerStatic/A-ServerStatic.component.ts} +73 -54
  468. package/src/{context/A-StaticConfig/A-StaticConfig.context.ts → lib/A-ServerStatic/A-ServerStatic.context.ts} +16 -6
  469. package/src/{components → middlewares}/A-ServerCORS/A_ServerCORS.component.ts +16 -13
  470. package/src/{components/A-ServerCORS/A_ServerCORS.component.defaults.ts → middlewares/A-ServerCORS/A_ServerCORS.constants.ts} +2 -2
  471. package/src/{components → repositories}/A-EntityRepository/A-EntityRepository.component.ts +39 -30
  472. package/tests/A-HttpChannel.test.ts +41 -48
  473. package/tests/A-HttpServerError.test.ts +204 -0
  474. package/tests/A-Request.test.ts +351 -0
  475. package/tsconfig.json +40 -50
  476. package/tsup.config.ts +111 -13
  477. package/dist/index.d.mts +0 -855
  478. package/dist/index.d.ts +0 -855
  479. package/dist/index.js +0 -2179
  480. package/dist/index.js.map +0 -1
  481. package/dist/index.mjs +0 -2144
  482. package/dist/index.mjs.map +0 -1
  483. package/examples/microservices-server/components/controllers/Statistics.controller.ts +0 -18
  484. package/examples/microservices-server/components/repositories/Memory.repository.ts +0 -66
  485. package/examples/microservices-server/concept.ts +0 -43
  486. package/examples/microservices-server/context/MemoryStore.context.ts +0 -31
  487. package/examples/microservices-server/entities/Order.entity.ts +0 -7
  488. package/examples/microservices-server/entities/User.entity.ts +0 -8
  489. package/src/components/A-Router/A-Router.component.types.ts +0 -38
  490. package/src/components/A-ServerError/A-ServerError.class.ts +0 -98
  491. package/src/components/A-ServerLogger/A_ServerLogger.component.ts +0 -194
  492. package/src/components/A-ServerLogger/A_ServerLogger.component.types.ts +0 -14
  493. package/src/containers/A-Service/A-Service.container.ts +0 -218
  494. package/src/containers/A-Service/A-Service.container.types.ts +0 -46
  495. package/src/context/A-EntityFactory/A-EntityFactory.context.ts +0 -163
  496. package/src/context/A-EntityFactory/A-EntityFactory.context.types.ts +0 -11
  497. package/src/context/A-HttpChannel/A-HttpChannel.context.ts +0 -36
  498. package/src/context/A-Server/A_Server.context.types.ts +0 -9
  499. package/src/entities/A-Request/A-Request.entity.ts +0 -163
  500. package/src/entities/A-Request/A-Request.entity.types.ts +0 -41
  501. package/src/entities/A-Response/A-Response.entity.ts +0 -194
  502. package/src/entities/A-Response/A-Response.entity.types.ts +0 -26
  503. package/src/entities/A-Route/A-Route.entity.ts +0 -117
  504. package/tests/A-Service.test.ts +0 -18
  505. /package/src/{components → controllers}/A-EntityController/A-EntityController.component.types.ts +0 -0
  506. /package/src/{components/A-Controller/A-Controller.component.types.ts → controllers/A-ListingController/A-ListingController.types.ts} +0 -0
  507. /package/src/{components/A-ServerHealthMonitor/A-ServerHealthMonitor.component.types.ts → controllers/A-ServerHealthMonitor/A-ServerHealthMonitor.types.ts} +0 -0
  508. /package/src/{components/A-EntityRepository/A-EntityRepository.error.ts → lib/A-Response/A-Response.env.ts} +0 -0
  509. /package/src/{components/A-EntityRepository/A-EntityRepository.types.ts → lib/A-ServerController/A-ServerController.types.ts} +0 -0
  510. /package/src/{components → lib}/A-ServerLogger/A-ServerLogger.constants.ts +0 -0
  511. /package/src/{components/A-ListingController/A-ListingController.component.types.ts → lib/A-ServerMiddleware/A-ServerMiddleware.constants.ts} +0 -0
  512. /package/src/{components/A-ServerError/A-ServerError.constants.ts → lib/A-ServerMiddleware/A-ServerMiddleware.types.ts} +0 -0
  513. /package/src/{components/A-StaticLoader/A-StaticLoader.component.types.ts → lib/A-ServerStatic/A-ServerStatic.types.ts} +0 -0
  514. /package/src/{components/A-ServerCORS/A_ServerCORS.component.types.ts → middlewares/A-ServerCORS/A_ServerCORS.types.ts} +0 -0
  515. /package/src/{context/A-StaticConfig/A-StaticConfig.context.types.ts → repositories/A-EntityRepository/A-EntityRepository.error.ts} +0 -0
  516. /package/src/{entities/A-Route/A-Route.entity.types.ts → repositories/A-EntityRepository/A-EntityRepository.types.ts} +0 -0
@@ -0,0 +1,24 @@
1
+ import { A_Component, A_TYPES__ComponentMeta } from '@adaas/a-concept';
2
+ import { A_ServerRoute } from '../A-ServerRoute/A-ServerRoute.entity.mjs';
3
+ import { A_ServerRouterMetaKeys } from './A-ServerRouter.constants.mjs';
4
+ import '@adaas/a-utils/a-route';
5
+ import '../A-ServerRoute/A-ServerRoute.types.mjs';
6
+ import '../A-ServerRoute/A-ServerRoute.constants.mjs';
7
+
8
+ type A_ServerRouterRouteDefinition = {
9
+ component: A_Component;
10
+ handler: string;
11
+ route: A_ServerRoute;
12
+ };
13
+ type A_ServerRouterMetaStructure = {
14
+ [A_ServerRouterMetaKeys.ROUTES]: Map<string, A_ServerRouterRouteDefinition>;
15
+ [A_ServerRouterMetaKeys.ROUTES_CONFIGS]: Array<A_ServerRoute>;
16
+ } & A_TYPES__ComponentMeta;
17
+ type A_ServerRouterMetaKeyNames = typeof A_ServerRouterMetaKeys[keyof typeof A_ServerRouterMetaKeys];
18
+ type A_ServerRouterRouteConfig = {
19
+ path: string | RegExp;
20
+ version: string;
21
+ prefix: string;
22
+ };
23
+
24
+ export type { A_ServerRouterMetaKeyNames, A_ServerRouterMetaStructure, A_ServerRouterRouteConfig, A_ServerRouterRouteDefinition };
@@ -0,0 +1,24 @@
1
+ import { A_Component, A_TYPES__ComponentMeta } from '@adaas/a-concept';
2
+ import { A_ServerRoute } from '../A-ServerRoute/A-ServerRoute.entity.js';
3
+ import { A_ServerRouterMetaKeys } from './A-ServerRouter.constants.js';
4
+ import '@adaas/a-utils/a-route';
5
+ import '../A-ServerRoute/A-ServerRoute.types.js';
6
+ import '../A-ServerRoute/A-ServerRoute.constants.js';
7
+
8
+ type A_ServerRouterRouteDefinition = {
9
+ component: A_Component;
10
+ handler: string;
11
+ route: A_ServerRoute;
12
+ };
13
+ type A_ServerRouterMetaStructure = {
14
+ [A_ServerRouterMetaKeys.ROUTES]: Map<string, A_ServerRouterRouteDefinition>;
15
+ [A_ServerRouterMetaKeys.ROUTES_CONFIGS]: Array<A_ServerRoute>;
16
+ } & A_TYPES__ComponentMeta;
17
+ type A_ServerRouterMetaKeyNames = typeof A_ServerRouterMetaKeys[keyof typeof A_ServerRouterMetaKeys];
18
+ type A_ServerRouterRouteConfig = {
19
+ path: string | RegExp;
20
+ version: string;
21
+ prefix: string;
22
+ };
23
+
24
+ export type { A_ServerRouterMetaKeyNames, A_ServerRouterMetaStructure, A_ServerRouterRouteConfig, A_ServerRouterRouteDefinition };
@@ -0,0 +1,4 @@
1
+ 'use strict';
2
+
3
+ //# sourceMappingURL=A-ServerRouter.types.js.map
4
+ //# sourceMappingURL=A-ServerRouter.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"A-ServerRouter.types.js"}
@@ -0,0 +1,3 @@
1
+
2
+ //# sourceMappingURL=A-ServerRouter.types.mjs.map
3
+ //# sourceMappingURL=A-ServerRouter.types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"A-ServerRouter.types.mjs"}
@@ -0,0 +1,16 @@
1
+ import { A_TYPES__MetaLinkedComponentConstructors, A_Component } from '@adaas/a-concept';
2
+ import { A_ServerRoute } from '../A-ServerRoute/A-ServerRoute.entity.mjs';
3
+ import '@adaas/a-utils/a-route';
4
+ import '../A-ServerRoute/A-ServerRoute.types.mjs';
5
+ import '../A-ServerRoute/A-ServerRoute.constants.mjs';
6
+
7
+ /**
8
+ *
9
+ * This decorator should allow to set a default meta type for the class, this helps to avoid
10
+ * the need to create custom meta classes for each class.
11
+ *
12
+ * @returns
13
+ */
14
+ declare function A_ServerRouterDefineDecorator(route: A_ServerRoute): <TTarget extends A_TYPES__MetaLinkedComponentConstructors>(target: A_Component, propertyKey: string, descriptor: PropertyDescriptor) => any;
15
+
16
+ export { A_ServerRouterDefineDecorator };
@@ -0,0 +1,16 @@
1
+ import { A_TYPES__MetaLinkedComponentConstructors, A_Component } from '@adaas/a-concept';
2
+ import { A_ServerRoute } from '../A-ServerRoute/A-ServerRoute.entity.js';
3
+ import '@adaas/a-utils/a-route';
4
+ import '../A-ServerRoute/A-ServerRoute.types.js';
5
+ import '../A-ServerRoute/A-ServerRoute.constants.js';
6
+
7
+ /**
8
+ *
9
+ * This decorator should allow to set a default meta type for the class, this helps to avoid
10
+ * the need to create custom meta classes for each class.
11
+ *
12
+ * @returns
13
+ */
14
+ declare function A_ServerRouterDefineDecorator(route: A_ServerRoute): <TTarget extends A_TYPES__MetaLinkedComponentConstructors>(target: A_Component, propertyKey: string, descriptor: PropertyDescriptor) => any;
15
+
16
+ export { A_ServerRouterDefineDecorator };
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ var aConcept = require('@adaas/a-concept');
4
+ var AServerRouter_component = require('./A-ServerRouter.component');
5
+
6
+ function A_ServerRouterDefineDecorator(route) {
7
+ return function(target, propertyKey, descriptor) {
8
+ const meta = aConcept.A_Context.meta(AServerRouter_component.A_ServerRouter);
9
+ const searchKey = route.toAFeatureExtension(["A_ServerRouter", "A_Service"]);
10
+ meta.addRoute(searchKey, {
11
+ component: target,
12
+ handler: propertyKey,
13
+ route
14
+ });
15
+ aConcept.A_Feature_Define({
16
+ name: searchKey.source,
17
+ invoke: false
18
+ })(target, propertyKey, descriptor);
19
+ return aConcept.A_Feature_Extend(searchKey)(target, propertyKey, descriptor);
20
+ };
21
+ }
22
+
23
+ exports.A_ServerRouterDefineDecorator = A_ServerRouterDefineDecorator;
24
+ //# sourceMappingURL=A-ServerRouterDefine.decorator.js.map
25
+ //# sourceMappingURL=A-ServerRouterDefine.decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/lib/A-ServerRouter/A-ServerRouterDefine.decorator.ts"],"names":["A_Context","A_ServerRouter","A_Feature_Define","A_Feature_Extend"],"mappings":";;;;;AAYO,SAAS,8BAA8B,KAAA,EAAsB;AAChE,EAAA,OAAO,SACH,MAAA,EACA,WAAA,EACA,UAAA,EACF;AAEE,IAAA,MAAM,IAAA,GAA2BA,kBAAA,CAAU,IAAA,CAAyBC,sCAAc,CAAA;AAElF,IAAA,MAAM,YAAY,KAAA,CAAM,mBAAA,CAAoB,CAAC,gBAAA,EAAkB,WAAW,CAAC,CAAA;AAE3E,IAAA,IAAA,CAAK,SAAS,SAAA,EAAW;AAAA,MACrB,SAAA,EAAW,MAAA;AAAA,MACX,OAAA,EAAS,WAAA;AAAA,MACT;AAAA,KACH,CAAA;AAED,IAAAC,yBAAA,CAAiB;AAAA,MACb,MAAM,SAAA,CAAU,MAAA;AAAA,MAChB,MAAA,EAAQ;AAAA,KACX,CAAA,CAAE,MAAA,EAAQ,WAAA,EAAa,UAAU,CAAA;AAElC,IAAA,OAAOC,yBAAA,CAAiB,SAAS,CAAA,CAAE,MAAA,EAAQ,aAAa,UAAU,CAAA;AAAA,EACtE,CAAA;AACJ","file":"A-ServerRouterDefine.decorator.js","sourcesContent":["import { A_Component, A_Context, A_Feature_Define, A_Feature_Extend, A_TYPES__MetaLinkedComponentConstructors } from \"@adaas/a-concept\";\nimport { A_ServerRouterMeta } from \"./A-ServerRouter.meta\";\nimport { A_ServerRoute } from \"../A-ServerRoute/A-ServerRoute.entity\";\nimport { A_ServerRouter } from \"./A-ServerRouter.component\";\n\n/**\n * \n * This decorator should allow to set a default meta type for the class, this helps to avoid\n * the need to create custom meta classes for each class.\n * \n * @returns \n */\nexport function A_ServerRouterDefineDecorator(route: A_ServerRoute) {\n return function <TTarget extends A_TYPES__MetaLinkedComponentConstructors>(\n target: A_Component,\n propertyKey: string,\n descriptor: PropertyDescriptor\n ) {\n\n const meta: A_ServerRouterMeta = A_Context.meta<A_ServerRouterMeta>(A_ServerRouter);\n\n const searchKey = route.toAFeatureExtension(['A_ServerRouter', 'A_Service']);\n\n meta.addRoute(searchKey, {\n component: target,\n handler: propertyKey,\n route\n });\n\n A_Feature_Define({\n name: searchKey.source,\n invoke: false\n })(target, propertyKey, descriptor)\n\n return A_Feature_Extend(searchKey)(target, propertyKey, descriptor);\n }\n}"]}
@@ -0,0 +1,24 @@
1
+ import '../../chunk-EQQGB2QZ.mjs';
2
+ import { A_Context, A_Feature_Define, A_Feature_Extend } from '@adaas/a-concept';
3
+ import { A_ServerRouter } from './A-ServerRouter.component';
4
+
5
+ function A_ServerRouterDefineDecorator(route) {
6
+ return function(target, propertyKey, descriptor) {
7
+ const meta = A_Context.meta(A_ServerRouter);
8
+ const searchKey = route.toAFeatureExtension(["A_ServerRouter", "A_Service"]);
9
+ meta.addRoute(searchKey, {
10
+ component: target,
11
+ handler: propertyKey,
12
+ route
13
+ });
14
+ A_Feature_Define({
15
+ name: searchKey.source,
16
+ invoke: false
17
+ })(target, propertyKey, descriptor);
18
+ return A_Feature_Extend(searchKey)(target, propertyKey, descriptor);
19
+ };
20
+ }
21
+
22
+ export { A_ServerRouterDefineDecorator };
23
+ //# sourceMappingURL=A-ServerRouterDefine.decorator.mjs.map
24
+ //# sourceMappingURL=A-ServerRouterDefine.decorator.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/lib/A-ServerRouter/A-ServerRouterDefine.decorator.ts"],"names":[],"mappings":";;;;AAYO,SAAS,8BAA8B,KAAA,EAAsB;AAChE,EAAA,OAAO,SACH,MAAA,EACA,WAAA,EACA,UAAA,EACF;AAEE,IAAA,MAAM,IAAA,GAA2B,SAAA,CAAU,IAAA,CAAyB,cAAc,CAAA;AAElF,IAAA,MAAM,YAAY,KAAA,CAAM,mBAAA,CAAoB,CAAC,gBAAA,EAAkB,WAAW,CAAC,CAAA;AAE3E,IAAA,IAAA,CAAK,SAAS,SAAA,EAAW;AAAA,MACrB,SAAA,EAAW,MAAA;AAAA,MACX,OAAA,EAAS,WAAA;AAAA,MACT;AAAA,KACH,CAAA;AAED,IAAA,gBAAA,CAAiB;AAAA,MACb,MAAM,SAAA,CAAU,MAAA;AAAA,MAChB,MAAA,EAAQ;AAAA,KACX,CAAA,CAAE,MAAA,EAAQ,WAAA,EAAa,UAAU,CAAA;AAElC,IAAA,OAAO,gBAAA,CAAiB,SAAS,CAAA,CAAE,MAAA,EAAQ,aAAa,UAAU,CAAA;AAAA,EACtE,CAAA;AACJ","file":"A-ServerRouterDefine.decorator.mjs","sourcesContent":["import { A_Component, A_Context, A_Feature_Define, A_Feature_Extend, A_TYPES__MetaLinkedComponentConstructors } from \"@adaas/a-concept\";\nimport { A_ServerRouterMeta } from \"./A-ServerRouter.meta\";\nimport { A_ServerRoute } from \"../A-ServerRoute/A-ServerRoute.entity\";\nimport { A_ServerRouter } from \"./A-ServerRouter.component\";\n\n/**\n * \n * This decorator should allow to set a default meta type for the class, this helps to avoid\n * the need to create custom meta classes for each class.\n * \n * @returns \n */\nexport function A_ServerRouterDefineDecorator(route: A_ServerRoute) {\n return function <TTarget extends A_TYPES__MetaLinkedComponentConstructors>(\n target: A_Component,\n propertyKey: string,\n descriptor: PropertyDescriptor\n ) {\n\n const meta: A_ServerRouterMeta = A_Context.meta<A_ServerRouterMeta>(A_ServerRouter);\n\n const searchKey = route.toAFeatureExtension(['A_ServerRouter', 'A_Service']);\n\n meta.addRoute(searchKey, {\n component: target,\n handler: propertyKey,\n route\n });\n\n A_Feature_Define({\n name: searchKey.source,\n invoke: false\n })(target, propertyKey, descriptor)\n\n return A_Feature_Extend(searchKey)(target, propertyKey, descriptor);\n }\n}"]}
@@ -0,0 +1,65 @@
1
+ import { A_Component } from '@adaas/a-concept';
2
+ import { A as A_Request } from '../../A-Request.entity-r905O60G.mjs';
3
+ import { A as A_Response } from '../../A-Response.entity-BVYAc6-8.mjs';
4
+ import { A_StaticConfig, A_StaticAlias } from './A-ServerStatic.context.mjs';
5
+ import { A_HttpServerFeatures } from '../A-Server/A-HttpServer.constants.mjs';
6
+ import { A_Logger } from '@adaas/a-utils/a-logger';
7
+ import { A_Polyfill } from '@adaas/a-utils/a-polyfill';
8
+ import 'http';
9
+ import '../A-Server/A-HttpServer.error.mjs';
10
+ import '../A-Server/A-HttpServer.types.mjs';
11
+ import '../A-Request/A-Request.constants.mjs';
12
+ import '../A-Request/A-Request.env.mjs';
13
+ import '../A-Request/A-HttpServerRequest.context.mjs';
14
+ import '@adaas/a-utils/a-operation';
15
+ import '../A-Request/A-HttpRequestData.context.mjs';
16
+ import '@adaas/a-utils/a-execution';
17
+ import '@adaas/a-utils/a-config';
18
+ import '../A-ServerRoute/A-ServerRoute.entity.mjs';
19
+ import '@adaas/a-utils/a-route';
20
+ import '../A-ServerRoute/A-ServerRoute.types.mjs';
21
+ import '../A-ServerRoute/A-ServerRoute.constants.mjs';
22
+ import 'stream';
23
+ import '../A-Response/A-Response.constants.mjs';
24
+
25
+ declare class A_StaticLoader extends A_Component {
26
+ private _fsPolyfill;
27
+ private _pathPolyfill;
28
+ load(logger: A_Logger, config: A_StaticConfig, polyfill: A_Polyfill): Promise<void>;
29
+ [A_HttpServerFeatures.onRequest](req: A_Request, res: A_Response, logger: A_Logger, config: A_StaticConfig, polyfill: A_Polyfill): Promise<void>;
30
+ /**
31
+ * Add a custom static file alias through the config
32
+ * @param alias - The URL path alias (e.g., '/assets')
33
+ * @param directory - The local directory path
34
+ * @param path - Optional custom path (defaults to alias)
35
+ * @param config - Static config instance
36
+ * @param logger - Logger instance for logging
37
+ */
38
+ addAlias(alias: string, directory: string, config: A_StaticConfig, logger?: A_Logger, path?: string): void;
39
+ /**
40
+ * Remove a static file alias through the config
41
+ * @param aliasPath - The path of the alias to remove
42
+ * @param config - Static config instance
43
+ * @param logger - Logger instance for logging
44
+ */
45
+ removeAlias(aliasPath: string, config: A_StaticConfig, logger?: A_Logger): boolean;
46
+ /**
47
+ * Get all configured aliases from config
48
+ * @param config - Static config instance
49
+ */
50
+ getAliases(config: A_StaticConfig): A_StaticAlias[];
51
+ /**
52
+ * Enable or disable an alias
53
+ * @param aliasPath - The path of the alias
54
+ * @param enabled - Whether to enable or disable
55
+ * @param config - Static config instance
56
+ * @param logger - Logger instance for logging
57
+ */
58
+ setAliasEnabled(aliasPath: string, enabled: boolean, config: A_StaticConfig, logger?: A_Logger): boolean;
59
+ protected getMimeType(ext: string): string;
60
+ protected safeFilePath(staticDir: string, reqUrl: string, host: string | undefined, pathPolyfill: any, fsPolyfill: any): string;
61
+ protected serveFile(filePath: string, res: A_Response, logger: A_Logger, fsPolyfill: any, pathPolyfill: any): Promise<void>;
62
+ protected getCacheControl(ext: string): string;
63
+ }
64
+
65
+ export { A_StaticLoader };
@@ -0,0 +1,65 @@
1
+ import { A_Component } from '@adaas/a-concept';
2
+ import { A as A_Request } from '../../A-Request.entity-8_9MCXT2.js';
3
+ import { A as A_Response } from '../../A-Response.entity-CRc-t-vr.js';
4
+ import { A_StaticConfig, A_StaticAlias } from './A-ServerStatic.context.js';
5
+ import { A_HttpServerFeatures } from '../A-Server/A-HttpServer.constants.js';
6
+ import { A_Logger } from '@adaas/a-utils/a-logger';
7
+ import { A_Polyfill } from '@adaas/a-utils/a-polyfill';
8
+ import 'http';
9
+ import '../A-Server/A-HttpServer.error.js';
10
+ import '../A-Server/A-HttpServer.types.js';
11
+ import '../A-Request/A-Request.constants.js';
12
+ import '../A-Request/A-Request.env.js';
13
+ import '../A-Request/A-HttpServerRequest.context.js';
14
+ import '@adaas/a-utils/a-operation';
15
+ import '../A-Request/A-HttpRequestData.context.js';
16
+ import '@adaas/a-utils/a-execution';
17
+ import '@adaas/a-utils/a-config';
18
+ import '../A-ServerRoute/A-ServerRoute.entity.js';
19
+ import '@adaas/a-utils/a-route';
20
+ import '../A-ServerRoute/A-ServerRoute.types.js';
21
+ import '../A-ServerRoute/A-ServerRoute.constants.js';
22
+ import 'stream';
23
+ import '../A-Response/A-Response.constants.js';
24
+
25
+ declare class A_StaticLoader extends A_Component {
26
+ private _fsPolyfill;
27
+ private _pathPolyfill;
28
+ load(logger: A_Logger, config: A_StaticConfig, polyfill: A_Polyfill): Promise<void>;
29
+ [A_HttpServerFeatures.onRequest](req: A_Request, res: A_Response, logger: A_Logger, config: A_StaticConfig, polyfill: A_Polyfill): Promise<void>;
30
+ /**
31
+ * Add a custom static file alias through the config
32
+ * @param alias - The URL path alias (e.g., '/assets')
33
+ * @param directory - The local directory path
34
+ * @param path - Optional custom path (defaults to alias)
35
+ * @param config - Static config instance
36
+ * @param logger - Logger instance for logging
37
+ */
38
+ addAlias(alias: string, directory: string, config: A_StaticConfig, logger?: A_Logger, path?: string): void;
39
+ /**
40
+ * Remove a static file alias through the config
41
+ * @param aliasPath - The path of the alias to remove
42
+ * @param config - Static config instance
43
+ * @param logger - Logger instance for logging
44
+ */
45
+ removeAlias(aliasPath: string, config: A_StaticConfig, logger?: A_Logger): boolean;
46
+ /**
47
+ * Get all configured aliases from config
48
+ * @param config - Static config instance
49
+ */
50
+ getAliases(config: A_StaticConfig): A_StaticAlias[];
51
+ /**
52
+ * Enable or disable an alias
53
+ * @param aliasPath - The path of the alias
54
+ * @param enabled - Whether to enable or disable
55
+ * @param config - Static config instance
56
+ * @param logger - Logger instance for logging
57
+ */
58
+ setAliasEnabled(aliasPath: string, enabled: boolean, config: A_StaticConfig, logger?: A_Logger): boolean;
59
+ protected getMimeType(ext: string): string;
60
+ protected safeFilePath(staticDir: string, reqUrl: string, host: string | undefined, pathPolyfill: any, fsPolyfill: any): string;
61
+ protected serveFile(filePath: string, res: A_Response, logger: A_Logger, fsPolyfill: any, pathPolyfill: any): Promise<void>;
62
+ protected getCacheControl(ext: string): string;
63
+ }
64
+
65
+ export { A_StaticLoader };
@@ -0,0 +1,260 @@
1
+ 'use strict';
2
+
3
+ var aConcept = require('@adaas/a-concept');
4
+ var ARequest_entity = require('@adaas/a-server/request/A-Request.entity');
5
+ var AResponse_entity = require('@adaas/a-server/response/A-Response.entity');
6
+ var AServerStatic_context = require('./A-ServerStatic.context');
7
+ var AHttpServer_constants = require('@adaas/a-server/server/A-HttpServer.constants');
8
+ var AHttpServer_error = require('@adaas/a-server/server/A-HttpServer.error');
9
+ var aLogger = require('@adaas/a-utils/a-logger');
10
+ var aPolyfill = require('@adaas/a-utils/a-polyfill');
11
+ var AServerRoute_entity = require('@adaas/a-server/route/A-ServerRoute.entity');
12
+
13
+ var __defProp = Object.defineProperty;
14
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
15
+ var __decorateClass = (decorators, target, key, kind) => {
16
+ var result = __getOwnPropDesc(target, key) ;
17
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
18
+ if (decorator = decorators[i])
19
+ result = (decorator(target, key, result) ) || result;
20
+ if (result) __defProp(target, key, result);
21
+ return result;
22
+ };
23
+ var __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);
24
+ var _a;
25
+ class A_StaticLoader extends aConcept.A_Component {
26
+ async load(logger, config, polyfill) {
27
+ this._fsPolyfill = await polyfill.fs();
28
+ this._pathPolyfill = await polyfill.path();
29
+ const aliases = config.getEnabledAliases();
30
+ logger.info(
31
+ "cyan",
32
+ `Static aliases configured:`,
33
+ ...aliases.map((alias) => `${alias.alias} -> ${alias.directory}`)
34
+ );
35
+ }
36
+ async [_a = AHttpServer_constants.A_HttpServerFeatures.onRequest](req, res, logger, config, polyfill) {
37
+ if (req.method !== "GET" && req.method !== "HEAD") {
38
+ return;
39
+ }
40
+ const { method, url } = req;
41
+ const route = new AServerRoute_entity.A_ServerRoute(url, method);
42
+ const alias = config.findMatchingAlias(route.path);
43
+ if (!alias) {
44
+ return;
45
+ }
46
+ try {
47
+ const fs = this._fsPolyfill || await polyfill.fs();
48
+ const path = this._pathPolyfill || await polyfill.path();
49
+ const staticDir = path.resolve(process.cwd(), alias.directory);
50
+ if (!fs.existsSync(staticDir)) {
51
+ logger.log("red", `Static directory ${staticDir} does not exist.`);
52
+ return;
53
+ }
54
+ const relativePath = route.path.replace(alias.path, "");
55
+ const safePath = this.safeFilePath(staticDir, relativePath, req.headers?.host, path, fs);
56
+ await this.serveFile(safePath, res, logger, fs, path);
57
+ logger.log("green", `Successfully served: ${safePath}`);
58
+ } catch (error) {
59
+ throw new AHttpServer_error.A_HttpServerError({
60
+ status: 500,
61
+ title: "Static File Serving Error",
62
+ description: `Error serving static file for ${route.path}: ${error.message}`,
63
+ originalError: error
64
+ });
65
+ }
66
+ }
67
+ /**
68
+ * Add a custom static file alias through the config
69
+ * @param alias - The URL path alias (e.g., '/assets')
70
+ * @param directory - The local directory path
71
+ * @param path - Optional custom path (defaults to alias)
72
+ * @param config - Static config instance
73
+ * @param logger - Logger instance for logging
74
+ */
75
+ addAlias(alias, directory, config, logger, path) {
76
+ config.addAlias(alias, directory, path);
77
+ if (logger) {
78
+ logger.log("cyan", `Static alias added: ${alias} -> ${directory}`);
79
+ }
80
+ }
81
+ /**
82
+ * Remove a static file alias through the config
83
+ * @param aliasPath - The path of the alias to remove
84
+ * @param config - Static config instance
85
+ * @param logger - Logger instance for logging
86
+ */
87
+ removeAlias(aliasPath, config, logger) {
88
+ const removed = config.removeAlias(aliasPath);
89
+ if (removed && logger) {
90
+ logger.log("yellow", `Static alias removed: ${aliasPath}`);
91
+ }
92
+ return removed;
93
+ }
94
+ /**
95
+ * Get all configured aliases from config
96
+ * @param config - Static config instance
97
+ */
98
+ getAliases(config) {
99
+ return config.getAliases();
100
+ }
101
+ /**
102
+ * Enable or disable an alias
103
+ * @param aliasPath - The path of the alias
104
+ * @param enabled - Whether to enable or disable
105
+ * @param config - Static config instance
106
+ * @param logger - Logger instance for logging
107
+ */
108
+ setAliasEnabled(aliasPath, enabled, config, logger) {
109
+ const result = config.setAliasEnabled(aliasPath, enabled);
110
+ if (result && logger) {
111
+ logger.log("blue", `Static alias ${enabled ? "enabled" : "disabled"}: ${aliasPath}`);
112
+ }
113
+ return result;
114
+ }
115
+ getMimeType(ext) {
116
+ const mimeTypes = {
117
+ // Text
118
+ ".html": "text/html",
119
+ ".htm": "text/html",
120
+ ".css": "text/css",
121
+ ".txt": "text/plain",
122
+ ".md": "text/markdown",
123
+ ".xml": "application/xml",
124
+ // JavaScript
125
+ ".js": "application/javascript",
126
+ ".mjs": "application/javascript",
127
+ ".jsx": "application/javascript",
128
+ ".ts": "application/typescript",
129
+ ".tsx": "application/typescript",
130
+ // JSON
131
+ ".json": "application/json",
132
+ ".jsonld": "application/ld+json",
133
+ // Images
134
+ ".png": "image/png",
135
+ ".jpg": "image/jpeg",
136
+ ".jpeg": "image/jpeg",
137
+ ".gif": "image/gif",
138
+ ".svg": "image/svg+xml",
139
+ ".ico": "image/x-icon",
140
+ ".webp": "image/webp",
141
+ ".bmp": "image/bmp",
142
+ ".tiff": "image/tiff",
143
+ // Fonts
144
+ ".woff": "font/woff",
145
+ ".woff2": "font/woff2",
146
+ ".ttf": "font/ttf",
147
+ ".otf": "font/otf",
148
+ ".eot": "application/vnd.ms-fontobject",
149
+ // Audio/Video
150
+ ".mp3": "audio/mpeg",
151
+ ".wav": "audio/wav",
152
+ ".mp4": "video/mp4",
153
+ ".webm": "video/webm",
154
+ ".ogg": "application/ogg",
155
+ // Archives
156
+ ".zip": "application/zip",
157
+ ".tar": "application/x-tar",
158
+ ".gz": "application/gzip",
159
+ // Documents
160
+ ".pdf": "application/pdf",
161
+ ".doc": "application/msword",
162
+ ".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
163
+ ".xls": "application/vnd.ms-excel",
164
+ ".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
165
+ };
166
+ return mimeTypes[ext.toLowerCase()] || "application/octet-stream";
167
+ }
168
+ safeFilePath(staticDir, reqUrl, host = "localhost", pathPolyfill, fsPolyfill) {
169
+ const parsedUrl = new URL(reqUrl || "/", `http://${host}`);
170
+ let pathname = decodeURIComponent(parsedUrl.pathname);
171
+ pathname = pathname.replace(/\.\.[\/\\]/g, "");
172
+ let filePath = pathPolyfill.join(staticDir, pathname);
173
+ if (!fsPolyfill.existsSync(filePath)) {
174
+ throw new Error(`File not found: ${filePath}`);
175
+ }
176
+ return filePath;
177
+ }
178
+ serveFile(filePath, res, logger, fsPolyfill, pathPolyfill) {
179
+ return new Promise((resolve, reject) => {
180
+ try {
181
+ if (fsPolyfill.existsSync(filePath)) {
182
+ const ext = pathPolyfill.extname(filePath);
183
+ const contentType = this.getMimeType(ext);
184
+ const headers = {
185
+ "Content-Type": contentType,
186
+ "Cache-Control": this.getCacheControl(ext),
187
+ "X-Content-Type-Options": "nosniff"
188
+ };
189
+ res.writeHead(200, headers);
190
+ const stream = fsPolyfill.createReadStream(filePath);
191
+ if (stream && res.original) {
192
+ stream.pipe(res.original);
193
+ stream.on("end", () => {
194
+ resolve();
195
+ });
196
+ stream.on("error", (err) => {
197
+ reject(new AHttpServer_error.A_HttpServerError({
198
+ status: 500,
199
+ title: "File Stream Error",
200
+ description: `Error reading file stream for ${filePath}: ${err.message}`,
201
+ originalError: err
202
+ }));
203
+ });
204
+ } else {
205
+ reject(new AHttpServer_error.A_HttpServerError({
206
+ status: 500,
207
+ title: "Response Stream Error",
208
+ description: `Unable to pipe file stream for ${filePath}`
209
+ }));
210
+ }
211
+ } else {
212
+ reject(new AHttpServer_error.A_HttpServerError({
213
+ status: 404,
214
+ title: "File Not Found",
215
+ description: `File not found: ${filePath}`
216
+ }));
217
+ }
218
+ } catch (error) {
219
+ logger.error(`Error serving file: ${error.message}`);
220
+ reject(new AHttpServer_error.A_HttpServerError({
221
+ status: 500,
222
+ title: "Internal Server Error",
223
+ description: `Error serving file: ${error.message}`,
224
+ originalError: error
225
+ }));
226
+ }
227
+ });
228
+ }
229
+ getCacheControl(ext) {
230
+ const staticAssets = [".css", ".js", ".png", ".jpg", ".jpeg", ".gif", ".svg", ".ico", ".woff", ".woff2", ".ttf", ".otf"];
231
+ const dynamicContent = [".html", ".htm"];
232
+ if (staticAssets.includes(ext.toLowerCase())) {
233
+ return "public, max-age=31536000";
234
+ } else if (dynamicContent.includes(ext.toLowerCase())) {
235
+ return "public, max-age=3600";
236
+ } else {
237
+ return "public, max-age=86400";
238
+ }
239
+ }
240
+ }
241
+ __decorateClass([
242
+ aConcept.A_Concept.Load(),
243
+ __decorateParam(0, aConcept.A_Inject(aLogger.A_Logger)),
244
+ __decorateParam(1, aConcept.A_Inject(AServerStatic_context.A_StaticConfig)),
245
+ __decorateParam(2, aConcept.A_Inject(aPolyfill.A_Polyfill))
246
+ ], A_StaticLoader.prototype, "load");
247
+ __decorateClass([
248
+ aConcept.A_Feature.Extend({
249
+ before: /.*/
250
+ }),
251
+ __decorateParam(0, aConcept.A_Inject(ARequest_entity.A_Request)),
252
+ __decorateParam(1, aConcept.A_Inject(AResponse_entity.A_Response)),
253
+ __decorateParam(2, aConcept.A_Inject(aLogger.A_Logger)),
254
+ __decorateParam(3, aConcept.A_Inject(AServerStatic_context.A_StaticConfig)),
255
+ __decorateParam(4, aConcept.A_Inject(aPolyfill.A_Polyfill))
256
+ ], A_StaticLoader.prototype, _a);
257
+
258
+ exports.A_StaticLoader = A_StaticLoader;
259
+ //# sourceMappingURL=A-ServerStatic.component.js.map
260
+ //# sourceMappingURL=A-ServerStatic.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/lib/A-ServerStatic/A-ServerStatic.component.ts"],"names":["A_Component","A_ServerRoute","A_HttpServerError","A_Concept","A_Logger","A_StaticConfig","A_Polyfill","A_Feature","A_Request","A_Response"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAA,EAAA;AAUO,MAAM,uBAAuBA,oBAAA,CAAY;AAAA,EAM5C,MAAM,IAAA,CACkB,MAAA,EACM,MAAA,EACJ,QAAA,EACxB;AAEE,IAAA,IAAA,CAAK,WAAA,GAAc,MAAM,QAAA,CAAS,EAAA,EAAG;AACrC,IAAA,IAAA,CAAK,aAAA,GAAgB,MAAM,QAAA,CAAS,IAAA,EAAK;AAGzC,IAAA,MAAM,OAAA,GAAU,OAAO,iBAAA,EAAkB;AACzC,IAAA,MAAA,CAAO,IAAA;AAAA,MAAK,MAAA;AAAA,MAER,CAAA,0BAAA,CAAA;AAAA,MACA,GAAG,OAAA,CAAQ,GAAA,CAAI,CAAA,KAAA,KAAS,CAAA,EAAG,MAAM,KAAK,CAAA,IAAA,EAAO,KAAA,CAAM,SAAS,CAAA,CAAE;AAAA,KAClE;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ACX,CAAA,MAAO;AACH,MAAA,OAAO,uBAAA;AAAA,IACX;AAAA,EACJ;AAEJ;AAhTU,eAAA,CAAA;AAAA,EADLC,mBAAU,IAAA,EAAK;AAAA,EAEX,qCAASC,gBAAQ,CAAA,CAAA;AAAA,EACjB,qCAASC,oCAAc,CAAA,CAAA;AAAA,EACvB,qCAASC,oBAAU,CAAA;AAAA,CAAA,EATf,cAAA,CAMH,SAAA,EAAA,MAAA,CAAA;AA0BC,eAAA,CAAA;AAAA,EAHNC,mBAAU,MAAA,CAAO;AAAA,IACd,MAAA,EAAQ;AAAA,GACX,CAAA;AAAA,EAEI,qCAASC,yBAAS,CAAA,CAAA;AAAA,EAClB,qCAASC,2BAAU,CAAA,CAAA;AAAA,EACnB,qCAASL,gBAAQ,CAAA,CAAA;AAAA,EACjB,qCAASC,oCAAc,CAAA,CAAA;AAAA,EACvB,qCAASC,oBAAU,CAAA;AAAA,CAAA,EArCf,cAAA,CAgCF,SAAA,EAAA,EAAA,CAAA","file":"A-ServerStatic.component.js","sourcesContent":["import { A_Component, A_Concept, A_Feature, A_Inject } from \"@adaas/a-concept\"\nimport { A_Request } from \"@adaas/a-server/request/A-Request.entity\";\nimport { A_Response } from \"@adaas/a-server/response/A-Response.entity\";\nimport { A_StaticConfig, A_StaticAlias } from \"./A-ServerStatic.context\";\nimport { A_HttpServerFeatures } from \"@adaas/a-server/server/A-HttpServer.constants\";\nimport { A_HttpServerError } from \"@adaas/a-server/server/A-HttpServer.error\";\nimport { A_Logger } from \"@adaas/a-utils/a-logger\";\nimport { A_Polyfill } from \"@adaas/a-utils/a-polyfill\";\nimport { A_ServerRoute } from \"@adaas/a-server/route/A-ServerRoute.entity\";\n\nexport class A_StaticLoader extends A_Component {\n\n private _fsPolyfill: any;\n private _pathPolyfill: any;\n\n @A_Concept.Load()\n async load(\n @A_Inject(A_Logger) logger: A_Logger,\n @A_Inject(A_StaticConfig) config: A_StaticConfig,\n @A_Inject(A_Polyfill) polyfill: A_Polyfill\n ) {\n // Initialize polyfills\n this._fsPolyfill = await polyfill.fs();\n this._pathPolyfill = await polyfill.path();\n\n // Log configured aliases\n const aliases = config.getEnabledAliases();\n logger.info('cyan',\n\n `Static aliases configured:`,\n ...aliases.map(alias => `${alias.alias} -> ${alias.directory}`)\n );\n }\n\n\n // =======================================================\n // ================ Method Definition=====================\n // =======================================================\n\n @A_Feature.Extend({\n before: /.*/\n })\n async [A_HttpServerFeatures.onRequest](\n @A_Inject(A_Request) req: A_Request,\n @A_Inject(A_Response) res: A_Response,\n @A_Inject(A_Logger) logger: A_Logger,\n @A_Inject(A_StaticConfig) config: A_StaticConfig,\n @A_Inject(A_Polyfill) polyfill: A_Polyfill\n ) {\n\n if (req.method !== 'GET' && req.method !== 'HEAD') {\n return; // Only handle GET and HEAD requests\n }\n\n const { method, url } = req;\n const route = new A_ServerRoute(url, method);\n\n // Check if this request matches any of our configured aliases\n const alias = config.findMatchingAlias(route.path);\n if (!alias) {\n return; // No static config for this path\n }\n\n try {\n // Ensure polyfills are available\n const fs = this._fsPolyfill || await polyfill.fs();\n const path = this._pathPolyfill || await polyfill.path();\n\n const staticDir = path.resolve(process.cwd(), alias.directory);\n\n // Validate static directory exists\n if (!fs.existsSync(staticDir)) {\n logger.log(\"red\", `Static directory ${staticDir} does not exist.`);\n return;\n }\n\n // Get the file path relative to the alias\n const relativePath = route.path.replace(alias.path, '');\n const safePath = this.safeFilePath(staticDir, relativePath, req.headers?.host, path, fs);\n\n await this.serveFile(safePath, res, logger, fs, path);\n\n logger.log('green', `Successfully served: ${safePath}`);\n\n } catch (error: any) {\n throw new A_HttpServerError({\n status: 500,\n title: 'Static File Serving Error',\n description: `Error serving static file for ${route.path}: ${error.message}`,\n originalError: error\n });\n }\n }\n\n /**\n * Add a custom static file alias through the config\n * @param alias - The URL path alias (e.g., '/assets')\n * @param directory - The local directory path\n * @param path - Optional custom path (defaults to alias)\n * @param config - Static config instance\n * @param logger - Logger instance for logging\n */\n public addAlias(\n alias: string,\n directory: string,\n config: A_StaticConfig,\n logger?: A_Logger,\n path?: string\n ): void {\n config.addAlias(alias, directory, path);\n\n if (logger) {\n logger.log('cyan', `Static alias added: ${alias} -> ${directory}`);\n }\n }\n\n /**\n * Remove a static file alias through the config\n * @param aliasPath - The path of the alias to remove\n * @param config - Static config instance\n * @param logger - Logger instance for logging\n */\n public removeAlias(aliasPath: string, config: A_StaticConfig, logger?: A_Logger): boolean {\n const removed = config.removeAlias(aliasPath);\n\n if (removed && logger) {\n logger.log('yellow', `Static alias removed: ${aliasPath}`);\n }\n\n return removed;\n }\n\n /**\n * Get all configured aliases from config\n * @param config - Static config instance\n */\n public getAliases(config: A_StaticConfig): A_StaticAlias[] {\n return config.getAliases();\n }\n\n /**\n * Enable or disable an alias\n * @param aliasPath - The path of the alias\n * @param enabled - Whether to enable or disable\n * @param config - Static config instance\n * @param logger - Logger instance for logging\n */\n public setAliasEnabled(\n aliasPath: string,\n enabled: boolean,\n config: A_StaticConfig,\n logger?: A_Logger\n ): boolean {\n const result = config.setAliasEnabled(aliasPath, enabled);\n\n if (result && logger) {\n logger.log('blue', `Static alias ${enabled ? 'enabled' : 'disabled'}: ${aliasPath}`);\n }\n\n return result;\n }\n\n protected getMimeType(ext: string): string {\n const mimeTypes: Record<string, string> = {\n // Text\n \".html\": \"text/html\",\n \".htm\": \"text/html\",\n \".css\": \"text/css\",\n \".txt\": \"text/plain\",\n \".md\": \"text/markdown\",\n \".xml\": \"application/xml\",\n\n // JavaScript\n \".js\": \"application/javascript\",\n \".mjs\": \"application/javascript\",\n \".jsx\": \"application/javascript\",\n \".ts\": \"application/typescript\",\n \".tsx\": \"application/typescript\",\n\n // JSON\n \".json\": \"application/json\",\n \".jsonld\": \"application/ld+json\",\n\n // Images\n \".png\": \"image/png\",\n \".jpg\": \"image/jpeg\",\n \".jpeg\": \"image/jpeg\",\n \".gif\": \"image/gif\",\n \".svg\": \"image/svg+xml\",\n \".ico\": \"image/x-icon\",\n \".webp\": \"image/webp\",\n \".bmp\": \"image/bmp\",\n \".tiff\": \"image/tiff\",\n\n // Fonts\n \".woff\": \"font/woff\",\n \".woff2\": \"font/woff2\",\n \".ttf\": \"font/ttf\",\n \".otf\": \"font/otf\",\n \".eot\": \"application/vnd.ms-fontobject\",\n\n // Audio/Video\n \".mp3\": \"audio/mpeg\",\n \".wav\": \"audio/wav\",\n \".mp4\": \"video/mp4\",\n \".webm\": \"video/webm\",\n \".ogg\": \"application/ogg\",\n\n // Archives\n \".zip\": \"application/zip\",\n \".tar\": \"application/x-tar\",\n \".gz\": \"application/gzip\",\n\n // Documents\n \".pdf\": \"application/pdf\",\n \".doc\": \"application/msword\",\n \".docx\": \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\",\n \".xls\": \"application/vnd.ms-excel\",\n \".xlsx\": \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\",\n };\n\n return mimeTypes[ext.toLowerCase()] || \"application/octet-stream\";\n }\n\n\n protected safeFilePath(staticDir: string, reqUrl: string, host: string = 'localhost', pathPolyfill: any, fsPolyfill: any): string {\n const parsedUrl = new URL(reqUrl || \"/\", `http://${host}`);\n let pathname = decodeURIComponent(parsedUrl.pathname);\n\n // Prevent path traversal attacks\n pathname = pathname.replace(/\\.\\.[\\/\\\\]/g, \"\");\n\n let filePath = pathPolyfill.join(staticDir, pathname);\n\n if (!fsPolyfill.existsSync(filePath)) {\n throw new Error(`File not found: ${filePath}`);\n }\n\n return filePath;\n }\n\n protected serveFile(\n filePath: string,\n res: A_Response,\n logger: A_Logger,\n fsPolyfill: any,\n pathPolyfill: any\n ): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n try {\n if (fsPolyfill.existsSync(filePath)) {\n const ext = pathPolyfill.extname(filePath);\n const contentType = this.getMimeType(ext);\n\n // Set appropriate headers\n const headers: Record<string, string> = {\n \"Content-Type\": contentType,\n \"Cache-Control\": this.getCacheControl(ext),\n \"X-Content-Type-Options\": \"nosniff\"\n };\n\n res.writeHead(200, headers);\n\n const stream = fsPolyfill.createReadStream(filePath);\n\n if (stream && res.original) {\n stream.pipe(res.original);\n\n stream.on('end', () => {\n resolve();\n });\n\n stream.on(\"error\", (err: any) => {\n reject(new A_HttpServerError({\n status: 500,\n title: 'File Stream Error',\n description: `Error reading file stream for ${filePath}: ${err.message}`,\n originalError: err\n }));\n });\n } else {\n reject(new A_HttpServerError({\n status: 500,\n title: 'Response Stream Error',\n description: `Unable to pipe file stream for ${filePath}`,\n }));\n }\n } else {\n reject(new A_HttpServerError({\n status: 404,\n title: 'File Not Found',\n description: `File not found: ${filePath}`,\n }));\n }\n } catch (error: any) {\n logger.error(`Error serving file: ${error.message}`);\n reject(new A_HttpServerError({\n status: 500,\n title: 'Internal Server Error',\n description: `Error serving file: ${error.message}`,\n originalError: error\n }));\n }\n });\n }\n\n protected getCacheControl(ext: string): string {\n // Different cache strategies for different file types\n const staticAssets = ['.css', '.js', '.png', '.jpg', '.jpeg', '.gif', '.svg', '.ico', '.woff', '.woff2', '.ttf', '.otf'];\n const dynamicContent = ['.html', '.htm'];\n\n if (staticAssets.includes(ext.toLowerCase())) {\n return \"public, max-age=31536000\"; // 1 year for static assets\n } else if (dynamicContent.includes(ext.toLowerCase())) {\n return \"public, max-age=3600\"; // 1 hour for HTML\n } else {\n return \"public, max-age=86400\"; // 1 day for other files\n }\n }\n\n}\n\n\n"]}