@mionjs/router 0.13.2 → 0.14.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 (866) hide show
  1. package/.dist/esm/.mion/types/A0Qb_CXFfAul.js +43 -0
  2. package/.dist/esm/.mion/types/A0Qb_CXFfAul.js.map +1 -0
  3. package/.dist/esm/.mion/types/A0Qb_EkYSHqf.js +29 -0
  4. package/.dist/esm/.mion/types/A0Qb_EkYSHqf.js.map +1 -0
  5. package/.dist/esm/.mion/types/A0Qb_GVXB1Wo.js +22 -0
  6. package/.dist/esm/.mion/types/A0Qb_GVXB1Wo.js.map +1 -0
  7. package/.dist/esm/.mion/types/A0Qb_HvnlLnd.js +38 -0
  8. package/.dist/esm/.mion/types/A0Qb_HvnlLnd.js.map +1 -0
  9. package/.dist/esm/.mion/types/A0Qb_JTXvy7Y.js +43 -0
  10. package/.dist/esm/.mion/types/A0Qb_JTXvy7Y.js.map +1 -0
  11. package/.dist/esm/.mion/types/A0Qb_JkwVz03.js +36 -0
  12. package/.dist/esm/.mion/types/A0Qb_JkwVz03.js.map +1 -0
  13. package/.dist/esm/.mion/types/A0Qb_Ju6MvJU.js +14 -0
  14. package/.dist/esm/.mion/types/A0Qb_Ju6MvJU.js.map +1 -0
  15. package/.dist/esm/.mion/types/A0Qb_KYXJdoi.js +42 -0
  16. package/.dist/esm/.mion/types/A0Qb_KYXJdoi.js.map +1 -0
  17. package/.dist/esm/.mion/types/A0Qb_L7TAwqn.js +44 -0
  18. package/.dist/esm/.mion/types/A0Qb_L7TAwqn.js.map +1 -0
  19. package/.dist/esm/.mion/types/A0Qb_NXjo9wB.js +82 -0
  20. package/.dist/esm/.mion/types/A0Qb_NXjo9wB.js.map +1 -0
  21. package/.dist/esm/.mion/types/A0Qb_P05N010.js +35 -0
  22. package/.dist/esm/.mion/types/A0Qb_P05N010.js.map +1 -0
  23. package/.dist/esm/.mion/types/A0Qb_R2waGIJ.js +43 -0
  24. package/.dist/esm/.mion/types/A0Qb_R2waGIJ.js.map +1 -0
  25. package/.dist/esm/.mion/types/A0Qb_UE6lPE3.js +14 -0
  26. package/.dist/esm/.mion/types/A0Qb_UE6lPE3.js.map +1 -0
  27. package/.dist/esm/.mion/types/A0Qb_UGPHsHZ.js +29 -0
  28. package/.dist/esm/.mion/types/A0Qb_UGPHsHZ.js.map +1 -0
  29. package/.dist/esm/.mion/types/A0Qb_VMxJugF.js +29 -0
  30. package/.dist/esm/.mion/types/A0Qb_VMxJugF.js.map +1 -0
  31. package/.dist/esm/.mion/types/A0Qb_VuzVN13.js +43 -0
  32. package/.dist/esm/.mion/types/A0Qb_VuzVN13.js.map +1 -0
  33. package/.dist/esm/.mion/types/A0Qb_WaXzp6u.js +29 -0
  34. package/.dist/esm/.mion/types/A0Qb_WaXzp6u.js.map +1 -0
  35. package/.dist/esm/.mion/types/A0Qb_b8JOgtl.js +35 -0
  36. package/.dist/esm/.mion/types/A0Qb_b8JOgtl.js.map +1 -0
  37. package/.dist/esm/.mion/types/A0Qb_bWgCH09.js +14 -0
  38. package/.dist/esm/.mion/types/A0Qb_bWgCH09.js.map +1 -0
  39. package/.dist/esm/.mion/types/A0Qb_cIwQaiK.js +43 -0
  40. package/.dist/esm/.mion/types/A0Qb_cIwQaiK.js.map +1 -0
  41. package/.dist/esm/.mion/types/A0Qb_ddv0QYt.js +27 -0
  42. package/.dist/esm/.mion/types/A0Qb_ddv0QYt.js.map +1 -0
  43. package/.dist/esm/.mion/types/A0Qb_fjaxPpO.js +28 -0
  44. package/.dist/esm/.mion/types/A0Qb_fjaxPpO.js.map +1 -0
  45. package/.dist/esm/.mion/types/A0Qb_hnO6xA5.js +43 -0
  46. package/.dist/esm/.mion/types/A0Qb_hnO6xA5.js.map +1 -0
  47. package/.dist/esm/.mion/types/A0Qb_jMcsHAh.js +76 -0
  48. package/.dist/esm/.mion/types/A0Qb_jMcsHAh.js.map +1 -0
  49. package/.dist/esm/.mion/types/A0Qb_pJ9XvFm.js +43 -0
  50. package/.dist/esm/.mion/types/A0Qb_pJ9XvFm.js.map +1 -0
  51. package/.dist/esm/.mion/types/A0Qb_pWBRJYE.js +22 -0
  52. package/.dist/esm/.mion/types/A0Qb_pWBRJYE.js.map +1 -0
  53. package/.dist/esm/.mion/types/A0Qb_qatpo1O.js +27 -0
  54. package/.dist/esm/.mion/types/A0Qb_qatpo1O.js.map +1 -0
  55. package/.dist/esm/.mion/types/A0Qb_qxw8aWP.js +43 -0
  56. package/.dist/esm/.mion/types/A0Qb_qxw8aWP.js.map +1 -0
  57. package/.dist/esm/.mion/types/A0Qb_ujMZYNY.js +29 -0
  58. package/.dist/esm/.mion/types/A0Qb_ujMZYNY.js.map +1 -0
  59. package/.dist/esm/.mion/types/A0Qb_vIbt7K7.js +25 -0
  60. package/.dist/esm/.mion/types/A0Qb_vIbt7K7.js.map +1 -0
  61. package/.dist/esm/.mion/types/A0Qb_vMVZ77w.js +29 -0
  62. package/.dist/esm/.mion/types/A0Qb_vMVZ77w.js.map +1 -0
  63. package/.dist/esm/.mion/types/Eq2V_EkYSHqf.js +31 -0
  64. package/.dist/esm/.mion/types/Eq2V_EkYSHqf.js.map +1 -0
  65. package/.dist/esm/.mion/types/Eq2V_GVXB1Wo.js +22 -0
  66. package/.dist/esm/.mion/types/Eq2V_GVXB1Wo.js.map +1 -0
  67. package/.dist/esm/.mion/types/Eq2V_HvnlLnd.js +39 -0
  68. package/.dist/esm/.mion/types/Eq2V_HvnlLnd.js.map +1 -0
  69. package/.dist/esm/.mion/types/Eq2V_JTXvy7Y.js +24 -0
  70. package/.dist/esm/.mion/types/Eq2V_JTXvy7Y.js.map +1 -0
  71. package/.dist/esm/.mion/types/Eq2V_JkwVz03.js +39 -0
  72. package/.dist/esm/.mion/types/Eq2V_JkwVz03.js.map +1 -0
  73. package/.dist/esm/.mion/types/Eq2V_KYXJdoi.js +41 -0
  74. package/.dist/esm/.mion/types/Eq2V_KYXJdoi.js.map +1 -0
  75. package/.dist/esm/.mion/types/Eq2V_L7TAwqn.js +41 -0
  76. package/.dist/esm/.mion/types/Eq2V_L7TAwqn.js.map +1 -0
  77. package/.dist/esm/.mion/types/Eq2V_P05N010.js +31 -0
  78. package/.dist/esm/.mion/types/Eq2V_P05N010.js.map +1 -0
  79. package/.dist/esm/.mion/types/Eq2V_R2waGIJ.js +24 -0
  80. package/.dist/esm/.mion/types/Eq2V_R2waGIJ.js.map +1 -0
  81. package/.dist/esm/.mion/types/Eq2V_UGPHsHZ.js +26 -0
  82. package/.dist/esm/.mion/types/Eq2V_UGPHsHZ.js.map +1 -0
  83. package/.dist/esm/.mion/types/Eq2V_VMxJugF.js +31 -0
  84. package/.dist/esm/.mion/types/Eq2V_VMxJugF.js.map +1 -0
  85. package/.dist/esm/.mion/types/Eq2V_VuzVN13.js +24 -0
  86. package/.dist/esm/.mion/types/Eq2V_VuzVN13.js.map +1 -0
  87. package/.dist/esm/.mion/types/Eq2V_WaXzp6u.js +31 -0
  88. package/.dist/esm/.mion/types/Eq2V_WaXzp6u.js.map +1 -0
  89. package/.dist/esm/.mion/types/Eq2V_cIwQaiK.js +24 -0
  90. package/.dist/esm/.mion/types/Eq2V_cIwQaiK.js.map +1 -0
  91. package/.dist/esm/.mion/types/Eq2V_ddv0QYt.js +26 -0
  92. package/.dist/esm/.mion/types/Eq2V_ddv0QYt.js.map +1 -0
  93. package/.dist/esm/.mion/types/Eq2V_fjaxPpO.js +32 -0
  94. package/.dist/esm/.mion/types/Eq2V_fjaxPpO.js.map +1 -0
  95. package/.dist/esm/.mion/types/Eq2V_hnO6xA5.js +24 -0
  96. package/.dist/esm/.mion/types/Eq2V_hnO6xA5.js.map +1 -0
  97. package/.dist/esm/.mion/types/Eq2V_pJ9XvFm.js +24 -0
  98. package/.dist/esm/.mion/types/Eq2V_pJ9XvFm.js.map +1 -0
  99. package/.dist/esm/.mion/types/Eq2V_pWBRJYE.js +22 -0
  100. package/.dist/esm/.mion/types/Eq2V_pWBRJYE.js.map +1 -0
  101. package/.dist/esm/.mion/types/Eq2V_qatpo1O.js +29 -0
  102. package/.dist/esm/.mion/types/Eq2V_qatpo1O.js.map +1 -0
  103. package/.dist/esm/.mion/types/Eq2V_qxw8aWP.js +24 -0
  104. package/.dist/esm/.mion/types/Eq2V_qxw8aWP.js.map +1 -0
  105. package/.dist/esm/.mion/types/Eq2V_vIbt7K7.js +27 -0
  106. package/.dist/esm/.mion/types/Eq2V_vIbt7K7.js.map +1 -0
  107. package/.dist/esm/.mion/types/Eq2V_vMVZ77w.js +31 -0
  108. package/.dist/esm/.mion/types/Eq2V_vMVZ77w.js.map +1 -0
  109. package/.dist/esm/.mion/types/Ky89_CXFfAul.js +64 -0
  110. package/.dist/esm/.mion/types/Ky89_CXFfAul.js.map +1 -0
  111. package/.dist/esm/.mion/types/Ky89_EkYSHqf.js +28 -0
  112. package/.dist/esm/.mion/types/Ky89_EkYSHqf.js.map +1 -0
  113. package/.dist/esm/.mion/types/Ky89_HvnlLnd.js +42 -0
  114. package/.dist/esm/.mion/types/Ky89_HvnlLnd.js.map +1 -0
  115. package/.dist/esm/.mion/types/Ky89_JTXvy7Y.js +64 -0
  116. package/.dist/esm/.mion/types/Ky89_JTXvy7Y.js.map +1 -0
  117. package/.dist/esm/.mion/types/Ky89_JkwVz03.js +37 -0
  118. package/.dist/esm/.mion/types/Ky89_JkwVz03.js.map +1 -0
  119. package/.dist/esm/.mion/types/Ky89_Ju6MvJU.js +14 -0
  120. package/.dist/esm/.mion/types/Ky89_Ju6MvJU.js.map +1 -0
  121. package/.dist/esm/.mion/types/Ky89_KYXJdoi.js +47 -0
  122. package/.dist/esm/.mion/types/Ky89_KYXJdoi.js.map +1 -0
  123. package/.dist/esm/.mion/types/Ky89_L7TAwqn.js +53 -0
  124. package/.dist/esm/.mion/types/Ky89_L7TAwqn.js.map +1 -0
  125. package/.dist/esm/.mion/types/Ky89_NXjo9wB.js +51 -0
  126. package/.dist/esm/.mion/types/Ky89_NXjo9wB.js.map +1 -0
  127. package/.dist/esm/.mion/types/Ky89_P05N010.js +35 -0
  128. package/.dist/esm/.mion/types/Ky89_P05N010.js.map +1 -0
  129. package/.dist/esm/.mion/types/Ky89_R2waGIJ.js +64 -0
  130. package/.dist/esm/.mion/types/Ky89_R2waGIJ.js.map +1 -0
  131. package/.dist/esm/.mion/types/Ky89_UE6lPE3.js +25 -0
  132. package/.dist/esm/.mion/types/Ky89_UE6lPE3.js.map +1 -0
  133. package/.dist/esm/.mion/types/Ky89_UGPHsHZ.js +28 -0
  134. package/.dist/esm/.mion/types/Ky89_UGPHsHZ.js.map +1 -0
  135. package/.dist/esm/.mion/types/Ky89_VMxJugF.js +28 -0
  136. package/.dist/esm/.mion/types/Ky89_VMxJugF.js.map +1 -0
  137. package/.dist/esm/.mion/types/Ky89_VuzVN13.js +64 -0
  138. package/.dist/esm/.mion/types/Ky89_VuzVN13.js.map +1 -0
  139. package/.dist/esm/.mion/types/Ky89_WaXzp6u.js +27 -0
  140. package/.dist/esm/.mion/types/Ky89_WaXzp6u.js.map +1 -0
  141. package/.dist/esm/.mion/types/Ky89_b8JOgtl.js +32 -0
  142. package/.dist/esm/.mion/types/Ky89_b8JOgtl.js.map +1 -0
  143. package/.dist/esm/.mion/types/Ky89_bWgCH09.js +26 -0
  144. package/.dist/esm/.mion/types/Ky89_bWgCH09.js.map +1 -0
  145. package/.dist/esm/.mion/types/Ky89_cIwQaiK.js +64 -0
  146. package/.dist/esm/.mion/types/Ky89_cIwQaiK.js.map +1 -0
  147. package/.dist/esm/.mion/types/Ky89_ddv0QYt.js +23 -0
  148. package/.dist/esm/.mion/types/Ky89_ddv0QYt.js.map +1 -0
  149. package/.dist/esm/.mion/types/Ky89_fjaxPpO.js +30 -0
  150. package/.dist/esm/.mion/types/Ky89_fjaxPpO.js.map +1 -0
  151. package/.dist/esm/.mion/types/Ky89_hnO6xA5.js +64 -0
  152. package/.dist/esm/.mion/types/Ky89_hnO6xA5.js.map +1 -0
  153. package/.dist/esm/.mion/types/Ky89_jMcsHAh.js +63 -0
  154. package/.dist/esm/.mion/types/Ky89_jMcsHAh.js.map +1 -0
  155. package/.dist/esm/.mion/types/Ky89_pJ9XvFm.js +64 -0
  156. package/.dist/esm/.mion/types/Ky89_pJ9XvFm.js.map +1 -0
  157. package/.dist/esm/.mion/types/Ky89_qatpo1O.js +33 -0
  158. package/.dist/esm/.mion/types/Ky89_qatpo1O.js.map +1 -0
  159. package/.dist/esm/.mion/types/Ky89_qxw8aWP.js +64 -0
  160. package/.dist/esm/.mion/types/Ky89_qxw8aWP.js.map +1 -0
  161. package/.dist/esm/.mion/types/Ky89_ujMZYNY.js +28 -0
  162. package/.dist/esm/.mion/types/Ky89_ujMZYNY.js.map +1 -0
  163. package/.dist/esm/.mion/types/Ky89_vIbt7K7.js +28 -0
  164. package/.dist/esm/.mion/types/Ky89_vIbt7K7.js.map +1 -0
  165. package/.dist/esm/.mion/types/Ky89_vMVZ77w.js +28 -0
  166. package/.dist/esm/.mion/types/Ky89_vMVZ77w.js.map +1 -0
  167. package/.dist/esm/.mion/types/OBOg_CXFfAul.js +57 -0
  168. package/.dist/esm/.mion/types/OBOg_CXFfAul.js.map +1 -0
  169. package/.dist/esm/.mion/types/OBOg_Ju6MvJU.js +25 -0
  170. package/.dist/esm/.mion/types/OBOg_Ju6MvJU.js.map +1 -0
  171. package/.dist/esm/.mion/types/OBOg_K9zElfi.js +27 -0
  172. package/.dist/esm/.mion/types/OBOg_K9zElfi.js.map +1 -0
  173. package/.dist/esm/.mion/types/OBOg_NXjo9wB.js +27 -0
  174. package/.dist/esm/.mion/types/OBOg_NXjo9wB.js.map +1 -0
  175. package/.dist/esm/.mion/types/OBOg_UE6lPE3.js +29 -0
  176. package/.dist/esm/.mion/types/OBOg_UE6lPE3.js.map +1 -0
  177. package/.dist/esm/.mion/types/OBOg_b8JOgtl.js +27 -0
  178. package/.dist/esm/.mion/types/OBOg_b8JOgtl.js.map +1 -0
  179. package/.dist/esm/.mion/types/OBOg_bWgCH09.js +34 -0
  180. package/.dist/esm/.mion/types/OBOg_bWgCH09.js.map +1 -0
  181. package/.dist/esm/.mion/types/OBOg_ddv0QYt.js +25 -0
  182. package/.dist/esm/.mion/types/OBOg_ddv0QYt.js.map +1 -0
  183. package/.dist/esm/.mion/types/OBOg_jMcsHAh.js +27 -0
  184. package/.dist/esm/.mion/types/OBOg_jMcsHAh.js.map +1 -0
  185. package/.dist/esm/.mion/types/OBOg_ujMZYNY.js +34 -0
  186. package/.dist/esm/.mion/types/OBOg_ujMZYNY.js.map +1 -0
  187. package/.dist/esm/.mion/types/Xhuv_CXFfAul.js +24 -0
  188. package/.dist/esm/.mion/types/Xhuv_CXFfAul.js.map +1 -0
  189. package/.dist/esm/.mion/types/Xhuv_EkYSHqf.js +31 -0
  190. package/.dist/esm/.mion/types/Xhuv_EkYSHqf.js.map +1 -0
  191. package/.dist/esm/.mion/types/Xhuv_GVXB1Wo.js +22 -0
  192. package/.dist/esm/.mion/types/Xhuv_GVXB1Wo.js.map +1 -0
  193. package/.dist/esm/.mion/types/Xhuv_HvnlLnd.js +39 -0
  194. package/.dist/esm/.mion/types/Xhuv_HvnlLnd.js.map +1 -0
  195. package/.dist/esm/.mion/types/Xhuv_JTXvy7Y.js +24 -0
  196. package/.dist/esm/.mion/types/Xhuv_JTXvy7Y.js.map +1 -0
  197. package/.dist/esm/.mion/types/Xhuv_JkwVz03.js +39 -0
  198. package/.dist/esm/.mion/types/Xhuv_JkwVz03.js.map +1 -0
  199. package/.dist/esm/.mion/types/Xhuv_Ju6MvJU.js +22 -0
  200. package/.dist/esm/.mion/types/Xhuv_Ju6MvJU.js.map +1 -0
  201. package/.dist/esm/.mion/types/Xhuv_K9zElfi.js +22 -0
  202. package/.dist/esm/.mion/types/Xhuv_K9zElfi.js.map +1 -0
  203. package/.dist/esm/.mion/types/Xhuv_KYXJdoi.js +41 -0
  204. package/.dist/esm/.mion/types/Xhuv_KYXJdoi.js.map +1 -0
  205. package/.dist/esm/.mion/types/Xhuv_L7TAwqn.js +41 -0
  206. package/.dist/esm/.mion/types/Xhuv_L7TAwqn.js.map +1 -0
  207. package/.dist/esm/.mion/types/Xhuv_NXjo9wB.js +95 -0
  208. package/.dist/esm/.mion/types/Xhuv_NXjo9wB.js.map +1 -0
  209. package/.dist/esm/.mion/types/Xhuv_P05N010.js +31 -0
  210. package/.dist/esm/.mion/types/Xhuv_P05N010.js.map +1 -0
  211. package/.dist/esm/.mion/types/Xhuv_R2waGIJ.js +24 -0
  212. package/.dist/esm/.mion/types/Xhuv_R2waGIJ.js.map +1 -0
  213. package/.dist/esm/.mion/types/Xhuv_UE6lPE3.js +30 -0
  214. package/.dist/esm/.mion/types/Xhuv_UE6lPE3.js.map +1 -0
  215. package/.dist/esm/.mion/types/Xhuv_UGPHsHZ.js +26 -0
  216. package/.dist/esm/.mion/types/Xhuv_UGPHsHZ.js.map +1 -0
  217. package/.dist/esm/.mion/types/Xhuv_VMxJugF.js +31 -0
  218. package/.dist/esm/.mion/types/Xhuv_VMxJugF.js.map +1 -0
  219. package/.dist/esm/.mion/types/Xhuv_VuzVN13.js +24 -0
  220. package/.dist/esm/.mion/types/Xhuv_VuzVN13.js.map +1 -0
  221. package/.dist/esm/.mion/types/Xhuv_WaXzp6u.js +31 -0
  222. package/.dist/esm/.mion/types/Xhuv_WaXzp6u.js.map +1 -0
  223. package/.dist/esm/.mion/types/Xhuv_b0EmsPZ.js +22 -0
  224. package/.dist/esm/.mion/types/Xhuv_b0EmsPZ.js.map +1 -0
  225. package/.dist/esm/.mion/types/Xhuv_b8JOgtl.js +24 -0
  226. package/.dist/esm/.mion/types/Xhuv_b8JOgtl.js.map +1 -0
  227. package/.dist/esm/.mion/types/Xhuv_bWgCH09.js +33 -0
  228. package/.dist/esm/.mion/types/Xhuv_bWgCH09.js.map +1 -0
  229. package/.dist/esm/.mion/types/Xhuv_cIwQaiK.js +24 -0
  230. package/.dist/esm/.mion/types/Xhuv_cIwQaiK.js.map +1 -0
  231. package/.dist/esm/.mion/types/Xhuv_ddv0QYt.js +26 -0
  232. package/.dist/esm/.mion/types/Xhuv_ddv0QYt.js.map +1 -0
  233. package/.dist/esm/.mion/types/Xhuv_fjaxPpO.js +32 -0
  234. package/.dist/esm/.mion/types/Xhuv_fjaxPpO.js.map +1 -0
  235. package/.dist/esm/.mion/types/Xhuv_hnO6xA5.js +24 -0
  236. package/.dist/esm/.mion/types/Xhuv_hnO6xA5.js.map +1 -0
  237. package/.dist/esm/.mion/types/Xhuv_jMcsHAh.js +71 -0
  238. package/.dist/esm/.mion/types/Xhuv_jMcsHAh.js.map +1 -0
  239. package/.dist/esm/.mion/types/Xhuv_pJ9XvFm.js +24 -0
  240. package/.dist/esm/.mion/types/Xhuv_pJ9XvFm.js.map +1 -0
  241. package/.dist/esm/.mion/types/Xhuv_pWBRJYE.js +22 -0
  242. package/.dist/esm/.mion/types/Xhuv_pWBRJYE.js.map +1 -0
  243. package/.dist/esm/.mion/types/Xhuv_qatpo1O.js +29 -0
  244. package/.dist/esm/.mion/types/Xhuv_qatpo1O.js.map +1 -0
  245. package/.dist/esm/.mion/types/Xhuv_qxw8aWP.js +24 -0
  246. package/.dist/esm/.mion/types/Xhuv_qxw8aWP.js.map +1 -0
  247. package/.dist/esm/.mion/types/Xhuv_ujMZYNY.js +31 -0
  248. package/.dist/esm/.mion/types/Xhuv_ujMZYNY.js.map +1 -0
  249. package/.dist/esm/.mion/types/Xhuv_vIbt7K7.js +27 -0
  250. package/.dist/esm/.mion/types/Xhuv_vIbt7K7.js.map +1 -0
  251. package/.dist/esm/.mion/types/Xhuv_vMVZ77w.js +31 -0
  252. package/.dist/esm/.mion/types/Xhuv_vMVZ77w.js.map +1 -0
  253. package/.dist/esm/.mion/types/mzca_Ju6MvJU.js +14 -0
  254. package/.dist/esm/.mion/types/mzca_Ju6MvJU.js.map +1 -0
  255. package/.dist/esm/.mion/types/mzca_UE6lPE3.js +14 -0
  256. package/.dist/esm/.mion/types/mzca_UE6lPE3.js.map +1 -0
  257. package/.dist/esm/.mion/types/mzca_bWgCH09.js +14 -0
  258. package/.dist/esm/.mion/types/mzca_bWgCH09.js.map +1 -0
  259. package/.dist/esm/.mion/types/pf/_rt/_abcB3do2M.js +23 -0
  260. package/.dist/esm/.mion/types/pf/_rt/_abcB3do2M.js.map +1 -0
  261. package/.dist/esm/.mion/types/pf/_rt/tfRjnFZVF8.js +27 -0
  262. package/.dist/esm/.mion/types/pf/_rt/tfRjnFZVF8.js.map +1 -0
  263. package/.dist/esm/.mion/types/rt/C7ezVBCtGn.js +192 -187
  264. package/.dist/esm/.mion/types/rt/C7ezVBCtGn.js.map +1 -1
  265. package/.dist/esm/.mion/types/rt/KjC1OsUQp4.js +1207 -0
  266. package/.dist/esm/.mion/types/rt/KjC1OsUQp4.js.map +1 -0
  267. package/.dist/esm/.mion/types/rt/VIdAjpHu1X.js +183 -184
  268. package/.dist/esm/.mion/types/rt/VIdAjpHu1X.js.map +1 -1
  269. package/.dist/esm/.mion/types/rt/eF4wQzU6Fd.js +332 -326
  270. package/.dist/esm/.mion/types/rt/eF4wQzU6Fd.js.map +1 -1
  271. package/.dist/esm/.mion/types/rt/shared/{X6LLuPu8LB.js → EjfwjaotqB.js} +169 -153
  272. package/.dist/esm/.mion/types/rt/shared/EjfwjaotqB.js.map +1 -0
  273. package/.dist/esm/.mion/types/rt/shared/lhgmFrJdOO.js +278 -0
  274. package/.dist/esm/.mion/types/rt/shared/lhgmFrJdOO.js.map +1 -0
  275. package/.dist/esm/.mion/types/rt/shared/{b3OCOIQ3Az.js → nJOmbxLb37.js} +474 -610
  276. package/.dist/esm/.mion/types/rt/shared/nJOmbxLb37.js.map +1 -0
  277. package/.dist/esm/index.d.ts +1 -1
  278. package/.dist/esm/index.js +7 -7
  279. package/.dist/esm/middlewares.d.ts +1 -0
  280. package/.dist/esm/middlewares.js +2 -1
  281. package/.dist/esm/src/batches.js +3 -3
  282. package/.dist/esm/src/batches.js.map +1 -1
  283. package/.dist/esm/src/callContext.d.ts +3 -3
  284. package/.dist/esm/src/callContext.js +7 -5
  285. package/.dist/esm/src/callContext.js.map +1 -1
  286. package/.dist/esm/src/constants.d.ts +1 -0
  287. package/.dist/esm/src/constants.js +5 -3
  288. package/.dist/esm/src/constants.js.map +1 -1
  289. package/.dist/esm/src/dispatch.d.ts +3 -3
  290. package/.dist/esm/src/dispatch.js +10 -8
  291. package/.dist/esm/src/dispatch.js.map +1 -1
  292. package/.dist/esm/src/lib/dispatchError.d.ts +2 -1
  293. package/.dist/esm/src/lib/dispatchError.js +11 -2
  294. package/.dist/esm/src/lib/dispatchError.js.map +1 -1
  295. package/.dist/esm/src/lib/handlers.d.ts +3 -3
  296. package/.dist/esm/src/lib/handlers.js.map +1 -1
  297. package/.dist/esm/src/lib/headers.d.ts +2 -0
  298. package/.dist/esm/src/lib/headers.js +19 -1
  299. package/.dist/esm/src/lib/headers.js.map +1 -1
  300. package/.dist/esm/src/lib/httpMethod.d.ts +3 -0
  301. package/.dist/esm/src/lib/httpMethod.js +21 -0
  302. package/.dist/esm/src/lib/httpMethod.js.map +1 -0
  303. package/.dist/esm/src/lib/queryBody.d.ts +1 -6
  304. package/.dist/esm/src/lib/queryBody.js +4 -7
  305. package/.dist/esm/src/lib/queryBody.js.map +1 -1
  306. package/.dist/esm/src/lib/reflection.js +4 -4
  307. package/.dist/esm/src/lib/reflection.js.map +1 -1
  308. package/.dist/esm/src/lib/remoteMethods.js +2 -2
  309. package/.dist/esm/src/lib/remoteMethods.js.map +1 -1
  310. package/.dist/esm/src/middlewares/fetchMetadata.js +20 -20
  311. package/.dist/esm/src/middlewares/security.d.ts +9 -0
  312. package/.dist/esm/src/middlewares/security.js +213 -0
  313. package/.dist/esm/src/middlewares/security.js.map +1 -0
  314. package/.dist/esm/src/middlewares/syncRoutes.js +20 -20
  315. package/.dist/esm/src/router.d.ts +8 -6
  316. package/.dist/esm/src/router.js +40 -29
  317. package/.dist/esm/src/router.js.map +1 -1
  318. package/.dist/esm/src/routes/errors.routes.js +34 -34
  319. package/.dist/esm/src/routes/serializer.routes.js +13 -2
  320. package/.dist/esm/src/routes/serializer.routes.js.map +1 -1
  321. package/.dist/esm/src/types/context.d.ts +6 -3
  322. package/.dist/esm/src/types/definitions.d.ts +5 -3
  323. package/.dist/esm/src/types/general.d.ts +24 -5
  324. package/.dist/esm/src/types/guards.d.ts +2 -6
  325. package/.dist/esm/src/types/guards.js +1 -13
  326. package/.dist/esm/src/types/guards.js.map +1 -1
  327. package/.dist/esm/src/types/mionRouter.d.ts +67 -22
  328. package/.dist/esm/src/types/publicMethods.d.ts +4 -5
  329. package/.dist/esm/src/types/resolvedOptions.d.ts +11 -2
  330. package/package.json +6 -6
  331. package/.dist/cjs/.mion/types/A0Qb_EtDWACB.cjs +0 -16
  332. package/.dist/cjs/.mion/types/A0Qb_EtDWACB.cjs.map +0 -1
  333. package/.dist/cjs/.mion/types/A0Qb_FSFQzFT.cjs +0 -17
  334. package/.dist/cjs/.mion/types/A0Qb_FSFQzFT.cjs.map +0 -1
  335. package/.dist/cjs/.mion/types/A0Qb_IJpcjGV.cjs +0 -16
  336. package/.dist/cjs/.mion/types/A0Qb_IJpcjGV.cjs.map +0 -1
  337. package/.dist/cjs/.mion/types/A0Qb_IugtMk3.cjs +0 -14
  338. package/.dist/cjs/.mion/types/A0Qb_IugtMk3.cjs.map +0 -1
  339. package/.dist/cjs/.mion/types/A0Qb_JmyrGf9.cjs +0 -13
  340. package/.dist/cjs/.mion/types/A0Qb_JmyrGf9.cjs.map +0 -1
  341. package/.dist/cjs/.mion/types/A0Qb_KW2BeGf.cjs +0 -13
  342. package/.dist/cjs/.mion/types/A0Qb_KW2BeGf.cjs.map +0 -1
  343. package/.dist/cjs/.mion/types/A0Qb_N4upY9e.cjs +0 -14
  344. package/.dist/cjs/.mion/types/A0Qb_N4upY9e.cjs.map +0 -1
  345. package/.dist/cjs/.mion/types/A0Qb_NpYuWjf.cjs +0 -16
  346. package/.dist/cjs/.mion/types/A0Qb_NpYuWjf.cjs.map +0 -1
  347. package/.dist/cjs/.mion/types/A0Qb_PGJvDQM.cjs +0 -16
  348. package/.dist/cjs/.mion/types/A0Qb_PGJvDQM.cjs.map +0 -1
  349. package/.dist/cjs/.mion/types/A0Qb_SJBMH8X.cjs +0 -16
  350. package/.dist/cjs/.mion/types/A0Qb_SJBMH8X.cjs.map +0 -1
  351. package/.dist/cjs/.mion/types/A0Qb_SW6Ke6X.cjs +0 -26
  352. package/.dist/cjs/.mion/types/A0Qb_SW6Ke6X.cjs.map +0 -1
  353. package/.dist/cjs/.mion/types/A0Qb_UM4R4B0.cjs +0 -16
  354. package/.dist/cjs/.mion/types/A0Qb_UM4R4B0.cjs.map +0 -1
  355. package/.dist/cjs/.mion/types/A0Qb_VU2j3Ds.cjs +0 -16
  356. package/.dist/cjs/.mion/types/A0Qb_VU2j3Ds.cjs.map +0 -1
  357. package/.dist/cjs/.mion/types/A0Qb_WIhjWe9.cjs +0 -13
  358. package/.dist/cjs/.mion/types/A0Qb_WIhjWe9.cjs.map +0 -1
  359. package/.dist/cjs/.mion/types/A0Qb_ZRJiRyT.cjs +0 -13
  360. package/.dist/cjs/.mion/types/A0Qb_ZRJiRyT.cjs.map +0 -1
  361. package/.dist/cjs/.mion/types/A0Qb_Zdevfid.cjs +0 -16
  362. package/.dist/cjs/.mion/types/A0Qb_Zdevfid.cjs.map +0 -1
  363. package/.dist/cjs/.mion/types/A0Qb_cCmjzQr.cjs +0 -36
  364. package/.dist/cjs/.mion/types/A0Qb_cCmjzQr.cjs.map +0 -1
  365. package/.dist/cjs/.mion/types/A0Qb_dbzlcVY.cjs +0 -16
  366. package/.dist/cjs/.mion/types/A0Qb_dbzlcVY.cjs.map +0 -1
  367. package/.dist/cjs/.mion/types/A0Qb_fzrXFOz.cjs +0 -16
  368. package/.dist/cjs/.mion/types/A0Qb_fzrXFOz.cjs.map +0 -1
  369. package/.dist/cjs/.mion/types/A0Qb_il6MWfT.cjs +0 -16
  370. package/.dist/cjs/.mion/types/A0Qb_il6MWfT.cjs.map +0 -1
  371. package/.dist/cjs/.mion/types/A0Qb_kuE24Ar.cjs +0 -13
  372. package/.dist/cjs/.mion/types/A0Qb_kuE24Ar.cjs.map +0 -1
  373. package/.dist/cjs/.mion/types/A0Qb_od0j6kO.cjs +0 -16
  374. package/.dist/cjs/.mion/types/A0Qb_od0j6kO.cjs.map +0 -1
  375. package/.dist/cjs/.mion/types/A0Qb_uz6TmiD.cjs +0 -17
  376. package/.dist/cjs/.mion/types/A0Qb_uz6TmiD.cjs.map +0 -1
  377. package/.dist/cjs/.mion/types/A0Qb_vDX1rqR.cjs +0 -13
  378. package/.dist/cjs/.mion/types/A0Qb_vDX1rqR.cjs.map +0 -1
  379. package/.dist/cjs/.mion/types/A0Qb_vei3XnC.cjs +0 -17
  380. package/.dist/cjs/.mion/types/A0Qb_vei3XnC.cjs.map +0 -1
  381. package/.dist/cjs/.mion/types/A0Qb_vtuQRKM.cjs +0 -14
  382. package/.dist/cjs/.mion/types/A0Qb_vtuQRKM.cjs.map +0 -1
  383. package/.dist/cjs/.mion/types/Eq2V_EtDWACB.cjs +0 -16
  384. package/.dist/cjs/.mion/types/Eq2V_EtDWACB.cjs.map +0 -1
  385. package/.dist/cjs/.mion/types/Eq2V_IJpcjGV.cjs +0 -16
  386. package/.dist/cjs/.mion/types/Eq2V_IJpcjGV.cjs.map +0 -1
  387. package/.dist/cjs/.mion/types/Eq2V_JmyrGf9.cjs +0 -13
  388. package/.dist/cjs/.mion/types/Eq2V_JmyrGf9.cjs.map +0 -1
  389. package/.dist/cjs/.mion/types/Eq2V_KW2BeGf.cjs +0 -13
  390. package/.dist/cjs/.mion/types/Eq2V_KW2BeGf.cjs.map +0 -1
  391. package/.dist/cjs/.mion/types/Eq2V_NpYuWjf.cjs +0 -16
  392. package/.dist/cjs/.mion/types/Eq2V_NpYuWjf.cjs.map +0 -1
  393. package/.dist/cjs/.mion/types/Eq2V_SJBMH8X.cjs +0 -16
  394. package/.dist/cjs/.mion/types/Eq2V_SJBMH8X.cjs.map +0 -1
  395. package/.dist/cjs/.mion/types/Eq2V_SW6Ke6X.cjs +0 -26
  396. package/.dist/cjs/.mion/types/Eq2V_SW6Ke6X.cjs.map +0 -1
  397. package/.dist/cjs/.mion/types/Eq2V_VU2j3Ds.cjs +0 -16
  398. package/.dist/cjs/.mion/types/Eq2V_VU2j3Ds.cjs.map +0 -1
  399. package/.dist/cjs/.mion/types/Eq2V_WIhjWe9.cjs +0 -13
  400. package/.dist/cjs/.mion/types/Eq2V_WIhjWe9.cjs.map +0 -1
  401. package/.dist/cjs/.mion/types/Eq2V_ZRJiRyT.cjs +0 -13
  402. package/.dist/cjs/.mion/types/Eq2V_ZRJiRyT.cjs.map +0 -1
  403. package/.dist/cjs/.mion/types/Eq2V_Zdevfid.cjs +0 -16
  404. package/.dist/cjs/.mion/types/Eq2V_Zdevfid.cjs.map +0 -1
  405. package/.dist/cjs/.mion/types/Eq2V_dbzlcVY.cjs +0 -16
  406. package/.dist/cjs/.mion/types/Eq2V_dbzlcVY.cjs.map +0 -1
  407. package/.dist/cjs/.mion/types/Eq2V_fzrXFOz.cjs +0 -16
  408. package/.dist/cjs/.mion/types/Eq2V_fzrXFOz.cjs.map +0 -1
  409. package/.dist/cjs/.mion/types/Eq2V_il6MWfT.cjs +0 -16
  410. package/.dist/cjs/.mion/types/Eq2V_il6MWfT.cjs.map +0 -1
  411. package/.dist/cjs/.mion/types/Eq2V_kuE24Ar.cjs +0 -13
  412. package/.dist/cjs/.mion/types/Eq2V_kuE24Ar.cjs.map +0 -1
  413. package/.dist/cjs/.mion/types/Eq2V_od0j6kO.cjs +0 -16
  414. package/.dist/cjs/.mion/types/Eq2V_od0j6kO.cjs.map +0 -1
  415. package/.dist/cjs/.mion/types/Eq2V_uz6TmiD.cjs +0 -17
  416. package/.dist/cjs/.mion/types/Eq2V_uz6TmiD.cjs.map +0 -1
  417. package/.dist/cjs/.mion/types/Eq2V_vDX1rqR.cjs +0 -13
  418. package/.dist/cjs/.mion/types/Eq2V_vDX1rqR.cjs.map +0 -1
  419. package/.dist/cjs/.mion/types/Eq2V_vei3XnC.cjs +0 -17
  420. package/.dist/cjs/.mion/types/Eq2V_vei3XnC.cjs.map +0 -1
  421. package/.dist/cjs/.mion/types/Ky89_EtDWACB.cjs +0 -16
  422. package/.dist/cjs/.mion/types/Ky89_EtDWACB.cjs.map +0 -1
  423. package/.dist/cjs/.mion/types/Ky89_FSFQzFT.cjs +0 -16
  424. package/.dist/cjs/.mion/types/Ky89_FSFQzFT.cjs.map +0 -1
  425. package/.dist/cjs/.mion/types/Ky89_IJpcjGV.cjs +0 -16
  426. package/.dist/cjs/.mion/types/Ky89_IJpcjGV.cjs.map +0 -1
  427. package/.dist/cjs/.mion/types/Ky89_IugtMk3.cjs +0 -14
  428. package/.dist/cjs/.mion/types/Ky89_IugtMk3.cjs.map +0 -1
  429. package/.dist/cjs/.mion/types/Ky89_JmyrGf9.cjs +0 -13
  430. package/.dist/cjs/.mion/types/Ky89_JmyrGf9.cjs.map +0 -1
  431. package/.dist/cjs/.mion/types/Ky89_KW2BeGf.cjs +0 -13
  432. package/.dist/cjs/.mion/types/Ky89_KW2BeGf.cjs.map +0 -1
  433. package/.dist/cjs/.mion/types/Ky89_N4upY9e.cjs +0 -13
  434. package/.dist/cjs/.mion/types/Ky89_N4upY9e.cjs.map +0 -1
  435. package/.dist/cjs/.mion/types/Ky89_NpYuWjf.cjs +0 -16
  436. package/.dist/cjs/.mion/types/Ky89_NpYuWjf.cjs.map +0 -1
  437. package/.dist/cjs/.mion/types/Ky89_PGJvDQM.cjs +0 -16
  438. package/.dist/cjs/.mion/types/Ky89_PGJvDQM.cjs.map +0 -1
  439. package/.dist/cjs/.mion/types/Ky89_SJBMH8X.cjs +0 -16
  440. package/.dist/cjs/.mion/types/Ky89_SJBMH8X.cjs.map +0 -1
  441. package/.dist/cjs/.mion/types/Ky89_SW6Ke6X.cjs +0 -26
  442. package/.dist/cjs/.mion/types/Ky89_SW6Ke6X.cjs.map +0 -1
  443. package/.dist/cjs/.mion/types/Ky89_UM4R4B0.cjs +0 -16
  444. package/.dist/cjs/.mion/types/Ky89_UM4R4B0.cjs.map +0 -1
  445. package/.dist/cjs/.mion/types/Ky89_VU2j3Ds.cjs +0 -16
  446. package/.dist/cjs/.mion/types/Ky89_VU2j3Ds.cjs.map +0 -1
  447. package/.dist/cjs/.mion/types/Ky89_Zdevfid.cjs +0 -16
  448. package/.dist/cjs/.mion/types/Ky89_Zdevfid.cjs.map +0 -1
  449. package/.dist/cjs/.mion/types/Ky89_cCmjzQr.cjs +0 -32
  450. package/.dist/cjs/.mion/types/Ky89_cCmjzQr.cjs.map +0 -1
  451. package/.dist/cjs/.mion/types/Ky89_dbzlcVY.cjs +0 -16
  452. package/.dist/cjs/.mion/types/Ky89_dbzlcVY.cjs.map +0 -1
  453. package/.dist/cjs/.mion/types/Ky89_fzrXFOz.cjs +0 -16
  454. package/.dist/cjs/.mion/types/Ky89_fzrXFOz.cjs.map +0 -1
  455. package/.dist/cjs/.mion/types/Ky89_il6MWfT.cjs +0 -16
  456. package/.dist/cjs/.mion/types/Ky89_il6MWfT.cjs.map +0 -1
  457. package/.dist/cjs/.mion/types/Ky89_kuE24Ar.cjs +0 -13
  458. package/.dist/cjs/.mion/types/Ky89_kuE24Ar.cjs.map +0 -1
  459. package/.dist/cjs/.mion/types/Ky89_od0j6kO.cjs +0 -16
  460. package/.dist/cjs/.mion/types/Ky89_od0j6kO.cjs.map +0 -1
  461. package/.dist/cjs/.mion/types/Ky89_uz6TmiD.cjs +0 -13
  462. package/.dist/cjs/.mion/types/Ky89_uz6TmiD.cjs.map +0 -1
  463. package/.dist/cjs/.mion/types/Ky89_vDX1rqR.cjs +0 -13
  464. package/.dist/cjs/.mion/types/Ky89_vDX1rqR.cjs.map +0 -1
  465. package/.dist/cjs/.mion/types/Ky89_vei3XnC.cjs +0 -17
  466. package/.dist/cjs/.mion/types/Ky89_vei3XnC.cjs.map +0 -1
  467. package/.dist/cjs/.mion/types/Ky89_vtuQRKM.cjs +0 -13
  468. package/.dist/cjs/.mion/types/Ky89_vtuQRKM.cjs.map +0 -1
  469. package/.dist/cjs/.mion/types/OBOg_FSFQzFT.cjs +0 -18
  470. package/.dist/cjs/.mion/types/OBOg_FSFQzFT.cjs.map +0 -1
  471. package/.dist/cjs/.mion/types/OBOg_IugtMk3.cjs +0 -17
  472. package/.dist/cjs/.mion/types/OBOg_IugtMk3.cjs.map +0 -1
  473. package/.dist/cjs/.mion/types/OBOg_N4upY9e.cjs +0 -17
  474. package/.dist/cjs/.mion/types/OBOg_N4upY9e.cjs.map +0 -1
  475. package/.dist/cjs/.mion/types/OBOg_PGJvDQM.cjs +0 -18
  476. package/.dist/cjs/.mion/types/OBOg_PGJvDQM.cjs.map +0 -1
  477. package/.dist/cjs/.mion/types/OBOg_TEA76po.cjs +0 -18
  478. package/.dist/cjs/.mion/types/OBOg_TEA76po.cjs.map +0 -1
  479. package/.dist/cjs/.mion/types/OBOg_UM4R4B0.cjs +0 -23
  480. package/.dist/cjs/.mion/types/OBOg_UM4R4B0.cjs.map +0 -1
  481. package/.dist/cjs/.mion/types/OBOg_cCmjzQr.cjs +0 -18
  482. package/.dist/cjs/.mion/types/OBOg_cCmjzQr.cjs.map +0 -1
  483. package/.dist/cjs/.mion/types/OBOg_vDX1rqR.cjs +0 -17
  484. package/.dist/cjs/.mion/types/OBOg_vDX1rqR.cjs.map +0 -1
  485. package/.dist/cjs/.mion/types/OBOg_vtuQRKM.cjs +0 -18
  486. package/.dist/cjs/.mion/types/OBOg_vtuQRKM.cjs.map +0 -1
  487. package/.dist/cjs/.mion/types/Xhuv_EtDWACB.cjs +0 -16
  488. package/.dist/cjs/.mion/types/Xhuv_EtDWACB.cjs.map +0 -1
  489. package/.dist/cjs/.mion/types/Xhuv_FSFQzFT.cjs +0 -16
  490. package/.dist/cjs/.mion/types/Xhuv_FSFQzFT.cjs.map +0 -1
  491. package/.dist/cjs/.mion/types/Xhuv_IJpcjGV.cjs +0 -16
  492. package/.dist/cjs/.mion/types/Xhuv_IJpcjGV.cjs.map +0 -1
  493. package/.dist/cjs/.mion/types/Xhuv_IugtMk3.cjs +0 -13
  494. package/.dist/cjs/.mion/types/Xhuv_IugtMk3.cjs.map +0 -1
  495. package/.dist/cjs/.mion/types/Xhuv_JmyrGf9.cjs +0 -13
  496. package/.dist/cjs/.mion/types/Xhuv_JmyrGf9.cjs.map +0 -1
  497. package/.dist/cjs/.mion/types/Xhuv_KW2BeGf.cjs +0 -13
  498. package/.dist/cjs/.mion/types/Xhuv_KW2BeGf.cjs.map +0 -1
  499. package/.dist/cjs/.mion/types/Xhuv_N4upY9e.cjs +0 -13
  500. package/.dist/cjs/.mion/types/Xhuv_N4upY9e.cjs.map +0 -1
  501. package/.dist/cjs/.mion/types/Xhuv_NpYuWjf.cjs +0 -16
  502. package/.dist/cjs/.mion/types/Xhuv_NpYuWjf.cjs.map +0 -1
  503. package/.dist/cjs/.mion/types/Xhuv_PGJvDQM.cjs +0 -16
  504. package/.dist/cjs/.mion/types/Xhuv_PGJvDQM.cjs.map +0 -1
  505. package/.dist/cjs/.mion/types/Xhuv_SJBMH8X.cjs +0 -16
  506. package/.dist/cjs/.mion/types/Xhuv_SJBMH8X.cjs.map +0 -1
  507. package/.dist/cjs/.mion/types/Xhuv_SW6Ke6X.cjs +0 -26
  508. package/.dist/cjs/.mion/types/Xhuv_SW6Ke6X.cjs.map +0 -1
  509. package/.dist/cjs/.mion/types/Xhuv_TEA76po.cjs +0 -13
  510. package/.dist/cjs/.mion/types/Xhuv_TEA76po.cjs.map +0 -1
  511. package/.dist/cjs/.mion/types/Xhuv_UM4R4B0.cjs +0 -16
  512. package/.dist/cjs/.mion/types/Xhuv_UM4R4B0.cjs.map +0 -1
  513. package/.dist/cjs/.mion/types/Xhuv_VU2j3Ds.cjs +0 -16
  514. package/.dist/cjs/.mion/types/Xhuv_VU2j3Ds.cjs.map +0 -1
  515. package/.dist/cjs/.mion/types/Xhuv_WIhjWe9.cjs +0 -13
  516. package/.dist/cjs/.mion/types/Xhuv_WIhjWe9.cjs.map +0 -1
  517. package/.dist/cjs/.mion/types/Xhuv_ZRJiRyT.cjs +0 -13
  518. package/.dist/cjs/.mion/types/Xhuv_ZRJiRyT.cjs.map +0 -1
  519. package/.dist/cjs/.mion/types/Xhuv_Zdevfid.cjs +0 -16
  520. package/.dist/cjs/.mion/types/Xhuv_Zdevfid.cjs.map +0 -1
  521. package/.dist/cjs/.mion/types/Xhuv_cCmjzQr.cjs +0 -29
  522. package/.dist/cjs/.mion/types/Xhuv_cCmjzQr.cjs.map +0 -1
  523. package/.dist/cjs/.mion/types/Xhuv_dbzlcVY.cjs +0 -16
  524. package/.dist/cjs/.mion/types/Xhuv_dbzlcVY.cjs.map +0 -1
  525. package/.dist/cjs/.mion/types/Xhuv_fzrXFOz.cjs +0 -16
  526. package/.dist/cjs/.mion/types/Xhuv_fzrXFOz.cjs.map +0 -1
  527. package/.dist/cjs/.mion/types/Xhuv_il6MWfT.cjs +0 -16
  528. package/.dist/cjs/.mion/types/Xhuv_il6MWfT.cjs.map +0 -1
  529. package/.dist/cjs/.mion/types/Xhuv_kuE24Ar.cjs +0 -13
  530. package/.dist/cjs/.mion/types/Xhuv_kuE24Ar.cjs.map +0 -1
  531. package/.dist/cjs/.mion/types/Xhuv_m13oqC7.cjs +0 -13
  532. package/.dist/cjs/.mion/types/Xhuv_m13oqC7.cjs.map +0 -1
  533. package/.dist/cjs/.mion/types/Xhuv_od0j6kO.cjs +0 -16
  534. package/.dist/cjs/.mion/types/Xhuv_od0j6kO.cjs.map +0 -1
  535. package/.dist/cjs/.mion/types/Xhuv_uz6TmiD.cjs +0 -17
  536. package/.dist/cjs/.mion/types/Xhuv_uz6TmiD.cjs.map +0 -1
  537. package/.dist/cjs/.mion/types/Xhuv_vDX1rqR.cjs +0 -13
  538. package/.dist/cjs/.mion/types/Xhuv_vDX1rqR.cjs.map +0 -1
  539. package/.dist/cjs/.mion/types/Xhuv_vei3XnC.cjs +0 -17
  540. package/.dist/cjs/.mion/types/Xhuv_vei3XnC.cjs.map +0 -1
  541. package/.dist/cjs/.mion/types/Xhuv_vtuQRKM.cjs +0 -16
  542. package/.dist/cjs/.mion/types/Xhuv_vtuQRKM.cjs.map +0 -1
  543. package/.dist/cjs/.mion/types/mzca_IugtMk3.cjs +0 -14
  544. package/.dist/cjs/.mion/types/mzca_IugtMk3.cjs.map +0 -1
  545. package/.dist/cjs/.mion/types/mzca_N4upY9e.cjs +0 -14
  546. package/.dist/cjs/.mion/types/mzca_N4upY9e.cjs.map +0 -1
  547. package/.dist/cjs/.mion/types/mzca_vtuQRKM.cjs +0 -14
  548. package/.dist/cjs/.mion/types/mzca_vtuQRKM.cjs.map +0 -1
  549. package/.dist/cjs/.mion/types/pf/@mionjs/run-types/rXVwGkGDX08BsQ.cjs +0 -14
  550. package/.dist/cjs/.mion/types/pf/@mionjs/run-types/rXVwGkGDX08BsQ.cjs.map +0 -1
  551. package/.dist/cjs/.mion/types/pf/@mionjs/run-types/tfRjnFZVF8lqI_.cjs +0 -14
  552. package/.dist/cjs/.mion/types/pf/@mionjs/run-types/tfRjnFZVF8lqI_.cjs.map +0 -1
  553. package/.dist/cjs/.mion/types/rt/C7ezVBCtGn.cjs +0 -498
  554. package/.dist/cjs/.mion/types/rt/C7ezVBCtGn.cjs.map +0 -1
  555. package/.dist/cjs/.mion/types/rt/VIdAjpHu1X.cjs +0 -526
  556. package/.dist/cjs/.mion/types/rt/VIdAjpHu1X.cjs.map +0 -1
  557. package/.dist/cjs/.mion/types/rt/eF4wQzU6Fd.cjs +0 -875
  558. package/.dist/cjs/.mion/types/rt/eF4wQzU6Fd.cjs.map +0 -1
  559. package/.dist/cjs/.mion/types/rt/shared/X6LLuPu8LB.cjs +0 -467
  560. package/.dist/cjs/.mion/types/rt/shared/X6LLuPu8LB.cjs.map +0 -1
  561. package/.dist/cjs/.mion/types/rt/shared/b3OCOIQ3Az.cjs +0 -1475
  562. package/.dist/cjs/.mion/types/rt/shared/b3OCOIQ3Az.cjs.map +0 -1
  563. package/.dist/cjs/index.cjs +0 -118
  564. package/.dist/cjs/index.d.ts +0 -21
  565. package/.dist/cjs/middlewares.cjs +0 -5
  566. package/.dist/cjs/middlewares.d.ts +0 -3
  567. package/.dist/cjs/package.json +0 -1
  568. package/.dist/cjs/src/batches.cjs +0 -332
  569. package/.dist/cjs/src/batches.cjs.map +0 -1
  570. package/.dist/cjs/src/batches.d.ts +0 -22
  571. package/.dist/cjs/src/callContext.cjs +0 -81
  572. package/.dist/cjs/src/callContext.cjs.map +0 -1
  573. package/.dist/cjs/src/callContext.d.ts +0 -8
  574. package/.dist/cjs/src/constants.cjs +0 -26
  575. package/.dist/cjs/src/constants.cjs.map +0 -1
  576. package/.dist/cjs/src/constants.d.ts +0 -5
  577. package/.dist/cjs/src/dispatch.cjs +0 -239
  578. package/.dist/cjs/src/dispatch.cjs.map +0 -1
  579. package/.dist/cjs/src/dispatch.d.ts +0 -10
  580. package/.dist/cjs/src/lib/bodyLimit.cjs +0 -37
  581. package/.dist/cjs/src/lib/bodyLimit.cjs.map +0 -1
  582. package/.dist/cjs/src/lib/bodyLimit.d.ts +0 -5
  583. package/.dist/cjs/src/lib/bodyReader.cjs +0 -79
  584. package/.dist/cjs/src/lib/bodyReader.cjs.map +0 -1
  585. package/.dist/cjs/src/lib/bodyReader.d.ts +0 -10
  586. package/.dist/cjs/src/lib/dispatchError.cjs +0 -82
  587. package/.dist/cjs/src/lib/dispatchError.cjs.map +0 -1
  588. package/.dist/cjs/src/lib/dispatchError.d.ts +0 -10
  589. package/.dist/cjs/src/lib/handlers.cjs +0 -99
  590. package/.dist/cjs/src/lib/handlers.cjs.map +0 -1
  591. package/.dist/cjs/src/lib/handlers.d.ts +0 -15
  592. package/.dist/cjs/src/lib/headers.cjs +0 -181
  593. package/.dist/cjs/src/lib/headers.cjs.map +0 -1
  594. package/.dist/cjs/src/lib/headers.d.ts +0 -42
  595. package/.dist/cjs/src/lib/queryBody.cjs +0 -30
  596. package/.dist/cjs/src/lib/queryBody.cjs.map +0 -1
  597. package/.dist/cjs/src/lib/queryBody.d.ts +0 -7
  598. package/.dist/cjs/src/lib/reflection.cjs +0 -81
  599. package/.dist/cjs/src/lib/reflection.cjs.map +0 -1
  600. package/.dist/cjs/src/lib/reflection.d.ts +0 -18
  601. package/.dist/cjs/src/lib/remoteMethods.cjs +0 -125
  602. package/.dist/cjs/src/lib/remoteMethods.cjs.map +0 -1
  603. package/.dist/cjs/src/lib/remoteMethods.d.ts +0 -11
  604. package/.dist/cjs/src/lib/urlQuery.cjs +0 -24
  605. package/.dist/cjs/src/lib/urlQuery.cjs.map +0 -1
  606. package/.dist/cjs/src/lib/urlQuery.d.ts +0 -2
  607. package/.dist/cjs/src/middlewares/fetchMetadata.cjs +0 -99
  608. package/.dist/cjs/src/middlewares/fetchMetadata.cjs.map +0 -1
  609. package/.dist/cjs/src/middlewares/fetchMetadata.d.ts +0 -15
  610. package/.dist/cjs/src/middlewares/syncRoutes.cjs +0 -67
  611. package/.dist/cjs/src/middlewares/syncRoutes.cjs.map +0 -1
  612. package/.dist/cjs/src/middlewares/syncRoutes.d.ts +0 -12
  613. package/.dist/cjs/src/router.cjs +0 -556
  614. package/.dist/cjs/src/router.cjs.map +0 -1
  615. package/.dist/cjs/src/router.d.ts +0 -41
  616. package/.dist/cjs/src/routes/errors.routes.cjs +0 -84
  617. package/.dist/cjs/src/routes/errors.routes.cjs.map +0 -1
  618. package/.dist/cjs/src/routes/errors.routes.d.ts +0 -19
  619. package/.dist/cjs/src/routes/serializer.routes.cjs +0 -122
  620. package/.dist/cjs/src/routes/serializer.routes.cjs.map +0 -1
  621. package/.dist/cjs/src/routes/serializer.routes.d.ts +0 -10
  622. package/.dist/cjs/src/types/context.cjs +0 -0
  623. package/.dist/cjs/src/types/context.d.ts +0 -50
  624. package/.dist/cjs/src/types/definitions.cjs +0 -0
  625. package/.dist/cjs/src/types/definitions.d.ts +0 -33
  626. package/.dist/cjs/src/types/general.cjs +0 -0
  627. package/.dist/cjs/src/types/general.d.ts +0 -29
  628. package/.dist/cjs/src/types/guards.cjs +0 -59
  629. package/.dist/cjs/src/types/guards.cjs.map +0 -1
  630. package/.dist/cjs/src/types/guards.d.ts +0 -18
  631. package/.dist/cjs/src/types/handlers.cjs +0 -0
  632. package/.dist/cjs/src/types/handlers.d.ts +0 -16
  633. package/.dist/cjs/src/types/mionRouter.cjs +0 -0
  634. package/.dist/cjs/src/types/mionRouter.d.ts +0 -44
  635. package/.dist/cjs/src/types/parser.cjs +0 -0
  636. package/.dist/cjs/src/types/parser.d.ts +0 -43
  637. package/.dist/cjs/src/types/publicMethods.cjs +0 -0
  638. package/.dist/cjs/src/types/publicMethods.d.ts +0 -86
  639. package/.dist/cjs/src/types/remoteMethods.cjs +0 -0
  640. package/.dist/cjs/src/types/remoteMethods.d.ts +0 -65
  641. package/.dist/cjs/src/types/resolvedOptions.cjs +0 -0
  642. package/.dist/cjs/src/types/resolvedOptions.d.ts +0 -28
  643. package/.dist/esm/.mion/types/A0Qb_EtDWACB.js +0 -16
  644. package/.dist/esm/.mion/types/A0Qb_EtDWACB.js.map +0 -1
  645. package/.dist/esm/.mion/types/A0Qb_FSFQzFT.js +0 -17
  646. package/.dist/esm/.mion/types/A0Qb_FSFQzFT.js.map +0 -1
  647. package/.dist/esm/.mion/types/A0Qb_IJpcjGV.js +0 -16
  648. package/.dist/esm/.mion/types/A0Qb_IJpcjGV.js.map +0 -1
  649. package/.dist/esm/.mion/types/A0Qb_IugtMk3.js +0 -14
  650. package/.dist/esm/.mion/types/A0Qb_IugtMk3.js.map +0 -1
  651. package/.dist/esm/.mion/types/A0Qb_JmyrGf9.js +0 -13
  652. package/.dist/esm/.mion/types/A0Qb_JmyrGf9.js.map +0 -1
  653. package/.dist/esm/.mion/types/A0Qb_KW2BeGf.js +0 -13
  654. package/.dist/esm/.mion/types/A0Qb_KW2BeGf.js.map +0 -1
  655. package/.dist/esm/.mion/types/A0Qb_N4upY9e.js +0 -14
  656. package/.dist/esm/.mion/types/A0Qb_N4upY9e.js.map +0 -1
  657. package/.dist/esm/.mion/types/A0Qb_NpYuWjf.js +0 -16
  658. package/.dist/esm/.mion/types/A0Qb_NpYuWjf.js.map +0 -1
  659. package/.dist/esm/.mion/types/A0Qb_PGJvDQM.js +0 -16
  660. package/.dist/esm/.mion/types/A0Qb_PGJvDQM.js.map +0 -1
  661. package/.dist/esm/.mion/types/A0Qb_SJBMH8X.js +0 -16
  662. package/.dist/esm/.mion/types/A0Qb_SJBMH8X.js.map +0 -1
  663. package/.dist/esm/.mion/types/A0Qb_SW6Ke6X.js +0 -26
  664. package/.dist/esm/.mion/types/A0Qb_SW6Ke6X.js.map +0 -1
  665. package/.dist/esm/.mion/types/A0Qb_UM4R4B0.js +0 -16
  666. package/.dist/esm/.mion/types/A0Qb_UM4R4B0.js.map +0 -1
  667. package/.dist/esm/.mion/types/A0Qb_VU2j3Ds.js +0 -16
  668. package/.dist/esm/.mion/types/A0Qb_VU2j3Ds.js.map +0 -1
  669. package/.dist/esm/.mion/types/A0Qb_WIhjWe9.js +0 -13
  670. package/.dist/esm/.mion/types/A0Qb_WIhjWe9.js.map +0 -1
  671. package/.dist/esm/.mion/types/A0Qb_ZRJiRyT.js +0 -13
  672. package/.dist/esm/.mion/types/A0Qb_ZRJiRyT.js.map +0 -1
  673. package/.dist/esm/.mion/types/A0Qb_Zdevfid.js +0 -16
  674. package/.dist/esm/.mion/types/A0Qb_Zdevfid.js.map +0 -1
  675. package/.dist/esm/.mion/types/A0Qb_cCmjzQr.js +0 -36
  676. package/.dist/esm/.mion/types/A0Qb_cCmjzQr.js.map +0 -1
  677. package/.dist/esm/.mion/types/A0Qb_dbzlcVY.js +0 -16
  678. package/.dist/esm/.mion/types/A0Qb_dbzlcVY.js.map +0 -1
  679. package/.dist/esm/.mion/types/A0Qb_fzrXFOz.js +0 -16
  680. package/.dist/esm/.mion/types/A0Qb_fzrXFOz.js.map +0 -1
  681. package/.dist/esm/.mion/types/A0Qb_il6MWfT.js +0 -16
  682. package/.dist/esm/.mion/types/A0Qb_il6MWfT.js.map +0 -1
  683. package/.dist/esm/.mion/types/A0Qb_kuE24Ar.js +0 -13
  684. package/.dist/esm/.mion/types/A0Qb_kuE24Ar.js.map +0 -1
  685. package/.dist/esm/.mion/types/A0Qb_od0j6kO.js +0 -16
  686. package/.dist/esm/.mion/types/A0Qb_od0j6kO.js.map +0 -1
  687. package/.dist/esm/.mion/types/A0Qb_uz6TmiD.js +0 -17
  688. package/.dist/esm/.mion/types/A0Qb_uz6TmiD.js.map +0 -1
  689. package/.dist/esm/.mion/types/A0Qb_vDX1rqR.js +0 -13
  690. package/.dist/esm/.mion/types/A0Qb_vDX1rqR.js.map +0 -1
  691. package/.dist/esm/.mion/types/A0Qb_vei3XnC.js +0 -17
  692. package/.dist/esm/.mion/types/A0Qb_vei3XnC.js.map +0 -1
  693. package/.dist/esm/.mion/types/A0Qb_vtuQRKM.js +0 -14
  694. package/.dist/esm/.mion/types/A0Qb_vtuQRKM.js.map +0 -1
  695. package/.dist/esm/.mion/types/Eq2V_EtDWACB.js +0 -16
  696. package/.dist/esm/.mion/types/Eq2V_EtDWACB.js.map +0 -1
  697. package/.dist/esm/.mion/types/Eq2V_IJpcjGV.js +0 -16
  698. package/.dist/esm/.mion/types/Eq2V_IJpcjGV.js.map +0 -1
  699. package/.dist/esm/.mion/types/Eq2V_JmyrGf9.js +0 -13
  700. package/.dist/esm/.mion/types/Eq2V_JmyrGf9.js.map +0 -1
  701. package/.dist/esm/.mion/types/Eq2V_KW2BeGf.js +0 -13
  702. package/.dist/esm/.mion/types/Eq2V_KW2BeGf.js.map +0 -1
  703. package/.dist/esm/.mion/types/Eq2V_NpYuWjf.js +0 -16
  704. package/.dist/esm/.mion/types/Eq2V_NpYuWjf.js.map +0 -1
  705. package/.dist/esm/.mion/types/Eq2V_SJBMH8X.js +0 -16
  706. package/.dist/esm/.mion/types/Eq2V_SJBMH8X.js.map +0 -1
  707. package/.dist/esm/.mion/types/Eq2V_SW6Ke6X.js +0 -26
  708. package/.dist/esm/.mion/types/Eq2V_SW6Ke6X.js.map +0 -1
  709. package/.dist/esm/.mion/types/Eq2V_VU2j3Ds.js +0 -16
  710. package/.dist/esm/.mion/types/Eq2V_VU2j3Ds.js.map +0 -1
  711. package/.dist/esm/.mion/types/Eq2V_WIhjWe9.js +0 -13
  712. package/.dist/esm/.mion/types/Eq2V_WIhjWe9.js.map +0 -1
  713. package/.dist/esm/.mion/types/Eq2V_ZRJiRyT.js +0 -13
  714. package/.dist/esm/.mion/types/Eq2V_ZRJiRyT.js.map +0 -1
  715. package/.dist/esm/.mion/types/Eq2V_Zdevfid.js +0 -16
  716. package/.dist/esm/.mion/types/Eq2V_Zdevfid.js.map +0 -1
  717. package/.dist/esm/.mion/types/Eq2V_dbzlcVY.js +0 -16
  718. package/.dist/esm/.mion/types/Eq2V_dbzlcVY.js.map +0 -1
  719. package/.dist/esm/.mion/types/Eq2V_fzrXFOz.js +0 -16
  720. package/.dist/esm/.mion/types/Eq2V_fzrXFOz.js.map +0 -1
  721. package/.dist/esm/.mion/types/Eq2V_il6MWfT.js +0 -16
  722. package/.dist/esm/.mion/types/Eq2V_il6MWfT.js.map +0 -1
  723. package/.dist/esm/.mion/types/Eq2V_kuE24Ar.js +0 -13
  724. package/.dist/esm/.mion/types/Eq2V_kuE24Ar.js.map +0 -1
  725. package/.dist/esm/.mion/types/Eq2V_od0j6kO.js +0 -16
  726. package/.dist/esm/.mion/types/Eq2V_od0j6kO.js.map +0 -1
  727. package/.dist/esm/.mion/types/Eq2V_uz6TmiD.js +0 -17
  728. package/.dist/esm/.mion/types/Eq2V_uz6TmiD.js.map +0 -1
  729. package/.dist/esm/.mion/types/Eq2V_vDX1rqR.js +0 -13
  730. package/.dist/esm/.mion/types/Eq2V_vDX1rqR.js.map +0 -1
  731. package/.dist/esm/.mion/types/Eq2V_vei3XnC.js +0 -17
  732. package/.dist/esm/.mion/types/Eq2V_vei3XnC.js.map +0 -1
  733. package/.dist/esm/.mion/types/Ky89_EtDWACB.js +0 -16
  734. package/.dist/esm/.mion/types/Ky89_EtDWACB.js.map +0 -1
  735. package/.dist/esm/.mion/types/Ky89_FSFQzFT.js +0 -16
  736. package/.dist/esm/.mion/types/Ky89_FSFQzFT.js.map +0 -1
  737. package/.dist/esm/.mion/types/Ky89_IJpcjGV.js +0 -16
  738. package/.dist/esm/.mion/types/Ky89_IJpcjGV.js.map +0 -1
  739. package/.dist/esm/.mion/types/Ky89_IugtMk3.js +0 -14
  740. package/.dist/esm/.mion/types/Ky89_IugtMk3.js.map +0 -1
  741. package/.dist/esm/.mion/types/Ky89_JmyrGf9.js +0 -13
  742. package/.dist/esm/.mion/types/Ky89_JmyrGf9.js.map +0 -1
  743. package/.dist/esm/.mion/types/Ky89_KW2BeGf.js +0 -13
  744. package/.dist/esm/.mion/types/Ky89_KW2BeGf.js.map +0 -1
  745. package/.dist/esm/.mion/types/Ky89_N4upY9e.js +0 -13
  746. package/.dist/esm/.mion/types/Ky89_N4upY9e.js.map +0 -1
  747. package/.dist/esm/.mion/types/Ky89_NpYuWjf.js +0 -16
  748. package/.dist/esm/.mion/types/Ky89_NpYuWjf.js.map +0 -1
  749. package/.dist/esm/.mion/types/Ky89_PGJvDQM.js +0 -16
  750. package/.dist/esm/.mion/types/Ky89_PGJvDQM.js.map +0 -1
  751. package/.dist/esm/.mion/types/Ky89_SJBMH8X.js +0 -16
  752. package/.dist/esm/.mion/types/Ky89_SJBMH8X.js.map +0 -1
  753. package/.dist/esm/.mion/types/Ky89_SW6Ke6X.js +0 -26
  754. package/.dist/esm/.mion/types/Ky89_SW6Ke6X.js.map +0 -1
  755. package/.dist/esm/.mion/types/Ky89_UM4R4B0.js +0 -16
  756. package/.dist/esm/.mion/types/Ky89_UM4R4B0.js.map +0 -1
  757. package/.dist/esm/.mion/types/Ky89_VU2j3Ds.js +0 -16
  758. package/.dist/esm/.mion/types/Ky89_VU2j3Ds.js.map +0 -1
  759. package/.dist/esm/.mion/types/Ky89_Zdevfid.js +0 -16
  760. package/.dist/esm/.mion/types/Ky89_Zdevfid.js.map +0 -1
  761. package/.dist/esm/.mion/types/Ky89_cCmjzQr.js +0 -32
  762. package/.dist/esm/.mion/types/Ky89_cCmjzQr.js.map +0 -1
  763. package/.dist/esm/.mion/types/Ky89_dbzlcVY.js +0 -16
  764. package/.dist/esm/.mion/types/Ky89_dbzlcVY.js.map +0 -1
  765. package/.dist/esm/.mion/types/Ky89_fzrXFOz.js +0 -16
  766. package/.dist/esm/.mion/types/Ky89_fzrXFOz.js.map +0 -1
  767. package/.dist/esm/.mion/types/Ky89_il6MWfT.js +0 -16
  768. package/.dist/esm/.mion/types/Ky89_il6MWfT.js.map +0 -1
  769. package/.dist/esm/.mion/types/Ky89_kuE24Ar.js +0 -13
  770. package/.dist/esm/.mion/types/Ky89_kuE24Ar.js.map +0 -1
  771. package/.dist/esm/.mion/types/Ky89_od0j6kO.js +0 -16
  772. package/.dist/esm/.mion/types/Ky89_od0j6kO.js.map +0 -1
  773. package/.dist/esm/.mion/types/Ky89_uz6TmiD.js +0 -13
  774. package/.dist/esm/.mion/types/Ky89_uz6TmiD.js.map +0 -1
  775. package/.dist/esm/.mion/types/Ky89_vDX1rqR.js +0 -13
  776. package/.dist/esm/.mion/types/Ky89_vDX1rqR.js.map +0 -1
  777. package/.dist/esm/.mion/types/Ky89_vei3XnC.js +0 -17
  778. package/.dist/esm/.mion/types/Ky89_vei3XnC.js.map +0 -1
  779. package/.dist/esm/.mion/types/Ky89_vtuQRKM.js +0 -13
  780. package/.dist/esm/.mion/types/Ky89_vtuQRKM.js.map +0 -1
  781. package/.dist/esm/.mion/types/OBOg_FSFQzFT.js +0 -18
  782. package/.dist/esm/.mion/types/OBOg_FSFQzFT.js.map +0 -1
  783. package/.dist/esm/.mion/types/OBOg_IugtMk3.js +0 -17
  784. package/.dist/esm/.mion/types/OBOg_IugtMk3.js.map +0 -1
  785. package/.dist/esm/.mion/types/OBOg_N4upY9e.js +0 -17
  786. package/.dist/esm/.mion/types/OBOg_N4upY9e.js.map +0 -1
  787. package/.dist/esm/.mion/types/OBOg_PGJvDQM.js +0 -18
  788. package/.dist/esm/.mion/types/OBOg_PGJvDQM.js.map +0 -1
  789. package/.dist/esm/.mion/types/OBOg_TEA76po.js +0 -18
  790. package/.dist/esm/.mion/types/OBOg_TEA76po.js.map +0 -1
  791. package/.dist/esm/.mion/types/OBOg_UM4R4B0.js +0 -23
  792. package/.dist/esm/.mion/types/OBOg_UM4R4B0.js.map +0 -1
  793. package/.dist/esm/.mion/types/OBOg_cCmjzQr.js +0 -18
  794. package/.dist/esm/.mion/types/OBOg_cCmjzQr.js.map +0 -1
  795. package/.dist/esm/.mion/types/OBOg_vDX1rqR.js +0 -17
  796. package/.dist/esm/.mion/types/OBOg_vDX1rqR.js.map +0 -1
  797. package/.dist/esm/.mion/types/OBOg_vtuQRKM.js +0 -18
  798. package/.dist/esm/.mion/types/OBOg_vtuQRKM.js.map +0 -1
  799. package/.dist/esm/.mion/types/Xhuv_EtDWACB.js +0 -16
  800. package/.dist/esm/.mion/types/Xhuv_EtDWACB.js.map +0 -1
  801. package/.dist/esm/.mion/types/Xhuv_FSFQzFT.js +0 -16
  802. package/.dist/esm/.mion/types/Xhuv_FSFQzFT.js.map +0 -1
  803. package/.dist/esm/.mion/types/Xhuv_IJpcjGV.js +0 -16
  804. package/.dist/esm/.mion/types/Xhuv_IJpcjGV.js.map +0 -1
  805. package/.dist/esm/.mion/types/Xhuv_IugtMk3.js +0 -13
  806. package/.dist/esm/.mion/types/Xhuv_IugtMk3.js.map +0 -1
  807. package/.dist/esm/.mion/types/Xhuv_JmyrGf9.js +0 -13
  808. package/.dist/esm/.mion/types/Xhuv_JmyrGf9.js.map +0 -1
  809. package/.dist/esm/.mion/types/Xhuv_KW2BeGf.js +0 -13
  810. package/.dist/esm/.mion/types/Xhuv_KW2BeGf.js.map +0 -1
  811. package/.dist/esm/.mion/types/Xhuv_N4upY9e.js +0 -13
  812. package/.dist/esm/.mion/types/Xhuv_N4upY9e.js.map +0 -1
  813. package/.dist/esm/.mion/types/Xhuv_NpYuWjf.js +0 -16
  814. package/.dist/esm/.mion/types/Xhuv_NpYuWjf.js.map +0 -1
  815. package/.dist/esm/.mion/types/Xhuv_PGJvDQM.js +0 -16
  816. package/.dist/esm/.mion/types/Xhuv_PGJvDQM.js.map +0 -1
  817. package/.dist/esm/.mion/types/Xhuv_SJBMH8X.js +0 -16
  818. package/.dist/esm/.mion/types/Xhuv_SJBMH8X.js.map +0 -1
  819. package/.dist/esm/.mion/types/Xhuv_SW6Ke6X.js +0 -26
  820. package/.dist/esm/.mion/types/Xhuv_SW6Ke6X.js.map +0 -1
  821. package/.dist/esm/.mion/types/Xhuv_TEA76po.js +0 -13
  822. package/.dist/esm/.mion/types/Xhuv_TEA76po.js.map +0 -1
  823. package/.dist/esm/.mion/types/Xhuv_UM4R4B0.js +0 -16
  824. package/.dist/esm/.mion/types/Xhuv_UM4R4B0.js.map +0 -1
  825. package/.dist/esm/.mion/types/Xhuv_VU2j3Ds.js +0 -16
  826. package/.dist/esm/.mion/types/Xhuv_VU2j3Ds.js.map +0 -1
  827. package/.dist/esm/.mion/types/Xhuv_WIhjWe9.js +0 -13
  828. package/.dist/esm/.mion/types/Xhuv_WIhjWe9.js.map +0 -1
  829. package/.dist/esm/.mion/types/Xhuv_ZRJiRyT.js +0 -13
  830. package/.dist/esm/.mion/types/Xhuv_ZRJiRyT.js.map +0 -1
  831. package/.dist/esm/.mion/types/Xhuv_Zdevfid.js +0 -16
  832. package/.dist/esm/.mion/types/Xhuv_Zdevfid.js.map +0 -1
  833. package/.dist/esm/.mion/types/Xhuv_cCmjzQr.js +0 -29
  834. package/.dist/esm/.mion/types/Xhuv_cCmjzQr.js.map +0 -1
  835. package/.dist/esm/.mion/types/Xhuv_dbzlcVY.js +0 -16
  836. package/.dist/esm/.mion/types/Xhuv_dbzlcVY.js.map +0 -1
  837. package/.dist/esm/.mion/types/Xhuv_fzrXFOz.js +0 -16
  838. package/.dist/esm/.mion/types/Xhuv_fzrXFOz.js.map +0 -1
  839. package/.dist/esm/.mion/types/Xhuv_il6MWfT.js +0 -16
  840. package/.dist/esm/.mion/types/Xhuv_il6MWfT.js.map +0 -1
  841. package/.dist/esm/.mion/types/Xhuv_kuE24Ar.js +0 -13
  842. package/.dist/esm/.mion/types/Xhuv_kuE24Ar.js.map +0 -1
  843. package/.dist/esm/.mion/types/Xhuv_m13oqC7.js +0 -13
  844. package/.dist/esm/.mion/types/Xhuv_m13oqC7.js.map +0 -1
  845. package/.dist/esm/.mion/types/Xhuv_od0j6kO.js +0 -16
  846. package/.dist/esm/.mion/types/Xhuv_od0j6kO.js.map +0 -1
  847. package/.dist/esm/.mion/types/Xhuv_uz6TmiD.js +0 -17
  848. package/.dist/esm/.mion/types/Xhuv_uz6TmiD.js.map +0 -1
  849. package/.dist/esm/.mion/types/Xhuv_vDX1rqR.js +0 -13
  850. package/.dist/esm/.mion/types/Xhuv_vDX1rqR.js.map +0 -1
  851. package/.dist/esm/.mion/types/Xhuv_vei3XnC.js +0 -17
  852. package/.dist/esm/.mion/types/Xhuv_vei3XnC.js.map +0 -1
  853. package/.dist/esm/.mion/types/Xhuv_vtuQRKM.js +0 -16
  854. package/.dist/esm/.mion/types/Xhuv_vtuQRKM.js.map +0 -1
  855. package/.dist/esm/.mion/types/mzca_IugtMk3.js +0 -14
  856. package/.dist/esm/.mion/types/mzca_IugtMk3.js.map +0 -1
  857. package/.dist/esm/.mion/types/mzca_N4upY9e.js +0 -14
  858. package/.dist/esm/.mion/types/mzca_N4upY9e.js.map +0 -1
  859. package/.dist/esm/.mion/types/mzca_vtuQRKM.js +0 -14
  860. package/.dist/esm/.mion/types/mzca_vtuQRKM.js.map +0 -1
  861. package/.dist/esm/.mion/types/pf/@mionjs/run-types/rXVwGkGDX08BsQ.js +0 -14
  862. package/.dist/esm/.mion/types/pf/@mionjs/run-types/rXVwGkGDX08BsQ.js.map +0 -1
  863. package/.dist/esm/.mion/types/pf/@mionjs/run-types/tfRjnFZVF8lqI_.js +0 -14
  864. package/.dist/esm/.mion/types/pf/@mionjs/run-types/tfRjnFZVF8lqI_.js.map +0 -1
  865. package/.dist/esm/.mion/types/rt/shared/X6LLuPu8LB.js.map +0 -1
  866. package/.dist/esm/.mion/types/rt/shared/b3OCOIQ3Az.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nJOmbxLb37.js","names":[],"sources":["../../../../../../.mion/types/rt/shared/nJOmbxLb37.js"],"sourcesContent":["import {__rt_rts_EjfwjaotqB} from './EjfwjaotqB.js';\nexport const __rt_rts_nJOmbxLb37=[4,()=>[__rt_rts_EjfwjaotqB],,'rts_Pswaci3k1G',[['A3ymOUC',31],\n['AfPinRI',32,,,'id',,,!0,,,,!0],\n['AvrQ5FK',32,,,'headersReturn',,!0,,,,,!0],\n['BwLs74i',32,,,'isAsync',,,,,,,!0],\n['CAEt5LI',32,,,'parser',,!0,,,,,!0],\n['DvEFm9P',32,,,'syncId',,!0,,,,,!0],\n['E1QylR8',32,,,'fnID',,,!0,,,,!0],\n['ESo9uto',32,,,'nestLevel',,,,,,,!0],\n['EkYSHqf',30,,'MethodsCache'],\n['GVXB1Wo',23,,'ParserStrategy'],\n['HIYwr01',32,,,'paramsRest',,!0,,,,,!0],\n['HvnlLnd',30,,'CompiledFnData'],\n['IUVDf5D',31],\n['J3IvK7k',32,,,'maxBodySize',,!0,,,,,!0],\n['JkwVz03',30,,'MethodOptionsMetadata'],\n['KMGXCec',31],\n['KYXJdoi',30,,'SerializableMethodsData'],\n['L7TAwqn',30,,'MethodWithOptions'],\n['L7k5gPj',32,,,'return',,,,,,,!0],\n['MFYKl78',32,,,'params',,,,,,,!0],\n['MOJRJc7',32,,,'headersParam',,!0,,,,,!0],\n['NPYwVjN',32,,,'id',,,,,,,!0],\n['NlROZC8',32,,,'pointer',,,,,,,!0],\n['OVxtr6c',32,,,'type',,,,,,,!0],\n['Pd078ZA',32,,,'alwaysRun',,!0,,,,,!0],\n['QfyfAm2',32,,,'paramsRest',,!0,,,,,!0],\n['RLwaPTO',32,,,'batches',,!0,,,,,!0],\n['RVwMNKw',32,,,'code',,!0,!0,,,,!0],\n['RYFonnq',32,,,'middlewareIds',,!0,,,,,!0],\n['SbiuwXH',32,,,'paramNames',,,!0,,,,!0],\n['THAV3kg',32,,,'defaultParamValues',,,!0,,,,!0],\n['TfUIVWv',32,,,'middlewareIds',,!0,,,,,!0],\n['UAfp8hs',32,,,'paramsCount',,!0,,,,,!0],\n['UGPHsHZ',30,,'ResolvedParser'],\n['VMxJugF',30,,'PureFnsDataCache'],\n['WIa2JzP',32,,,'deps',,,,,,,!0],\n['WUaFpwD',32,,,'returnJitHash',,,,,,,!0],\n['WWZX9et',32,,,'isAsync',,,,,,,!0],\n['WaXzp6u',30,,'CompiledFnArgs'],\n['WbwWoJC',32,,,'description',,!0,,,,,!0],\n['X6xysR4',32,,,'paramNames',,!0,,,,,!0],\n['YL4yNFX',32,,,'pureFnDependencies',,!0,!0,,,,!0],\n['ZpGySwm',32,,,'parser',,!0,,,,,!0],\n['aYmhhDj',31],\n['aoyR7oG',32,,,'jitHash',,,,,,,!0],\n['bD2CcA5',32,,,'vλl'],\n['c2Z86kG',32,,,'paramsJitHash',,,,,,,!0],\n['cBzkZVx',32,,,'args',,,!0,,,,!0],\n['cYEk8WJ',32,,,'isMutation',,!0,,,,,!0],\n['diEDHDc',32,,,'returnJitHash',,,,,,,!0],\n['dsaxFa6',32,,,'rtFnHash',,,!0,,,,!0],\n['eeLiuLD',32,,,'syncId',,!0,,,,,!0],\n['fdsjiDa',32,,,'sanitizeParams',,!0,,,,,!0],\n['fjaxPpO',30,,'SerializablePureFunction'],\n['gEDLhpx',32,,,'id',,,,,,,!0],\n['gdQ1CIx',32,,,'pureFnDependencies',,!0,!0,,,,!0],\n['gv2lhei',32,,,'type',,,,,,,!0],\n['jtVuIvc',32,,,'purFnDeps',,,,,,,!0],\n['kla0eVf',32,,,'headersReturn',,!0,,,,,!0],\n['l0SvVbl',32,,,'code',,,!0,,,,!0],\n['lG9I0wZ',32,,,'hasReturnData',,,,,,,!0],\n['la7Gj3A',13,,,,'clone'],\n['leMNZlh',32,,,'nestLevel',,,,,,,!0],\n['lsuScNf',32,,,'headerNames',,,,,,,!0],\n['mD0DGLJ',13,,,,'compact'],\n['mUNBZXJ',32,,,'rtDependencies',,!0,!0,,,,!0],\n['mVmyR1d',32,,,'isNoop',,!0,!0,,,,!0],\n['n2m5Ook',32,,,'typeName',,,!0,,,,!0],\n['o06x9N9',7],\n['oQMaTFQ',32,,,'headersParam',,!0,,,,,!0],\n['olgV1ZG',25],\n['oyG5Q0U',32,,,'options',,,,,,,!0],\n['ozt4uk2',32,,,'methods',,,,,,,!0],\n['pSOt13v',32,,,'paramsCount',,!0,,,,,!0],\n['pWBRJYE',23,,'ReturnParserStrategy'],\n['pmt3pF1',32,,,'alwaysRun',,!0,,,,,!0],\n['pnaS51K',32,,,'description',,!0,,,,,!0],\n['pzhCQnb',32,,,'hasReturnData',,,,,,,!0],\n['qTvyy6t',31],\n['qarssac',32,,,'isMutation',,!0,,,,,!0],\n['rzMAZkX',32,,,'familyTag',,!0,!0,,,,!0],\n['s7vhS6O',32,,,'maxBodySize',,!0,,,,,!0],\n['s9oueuz',13,,,,'mutate'],\n['uVxbfLm',13,,,,'mutateStrict'],\n['uwKlOoF',30,,'RemoteMethodOpts'],\n['uzqtXkY',30,,'MethodMetadata'],\n['vIbt7K7',30,,'HeadersMetaData'],\n['vJD6Cbk',32,,,'paramNames',,!0,,,,,!0],\n['vMVZ77w',30,,'FnsDataCache'],\n['wbqluqx',32,,,'alwaysThrowMessage',,!0,!0,,,,!0],\n['xatoY7C',32,,,'paramsJitHash',,,,,,,!0],\n['yP7bwEB',32,,,'sanitizeParams',,!0,,,,,!0],\n['z2Q3S5M',32,,,'paramNames',,!0,,,,,!0],\n['zn3YeJx',32,,,'pointer',,,,,,,!0]],[['rIuKJ6Y',,'rIuKJ6Y'],['rIuKJ6Y'],[86],[68],[33],['rIuKJ6Y'],['rIuKJ6Y'],['FSH3P3D'],[,[78]],[,[61,64,82,83],,,,,[61,64,82,83]],[68],[,[67,6,80,50,47,30,66,27,65,41,92,89]],[53,,'rIuKJ6Y'],['FSH3P3D'],[,[75,76,4,79,91,13,43],,,,,,,,,,,,[84]],[11,,'rIuKJ6Y'],[,[72,35,57,26]],[,[71,56,54,3,77,73,87,25,46,36,69,58,51,31,22,7],,,,,,,,,,,,[85]],[74],[9],[86],['rIuKJ6Y'],[70],['FSH3P3D'],[68],[68],[70],['rIuKJ6Y'],[70],[70],[38],[70],['FSH3P3D'],[,[19,18]],[,[12]],[88],['rIuKJ6Y'],[68],[,[45,0]],['rIuKJ6Y'],[70],[70],[33],['v2YIDmI',,'rIuKJ6Y'],['rIuKJ6Y'],['rIuKJ6Y'],['rIuKJ6Y'],[38],[68],['rIuKJ6Y'],['rIuKJ6Y'],['rIuKJ6Y'],[68],[,[1,29,59,55]],['rIuKJ6Y'],[70],['FSH3P3D'],[34],[86],['rIuKJ6Y'],[68],,['FSH3P3D'],[70],,[70],[68],['rIuKJ6Y'],,[86],['rIuKJ6Y'],[14],[8],['FSH3P3D'],[,[61,64,82],,,,,[61,64,82]],[68],['rIuKJ6Y'],[68],[17,,'rIuKJ6Y'],[68],['rIuKJ6Y'],['FSH3P3D'],,,[,[24,39,42,48,52,81]],[,[23,21,37,60,32,40,10,90,49,20,2,5,28,93,62]],[,[63,44]],[70],[,[15]],['rIuKJ6Y'],['rIuKJ6Y'],[68],[70],[70]]];\n"],"mappings":";;AACA,IAAa,sBAAoB;CAAC;OAAM,CAAC,mBAAmB;;CAAG;CAAiB;EAAC,CAAC,WAAU,EAAE;EAC9F;GAAC;GAAU;;;GAAK;;;GAAO,CAAC;;;;GAAK,CAAC;EAAC;EAC/B;GAAC;GAAU;;;GAAK;;GAAiB,CAAC;;;;;GAAM,CAAC;EAAC;EAC1C;GAAC;GAAU;;;GAAK;;;;;;;GAAgB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;GAAC;GAAE;GAAG;GAAG;EAAE,CAAC;EAAE,CAAC,SAAS;EAAE,CAAC,EAAE;EAAE,CAAC,SAAS;EAAE,CAAC,EAAE;EAAE,CAAC,EAAE;EAAE,CAAC,SAAS;EAAE,CAAC,EAAE;;EAAG,CAAC,SAAS;EAAE,CAAC,EAAE;;EAAG,CAAC,EAAE;EAAE,CAAC,EAAE;EAAE,CAAC,SAAS;;EAAG,CAAC,EAAE;EAAE,CAAC,SAAS;EAAE,CAAC,EAAE;EAAE,CAAC,CAAC;EAAE,CAAC,SAAS;EAAE;;GAAE;IAAC;IAAG;IAAG;GAAE;;;;;GAAM;IAAC;IAAG;IAAG;GAAE;EAAC;EAAE,CAAC,EAAE;EAAE,CAAC,SAAS;EAAE,CAAC,EAAE;EAAE;GAAC;;GAAI;EAAS;EAAE,CAAC,EAAE;EAAE,CAAC,SAAS;EAAE,CAAC,SAAS;;;EAAI,GAAE;GAAC;GAAG;GAAG;GAAG;GAAG;GAAG;EAAE,CAAC;EAAE,GAAE;GAAC;GAAG;GAAG;GAAG;GAAG;GAAG;GAAG;GAAG;GAAG;GAAG;GAAG;GAAE;GAAE;GAAG;GAAG;EAAE,CAAC;EAAE,GAAE,CAAC,IAAG,EAAE,CAAC;EAAE,CAAC,EAAE;EAAE,GAAE,CAAC,EAAE,CAAC;EAAE,CAAC,SAAS;EAAE,CAAC,SAAS;EAAE,CAAC,EAAE;EAAE,CAAC,EAAE;EAAE,CAAC,EAAE;CAAC;AAAC"}
