@mionjs/router 0.8.10 → 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
|
@@ -1,39 +1,75 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { JSON_CONTENT_TYPE } from "../constants.js";
|
|
2
|
+
import { FatalError, MION_ROUTES, RpcError, StatusCodes, markFatal } from "@mionjs/core";
|
|
3
|
+
//#region src/lib/dispatchError.ts
|
|
4
|
+
/** The response for an error raised outside the router by any adapter; it goes in `@thrownErrors` like a route error. */
|
|
2
5
|
function getRouterFatalErrorResponse(returnErr, respHeaders) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
serializer: SerializerModes.json
|
|
15
|
-
// global errors are always json
|
|
16
|
-
};
|
|
17
|
-
return response;
|
|
6
|
+
markFatal(returnErr);
|
|
7
|
+
const body = { "@thrownErrors": { [MION_ROUTES.platformError]: returnErr } };
|
|
8
|
+
respHeaders.set("x-rpc-error", errorHeaderValue(returnErr.type));
|
|
9
|
+
return {
|
|
10
|
+
statusCode: returnErr.statusCode || StatusCodes.SERVER_ERROR,
|
|
11
|
+
contentType: JSON_CONTENT_TYPE,
|
|
12
|
+
hasErrors: true,
|
|
13
|
+
fatalError: returnErr,
|
|
14
|
+
headers: respHeaders,
|
|
15
|
+
body
|
|
16
|
+
};
|
|
18
17
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
originalError: err,
|
|
26
|
-
type: "unknown-error"
|
|
27
|
-
});
|
|
28
|
-
if (!response.hasErrors) response.headers.set("x-rpc-error", rpcError.type);
|
|
29
|
-
response.statusCode = rpcError.statusCode ?? StatusCodes.UNEXPECTED_ERROR;
|
|
30
|
-
response.hasErrors = true;
|
|
31
|
-
const thrownErrors = context.request.thrownErrors || {};
|
|
32
|
-
thrownErrors[path] = rpcError;
|
|
33
|
-
context.request.thrownErrors = thrownErrors;
|
|
18
|
+
/** An app-thrown RpcError may carry any string as its `type`, and a CR or LF there is header injection on
|
|
19
|
+
* adapters that write headers unchecked (or an ERR_INVALID_CHAR throw on node). Anything outside the token
|
|
20
|
+
* alphabet reports as `unknown-error` on the header; the body still carries the full type. */
|
|
21
|
+
var HEADER_SAFE_TYPE = /^[A-Za-z0-9_.:@-]{1,128}$/;
|
|
22
|
+
function errorHeaderValue(type) {
|
|
23
|
+
return HEADER_SAFE_TYPE.test(type) ? type : "unknown-error";
|
|
34
24
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
25
|
+
/** Marks the response as ended by `rpcError`: the error header (first error only), the status code,
|
|
26
|
+
* `hasErrors` (what the dispatcher's skip rule reads) and `fatalError` (first one wins). Shared by the
|
|
27
|
+
* thrown path and a returned FatalError; where the error itself lands is the caller's decision.
|
|
28
|
+
* `fallbackStatus` answers when the error carries no statusCode: a thrown one is unexpected (422), a
|
|
29
|
+
* returned FatalError a declared application error (400). */
|
|
30
|
+
function markResponseFailed(context, rpcError, fallbackStatus) {
|
|
31
|
+
const response = context.response;
|
|
32
|
+
if (!response.hasErrors) {
|
|
33
|
+
response.headers.set("x-rpc-error", errorHeaderValue(rpcError.type));
|
|
34
|
+
response.fatalError = rpcError;
|
|
35
|
+
}
|
|
36
|
+
response.statusCode = rpcError.statusCode ?? fallbackStatus;
|
|
37
|
+
response.hasErrors = true;
|
|
38
|
+
}
|
|
39
|
+
/** Whatever an adapter caught, as the mion error the wire carries. */
|
|
40
|
+
function toRpcError(err) {
|
|
41
|
+
return err instanceof RpcError ? err : new FatalError({
|
|
42
|
+
publicMessage: "Unknown Error",
|
|
43
|
+
type: "unknown-error",
|
|
44
|
+
originalError: err
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/** Records an undeclared error under `key` and ends the request: it lands in `@thrownErrors` untyped, sets
|
|
48
|
+
* the status and the error header, and stops every later member that does not declare `alwaysRun`.
|
|
49
|
+
* Undeclared means thrown, or returned by a raw middleware, which cannot declare a return type; a declared
|
|
50
|
+
* error is returned from a handler and goes straight into `response.body`. The key is normally the member
|
|
51
|
+
* that failed; an adapter passes its own (`mion@platformError`) for a request no member could run. */
|
|
52
|
+
function recordUndeclaredError(context, key, err) {
|
|
53
|
+
const rpcError = markFatal(err instanceof RpcError ? err : new FatalError({
|
|
54
|
+
statusCode: StatusCodes.UNEXPECTED_ERROR,
|
|
55
|
+
publicMessage: `Unknown error in handler "${key}" of route ExecutionChain.`,
|
|
56
|
+
originalError: err,
|
|
57
|
+
type: "unknown-error"
|
|
58
|
+
}));
|
|
59
|
+
markResponseFailed(context, rpcError, StatusCodes.UNEXPECTED_ERROR);
|
|
60
|
+
addThrownError(context, key, rpcError);
|
|
61
|
+
}
|
|
62
|
+
/** Unlike recordUndeclaredError, does not end the request. */
|
|
63
|
+
function addThrownError(context, key, rpcError) {
|
|
64
|
+
const thrownErrors = context.request.thrownErrors || {};
|
|
65
|
+
thrownErrors[key] = rpcError;
|
|
66
|
+
context.request.thrownErrors = thrownErrors;
|
|
67
|
+
}
|
|
68
|
+
function hasThrownError(context, key) {
|
|
69
|
+
const thrownErrors = context.request.thrownErrors;
|
|
70
|
+
return !!thrownErrors && Object.hasOwn(thrownErrors, key);
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
73
|
+
export { addThrownError, errorHeaderValue, getRouterFatalErrorResponse, hasThrownError, markResponseFailed, recordUndeclaredError, toRpcError };
|
|
74
|
+
|
|
75
|
+
//# sourceMappingURL=dispatchError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatchError.js","sources":["../../../../src/lib/dispatchError.ts"],"sourcesContent":["import {RpcError, MION_ROUTES, Mutable, StatusCodes,
|
|
1
|
+
{"version":3,"file":"dispatchError.js","names":[],"sources":["../../../../src/lib/dispatchError.ts"],"sourcesContent":["import {RpcError, FatalError, MION_ROUTES, Mutable, StatusCodes, markFatal} from '@mionjs/core';\nimport {JSON_CONTENT_TYPE} from '../constants.ts';\nimport type {CallContext, MionHeaders, MionRequest, MionResponse, ResponseBody} from '../types/context.ts';\n\n/** The response for an error raised outside the router by any adapter; it goes in `@thrownErrors` like a route error. */\n\nexport function getRouterFatalErrorResponse(returnErr: RpcError<string>, respHeaders: MionHeaders): MionResponse {\n // a platform error ends the request before any handler runs, so it is fatal by definition\n markFatal(returnErr);\n const body: ResponseBody = {\n '@thrownErrors': {[MION_ROUTES.platformError]: returnErr},\n };\n respHeaders.set('x-rpc-error', errorHeaderValue(returnErr.type));\n const response: Mutable<MionResponse> = {\n statusCode: returnErr.statusCode || StatusCodes.SERVER_ERROR, // Global errors are always unexpected\n contentType: JSON_CONTENT_TYPE,\n hasErrors: true,\n fatalError: returnErr,\n headers: respHeaders,\n body,\n };\n return response;\n}\n\n/** An app-thrown RpcError may carry any string as its `type`, and a CR or LF there is header injection on\n * adapters that write headers unchecked (or an ERR_INVALID_CHAR throw on node). Anything outside the token\n * alphabet reports as `unknown-error` on the header; the body still carries the full type. */\nconst HEADER_SAFE_TYPE = /^[A-Za-z0-9_.:@-]{1,128}$/;\nexport function errorHeaderValue(type: string): string {\n return HEADER_SAFE_TYPE.test(type) ? type : 'unknown-error';\n}\n\n/** Marks the response as ended by `rpcError`: the error header (first error only), the status code,\n * `hasErrors` (what the dispatcher's skip rule reads) and `fatalError` (first one wins). Shared by the\n * thrown path and a returned FatalError; where the error itself lands is the caller's decision.\n * `fallbackStatus` answers when the error carries no statusCode: a thrown one is unexpected (422), a\n * returned FatalError a declared application error (400). */\nexport function markResponseFailed(context: CallContext, rpcError: RpcError<string>, fallbackStatus: number) {\n const response = context.response as Mutable<MionResponse>;\n if (!response.hasErrors) {\n response.headers.set('x-rpc-error', errorHeaderValue(rpcError.type));\n response.fatalError = rpcError;\n }\n response.statusCode = rpcError.statusCode ?? fallbackStatus;\n response.hasErrors = true;\n}\n\n/** Whatever an adapter caught, as the mion error the wire carries. */\nexport function toRpcError(err: unknown): RpcError<string> {\n return err instanceof RpcError\n ? err\n : new FatalError({publicMessage: 'Unknown Error', type: 'unknown-error', originalError: err as Error});\n}\n\n/** Records an undeclared error under `key` and ends the request: it lands in `@thrownErrors` untyped, sets\n * the status and the error header, and stops every later member that does not declare `alwaysRun`.\n * Undeclared means thrown, or returned by a raw middleware, which cannot declare a return type; a declared\n * error is returned from a handler and goes straight into `response.body`. The key is normally the member\n * that failed; an adapter passes its own (`mion@platformError`) for a request no member could run. */\nexport function recordUndeclaredError(context: CallContext, key: string, err: any) {\n const rpcError: RpcError<string> = markFatal(\n err instanceof RpcError\n ? err\n : new FatalError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n publicMessage: `Unknown error in handler \"${key}\" of route ExecutionChain.`,\n originalError: err,\n type: 'unknown-error',\n })\n );\n markResponseFailed(context, rpcError, StatusCodes.UNEXPECTED_ERROR);\n addThrownError(context, key, rpcError);\n}\n\n/** Unlike recordUndeclaredError, does not end the request. */\nexport function addThrownError(context: CallContext, key: string, rpcError: RpcError<string>) {\n // tsgo types `readonly || mutable` as readonly, so casting only the `{}` fallback still forbids the write.\n const thrownErrors = (context.request.thrownErrors || {}) as Record<string, RpcError<string>>;\n thrownErrors[key] = rpcError;\n (context.request as Mutable<MionRequest>).thrownErrors = thrownErrors;\n}\n\nexport function hasThrownError(context: CallContext, key: string): boolean {\n const thrownErrors = context.request.thrownErrors;\n return !!thrownErrors && Object.hasOwn(thrownErrors, key);\n}\n"],"mappings":";;;;AAMA,SAAgB,4BAA4B,WAA6B,aAAwC;CAE/G,UAAU,SAAS;CACnB,MAAM,OAAqB,EACzB,iBAAiB,GAAE,YAAY,gBAAgB,UAAS,EAC1D;CACA,YAAY,IAAI,eAAe,iBAAiB,UAAU,IAAI,CAAC;CAS/D,OAAO;EAPL,YAAY,UAAU,cAAc,YAAY;EAChD,aAAa;EACb,WAAW;EACX,YAAY;EACZ,SAAS;EACT;CAEK;AACT;;;;AAKA,IAAM,mBAAmB;AACzB,SAAgB,iBAAiB,MAAsB;CACrD,OAAO,iBAAiB,KAAK,IAAI,IAAI,OAAO;AAC9C;;;;;;AAOA,SAAgB,mBAAmB,SAAsB,UAA4B,gBAAwB;CAC3G,MAAM,WAAW,QAAQ;CACzB,IAAI,CAAC,SAAS,WAAW;EACvB,SAAS,QAAQ,IAAI,eAAe,iBAAiB,SAAS,IAAI,CAAC;EACnE,SAAS,aAAa;CACxB;CACA,SAAS,aAAa,SAAS,cAAc;CAC7C,SAAS,YAAY;AACvB;;AAGA,SAAgB,WAAW,KAAgC;CACzD,OAAO,eAAe,WAClB,MACA,IAAI,WAAW;EAAC,eAAe;EAAiB,MAAM;EAAiB,eAAe;CAAY,CAAC;AACzG;;;;;;AAOA,SAAgB,sBAAsB,SAAsB,KAAa,KAAU;CACjF,MAAM,WAA6B,UACjC,eAAe,WACX,MACA,IAAI,WAAW;EACb,YAAY,YAAY;EACxB,eAAe,6BAA6B,IAAI;EAChD,eAAe;EACf,MAAM;CACR,CAAC,CACP;CACA,mBAAmB,SAAS,UAAU,YAAY,gBAAgB;CAClE,eAAe,SAAS,KAAK,QAAQ;AACvC;;AAGA,SAAgB,eAAe,SAAsB,KAAa,UAA4B;CAE5F,MAAM,eAAgB,QAAQ,QAAQ,gBAAgB,CAAC;CACvD,aAAa,OAAO;CACpB,QAAS,QAAiC,eAAe;AAC3D;AAEA,SAAgB,eAAe,SAAsB,KAAsB;CACzE,MAAM,eAAe,QAAQ,QAAQ;CACrC,OAAO,CAAC,CAAC,gBAAgB,OAAO,OAAO,cAAc,GAAG;AAC1D"}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export declare
|
|
5
|
-
export declare
|
|
6
|
-
export declare
|
|
7
|
-
export declare
|
|
8
|
-
export declare
|
|
9
|
-
|
|
1
|
+
import { HeadersMiddlewareHelper, MiddlewareHelper, RawMiddlewareHelper, RouteHelper, RouterOptionsInput } from '../types/mionRouter.ts';
|
|
2
|
+
import { CallContext } from '../types/context.ts';
|
|
3
|
+
export declare const route: RouteHelper<RouterOptionsInput>;
|
|
4
|
+
export declare const query: RouteHelper<Partial<import('../types/general.ts').RouterOptions<any, any>>, false>;
|
|
5
|
+
export declare const mutation: RouteHelper<Partial<import('../types/general.ts').RouterOptions<any, any>>, true>;
|
|
6
|
+
export declare const middleware: MiddlewareHelper<RouterOptionsInput>;
|
|
7
|
+
export declare const headersMiddleware: HeadersMiddlewareHelper<RouterOptionsInput>;
|
|
8
|
+
export declare const rawMiddleware: RawMiddlewareHelper<RouterOptionsInput>;
|
|
9
|
+
type OnEveryCall = (ctx: CallContext) => void;
|
|
10
|
+
export declare function markOnDemand<Def extends object>(def: Def, onEveryCall?: OnEveryCall): Def;
|
|
11
|
+
export declare function isOnDemandMiddleware(def: object): boolean;
|
|
12
|
+
export declare function getOnEveryCall(def: object): OnEveryCall | undefined;
|
|
13
|
+
export declare const mionInternalRouteIds: ReadonlySet<string>;
|
|
14
|
+
export {};
|
|
10
15
|
//# sourceMappingURL=handlers.d.ts.map
|
|
@@ -1,52 +1,89 @@
|
|
|
1
|
-
import { HandlerType } from "@mionjs/core";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { HandlerType, MION_ROUTES } from "@mionjs/core";
|
|
2
|
+
//#region src/lib/handlers.ts
|
|
3
|
+
var route = (handler, opts, paramsFns, returnFns, paramsId, returnId, isAsyncId, syncId) => ({
|
|
4
|
+
type: HandlerType.route,
|
|
5
|
+
handler,
|
|
6
|
+
options: opts,
|
|
7
|
+
rtFns: {
|
|
8
|
+
paramsFns,
|
|
9
|
+
returnFns,
|
|
10
|
+
paramsId,
|
|
11
|
+
returnId,
|
|
12
|
+
isAsyncId,
|
|
13
|
+
syncId
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
/** Typed as the same helper as `route()`, so both keep the marker signature the scanner reads at the call site. */
|
|
17
|
+
function routeWithMutation(isMutation) {
|
|
18
|
+
return (handler, opts, paramsFns, returnFns, paramsId, returnId, isAsyncId, syncId) => ({
|
|
19
|
+
type: HandlerType.route,
|
|
20
|
+
handler,
|
|
21
|
+
options: {
|
|
22
|
+
...opts,
|
|
23
|
+
isMutation
|
|
24
|
+
},
|
|
25
|
+
rtFns: {
|
|
26
|
+
paramsFns,
|
|
27
|
+
returnFns,
|
|
28
|
+
paramsId,
|
|
29
|
+
returnId,
|
|
30
|
+
isAsyncId,
|
|
31
|
+
syncId
|
|
32
|
+
}
|
|
33
|
+
});
|
|
8
34
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
35
|
+
/** Route handler for read-only queries. Uses GET with ?data=base64url on the client when payload fits. */
|
|
36
|
+
var query = routeWithMutation(false);
|
|
37
|
+
var mutation = routeWithMutation(true);
|
|
38
|
+
var middleware = (handler, opts, paramsFns, returnFns, paramsId, returnId, isAsyncId, syncId) => ({
|
|
39
|
+
type: HandlerType.middleware,
|
|
40
|
+
handler,
|
|
41
|
+
options: opts,
|
|
42
|
+
rtFns: {
|
|
43
|
+
paramsFns,
|
|
44
|
+
returnFns,
|
|
45
|
+
paramsId,
|
|
46
|
+
returnId,
|
|
47
|
+
isAsyncId,
|
|
48
|
+
syncId
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
var headersMiddleware = (handler, opts, headersFns, paramsFns, returnFns, headersId, paramsId, returnId, isAsyncId, syncId) => ({
|
|
52
|
+
type: HandlerType.headersMiddleware,
|
|
53
|
+
handler,
|
|
54
|
+
options: opts,
|
|
55
|
+
rtFns: {
|
|
56
|
+
paramsFns,
|
|
57
|
+
returnFns,
|
|
58
|
+
paramsId,
|
|
59
|
+
returnId,
|
|
60
|
+
isAsyncId,
|
|
61
|
+
syncId,
|
|
62
|
+
headersFns,
|
|
63
|
+
headersId
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
var rawMiddleware = (handler, opts) => ({
|
|
67
|
+
type: HandlerType.rawMiddleware,
|
|
68
|
+
handler,
|
|
69
|
+
options: opts
|
|
70
|
+
});
|
|
71
|
+
/** Each on-demand middleware, with what it does on every call even without its slot. */
|
|
72
|
+
var onDemandMiddlewares = /* @__PURE__ */ new WeakMap();
|
|
73
|
+
/** Internal: the middleware runs only when the request body carries its slot, so an absent slot costs nothing */
|
|
74
|
+
function markOnDemand(def, onEveryCall) {
|
|
75
|
+
onDemandMiddlewares.set(def, onEveryCall);
|
|
76
|
+
return def;
|
|
15
77
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
type: HandlerType.route,
|
|
19
|
-
handler,
|
|
20
|
-
options: { ...opts, isMutation: true }
|
|
21
|
-
};
|
|
78
|
+
function isOnDemandMiddleware(def) {
|
|
79
|
+
return onDemandMiddlewares.has(def);
|
|
22
80
|
}
|
|
23
|
-
function
|
|
24
|
-
|
|
25
|
-
type: HandlerType.middleFn,
|
|
26
|
-
handler,
|
|
27
|
-
options: opts
|
|
28
|
-
};
|
|
81
|
+
function getOnEveryCall(def) {
|
|
82
|
+
return onDemandMiddlewares.get(def);
|
|
29
83
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
function rawMiddleFn(handler, opts) {
|
|
38
|
-
return {
|
|
39
|
-
type: HandlerType.rawMiddleFn,
|
|
40
|
-
handler,
|
|
41
|
-
options: opts
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
export {
|
|
45
|
-
headersFn,
|
|
46
|
-
middleFn,
|
|
47
|
-
mutation,
|
|
48
|
-
query,
|
|
49
|
-
rawMiddleFn,
|
|
50
|
-
route
|
|
51
|
-
};
|
|
52
|
-
//# sourceMappingURL=handlers.js.map
|
|
84
|
+
/** mion's own ids, never exposed to clients */
|
|
85
|
+
var mionInternalRouteIds = new Set(Object.values(MION_ROUTES));
|
|
86
|
+
//#endregion
|
|
87
|
+
export { getOnEveryCall, headersMiddleware, isOnDemandMiddleware, markOnDemand, middleware, mionInternalRouteIds, mutation, query, rawMiddleware, route };
|
|
88
|
+
|
|
89
|
+
//# sourceMappingURL=handlers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlers.js","sources":["../../../../src/lib/handlers.ts"],"sourcesContent":["/* ########\n * 2024 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport {
|
|
1
|
+
{"version":3,"file":"handlers.js","names":[],"sources":["../../../../src/lib/handlers.ts"],"sourcesContent":["/* ########\n * 2024 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport {HandlerType, MION_ROUTES} from '@mionjs/core';\nimport type {\n HeadersMiddlewareHelper,\n MiddlewareHelper,\n PinnedMutation,\n RawMiddlewareHelper,\n RouteHelper,\n RouterOptionsInput,\n} from '../types/mionRouter.ts';\nimport type {CallContext} from '../types/context.ts';\n\n// ############# Route & Middlewares initialization (INTERNAL) #############\n// These bodies initialize the definition objects AND are the mion injection points: the trailing marker\n// params are filled at BUILD TIME by @mionjs/devtools. Not exported from the package, consumers reach\n// them as the closures `createMionRouter()` returns; only mion's own middlewares and its error / serializer routes\n// call them directly, each pinning its own `encoder`.\n// ⚠️ There is NO signature here on purpose: each body is TYPED BY its helper interface in\n// types/mionRouter.ts, the one place a helper signature is written, so there is no second surface to keep\n// in step. `RouterOptionsInput` is the widest options shape; `createMionRouter` narrows each helper to\n// its own `O` so a declaration reads the factory's options.\n\nexport const route: RouteHelper<RouterOptionsInput> = (\n handler,\n opts,\n paramsFns,\n returnFns,\n paramsId,\n returnId,\n isAsyncId,\n syncId\n) => ({\n type: HandlerType.route,\n handler,\n options: opts,\n rtFns: {paramsFns, returnFns, paramsId, returnId, isAsyncId, syncId},\n});\n\n/** Typed as the same helper as `route()`, so both keep the marker signature the scanner reads at the call site. */\nfunction routeWithMutation<M extends boolean>(isMutation: M): RouteHelper<RouterOptionsInput, M> {\n return (handler, opts, paramsFns, returnFns, paramsId, returnId, isAsyncId, syncId) => ({\n type: HandlerType.route,\n handler,\n options: {...opts, isMutation} as PinnedMutation<typeof opts & object, M>,\n rtFns: {paramsFns, returnFns, paramsId, returnId, isAsyncId, syncId},\n });\n}\n\n/** Route handler for read-only queries. Uses GET with ?data=base64url on the client when payload fits. */\nexport const query = routeWithMutation(false);\n\nexport const mutation = routeWithMutation(true);\n\nexport const middleware: MiddlewareHelper<RouterOptionsInput> = (\n handler,\n opts,\n paramsFns,\n returnFns,\n paramsId,\n returnId,\n isAsyncId,\n syncId\n) => ({\n type: HandlerType.middleware,\n handler,\n options: opts,\n rtFns: {paramsFns, returnFns, paramsId, returnId, isAsyncId, syncId},\n});\n\nexport const headersMiddleware: HeadersMiddlewareHelper<RouterOptionsInput> = (\n handler,\n opts,\n headersFns,\n paramsFns,\n returnFns,\n headersId,\n paramsId,\n returnId,\n isAsyncId,\n syncId\n) => ({\n type: HandlerType.headersMiddleware,\n handler,\n options: opts,\n rtFns: {paramsFns, returnFns, paramsId, returnId, isAsyncId, syncId, headersFns, headersId},\n});\n\nexport const rawMiddleware: RawMiddlewareHelper<RouterOptionsInput> = (handler, opts) => ({\n type: HandlerType.rawMiddleware,\n handler,\n options: opts,\n});\n\n/** Each on-demand middleware, with what it does on every call even without its slot. */\nconst onDemandMiddlewares = new WeakMap<object, OnEveryCall | undefined>();\ntype OnEveryCall = (ctx: CallContext) => void;\n\n/** Internal: the middleware runs only when the request body carries its slot, so an absent slot costs nothing */\nexport function markOnDemand<Def extends object>(def: Def, onEveryCall?: OnEveryCall): Def {\n onDemandMiddlewares.set(def, onEveryCall);\n return def;\n}\n\nexport function isOnDemandMiddleware(def: object): boolean {\n return onDemandMiddlewares.has(def);\n}\n\nexport function getOnEveryCall(def: object): OnEveryCall | undefined {\n return onDemandMiddlewares.get(def);\n}\n\n/** mion's own ids, never exposed to clients */\nexport const mionInternalRouteIds: ReadonlySet<string> = new Set(Object.values(MION_ROUTES));\n"],"mappings":";;AA4BA,IAAa,SACX,SACA,MACA,WACA,WACA,UACA,UACA,WACA,YACI;CACJ,MAAM,YAAY;CAClB;CACA,SAAS;CACT,OAAO;EAAC;EAAW;EAAW;EAAU;EAAU;EAAW;CAAM;AACrE;;AAGA,SAAS,kBAAqC,YAAmD;CAC/F,QAAQ,SAAS,MAAM,WAAW,WAAW,UAAU,UAAU,WAAW,YAAY;EACtF,MAAM,YAAY;EAClB;EACA,SAAS;GAAC,GAAG;GAAM;EAAU;EAC7B,OAAO;GAAC;GAAW;GAAW;GAAU;GAAU;GAAW;EAAM;CACrE;AACF;;AAGA,IAAa,QAAQ,kBAAkB,KAAK;AAE5C,IAAa,WAAW,kBAAkB,IAAI;AAE9C,IAAa,cACX,SACA,MACA,WACA,WACA,UACA,UACA,WACA,YACI;CACJ,MAAM,YAAY;CAClB;CACA,SAAS;CACT,OAAO;EAAC;EAAW;EAAW;EAAU;EAAU;EAAW;CAAM;AACrE;AAEA,IAAa,qBACX,SACA,MACA,YACA,WACA,WACA,WACA,UACA,UACA,WACA,YACI;CACJ,MAAM,YAAY;CAClB;CACA,SAAS;CACT,OAAO;EAAC;EAAW;EAAW;EAAU;EAAU;EAAW;EAAQ;EAAY;CAAS;AAC5F;AAEA,IAAa,iBAA0D,SAAS,UAAU;CACxF,MAAM,YAAY;CAClB;CACA,SAAS;AACX;;AAGA,IAAM,sCAAsB,IAAI,QAAyC;;AAIzE,SAAgB,aAAiC,KAAU,aAAgC;CACzF,oBAAoB,IAAI,KAAK,WAAW;CACxC,OAAO;AACT;AAEA,SAAgB,qBAAqB,KAAsB;CACzD,OAAO,oBAAoB,IAAI,GAAG;AACpC;AAEA,SAAgB,eAAe,KAAsC;CACnE,OAAO,oBAAoB,IAAI,GAAG;AACpC;;AAGA,IAAa,uBAA4C,IAAI,IAAI,OAAO,OAAO,WAAW,CAAC"}
|
|
@@ -1,3 +1,42 @@
|
|
|
1
|
-
import { MionHeaders } from '../types/context.ts';
|
|
1
|
+
import { MionHeaders, MionResponse, PooledHeaders, ResponseDefaults } from '../types/context.ts';
|
|
2
|
+
type HeadersRecord = Record<string, string | string[]>;
|
|
3
|
+
declare class MionHeadersImpl implements MionHeaders {
|
|
4
|
+
protected headers: HeadersRecord;
|
|
5
|
+
unused: boolean;
|
|
6
|
+
constructor(headers: HeadersRecord);
|
|
7
|
+
append(name: string, value: string): void;
|
|
8
|
+
delete(name: string): void;
|
|
9
|
+
get(name: string): string | undefined | null;
|
|
10
|
+
set(name: string, value: string): void;
|
|
11
|
+
has(name: string): boolean;
|
|
12
|
+
entries(): IterableIterator<[string, string]>;
|
|
13
|
+
keys(): IterableIterator<string>;
|
|
14
|
+
values(): IterableIterator<string>;
|
|
15
|
+
}
|
|
16
|
+
export declare class RecordResponseHeaders extends MionHeadersImpl implements PooledHeaders {
|
|
17
|
+
readonly defaults: ResponseDefaults;
|
|
18
|
+
constructor(defaults: ResponseDefaults);
|
|
19
|
+
append(name: string, value: string): void;
|
|
20
|
+
forEach(visit: (name: string, value: string | string[]) => void): void;
|
|
21
|
+
}
|
|
22
|
+
export declare class FetchResponseHeaders implements PooledHeaders {
|
|
23
|
+
readonly defaults: ResponseDefaults;
|
|
24
|
+
readonly native: import('undici-types').Headers;
|
|
25
|
+
unused: boolean;
|
|
26
|
+
constructor(defaults: ResponseDefaults);
|
|
27
|
+
set(name: string, value: string): void;
|
|
28
|
+
append(name: string, value: string): void;
|
|
29
|
+
delete(name: string): void;
|
|
30
|
+
get(name: string): string | null;
|
|
31
|
+
has(name: string): boolean;
|
|
32
|
+
entries(): IterableIterator<[string, string]>;
|
|
33
|
+
keys(): IterableIterator<string>;
|
|
34
|
+
values(): IterableIterator<string>;
|
|
35
|
+
}
|
|
36
|
+
export declare const getDefaultHeaders: () => RecordResponseHeaders;
|
|
37
|
+
export declare const getDefaultFetchHeaders: () => FetchResponseHeaders;
|
|
38
|
+
export declare const releaseHeaders: (headers: RecordResponseHeaders) => void;
|
|
39
|
+
export declare function replyFetch(mionResp: MionResponse, headers: FetchResponseHeaders): Response;
|
|
2
40
|
export declare function headersFromRecord(headersObj: Record<string, string>, skipToLower?: boolean): MionHeaders;
|
|
41
|
+
export {};
|
|
3
42
|
//# sourceMappingURL=headers.d.ts.map
|
|
@@ -1,64 +1,174 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
1
|
+
import "../constants.js";
|
|
2
|
+
import { getResponseDefaults } from "../router.js";
|
|
3
|
+
//#region src/lib/headers.ts
|
|
4
|
+
var PROTO_KEY = "__proto__";
|
|
5
|
+
/** Case-insensitive HTTP headers, like the fetch Headers API but optimized for performance.
|
|
6
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Headers */
|
|
7
|
+
var MionHeadersImpl = class {
|
|
8
|
+
headers;
|
|
9
|
+
/** Read by the response headers pool only; request headers ignore it. */
|
|
10
|
+
unused = true;
|
|
11
|
+
constructor(headers) {
|
|
12
|
+
this.headers = headers;
|
|
13
|
+
}
|
|
14
|
+
append(name, value) {
|
|
15
|
+
this.unused = false;
|
|
16
|
+
const nl = name.toLowerCase();
|
|
17
|
+
if (nl === PROTO_KEY) return;
|
|
18
|
+
const existing = readHeader(this.headers, nl);
|
|
19
|
+
const headerValue = toSingleHeader(value);
|
|
20
|
+
if (existing) this.headers[nl] = `${existing}, ${headerValue}`;
|
|
21
|
+
else this.headers[nl] = headerValue;
|
|
22
|
+
}
|
|
23
|
+
delete(name) {
|
|
24
|
+
this.unused = false;
|
|
25
|
+
delete this.headers[name.toLowerCase()];
|
|
26
|
+
}
|
|
27
|
+
get(name) {
|
|
28
|
+
return readHeader(this.headers, name.toLowerCase());
|
|
29
|
+
}
|
|
30
|
+
set(name, value) {
|
|
31
|
+
this.unused = false;
|
|
32
|
+
const ln = name.toLowerCase();
|
|
33
|
+
if (ln === PROTO_KEY) return;
|
|
34
|
+
this.headers[ln] = value;
|
|
35
|
+
}
|
|
36
|
+
has(name) {
|
|
37
|
+
return !!readHeader(this.headers, name.toLowerCase());
|
|
38
|
+
}
|
|
39
|
+
entries() {
|
|
40
|
+
return Object.entries(this.headers).map(([name, value]) => [name, joined(value)]).values();
|
|
41
|
+
}
|
|
42
|
+
keys() {
|
|
43
|
+
return new Map(Object.entries(this.headers)).keys();
|
|
44
|
+
}
|
|
45
|
+
values() {
|
|
46
|
+
return Object.values(this.headers).map(joined).values();
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
/** Response headers over a copy of the defaults, for an adapter that answers from a header record (uws, aws). */
|
|
50
|
+
var RecordResponseHeaders = class extends MionHeadersImpl {
|
|
51
|
+
defaults;
|
|
52
|
+
constructor(defaults) {
|
|
53
|
+
super({ ...defaults });
|
|
54
|
+
this.defaults = defaults;
|
|
55
|
+
}
|
|
56
|
+
/** Keeps a repeated name's values apart, never joined: the adapter writes them its own way. */
|
|
57
|
+
append(name, value) {
|
|
58
|
+
this.unused = false;
|
|
59
|
+
const key = name.toLowerCase();
|
|
60
|
+
if (key === PROTO_KEY) return;
|
|
61
|
+
const current = this.headers[key];
|
|
62
|
+
if (Array.isArray(current)) current.push(value);
|
|
63
|
+
else if (typeof current === "string" && current) this.headers[key] = [current, value];
|
|
64
|
+
else this.headers[key] = value;
|
|
65
|
+
}
|
|
66
|
+
/** Walks the headers with no pair array per header; a repeated name gives its values apart. */
|
|
67
|
+
forEach(visit) {
|
|
68
|
+
for (const name in this.headers) visit(name, this.headers[name]);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
/** The response headers of the fetch adapters (bun, cloudflare, vercel). */
|
|
72
|
+
var FetchResponseHeaders = class {
|
|
73
|
+
defaults;
|
|
74
|
+
/** What the reply hands to `Response`, which copies it. */
|
|
75
|
+
native = new Headers();
|
|
76
|
+
unused = true;
|
|
77
|
+
constructor(defaults) {
|
|
78
|
+
this.defaults = defaults;
|
|
79
|
+
for (const name in defaults) this.native.set(name, defaults[name]);
|
|
80
|
+
}
|
|
81
|
+
set(name, value) {
|
|
82
|
+
this.unused = false;
|
|
83
|
+
this.native.set(name, value);
|
|
84
|
+
}
|
|
85
|
+
append(name, value) {
|
|
86
|
+
this.unused = false;
|
|
87
|
+
this.native.append(name, value);
|
|
88
|
+
}
|
|
89
|
+
delete(name) {
|
|
90
|
+
this.unused = false;
|
|
91
|
+
this.native.delete(name);
|
|
92
|
+
}
|
|
93
|
+
get(name) {
|
|
94
|
+
return this.native.get(name);
|
|
95
|
+
}
|
|
96
|
+
has(name) {
|
|
97
|
+
return this.native.has(name);
|
|
98
|
+
}
|
|
99
|
+
entries() {
|
|
100
|
+
return this.native.entries();
|
|
101
|
+
}
|
|
102
|
+
keys() {
|
|
103
|
+
return this.native.keys();
|
|
104
|
+
}
|
|
105
|
+
values() {
|
|
106
|
+
return this.native.values();
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
var MAX_UNUSED_HEADERS = 256;
|
|
110
|
+
var unusedRecordHeaders = [];
|
|
111
|
+
var unusedFetchHeaders = [];
|
|
112
|
+
var newRecordHeaders = (defaults) => new RecordResponseHeaders(defaults);
|
|
113
|
+
var newFetchHeaders = (defaults) => new FetchResponseHeaders(defaults);
|
|
114
|
+
/** Response headers holding the defaults and nothing else, from the pool or new. */
|
|
115
|
+
var getDefaultHeaders = () => takeUnused(unusedRecordHeaders, newRecordHeaders);
|
|
116
|
+
/** Like `getDefaultHeaders`, over a native `Headers` for the fetch adapters. */
|
|
117
|
+
var getDefaultFetchHeaders = () => takeUnused(unusedFetchHeaders, newFetchHeaders);
|
|
118
|
+
/** Gives headers back once the reply is sent; written ones are dropped. */
|
|
119
|
+
var releaseHeaders = (headers) => giveBackUnused(unusedRecordHeaders, headers);
|
|
120
|
+
function takeUnused(pool, create) {
|
|
121
|
+
const defaults = getResponseDefaults();
|
|
122
|
+
const headers = pool.pop();
|
|
123
|
+
if (headers?.defaults === defaults) return headers;
|
|
124
|
+
pool.length = 0;
|
|
125
|
+
return create(defaults);
|
|
126
|
+
}
|
|
127
|
+
function giveBackUnused(pool, headers) {
|
|
128
|
+
if (headers.unused && pool.length < MAX_UNUSED_HEADERS) pool.push(headers);
|
|
40
129
|
}
|
|
130
|
+
function replyFetch(mionResp, headers) {
|
|
131
|
+
if (!headers.unused || mionResp.contentType !== "application/json; charset=utf-8") headers.set("content-type", mionResp.contentType);
|
|
132
|
+
const response = Response.json(mionResp.body, {
|
|
133
|
+
status: mionResp.statusCode,
|
|
134
|
+
headers: headers.native
|
|
135
|
+
});
|
|
136
|
+
giveBackUnused(unusedFetchHeaders, headers);
|
|
137
|
+
return response;
|
|
138
|
+
}
|
|
139
|
+
/** A fetch-like (not identical) Headers object over a header record, for an incoming request carrying its
|
|
140
|
+
* headers as an object: IncomingMessage.headers, ApiGatewayEvent.headers.
|
|
141
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Headers */
|
|
41
142
|
function headersFromRecord(headersObj, skipToLower = false) {
|
|
42
|
-
|
|
43
|
-
|
|
143
|
+
return new MionHeadersImpl(parseHeaders(headersObj, skipToLower));
|
|
144
|
+
}
|
|
145
|
+
/** A header value, or undefined for a name the record does not carry as an own string (a prototype
|
|
146
|
+
* hit is a function or an object). A platform record may hold an array (node's `set-cookie`). */
|
|
147
|
+
function readHeader(headers, lowerName) {
|
|
148
|
+
const value = headers[lowerName];
|
|
149
|
+
if (typeof value === "string") return value;
|
|
150
|
+
return Array.isArray(value) ? value.join(", ") : void 0;
|
|
151
|
+
}
|
|
152
|
+
function joined(value) {
|
|
153
|
+
return Array.isArray(value) ? value.join(", ") : value;
|
|
44
154
|
}
|
|
45
155
|
function toSingleHeader(value) {
|
|
46
|
-
|
|
47
|
-
|
|
156
|
+
if (Array.isArray(value)) return value.join(", ");
|
|
157
|
+
return value;
|
|
48
158
|
}
|
|
49
159
|
function parseHeaders(headersObj, skipToLower = false) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
160
|
+
if (skipToLower) return headersObj;
|
|
161
|
+
const entries = Object.entries(headersObj);
|
|
162
|
+
const headers = Object.create(null);
|
|
163
|
+
for (let i = 0; i < entries.length; i++) {
|
|
164
|
+
const [name, value] = entries[i];
|
|
165
|
+
if (!value) continue;
|
|
166
|
+
const ln = name.toLowerCase();
|
|
167
|
+
headers[ln] = toSingleHeader(value);
|
|
168
|
+
}
|
|
169
|
+
return headers;
|
|
60
170
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
//# sourceMappingURL=headers.js.map
|
|
171
|
+
//#endregion
|
|
172
|
+
export { FetchResponseHeaders, RecordResponseHeaders, getDefaultFetchHeaders, getDefaultHeaders, headersFromRecord, releaseHeaders, replyFetch };
|
|
173
|
+
|
|
174
|
+
//# sourceMappingURL=headers.js.map
|