@mionjs/router 0.8.8 → 0.13.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.
- package/.dist/cjs/.mion/types/A0Qb_D32xQCR.cjs +16 -0
- package/.dist/cjs/.mion/types/A0Qb_D32xQCR.cjs.map +1 -0
- package/.dist/cjs/.mion/types/A0Qb_D5PMNNO.cjs +17 -0
- package/.dist/cjs/.mion/types/A0Qb_D5PMNNO.cjs.map +1 -0
- package/.dist/cjs/.mion/types/A0Qb_E1CjDEA.cjs +36 -0
- package/.dist/cjs/.mion/types/A0Qb_E1CjDEA.cjs.map +1 -0
- package/.dist/cjs/.mion/types/A0Qb_EYEglde.cjs +16 -0
- package/.dist/cjs/.mion/types/A0Qb_EYEglde.cjs.map +1 -0
- package/.dist/cjs/.mion/types/A0Qb_EyHLuYw.cjs +16 -0
- package/.dist/cjs/.mion/types/A0Qb_EyHLuYw.cjs.map +1 -0
- package/.dist/cjs/.mion/types/A0Qb_G42dZdW.cjs +16 -0
- package/.dist/cjs/.mion/types/A0Qb_G42dZdW.cjs.map +1 -0
- package/.dist/cjs/.mion/types/A0Qb_HSE8icr.cjs +16 -0
- package/.dist/cjs/.mion/types/A0Qb_HSE8icr.cjs.map +1 -0
- package/.dist/cjs/.mion/types/A0Qb_HXAy3Lx.cjs +13 -0
- package/.dist/cjs/.mion/types/A0Qb_HXAy3Lx.cjs.map +1 -0
- package/.dist/cjs/.mion/types/A0Qb_JJrCj9i.cjs +13 -0
- package/.dist/cjs/.mion/types/A0Qb_JJrCj9i.cjs.map +1 -0
- package/.dist/cjs/.mion/types/A0Qb_KDyf2Fa.cjs +16 -0
- package/.dist/cjs/.mion/types/A0Qb_KDyf2Fa.cjs.map +1 -0
- package/.dist/cjs/.mion/types/A0Qb_L3mQkaR.cjs +13 -0
- package/.dist/cjs/.mion/types/A0Qb_L3mQkaR.cjs.map +1 -0
- package/.dist/cjs/.mion/types/A0Qb_RAudOr2.cjs +13 -0
- package/.dist/cjs/.mion/types/A0Qb_RAudOr2.cjs.map +1 -0
- package/.dist/cjs/.mion/types/A0Qb_TRnIbow.cjs +17 -0
- package/.dist/cjs/.mion/types/A0Qb_TRnIbow.cjs.map +1 -0
- package/.dist/cjs/.mion/types/A0Qb_UOI3bXq.cjs +17 -0
- package/.dist/cjs/.mion/types/A0Qb_UOI3bXq.cjs.map +1 -0
- package/.dist/cjs/.mion/types/A0Qb_VsWxRKn.cjs +13 -0
- package/.dist/cjs/.mion/types/A0Qb_VsWxRKn.cjs.map +1 -0
- package/.dist/cjs/.mion/types/A0Qb_ZTKzxQG.cjs +16 -0
- package/.dist/cjs/.mion/types/A0Qb_ZTKzxQG.cjs.map +1 -0
- package/.dist/cjs/.mion/types/A0Qb_b4tYK8X.cjs +16 -0
- package/.dist/cjs/.mion/types/A0Qb_b4tYK8X.cjs.map +1 -0
- package/.dist/cjs/.mion/types/A0Qb_deFq9zY.cjs +26 -0
- package/.dist/cjs/.mion/types/A0Qb_deFq9zY.cjs.map +1 -0
- package/.dist/cjs/.mion/types/A0Qb_fMIJ1JT.cjs +14 -0
- package/.dist/cjs/.mion/types/A0Qb_fMIJ1JT.cjs.map +1 -0
- package/.dist/cjs/.mion/types/A0Qb_g17turq.cjs +13 -0
- package/.dist/cjs/.mion/types/A0Qb_g17turq.cjs.map +1 -0
- package/.dist/cjs/.mion/types/A0Qb_hqa3Nzs.cjs +14 -0
- package/.dist/cjs/.mion/types/A0Qb_hqa3Nzs.cjs.map +1 -0
- package/.dist/cjs/.mion/types/A0Qb_iKPrxW9.cjs +16 -0
- package/.dist/cjs/.mion/types/A0Qb_iKPrxW9.cjs.map +1 -0
- package/.dist/cjs/.mion/types/A0Qb_jLtJ5Kv.cjs +16 -0
- package/.dist/cjs/.mion/types/A0Qb_jLtJ5Kv.cjs.map +1 -0
- package/.dist/cjs/.mion/types/A0Qb_kibOHkN.cjs +14 -0
- package/.dist/cjs/.mion/types/A0Qb_kibOHkN.cjs.map +1 -0
- package/.dist/cjs/.mion/types/A0Qb_kz5ne4c.cjs +16 -0
- package/.dist/cjs/.mion/types/A0Qb_kz5ne4c.cjs.map +1 -0
- package/.dist/cjs/.mion/types/A0Qb_pzBRrJb.cjs +16 -0
- package/.dist/cjs/.mion/types/A0Qb_pzBRrJb.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Eq2V_EYEglde.cjs +16 -0
- package/.dist/cjs/.mion/types/Eq2V_EYEglde.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Eq2V_EyHLuYw.cjs +16 -0
- package/.dist/cjs/.mion/types/Eq2V_EyHLuYw.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Eq2V_HSE8icr.cjs +16 -0
- package/.dist/cjs/.mion/types/Eq2V_HSE8icr.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Eq2V_HXAy3Lx.cjs +13 -0
- package/.dist/cjs/.mion/types/Eq2V_HXAy3Lx.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Eq2V_JJrCj9i.cjs +13 -0
- package/.dist/cjs/.mion/types/Eq2V_JJrCj9i.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Eq2V_KDyf2Fa.cjs +16 -0
- package/.dist/cjs/.mion/types/Eq2V_KDyf2Fa.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Eq2V_L3mQkaR.cjs +13 -0
- package/.dist/cjs/.mion/types/Eq2V_L3mQkaR.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Eq2V_RAudOr2.cjs +13 -0
- package/.dist/cjs/.mion/types/Eq2V_RAudOr2.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Eq2V_TRnIbow.cjs +17 -0
- package/.dist/cjs/.mion/types/Eq2V_TRnIbow.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Eq2V_UOI3bXq.cjs +17 -0
- package/.dist/cjs/.mion/types/Eq2V_UOI3bXq.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Eq2V_VsWxRKn.cjs +13 -0
- package/.dist/cjs/.mion/types/Eq2V_VsWxRKn.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Eq2V_ZTKzxQG.cjs +16 -0
- package/.dist/cjs/.mion/types/Eq2V_ZTKzxQG.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Eq2V_b4tYK8X.cjs +16 -0
- package/.dist/cjs/.mion/types/Eq2V_b4tYK8X.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Eq2V_deFq9zY.cjs +26 -0
- package/.dist/cjs/.mion/types/Eq2V_deFq9zY.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Eq2V_g17turq.cjs +13 -0
- package/.dist/cjs/.mion/types/Eq2V_g17turq.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Eq2V_iKPrxW9.cjs +16 -0
- package/.dist/cjs/.mion/types/Eq2V_iKPrxW9.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Eq2V_jLtJ5Kv.cjs +16 -0
- package/.dist/cjs/.mion/types/Eq2V_jLtJ5Kv.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Eq2V_kz5ne4c.cjs +16 -0
- package/.dist/cjs/.mion/types/Eq2V_kz5ne4c.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Eq2V_pzBRrJb.cjs +16 -0
- package/.dist/cjs/.mion/types/Eq2V_pzBRrJb.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Ky89_D32xQCR.cjs +16 -0
- package/.dist/cjs/.mion/types/Ky89_D32xQCR.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Ky89_D5PMNNO.cjs +16 -0
- package/.dist/cjs/.mion/types/Ky89_D5PMNNO.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Ky89_E1CjDEA.cjs +32 -0
- package/.dist/cjs/.mion/types/Ky89_E1CjDEA.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Ky89_EYEglde.cjs +16 -0
- package/.dist/cjs/.mion/types/Ky89_EYEglde.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Ky89_EyHLuYw.cjs +16 -0
- package/.dist/cjs/.mion/types/Ky89_EyHLuYw.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Ky89_G42dZdW.cjs +16 -0
- package/.dist/cjs/.mion/types/Ky89_G42dZdW.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Ky89_HSE8icr.cjs +16 -0
- package/.dist/cjs/.mion/types/Ky89_HSE8icr.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Ky89_JJrCj9i.cjs +13 -0
- package/.dist/cjs/.mion/types/Ky89_JJrCj9i.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Ky89_KDyf2Fa.cjs +16 -0
- package/.dist/cjs/.mion/types/Ky89_KDyf2Fa.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Ky89_L3mQkaR.cjs +13 -0
- package/.dist/cjs/.mion/types/Ky89_L3mQkaR.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Ky89_RAudOr2.cjs +13 -0
- package/.dist/cjs/.mion/types/Ky89_RAudOr2.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Ky89_TRnIbow.cjs +13 -0
- package/.dist/cjs/.mion/types/Ky89_TRnIbow.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Ky89_UOI3bXq.cjs +17 -0
- package/.dist/cjs/.mion/types/Ky89_UOI3bXq.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Ky89_ZTKzxQG.cjs +16 -0
- package/.dist/cjs/.mion/types/Ky89_ZTKzxQG.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Ky89_b4tYK8X.cjs +16 -0
- package/.dist/cjs/.mion/types/Ky89_b4tYK8X.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Ky89_deFq9zY.cjs +26 -0
- package/.dist/cjs/.mion/types/Ky89_deFq9zY.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Ky89_fMIJ1JT.cjs +13 -0
- package/.dist/cjs/.mion/types/Ky89_fMIJ1JT.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Ky89_g17turq.cjs +13 -0
- package/.dist/cjs/.mion/types/Ky89_g17turq.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Ky89_hqa3Nzs.cjs +14 -0
- package/.dist/cjs/.mion/types/Ky89_hqa3Nzs.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Ky89_iKPrxW9.cjs +16 -0
- package/.dist/cjs/.mion/types/Ky89_iKPrxW9.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Ky89_jLtJ5Kv.cjs +16 -0
- package/.dist/cjs/.mion/types/Ky89_jLtJ5Kv.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Ky89_kibOHkN.cjs +13 -0
- package/.dist/cjs/.mion/types/Ky89_kibOHkN.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Ky89_kz5ne4c.cjs +16 -0
- package/.dist/cjs/.mion/types/Ky89_kz5ne4c.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Ky89_pzBRrJb.cjs +16 -0
- package/.dist/cjs/.mion/types/Ky89_pzBRrJb.cjs.map +1 -0
- package/.dist/cjs/.mion/types/OBOg_D32xQCR.cjs +23 -0
- package/.dist/cjs/.mion/types/OBOg_D32xQCR.cjs.map +1 -0
- package/.dist/cjs/.mion/types/OBOg_D5PMNNO.cjs +18 -0
- package/.dist/cjs/.mion/types/OBOg_D5PMNNO.cjs.map +1 -0
- package/.dist/cjs/.mion/types/OBOg_E1CjDEA.cjs +18 -0
- package/.dist/cjs/.mion/types/OBOg_E1CjDEA.cjs.map +1 -0
- package/.dist/cjs/.mion/types/OBOg_G42dZdW.cjs +18 -0
- package/.dist/cjs/.mion/types/OBOg_G42dZdW.cjs.map +1 -0
- package/.dist/cjs/.mion/types/OBOg_LKYfhxm.cjs +18 -0
- package/.dist/cjs/.mion/types/OBOg_LKYfhxm.cjs.map +1 -0
- package/.dist/cjs/.mion/types/OBOg_fMIJ1JT.cjs +18 -0
- package/.dist/cjs/.mion/types/OBOg_fMIJ1JT.cjs.map +1 -0
- package/.dist/cjs/.mion/types/OBOg_g17turq.cjs +17 -0
- package/.dist/cjs/.mion/types/OBOg_g17turq.cjs.map +1 -0
- package/.dist/cjs/.mion/types/OBOg_hqa3Nzs.cjs +17 -0
- package/.dist/cjs/.mion/types/OBOg_hqa3Nzs.cjs.map +1 -0
- package/.dist/cjs/.mion/types/OBOg_kibOHkN.cjs +17 -0
- package/.dist/cjs/.mion/types/OBOg_kibOHkN.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Xhuv_D32xQCR.cjs +16 -0
- package/.dist/cjs/.mion/types/Xhuv_D32xQCR.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Xhuv_D5PMNNO.cjs +16 -0
- package/.dist/cjs/.mion/types/Xhuv_D5PMNNO.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Xhuv_E1CjDEA.cjs +29 -0
- package/.dist/cjs/.mion/types/Xhuv_E1CjDEA.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Xhuv_EYEglde.cjs +16 -0
- package/.dist/cjs/.mion/types/Xhuv_EYEglde.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Xhuv_EyHLuYw.cjs +16 -0
- package/.dist/cjs/.mion/types/Xhuv_EyHLuYw.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Xhuv_G42dZdW.cjs +16 -0
- package/.dist/cjs/.mion/types/Xhuv_G42dZdW.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Xhuv_HSE8icr.cjs +16 -0
- package/.dist/cjs/.mion/types/Xhuv_HSE8icr.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Xhuv_HXAy3Lx.cjs +13 -0
- package/.dist/cjs/.mion/types/Xhuv_HXAy3Lx.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Xhuv_JJrCj9i.cjs +13 -0
- package/.dist/cjs/.mion/types/Xhuv_JJrCj9i.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Xhuv_KDyf2Fa.cjs +16 -0
- package/.dist/cjs/.mion/types/Xhuv_KDyf2Fa.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Xhuv_L3mQkaR.cjs +13 -0
- package/.dist/cjs/.mion/types/Xhuv_L3mQkaR.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Xhuv_LKYfhxm.cjs +13 -0
- package/.dist/cjs/.mion/types/Xhuv_LKYfhxm.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Xhuv_RAudOr2.cjs +13 -0
- package/.dist/cjs/.mion/types/Xhuv_RAudOr2.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Xhuv_TRnIbow.cjs +17 -0
- package/.dist/cjs/.mion/types/Xhuv_TRnIbow.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Xhuv_UOI3bXq.cjs +17 -0
- package/.dist/cjs/.mion/types/Xhuv_UOI3bXq.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Xhuv_VsWxRKn.cjs +13 -0
- package/.dist/cjs/.mion/types/Xhuv_VsWxRKn.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Xhuv_ZTKzxQG.cjs +16 -0
- package/.dist/cjs/.mion/types/Xhuv_ZTKzxQG.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Xhuv_ZgsWs6s.cjs +13 -0
- package/.dist/cjs/.mion/types/Xhuv_ZgsWs6s.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Xhuv_b4tYK8X.cjs +16 -0
- package/.dist/cjs/.mion/types/Xhuv_b4tYK8X.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Xhuv_deFq9zY.cjs +26 -0
- package/.dist/cjs/.mion/types/Xhuv_deFq9zY.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Xhuv_fMIJ1JT.cjs +16 -0
- package/.dist/cjs/.mion/types/Xhuv_fMIJ1JT.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Xhuv_g17turq.cjs +13 -0
- package/.dist/cjs/.mion/types/Xhuv_g17turq.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Xhuv_hqa3Nzs.cjs +13 -0
- package/.dist/cjs/.mion/types/Xhuv_hqa3Nzs.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Xhuv_iKPrxW9.cjs +16 -0
- package/.dist/cjs/.mion/types/Xhuv_iKPrxW9.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Xhuv_jLtJ5Kv.cjs +16 -0
- package/.dist/cjs/.mion/types/Xhuv_jLtJ5Kv.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Xhuv_kibOHkN.cjs +13 -0
- package/.dist/cjs/.mion/types/Xhuv_kibOHkN.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Xhuv_kz5ne4c.cjs +16 -0
- package/.dist/cjs/.mion/types/Xhuv_kz5ne4c.cjs.map +1 -0
- package/.dist/cjs/.mion/types/Xhuv_pzBRrJb.cjs +16 -0
- package/.dist/cjs/.mion/types/Xhuv_pzBRrJb.cjs.map +1 -0
- package/.dist/cjs/.mion/types/mzca_fMIJ1JT.cjs +14 -0
- package/.dist/cjs/.mion/types/mzca_fMIJ1JT.cjs.map +1 -0
- package/.dist/cjs/.mion/types/mzca_hqa3Nzs.cjs +14 -0
- package/.dist/cjs/.mion/types/mzca_hqa3Nzs.cjs.map +1 -0
- package/.dist/cjs/.mion/types/mzca_kibOHkN.cjs +14 -0
- package/.dist/cjs/.mion/types/mzca_kibOHkN.cjs.map +1 -0
- package/.dist/cjs/.mion/types/pf/@mionjs/run-types/rXVwGkGDX08BsQ.cjs +14 -0
- package/.dist/cjs/.mion/types/pf/@mionjs/run-types/rXVwGkGDX08BsQ.cjs.map +1 -0
- package/.dist/cjs/.mion/types/pf/@mionjs/run-types/tfRjnFZVF8lqI_.cjs +14 -0
- package/.dist/cjs/.mion/types/pf/@mionjs/run-types/tfRjnFZVF8lqI_.cjs.map +1 -0
- package/.dist/cjs/.mion/types/rt/C7ezVBCtGn.cjs +498 -0
- package/.dist/cjs/.mion/types/rt/C7ezVBCtGn.cjs.map +1 -0
- package/.dist/cjs/.mion/types/rt/VIdAjpHu1X.cjs +526 -0
- package/.dist/cjs/.mion/types/rt/VIdAjpHu1X.cjs.map +1 -0
- package/.dist/cjs/.mion/types/rt/eF4wQzU6Fd.cjs +876 -0
- package/.dist/cjs/.mion/types/rt/eF4wQzU6Fd.cjs.map +1 -0
- package/.dist/cjs/.mion/types/rt/shared/JQEexHbHMp.cjs +467 -0
- package/.dist/cjs/.mion/types/rt/shared/JQEexHbHMp.cjs.map +1 -0
- package/.dist/cjs/.mion/types/rt/shared/connsmWgsp.cjs +1475 -0
- package/.dist/cjs/.mion/types/rt/shared/connsmWgsp.cjs.map +1 -0
- package/.dist/cjs/index.cjs +115 -153
- package/.dist/cjs/index.d.ts +5 -4
- package/.dist/cjs/middlewares.cjs +5 -0
- package/.dist/cjs/middlewares.d.ts +3 -0
- package/.dist/cjs/src/batches.cjs +332 -0
- package/.dist/cjs/src/batches.cjs.map +1 -0
- package/.dist/cjs/src/batches.d.ts +22 -0
- package/.dist/cjs/src/callContext.cjs +72 -116
- package/.dist/cjs/src/callContext.cjs.map +1 -1
- package/.dist/cjs/src/callContext.d.ts +5 -8
- package/.dist/cjs/src/constants.cjs +22 -41
- package/.dist/cjs/src/constants.cjs.map +1 -1
- package/.dist/cjs/src/constants.d.ts +1 -7
- package/.dist/cjs/src/dispatch.cjs +227 -129
- package/.dist/cjs/src/dispatch.cjs.map +1 -1
- package/.dist/cjs/src/dispatch.d.ts +8 -2
- package/.dist/cjs/src/lib/bodyLimit.cjs +37 -0
- package/.dist/cjs/src/lib/bodyLimit.cjs.map +1 -0
- package/.dist/cjs/src/lib/bodyLimit.d.ts +5 -0
- package/.dist/cjs/src/lib/bodyReader.cjs +79 -0
- package/.dist/cjs/src/lib/bodyReader.cjs.map +1 -0
- package/.dist/cjs/src/lib/bodyReader.d.ts +10 -0
- package/.dist/cjs/src/lib/dispatchError.cjs +77 -34
- package/.dist/cjs/src/lib/dispatchError.cjs.map +1 -1
- package/.dist/cjs/src/lib/dispatchError.d.ts +6 -2
- package/.dist/cjs/src/lib/handlers.cjs +91 -44
- package/.dist/cjs/src/lib/handlers.cjs.map +1 -1
- package/.dist/cjs/src/lib/handlers.d.ts +14 -9
- package/.dist/cjs/src/lib/headers.cjs +172 -55
- package/.dist/cjs/src/lib/headers.cjs.map +1 -1
- package/.dist/cjs/src/lib/headers.d.ts +40 -1
- package/.dist/cjs/src/lib/queryBody.cjs +25 -29
- package/.dist/cjs/src/lib/queryBody.cjs.map +1 -1
- package/.dist/cjs/src/lib/queryBody.d.ts +0 -1
- package/.dist/cjs/src/lib/reflection.cjs +78 -371
- package/.dist/cjs/src/lib/reflection.cjs.map +1 -1
- package/.dist/cjs/src/lib/reflection.d.ts +12 -9
- package/.dist/cjs/src/lib/remoteMethods.cjs +104 -104
- package/.dist/cjs/src/lib/remoteMethods.cjs.map +1 -1
- package/.dist/cjs/src/lib/remoteMethods.d.ts +4 -4
- package/.dist/cjs/src/lib/urlQuery.cjs +24 -0
- package/.dist/cjs/src/lib/urlQuery.cjs.map +1 -0
- package/.dist/cjs/src/lib/urlQuery.d.ts +2 -0
- package/.dist/cjs/src/middlewares/fetchMetadata.cjs +99 -0
- package/.dist/cjs/src/middlewares/fetchMetadata.cjs.map +1 -0
- package/.dist/cjs/src/middlewares/fetchMetadata.d.ts +15 -0
- package/.dist/cjs/src/middlewares/syncRoutes.cjs +67 -0
- package/.dist/cjs/src/middlewares/syncRoutes.cjs.map +1 -0
- package/.dist/cjs/src/middlewares/syncRoutes.d.ts +12 -0
- package/.dist/cjs/src/router.cjs +506 -432
- package/.dist/cjs/src/router.cjs.map +1 -1
- package/.dist/cjs/src/router.d.ts +27 -19
- package/.dist/cjs/src/routes/errors.routes.cjs +81 -46
- package/.dist/cjs/src/routes/errors.routes.cjs.map +1 -1
- package/.dist/cjs/src/routes/errors.routes.d.ts +14 -3
- package/.dist/cjs/src/routes/serializer.routes.cjs +107 -176
- package/.dist/cjs/src/routes/serializer.routes.cjs.map +1 -1
- package/.dist/cjs/src/routes/serializer.routes.d.ts +3 -3
- package/.dist/cjs/src/types/context.cjs +0 -31
- package/.dist/cjs/src/types/context.d.ts +13 -21
- package/.dist/cjs/src/types/definitions.cjs +0 -15
- package/.dist/cjs/src/types/definitions.d.ts +32 -20
- package/.dist/cjs/src/types/general.cjs +0 -14
- package/.dist/cjs/src/types/general.d.ts +15 -15
- package/.dist/cjs/src/types/guards.cjs +31 -38
- package/.dist/cjs/src/types/guards.cjs.map +1 -1
- package/.dist/cjs/src/types/guards.d.ts +7 -7
- package/.dist/cjs/src/types/handlers.cjs +0 -13
- package/.dist/cjs/src/types/handlers.d.ts +8 -5
- package/.dist/cjs/src/types/mionRouter.cjs +0 -0
- package/.dist/cjs/src/types/mionRouter.d.ts +44 -0
- package/.dist/cjs/src/types/parser.cjs +0 -0
- package/.dist/cjs/src/types/parser.d.ts +43 -0
- package/.dist/cjs/src/types/publicMethods.cjs +0 -24
- package/.dist/cjs/src/types/publicMethods.d.ts +65 -25
- package/.dist/cjs/src/types/remoteMethods.cjs +0 -25
- package/.dist/cjs/src/types/remoteMethods.d.ts +49 -29
- package/.dist/cjs/src/types/resolvedOptions.cjs +0 -0
- package/.dist/cjs/src/types/resolvedOptions.d.ts +28 -0
- package/.dist/esm/.mion/types/A0Qb_D32xQCR.js +16 -0
- package/.dist/esm/.mion/types/A0Qb_D32xQCR.js.map +1 -0
- package/.dist/esm/.mion/types/A0Qb_D5PMNNO.js +17 -0
- package/.dist/esm/.mion/types/A0Qb_D5PMNNO.js.map +1 -0
- package/.dist/esm/.mion/types/A0Qb_E1CjDEA.js +36 -0
- package/.dist/esm/.mion/types/A0Qb_E1CjDEA.js.map +1 -0
- package/.dist/esm/.mion/types/A0Qb_EYEglde.js +16 -0
- package/.dist/esm/.mion/types/A0Qb_EYEglde.js.map +1 -0
- package/.dist/esm/.mion/types/A0Qb_EyHLuYw.js +16 -0
- package/.dist/esm/.mion/types/A0Qb_EyHLuYw.js.map +1 -0
- package/.dist/esm/.mion/types/A0Qb_G42dZdW.js +16 -0
- package/.dist/esm/.mion/types/A0Qb_G42dZdW.js.map +1 -0
- package/.dist/esm/.mion/types/A0Qb_HSE8icr.js +16 -0
- package/.dist/esm/.mion/types/A0Qb_HSE8icr.js.map +1 -0
- package/.dist/esm/.mion/types/A0Qb_HXAy3Lx.js +13 -0
- package/.dist/esm/.mion/types/A0Qb_HXAy3Lx.js.map +1 -0
- package/.dist/esm/.mion/types/A0Qb_JJrCj9i.js +13 -0
- package/.dist/esm/.mion/types/A0Qb_JJrCj9i.js.map +1 -0
- package/.dist/esm/.mion/types/A0Qb_KDyf2Fa.js +16 -0
- package/.dist/esm/.mion/types/A0Qb_KDyf2Fa.js.map +1 -0
- package/.dist/esm/.mion/types/A0Qb_L3mQkaR.js +13 -0
- package/.dist/esm/.mion/types/A0Qb_L3mQkaR.js.map +1 -0
- package/.dist/esm/.mion/types/A0Qb_RAudOr2.js +13 -0
- package/.dist/esm/.mion/types/A0Qb_RAudOr2.js.map +1 -0
- package/.dist/esm/.mion/types/A0Qb_TRnIbow.js +17 -0
- package/.dist/esm/.mion/types/A0Qb_TRnIbow.js.map +1 -0
- package/.dist/esm/.mion/types/A0Qb_UOI3bXq.js +17 -0
- package/.dist/esm/.mion/types/A0Qb_UOI3bXq.js.map +1 -0
- package/.dist/esm/.mion/types/A0Qb_VsWxRKn.js +13 -0
- package/.dist/esm/.mion/types/A0Qb_VsWxRKn.js.map +1 -0
- package/.dist/esm/.mion/types/A0Qb_ZTKzxQG.js +16 -0
- package/.dist/esm/.mion/types/A0Qb_ZTKzxQG.js.map +1 -0
- package/.dist/esm/.mion/types/A0Qb_b4tYK8X.js +16 -0
- package/.dist/esm/.mion/types/A0Qb_b4tYK8X.js.map +1 -0
- package/.dist/esm/.mion/types/A0Qb_deFq9zY.js +26 -0
- package/.dist/esm/.mion/types/A0Qb_deFq9zY.js.map +1 -0
- package/.dist/esm/.mion/types/A0Qb_fMIJ1JT.js +14 -0
- package/.dist/esm/.mion/types/A0Qb_fMIJ1JT.js.map +1 -0
- package/.dist/esm/.mion/types/A0Qb_g17turq.js +13 -0
- package/.dist/esm/.mion/types/A0Qb_g17turq.js.map +1 -0
- package/.dist/esm/.mion/types/A0Qb_hqa3Nzs.js +14 -0
- package/.dist/esm/.mion/types/A0Qb_hqa3Nzs.js.map +1 -0
- package/.dist/esm/.mion/types/A0Qb_iKPrxW9.js +16 -0
- package/.dist/esm/.mion/types/A0Qb_iKPrxW9.js.map +1 -0
- package/.dist/esm/.mion/types/A0Qb_jLtJ5Kv.js +16 -0
- package/.dist/esm/.mion/types/A0Qb_jLtJ5Kv.js.map +1 -0
- package/.dist/esm/.mion/types/A0Qb_kibOHkN.js +14 -0
- package/.dist/esm/.mion/types/A0Qb_kibOHkN.js.map +1 -0
- package/.dist/esm/.mion/types/A0Qb_kz5ne4c.js +16 -0
- package/.dist/esm/.mion/types/A0Qb_kz5ne4c.js.map +1 -0
- package/.dist/esm/.mion/types/A0Qb_pzBRrJb.js +16 -0
- package/.dist/esm/.mion/types/A0Qb_pzBRrJb.js.map +1 -0
- package/.dist/esm/.mion/types/Eq2V_EYEglde.js +16 -0
- package/.dist/esm/.mion/types/Eq2V_EYEglde.js.map +1 -0
- package/.dist/esm/.mion/types/Eq2V_EyHLuYw.js +16 -0
- package/.dist/esm/.mion/types/Eq2V_EyHLuYw.js.map +1 -0
- package/.dist/esm/.mion/types/Eq2V_HSE8icr.js +16 -0
- package/.dist/esm/.mion/types/Eq2V_HSE8icr.js.map +1 -0
- package/.dist/esm/.mion/types/Eq2V_HXAy3Lx.js +13 -0
- package/.dist/esm/.mion/types/Eq2V_HXAy3Lx.js.map +1 -0
- package/.dist/esm/.mion/types/Eq2V_JJrCj9i.js +13 -0
- package/.dist/esm/.mion/types/Eq2V_JJrCj9i.js.map +1 -0
- package/.dist/esm/.mion/types/Eq2V_KDyf2Fa.js +16 -0
- package/.dist/esm/.mion/types/Eq2V_KDyf2Fa.js.map +1 -0
- package/.dist/esm/.mion/types/Eq2V_L3mQkaR.js +13 -0
- package/.dist/esm/.mion/types/Eq2V_L3mQkaR.js.map +1 -0
- package/.dist/esm/.mion/types/Eq2V_RAudOr2.js +13 -0
- package/.dist/esm/.mion/types/Eq2V_RAudOr2.js.map +1 -0
- package/.dist/esm/.mion/types/Eq2V_TRnIbow.js +17 -0
- package/.dist/esm/.mion/types/Eq2V_TRnIbow.js.map +1 -0
- package/.dist/esm/.mion/types/Eq2V_UOI3bXq.js +17 -0
- package/.dist/esm/.mion/types/Eq2V_UOI3bXq.js.map +1 -0
- package/.dist/esm/.mion/types/Eq2V_VsWxRKn.js +13 -0
- package/.dist/esm/.mion/types/Eq2V_VsWxRKn.js.map +1 -0
- package/.dist/esm/.mion/types/Eq2V_ZTKzxQG.js +16 -0
- package/.dist/esm/.mion/types/Eq2V_ZTKzxQG.js.map +1 -0
- package/.dist/esm/.mion/types/Eq2V_b4tYK8X.js +16 -0
- package/.dist/esm/.mion/types/Eq2V_b4tYK8X.js.map +1 -0
- package/.dist/esm/.mion/types/Eq2V_deFq9zY.js +26 -0
- package/.dist/esm/.mion/types/Eq2V_deFq9zY.js.map +1 -0
- package/.dist/esm/.mion/types/Eq2V_g17turq.js +13 -0
- package/.dist/esm/.mion/types/Eq2V_g17turq.js.map +1 -0
- package/.dist/esm/.mion/types/Eq2V_iKPrxW9.js +16 -0
- package/.dist/esm/.mion/types/Eq2V_iKPrxW9.js.map +1 -0
- package/.dist/esm/.mion/types/Eq2V_jLtJ5Kv.js +16 -0
- package/.dist/esm/.mion/types/Eq2V_jLtJ5Kv.js.map +1 -0
- package/.dist/esm/.mion/types/Eq2V_kz5ne4c.js +16 -0
- package/.dist/esm/.mion/types/Eq2V_kz5ne4c.js.map +1 -0
- package/.dist/esm/.mion/types/Eq2V_pzBRrJb.js +16 -0
- package/.dist/esm/.mion/types/Eq2V_pzBRrJb.js.map +1 -0
- package/.dist/esm/.mion/types/Ky89_D32xQCR.js +16 -0
- package/.dist/esm/.mion/types/Ky89_D32xQCR.js.map +1 -0
- package/.dist/esm/.mion/types/Ky89_D5PMNNO.js +16 -0
- package/.dist/esm/.mion/types/Ky89_D5PMNNO.js.map +1 -0
- package/.dist/esm/.mion/types/Ky89_E1CjDEA.js +32 -0
- package/.dist/esm/.mion/types/Ky89_E1CjDEA.js.map +1 -0
- package/.dist/esm/.mion/types/Ky89_EYEglde.js +16 -0
- package/.dist/esm/.mion/types/Ky89_EYEglde.js.map +1 -0
- package/.dist/esm/.mion/types/Ky89_EyHLuYw.js +16 -0
- package/.dist/esm/.mion/types/Ky89_EyHLuYw.js.map +1 -0
- package/.dist/esm/.mion/types/Ky89_G42dZdW.js +16 -0
- package/.dist/esm/.mion/types/Ky89_G42dZdW.js.map +1 -0
- package/.dist/esm/.mion/types/Ky89_HSE8icr.js +16 -0
- package/.dist/esm/.mion/types/Ky89_HSE8icr.js.map +1 -0
- package/.dist/esm/.mion/types/Ky89_JJrCj9i.js +13 -0
- package/.dist/esm/.mion/types/Ky89_JJrCj9i.js.map +1 -0
- package/.dist/esm/.mion/types/Ky89_KDyf2Fa.js +16 -0
- package/.dist/esm/.mion/types/Ky89_KDyf2Fa.js.map +1 -0
- package/.dist/esm/.mion/types/Ky89_L3mQkaR.js +13 -0
- package/.dist/esm/.mion/types/Ky89_L3mQkaR.js.map +1 -0
- package/.dist/esm/.mion/types/Ky89_RAudOr2.js +13 -0
- package/.dist/esm/.mion/types/Ky89_RAudOr2.js.map +1 -0
- package/.dist/esm/.mion/types/Ky89_TRnIbow.js +13 -0
- package/.dist/esm/.mion/types/Ky89_TRnIbow.js.map +1 -0
- package/.dist/esm/.mion/types/Ky89_UOI3bXq.js +17 -0
- package/.dist/esm/.mion/types/Ky89_UOI3bXq.js.map +1 -0
- package/.dist/esm/.mion/types/Ky89_ZTKzxQG.js +16 -0
- package/.dist/esm/.mion/types/Ky89_ZTKzxQG.js.map +1 -0
- package/.dist/esm/.mion/types/Ky89_b4tYK8X.js +16 -0
- package/.dist/esm/.mion/types/Ky89_b4tYK8X.js.map +1 -0
- package/.dist/esm/.mion/types/Ky89_deFq9zY.js +26 -0
- package/.dist/esm/.mion/types/Ky89_deFq9zY.js.map +1 -0
- package/.dist/esm/.mion/types/Ky89_fMIJ1JT.js +13 -0
- package/.dist/esm/.mion/types/Ky89_fMIJ1JT.js.map +1 -0
- package/.dist/esm/.mion/types/Ky89_g17turq.js +13 -0
- package/.dist/esm/.mion/types/Ky89_g17turq.js.map +1 -0
- package/.dist/esm/.mion/types/Ky89_hqa3Nzs.js +14 -0
- package/.dist/esm/.mion/types/Ky89_hqa3Nzs.js.map +1 -0
- package/.dist/esm/.mion/types/Ky89_iKPrxW9.js +16 -0
- package/.dist/esm/.mion/types/Ky89_iKPrxW9.js.map +1 -0
- package/.dist/esm/.mion/types/Ky89_jLtJ5Kv.js +16 -0
- package/.dist/esm/.mion/types/Ky89_jLtJ5Kv.js.map +1 -0
- package/.dist/esm/.mion/types/Ky89_kibOHkN.js +13 -0
- package/.dist/esm/.mion/types/Ky89_kibOHkN.js.map +1 -0
- package/.dist/esm/.mion/types/Ky89_kz5ne4c.js +16 -0
- package/.dist/esm/.mion/types/Ky89_kz5ne4c.js.map +1 -0
- package/.dist/esm/.mion/types/Ky89_pzBRrJb.js +16 -0
- package/.dist/esm/.mion/types/Ky89_pzBRrJb.js.map +1 -0
- package/.dist/esm/.mion/types/OBOg_D32xQCR.js +23 -0
- package/.dist/esm/.mion/types/OBOg_D32xQCR.js.map +1 -0
- package/.dist/esm/.mion/types/OBOg_D5PMNNO.js +18 -0
- package/.dist/esm/.mion/types/OBOg_D5PMNNO.js.map +1 -0
- package/.dist/esm/.mion/types/OBOg_E1CjDEA.js +18 -0
- package/.dist/esm/.mion/types/OBOg_E1CjDEA.js.map +1 -0
- package/.dist/esm/.mion/types/OBOg_G42dZdW.js +18 -0
- package/.dist/esm/.mion/types/OBOg_G42dZdW.js.map +1 -0
- package/.dist/esm/.mion/types/OBOg_LKYfhxm.js +18 -0
- package/.dist/esm/.mion/types/OBOg_LKYfhxm.js.map +1 -0
- package/.dist/esm/.mion/types/OBOg_fMIJ1JT.js +18 -0
- package/.dist/esm/.mion/types/OBOg_fMIJ1JT.js.map +1 -0
- package/.dist/esm/.mion/types/OBOg_g17turq.js +17 -0
- package/.dist/esm/.mion/types/OBOg_g17turq.js.map +1 -0
- package/.dist/esm/.mion/types/OBOg_hqa3Nzs.js +17 -0
- package/.dist/esm/.mion/types/OBOg_hqa3Nzs.js.map +1 -0
- package/.dist/esm/.mion/types/OBOg_kibOHkN.js +17 -0
- package/.dist/esm/.mion/types/OBOg_kibOHkN.js.map +1 -0
- package/.dist/esm/.mion/types/Xhuv_D32xQCR.js +16 -0
- package/.dist/esm/.mion/types/Xhuv_D32xQCR.js.map +1 -0
- package/.dist/esm/.mion/types/Xhuv_D5PMNNO.js +16 -0
- package/.dist/esm/.mion/types/Xhuv_D5PMNNO.js.map +1 -0
- package/.dist/esm/.mion/types/Xhuv_E1CjDEA.js +29 -0
- package/.dist/esm/.mion/types/Xhuv_E1CjDEA.js.map +1 -0
- package/.dist/esm/.mion/types/Xhuv_EYEglde.js +16 -0
- package/.dist/esm/.mion/types/Xhuv_EYEglde.js.map +1 -0
- package/.dist/esm/.mion/types/Xhuv_EyHLuYw.js +16 -0
- package/.dist/esm/.mion/types/Xhuv_EyHLuYw.js.map +1 -0
- package/.dist/esm/.mion/types/Xhuv_G42dZdW.js +16 -0
- package/.dist/esm/.mion/types/Xhuv_G42dZdW.js.map +1 -0
- package/.dist/esm/.mion/types/Xhuv_HSE8icr.js +16 -0
- package/.dist/esm/.mion/types/Xhuv_HSE8icr.js.map +1 -0
- package/.dist/esm/.mion/types/Xhuv_HXAy3Lx.js +13 -0
- package/.dist/esm/.mion/types/Xhuv_HXAy3Lx.js.map +1 -0
- package/.dist/esm/.mion/types/Xhuv_JJrCj9i.js +13 -0
- package/.dist/esm/.mion/types/Xhuv_JJrCj9i.js.map +1 -0
- package/.dist/esm/.mion/types/Xhuv_KDyf2Fa.js +16 -0
- package/.dist/esm/.mion/types/Xhuv_KDyf2Fa.js.map +1 -0
- package/.dist/esm/.mion/types/Xhuv_L3mQkaR.js +13 -0
- package/.dist/esm/.mion/types/Xhuv_L3mQkaR.js.map +1 -0
- package/.dist/esm/.mion/types/Xhuv_LKYfhxm.js +13 -0
- package/.dist/esm/.mion/types/Xhuv_LKYfhxm.js.map +1 -0
- package/.dist/esm/.mion/types/Xhuv_RAudOr2.js +13 -0
- package/.dist/esm/.mion/types/Xhuv_RAudOr2.js.map +1 -0
- package/.dist/esm/.mion/types/Xhuv_TRnIbow.js +17 -0
- package/.dist/esm/.mion/types/Xhuv_TRnIbow.js.map +1 -0
- package/.dist/esm/.mion/types/Xhuv_UOI3bXq.js +17 -0
- package/.dist/esm/.mion/types/Xhuv_UOI3bXq.js.map +1 -0
- package/.dist/esm/.mion/types/Xhuv_VsWxRKn.js +13 -0
- package/.dist/esm/.mion/types/Xhuv_VsWxRKn.js.map +1 -0
- package/.dist/esm/.mion/types/Xhuv_ZTKzxQG.js +16 -0
- package/.dist/esm/.mion/types/Xhuv_ZTKzxQG.js.map +1 -0
- package/.dist/esm/.mion/types/Xhuv_ZgsWs6s.js +13 -0
- package/.dist/esm/.mion/types/Xhuv_ZgsWs6s.js.map +1 -0
- package/.dist/esm/.mion/types/Xhuv_b4tYK8X.js +16 -0
- package/.dist/esm/.mion/types/Xhuv_b4tYK8X.js.map +1 -0
- package/.dist/esm/.mion/types/Xhuv_deFq9zY.js +26 -0
- package/.dist/esm/.mion/types/Xhuv_deFq9zY.js.map +1 -0
- package/.dist/esm/.mion/types/Xhuv_fMIJ1JT.js +16 -0
- package/.dist/esm/.mion/types/Xhuv_fMIJ1JT.js.map +1 -0
- package/.dist/esm/.mion/types/Xhuv_g17turq.js +13 -0
- package/.dist/esm/.mion/types/Xhuv_g17turq.js.map +1 -0
- package/.dist/esm/.mion/types/Xhuv_hqa3Nzs.js +13 -0
- package/.dist/esm/.mion/types/Xhuv_hqa3Nzs.js.map +1 -0
- package/.dist/esm/.mion/types/Xhuv_iKPrxW9.js +16 -0
- package/.dist/esm/.mion/types/Xhuv_iKPrxW9.js.map +1 -0
- package/.dist/esm/.mion/types/Xhuv_jLtJ5Kv.js +16 -0
- package/.dist/esm/.mion/types/Xhuv_jLtJ5Kv.js.map +1 -0
- package/.dist/esm/.mion/types/Xhuv_kibOHkN.js +13 -0
- package/.dist/esm/.mion/types/Xhuv_kibOHkN.js.map +1 -0
- package/.dist/esm/.mion/types/Xhuv_kz5ne4c.js +16 -0
- package/.dist/esm/.mion/types/Xhuv_kz5ne4c.js.map +1 -0
- package/.dist/esm/.mion/types/Xhuv_pzBRrJb.js +16 -0
- package/.dist/esm/.mion/types/Xhuv_pzBRrJb.js.map +1 -0
- package/.dist/esm/.mion/types/mzca_fMIJ1JT.js +14 -0
- package/.dist/esm/.mion/types/mzca_fMIJ1JT.js.map +1 -0
- package/.dist/esm/.mion/types/mzca_hqa3Nzs.js +14 -0
- package/.dist/esm/.mion/types/mzca_hqa3Nzs.js.map +1 -0
- package/.dist/esm/.mion/types/mzca_kibOHkN.js +14 -0
- package/.dist/esm/.mion/types/mzca_kibOHkN.js.map +1 -0
- package/.dist/esm/.mion/types/pf/@mionjs/run-types/rXVwGkGDX08BsQ.js +14 -0
- package/.dist/esm/.mion/types/pf/@mionjs/run-types/rXVwGkGDX08BsQ.js.map +1 -0
- package/.dist/esm/.mion/types/pf/@mionjs/run-types/tfRjnFZVF8lqI_.js +14 -0
- package/.dist/esm/.mion/types/pf/@mionjs/run-types/tfRjnFZVF8lqI_.js.map +1 -0
- package/.dist/esm/.mion/types/rt/C7ezVBCtGn.js +495 -0
- package/.dist/esm/.mion/types/rt/C7ezVBCtGn.js.map +1 -0
- package/.dist/esm/.mion/types/rt/VIdAjpHu1X.js +521 -0
- package/.dist/esm/.mion/types/rt/VIdAjpHu1X.js.map +1 -0
- package/.dist/esm/.mion/types/rt/eF4wQzU6Fd.js +873 -0
- package/.dist/esm/.mion/types/rt/eF4wQzU6Fd.js.map +1 -0
- package/.dist/esm/.mion/types/rt/shared/JQEexHbHMp.js +467 -0
- package/.dist/esm/.mion/types/rt/shared/JQEexHbHMp.js.map +1 -0
- package/.dist/esm/.mion/types/rt/shared/connsmWgsp.js +1475 -0
- package/.dist/esm/.mion/types/rt/shared/connsmWgsp.js.map +1 -0
- package/.dist/esm/index.d.ts +5 -4
- package/.dist/esm/index.js +11 -145
- package/.dist/esm/middlewares.d.ts +3 -0
- package/.dist/esm/middlewares.js +3 -0
- package/.dist/esm/src/batches.d.ts +22 -0
- package/.dist/esm/src/batches.js +321 -0
- package/.dist/esm/src/batches.js.map +1 -0
- package/.dist/esm/src/callContext.d.ts +5 -8
- package/.dist/esm/src/callContext.js +70 -118
- package/.dist/esm/src/callContext.js.map +1 -1
- package/.dist/esm/src/constants.d.ts +1 -7
- package/.dist/esm/src/constants.js +22 -44
- package/.dist/esm/src/constants.js.map +1 -1
- package/.dist/esm/src/dispatch.d.ts +8 -2
- package/.dist/esm/src/dispatch.js +223 -131
- package/.dist/esm/src/dispatch.js.map +1 -1
- package/.dist/esm/src/lib/bodyLimit.d.ts +5 -0
- package/.dist/esm/src/lib/bodyLimit.js +35 -0
- package/.dist/esm/src/lib/bodyLimit.js.map +1 -0
- package/.dist/esm/src/lib/bodyReader.d.ts +10 -0
- package/.dist/esm/src/lib/bodyReader.js +76 -0
- package/.dist/esm/src/lib/bodyReader.js.map +1 -0
- package/.dist/esm/src/lib/dispatchError.d.ts +6 -2
- package/.dist/esm/src/lib/dispatchError.js +72 -36
- package/.dist/esm/src/lib/dispatchError.js.map +1 -1
- package/.dist/esm/src/lib/handlers.d.ts +14 -9
- package/.dist/esm/src/lib/handlers.js +85 -48
- package/.dist/esm/src/lib/handlers.js.map +1 -1
- package/.dist/esm/src/lib/headers.d.ts +40 -1
- package/.dist/esm/src/lib/headers.js +167 -57
- package/.dist/esm/src/lib/headers.js.map +1 -1
- package/.dist/esm/src/lib/queryBody.d.ts +0 -1
- package/.dist/esm/src/lib/queryBody.js +26 -31
- package/.dist/esm/src/lib/queryBody.js.map +1 -1
- package/.dist/esm/src/lib/reflection.d.ts +12 -9
- package/.dist/esm/src/lib/reflection.js +75 -351
- package/.dist/esm/src/lib/reflection.js.map +1 -1
- package/.dist/esm/src/lib/remoteMethods.d.ts +4 -4
- package/.dist/esm/src/lib/remoteMethods.js +105 -111
- package/.dist/esm/src/lib/remoteMethods.js.map +1 -1
- package/.dist/esm/src/lib/urlQuery.d.ts +2 -0
- package/.dist/esm/src/lib/urlQuery.js +23 -0
- package/.dist/esm/src/lib/urlQuery.js.map +1 -0
- package/.dist/esm/src/middlewares/fetchMetadata.d.ts +15 -0
- package/.dist/esm/src/middlewares/fetchMetadata.js +97 -0
- package/.dist/esm/src/middlewares/fetchMetadata.js.map +1 -0
- package/.dist/esm/src/middlewares/syncRoutes.d.ts +12 -0
- package/.dist/esm/src/middlewares/syncRoutes.js +66 -0
- package/.dist/esm/src/middlewares/syncRoutes.js.map +1 -0
- package/.dist/esm/src/router.d.ts +27 -19
- package/.dist/esm/src/router.js +477 -449
- package/.dist/esm/src/router.js.map +1 -1
- package/.dist/esm/src/routes/errors.routes.d.ts +14 -3
- package/.dist/esm/src/routes/errors.routes.js +80 -48
- package/.dist/esm/src/routes/errors.routes.js.map +1 -1
- package/.dist/esm/src/routes/serializer.routes.d.ts +3 -3
- package/.dist/esm/src/routes/serializer.routes.js +107 -179
- package/.dist/esm/src/routes/serializer.routes.js.map +1 -1
- package/.dist/esm/src/types/context.d.ts +13 -21
- package/.dist/esm/src/types/context.js +0 -31
- package/.dist/esm/src/types/definitions.d.ts +32 -20
- package/.dist/esm/src/types/definitions.js +0 -15
- package/.dist/esm/src/types/general.d.ts +15 -15
- package/.dist/esm/src/types/general.js +0 -14
- package/.dist/esm/src/types/guards.d.ts +7 -7
- package/.dist/esm/src/types/guards.js +27 -46
- package/.dist/esm/src/types/guards.js.map +1 -1
- package/.dist/esm/src/types/handlers.d.ts +8 -5
- package/.dist/esm/src/types/handlers.js +0 -13
- package/.dist/esm/src/types/mionRouter.d.ts +44 -0
- package/.dist/esm/src/types/mionRouter.js +0 -0
- package/.dist/esm/src/types/parser.d.ts +43 -0
- package/.dist/esm/src/types/parser.js +0 -0
- package/.dist/esm/src/types/publicMethods.d.ts +65 -25
- package/.dist/esm/src/types/publicMethods.js +0 -24
- package/.dist/esm/src/types/remoteMethods.d.ts +49 -29
- package/.dist/esm/src/types/remoteMethods.js +0 -25
- package/.dist/esm/src/types/resolvedOptions.d.ts +28 -0
- package/.dist/esm/src/types/resolvedOptions.js +0 -0
- package/LICENSE +1 -1
- package/README.md +6 -6
- package/package.json +21 -24
- package/.dist/cjs/index.cjs.map +0 -1
- package/.dist/cjs/index.d.ts.map +0 -1
- package/.dist/cjs/src/aot/aotCacheLoader.cjs +0 -11
- package/.dist/cjs/src/aot/aotCacheLoader.cjs.map +0 -1
- package/.dist/cjs/src/aot/aotCacheLoader.d.ts +0 -2
- package/.dist/cjs/src/aot/aotCacheLoader.d.ts.map +0 -1
- package/.dist/cjs/src/callContext.d.ts.map +0 -1
- package/.dist/cjs/src/constants.d.ts.map +0 -1
- package/.dist/cjs/src/defaultRoutes.cjs +0 -16
- package/.dist/cjs/src/defaultRoutes.cjs.map +0 -1
- package/.dist/cjs/src/defaultRoutes.d.ts +0 -4
- package/.dist/cjs/src/defaultRoutes.d.ts.map +0 -1
- package/.dist/cjs/src/dispatch.d.ts.map +0 -1
- package/.dist/cjs/src/lib/aotEmitter.cjs +0 -74
- package/.dist/cjs/src/lib/aotEmitter.cjs.map +0 -1
- package/.dist/cjs/src/lib/aotEmitter.d.ts +0 -24
- package/.dist/cjs/src/lib/aotEmitter.d.ts.map +0 -1
- package/.dist/cjs/src/lib/dispatchError.d.ts.map +0 -1
- package/.dist/cjs/src/lib/handlers.d.ts.map +0 -1
- package/.dist/cjs/src/lib/headers.d.ts.map +0 -1
- package/.dist/cjs/src/lib/methodsCache.cjs +0 -55
- package/.dist/cjs/src/lib/methodsCache.cjs.map +0 -1
- package/.dist/cjs/src/lib/methodsCache.d.ts +0 -12
- package/.dist/cjs/src/lib/methodsCache.d.ts.map +0 -1
- package/.dist/cjs/src/lib/queryBody.d.ts.map +0 -1
- package/.dist/cjs/src/lib/reflection.d.ts.map +0 -1
- package/.dist/cjs/src/lib/remoteMethods.d.ts.map +0 -1
- package/.dist/cjs/src/lib/test/aotEmitter-test-router.cjs +0 -24
- package/.dist/cjs/src/lib/test/aotEmitter-test-router.cjs.map +0 -1
- package/.dist/cjs/src/lib/test/aotEmitter-test-router.d.ts +0 -5
- package/.dist/cjs/src/lib/test/aotEmitter-test-router.d.ts.map +0 -1
- package/.dist/cjs/src/router.d.ts.map +0 -1
- package/.dist/cjs/src/routes/client.routes.cjs +0 -76
- package/.dist/cjs/src/routes/client.routes.cjs.map +0 -1
- package/.dist/cjs/src/routes/client.routes.d.ts +0 -20
- package/.dist/cjs/src/routes/client.routes.d.ts.map +0 -1
- package/.dist/cjs/src/routes/errors.routes.d.ts.map +0 -1
- package/.dist/cjs/src/routes/mion.routes.cjs +0 -13
- package/.dist/cjs/src/routes/mion.routes.cjs.map +0 -1
- package/.dist/cjs/src/routes/mion.routes.d.ts +0 -10
- package/.dist/cjs/src/routes/mion.routes.d.ts.map +0 -1
- package/.dist/cjs/src/routes/serializer.routes.d.ts.map +0 -1
- package/.dist/cjs/src/routesFlow.cjs +0 -227
- package/.dist/cjs/src/routesFlow.cjs.map +0 -1
- package/.dist/cjs/src/routesFlow.d.ts +0 -8
- package/.dist/cjs/src/routesFlow.d.ts.map +0 -1
- package/.dist/cjs/src/types/context.cjs.map +0 -1
- package/.dist/cjs/src/types/context.d.ts.map +0 -1
- package/.dist/cjs/src/types/definitions.cjs.map +0 -1
- package/.dist/cjs/src/types/definitions.d.ts.map +0 -1
- package/.dist/cjs/src/types/general.cjs.map +0 -1
- package/.dist/cjs/src/types/general.d.ts.map +0 -1
- package/.dist/cjs/src/types/guards.d.ts.map +0 -1
- package/.dist/cjs/src/types/handlers.cjs.map +0 -1
- package/.dist/cjs/src/types/handlers.d.ts.map +0 -1
- package/.dist/cjs/src/types/publicMethods.cjs.map +0 -1
- package/.dist/cjs/src/types/publicMethods.d.ts.map +0 -1
- package/.dist/cjs/src/types/remoteMethods.cjs.map +0 -1
- package/.dist/cjs/src/types/remoteMethods.d.ts.map +0 -1
- package/.dist/esm/index.d.ts.map +0 -1
- package/.dist/esm/index.js.map +0 -1
- package/.dist/esm/src/aot/aotCacheLoader.d.ts +0 -2
- package/.dist/esm/src/aot/aotCacheLoader.d.ts.map +0 -1
- package/.dist/esm/src/aot/aotCacheLoader.js +0 -11
- package/.dist/esm/src/aot/aotCacheLoader.js.map +0 -1
- package/.dist/esm/src/callContext.d.ts.map +0 -1
- package/.dist/esm/src/constants.d.ts.map +0 -1
- package/.dist/esm/src/defaultRoutes.d.ts +0 -4
- package/.dist/esm/src/defaultRoutes.d.ts.map +0 -1
- package/.dist/esm/src/defaultRoutes.js +0 -16
- package/.dist/esm/src/defaultRoutes.js.map +0 -1
- package/.dist/esm/src/dispatch.d.ts.map +0 -1
- package/.dist/esm/src/lib/aotEmitter.d.ts +0 -24
- package/.dist/esm/src/lib/aotEmitter.d.ts.map +0 -1
- package/.dist/esm/src/lib/aotEmitter.js +0 -74
- package/.dist/esm/src/lib/aotEmitter.js.map +0 -1
- package/.dist/esm/src/lib/dispatchError.d.ts.map +0 -1
- package/.dist/esm/src/lib/handlers.d.ts.map +0 -1
- package/.dist/esm/src/lib/headers.d.ts.map +0 -1
- package/.dist/esm/src/lib/methodsCache.d.ts +0 -12
- package/.dist/esm/src/lib/methodsCache.d.ts.map +0 -1
- package/.dist/esm/src/lib/methodsCache.js +0 -56
- package/.dist/esm/src/lib/methodsCache.js.map +0 -1
- package/.dist/esm/src/lib/queryBody.d.ts.map +0 -1
- package/.dist/esm/src/lib/reflection.d.ts.map +0 -1
- package/.dist/esm/src/lib/remoteMethods.d.ts.map +0 -1
- package/.dist/esm/src/lib/test/aotEmitter-test-router.d.ts +0 -5
- package/.dist/esm/src/lib/test/aotEmitter-test-router.d.ts.map +0 -1
- package/.dist/esm/src/lib/test/aotEmitter-test-router.js +0 -24
- package/.dist/esm/src/lib/test/aotEmitter-test-router.js.map +0 -1
- package/.dist/esm/src/router.d.ts.map +0 -1
- package/.dist/esm/src/routes/client.routes.d.ts +0 -20
- package/.dist/esm/src/routes/client.routes.d.ts.map +0 -1
- package/.dist/esm/src/routes/client.routes.js +0 -76
- package/.dist/esm/src/routes/client.routes.js.map +0 -1
- package/.dist/esm/src/routes/errors.routes.d.ts.map +0 -1
- package/.dist/esm/src/routes/mion.routes.d.ts +0 -10
- package/.dist/esm/src/routes/mion.routes.d.ts.map +0 -1
- package/.dist/esm/src/routes/mion.routes.js +0 -13
- package/.dist/esm/src/routes/mion.routes.js.map +0 -1
- package/.dist/esm/src/routes/serializer.routes.d.ts.map +0 -1
- package/.dist/esm/src/routesFlow.d.ts +0 -8
- package/.dist/esm/src/routesFlow.d.ts.map +0 -1
- package/.dist/esm/src/routesFlow.js +0 -227
- package/.dist/esm/src/routesFlow.js.map +0 -1
- package/.dist/esm/src/types/context.d.ts.map +0 -1
- package/.dist/esm/src/types/context.js.map +0 -1
- package/.dist/esm/src/types/definitions.d.ts.map +0 -1
- package/.dist/esm/src/types/definitions.js.map +0 -1
- package/.dist/esm/src/types/general.d.ts.map +0 -1
- package/.dist/esm/src/types/general.js.map +0 -1
- package/.dist/esm/src/types/guards.d.ts.map +0 -1
- package/.dist/esm/src/types/handlers.d.ts.map +0 -1
- package/.dist/esm/src/types/handlers.js.map +0 -1
- package/.dist/esm/src/types/publicMethods.d.ts.map +0 -1
- package/.dist/esm/src/types/publicMethods.js.map +0 -1
- package/.dist/esm/src/types/remoteMethods.d.ts.map +0 -1
- package/.dist/esm/src/types/remoteMethods.js.map +0 -1
- package/index.ts +0 -29
- package/src/aot/aotCacheLoader.ts +0 -15
- package/src/callContext.ts +0 -193
- package/src/constants.ts +0 -45
- package/src/defaultRoutes.ts +0 -37
- package/src/dispatch.ts +0 -204
- package/src/lib/aotEmitter.ts +0 -140
- package/src/lib/dispatchError.ts +0 -60
- package/src/lib/handlers.ts +0 -75
- package/src/lib/headers.ts +0 -102
- package/src/lib/methodsCache.ts +0 -72
- package/src/lib/queryBody.ts +0 -40
- package/src/lib/reflection.ts +0 -517
- package/src/lib/remoteMethods.ts +0 -180
- package/src/lib/test/aotEmitter-test-router.ts +0 -40
- package/src/router.ts +0 -656
- package/src/routes/client.routes.ts +0 -108
- package/src/routes/errors.routes.ts +0 -51
- package/src/routes/mion.routes.ts +0 -11
- package/src/routes/serializer.routes.ts +0 -225
- package/src/routesFlow.ts +0 -320
- package/src/types/context.ts +0 -119
- package/src/types/definitions.ts +0 -53
- package/src/types/general.ts +0 -84
- package/src/types/guards.ts +0 -71
- package/src/types/handlers.ts +0 -49
- package/src/types/publicMethods.ts +0 -83
- package/src/types/remoteMethods.ts +0 -54
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_src_lib_dispatchError = require("./lib/dispatchError.cjs");
|
|
3
|
+
const require_src_lib_urlQuery = require("./lib/urlQuery.cjs");
|
|
4
|
+
const require_src_dispatch = require("./dispatch.cjs");
|
|
5
|
+
const require_src_router = require("./router.cjs");
|
|
6
|
+
let _mionjs_core = require("@mionjs/core");
|
|
7
|
+
//#region src/batches.ts
|
|
8
|
+
var batchesById = (0, _mionjs_core.getOrCreateGlobal)("mion.router.batchesById", () => /* @__PURE__ */ new Map());
|
|
9
|
+
var mappingMethodCache = (0, _mionjs_core.getOrCreateGlobal)("mion.router.batchMappingMethodCache", () => /* @__PURE__ */ new Map());
|
|
10
|
+
/** A malformed definition is a configuration error and throws at registration, never at request time.
|
|
11
|
+
* Re-registering an id replaces it; ids not in `table` are left alone (replaceBatches is the whole-table form). */
|
|
12
|
+
function registerBatches(table) {
|
|
13
|
+
for (const [id, definition] of Object.entries(table)) {
|
|
14
|
+
assertValidBatchDefinition(id, definition);
|
|
15
|
+
batchesById.set(id, {
|
|
16
|
+
id,
|
|
17
|
+
routes: [...definition.routes],
|
|
18
|
+
mappings: definition.mappings ? definition.mappings.map((mapping) => ({ ...mapping })) : [],
|
|
19
|
+
chains: /* @__PURE__ */ new Map()
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/** Replaces the WHOLE table. What the generated `.mion/rpc/batches.generated.js` calls, so every
|
|
24
|
+
* evaluation of it leaves exactly that file's batches registered and nothing from before. */
|
|
25
|
+
function replaceBatches(table) {
|
|
26
|
+
clearBatches();
|
|
27
|
+
registerBatches(table);
|
|
28
|
+
}
|
|
29
|
+
/** The table is build-generated, so this only guards against a stale or hand-edited manifest. */
|
|
30
|
+
function assertValidBatchDefinition(id, definition) {
|
|
31
|
+
const invalid = (reason) => {
|
|
32
|
+
throw new Error(`[mion batches] batch '${id}' is malformed: ${reason}.`);
|
|
33
|
+
};
|
|
34
|
+
if (!id) invalid("empty id");
|
|
35
|
+
if (!definition || typeof definition !== "object") invalid("expected an object");
|
|
36
|
+
if (!Array.isArray(definition.routes) || definition.routes.length === 0) invalid("`routes` must be a non-empty array");
|
|
37
|
+
if (definition.routes.some((route) => typeof route !== "string" || !route)) invalid("`routes` must be route ids");
|
|
38
|
+
if (definition.mappings === void 0) return;
|
|
39
|
+
if (!Array.isArray(definition.mappings)) invalid("`mappings` must be an array");
|
|
40
|
+
for (const mapping of definition.mappings) {
|
|
41
|
+
if (!mapping || typeof mapping !== "object") invalid("every mapping must be an object");
|
|
42
|
+
const { fromId, toId, mapperKey, paramIndex } = mapping;
|
|
43
|
+
if (typeof fromId !== "string" || typeof toId !== "string" || typeof mapperKey !== "string") invalid("mapping `fromId`, `toId` and `mapperKey` must be strings");
|
|
44
|
+
if (!definition.routes.includes(fromId)) invalid(`mapping source '${fromId}' is not a route of the batch`);
|
|
45
|
+
if (!definition.routes.includes(toId)) invalid(`mapping target '${toId}' is not a route of the batch`);
|
|
46
|
+
if (typeof paramIndex !== "number" || !Number.isInteger(paramIndex) || paramIndex < 0) invalid("mapping `paramIndex` must be a non-negative integer");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function getBatch(id) {
|
|
50
|
+
return batchesById.get(id);
|
|
51
|
+
}
|
|
52
|
+
/** Ids of every registered batch, for the metadata route. */
|
|
53
|
+
function getBatchIds() {
|
|
54
|
+
return [...batchesById.keys()];
|
|
55
|
+
}
|
|
56
|
+
/** Called by resetRouter and replaceBatches. */
|
|
57
|
+
function clearBatches() {
|
|
58
|
+
batchesById.clear();
|
|
59
|
+
mappingMethodCache.clear();
|
|
60
|
+
}
|
|
61
|
+
/** The member routes' resolved limits (each already carries its factor and envelope, or the platform's
|
|
62
|
+
* number when its types cannot say) plus the outer braces, fixed the first time a chain is built. */
|
|
63
|
+
function resolveBatchMaxBodySize(entry, memberChains) {
|
|
64
|
+
if (entry.maxBodySize === void 0) entry.maxBodySize = sumChainMaxBodySize(memberChains);
|
|
65
|
+
return entry.maxBodySize;
|
|
66
|
+
}
|
|
67
|
+
function sumChainMaxBodySize(chains) {
|
|
68
|
+
let total = 2;
|
|
69
|
+
for (const chain of chains) total += chain.maxBodySize;
|
|
70
|
+
return Math.min(total, require_src_router.getPlatformRequestCap() ?? Infinity);
|
|
71
|
+
}
|
|
72
|
+
/** The limits not yet settled read the platform ceiling when they are. */
|
|
73
|
+
function capBatchBodySizes(maxRequestSize) {
|
|
74
|
+
for (const entry of batchesById.values()) if (entry.maxBodySize !== void 0 && entry.maxBodySize > maxRequestSize) entry.maxBodySize = maxRequestSize;
|
|
75
|
+
}
|
|
76
|
+
/** Re-folds every ALREADY built chain from its entry's current number: without it a chain built before
|
|
77
|
+
* a later setPlatformConfig keeps serving a limit the platform has since promised to refuse. */
|
|
78
|
+
function refreshBatchChainBodyLimits(platformMaxBodySize) {
|
|
79
|
+
for (const entry of batchesById.values()) {
|
|
80
|
+
const limit = entry.maxBodySize ?? platformMaxBodySize;
|
|
81
|
+
for (const chain of entry.chains.values()) {
|
|
82
|
+
chain.declaredBodySize = entry.maxBodySize;
|
|
83
|
+
chain.maxBodySize = limit;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/** The largest limit any registered batch resolves to, over the member routes' untransformed
|
|
88
|
+
* paths: what bun sizes its native server limit with (see getMaxRouteBodySize). */
|
|
89
|
+
function getMaxBatchBodySize() {
|
|
90
|
+
const opts = require_src_router.getRouterOptions();
|
|
91
|
+
let largest = 0;
|
|
92
|
+
for (const entry of batchesById.values()) {
|
|
93
|
+
if (entry.maxBodySize !== void 0) {
|
|
94
|
+
largest = Math.max(largest, entry.maxBodySize);
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
const chains = [];
|
|
98
|
+
for (const routeId of entry.routes) {
|
|
99
|
+
const chain = require_src_router.getRouteExecutionChain((0, _mionjs_core.getRoutePath)(routeId.split(_mionjs_core.ROUTER_ITEM_SEPARATOR_CHAR), opts));
|
|
100
|
+
if (chain) chains.push(chain);
|
|
101
|
+
}
|
|
102
|
+
largest = Math.max(largest, sumChainMaxBodySize(chains));
|
|
103
|
+
}
|
|
104
|
+
return largest;
|
|
105
|
+
}
|
|
106
|
+
/** `id=<batchId>` is the only parameter the batch endpoint reads; missing or undecodable is an unknown id.
|
|
107
|
+
* The id is the one query value that IS percent-decoded, so it survives a `/` or a space in a route name. */
|
|
108
|
+
function readBatchId(urlQuery) {
|
|
109
|
+
const rawId = require_src_lib_urlQuery.findMionQueryParam(urlQuery, "id");
|
|
110
|
+
if (rawId === void 0) return void 0;
|
|
111
|
+
try {
|
|
112
|
+
return decodeURIComponent(rawId) || void 0;
|
|
113
|
+
} catch {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/** Runs while the call context is acquired, BEFORE the body is read, so an unknown id costs nothing but
|
|
118
|
+
* a Map lookup: it answers undefined and the caller resolves the batch not-found chain.
|
|
119
|
+
* The id is the only untrusted input and it is never echoed back. */
|
|
120
|
+
function getBatchExecutionChain(rawRequest, opts, urlQuery) {
|
|
121
|
+
const batchId = readBatchId(urlQuery);
|
|
122
|
+
const entry = batchId ? getBatch(batchId) : void 0;
|
|
123
|
+
if (!entry) return void 0;
|
|
124
|
+
const routePaths = entry.routes.map((routeId) => (0, _mionjs_core.getRoutePath)(routeId.split(_mionjs_core.ROUTER_ITEM_SEPARATOR_CHAR), opts));
|
|
125
|
+
const transformedPaths = opts.pathTransform ? routePaths.map((routePath) => opts.pathTransform(rawRequest, routePath) || routePath) : routePaths;
|
|
126
|
+
const chainKey = opts.pathTransform ? transformedPaths.join(",") : "";
|
|
127
|
+
let executionChain = entry.chains.get(chainKey);
|
|
128
|
+
if (!executionChain) {
|
|
129
|
+
executionChain = buildMergedExecutionChain(entry, transformedPaths);
|
|
130
|
+
entry.chains.set(chainKey, executionChain);
|
|
131
|
+
}
|
|
132
|
+
return executionChain;
|
|
133
|
+
}
|
|
134
|
+
/** Takes already-transformed paths; each mapping step goes between its source and target route. */
|
|
135
|
+
function buildMergedExecutionChain(entry, transformedPaths) {
|
|
136
|
+
const seenIds = /* @__PURE__ */ new Set();
|
|
137
|
+
const middleMethods = [];
|
|
138
|
+
const memberChains = [];
|
|
139
|
+
let firstRouteIndex = -1;
|
|
140
|
+
const startMiddlewareIds = new Set(require_src_router.startMiddlewares.map((method) => method.id));
|
|
141
|
+
const endMiddlewareIds = new Set(require_src_router.endMiddlewares.map((method) => method.id));
|
|
142
|
+
transformedPaths.forEach((transformedPath, index) => {
|
|
143
|
+
const chain = require_src_router.getRouteExecutionChain(transformedPath);
|
|
144
|
+
if (!chain) throw new _mionjs_core.FatalError({
|
|
145
|
+
statusCode: _mionjs_core.StatusCodes.UNEXPECTED_ERROR,
|
|
146
|
+
type: "batch-route-not-found",
|
|
147
|
+
publicMessage: `Route '${entry.routes[index]}' of batch '${entry.id}' is not registered on this server.`,
|
|
148
|
+
errorData: {
|
|
149
|
+
batchId: entry.id,
|
|
150
|
+
routeId: entry.routes[index]
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
memberChains.push(chain);
|
|
154
|
+
if (firstRouteIndex < 0) firstRouteIndex = chain.routeIndex;
|
|
155
|
+
for (const method of chain.methods) {
|
|
156
|
+
if (seenIds.has(method.id)) continue;
|
|
157
|
+
if (startMiddlewareIds.has(method.id)) continue;
|
|
158
|
+
if (endMiddlewareIds.has(method.id)) continue;
|
|
159
|
+
seenIds.add(method.id);
|
|
160
|
+
middleMethods.push(method);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
if (entry.mappings.length > 0) insertMappingMethods(entry, middleMethods);
|
|
164
|
+
const methods = [
|
|
165
|
+
...require_src_router.startMiddlewares,
|
|
166
|
+
...middleMethods,
|
|
167
|
+
...require_src_router.endMiddlewares
|
|
168
|
+
];
|
|
169
|
+
const declaredBodySize = resolveBatchMaxBodySize(entry, memberChains);
|
|
170
|
+
return {
|
|
171
|
+
routeIndex: firstRouteIndex,
|
|
172
|
+
methods,
|
|
173
|
+
path: void 0,
|
|
174
|
+
batchId: entry.id,
|
|
175
|
+
batchRouteIds: entry.routes,
|
|
176
|
+
declaredBodySize,
|
|
177
|
+
maxBodySize: declaredBodySize,
|
|
178
|
+
readsBody: true
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Inserts mapping methods into the middleMethods array in the correct position.
|
|
183
|
+
* Each mapping method is inserted after the source route (fromId) and before the target route (toId).
|
|
184
|
+
*/
|
|
185
|
+
function insertMappingMethods(entry, middleMethods) {
|
|
186
|
+
const idToIndex = /* @__PURE__ */ new Map();
|
|
187
|
+
for (let i = 0; i < middleMethods.length; i++) idToIndex.set(middleMethods[i].id, i);
|
|
188
|
+
const insertions = [];
|
|
189
|
+
for (const mapping of entry.mappings) {
|
|
190
|
+
const fromIndex = idToIndex.get(mapping.fromId);
|
|
191
|
+
const toIndex = idToIndex.get(mapping.toId);
|
|
192
|
+
if (fromIndex === void 0) throw new _mionjs_core.FatalError({
|
|
193
|
+
statusCode: _mionjs_core.StatusCodes.UNEXPECTED_ERROR,
|
|
194
|
+
type: "batch-mapping-invalid-source",
|
|
195
|
+
publicMessage: `Mapping source route '${mapping.fromId}' not found in batch '${entry.id}'.`,
|
|
196
|
+
errorData: {
|
|
197
|
+
batchId: entry.id,
|
|
198
|
+
mapping
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
if (toIndex === void 0) throw new _mionjs_core.FatalError({
|
|
202
|
+
statusCode: _mionjs_core.StatusCodes.UNEXPECTED_ERROR,
|
|
203
|
+
type: "batch-mapping-invalid-target",
|
|
204
|
+
publicMessage: `Mapping target route '${mapping.toId}' not found in batch '${entry.id}'.`,
|
|
205
|
+
errorData: {
|
|
206
|
+
batchId: entry.id,
|
|
207
|
+
mapping
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
const target = middleMethods[toIndex];
|
|
211
|
+
const targetParamsCount = target.paramsCount ?? 0;
|
|
212
|
+
if (mapping.paramIndex >= targetParamsCount && !target.paramsRest) throw new _mionjs_core.FatalError({
|
|
213
|
+
statusCode: _mionjs_core.StatusCodes.UNEXPECTED_ERROR,
|
|
214
|
+
type: "batch-mapping-invalid-param-index",
|
|
215
|
+
publicMessage: `Mapping paramIndex ${mapping.paramIndex} is out of range for target route '${mapping.toId}', which takes ${targetParamsCount} parameter(s).`,
|
|
216
|
+
errorData: {
|
|
217
|
+
batchId: entry.id,
|
|
218
|
+
mapping
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
if (!(0, _mionjs_core.hasInputMapper)(mapping.mapperKey)) throw new _mionjs_core.FatalError({
|
|
222
|
+
statusCode: _mionjs_core.StatusCodes.UNEXPECTED_ERROR,
|
|
223
|
+
type: "batch-mapper-not-allowed",
|
|
224
|
+
publicMessage: `Input mapper '${mapping.mapperKey}' is not registered on the server.`,
|
|
225
|
+
errorData: {
|
|
226
|
+
batchId: entry.id,
|
|
227
|
+
mapping
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
insertions.push({
|
|
231
|
+
index: fromIndex + 1,
|
|
232
|
+
method: createMappingMethod(mapping)
|
|
233
|
+
});
|
|
234
|
+
middleMethods[toIndex] = guardMappedTarget(middleMethods[toIndex]);
|
|
235
|
+
}
|
|
236
|
+
insertions.sort((a, b) => b.index - a.index);
|
|
237
|
+
for (const { index, method } of insertions) middleMethods.splice(index, 0, method);
|
|
238
|
+
}
|
|
239
|
+
/** A copy, never a mutation: the route's own RemoteMethod is shared with every plain call to that route. */
|
|
240
|
+
function guardMappedTarget(target) {
|
|
241
|
+
if (target.mappedTargetOf) return target;
|
|
242
|
+
return {
|
|
243
|
+
...target,
|
|
244
|
+
mappedTargetOf: target,
|
|
245
|
+
isAsync: true,
|
|
246
|
+
methodCaller: async (context, executable, ...args) => {
|
|
247
|
+
if (require_src_lib_dispatchError.hasThrownError(context, executable.id)) return void 0;
|
|
248
|
+
return require_src_dispatch.getMethodCaller(target)(context, executable, ...args);
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
function createMappingMethod(mapping) {
|
|
253
|
+
const id = `mionInputFrom_${mapping.fromId}_${mapping.mapperKey}_to_${mapping.toId}`;
|
|
254
|
+
const cached = mappingMethodCache.get(id);
|
|
255
|
+
if (cached) return cached;
|
|
256
|
+
const noopJitFns = (0, _mionjs_core.getNoopJitFns)();
|
|
257
|
+
const method = {
|
|
258
|
+
type: _mionjs_core.HandlerType.rawMiddleware,
|
|
259
|
+
id,
|
|
260
|
+
hasReturnData: false,
|
|
261
|
+
paramsJitHash: "",
|
|
262
|
+
returnJitHash: "",
|
|
263
|
+
paramsJitFns: noopJitFns,
|
|
264
|
+
returnJitFns: noopJitFns,
|
|
265
|
+
handler: createMappingHandler(mapping),
|
|
266
|
+
options: { alwaysRun: false },
|
|
267
|
+
alwaysRun: false,
|
|
268
|
+
isAsync: true,
|
|
269
|
+
methodCaller: runMappingHandler
|
|
270
|
+
};
|
|
271
|
+
mappingMethodCache.set(id, method);
|
|
272
|
+
return method;
|
|
273
|
+
}
|
|
274
|
+
function createMappingHandler(mapping) {
|
|
275
|
+
return (ctx) => {
|
|
276
|
+
const sourceOutput = Object.hasOwn(ctx.response.body, mapping.fromId) ? ctx.response.body[mapping.fromId] : void 0;
|
|
277
|
+
if ((0, _mionjs_core.isRpcError)(sourceOutput) || require_src_lib_dispatchError.hasThrownError(ctx, mapping.fromId)) {
|
|
278
|
+
require_src_lib_dispatchError.addThrownError(ctx, mapping.toId, new _mionjs_core.RpcError({
|
|
279
|
+
statusCode: _mionjs_core.StatusCodes.UNEXPECTED_ERROR,
|
|
280
|
+
type: "batch-mapping-source-failed",
|
|
281
|
+
publicMessage: `Route '${mapping.fromId}' failed, so the input it feeds into '${mapping.toId}' could not be computed.`,
|
|
282
|
+
errorData: {
|
|
283
|
+
fromId: mapping.fromId,
|
|
284
|
+
toId: mapping.toId,
|
|
285
|
+
paramIndex: mapping.paramIndex
|
|
286
|
+
}
|
|
287
|
+
}));
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
const pureFn = (0, _mionjs_core.getInputMapper)(mapping.mapperKey);
|
|
291
|
+
if (!pureFn) throw new _mionjs_core.FatalError({
|
|
292
|
+
statusCode: _mionjs_core.StatusCodes.UNEXPECTED_ERROR,
|
|
293
|
+
type: "batch-mapper-not-allowed",
|
|
294
|
+
publicMessage: `Input mapper '${mapping.mapperKey}' not found at runtime.`
|
|
295
|
+
});
|
|
296
|
+
let mappedValue;
|
|
297
|
+
try {
|
|
298
|
+
mappedValue = pureFn(sourceOutput);
|
|
299
|
+
} catch (error) {
|
|
300
|
+
throw new _mionjs_core.FatalError({
|
|
301
|
+
statusCode: _mionjs_core.StatusCodes.UNEXPECTED_ERROR,
|
|
302
|
+
type: "batch-mapper-failed",
|
|
303
|
+
publicMessage: `The input mapper feeding route '${mapping.toId}' from '${mapping.fromId}' threw.`,
|
|
304
|
+
errorData: {
|
|
305
|
+
fromId: mapping.fromId,
|
|
306
|
+
toId: mapping.toId,
|
|
307
|
+
paramIndex: mapping.paramIndex
|
|
308
|
+
},
|
|
309
|
+
originalError: error
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
const targetParams = ctx.request.body[mapping.toId];
|
|
313
|
+
if (Array.isArray(targetParams)) targetParams[mapping.paramIndex] = mappedValue;
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
async function runMappingHandler(context, executable, ...args) {
|
|
317
|
+
return executable.handler(context);
|
|
318
|
+
}
|
|
319
|
+
//#endregion
|
|
320
|
+
exports.capBatchBodySizes = capBatchBodySizes;
|
|
321
|
+
exports.clearBatches = clearBatches;
|
|
322
|
+
exports.getBatch = getBatch;
|
|
323
|
+
exports.getBatchExecutionChain = getBatchExecutionChain;
|
|
324
|
+
exports.getBatchIds = getBatchIds;
|
|
325
|
+
exports.getMaxBatchBodySize = getMaxBatchBodySize;
|
|
326
|
+
exports.readBatchId = readBatchId;
|
|
327
|
+
exports.refreshBatchChainBodyLimits = refreshBatchChainBodyLimits;
|
|
328
|
+
exports.registerBatches = registerBatches;
|
|
329
|
+
exports.replaceBatches = replaceBatches;
|
|
330
|
+
exports.resolveBatchMaxBodySize = resolveBatchMaxBodySize;
|
|
331
|
+
|
|
332
|
+
//# sourceMappingURL=batches.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batches.cjs","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,eAAA,GAAA,aAAA,mBAAgC,iDAAiC,IAAI,IAAwB,CAAC;AACpG,IAAM,sBAAA,GAAA,aAAA,mBAAuC,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,G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@
|
|
|
1
|
+
import { BatchDefinition, BatchMapping } from '@mionjs/core';
|
|
2
|
+
import { RouterOptions } from './types/general.ts';
|
|
3
|
+
import { MethodsExecutionChain } from './types/remoteMethods.ts';
|
|
4
|
+
export interface BatchEntry {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly routes: readonly string[];
|
|
7
|
+
readonly mappings: readonly BatchMapping[];
|
|
8
|
+
readonly chains: Map<string, MethodsExecutionChain>;
|
|
9
|
+
maxBodySize?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function registerBatches(table: Record<string, BatchDefinition>): void;
|
|
12
|
+
export declare function replaceBatches(table: Record<string, BatchDefinition>): void;
|
|
13
|
+
export declare function getBatch(id: string): BatchEntry | undefined;
|
|
14
|
+
export declare function getBatchIds(): string[];
|
|
15
|
+
export declare function clearBatches(): void;
|
|
16
|
+
export declare function resolveBatchMaxBodySize(entry: BatchEntry, memberChains: MethodsExecutionChain[]): number;
|
|
17
|
+
export declare function capBatchBodySizes(maxRequestSize: number): void;
|
|
18
|
+
export declare function refreshBatchChainBodyLimits(platformMaxBodySize: number): void;
|
|
19
|
+
export declare function getMaxBatchBodySize(): number;
|
|
20
|
+
export declare function readBatchId(urlQuery: string | undefined): string | undefined;
|
|
21
|
+
export declare function getBatchExecutionChain(rawRequest: unknown, opts: RouterOptions, urlQuery?: string): MethodsExecutionChain | undefined;
|
|
22
|
+
//# sourceMappingURL=batches.d.ts.map
|
|
@@ -1,125 +1,81 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
const require_src_constants = require("./constants.cjs");
|
|
3
|
+
const require_src_batches = require("./batches.cjs");
|
|
4
|
+
const require_src_router = require("./router.cjs");
|
|
5
|
+
let _mionjs_core = require("@mionjs/core");
|
|
6
|
+
//#region src/callContext.ts
|
|
7
|
+
/** Resolves a request to the REGISTERED chain that answers it, allocating NOTHING, so a streaming adapter
|
|
8
|
+
* calls it BEFORE the body to read against `chain.maxBodySize` and `createContextFromChain` after.
|
|
9
|
+
* Nothing of the request's own may survive the read: such an object is promoted to the old heap and the
|
|
10
|
+
* parsed body attached to it is promoted with it, which on a 4 MB body costs garbage-collector throughput.
|
|
11
|
+
* The chain is SHARED and long-lived: mutating what this returns damages the route for the whole process.
|
|
12
|
+
* An unknown path or batch id resolves to a not-found chain that never reads the body (`readsBody` false)
|
|
13
|
+
* and runs only the global middlewares that declare `alwaysRun`. */
|
|
14
|
+
function resolveExecutionChain(path, urlQuery, rawRequest) {
|
|
15
|
+
const opts = require_src_router.getRouterOptions();
|
|
16
|
+
return getExecutionChain(path, opts.pathTransform?.(rawRequest, path) || path, urlQuery, rawRequest, opts);
|
|
12
17
|
}
|
|
13
|
-
|
|
14
|
-
|
|
18
|
+
/** `path` and `urlQuery` are the request's; a route chain's own path wins, not-found and batch chains use the request's. */
|
|
19
|
+
function createContextFromChain(chain, path, urlQuery, reqHeaders, respHeaders, reqRawBody, reqBodyType) {
|
|
20
|
+
const request = {
|
|
21
|
+
headers: reqHeaders,
|
|
22
|
+
rawBody: reqRawBody,
|
|
23
|
+
bodyType: reqBodyType ?? getRequestBodyType(reqRawBody),
|
|
24
|
+
body: EMPTY_BODY,
|
|
25
|
+
thrownErrors: void 0
|
|
26
|
+
};
|
|
27
|
+
const response = {
|
|
28
|
+
statusCode: _mionjs_core.StatusCodes.OK,
|
|
29
|
+
contentType: require_src_constants.JSON_CONTENT_TYPE,
|
|
30
|
+
hasErrors: false,
|
|
31
|
+
fatalError: void 0,
|
|
32
|
+
headers: respHeaders,
|
|
33
|
+
body: {}
|
|
34
|
+
};
|
|
35
|
+
const contextDataFactory = require_src_router.getRouterOptions().contextDataFactory;
|
|
36
|
+
return {
|
|
37
|
+
path: chain.path ?? path,
|
|
38
|
+
request,
|
|
39
|
+
response,
|
|
40
|
+
executionChain: chain,
|
|
41
|
+
maxBodySize: chain.maxBodySize,
|
|
42
|
+
readsBody: chain.readsBody,
|
|
43
|
+
shared: contextDataFactory ? contextDataFactory() : {},
|
|
44
|
+
urlQuery,
|
|
45
|
+
batchId: chain.batchId,
|
|
46
|
+
batchRouteIds: chain.batchRouteIds
|
|
47
|
+
};
|
|
15
48
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
path: transformedPath,
|
|
21
|
-
request: {
|
|
22
|
-
headers: reqHeaders,
|
|
23
|
-
rawBody: reqRawBody,
|
|
24
|
-
bodyType: reqBodyType ?? getRequestBodyType(reqRawBody),
|
|
25
|
-
body: {},
|
|
26
|
-
thrownErrors: void 0
|
|
27
|
-
},
|
|
28
|
-
response: {
|
|
29
|
-
statusCode: core.StatusCodes.OK,
|
|
30
|
-
hasErrors: false,
|
|
31
|
-
headers: respHeaders,
|
|
32
|
-
body: {},
|
|
33
|
-
rawBody: "",
|
|
34
|
-
serializer: core.SerializerModes.json,
|
|
35
|
-
binSerializer: void 0
|
|
36
|
-
},
|
|
37
|
-
executionChain,
|
|
38
|
-
shared: opts.contextDataFactory ? opts.contextDataFactory() : {},
|
|
39
|
-
urlQuery,
|
|
40
|
-
routesFlowRouteIds
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
function acquireCallContext(usePooling, path, opts, reqRawBody, rawRequest, reqHeaders, respHeaders, reqBodyType, urlQuery) {
|
|
44
|
-
if (!usePooling) return createCallContext(path, opts, reqRawBody, rawRequest, reqHeaders, respHeaders, reqBodyType, urlQuery);
|
|
45
|
-
const pooledContext = contextPool.pop();
|
|
46
|
-
const transformedPath = opts.pathTransform?.(rawRequest, path) || path;
|
|
47
|
-
if (pooledContext) {
|
|
48
|
-
const ctx = pooledContext;
|
|
49
|
-
ctx.path = transformedPath;
|
|
50
|
-
const req = ctx.request;
|
|
51
|
-
req.headers = reqHeaders;
|
|
52
|
-
req.rawBody = reqRawBody;
|
|
53
|
-
req.bodyType = reqBodyType ?? getRequestBodyType(reqRawBody);
|
|
54
|
-
req.body = {};
|
|
55
|
-
req.thrownErrors = void 0;
|
|
56
|
-
const resp = ctx.response;
|
|
57
|
-
resp.statusCode = core.StatusCodes.OK;
|
|
58
|
-
resp.hasErrors = false;
|
|
59
|
-
resp.headers = respHeaders;
|
|
60
|
-
resp.body = {};
|
|
61
|
-
resp.rawBody = "";
|
|
62
|
-
resp.serializer = core.SerializerModes.json;
|
|
63
|
-
resp.binSerializer = void 0;
|
|
64
|
-
const { executionChain, routesFlowRouteIds } = getExecutionChain(path, transformedPath, urlQuery, rawRequest, opts);
|
|
65
|
-
ctx.executionChain = executionChain;
|
|
66
|
-
ctx.routesFlowRouteIds = routesFlowRouteIds;
|
|
67
|
-
ctx.shared = opts.contextDataFactory ? opts.contextDataFactory() : {};
|
|
68
|
-
ctx.urlQuery = urlQuery;
|
|
69
|
-
return ctx;
|
|
70
|
-
}
|
|
71
|
-
return createCallContext(path, opts, reqRawBody, rawRequest, reqHeaders, respHeaders, reqBodyType, urlQuery);
|
|
72
|
-
}
|
|
73
|
-
function releaseCallContext(ctx, maxPoolSize) {
|
|
74
|
-
if (contextPool.length < maxPoolSize) {
|
|
75
|
-
const mutableCtx = ctx;
|
|
76
|
-
const req = mutableCtx.request;
|
|
77
|
-
req.rawBody = "";
|
|
78
|
-
req.body = null;
|
|
79
|
-
req.thrownErrors = void 0;
|
|
80
|
-
mutableCtx.response = {
|
|
81
|
-
statusCode: core.StatusCodes.OK,
|
|
82
|
-
hasErrors: false,
|
|
83
|
-
headers: null,
|
|
84
|
-
// Will be set when context is acquired
|
|
85
|
-
body: null,
|
|
86
|
-
// Will be set when context is acquired
|
|
87
|
-
rawBody: "",
|
|
88
|
-
serializer: core.SerializerModes.json,
|
|
89
|
-
binSerializer: void 0
|
|
90
|
-
};
|
|
91
|
-
mutableCtx.shared = null;
|
|
92
|
-
mutableCtx.executionChain = null;
|
|
93
|
-
mutableCtx.routesFlowRouteIds = void 0;
|
|
94
|
-
contextPool.push(ctx);
|
|
95
|
-
}
|
|
49
|
+
var EMPTY_BODY = Object.freeze({});
|
|
50
|
+
/** The one-call form, for a caller that already has the body (a host that parsed it, `dispatchRoute`, a test). */
|
|
51
|
+
function createCallContext(path, urlQuery, rawRequest, reqHeaders, respHeaders, reqRawBody, reqBodyType) {
|
|
52
|
+
return createContextFromChain(resolveExecutionChain(path, urlQuery, rawRequest), path, urlQuery, reqHeaders, respHeaders, reqRawBody, reqBodyType);
|
|
96
53
|
}
|
|
54
|
+
/** The wire form of a body: a string is stringified JSON, anything else a parsed object. A body
|
|
55
|
+
* not yet read (a context built before it) reads as an object until the body arrives. */
|
|
97
56
|
function getRequestBodyType(rawBody) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
57
|
+
if (typeof rawBody === "string") return _mionjs_core.SerializerModes.stringifyJson;
|
|
58
|
+
if (rawBody instanceof ArrayBuffer || rawBody instanceof Uint8Array) throw new Error("mion: a byte request body has no encoder; send the body as a JSON string or a parsed object.");
|
|
59
|
+
return _mionjs_core.SerializerModes.json;
|
|
101
60
|
}
|
|
102
61
|
function getExecutionChain(originalPath, transformedPath, urlQuery, rawRequest, opts) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return { executionChain };
|
|
62
|
+
if (!!opts.basePath ? originalPath.endsWith(_mionjs_core.MION_BATCH_PATH) : originalPath === _mionjs_core.MION_BATCH_PATH) return require_src_batches.getBatchExecutionChain(rawRequest, opts, urlQuery) ?? notFoundChain(_mionjs_core.MION_ROUTES.batchNotFound);
|
|
63
|
+
return require_src_router.getRouteExecutionChain(transformedPath) ?? notFoundChain(_mionjs_core.MION_ROUTES.notFound);
|
|
64
|
+
}
|
|
65
|
+
/** mion's own not-found chains are built by initRouter, so an absent one is a bug, not a request error. */
|
|
66
|
+
function notFoundChain(chainId) {
|
|
67
|
+
const executionChain = require_src_router.getNotFoundExecutionChain(chainId);
|
|
68
|
+
if (!executionChain) throw new _mionjs_core.FatalError({
|
|
69
|
+
statusCode: _mionjs_core.StatusCodes.UNEXPECTED_ERROR,
|
|
70
|
+
type: "not-found",
|
|
71
|
+
publicMessage: "Not-found chain is not registered. This should never happen."
|
|
72
|
+
});
|
|
73
|
+
return executionChain;
|
|
119
74
|
}
|
|
120
|
-
|
|
121
|
-
exports.clearContextPool = clearContextPool;
|
|
75
|
+
//#endregion
|
|
122
76
|
exports.createCallContext = createCallContext;
|
|
123
|
-
exports.
|
|
124
|
-
exports.
|
|
125
|
-
|
|
77
|
+
exports.createContextFromChain = createContextFromChain;
|
|
78
|
+
exports.getRequestBodyType = getRequestBodyType;
|
|
79
|
+
exports.resolveExecutionChain = resolveExecutionChain;
|
|
80
|
+
|
|
81
|
+
//# sourceMappingURL=callContext.cjs.map
|