@@ -15,7 +15,7 @@ export * from './src/lib/dispatchError.ts';
15
15
  export * from './src/lib/headers.ts';
16
16
  export * from './src/lib/remoteMethods.ts';
17
17
  export * from './src/types/mionRouter.ts';
18
- export * from './src/lib/queryBody.ts';
19
18
  export * from './src/lib/bodyReader.ts';
19
+ export * from './src/lib/httpMethod.ts';
20
20
  export { mionErrorsRoutes } from './src/routes/errors.routes.ts';
21
21
  //# sourceMappingURL=index.d.ts.map
@@ -1,13 +1,13 @@
1
- import { isAnyMiddlewareDef, isExecutable, isHeaderExecutable, isHeadersMiddlewareDef, isMiddlewareDef, isPublicExecutable, isRawExecutable, isRawMiddlewareDef, isRoute, isRouteDef, isRouteExecutable, isRoutes } from "./src/types/guards.js";
2
- import { DEFAULT_ROUTE_OPTIONS, JSON_CONTENT_TYPE, MAX_ROUTE_NESTING } from "./src/constants.js";
3
- import { addThrownError, errorHeaderValue, getRouterFatalErrorResponse, hasThrownError, markResponseFailed, recordUndeclaredError, toRpcError } from "./src/lib/dispatchError.js";
1
+ import { isAnyMiddlewareDef, isExecutable, isHeadersMiddlewareDef, isMiddlewareDef, isPublicExecutable, isRawMiddlewareDef, isRoute, isRoutes } from "./src/types/guards.js";
2
+ import { DEFAULT_ROUTE_OPTIONS, JSON_CONTENT_TYPE, MAX_ROUTE_NESTING, MION_SERVER_NAME } from "./src/constants.js";
3
+ import { FetchResponseHeaders, RecordResponseHeaders, assertHeaderSafe, getDefaultFetchHeaders, getDefaultHeaders, headersFromRecord, releaseHeaders, replyFetch } from "./src/lib/headers.js";
4
+ import { addThrownError, endChain, errorHeaderValue, getRouterFatalErrorResponse, hasThrownError, markResponseFailed, recordUndeclaredError, toRpcError } from "./src/lib/dispatchError.js";
4
5
  import { capBatchBodySizes, clearBatches, getBatch, getBatchExecutionChain, getBatchIds, getMaxBatchBodySize, readBatchId, refreshBatchChainBodyLimits, registerBatches, replaceBatches, resolveBatchMaxBodySize } from "./src/batches.js";
5
6
  import { createCallContext, createContextFromChain, getRequestBodyType, resolveExecutionChain } from "./src/callContext.js";
6
7
  import { callerForType, dispatchMaybeSync, dispatchPlatformError, dispatchRoute, dispatchWithContext, getMethodCaller } from "./src/dispatch.js";
7
8
  import { getPublicApi, getSerializableMethod, resetRemoteMethodsMetadata, serializeJitFn, serializeMethodDeps, serializePureDeps } from "./src/lib/remoteMethods.js";
8
9
  import { mionErrorsRoutes } from "./src/routes/errors.routes.js";
9
- import { addEndMiddlewares, addStartMiddlewares, createMionRouter, endMiddlewares, geRoutesSize, getAllExecutablesIds, getAnyExecutable, getBuildVersion, getComplexity, getExecutableFromMiddleware, getExecutableFromRawMiddleware, getExecutableFromRoute, getHostRequestHandler, getMaxRouteBodySize, getMiddlewareExecutable, getMiddlewaresSize, getNotFoundExecutionChain, getPlatformConfig, getPlatformMaxBodySize, getPlatformRequestCap, getResponseDefaults, getRouteEntries, getRouteExecutable, getRouteExecutionChain, getRouterOptions, getTotalExecutables, handOverToHost, hostOwnsSocket, isPrivateDefinition, resetRouter, setHostOwnsSocket, setPlatformConfig, shouldFullGenerateSpec, startMiddlewares } from "./src/router.js";
10
- import { FetchResponseHeaders, RecordResponseHeaders, getDefaultFetchHeaders, getDefaultHeaders, headersFromRecord, releaseHeaders, replyFetch } from "./src/lib/headers.js";
11
- import { decodeQueryBody } from "./src/lib/queryBody.js";
10
+ import { addEndMiddlewares, addStartMiddlewares, createMionRouter, endMiddlewares, getAllExecutablesIds, getAnyExecutable, getBuildVersion, getComplexity, getExecutableFromMiddleware, getExecutableFromRawMiddleware, getExecutableFromRoute, getHostRequestHandler, getMaxRouteBodySize, getMiddlewareExecutable, getMiddlewaresSize, getNotFoundExecutionChain, getPlatformConfig, getPlatformMaxBodySize, getPlatformRequestCap, getResponseDefaults, getRouteExecutable, getRouteExecutionChain, getRouterOptions, getRoutesSize, getTotalExecutables, handOverToHost, hostOwnsSocket, isPrivateDefinition, resetRouter, setHostOwnsSocket, setPlatformConfig, shouldFullGenerateSpec, startMiddlewares } from "./src/router.js";
12
11
  import { BodyReadStrategy, readRequestBody, requestPayloadTooLarge } from "./src/lib/bodyReader.js";
13
- export { BodyReadStrategy, DEFAULT_ROUTE_OPTIONS, FetchResponseHeaders, JSON_CONTENT_TYPE, MAX_ROUTE_NESTING, RecordResponseHeaders, addEndMiddlewares, addStartMiddlewares, addThrownError, callerForType, capBatchBodySizes, clearBatches, createCallContext, createContextFromChain, createMionRouter, decodeQueryBody, dispatchMaybeSync, dispatchPlatformError, dispatchRoute, dispatchWithContext, endMiddlewares, errorHeaderValue, geRoutesSize, getAllExecutablesIds, getAnyExecutable, getBatch, getBatchExecutionChain, getBatchIds, getBuildVersion, getComplexity, getDefaultFetchHeaders, getDefaultHeaders, getExecutableFromMiddleware, getExecutableFromRawMiddleware, getExecutableFromRoute, getHostRequestHandler, getMaxBatchBodySize, getMaxRouteBodySize, getMethodCaller, getMiddlewareExecutable, getMiddlewaresSize, getNotFoundExecutionChain, getPlatformConfig, getPlatformMaxBodySize, getPlatformRequestCap, getPublicApi, getRequestBodyType, getResponseDefaults, getRouteEntries, getRouteExecutable, getRouteExecutionChain, getRouterFatalErrorResponse, getRouterOptions, getSerializableMethod, getTotalExecutables, handOverToHost, hasThrownError, headersFromRecord, hostOwnsSocket, isAnyMiddlewareDef, isExecutable, isHeaderExecutable, isHeadersMiddlewareDef, isMiddlewareDef, isPrivateDefinition, isPublicExecutable, isRawExecutable, isRawMiddlewareDef, isRoute, isRouteDef, isRouteExecutable, isRoutes, markResponseFailed, mionErrorsRoutes, readBatchId, readRequestBody, recordUndeclaredError, refreshBatchChainBodyLimits, registerBatches, releaseHeaders, replaceBatches, replyFetch, requestPayloadTooLarge, resetRemoteMethodsMetadata, resetRouter, resolveBatchMaxBodySize, resolveExecutionChain, serializeJitFn, serializeMethodDeps, serializePureDeps, setHostOwnsSocket, setPlatformConfig, shouldFullGenerateSpec, startMiddlewares, toRpcError };
12
+ import { toHttpMethod } from "./src/lib/httpMethod.js";
13
+ export { BodyReadStrategy, DEFAULT_ROUTE_OPTIONS, FetchResponseHeaders, JSON_CONTENT_TYPE, MAX_ROUTE_NESTING, MION_SERVER_NAME, RecordResponseHeaders, addEndMiddlewares, addStartMiddlewares, addThrownError, assertHeaderSafe, callerForType, capBatchBodySizes, clearBatches, createCallContext, createContextFromChain, createMionRouter, dispatchMaybeSync, dispatchPlatformError, dispatchRoute, dispatchWithContext, endChain, endMiddlewares, errorHeaderValue, getAllExecutablesIds, getAnyExecutable, getBatch, getBatchExecutionChain, getBatchIds, getBuildVersion, getComplexity, getDefaultFetchHeaders, getDefaultHeaders, getExecutableFromMiddleware, getExecutableFromRawMiddleware, getExecutableFromRoute, getHostRequestHandler, getMaxBatchBodySize, getMaxRouteBodySize, getMethodCaller, getMiddlewareExecutable, getMiddlewaresSize, getNotFoundExecutionChain, getPlatformConfig, getPlatformMaxBodySize, getPlatformRequestCap, getPublicApi, getRequestBodyType, getResponseDefaults, getRouteExecutable, getRouteExecutionChain, getRouterFatalErrorResponse, getRouterOptions, getRoutesSize, getSerializableMethod, getTotalExecutables, handOverToHost, hasThrownError, headersFromRecord, hostOwnsSocket, isAnyMiddlewareDef, isExecutable, isHeadersMiddlewareDef, isMiddlewareDef, isPrivateDefinition, isPublicExecutable, isRawMiddlewareDef, isRoute, isRoutes, markResponseFailed, mionErrorsRoutes, readBatchId, readRequestBody, recordUndeclaredError, refreshBatchChainBodyLimits, registerBatches, releaseHeaders, replaceBatches, replyFetch, requestPayloadTooLarge, resetRemoteMethodsMetadata, resetRouter, resolveBatchMaxBodySize, resolveExecutionChain, serializeJitFn, serializeMethodDeps, serializePureDeps, setHostOwnsSocket, setPlatformConfig, shouldFullGenerateSpec, startMiddlewares, toHttpMethod, toRpcError };
@@ -1,3 +1,4 @@
1
1
  export { mionFetchMetadata } from './src/middlewares/fetchMetadata.ts';
2
2
  export { mionSyncRoutes } from './src/middlewares/syncRoutes.ts';
3
+ export { mionSecurity } from './src/middlewares/security.ts';
3
4
  //# sourceMappingURL=middlewares.d.ts.map
@@ -1,3 +1,4 @@
1
1
  import { mionFetchMetadata } from "./src/middlewares/fetchMetadata.js";
2
2
  import { mionSyncRoutes } from "./src/middlewares/syncRoutes.js";
3
- export { mionFetchMetadata, mionSyncRoutes };
3
+ import { mionSecurity } from "./src/middlewares/security.js";
4
+ export { mionFetchMetadata, mionSecurity, mionSyncRoutes };
@@ -2,10 +2,10 @@ import { addThrownError, hasThrownError } from "./lib/dispatchError.js";
2
2
  import { findMionQueryParam } from "./lib/urlQuery.js";
3
3
  import { getMethodCaller } from "./dispatch.js";
4
4
  import { endMiddlewares, getPlatformRequestCap, getRouteExecutionChain, getRouterOptions, startMiddlewares } from "./router.js";
5
- import { FatalError, HandlerType, ROUTER_ITEM_SEPARATOR_CHAR, RpcError, StatusCodes, getInputMapper, getNoopJitFns, getOrCreateGlobal, getRoutePath, hasInputMapper, isRpcError } from "@mionjs/core";
5
+ import { FatalError, HandlerType, ROUTER_ITEM_SEPARATOR_CHAR, RpcError, StatusCodes, getInputMapper, getNoopJitFns, getRoutePath, hasInputMapper, isRpcError } from "@mionjs/core";
6
6
  //#region src/batches.ts
7
- var batchesById = getOrCreateGlobal("mion.router.batchesById", () => /* @__PURE__ */ new Map());
8
- var mappingMethodCache = getOrCreateGlobal("mion.router.batchMappingMethodCache", () => /* @__PURE__ */ new Map());
7
+ var batchesById = /* @__PURE__ */ new Map();
8
+ var mappingMethodCache = /* @__PURE__ */ new Map();
9
9
  /** A malformed definition is a configuration error and throws at registration, never at request time.
10
10
  * Re-registering an id replaces it; ids not in `table` are left alone (replaceBatches is the whole-table form). */
11
11
  function registerBatches(table) {
@@ -1 +1 @@
1
- {"version":3,"file":"batches.js","names":[],"sources":["../../../src/batches.ts"],"sourcesContent":["/* ########\n * 2026 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport {\n RpcError,\n FatalError,\n StatusCodes,\n HandlerType,\n getNoopJitFns,\n getOrCreateGlobal,\n getRoutePath,\n ROUTER_ITEM_SEPARATOR_CHAR,\n isRpcError,\n} from '@mionjs/core';\nimport {getInputMapper, hasInputMapper} from '@mionjs/core';\nimport type {BatchDefinition, BatchMapping} from '@mionjs/core';\nimport {getRouteExecutionChain, getPlatformRequestCap, getRouterOptions, startMiddlewares, endMiddlewares} from './router.ts';\nimport {getMethodCaller} from './dispatch.ts';\nimport {findMionQueryParam} from './lib/urlQuery.ts';\nimport {addThrownError, hasThrownError} from './lib/dispatchError.ts';\nimport {RouterOptions} from './types/general.ts';\nimport {MethodsExecutionChain, RemoteMethod} from './types/remoteMethods.ts';\nimport type {CallContext} from './types/context.ts';\n\n// ############# BATCH REGISTRY #############\n//\n// A batch is several routes run in ONE request, with `inputFrom` mappings feeding one route's output\n// into another's input on the server. The client build hashes each `batch([...])` call site's ordered\n// route ids into an id and compiles the id → definition table into the server (the generated\n// `.mion/rpc/batches.generated.js` calls replaceBatches), so a request carries only the id: nothing\n// untrusted describes a chain, there is no shape to check and no count to cap. Batches are NOT routes:\n// they live here apart from the route table, never looked up by path, and the merged chain is built\n// once per id (once per tenant when a pathTransform reads the request) and kept on the entry.\n\nexport interface BatchEntry {\n readonly id: string;\n /** Route ids in call order */\n readonly routes: readonly string[];\n readonly mappings: readonly BatchMapping[];\n /** Merged chains keyed by the pathTransform-resolved paths ('' when there is no transform) */\n readonly chains: Map<string, MethodsExecutionChain>;\n /** The members' resolved limits plus the envelope, fixed when the first chain is built (see resolveBatchMaxBodySize) */\n maxBodySize?: number;\n}\n\nconst batchesById = getOrCreateGlobal('mion.router.batchesById', () => new Map<string, BatchEntry>());\nconst mappingMethodCache = getOrCreateGlobal('mion.router.batchMappingMethodCache', () => new Map<string, RemoteMethod>());\n\n/** A malformed definition is a configuration error and throws at registration, never at request time.\n * Re-registering an id replaces it; ids not in `table` are left alone (replaceBatches is the whole-table form). */\nexport function registerBatches(table: Record<string, BatchDefinition>): void {\n for (const [id, definition] of Object.entries(table)) {\n assertValidBatchDefinition(id, definition);\n batchesById.set(id, {\n id,\n routes: [...definition.routes],\n mappings: definition.mappings ? definition.mappings.map((mapping) => ({...mapping})) : [],\n chains: new Map(),\n });\n }\n}\n\n/** Replaces the WHOLE table. What the generated `.mion/rpc/batches.generated.js` calls, so every\n * evaluation of it leaves exactly that file's batches registered and nothing from before. */\nexport function replaceBatches(table: Record<string, BatchDefinition>): void {\n clearBatches();\n registerBatches(table);\n}\n\n/** The table is build-generated, so this only guards against a stale or hand-edited manifest. */\nfunction assertValidBatchDefinition(id: string, definition: BatchDefinition): void {\n const invalid = (reason: string): never => {\n throw new Error(`[mion batches] batch '${id}' is malformed: ${reason}.`);\n };\n if (!id) invalid('empty id');\n if (!definition || typeof definition !== 'object') invalid('expected an object');\n if (!Array.isArray(definition.routes) || definition.routes.length === 0) invalid('`routes` must be a non-empty array');\n if (definition.routes.some((route) => typeof route !== 'string' || !route)) invalid('`routes` must be route ids');\n if (definition.mappings === undefined) return;\n if (!Array.isArray(definition.mappings)) invalid('`mappings` must be an array');\n for (const mapping of definition.mappings) {\n if (!mapping || typeof mapping !== 'object') invalid('every mapping must be an object');\n const {fromId, toId, mapperKey, paramIndex} = mapping;\n if (typeof fromId !== 'string' || typeof toId !== 'string' || typeof mapperKey !== 'string')\n invalid('mapping `fromId`, `toId` and `mapperKey` must be strings');\n if (!definition.routes.includes(fromId)) invalid(`mapping source '${fromId}' is not a route of the batch`);\n if (!definition.routes.includes(toId)) invalid(`mapping target '${toId}' is not a route of the batch`);\n // Integer + non-negative, so paramIndex can only ever be an array INDEX (never a property name\n // like '__proto__'); the upper bound needs the target's arity, checked while the chain is built.\n if (typeof paramIndex !== 'number' || !Number.isInteger(paramIndex) || paramIndex < 0)\n invalid('mapping `paramIndex` must be a non-negative integer');\n }\n}\n\nexport function getBatch(id: string): BatchEntry | undefined {\n return batchesById.get(id);\n}\n\n/** Ids of every registered batch, for the metadata route. */\nexport function getBatchIds(): string[] {\n return [...batchesById.keys()];\n}\n\n/** Called by resetRouter and replaceBatches. */\nexport function clearBatches(): void {\n batchesById.clear();\n mappingMethodCache.clear();\n}\n\n/** The member routes' resolved limits (each already carries its factor and envelope, or the platform's\n * number when its types cannot say) plus the outer braces, fixed the first time a chain is built. */\nexport function resolveBatchMaxBodySize(entry: BatchEntry, memberChains: MethodsExecutionChain[]): number {\n if (entry.maxBodySize === undefined) entry.maxBodySize = sumChainMaxBodySize(memberChains);\n return entry.maxBodySize;\n}\n\nfunction sumChainMaxBodySize(chains: MethodsExecutionChain[]): number {\n let total = 2;\n for (const chain of chains) total += chain.maxBodySize;\n return Math.min(total, getPlatformRequestCap() ?? Infinity);\n}\n\n/** The limits not yet settled read the platform ceiling when they are. */\nexport function capBatchBodySizes(maxRequestSize: number): void {\n for (const entry of batchesById.values()) {\n if (entry.maxBodySize !== undefined && entry.maxBodySize > maxRequestSize) entry.maxBodySize = maxRequestSize;\n }\n}\n\n/** Re-folds every ALREADY built chain from its entry's current number: without it a chain built before\n * a later setPlatformConfig keeps serving a limit the platform has since promised to refuse. */\nexport function refreshBatchChainBodyLimits(platformMaxBodySize: number): void {\n for (const entry of batchesById.values()) {\n const limit = entry.maxBodySize ?? platformMaxBodySize;\n for (const chain of entry.chains.values()) {\n chain.declaredBodySize = entry.maxBodySize;\n chain.maxBodySize = limit;\n }\n }\n}\n\n/** The largest limit any registered batch resolves to, over the member routes' untransformed\n * paths: what bun sizes its native server limit with (see getMaxRouteBodySize). */\nexport function getMaxBatchBodySize(): number {\n const opts = getRouterOptions();\n let largest = 0;\n for (const entry of batchesById.values()) {\n if (entry.maxBodySize !== undefined) {\n largest = Math.max(largest, entry.maxBodySize);\n continue;\n }\n const chains: MethodsExecutionChain[] = [];\n for (const routeId of entry.routes) {\n const chain = getRouteExecutionChain(getRoutePath(routeId.split(ROUTER_ITEM_SEPARATOR_CHAR), opts));\n if (chain) chains.push(chain);\n }\n largest = Math.max(largest, sumChainMaxBodySize(chains));\n }\n return largest;\n}\n\n// ############# REQUEST RESOLUTION #############\n\n/** `id=<batchId>` is the only parameter the batch endpoint reads; missing or undecodable is an unknown id.\n * The id is the one query value that IS percent-decoded, so it survives a `/` or a space in a route name. */\nexport function readBatchId(urlQuery: string | undefined): string | undefined {\n const rawId = findMionQueryParam(urlQuery, 'id');\n if (rawId === undefined) return undefined;\n try {\n return decodeURIComponent(rawId) || undefined;\n } catch {\n return undefined;\n }\n}\n\n/** Runs while the call context is acquired, BEFORE the body is read, so an unknown id costs nothing but\n * a Map lookup: it answers undefined and the caller resolves the batch not-found chain.\n * The id is the only untrusted input and it is never echoed back. */\nexport function getBatchExecutionChain(\n rawRequest: unknown,\n opts: RouterOptions,\n urlQuery?: string\n): MethodsExecutionChain | undefined {\n const batchId = readBatchId(urlQuery);\n const entry = batchId ? getBatch(batchId) : undefined;\n if (!entry) return undefined;\n\n // pathTransform may read the request (a tenant header, the host), so with a transform the chains are\n // kept per resolved path list: the same id from two requests that resolve differently never shares a chain.\n const routePaths = entry.routes.map((routeId) => getRoutePath(routeId.split(ROUTER_ITEM_SEPARATOR_CHAR), opts));\n const transformedPaths = opts.pathTransform\n ? routePaths.map((routePath) => opts.pathTransform!(rawRequest, routePath) || routePath)\n : routePaths;\n const chainKey = opts.pathTransform ? transformedPaths.join(',') : '';\n let executionChain = entry.chains.get(chainKey);\n if (!executionChain) {\n executionChain = buildMergedExecutionChain(entry, transformedPaths);\n entry.chains.set(chainKey, executionChain);\n }\n return executionChain;\n}\n\n/** Takes already-transformed paths; each mapping step goes between its source and target route. */\nfunction buildMergedExecutionChain(entry: BatchEntry, transformedPaths: string[]): MethodsExecutionChain {\n const seenIds = new Set<string>();\n const middleMethods: RemoteMethod[] = [];\n const memberChains: MethodsExecutionChain[] = [];\n let firstRouteIndex = -1;\n\n const startMiddlewareIds = new Set(startMiddlewares.map((method) => method.id));\n const endMiddlewareIds = new Set(endMiddlewares.map((method) => method.id));\n\n transformedPaths.forEach((transformedPath, index) => {\n const chain = getRouteExecutionChain(transformedPath);\n if (!chain) {\n throw new FatalError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n type: 'batch-route-not-found',\n publicMessage: `Route '${entry.routes[index]}' of batch '${entry.id}' is not registered on this server.`,\n errorData: {batchId: entry.id, routeId: entry.routes[index]},\n });\n }\n\n memberChains.push(chain);\n if (firstRouteIndex < 0) firstRouteIndex = chain.routeIndex;\n\n // start and end middlewares are added separately, so skip them here\n for (const method of chain.methods) {\n if (seenIds.has(method.id)) continue;\n if (startMiddlewareIds.has(method.id)) continue;\n if (endMiddlewareIds.has(method.id)) continue;\n seenIds.add(method.id);\n middleMethods.push(method);\n }\n });\n\n if (entry.mappings.length > 0) insertMappingMethods(entry, middleMethods);\n\n const methods = [...startMiddlewares, ...middleMethods, ...endMiddlewares];\n // A batch declares the sum its members resolved to\n const declaredBodySize = resolveBatchMaxBodySize(entry, memberChains);\n return {\n // where the first route handler sits in the merged methods\n routeIndex: firstRouteIndex,\n methods,\n // cached per member-path list, so one chain answers every endpoint path that reaches it\n path: undefined,\n batchId: entry.id,\n batchRouteIds: entry.routes as string[],\n declaredBodySize,\n maxBodySize: declaredBodySize,\n readsBody: true,\n };\n}\n\n// ############# MAPPING METHODS #############\n\n/**\n * Inserts mapping methods into the middleMethods array in the correct position.\n * Each mapping method is inserted after the source route (fromId) and before the target route (toId).\n */\nfunction insertMappingMethods(entry: BatchEntry, middleMethods: RemoteMethod[]): void {\n const idToIndex = new Map<string, number>();\n for (let i = 0; i < middleMethods.length; i++) idToIndex.set(middleMethods[i].id, i);\n\n const insertions: Array<{index: number; method: RemoteMethod}> = [];\n\n for (const mapping of entry.mappings) {\n const fromIndex = idToIndex.get(mapping.fromId);\n const toIndex = idToIndex.get(mapping.toId);\n if (fromIndex === undefined) {\n throw new FatalError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n type: 'batch-mapping-invalid-source',\n publicMessage: `Mapping source route '${mapping.fromId}' not found in batch '${entry.id}'.`,\n errorData: {batchId: entry.id, mapping},\n });\n }\n if (toIndex === undefined) {\n throw new FatalError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n type: 'batch-mapping-invalid-target',\n publicMessage: `Mapping target route '${mapping.toId}' not found in batch '${entry.id}'.`,\n errorData: {batchId: entry.id, mapping},\n });\n }\n\n // paramIndex is a non-negative integer (registerBatches); the UPPER bound needs the target's\n // arity, only known here. A mapping can never write past the params the route declares, unless a rest param takes them.\n const target = middleMethods[toIndex];\n const targetParamsCount = target.paramsCount ?? 0;\n if (mapping.paramIndex >= targetParamsCount && !target.paramsRest) {\n throw new FatalError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n type: 'batch-mapping-invalid-param-index',\n publicMessage:\n `Mapping paramIndex ${mapping.paramIndex} is out of range for target route '${mapping.toId}', ` +\n `which takes ${targetParamsCount} parameter(s).`,\n errorData: {batchId: entry.id, mapping},\n });\n }\n\n // The allow-list is the gate on what a table may reference: the mapper's pure-fn id, as\n // harvested from the client build. An id that came through no mion lane is REJECTED here,\n // never evaluated.\n if (!hasInputMapper(mapping.mapperKey)) {\n throw new FatalError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n type: 'batch-mapper-not-allowed',\n publicMessage: `Input mapper '${mapping.mapperKey}' is not registered on the server.`,\n errorData: {batchId: entry.id, mapping},\n });\n }\n\n insertions.push({index: fromIndex + 1, method: createMappingMethod(mapping)});\n // Run the target only when every mapping into it produced a value: a failed source leaves it a thrown error.\n middleMethods[toIndex] = guardMappedTarget(middleMethods[toIndex]);\n }\n\n // descending, so a splice never shifts the indices still to come\n insertions.sort((a, b) => b.index - a.index);\n for (const {index, method} of insertions) middleMethods.splice(index, 0, method);\n}\n\n/** A copy, never a mutation: the route's own RemoteMethod is shared with every plain call to that route. */\nfunction guardMappedTarget(target: RemoteMethod): RemoteMethod {\n if ((target as GuardedTarget).mappedTargetOf) return target;\n const guarded = {\n ...target,\n mappedTargetOf: target,\n // async whatever the target is, so the dispatcher must await this member\n isAsync: true,\n methodCaller: async (context: CallContext, executable: RemoteMethod, ...args: unknown[]) => {\n if (hasThrownError(context, executable.id)) return undefined;\n // the shared method carries its caller from registration, same as the dispatcher reads\n return getMethodCaller(target)(context, executable, ...args);\n },\n } as GuardedTarget;\n return guarded;\n}\n\ntype GuardedTarget = RemoteMethod & {mappedTargetOf?: RemoteMethod};\n\nfunction createMappingMethod(mapping: BatchMapping): RemoteMethod {\n const id = `mionInputFrom_${mapping.fromId}_${mapping.mapperKey}_to_${mapping.toId}`;\n const cached = mappingMethodCache.get(id);\n if (cached) return cached;\n\n const noopJitFns = getNoopJitFns();\n const method = {\n type: HandlerType.rawMiddleware,\n id,\n hasReturnData: false,\n paramsJitHash: '',\n returnJitHash: '',\n paramsJitFns: noopJitFns,\n returnJitFns: noopJitFns,\n handler: createMappingHandler(mapping),\n options: {alwaysRun: false},\n alwaysRun: false,\n // runMappingHandler is async, so this member must be awaited\n isAsync: true,\n methodCaller: runMappingHandler,\n } as RemoteMethod;\n\n mappingMethodCache.set(id, method);\n return method;\n}\n\nfunction createMappingHandler(mapping: BatchMapping) {\n return (ctx: CallContext) => {\n // own key only: a source named like `toString` that stored nothing would feed Object.prototype's function\n const sourceOutput = Object.hasOwn(ctx.response.body, mapping.fromId) ? ctx.response.body[mapping.fromId] : undefined;\n // A failed or skipped source has nothing to map: the error goes to @thrownErrors, the target's slots hold only what it declares.\n if (isRpcError(sourceOutput) || hasThrownError(ctx, mapping.fromId)) {\n addThrownError(\n ctx,\n mapping.toId,\n new RpcError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n type: 'batch-mapping-source-failed',\n publicMessage: `Route '${mapping.fromId}' failed, so the input it feeds into '${mapping.toId}' could not be computed.`,\n errorData: {fromId: mapping.fromId, toId: mapping.toId, paramIndex: mapping.paramIndex},\n })\n );\n return;\n }\n const pureFn = getInputMapper(mapping.mapperKey);\n if (!pureFn) {\n throw new FatalError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n type: 'batch-mapper-not-allowed',\n publicMessage: `Input mapper '${mapping.mapperKey}' not found at runtime.`,\n });\n }\n let mappedValue: unknown;\n try {\n mappedValue = pureFn(sourceOutput);\n } catch (error) {\n // thrown, so the batch stops like any handler error, but typed and with no registry key in the message\n throw new FatalError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n type: 'batch-mapper-failed',\n publicMessage: `The input mapper feeding route '${mapping.toId}' from '${mapping.fromId}' threw.`,\n errorData: {fromId: mapping.fromId, toId: mapping.toId, paramIndex: mapping.paramIndex},\n originalError: error as Error,\n });\n }\n // the client sent a null placeholder at paramIndex\n // an array check, not truthiness: an id like `toString` finds a prototype function, a wire value may be a string\n const targetParams = ctx.request.body[mapping.toId];\n if (Array.isArray(targetParams)) targetParams[mapping.paramIndex] = mappedValue;\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nasync function runMappingHandler(context: CallContext, executable: RemoteMethod, ...args: unknown[]) {\n return executable.handler(context);\n}\n"],"mappings":";;;;;;AAiDA,IAAM,cAAc,kBAAkB,iDAAiC,IAAI,IAAwB,CAAC;AACpG,IAAM,qBAAqB,kBAAkB,6DAA6C,IAAI,IAA0B,CAAC;;;AAIzH,SAAgB,gBAAgB,OAA8C;CAC5E,KAAK,MAAM,CAAC,IAAI,eAAe,OAAO,QAAQ,KAAK,GAAG;EACpD,2BAA2B,IAAI,UAAU;EACzC,YAAY,IAAI,IAAI;GAClB;GACA,QAAQ,CAAC,GAAG,WAAW,MAAM;GAC7B,UAAU,WAAW,WAAW,WAAW,SAAS,KAAK,aAAa,EAAC,GAAG,QAAO,EAAE,IAAI,CAAC;GACxF,wBAAQ,IAAI,IAAI;EAClB,CAAC;CACH;AACF;;;AAIA,SAAgB,eAAe,OAA8C;CAC3E,aAAa;CACb,gBAAgB,KAAK;AACvB;;AAGA,SAAS,2BAA2B,IAAY,YAAmC;CACjF,MAAM,WAAW,WAA0B;EACzC,MAAM,IAAI,MAAM,yBAAyB,GAAG,kBAAkB,OAAO,EAAE;CACzE;CACA,IAAI,CAAC,IAAI,QAAQ,UAAU;CAC3B,IAAI,CAAC,cAAc,OAAO,eAAe,UAAU,QAAQ,oBAAoB;CAC/E,IAAI,CAAC,MAAM,QAAQ,WAAW,MAAM,KAAK,WAAW,OAAO,WAAW,GAAG,QAAQ,oCAAoC;CACrH,IAAI,WAAW,OAAO,MAAM,UAAU,OAAO,UAAU,YAAY,CAAC,KAAK,GAAG,QAAQ,4BAA4B;CAChH,IAAI,WAAW,aAAa,KAAA,GAAW;CACvC,IAAI,CAAC,MAAM,QAAQ,WAAW,QAAQ,GAAG,QAA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KAAC,QAAQ,QAAQ;KAAQ,MAAM,QAAQ;KAAM,YAAY,QAAQ;IAAU;GACxF,CAAC,CACH;GACA;EACF;EACA,MAAM,SAAS,eAAe,QAAQ,SAAS;EAC/C,IAAI,CAAC,QACH,MAAM,IAAI,WAAW;GACnB,YAAY,YAAY;GACxB,MAAM;GACN,eAAe,iBAAiB,QAAQ,UAAU;EACpD,CAAC;EAEH,IAAI;EACJ,IAAI;GACF,cAAc,OAAO,YAAY;EACnC,SAAS,OAAO;GAEd,MAAM,IAAI,WAAW;IACnB,YAAY,YAAY;IACxB,MAAM;IACN,eAAe,mCAAmC,QAAQ,KAAK,UAAU,QAAQ,OAAO;IACxF,WAAW;KAAC,QAAQ,QAAQ;KAAQ,MAAM,QAAQ;KAAM,YAAY,QAAQ;IAAU;IACtF,eAAe;GACjB,CAAC;EACH;EAGA,MAAM,eAAe,IAAI,QAAQ,KAAK,QAAQ;EAC9C,IAAI,MAAM,QAAQ,YAAY,GAAG,aAAa,QAAQ,cAAc;CACtE;AACF;AAGA,eAAe,kBAAkB,SAAsB,YAA0B,GAAG,MAAiB;CACnG,OAAO,WAAW,QAAQ,OAAO;AACnC"}
1
+ {"version":3,"file":"batches.js","names":[],"sources":["../../../src/batches.ts"],"sourcesContent":["/* ########\n * 2026 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport {\n RpcError,\n FatalError,\n StatusCodes,\n HandlerType,\n getNoopJitFns,\n getRoutePath,\n ROUTER_ITEM_SEPARATOR_CHAR,\n isRpcError,\n} from '@mionjs/core';\nimport {getInputMapper, hasInputMapper} from '@mionjs/core';\nimport type {BatchDefinition, BatchMapping} from '@mionjs/core';\nimport {getRouteExecutionChain, getPlatformRequestCap, getRouterOptions, startMiddlewares, endMiddlewares} from './router.ts';\nimport {getMethodCaller} from './dispatch.ts';\nimport {findMionQueryParam} from './lib/urlQuery.ts';\nimport {addThrownError, hasThrownError} from './lib/dispatchError.ts';\nimport {RouterOptions} from './types/general.ts';\nimport {MethodsExecutionChain, RemoteMethod} from './types/remoteMethods.ts';\nimport type {CallContext} from './types/context.ts';\n\n// ############# BATCH REGISTRY #############\n//\n// A batch is several routes run in ONE request, with `inputFrom` mappings feeding one route's output\n// into another's input on the server. The client build hashes each `batch([...])` call site's ordered\n// route ids into an id and compiles the id → definition table into the server (the generated\n// `.mion/rpc/batches.generated.js` calls replaceBatches), so a request carries only the id: nothing\n// untrusted describes a chain, there is no shape to check and no count to cap. Batches are NOT routes:\n// they live here apart from the route table, never looked up by path, and the merged chain is built\n// once per id (once per tenant when a pathTransform reads the request) and kept on the entry.\n\nexport interface BatchEntry {\n readonly id: string;\n /** Route ids in call order */\n readonly routes: readonly string[];\n readonly mappings: readonly BatchMapping[];\n /** Merged chains keyed by the pathTransform-resolved paths ('' when there is no transform) */\n readonly chains: Map<string, MethodsExecutionChain>;\n /** The members' resolved limits plus the envelope, fixed when the first chain is built (see resolveBatchMaxBodySize) */\n maxBodySize?: number;\n}\n\nconst batchesById = new Map<string, BatchEntry>();\nconst mappingMethodCache = new Map<string, RemoteMethod>();\n\n/** A malformed definition is a configuration error and throws at registration, never at request time.\n * Re-registering an id replaces it; ids not in `table` are left alone (replaceBatches is the whole-table form). */\nexport function registerBatches(table: Record<string, BatchDefinition>): void {\n for (const [id, definition] of Object.entries(table)) {\n assertValidBatchDefinition(id, definition);\n batchesById.set(id, {\n id,\n routes: [...definition.routes],\n mappings: definition.mappings ? definition.mappings.map((mapping) => ({...mapping})) : [],\n chains: new Map(),\n });\n }\n}\n\n/** Replaces the WHOLE table. What the generated `.mion/rpc/batches.generated.js` calls, so every\n * evaluation of it leaves exactly that file's batches registered and nothing from before. */\nexport function replaceBatches(table: Record<string, BatchDefinition>): void {\n clearBatches();\n registerBatches(table);\n}\n\n/** The table is build-generated, so this only guards against a stale or hand-edited manifest. */\nfunction assertValidBatchDefinition(id: string, definition: BatchDefinition): void {\n const invalid = (reason: string): never => {\n throw new Error(`[mion batches] batch '${id}' is malformed: ${reason}.`);\n };\n if (!id) invalid('empty id');\n if (!definition || typeof definition !== 'object') invalid('expected an object');\n if (!Array.isArray(definition.routes) || definition.routes.length === 0) invalid('`routes` must be a non-empty array');\n if (definition.routes.some((route) => typeof route !== 'string' || !route)) invalid('`routes` must be route ids');\n if (definition.mappings === undefined) return;\n if (!Array.isArray(definition.mappings)) invalid('`mappings` must be an array');\n for (const mapping of definition.mappings) {\n if (!mapping || typeof mapping !== 'object') invalid('every mapping must be an object');\n const {fromId, toId, mapperKey, paramIndex} = mapping;\n if (typeof fromId !== 'string' || typeof toId !== 'string' || typeof mapperKey !== 'string')\n invalid('mapping `fromId`, `toId` and `mapperKey` must be strings');\n if (!definition.routes.includes(fromId)) invalid(`mapping source '${fromId}' is not a route of the batch`);\n if (!definition.routes.includes(toId)) invalid(`mapping target '${toId}' is not a route of the batch`);\n // Integer + non-negative, so paramIndex can only ever be an array INDEX (never a property name\n // like '__proto__'); the upper bound needs the target's arity, checked while the chain is built.\n if (typeof paramIndex !== 'number' || !Number.isInteger(paramIndex) || paramIndex < 0)\n invalid('mapping `paramIndex` must be a non-negative integer');\n }\n}\n\nexport function getBatch(id: string): BatchEntry | undefined {\n return batchesById.get(id);\n}\n\n/** Ids of every registered batch, for the metadata route. */\nexport function getBatchIds(): string[] {\n return [...batchesById.keys()];\n}\n\n/** Called by resetRouter and replaceBatches. */\nexport function clearBatches(): void {\n batchesById.clear();\n mappingMethodCache.clear();\n}\n\n/** The member routes' resolved limits (each already carries its factor and envelope, or the platform's\n * number when its types cannot say) plus the outer braces, fixed the first time a chain is built. */\nexport function resolveBatchMaxBodySize(entry: BatchEntry, memberChains: MethodsExecutionChain[]): number {\n if (entry.maxBodySize === undefined) entry.maxBodySize = sumChainMaxBodySize(memberChains);\n return entry.maxBodySize;\n}\n\nfunction sumChainMaxBodySize(chains: MethodsExecutionChain[]): number {\n let total = 2;\n for (const chain of chains) total += chain.maxBodySize;\n return Math.min(total, getPlatformRequestCap() ?? Infinity);\n}\n\n/** The limits not yet settled read the platform ceiling when they are. */\nexport function capBatchBodySizes(maxRequestSize: number): void {\n for (const entry of batchesById.values()) {\n if (entry.maxBodySize !== undefined && entry.maxBodySize > maxRequestSize) entry.maxBodySize = maxRequestSize;\n }\n}\n\n/** Re-folds every ALREADY built chain from its entry's current number: without it a chain built before\n * a later setPlatformConfig keeps serving a limit the platform has since promised to refuse. */\nexport function refreshBatchChainBodyLimits(platformMaxBodySize: number): void {\n for (const entry of batchesById.values()) {\n const limit = entry.maxBodySize ?? platformMaxBodySize;\n for (const chain of entry.chains.values()) {\n chain.declaredBodySize = entry.maxBodySize;\n chain.maxBodySize = limit;\n }\n }\n}\n\n/** The largest limit any registered batch resolves to, over the member routes' untransformed\n * paths: what bun sizes its native server limit with (see getMaxRouteBodySize). */\nexport function getMaxBatchBodySize(): number {\n const opts = getRouterOptions();\n let largest = 0;\n for (const entry of batchesById.values()) {\n if (entry.maxBodySize !== undefined) {\n largest = Math.max(largest, entry.maxBodySize);\n continue;\n }\n const chains: MethodsExecutionChain[] = [];\n for (const routeId of entry.routes) {\n const chain = getRouteExecutionChain(getRoutePath(routeId.split(ROUTER_ITEM_SEPARATOR_CHAR), opts));\n if (chain) chains.push(chain);\n }\n largest = Math.max(largest, sumChainMaxBodySize(chains));\n }\n return largest;\n}\n\n// ############# REQUEST RESOLUTION #############\n\n/** `id=<batchId>` is the only parameter the batch endpoint reads; missing or undecodable is an unknown id.\n * The id is the one query value that IS percent-decoded, so it survives a `/` or a space in a route name. */\nexport function readBatchId(urlQuery: string | undefined): string | undefined {\n const rawId = findMionQueryParam(urlQuery, 'id');\n if (rawId === undefined) return undefined;\n try {\n return decodeURIComponent(rawId) || undefined;\n } catch {\n return undefined;\n }\n}\n\n/** Runs while the call context is acquired, BEFORE the body is read, so an unknown id costs nothing but\n * a Map lookup: it answers undefined and the caller resolves the batch not-found chain.\n * The id is the only untrusted input and it is never echoed back. */\nexport function getBatchExecutionChain(\n rawRequest: unknown,\n opts: RouterOptions,\n urlQuery?: string\n): MethodsExecutionChain | undefined {\n const batchId = readBatchId(urlQuery);\n const entry = batchId ? getBatch(batchId) : undefined;\n if (!entry) return undefined;\n\n // pathTransform may read the request (a tenant header, the host), so with a transform the chains are\n // kept per resolved path list: the same id from two requests that resolve differently never shares a chain.\n const routePaths = entry.routes.map((routeId) => getRoutePath(routeId.split(ROUTER_ITEM_SEPARATOR_CHAR), opts));\n const transformedPaths = opts.pathTransform\n ? routePaths.map((routePath) => opts.pathTransform!(rawRequest, routePath) || routePath)\n : routePaths;\n const chainKey = opts.pathTransform ? transformedPaths.join(',') : '';\n let executionChain = entry.chains.get(chainKey);\n if (!executionChain) {\n executionChain = buildMergedExecutionChain(entry, transformedPaths);\n entry.chains.set(chainKey, executionChain);\n }\n return executionChain;\n}\n\n/** Takes already-transformed paths; each mapping step goes between its source and target route. */\nfunction buildMergedExecutionChain(entry: BatchEntry, transformedPaths: string[]): MethodsExecutionChain {\n const seenIds = new Set<string>();\n const middleMethods: RemoteMethod[] = [];\n const memberChains: MethodsExecutionChain[] = [];\n let firstRouteIndex = -1;\n\n const startMiddlewareIds = new Set(startMiddlewares.map((method) => method.id));\n const endMiddlewareIds = new Set(endMiddlewares.map((method) => method.id));\n\n transformedPaths.forEach((transformedPath, index) => {\n const chain = getRouteExecutionChain(transformedPath);\n if (!chain) {\n throw new FatalError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n type: 'batch-route-not-found',\n publicMessage: `Route '${entry.routes[index]}' of batch '${entry.id}' is not registered on this server.`,\n errorData: {batchId: entry.id, routeId: entry.routes[index]},\n });\n }\n\n memberChains.push(chain);\n if (firstRouteIndex < 0) firstRouteIndex = chain.routeIndex;\n\n // start and end middlewares are added separately, so skip them here\n for (const method of chain.methods) {\n if (seenIds.has(method.id)) continue;\n if (startMiddlewareIds.has(method.id)) continue;\n if (endMiddlewareIds.has(method.id)) continue;\n seenIds.add(method.id);\n middleMethods.push(method);\n }\n });\n\n if (entry.mappings.length > 0) insertMappingMethods(entry, middleMethods);\n\n const methods = [...startMiddlewares, ...middleMethods, ...endMiddlewares];\n // A batch declares the sum its members resolved to\n const declaredBodySize = resolveBatchMaxBodySize(entry, memberChains);\n return {\n // where the first route handler sits in the merged methods\n routeIndex: firstRouteIndex,\n methods,\n // cached per member-path list, so one chain answers every endpoint path that reaches it\n path: undefined,\n batchId: entry.id,\n batchRouteIds: entry.routes as string[],\n declaredBodySize,\n maxBodySize: declaredBodySize,\n readsBody: true,\n };\n}\n\n// ############# MAPPING METHODS #############\n\n/**\n * Inserts mapping methods into the middleMethods array in the correct position.\n * Each mapping method is inserted after the source route (fromId) and before the target route (toId).\n */\nfunction insertMappingMethods(entry: BatchEntry, middleMethods: RemoteMethod[]): void {\n const idToIndex = new Map<string, number>();\n for (let i = 0; i < middleMethods.length; i++) idToIndex.set(middleMethods[i].id, i);\n\n const insertions: Array<{index: number; method: RemoteMethod}> = [];\n\n for (const mapping of entry.mappings) {\n const fromIndex = idToIndex.get(mapping.fromId);\n const toIndex = idToIndex.get(mapping.toId);\n if (fromIndex === undefined) {\n throw new FatalError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n type: 'batch-mapping-invalid-source',\n publicMessage: `Mapping source route '${mapping.fromId}' not found in batch '${entry.id}'.`,\n errorData: {batchId: entry.id, mapping},\n });\n }\n if (toIndex === undefined) {\n throw new FatalError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n type: 'batch-mapping-invalid-target',\n publicMessage: `Mapping target route '${mapping.toId}' not found in batch '${entry.id}'.`,\n errorData: {batchId: entry.id, mapping},\n });\n }\n\n // paramIndex is a non-negative integer (registerBatches); the UPPER bound needs the target's\n // arity, only known here. A mapping can never write past the params the route declares, unless a rest param takes them.\n const target = middleMethods[toIndex];\n const targetParamsCount = target.paramsCount ?? 0;\n if (mapping.paramIndex >= targetParamsCount && !target.paramsRest) {\n throw new FatalError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n type: 'batch-mapping-invalid-param-index',\n publicMessage:\n `Mapping paramIndex ${mapping.paramIndex} is out of range for target route '${mapping.toId}', ` +\n `which takes ${targetParamsCount} parameter(s).`,\n errorData: {batchId: entry.id, mapping},\n });\n }\n\n // The allow-list is the gate on what a table may reference: the mapper's pure-fn id, as\n // harvested from the client build. An id that came through no mion lane is REJECTED here,\n // never evaluated.\n if (!hasInputMapper(mapping.mapperKey)) {\n throw new FatalError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n type: 'batch-mapper-not-allowed',\n publicMessage: `Input mapper '${mapping.mapperKey}' is not registered on the server.`,\n errorData: {batchId: entry.id, mapping},\n });\n }\n\n insertions.push({index: fromIndex + 1, method: createMappingMethod(mapping)});\n // Run the target only when every mapping into it produced a value: a failed source leaves it a thrown error.\n middleMethods[toIndex] = guardMappedTarget(middleMethods[toIndex]);\n }\n\n // descending, so a splice never shifts the indices still to come\n insertions.sort((a, b) => b.index - a.index);\n for (const {index, method} of insertions) middleMethods.splice(index, 0, method);\n}\n\n/** A copy, never a mutation: the route's own RemoteMethod is shared with every plain call to that route. */\nfunction guardMappedTarget(target: RemoteMethod): RemoteMethod {\n if ((target as GuardedTarget).mappedTargetOf) return target;\n const guarded = {\n ...target,\n mappedTargetOf: target,\n // async whatever the target is, so the dispatcher must await this member\n isAsync: true,\n methodCaller: async (context: CallContext, executable: RemoteMethod, ...args: unknown[]) => {\n if (hasThrownError(context, executable.id)) return undefined;\n // the shared method carries its caller from registration, same as the dispatcher reads\n return getMethodCaller(target)(context, executable, ...args);\n },\n } as GuardedTarget;\n return guarded;\n}\n\ntype GuardedTarget = RemoteMethod & {mappedTargetOf?: RemoteMethod};\n\nfunction createMappingMethod(mapping: BatchMapping): RemoteMethod {\n const id = `mionInputFrom_${mapping.fromId}_${mapping.mapperKey}_to_${mapping.toId}`;\n const cached = mappingMethodCache.get(id);\n if (cached) return cached;\n\n const noopJitFns = getNoopJitFns();\n const method = {\n type: HandlerType.rawMiddleware,\n id,\n hasReturnData: false,\n paramsJitHash: '',\n returnJitHash: '',\n paramsJitFns: noopJitFns,\n returnJitFns: noopJitFns,\n handler: createMappingHandler(mapping),\n options: {alwaysRun: false},\n alwaysRun: false,\n // runMappingHandler is async, so this member must be awaited\n isAsync: true,\n methodCaller: runMappingHandler,\n } as RemoteMethod;\n\n mappingMethodCache.set(id, method);\n return method;\n}\n\nfunction createMappingHandler(mapping: BatchMapping) {\n return (ctx: CallContext) => {\n // own key only: a source named like `toString` that stored nothing would feed Object.prototype's function\n const sourceOutput = Object.hasOwn(ctx.response.body, mapping.fromId) ? ctx.response.body[mapping.fromId] : undefined;\n // A failed or skipped source has nothing to map: the error goes to @thrownErrors, the target's slots hold only what it declares.\n if (isRpcError(sourceOutput) || hasThrownError(ctx, mapping.fromId)) {\n addThrownError(\n ctx,\n mapping.toId,\n new RpcError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n type: 'batch-mapping-source-failed',\n publicMessage: `Route '${mapping.fromId}' failed, so the input it feeds into '${mapping.toId}' could not be computed.`,\n errorData: {fromId: mapping.fromId, toId: mapping.toId, paramIndex: mapping.paramIndex},\n })\n );\n return;\n }\n const pureFn = getInputMapper(mapping.mapperKey);\n if (!pureFn) {\n throw new FatalError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n type: 'batch-mapper-not-allowed',\n publicMessage: `Input mapper '${mapping.mapperKey}' not found at runtime.`,\n });\n }\n let mappedValue: unknown;\n try {\n mappedValue = pureFn(sourceOutput);\n } catch (error) {\n // thrown, so the batch stops like any handler error, but typed and with no registry key in the message\n throw new FatalError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n type: 'batch-mapper-failed',\n publicMessage: `The input mapper feeding route '${mapping.toId}' from '${mapping.fromId}' threw.`,\n errorData: {fromId: mapping.fromId, toId: mapping.toId, paramIndex: mapping.paramIndex},\n originalError: error as Error,\n });\n }\n // the client sent a null placeholder at paramIndex\n // an array check, not truthiness: an id like `toString` finds a prototype function, a wire value may be a string\n const targetParams = ctx.request.body[mapping.toId];\n if (Array.isArray(targetParams)) targetParams[mapping.paramIndex] = mappedValue;\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nasync function runMappingHandler(context: CallContext, executable: RemoteMethod, ...args: unknown[]) {\n return executable.handler(context);\n}\n"],"mappings":";;;;;;AAgDA,IAAM,8BAAc,IAAI,IAAwB;AAChD,IAAM,qCAAqB,IAAI,IAA0B;;;AAIzD,SAAgB,gBAAgB,OAA8C;CAC5E,KAAK,MAAM,CAAC,IAAI,eAAe,OAAO,QAAQ,KAAK,GAAG;EACpD,2BAA2B,IAAI,UAAU;EACzC,YAAY,IAAI,IAAI;GAClB;GACA,QAAQ,CAAC,GAAG,WAAW,MAAM;GAC7B,UAAU,WAAW,WAAW,WAAW,SAAS,KAAK,aAAa,EAAC,GAAG,QAAO,EAAE,IAAI,CAAC;GACxF,wBAAQ,IAAI,IAAI;EAClB,CAAC;CACH;AACF;;;AAIA,SAAgB,eAAe,OAA8C;CAC3E,aAAa;CACb,gBAAgB,KAAK;AACvB;;AAGA,SAAS,2BAA2B,IAAY,YAAmC;CACjF,MAAM,WAAW,WAA0B;EACzC,MAAM,IAAI,MAAM,yBAAyB,GAAG,kBAAkB,OAAO,EAAE;CACzE;CACA,IAAI,CAAC,IAAI,QAAQ,UAAU;CAC3B,IAAI,CAAC,cAAc,OAAO,eAAe,UAAU,QAAQ,oBAAoB;CAC/E,IAAI,CAAC,MAAM,QAAQ,WAAW,MAAM,KAAK,WAAW,OAAO,WAAW,GAAG,QAAQ,oCAAoC;CACrH,IAAI,WAAW,OAAO,MAAM,UAAU,OAAO,UAAU,YAAY,CAAC,KAAK,GAAG,QAAQ,4BAA4B;CAChH,IAAI,WAAW,aAAa,KAAA,GAAW;CACvC,IAAI,CAAC,MAAM,QAAQ,WAAW,QAAQ,GAAG,QAAQ,6BAA6B;CAC9E,KAAK,MAAM,WAAW,WAAW,UAAU;EACzC,IAAI,CAAC,WAAW,OAAO,YAAY,UAAU,QAAQ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,MAAM,SAAS,eAAe,QAAQ,SAAS;EAC/C,IAAI,CAAC,QACH,MAAM,IAAI,WAAW;GACnB,YAAY,YAAY;GACxB,MAAM;GACN,eAAe,iBAAiB,QAAQ,UAAU;EACpD,CAAC;EAEH,IAAI;EACJ,IAAI;GACF,cAAc,OAAO,YAAY;EACnC,SAAS,OAAO;GAEd,MAAM,IAAI,WAAW;IACnB,YAAY,YAAY;IACxB,MAAM;IACN,eAAe,mCAAmC,QAAQ,KAAK,UAAU,QAAQ,OAAO;IACxF,WAAW;KAAC,QAAQ,QAAQ;KAAQ,MAAM,QAAQ;KAAM,YAAY,QAAQ;IAAU;IACtF,eAAe;GACjB,CAAC;EACH;EAGA,MAAM,eAAe,IAAI,QAAQ,KAAK,QAAQ;EAC9C,IAAI,MAAM,QAAQ,YAAY,GAAG,aAAa,QAAQ,cAAc;CACtE;AACF;AAGA,eAAe,kBAAkB,SAAsB,YAA0B,GAAG,MAAiB;CACnG,OAAO,WAAW,QAAQ,OAAO;AACnC"}
@@ -1,8 +1,8 @@
1
- import { CallContext, MionHeaders, RawRequestBody } from './types/context.ts';
1
+ import { CallContext, HttpMethod, MionHeaders, RawRequestBody } from './types/context.ts';
2
2
  import { MethodsExecutionChain } from './types/remoteMethods.ts';
3
3
  import { SerializerCode } from '@mionjs/core';
4
4
  export declare function resolveExecutionChain(path: string, urlQuery: string | undefined, rawRequest: unknown): MethodsExecutionChain;
5
- export declare function createContextFromChain(chain: MethodsExecutionChain, path: string, urlQuery: string | undefined, reqHeaders: MionHeaders, respHeaders: MionHeaders, reqRawBody?: RawRequestBody, reqBodyType?: SerializerCode): CallContext;
6
- export declare function createCallContext(path: string, urlQuery: string | undefined, rawRequest: unknown, reqHeaders: MionHeaders, respHeaders: MionHeaders, reqRawBody?: RawRequestBody, reqBodyType?: SerializerCode): CallContext;
5
+ export declare function createContextFromChain(chain: MethodsExecutionChain, path: string, urlQuery: string | undefined, method: HttpMethod, reqHeaders: MionHeaders, respHeaders: MionHeaders, reqRawBody?: RawRequestBody, reqBodyType?: SerializerCode): CallContext;
6
+ export declare function createCallContext(path: string, urlQuery: string | undefined, rawRequest: unknown, reqHeaders: MionHeaders, respHeaders: MionHeaders, reqRawBody?: RawRequestBody, reqBodyType?: SerializerCode, method?: HttpMethod): CallContext;
7
7
  export declare function getRequestBodyType(rawBody: RawRequestBody | undefined): SerializerCode;
8
8
  //# sourceMappingURL=callContext.d.ts.map
@@ -15,8 +15,9 @@ function resolveExecutionChain(path, urlQuery, rawRequest) {
15
15
  return getExecutionChain(path, opts.pathTransform?.(rawRequest, path) || path, urlQuery, rawRequest, opts);
16
16
  }
17
17
  /** `path` and `urlQuery` are the request's; a route chain's own path wins, not-found and batch chains use the request's. */
18
- function createContextFromChain(chain, path, urlQuery, reqHeaders, respHeaders, reqRawBody, reqBodyType) {
18
+ function createContextFromChain(chain, path, urlQuery, method, reqHeaders, respHeaders, reqRawBody, reqBodyType) {
19
19
  const request = {
20
+ method,
20
21
  headers: reqHeaders,
21
22
  rawBody: reqRawBody,
22
23
  bodyType: reqBodyType ?? getRequestBodyType(reqRawBody),
@@ -27,11 +28,12 @@ function createContextFromChain(chain, path, urlQuery, reqHeaders, respHeaders,
27
28
  statusCode: StatusCodes.OK,
28
29
  contentType: JSON_CONTENT_TYPE,
29
30
  hasErrors: false,
31
+ stopped: false,
30
32
  fatalError: void 0,
31
33
  headers: respHeaders,
32
34
  body: {}
33
35
  };
34
- const contextDataFactory = getRouterOptions().contextDataFactory;
36
+ const sharedDataFactory = getRouterOptions().sharedDataFactory;
35
37
  return {
36
38
  path: chain.path ?? path,
37
39
  request,
@@ -39,7 +41,7 @@ function createContextFromChain(chain, path, urlQuery, reqHeaders, respHeaders,
39
41
  executionChain: chain,
40
42
  maxBodySize: chain.maxBodySize,
41
43
  readsBody: chain.readsBody,
42
- shared: contextDataFactory ? contextDataFactory() : {},
44
+ shared: sharedDataFactory ? sharedDataFactory() : {},
43
45
  urlQuery,
44
46
  batchId: chain.batchId,
45
47
  batchRouteIds: chain.batchRouteIds
@@ -47,8 +49,8 @@ function createContextFromChain(chain, path, urlQuery, reqHeaders, respHeaders,
47
49
  }
48
50
  var EMPTY_BODY = Object.freeze({});
49
51
  /** The one-call form, for a caller that already has the body (a host that parsed it, `dispatchRoute`, a test). */
50
- function createCallContext(path, urlQuery, rawRequest, reqHeaders, respHeaders, reqRawBody, reqBodyType) {
51
- return createContextFromChain(resolveExecutionChain(path, urlQuery, rawRequest), path, urlQuery, reqHeaders, respHeaders, reqRawBody, reqBodyType);
52
+ function createCallContext(path, urlQuery, rawRequest, reqHeaders, respHeaders, reqRawBody, reqBodyType, method = "POST") {
53
+ return createContextFromChain(resolveExecutionChain(path, urlQuery, rawRequest), path, urlQuery, method, reqHeaders, respHeaders, reqRawBody, reqBodyType);
52
54
  }
53
55
  /** The wire form of a body: a string is stringified JSON, anything else a parsed object. A body
54
56
  * not yet read (a context built before it) reads as an object until the body arrives. */
@@ -1 +1 @@
1
- {"version":3,"file":"callContext.js","names":[],"sources":["../../../src/callContext.ts"],"sourcesContent":["/* ########\n * 2026 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport {getRouteExecutionChain, getNotFoundExecutionChain, getRouterOptions} from './router.ts';\nimport type {CallContext, MionHeaders, MionRequest, MionResponse, RawRequestBody} from './types/context.ts';\nimport type {RouterOptions} from './types/general.ts';\nimport type {MethodsExecutionChain} from './types/remoteMethods.ts';\nimport {StatusCodes, SerializerModes, SerializerCode, FatalError, MION_ROUTES, MION_BATCH_PATH} from '@mionjs/core';\nimport type {AnyObject} from '@mionjs/core';\nimport {getBatchExecutionChain} from './batches.ts';\nimport {JSON_CONTENT_TYPE} from './constants.ts';\n\n// ############# CONTEXT CREATION #############\n\n/** Resolves a request to the REGISTERED chain that answers it, allocating NOTHING, so a streaming adapter\n * calls it BEFORE the body to read against `chain.maxBodySize` and `createContextFromChain` after.\n * Nothing of the request's own may survive the read: such an object is promoted to the old heap and the\n * parsed body attached to it is promoted with it, which on a 4 MB body costs garbage-collector throughput.\n * The chain is SHARED and long-lived: mutating what this returns damages the route for the whole process.\n * An unknown path or batch id resolves to a not-found chain that never reads the body (`readsBody` false)\n * and runs only the global middlewares that declare `alwaysRun`. */\nexport function resolveExecutionChain(path: string, urlQuery: string | undefined, rawRequest: unknown): MethodsExecutionChain {\n const opts = getRouterOptions();\n const transformedPath = opts.pathTransform?.(rawRequest, path) || path;\n return getExecutionChain(path, transformedPath, urlQuery, rawRequest, opts);\n}\n\n/** `path` and `urlQuery` are the request's; a route chain's own path wins, not-found and batch chains use the request's. */\nexport function createContextFromChain(\n chain: MethodsExecutionChain,\n path: string,\n urlQuery: string | undefined,\n reqHeaders: MionHeaders,\n respHeaders: MionHeaders,\n reqRawBody?: RawRequestBody,\n reqBodyType?: SerializerCode\n): CallContext {\n const request: MionRequest = {\n headers: reqHeaders,\n rawBody: reqRawBody,\n bodyType: reqBodyType ?? getRequestBodyType(reqRawBody),\n // Shared and FROZEN: the parse replaces it, and a write before the parse would leak across requests\n body: EMPTY_BODY,\n thrownErrors: undefined,\n } as MionRequest;\n const response: MionResponse = {\n statusCode: StatusCodes.OK,\n contentType: JSON_CONTENT_TYPE,\n hasErrors: false,\n fatalError: undefined,\n headers: respHeaders,\n body: {},\n } as MionResponse;\n const contextDataFactory = getRouterOptions().contextDataFactory;\n\n return {\n path: chain.path ?? path,\n request,\n response,\n executionChain: chain,\n maxBodySize: chain.maxBodySize,\n readsBody: chain.readsBody,\n // Eager: a lazy defineProperty puts contexts in V8 dictionary mode (2x heap, 6% less throughput at 1 KB)\n shared: contextDataFactory ? contextDataFactory() : {},\n urlQuery,\n batchId: chain.batchId,\n batchRouteIds: chain.batchRouteIds,\n } as CallContext;\n}\n\nconst EMPTY_BODY: Readonly<AnyObject> = Object.freeze({});\n\n/** The one-call form, for a caller that already has the body (a host that parsed it, `dispatchRoute`, a test). */\nexport function createCallContext(\n path: string,\n urlQuery: string | undefined,\n rawRequest: unknown,\n reqHeaders: MionHeaders,\n respHeaders: MionHeaders,\n reqRawBody?: RawRequestBody,\n reqBodyType?: SerializerCode\n): CallContext {\n const chain = resolveExecutionChain(path, urlQuery, rawRequest);\n return createContextFromChain(chain, path, urlQuery, reqHeaders, respHeaders, reqRawBody, reqBodyType);\n}\n\n// ############# HELPER FUNCTIONS #############\n\n/** The wire form of a body: a string is stringified JSON, anything else a parsed object. A body\n * not yet read (a context built before it) reads as an object until the body arrives. */\nexport function getRequestBodyType(rawBody: RawRequestBody | undefined): SerializerCode {\n if (typeof rawBody === 'string') return SerializerModes.stringifyJson;\n if (rawBody instanceof ArrayBuffer || rawBody instanceof Uint8Array)\n throw new Error('mion: a byte request body has no encoder; send the body as a JSON string or a parsed object.');\n return SerializerModes.json;\n}\n\nfunction getExecutionChain(\n originalPath: string,\n transformedPath: string,\n urlQuery: string | undefined,\n rawRequest: unknown,\n opts: RouterOptions\n): MethodsExecutionChain {\n const hasPrefix = !!opts.basePath;\n // the batch key ends the path under any prefix (/mion-batch, /api/v1/mion-batch); the query id picks the chain\n const isBatchPath = hasPrefix ? originalPath.endsWith(MION_BATCH_PATH) : originalPath === MION_BATCH_PATH;\n if (isBatchPath) {\n return getBatchExecutionChain(rawRequest, opts, urlQuery) ?? notFoundChain(MION_ROUTES.batchNotFound);\n }\n\n return getRouteExecutionChain(transformedPath) ?? notFoundChain(MION_ROUTES.notFound);\n}\n\n/** mion's own not-found chains are built by initRouter, so an absent one is a bug, not a request error. */\nfunction notFoundChain(chainId: string): MethodsExecutionChain {\n const executionChain = getNotFoundExecutionChain(chainId);\n if (!executionChain) {\n throw new FatalError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n type: 'not-found',\n publicMessage: 'Not-found chain is not registered. This should never happen.',\n });\n }\n return executionChain;\n}\n"],"mappings":";;;;;;;;;;;;AAyBA,SAAgB,sBAAsB,MAAc,UAA8B,YAA4C;CAC5H,MAAM,OAAO,iBAAiB;CAE9B,OAAO,kBAAkB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ACxD,IAAI,CAAC,gBACH,MAAM,IAAI,WAAW;EACnB,YAAY,YAAY;EACxB,MAAM;EACN,eAAe;CACjB,CAAC;CAEH,OAAO;AACT"}
1
+ {"version":3,"file":"callContext.js","names":[],"sources":["../../../src/callContext.ts"],"sourcesContent":["/* ########\n * 2026 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport {getRouteExecutionChain, getNotFoundExecutionChain, getRouterOptions} from './router.ts';\nimport type {CallContext, HttpMethod, MionResponse, MionHeaders, MionRequest, RawRequestBody} from './types/context.ts';\nimport type {RouterOptions} from './types/general.ts';\nimport type {MethodsExecutionChain} from './types/remoteMethods.ts';\nimport {StatusCodes, SerializerModes, SerializerCode, FatalError, MION_ROUTES, MION_BATCH_PATH} from '@mionjs/core';\nimport type {AnyObject} from '@mionjs/core';\nimport {getBatchExecutionChain} from './batches.ts';\nimport {JSON_CONTENT_TYPE} from './constants.ts';\n\n// ############# CONTEXT CREATION #############\n\n/** Resolves a request to the REGISTERED chain that answers it, allocating NOTHING, so a streaming adapter\n * calls it BEFORE the body to read against `chain.maxBodySize` and `createContextFromChain` after.\n * Nothing of the request's own may survive the read: such an object is promoted to the old heap and the\n * parsed body attached to it is promoted with it, which on a 4 MB body costs garbage-collector throughput.\n * The chain is SHARED and long-lived: mutating what this returns damages the route for the whole process.\n * An unknown path or batch id resolves to a not-found chain that never reads the body (`readsBody` false)\n * and runs only the global middlewares that declare `alwaysRun`. */\nexport function resolveExecutionChain(path: string, urlQuery: string | undefined, rawRequest: unknown): MethodsExecutionChain {\n const opts = getRouterOptions();\n const transformedPath = opts.pathTransform?.(rawRequest, path) || path;\n return getExecutionChain(path, transformedPath, urlQuery, rawRequest, opts);\n}\n\n/** `path` and `urlQuery` are the request's; a route chain's own path wins, not-found and batch chains use the request's. */\nexport function createContextFromChain(\n chain: MethodsExecutionChain,\n path: string,\n urlQuery: string | undefined,\n method: HttpMethod,\n reqHeaders: MionHeaders,\n respHeaders: MionHeaders,\n reqRawBody?: RawRequestBody,\n reqBodyType?: SerializerCode\n): CallContext {\n const request: MionRequest = {\n method,\n headers: reqHeaders,\n rawBody: reqRawBody,\n bodyType: reqBodyType ?? getRequestBodyType(reqRawBody),\n // Shared and FROZEN: the parse replaces it, and a write before the parse would leak across requests\n body: EMPTY_BODY,\n thrownErrors: undefined,\n } as MionRequest;\n const response: MionResponse = {\n statusCode: StatusCodes.OK,\n contentType: JSON_CONTENT_TYPE,\n hasErrors: false,\n stopped: false,\n fatalError: undefined,\n headers: respHeaders,\n body: {},\n };\n const sharedDataFactory = getRouterOptions().sharedDataFactory;\n\n return {\n path: chain.path ?? path,\n request,\n response,\n executionChain: chain,\n maxBodySize: chain.maxBodySize,\n readsBody: chain.readsBody,\n // Eager: a lazy defineProperty puts contexts in V8 dictionary mode (2x heap, 6% less throughput at 1 KB)\n shared: sharedDataFactory ? sharedDataFactory() : {},\n urlQuery,\n batchId: chain.batchId,\n batchRouteIds: chain.batchRouteIds,\n } as CallContext;\n}\n\nconst EMPTY_BODY: Readonly<AnyObject> = Object.freeze({});\n\n/** The one-call form, for a caller that already has the body (a host that parsed it, `dispatchRoute`, a test). */\nexport function createCallContext(\n path: string,\n urlQuery: string | undefined,\n rawRequest: unknown,\n reqHeaders: MionHeaders,\n respHeaders: MionHeaders,\n reqRawBody?: RawRequestBody,\n reqBodyType?: SerializerCode,\n method: HttpMethod = 'POST'\n): CallContext {\n const chain = resolveExecutionChain(path, urlQuery, rawRequest);\n return createContextFromChain(chain, path, urlQuery, method, reqHeaders, respHeaders, reqRawBody, reqBodyType);\n}\n\n// ############# HELPER FUNCTIONS #############\n\n/** The wire form of a body: a string is stringified JSON, anything else a parsed object. A body\n * not yet read (a context built before it) reads as an object until the body arrives. */\nexport function getRequestBodyType(rawBody: RawRequestBody | undefined): SerializerCode {\n if (typeof rawBody === 'string') return SerializerModes.stringifyJson;\n if (rawBody instanceof ArrayBuffer || rawBody instanceof Uint8Array)\n throw new Error('mion: a byte request body has no encoder; send the body as a JSON string or a parsed object.');\n return SerializerModes.json;\n}\n\nfunction getExecutionChain(\n originalPath: string,\n transformedPath: string,\n urlQuery: string | undefined,\n rawRequest: unknown,\n opts: RouterOptions\n): MethodsExecutionChain {\n const hasPrefix = !!opts.basePath;\n // the batch key ends the path under any prefix (/mion-batch, /api/v1/mion-batch); the query id picks the chain\n const isBatchPath = hasPrefix ? originalPath.endsWith(MION_BATCH_PATH) : originalPath === MION_BATCH_PATH;\n if (isBatchPath) {\n return getBatchExecutionChain(rawRequest, opts, urlQuery) ?? notFoundChain(MION_ROUTES.batchNotFound);\n }\n\n return getRouteExecutionChain(transformedPath) ?? notFoundChain(MION_ROUTES.notFound);\n}\n\n/** mion's own not-found chains are built by initRouter, so an absent one is a bug, not a request error. */\nfunction notFoundChain(chainId: string): MethodsExecutionChain {\n const executionChain = getNotFoundExecutionChain(chainId);\n if (!executionChain) {\n throw new FatalError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n type: 'not-found',\n publicMessage: 'Not-found chain is not registered. This should never happen.',\n });\n }\n return executionChain;\n}\n"],"mappings":";;;;;;;;;;;;AAyBA,SAAgB,sBAAsB,MAAc,UAA8B,YAA4C;CAC5H,MAAM,OAAO,iBAAiB;CAE9B,OAAO,kBAAkB,MADD,KAAK,gBAAgB,YAAY,IAAI,KAAK,MAClB,UAAU,YAAY,IAAI;AAC5E;;AAGA,SAAgB,uBACd,OACA,MACA,UACA,QACA,YACA,aACA,YACA,aACa;CACb,MAAM,UAAuB;EAC3B;EACA,SAAS;EACT,SAAS;EACT,UAAU,eAAe,mBAAmB,UAAU;EAEtD,MAAM;EACN,cAAc,KAAA;CAChB;CACA,MAAM,WAAyB;EAC7B,YAAY,YAAY;EACxB,aAAa;EACb,WAAW;EACX,SAAS;EACT,YAAY,KAAA;EACZ,SAAS;EACT,MAAM,CAAC;CACT;CACA,MAAM,oBAAoB,iBAAiB,EAAE;CAE7C,OAAO;EACL,MAAM,MAAM,QAAQ;EACpB;EACA;EACA,gBAAgB;EAChB,aAAa,MAAM;EACnB,WAAW,MAAM;EAEjB,QAAQ,oBAAoB,kBAAkB,IAAI,CAAC;EACnD;EACA,SAAS,MAAM;EACf,eAAe,MAAM;CACvB;AACF;AAEA,IAAM,aAAkC,OAAO,OAAO,CAAC,CAAC;;AAGxD,SAAgB,kBACd,MACA,UACA,YACA,YACA,aACA,YACA,aACA,SAAqB,QACR;CAEb,OAAO,uBADO,sBAAsB,MAAM,UAAU,UACtB,GAAO,MAAM,UAAU,QAAQ,YAAY,aAAa,YAAY,WAAW;AAC/G;;;AAMA,SAAgB,mBAAmB,SAAqD;CACtF,IAAI,OAAO,YAAY,UAAU,OAAO,gBAAgB;CACxD,IAAI,mBAAmB,eAAe,mBAAmB,YACvD,MAAM,IAAI,MAAM,8FAA8F;CAChH,OAAO,gBAAgB;AACzB;AAEA,SAAS,kBACP,cACA,iBACA,UACA,YACA,MACuB;CAIvB,IADoB,CAFD,CAAC,KAAK,WAEO,aAAa,SAAS,eAAe,IAAI,iBAAiB,iBAExF,OAAO,uBAAuB,YAAY,MAAM,QAAQ,KAAK,cAAc,YAAY,aAAa;CAGtG,OAAO,uBAAuB,eAAe,KAAK,cAAc,YAAY,QAAQ;AACtF;;AAGA,SAAS,cAAc,SAAwC;CAC7D,MAAM,iBAAiB,0BAA0B,OAAO;CACxD,IAAI,CAAC,gBACH,MAAM,IAAI,WAAW;EACnB,YAAY,YAAY;EACxB,MAAM;EACN,eAAe;CACjB,CAAC;CAEH,OAAO;AACT"}
@@ -2,4 +2,5 @@ import { RouterOptions } from './types/general.ts';
2
2
  export declare const DEFAULT_ROUTE_OPTIONS: Readonly<RouterOptions>;
3
3
  export declare const MAX_ROUTE_NESTING = 10;
4
4
  export declare const JSON_CONTENT_TYPE = "application/json; charset=utf-8";
5
+ export declare const MION_SERVER_NAME = "mionjs";
5
6
  //# sourceMappingURL=constants.d.ts.map
@@ -3,8 +3,8 @@ var DEFAULT_ROUTE_OPTIONS = {
3
3
  basePath: "",
4
4
  suffix: "",
5
5
  pathTransform: void 0,
6
- /** set to true to generate router spec for clients. */
7
- getPublicRoutesData: process.env.GENERATE_ROUTER_SPEC === "true",
6
+ /** set to true to generate router spec for clients; GENERATE_ROUTER_SPEC=true also enables it */
7
+ getPublicRoutesData: false,
8
8
  autoGenerateErrorId: false,
9
9
  /** Every chain step is awaited by default, so the chain keeps yielding between steps */
10
10
  alwaysAwait: true,
@@ -17,7 +17,9 @@ var DEFAULT_ROUTE_OPTIONS = {
17
17
  };
18
18
  var MAX_ROUTE_NESTING = 10;
19
19
  var JSON_CONTENT_TYPE = "application/json; charset=utf-8";
20
+ /** The default `server` response header; mionSecurity removes it */
21
+ var MION_SERVER_NAME = "mionjs";
20
22
  //#endregion
21
- export { DEFAULT_ROUTE_OPTIONS, JSON_CONTENT_TYPE, MAX_ROUTE_NESTING };
23
+ export { DEFAULT_ROUTE_OPTIONS, JSON_CONTENT_TYPE, MAX_ROUTE_NESTING, MION_SERVER_NAME };
22
24
 
23
25
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":[],"sources":["../../../src/constants.ts"],"sourcesContent":["/* ########\n * 2022 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport {RouterOptions} from './types/general.ts';\n\nexport const DEFAULT_ROUTE_OPTIONS = {\n basePath: '',\n suffix: '',\n pathTransform: undefined,\n /** set to true to generate router spec for clients. */\n getPublicRoutesData: process.env.GENERATE_ROUTER_SPEC === 'true',\n autoGenerateErrorId: false,\n /** Every chain step is awaited by default, so the chain keeps yielding between steps */\n alwaysAwait: true,\n /** A type-derived request limit is the JSON maximum times this factor */\n maxBodySizeFactor: 2,\n releaseRawBody: true,\n responseHeaders: {},\n apiVersionCheck: true,\n getAllRemoteMethodsMaxNumber: 100,\n} as Readonly<RouterOptions>;\n\nexport const MAX_ROUTE_NESTING = 10;\n\nexport const JSON_CONTENT_TYPE = 'application/json; charset=utf-8';\n"],"mappings":";AASA,IAAa,wBAAwB;CACnC,UAAU;CACV,QAAQ;CACR,eAAe,KAAA;;CAEf,qBAAqB,QAAQ,IAAI,yBAAyB;CAC1D,qBAAqB;;CAErB,aAAa;;CAEb,mBAAmB;CACnB,gBAAgB;CAChB,iBAAiB,CAAC;CAClB,iBAAiB;CACjB,8BAA8B;AAChC;AAEA,IAAa,oBAAoB;AAEjC,IAAa,oBAAoB"}
1
+ {"version":3,"file":"constants.js","names":[],"sources":["../../../src/constants.ts"],"sourcesContent":["/* ########\n * 2022 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport {RouterOptions} from './types/general.ts';\n\nexport const DEFAULT_ROUTE_OPTIONS = {\n basePath: '',\n suffix: '',\n pathTransform: undefined,\n /** set to true to generate router spec for clients; GENERATE_ROUTER_SPEC=true also enables it */\n getPublicRoutesData: false,\n autoGenerateErrorId: false,\n /** Every chain step is awaited by default, so the chain keeps yielding between steps */\n alwaysAwait: true,\n /** A type-derived request limit is the JSON maximum times this factor */\n maxBodySizeFactor: 2,\n releaseRawBody: true,\n responseHeaders: {},\n apiVersionCheck: true,\n getAllRemoteMethodsMaxNumber: 100,\n} as Readonly<RouterOptions>;\n\nexport const MAX_ROUTE_NESTING = 10;\n\nexport const JSON_CONTENT_TYPE = 'application/json; charset=utf-8';\n/** The default `server` response header; mionSecurity removes it */\nexport const MION_SERVER_NAME = 'mionjs';\n"],"mappings":";AASA,IAAa,wBAAwB;CACnC,UAAU;CACV,QAAQ;CACR,eAAe,KAAA;;CAEf,qBAAqB;CACrB,qBAAqB;;CAErB,aAAa;;CAEb,mBAAmB;CACnB,gBAAgB;CAChB,iBAAiB,CAAC;CAClB,iBAAiB;CACjB,8BAA8B;AAChC;AAEA,IAAa,oBAAoB;AAEjC,IAAa,oBAAoB;;AAEjC,IAAa,mBAAmB"}
@@ -1,10 +1,10 @@
1
- import { CallContext, MionResponse, MionHeaders, RawRequestBody } from './types/context.ts';
1
+ import { CallContext, HttpMethod, MionResponse, MionHeaders, RawRequestBody } from './types/context.ts';
2
2
  import { RemoteMethod, MethodsExecutionChain } from './types/remoteMethods.ts';
3
3
  import { SerializerCode, RpcError } from '@mionjs/core';
4
- export declare function dispatchRoute<Req, Resp>(path: string, reqRawBody: RawRequestBody, reqHeaders: MionHeaders, respHeaders: MionHeaders, rawRequest: Req, rawResponse?: Resp, reqBodyType?: SerializerCode, urlQuery?: string): Promise<MionResponse>;
4
+ export declare function dispatchRoute<Req, Resp>(path: string, reqRawBody: RawRequestBody, reqHeaders: MionHeaders, respHeaders: MionHeaders, rawRequest: Req, rawResponse?: Resp, reqBodyType?: SerializerCode, urlQuery?: string, method?: HttpMethod): Promise<MionResponse>;
5
5
  export declare function dispatchWithContext<Req, Resp>(context: CallContext, rawRequest: Req, rawResponse?: Resp, reqRawBody?: RawRequestBody, reqBodyType?: SerializerCode): Promise<MionResponse>;
6
6
  export declare function dispatchMaybeSync<Req, Resp>(context: CallContext, rawRequest: Req, rawResponse?: Resp): MionResponse | Promise<MionResponse>;
7
- export declare function dispatchPlatformError<Req, Resp>(chain: MethodsExecutionChain, path: string, urlQuery: string | undefined, platformError: RpcError<string>, reqHeaders: MionHeaders, respHeaders: MionHeaders, rawRequest: Req, rawResponse?: Resp): Promise<MionResponse>;
7
+ export declare function dispatchPlatformError<Req, Resp>(chain: MethodsExecutionChain, path: string, urlQuery: string | undefined, method: HttpMethod, platformError: RpcError<string>, reqHeaders: MionHeaders, respHeaders: MionHeaders, rawRequest: Req, rawResponse?: Resp): Promise<MionResponse>;
8
8
  export declare function callerForType(type: RemoteMethod['type']): (...args: any[]) => any;
9
9
  export declare function getMethodCaller(executable: RemoteMethod): (...args: any[]) => any;
10
10
  //# sourceMappingURL=dispatch.d.ts.map
@@ -5,8 +5,8 @@ import { FatalError, HandlerType, HeadersSubset, MION_ROUTES, StatusCodes, isNat
5
5
  import { UNSAFE_PROPERTY_NAME_MESSAGE } from "@mionjs/run-types";
6
6
  //#region src/dispatch.ts
7
7
  /** The one-call form for a caller that already has the body (tests, a host that parsed it). */
8
- async function dispatchRoute(path, reqRawBody, reqHeaders, respHeaders, rawRequest, rawResponse, reqBodyType, urlQuery) {
9
- return dispatchWithContext(createCallContext(path, urlQuery, rawRequest, reqHeaders, respHeaders, reqRawBody, reqBodyType), rawRequest, rawResponse);
8
+ async function dispatchRoute(path, reqRawBody, reqHeaders, respHeaders, rawRequest, rawResponse, reqBodyType, urlQuery, method = "POST") {
9
+ return dispatchWithContext(createCallContext(path, urlQuery, rawRequest, reqHeaders, respHeaders, reqRawBody, reqBodyType, method), rawRequest, rawResponse);
10
10
  }
11
11
  /** A streaming adapter builds the context before reading the body, to check `context.maxBodySize`, then passes it. */
12
12
  async function dispatchWithContext(context, rawRequest, rawResponse, reqRawBody, reqBodyType) {
@@ -30,19 +30,20 @@ function dispatchMaybeSync(context, rawRequest, rawResponse) {
30
30
  * `path` and `urlQuery` travel with the chain rather than on it: mion's not-found chains and a merged
31
31
  * batch chain each answer for many paths, so they carry none of their own, and a refusal does reach one
32
32
  * of those (an adapter checks a declared content-length before asking whether the chain reads a body). */
33
- function dispatchPlatformError(chain, path, urlQuery, platformError, reqHeaders, respHeaders, rawRequest, rawResponse) {
34
- const context = createContextFromChain(chain, path, urlQuery, reqHeaders, respHeaders);
33
+ function dispatchPlatformError(chain, path, urlQuery, method, platformError, reqHeaders, respHeaders, rawRequest, rawResponse) {
34
+ const context = createContextFromChain(chain, path, urlQuery, method, reqHeaders, respHeaders);
35
35
  recordUndeclaredError(context, MION_ROUTES.platformError, platformError);
36
36
  return dispatchWithContext(context, rawRequest, rawResponse);
37
37
  }
38
38
  async function runExecutionChain(context, rawRequest, rawResponse, opts, startIndex) {
39
- const { response, request, executionChain } = context;
39
+ const { request, executionChain } = context;
40
+ const response = context.response;
40
41
  const alwaysAwait = opts.alwaysAwait;
41
42
  const executionList = executionChain.methods;
42
43
  const executionCount = executionList.length;
43
44
  for (let i = startIndex; i < executionCount; i++) {
44
45
  const executable = executionList[i];
45
- if (response.hasErrors && !executable.alwaysRun) continue;
46
+ if (response.stopped && !executable.alwaysRun) continue;
46
47
  try {
47
48
  let result;
48
49
  if (alwaysAwait || executable.isAsync) result = await executable.methodCaller(context, executable, request, response, opts, rawRequest, rawResponse);
@@ -59,12 +60,13 @@ async function runExecutionChain(context, rawRequest, rawResponse, opts, startIn
59
60
  }
60
61
  /** `runExecutionChain` without awaits: from the first async step on it hands over, so both give the same result. */
61
62
  function runSyncExecutionChain(context, rawRequest, rawResponse, opts) {
62
- const { response, request, executionChain } = context;
63
+ const { request, executionChain } = context;
64
+ const response = context.response;
63
65
  const executionList = executionChain.methods;
64
66
  const executionCount = executionList.length;
65
67
  for (let i = 0; i < executionCount; i++) {
66
68
  const executable = executionList[i];
67
- if (response.hasErrors && !executable.alwaysRun) continue;
69
+ if (response.stopped && !executable.alwaysRun) continue;
68
70
  if (executable.isAsync) return runExecutionChain(context, rawRequest, rawResponse, opts, i);
69
71
  try {
70
72
  const result = executable.methodCaller(context, executable, request, response, opts, rawRequest, rawResponse);
@@ -1 +1 @@
1
- {"version":3,"file":"dispatch.js","names":[],"sources":["../../../src/dispatch.ts"],"sourcesContent":["/* ########\n * 2022 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport type {CallContext, MionResponse, MionRequest, MionHeaders, RawRequestBody} from './types/context.ts';\nimport {type RouterOptions} from './types/general.ts';\nimport {HeadersMethod, RemoteMethod, RawMethod} from './types/remoteMethods.ts';\nimport type {MethodsExecutionChain} from './types/remoteMethods.ts';\nimport {getRouterOptions} from './router.ts';\nimport {Mutable, AnyObject, StatusCodes, HeadersSubset, SerializerCode, MION_ROUTES, trustedHeadersSubset} from '@mionjs/core';\nimport {RpcError, FatalError, HandlerType, ValidationError, isNativeError} from '@mionjs/core';\nimport {UNSAFE_PROPERTY_NAME_MESSAGE} from '@mionjs/run-types';\nimport {markResponseFailed, recordUndeclaredError} from './lib/dispatchError.ts';\nimport {createCallContext, createContextFromChain, getRequestBodyType} from './callContext.ts';\n\n// Profiled and discarded: promisify(setImmediate) (worse or no gain), queueMicrotask instead of\n// setImmediate (definitely worse), callbacks instead of promises (slower, less memory in some scenarios).\n\n// ############# PUBLIC METHODS #############\n\n/** The one-call form for a caller that already has the body (tests, a host that parsed it). */\nexport async function dispatchRoute<Req, Resp>(\n path: string,\n reqRawBody: RawRequestBody,\n reqHeaders: MionHeaders,\n respHeaders: MionHeaders,\n rawRequest: Req,\n rawResponse?: Resp,\n reqBodyType?: SerializerCode,\n urlQuery?: string\n): Promise<MionResponse> {\n const context = createCallContext(path, urlQuery, rawRequest, reqHeaders, respHeaders, reqRawBody, reqBodyType);\n return dispatchWithContext(context, rawRequest, rawResponse);\n}\n\n/** A streaming adapter builds the context before reading the body, to check `context.maxBodySize`, then passes it. */\nexport async function dispatchWithContext<Req, Resp>(\n context: CallContext,\n rawRequest: Req,\n rawResponse?: Resp,\n reqRawBody?: RawRequestBody,\n reqBodyType?: SerializerCode\n): Promise<MionResponse> {\n if (reqRawBody !== undefined) {\n const request = context.request as Mutable<MionRequest>;\n request.rawBody = reqRawBody;\n request.bodyType = reqBodyType ?? getRequestBodyType(reqRawBody);\n }\n // No catch: the chain runners handle every exception themselves, so one that only re-rejects changes nothing.\n return dispatchMaybeSync(context, rawRequest, rawResponse);\n}\n\n/** `dispatchWithContext` for a context built with its body, minus the promise when no step needs one. */\nexport function dispatchMaybeSync<Req, Resp>(\n context: CallContext,\n rawRequest: Req,\n rawResponse?: Resp\n): MionResponse | Promise<MionResponse> {\n const opts = getRouterOptions();\n if (opts.alwaysAwait) return runExecutionChain(context, rawRequest, rawResponse, opts, 0);\n return runSyncExecutionChain(context, rawRequest, rawResponse, opts);\n}\n\n/** Dispatches a request the platform adapter refused after its route resolved: a body past the limit.\n * The error is recorded exactly as a thrown one is, so the chain runs only the members that declare\n * `alwaysRun` (a rate limiter, an access log) and answers with the same envelope. The adapter stopped\n * the read, so the context is built without a body.\n * `path` and `urlQuery` travel with the chain rather than on it: mion's not-found chains and a merged\n * batch chain each answer for many paths, so they carry none of their own, and a refusal does reach one\n * of those (an adapter checks a declared content-length before asking whether the chain reads a body). */\nexport function dispatchPlatformError<Req, Resp>(\n chain: MethodsExecutionChain,\n path: string,\n urlQuery: string | undefined,\n platformError: RpcError<string>,\n reqHeaders: MionHeaders,\n respHeaders: MionHeaders,\n rawRequest: Req,\n rawResponse?: Resp\n): Promise<MionResponse> {\n const context = createContextFromChain(chain, path, urlQuery, reqHeaders, respHeaders);\n recordUndeclaredError(context, MION_ROUTES.platformError, platformError);\n return dispatchWithContext(context, rawRequest, rawResponse);\n}\n\n// ############# PRIVATE METHODS #############\n\nasync function runExecutionChain(\n context: CallContext,\n rawRequest: unknown,\n rawResponse: unknown,\n opts: RouterOptions,\n startIndex: number\n): Promise<MionResponse> {\n const {response, request, executionChain} = context;\n // `alwaysAwait: false` skips the await on sync steps: awaiting one only costs a promise frame\n const alwaysAwait = opts.alwaysAwait;\n const executionList = executionChain.methods;\n const executionCount = executionList.length;\n for (let i = startIndex; i < executionCount; i++) {\n const executable = executionList[i];\n if (response.hasErrors && !executable.alwaysRun) continue;\n\n try {\n // runRawMiddleware, runHeadersMiddleware & runRouteOrMiddleware must take the same params in the same order\n // methodCaller is resolved at registration, so the loop never picks one\n // `isAsync` comes from the type checker, so a plain function returning a promise still awaits\n let result;\n if (alwaysAwait || executable.isAsync) {\n result = await executable.methodCaller(context, executable, request, response, opts, rawRequest, rawResponse);\n } else {\n result = executable.methodCaller(context, executable, request, response, opts, rawRequest, rawResponse);\n if (isUncheckedPromise(executable, result)) result = await result;\n }\n applyResult(context, executable, result);\n } catch (err: any) {\n // All thrown errors are undeclared and fatal\n recordUndeclaredError(context, executable.id, err);\n }\n }\n return context.response;\n}\n\n/** `runExecutionChain` without awaits: from the first async step on it hands over, so both give the same result. */\nfunction runSyncExecutionChain(\n context: CallContext,\n rawRequest: unknown,\n rawResponse: unknown,\n opts: RouterOptions\n): MionResponse | Promise<MionResponse> {\n const {response, request, executionChain} = context;\n const executionList = executionChain.methods;\n const executionCount = executionList.length;\n for (let i = 0; i < executionCount; i++) {\n const executable = executionList[i];\n if (response.hasErrors && !executable.alwaysRun) continue;\n if (executable.isAsync) return runExecutionChain(context, rawRequest, rawResponse, opts, i);\n\n try {\n const result = executable.methodCaller(context, executable, request, response, opts, rawRequest, rawResponse);\n if (isUncheckedPromise(executable, result)) {\n return Promise.resolve(result)\n .then((resolved) => applyResult(context, executable, resolved))\n .catch((err) => recordUndeclaredError(context, executable.id, err))\n .then(() => runExecutionChain(context, rawRequest, rawResponse, opts, i + 1));\n }\n applyResult(context, executable, result);\n } catch (err: any) {\n // All thrown errors are undeclared and fatal\n recordUndeclaredError(context, executable.id, err);\n }\n }\n return response;\n}\n\n/** Backstop for a wrong or missing declared type, else the promise is serialized as the answer. */\nfunction isUncheckedPromise(executable: RemoteMethod, result: any): result is PromiseLike<unknown> {\n if (executable.asyncChecked === true) return false;\n executable.asyncChecked = true;\n if (result === null || typeof result !== 'object' || typeof result.then !== 'function') return false;\n (executable as Mutable<RemoteMethod>).isAsync = true;\n return true;\n}\n\n/** A throw here is the caller's to record, like the step's own. */\nfunction applyResult(context: CallContext, executable: RemoteMethod, result: any): void {\n if (result === undefined) return;\n const response = context.response;\n // One brand read serves every branch below: it is an own property on every mion error, wire copies too\n // `null` is a valid answer and reading a property off it throws, so it is excluded first\n const isMionError = result !== null && result['mion@isΣrrθr'] === true;\n if (!executable.hasReturnData) {\n // a raw middleware declares no return, so a returned error is undeclared and halts like a thrown one\n if (isMionError || isNativeError(result)) recordUndeclaredError(context, executable.id, result);\n return;\n }\n if (isMionError) {\n // a returned FatalError is declared: it ends the chain but keeps its slot; a plain RpcError lets the chain run on\n if (result.isFatal === true) markResponseFailed(context, result, StatusCodes.APPLICATION_ERROR);\n }\n // A brandless Error is a bug with no typed slot; in the body it would be served as a SUCCESSFUL answer\n else if (isNativeError(result)) {\n recordUndeclaredError(context, executable.id, result);\n return; // like a thrown one: it belongs in @thrownErrors, never in the body\n }\n if (executable.headersReturn && result instanceof HeadersSubset) {\n // own keys only: a HeadersSubset built over a parsed body must not turn inherited keys into headers\n const headersMap = result.headers;\n for (const name of Object.keys(headersMap)) {\n const value = headersMap[name];\n if (value !== undefined && value !== null) {\n response.headers.set(name, value);\n }\n }\n return;\n }\n (response.body as Mutable<AnyObject>)[executable.id] = result;\n}\n\n// The three callers below are NOT async: awaiting the handler only to return its value adds a promise\n// frame per chain member, and the loop's own await and try/catch cover the value and the promise alike.\nfunction runRawMiddleware(\n context: CallContext,\n executable: RawMethod,\n req,\n resp,\n opts: RouterOptions,\n rawRequest: unknown,\n rawResponse: unknown\n) {\n return executable.handler(context, rawRequest, rawResponse, opts);\n}\n\nfunction runHeadersMiddleware(context: CallContext, executable: HeadersMethod, request: MionRequest) {\n const headerNames = executable.headersParam.headerNames;\n const params = sanitizeParams(\n deserializeBodyParamsOrThrow(request, executable as RemoteMethod),\n request,\n executable as RemoteMethod\n );\n const headersMap: Record<string, string> = {};\n headerNames.forEach((name) => {\n const value = request.headers.get(name);\n if (value) headersMap[name] = value;\n });\n const headersSubset = trustedHeadersSubset(headersMap);\n validateHeaderParamsOrThrow(headersSubset, executable as HeadersMethod);\n validateParametersOrThrow(params, executable as HeadersMethod);\n\n return executable.handler(context, headersSubset, ...params);\n}\n\nfunction runRouteOrMiddleware(context: CallContext, executable: HeadersMethod, request: MionRequest) {\n const params = sanitizeParams(\n deserializeBodyParamsOrThrow(request, executable as RemoteMethod),\n request,\n executable as RemoteMethod\n );\n validateParametersOrThrow(params, executable as RemoteMethod);\n return executable.handler(context, ...params);\n}\n\n/** Applies the rewrites the params types declare under a format's `transform` key (trim / case /\n * replace / stripSeparators) in place, after decode and BEFORE validation. Params only: headers and\n * return values are never sanitized. A transform over wrong-shaped input can throw (`.trim()` on a\n * number): the raw params fall through so validation reports the real error instead of a 500. */\nfunction sanitizeParams(params: any[], request: MionRequest, executable: RemoteMethod): any[] {\n if (!executable.options.sanitizeParams) return params;\n const formatTransform = executable.paramsJitFns.formatTransform;\n if (!formatTransform || formatTransform.isNoop) return params;\n try {\n const sanitized = formatTransform.fn(params) as any[];\n (request.body as Mutable<MionRequest['body']>)[executable.id] = sanitized;\n return sanitized;\n } catch {\n return params;\n }\n}\n\n/** The caller for a method kind. Read ONCE, when the method is registered, so the dispatch loop\n * reads a field instead of branching on the method type on every request. */\nexport function callerForType(type: RemoteMethod['type']): (...args: any[]) => any {\n if (type === HandlerType.rawMiddleware) return runRawMiddleware;\n if (type === HandlerType.headersMiddleware) return runHeadersMiddleware;\n return runRouteOrMiddleware;\n}\n\n/** The caller already stored on a registered method. */\nexport function getMethodCaller(executable: RemoteMethod) {\n return executable.methodCaller;\n}\n\n/** Shared, for the members whose id is absent from the body: a fresh empty array per member per request\n * bought nothing. Frozen, so a handler that tried to mutate its params fails loudly instead of corrupting\n * the next request; nothing can reach it anyway, an empty tuple is spread into the call. */\nconst EMPTY_PARAMS: any[] = [];\nObject.freeze(EMPTY_PARAMS);\n\nfunction deserializeBodyParamsOrThrow(request: MionRequest, executable: RemoteMethod): any[] {\n // own key only: an id like `toString` would otherwise read Object.prototype off the parsed body\n const body = request.body;\n const params = (Object.hasOwn(body, executable.id) ? body[executable.id] : undefined) as any[] | undefined;\n // EMPTY_PARAMS is frozen and the decoders mutate what they are handed, so decoding the sentinel would\n // report a raw serialization error where validation should refuse the missing body.\n if (!params) return EMPTY_PARAMS;\n // a route without params has no validator, so a spread string would reach the handler as its characters\n if (!Array.isArray(params))\n throw new FatalError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n type: 'serialization-error',\n publicMessage: `Invalid params '${executable.id}', params must be an array.`,\n errorData: {deserializeError: 'params must be an array'},\n });\n\n const {decode} = executable.paramsJitFns.json;\n if (decode.isNoop) return params;\n try {\n const decoded = decode.fn(params);\n (body as Mutable<MionRequest['body']>)[executable.id] = decoded;\n return decoded;\n } catch (e: any) {\n if (isStackOverflow(e)) throw nestingTooDeep(executable, e);\n // Fixed wire text: the decoder's message quotes internal detail; the original stays on `originalError`.\n // A refused-key message is safe to pass on: mion's own constant, naming a key the caller sent.\n const refusedKey = typeof e?.message === 'string' && e.message.startsWith(UNSAFE_PROPERTY_NAME_MESSAGE);\n const detail = refusedKey ? (e.message as string) : 'Parameters might be of the wrong type.';\n throw new FatalError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n type: 'serialization-error',\n publicMessage: `Invalid params '${executable.id}', can not deserialize. ${detail}`,\n originalError: e,\n errorData: {\n deserializeError: detail,\n },\n });\n }\n}\n\n/** A RangeError out of a compiled function is the engine's stack limit: the request nested deeper\n * than a recursive type can be walked. Reported as its own typed 4xx, never as an unknown error. */\nfunction isStackOverflow(err: unknown): boolean {\n return err instanceof RangeError;\n}\n\nfunction nestingTooDeep(executable: RemoteMethod, originalError: Error): RpcError<'request-nesting-too-deep'> {\n return new FatalError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n type: 'request-nesting-too-deep',\n publicMessage: `Invalid params in '${executable.id}', the request is nested too deep.`,\n originalError,\n });\n}\n\nfunction validateParametersOrThrow(params: any[], executable: RemoteMethod): void {\n if (executable.paramsJitFns.isType.isNoop) return;\n let isValid: boolean;\n try {\n isValid = executable.paramsJitFns.isType.fn(params);\n } catch (e: any) {\n if (isStackOverflow(e)) throw nestingTooDeep(executable, e);\n throw e;\n }\n if (!isValid) {\n const validationError: ValidationError = new FatalError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n type: 'validation-error',\n publicMessage: `Invalid params in '${executable.id}', validation failed.`,\n errorData: {\n typeErrors: executable.paramsJitFns.typeErrors.fn(params),\n },\n });\n throw validationError;\n }\n}\n\nfunction validateHeaderParamsOrThrow(headers: HeadersSubset<string, string>, executable: HeadersMethod): void {\n if (!executable.headersParam.jitFns.isType.fn(headers)) {\n const validationError: ValidationError = new FatalError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n type: 'validation-error',\n publicMessage: `Invalid params in '${executable.id}', validation failed.`,\n errorData: {\n typeErrors: executable.headersParam.jitFns.typeErrors.fn(headers),\n },\n });\n throw validationError;\n }\n}\n"],"mappings":";;;;;;;AAwBA,eAAsB,cACpB,MACA,YACA,YACA,aACA,YACA,aACA,aACA,UACuB;CAEvB,OAAO,oBADS,kBAAkB,MAAM,UAAU,YAAY,YAAY,aAAa,YAAY,WACxE,GAAS,YAAY,WAAW;AAC7D;;AAGA,eAAsB,oBACpB,SACA,YACA,aACA,YACA,aACuB;CACvB,IAAI,eAAe,KAAA,GAAW;EAC5B,MAAM,UAAU,QAAQ;EACxB,QAAQ,UAAU;EAClB,QAAQ,WAAW,eAAe,mBAAmB,UAAU;CACjE;CAEA,OAAO,kBAAkB,SAAS,YAAY,WAAW;AAC3D;;AAGA,SAAgB,kBACd,SACA,YACA,aACsC;CACtC,MAAM,OAAO,iBAAiB;CAC9B,IAAI,KAAK,aAAa,OAAO,kBAAkB,SAAS,YAAY,aAAa,MAAM,CAAC;CACxF,OAAO,sBAAsB,SAAS,YAAY,aAAa,IAAI;AACrE;;;;;;;;AASA,SAAgB,sBACd,OACA,MACA,UACA,eACA,YACA,aACA,YACA,aACuB;CACvB,MAAM,UAAU,uBAAuB,OAAO,MAAM,UAAU,YAAY,WAAW;CACrF,sBAAsB,SAAS,YAAY,eAAe,aAAa;CACvE,OAAO,oBAAoB,SAAS,YAAY,WAAW;AAC7D;AAIA,eAAe,kBACb,SACA,YACA,aACA,MACA,YACuB;CACvB,MAAM,EAAC,UAAU,SAAS,mBAAkB;CAE5C,MAAM,cAAc,KAAK;CACzB,MAAM,gBAAgB,eAAe;CACrC,MAAM,iBAAiB,cAAc;CACrC,KAAK,IAAI,IAAI,YAAY,IAAI,gBAAgB,KAAK;EAChD,MAAM,aAAa,cAAc;EACjC,IAAI,SAAS,aAAa,CAAC,WAAW,WAAW;EAEjD,IAAI;GAIF,IAAI;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ch.js","names":[],"sources":["../../../src/dispatch.ts"],"sourcesContent":["/* ########\n * 2022 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport type {CallContext, HttpMethod, MionResponse, MionRequest, MionHeaders, RawRequestBody} from './types/context.ts';\nimport {type RouterOptions} from './types/general.ts';\nimport {HeadersMethod, RemoteMethod, RawMethod} from './types/remoteMethods.ts';\nimport type {MethodsExecutionChain} from './types/remoteMethods.ts';\nimport {getRouterOptions} from './router.ts';\nimport {Mutable, AnyObject, StatusCodes, HeadersSubset, SerializerCode, MION_ROUTES, trustedHeadersSubset} from '@mionjs/core';\nimport {RpcError, FatalError, HandlerType, ValidationError, isNativeError} from '@mionjs/core';\nimport {UNSAFE_PROPERTY_NAME_MESSAGE} from '@mionjs/run-types';\nimport {markResponseFailed, recordUndeclaredError} from './lib/dispatchError.ts';\nimport {createCallContext, createContextFromChain, getRequestBodyType} from './callContext.ts';\n\n// Profiled and discarded: promisify(setImmediate) (worse or no gain), queueMicrotask instead of\n// setImmediate (definitely worse), callbacks instead of promises (slower, less memory in some scenarios).\n\n// ############# PUBLIC METHODS #############\n\n/** The one-call form for a caller that already has the body (tests, a host that parsed it). */\nexport async function dispatchRoute<Req, Resp>(\n path: string,\n reqRawBody: RawRequestBody,\n reqHeaders: MionHeaders,\n respHeaders: MionHeaders,\n rawRequest: Req,\n rawResponse?: Resp,\n reqBodyType?: SerializerCode,\n urlQuery?: string,\n method: HttpMethod = 'POST'\n): Promise<MionResponse> {\n const context = createCallContext(path, urlQuery, rawRequest, reqHeaders, respHeaders, reqRawBody, reqBodyType, method);\n return dispatchWithContext(context, rawRequest, rawResponse);\n}\n\n/** A streaming adapter builds the context before reading the body, to check `context.maxBodySize`, then passes it. */\nexport async function dispatchWithContext<Req, Resp>(\n context: CallContext,\n rawRequest: Req,\n rawResponse?: Resp,\n reqRawBody?: RawRequestBody,\n reqBodyType?: SerializerCode\n): Promise<MionResponse> {\n if (reqRawBody !== undefined) {\n const request = context.request as Mutable<MionRequest>;\n request.rawBody = reqRawBody;\n request.bodyType = reqBodyType ?? getRequestBodyType(reqRawBody);\n }\n // No catch: the chain runners handle every exception themselves, so one that only re-rejects changes nothing.\n return dispatchMaybeSync(context, rawRequest, rawResponse);\n}\n\n/** `dispatchWithContext` for a context built with its body, minus the promise when no step needs one. */\nexport function dispatchMaybeSync<Req, Resp>(\n context: CallContext,\n rawRequest: Req,\n rawResponse?: Resp\n): MionResponse | Promise<MionResponse> {\n const opts = getRouterOptions();\n if (opts.alwaysAwait) return runExecutionChain(context, rawRequest, rawResponse, opts, 0);\n return runSyncExecutionChain(context, rawRequest, rawResponse, opts);\n}\n\n/** Dispatches a request the platform adapter refused after its route resolved: a body past the limit.\n * The error is recorded exactly as a thrown one is, so the chain runs only the members that declare\n * `alwaysRun` (a rate limiter, an access log) and answers with the same envelope. The adapter stopped\n * the read, so the context is built without a body.\n * `path` and `urlQuery` travel with the chain rather than on it: mion's not-found chains and a merged\n * batch chain each answer for many paths, so they carry none of their own, and a refusal does reach one\n * of those (an adapter checks a declared content-length before asking whether the chain reads a body). */\nexport function dispatchPlatformError<Req, Resp>(\n chain: MethodsExecutionChain,\n path: string,\n urlQuery: string | undefined,\n method: HttpMethod,\n platformError: RpcError<string>,\n reqHeaders: MionHeaders,\n respHeaders: MionHeaders,\n rawRequest: Req,\n rawResponse?: Resp\n): Promise<MionResponse> {\n const context = createContextFromChain(chain, path, urlQuery, method, reqHeaders, respHeaders);\n recordUndeclaredError(context, MION_ROUTES.platformError, platformError);\n return dispatchWithContext(context, rawRequest, rawResponse);\n}\n\n// ############# PRIVATE METHODS #############\n\nasync function runExecutionChain(\n context: CallContext,\n rawRequest: unknown,\n rawResponse: unknown,\n opts: RouterOptions,\n startIndex: number\n): Promise<MionResponse> {\n const {request, executionChain} = context;\n const response = context.response;\n // `alwaysAwait: false` skips the await on sync steps: awaiting one only costs a promise frame\n const alwaysAwait = opts.alwaysAwait;\n const executionList = executionChain.methods;\n const executionCount = executionList.length;\n for (let i = startIndex; i < executionCount; i++) {\n const executable = executionList[i];\n if (response.stopped && !executable.alwaysRun) continue;\n\n try {\n // runRawMiddleware, runHeadersMiddleware & runRouteOrMiddleware must take the same params in the same order\n // methodCaller is resolved at registration, so the loop never picks one\n // `isAsync` comes from the type checker, so a plain function returning a promise still awaits\n let result;\n if (alwaysAwait || executable.isAsync) {\n result = await executable.methodCaller(context, executable, request, response, opts, rawRequest, rawResponse);\n } else {\n result = executable.methodCaller(context, executable, request, response, opts, rawRequest, rawResponse);\n if (isUncheckedPromise(executable, result)) result = await result;\n }\n applyResult(context, executable, result);\n } catch (err: any) {\n // All thrown errors are undeclared and fatal\n recordUndeclaredError(context, executable.id, err);\n }\n }\n return context.response;\n}\n\n/** `runExecutionChain` without awaits: from the first async step on it hands over, so both give the same result. */\nfunction runSyncExecutionChain(\n context: CallContext,\n rawRequest: unknown,\n rawResponse: unknown,\n opts: RouterOptions\n): MionResponse | Promise<MionResponse> {\n const {request, executionChain} = context;\n const response = context.response;\n const executionList = executionChain.methods;\n const executionCount = executionList.length;\n for (let i = 0; i < executionCount; i++) {\n const executable = executionList[i];\n if (response.stopped && !executable.alwaysRun) continue;\n if (executable.isAsync) return runExecutionChain(context, rawRequest, rawResponse, opts, i);\n\n try {\n const result = executable.methodCaller(context, executable, request, response, opts, rawRequest, rawResponse);\n if (isUncheckedPromise(executable, result)) {\n return Promise.resolve(result)\n .then((resolved) => applyResult(context, executable, resolved))\n .catch((err) => recordUndeclaredError(context, executable.id, err))\n .then(() => runExecutionChain(context, rawRequest, rawResponse, opts, i + 1));\n }\n applyResult(context, executable, result);\n } catch (err: any) {\n // All thrown errors are undeclared and fatal\n recordUndeclaredError(context, executable.id, err);\n }\n }\n return response;\n}\n\n/** Backstop for a wrong or missing declared type, else the promise is serialized as the answer. */\nfunction isUncheckedPromise(executable: RemoteMethod, result: any): result is PromiseLike<unknown> {\n if (executable.asyncChecked === true) return false;\n executable.asyncChecked = true;\n if (result === null || typeof result !== 'object' || typeof result.then !== 'function') return false;\n (executable as Mutable<RemoteMethod>).isAsync = true;\n return true;\n}\n\n/** A throw here is the caller's to record, like the step's own. */\nfunction applyResult(context: CallContext, executable: RemoteMethod, result: any): void {\n if (result === undefined) return;\n const response = context.response;\n // One brand read serves every branch below: it is an own property on every mion error, wire copies too\n // `null` is a valid answer and reading a property off it throws, so it is excluded first\n const isMionError = result !== null && result['mion@isΣrrθr'] === true;\n if (!executable.hasReturnData) {\n // a raw middleware declares no return, so a returned error is undeclared and halts like a thrown one\n if (isMionError || isNativeError(result)) recordUndeclaredError(context, executable.id, result);\n return;\n }\n if (isMionError) {\n // a returned FatalError is declared: it ends the chain but keeps its slot; a plain RpcError lets the chain run on\n if (result.isFatal === true) markResponseFailed(context, result, StatusCodes.APPLICATION_ERROR);\n }\n // A brandless Error is a bug with no typed slot; in the body it would be served as a SUCCESSFUL answer\n else if (isNativeError(result)) {\n recordUndeclaredError(context, executable.id, result);\n return; // like a thrown one: it belongs in @thrownErrors, never in the body\n }\n if (executable.headersReturn && result instanceof HeadersSubset) {\n // own keys only: a HeadersSubset built over a parsed body must not turn inherited keys into headers\n const headersMap = result.headers;\n for (const name of Object.keys(headersMap)) {\n const value = headersMap[name];\n if (value !== undefined && value !== null) {\n response.headers.set(name, value);\n }\n }\n return;\n }\n (response.body as Mutable<AnyObject>)[executable.id] = result;\n}\n\n// The three callers below are NOT async: awaiting the handler only to return its value adds a promise\n// frame per chain member, and the loop's own await and try/catch cover the value and the promise alike.\nfunction runRawMiddleware(\n context: CallContext,\n executable: RawMethod,\n req,\n resp,\n opts: RouterOptions,\n rawRequest: unknown,\n rawResponse: unknown\n) {\n return executable.handler(context, rawRequest, rawResponse, opts);\n}\n\nfunction runHeadersMiddleware(context: CallContext, executable: HeadersMethod, request: MionRequest) {\n const headerNames = executable.headersParam.headerNames;\n const params = sanitizeParams(\n deserializeBodyParamsOrThrow(request, executable as RemoteMethod),\n request,\n executable as RemoteMethod\n );\n const headersMap: Record<string, string> = {};\n headerNames.forEach((name) => {\n const value = request.headers.get(name);\n if (value) headersMap[name] = value;\n });\n const headersSubset = trustedHeadersSubset(headersMap);\n validateHeaderParamsOrThrow(headersSubset, executable as HeadersMethod);\n validateParametersOrThrow(params, executable as HeadersMethod);\n\n return executable.handler(context, headersSubset, ...params);\n}\n\nfunction runRouteOrMiddleware(context: CallContext, executable: HeadersMethod, request: MionRequest) {\n const params = sanitizeParams(\n deserializeBodyParamsOrThrow(request, executable as RemoteMethod),\n request,\n executable as RemoteMethod\n );\n validateParametersOrThrow(params, executable as RemoteMethod);\n return executable.handler(context, ...params);\n}\n\n/** Applies the rewrites the params types declare under a format's `transform` key (trim / case /\n * replace / stripSeparators) in place, after decode and BEFORE validation. Params only: headers and\n * return values are never sanitized. A transform over wrong-shaped input can throw (`.trim()` on a\n * number): the raw params fall through so validation reports the real error instead of a 500. */\nfunction sanitizeParams(params: any[], request: MionRequest, executable: RemoteMethod): any[] {\n if (!executable.options.sanitizeParams) return params;\n const formatTransform = executable.paramsJitFns.formatTransform;\n if (!formatTransform || formatTransform.isNoop) return params;\n try {\n const sanitized = formatTransform.fn(params) as any[];\n (request.body as Mutable<MionRequest['body']>)[executable.id] = sanitized;\n return sanitized;\n } catch {\n return params;\n }\n}\n\n/** The caller for a method kind. Read ONCE, when the method is registered, so the dispatch loop\n * reads a field instead of branching on the method type on every request. */\nexport function callerForType(type: RemoteMethod['type']): (...args: any[]) => any {\n if (type === HandlerType.rawMiddleware) return runRawMiddleware;\n if (type === HandlerType.headersMiddleware) return runHeadersMiddleware;\n return runRouteOrMiddleware;\n}\n\n/** The caller already stored on a registered method. */\nexport function getMethodCaller(executable: RemoteMethod) {\n return executable.methodCaller;\n}\n\n/** Shared, for the members whose id is absent from the body: a fresh empty array per member per request\n * bought nothing. Frozen, so a handler that tried to mutate its params fails loudly instead of corrupting\n * the next request; nothing can reach it anyway, an empty tuple is spread into the call. */\nconst EMPTY_PARAMS: any[] = [];\nObject.freeze(EMPTY_PARAMS);\n\nfunction deserializeBodyParamsOrThrow(request: MionRequest, executable: RemoteMethod): any[] {\n // own key only: an id like `toString` would otherwise read Object.prototype off the parsed body\n const body = request.body;\n const params = (Object.hasOwn(body, executable.id) ? body[executable.id] : undefined) as any[] | undefined;\n // EMPTY_PARAMS is frozen and the decoders mutate what they are handed, so decoding the sentinel would\n // report a raw serialization error where validation should refuse the missing body.\n if (!params) return EMPTY_PARAMS;\n // a route without params has no validator, so a spread string would reach the handler as its characters\n if (!Array.isArray(params))\n throw new FatalError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n type: 'serialization-error',\n publicMessage: `Invalid params '${executable.id}', params must be an array.`,\n errorData: {deserializeError: 'params must be an array'},\n });\n\n const {decode} = executable.paramsJitFns.json;\n if (decode.isNoop) return params;\n try {\n const decoded = decode.fn(params);\n (body as Mutable<MionRequest['body']>)[executable.id] = decoded;\n return decoded;\n } catch (e: any) {\n if (isStackOverflow(e)) throw nestingTooDeep(executable, e);\n // Fixed wire text: the decoder's message quotes internal detail; the original stays on `originalError`.\n // A refused-key message is safe to pass on: mion's own constant, naming a key the caller sent.\n const refusedKey = typeof e?.message === 'string' && e.message.startsWith(UNSAFE_PROPERTY_NAME_MESSAGE);\n const detail = refusedKey ? (e.message as string) : 'Parameters might be of the wrong type.';\n throw new FatalError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n type: 'serialization-error',\n publicMessage: `Invalid params '${executable.id}', can not deserialize. ${detail}`,\n originalError: e,\n errorData: {\n deserializeError: detail,\n },\n });\n }\n}\n\n/** A RangeError out of a compiled function is the engine's stack limit: the request nested deeper\n * than a recursive type can be walked. Reported as its own typed 4xx, never as an unknown error. */\nfunction isStackOverflow(err: unknown): boolean {\n return err instanceof RangeError;\n}\n\nfunction nestingTooDeep(executable: RemoteMethod, originalError: Error): RpcError<'request-nesting-too-deep'> {\n return new FatalError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n type: 'request-nesting-too-deep',\n publicMessage: `Invalid params in '${executable.id}', the request is nested too deep.`,\n originalError,\n });\n}\n\nfunction validateParametersOrThrow(params: any[], executable: RemoteMethod): void {\n if (executable.paramsJitFns.isType.isNoop) return;\n let isValid: boolean;\n try {\n isValid = executable.paramsJitFns.isType.fn(params);\n } catch (e: any) {\n if (isStackOverflow(e)) throw nestingTooDeep(executable, e);\n throw e;\n }\n if (!isValid) {\n const validationError: ValidationError = new FatalError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n type: 'validation-error',\n publicMessage: `Invalid params in '${executable.id}', validation failed.`,\n errorData: {\n typeErrors: executable.paramsJitFns.typeErrors.fn(params),\n },\n });\n throw validationError;\n }\n}\n\nfunction validateHeaderParamsOrThrow(headers: HeadersSubset<string, string>, executable: HeadersMethod): void {\n if (!executable.headersParam.jitFns.isType.fn(headers)) {\n const validationError: ValidationError = new FatalError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n type: 'validation-error',\n publicMessage: `Invalid params in '${executable.id}', validation failed.`,\n errorData: {\n typeErrors: executable.headersParam.jitFns.typeErrors.fn(headers),\n },\n });\n throw validationError;\n }\n}\n"],"mappings":";;;;;;;AAwBA,eAAsB,cACpB,MACA,YACA,YACA,aACA,YACA,aACA,aACA,UACA,SAAqB,QACE;CAEvB,OAAO,oBADS,kBAAkB,MAAM,UAAU,YAAY,YAAY,aAAa,YAAY,aAAa,MACrF,GAAS,YAAY,WAAW;AAC7D;;AAGA,eAAsB,oBACpB,SACA,YACA,aACA,YACA,aACuB;CACvB,IAAI,eAAe,KAAA,GAAW;EAC5B,MAAM,UAAU,QAAQ;EACxB,QAAQ,UAAU;EAClB,QAAQ,WAAW,eAAe,mBAAmB,UAAU;CACjE;CAEA,OAAO,kBAAkB,SAAS,YAAY,WAAW;AAC3D;;AAGA,SAAgB,kBACd,SACA,YACA,aACsC;CACtC,MAAM,OAAO,iBAAiB;CAC9B,IAAI,KAAK,aAAa,OAAO,kBAAkB,SAAS,YAAY,aAAa,MAAM,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;CAC3C,IAAI;CACJ,IAAI;EACF,UAAU,WAAW,aAAa,OAAO,GAAG,MAAM;CACpD,SAAS,GAAQ;EACf,IAAI,gBAAgB,CAAC,GAAG,MAAM,eAAe,YAAY,CAAC;EAC1D,MAAM;CACR;CACA,IAAI,CAAC,SASH,MAAM,IARuC,WAAW;EACtD,YAAY,YAAY;EACxB,MAAM;EACN,eAAe,sBAAsB,WAAW,GAAG;EACnD,WAAW,EACT,YAAY,WAAW,aAAa,WAAW,GAAG,MAAM,EAC1D;CACF,CACM;AAEV;AAEA,SAAS,4BAA4B,SAAwC,YAAiC;CAC5G,IAAI,CAAC,WAAW,aAAa,OAAO,OAAO,GAAG,OAAO,GASnD,MAAM,IARuC,WAAW;EACtD,YAAY,YAAY;EACxB,MAAM;EACN,eAAe,sBAAsB,WAAW,GAAG;EACnD,WAAW,EACT,YAAY,WAAW,aAAa,OAAO,WAAW,GAAG,OAAO,EAClE;CACF,CACM;AAEV"}
@@ -1,8 +1,9 @@
1
1
  import { RpcError } from '@mionjs/core';
2
- import { CallContext, MionHeaders, MionResponse } from '../types/context.ts';
2
+ import { CallContext, MionResponse, MionHeaders } from '../types/context.ts';
3
3
  export declare function getRouterFatalErrorResponse(returnErr: RpcError<string>, respHeaders: MionHeaders): MionResponse;
4
4
  export declare function errorHeaderValue(type: string): string;
5
5
  export declare function markResponseFailed(context: CallContext, rpcError: RpcError<string>, fallbackStatus: number): void;
6
+ export declare function endChain(context: CallContext, statusCode?: number): void;
6
7
  export declare function toRpcError(err: unknown): RpcError<string>;
7
8
  export declare function recordUndeclaredError(context: CallContext, key: string, err: any): void;
8
9
  export declare function addThrownError(context: CallContext, key: string, rpcError: RpcError<string>): void;