@geekmidas/constructs 0.0.11 → 0.0.13
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/README.md +448 -0
- package/dist/AWSLambdaFunction-B-Oxr8qt.d.cts +30 -0
- package/dist/{AWSLambdaFunction-DcI_77u8.cjs → AWSLambdaFunction-C-fuCLA3.cjs} +28 -5
- package/dist/AWSLambdaFunction-C-fuCLA3.cjs.map +1 -0
- package/dist/AWSLambdaFunction-CAm9r5ZX.d.mts +30 -0
- package/dist/{AWSLambdaFunction-BTSGYZSx.mjs → AWSLambdaFunction-H65WfXLt.mjs} +28 -5
- package/dist/AWSLambdaFunction-H65WfXLt.mjs.map +1 -0
- package/dist/{AWSLambdaSubscriberAdaptor-mLOpS63x.d.mts → AWSLambdaSubscriberAdaptor-Cknp_nn1.d.cts} +4 -4
- package/dist/{AWSLambdaSubscriberAdaptor-G8y3YkWj.mjs → AWSLambdaSubscriberAdaptor-CyFh7MN8.mjs} +1 -1
- package/dist/{AWSLambdaSubscriberAdaptor-G8y3YkWj.mjs.map → AWSLambdaSubscriberAdaptor-CyFh7MN8.mjs.map} +1 -1
- package/dist/{AWSLambdaSubscriberAdaptor-DX5NFdWf.d.cts → AWSLambdaSubscriberAdaptor-DpHzp-AM.d.mts} +4 -4
- package/dist/{AWSLambdaSubscriberAdaptor-CmPZ10JF.cjs → AWSLambdaSubscriberAdaptor-Dum5bkw3.cjs} +1 -1
- package/dist/{AWSLambdaSubscriberAdaptor-CmPZ10JF.cjs.map → AWSLambdaSubscriberAdaptor-Dum5bkw3.cjs.map} +1 -1
- package/dist/{AmazonApiGatewayEndpointAdaptor-CATWBIJo.d.mts → AmazonApiGatewayEndpointAdaptor-4hPy5vty.d.mts} +9 -8
- package/dist/{AmazonApiGatewayEndpointAdaptor-vi0D3dWg.mjs → AmazonApiGatewayEndpointAdaptor-C6Jk5HSy.mjs} +51 -16
- package/dist/AmazonApiGatewayEndpointAdaptor-C6Jk5HSy.mjs.map +1 -0
- package/dist/{AmazonApiGatewayEndpointAdaptor-BTqB3c1_.cjs → AmazonApiGatewayEndpointAdaptor-CI9L7Ucn.cjs} +51 -16
- package/dist/AmazonApiGatewayEndpointAdaptor-CI9L7Ucn.cjs.map +1 -0
- package/dist/{AmazonApiGatewayEndpointAdaptor-BwtDtS-i.d.cts → AmazonApiGatewayEndpointAdaptor-ro0RMLzr.d.cts} +8 -7
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-D2_u_zR6.mjs → AmazonApiGatewayV1EndpointAdaptor-BMy8DdNJ.mjs} +3 -3
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-D2_u_zR6.mjs.map → AmazonApiGatewayV1EndpointAdaptor-BMy8DdNJ.mjs.map} +1 -1
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-B1AVk2MM.d.cts → AmazonApiGatewayV1EndpointAdaptor-BWJWKqQT.d.cts} +3 -3
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-nwrtG5L9.cjs → AmazonApiGatewayV1EndpointAdaptor-DYL1bCBS.cjs} +3 -3
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-nwrtG5L9.cjs.map → AmazonApiGatewayV1EndpointAdaptor-DYL1bCBS.cjs.map} +1 -1
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-2Rd0LLz4.d.mts → AmazonApiGatewayV1EndpointAdaptor-hyR-WwyP.d.mts} +4 -4
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-DoWAJ9oN.mjs → AmazonApiGatewayV2EndpointAdaptor-BU5wQMOe.mjs} +3 -3
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-DoWAJ9oN.mjs.map → AmazonApiGatewayV2EndpointAdaptor-BU5wQMOe.mjs.map} +1 -1
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-FSIdXYV6.cjs → AmazonApiGatewayV2EndpointAdaptor-CPLCMeaN.cjs} +3 -3
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-FSIdXYV6.cjs.map → AmazonApiGatewayV2EndpointAdaptor-CPLCMeaN.cjs.map} +1 -1
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-DmY_QfjO.d.cts → AmazonApiGatewayV2EndpointAdaptor-D1Irdggp.d.cts} +3 -3
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-cBDfwdBx.d.mts → AmazonApiGatewayV2EndpointAdaptor-DX3SuI5S.d.mts} +4 -4
- package/dist/{Authorizer-Bbk9ziuG.d.mts → Authorizer-BTmly8ps.d.cts} +1 -1
- package/dist/{Authorizer-iXsSB600.d.cts → Authorizer-pmPvIVgv.d.mts} +1 -1
- package/dist/{BaseFunctionBuilder-DSqF1r3a.mjs → BaseFunctionBuilder-B5gkW0Kt.mjs} +16 -2
- package/dist/BaseFunctionBuilder-B5gkW0Kt.mjs.map +1 -0
- package/dist/{BaseFunctionBuilder-bTDKP7bd.cjs → BaseFunctionBuilder-C5Se7pdL.cjs} +16 -2
- package/dist/BaseFunctionBuilder-C5Se7pdL.cjs.map +1 -0
- package/dist/{BaseFunctionBuilder-DOcm1heZ.d.mts → BaseFunctionBuilder-CbDnPZpD.d.mts} +13 -4
- package/dist/{BaseFunctionBuilder-hWNVKXQB.d.cts → BaseFunctionBuilder-DUZMbEr3.d.cts} +13 -4
- package/dist/{Construct-XCGKof_O.cjs → Construct-BYSPikVm.cjs} +8 -3
- package/dist/Construct-BYSPikVm.cjs.map +1 -0
- package/dist/{Construct-rZQg2yus.mjs → Construct-LWeB1rSQ.mjs} +8 -3
- package/dist/Construct-LWeB1rSQ.mjs.map +1 -0
- package/dist/{Construct-iDmbkZ3o.d.mts → Construct-ZPqE0vhn.d.mts} +5 -3
- package/dist/{Construct-zc8BkRSp.d.cts → Construct-dI_rgdSp.d.cts} +5 -3
- package/dist/Construct.cjs +1 -1
- package/dist/Construct.d.cts +1 -1
- package/dist/Construct.d.mts +1 -1
- package/dist/Construct.mjs +1 -1
- package/dist/{Cron-CYIhd0VE.cjs → Cron-Bi3QOge_.cjs} +5 -5
- package/dist/Cron-Bi3QOge_.cjs.map +1 -0
- package/dist/{Cron-D5HGEt6g.d.mts → Cron-COdfP0Jd.d.cts} +5 -5
- package/dist/{Cron-DbJNPTbP.d.cts → Cron-D8cn_ahj.d.mts} +5 -5
- package/dist/{Cron-BnO1uXhh.mjs → Cron-Dy_HW2Vv.mjs} +5 -5
- package/dist/Cron-Dy_HW2Vv.mjs.map +1 -0
- package/dist/{CronBuilder-BxKwHCdJ.mjs → CronBuilder-Bl3A2Zp4.mjs} +15 -6
- package/dist/CronBuilder-Bl3A2Zp4.mjs.map +1 -0
- package/dist/{CronBuilder-D-546XtP.d.cts → CronBuilder-DntF6H3A.d.cts} +17 -12
- package/dist/{CronBuilder-vRiZb1_N.d.mts → CronBuilder-DoMnSs_0.d.mts} +17 -12
- package/dist/{CronBuilder-D_3AiPFO.cjs → CronBuilder-Dv_w7Yri.cjs} +15 -6
- package/dist/CronBuilder-Dv_w7Yri.cjs.map +1 -0
- package/dist/{Endpoint-DqZkc6ft.d.mts → Endpoint-Bbs_sFvg.d.mts} +120 -23
- package/dist/{Endpoint-BpTSQn7W.d.cts → Endpoint-Bu8Phz6y.d.cts} +120 -23
- package/dist/{Endpoint-BdIGWw1H.cjs → Endpoint-DDpF7NO1.cjs} +22 -10
- package/dist/Endpoint-DDpF7NO1.cjs.map +1 -0
- package/dist/{Endpoint-ChzcIFdV.mjs → Endpoint-S6Yh2_PN.mjs} +22 -10
- package/dist/Endpoint-S6Yh2_PN.mjs.map +1 -0
- package/dist/EndpointBuilder-CPxmF_w7.d.cts +103 -0
- package/dist/EndpointBuilder-Csfyfjd7.d.mts +103 -0
- package/dist/{EndpointBuilder-dmMiNRm9.cjs → EndpointBuilder-DpGmObMb.cjs} +68 -5
- package/dist/EndpointBuilder-DpGmObMb.cjs.map +1 -0
- package/dist/{EndpointBuilder-yo40Qkf_.mjs → EndpointBuilder-aE2E6WTx.mjs} +68 -5
- package/dist/EndpointBuilder-aE2E6WTx.mjs.map +1 -0
- package/dist/{EndpointFactory-D_mmO7Gu.d.mts → EndpointFactory-Bf9JSWzI.d.cts} +12 -11
- package/dist/{EndpointFactory-CNbcr8u_.cjs → EndpointFactory-BfH6mjJ3.cjs} +3 -3
- package/dist/EndpointFactory-BfH6mjJ3.cjs.map +1 -0
- package/dist/{EndpointFactory-JPhk0Qom.d.cts → EndpointFactory-Cgk1R0oO.d.mts} +12 -11
- package/dist/{EndpointFactory-LD3upVQK.mjs → EndpointFactory-D4leYk1N.mjs} +3 -3
- package/dist/EndpointFactory-D4leYk1N.mjs.map +1 -0
- package/dist/{Function-DDaSfL_E.cjs → Function-DagDbeXo.cjs} +7 -6
- package/dist/Function-DagDbeXo.cjs.map +1 -0
- package/dist/{Function-Cl9fiR3a.mjs → Function-DfKsM5Kx.mjs} +7 -6
- package/dist/Function-DfKsM5Kx.mjs.map +1 -0
- package/dist/{Function-C-5_23Wi.d.mts → Function-V9M9UVHp.d.mts} +25 -7
- package/dist/{Function-CW-WcZTu.d.cts → Function-VI1TB3Mh.d.cts} +25 -7
- package/dist/{FunctionBuilder-vW12WFOw.mjs → FunctionBuilder-CVT7bG2o.mjs} +27 -6
- package/dist/FunctionBuilder-CVT7bG2o.mjs.map +1 -0
- package/dist/FunctionBuilder-CjVEFTYC.d.cts +38 -0
- package/dist/FunctionBuilder-D1ofSeMd.d.mts +38 -0
- package/dist/{FunctionBuilder-LQuBiqRc.cjs → FunctionBuilder-DXvG_XD-.cjs} +27 -6
- package/dist/FunctionBuilder-DXvG_XD-.cjs.map +1 -0
- package/dist/FunctionExecutionWrapper-Bubnr0zA.mjs +101 -0
- package/dist/FunctionExecutionWrapper-Bubnr0zA.mjs.map +1 -0
- package/dist/FunctionExecutionWrapper-CwtwYozd.d.cts +48 -0
- package/dist/FunctionExecutionWrapper-DkNycmOh.cjs +107 -0
- package/dist/FunctionExecutionWrapper-DkNycmOh.cjs.map +1 -0
- package/dist/FunctionExecutionWrapper-rhbIYT0Q.d.mts +48 -0
- package/dist/{HonoEndpointAdaptor-BVQtyvna.d.cts → HonoEndpointAdaptor-B34kNobH.d.cts} +8 -7
- package/dist/{HonoEndpointAdaptor-W-disJnm.d.mts → HonoEndpointAdaptor-BDpi32mH.d.mts} +9 -8
- package/dist/{HonoEndpointAdaptor-Bc61IS6Q.cjs → HonoEndpointAdaptor-CfLRHHFw.cjs} +55 -20
- package/dist/HonoEndpointAdaptor-CfLRHHFw.cjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-NR3h5gml.mjs → HonoEndpointAdaptor-DuyE06nH.mjs} +55 -20
- package/dist/HonoEndpointAdaptor-DuyE06nH.mjs.map +1 -0
- package/dist/{Subscriber-C2OPATI8.cjs → Subscriber-Bdh8rMSL.cjs} +2 -2
- package/dist/{Subscriber-C2OPATI8.cjs.map → Subscriber-Bdh8rMSL.cjs.map} +1 -1
- package/dist/{Subscriber-BVq3ST4C.d.cts → Subscriber-BhzqUzs-.d.cts} +2 -2
- package/dist/{Subscriber-BKftCzwT.mjs → Subscriber-CJOWwaw1.mjs} +2 -2
- package/dist/{Subscriber-BKftCzwT.mjs.map → Subscriber-CJOWwaw1.mjs.map} +1 -1
- package/dist/{Subscriber-BuHaqWo4.d.mts → Subscriber-s6yfjeOc.d.mts} +2 -2
- package/dist/{SubscriberBuilder-2asHtGbl.d.mts → SubscriberBuilder-BCVkp-ga.d.cts} +3 -3
- package/dist/{SubscriberBuilder-yDfpHPZE.mjs → SubscriberBuilder-BWQmiYd8.mjs} +2 -2
- package/dist/{SubscriberBuilder-yDfpHPZE.mjs.map → SubscriberBuilder-BWQmiYd8.mjs.map} +1 -1
- package/dist/{SubscriberBuilder-yikoQ8ND.cjs → SubscriberBuilder-DieD_60p.cjs} +2 -2
- package/dist/{SubscriberBuilder-yikoQ8ND.cjs.map → SubscriberBuilder-DieD_60p.cjs.map} +1 -1
- package/dist/{SubscriberBuilder-CHIRyNjy.d.cts → SubscriberBuilder-aCua5_wA.d.mts} +3 -3
- package/dist/{TestEndpointAdaptor-DpmNXp7G.mjs → TestEndpointAdaptor-BEyZa0Yg.mjs} +51 -18
- package/dist/TestEndpointAdaptor-BEyZa0Yg.mjs.map +1 -0
- package/dist/{TestEndpointAdaptor-DA1D6l-U.cjs → TestEndpointAdaptor-C8425RJ0.cjs} +51 -18
- package/dist/TestEndpointAdaptor-C8425RJ0.cjs.map +1 -0
- package/dist/{TestEndpointAdaptor-BrE5Rs4U.d.cts → TestEndpointAdaptor-H5To8PH7.d.cts} +6 -5
- package/dist/{TestEndpointAdaptor-B10J-cI-.d.mts → TestEndpointAdaptor-jxn68ayg.d.mts} +7 -6
- package/dist/adaptors/aws.cjs +14 -13
- package/dist/adaptors/aws.d.cts +14 -14
- package/dist/adaptors/aws.d.mts +15 -15
- package/dist/adaptors/aws.mjs +14 -13
- package/dist/adaptors/hono.cjs +10 -9
- package/dist/adaptors/hono.d.cts +8 -8
- package/dist/adaptors/hono.d.mts +9 -9
- package/dist/adaptors/hono.mjs +10 -9
- package/dist/adaptors/testing.cjs +8 -7
- package/dist/adaptors/testing.d.cts +8 -8
- package/dist/adaptors/testing.d.mts +9 -9
- package/dist/adaptors/testing.mjs +8 -7
- package/dist/crons/Cron.cjs +6 -6
- package/dist/crons/Cron.d.cts +6 -6
- package/dist/crons/Cron.d.mts +6 -6
- package/dist/crons/Cron.mjs +6 -6
- package/dist/crons/CronBuilder.cjs +7 -7
- package/dist/crons/CronBuilder.d.cts +7 -7
- package/dist/crons/CronBuilder.d.mts +7 -7
- package/dist/crons/CronBuilder.mjs +7 -7
- package/dist/crons/index.cjs +7 -7
- package/dist/crons/index.d.cts +11 -11
- package/dist/crons/index.d.mts +8 -8
- package/dist/crons/index.mjs +7 -7
- package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.cjs +8 -7
- package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.d.cts +8 -8
- package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.d.mts +9 -9
- package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.mjs +8 -7
- package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.cjs +10 -9
- package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.d.cts +9 -9
- package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.d.mts +10 -10
- package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.mjs +10 -9
- package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.cjs +10 -9
- package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.d.cts +9 -9
- package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.d.mts +10 -10
- package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.mjs +10 -9
- package/dist/endpoints/Authorizer.d.cts +1 -1
- package/dist/endpoints/Authorizer.d.mts +1 -1
- package/dist/endpoints/Endpoint.cjs +6 -6
- package/dist/endpoints/Endpoint.d.cts +7 -7
- package/dist/endpoints/Endpoint.d.mts +8 -8
- package/dist/endpoints/Endpoint.mjs +6 -6
- package/dist/endpoints/EndpointBuilder.cjs +7 -7
- package/dist/endpoints/EndpointBuilder.d.cts +8 -8
- package/dist/endpoints/EndpointBuilder.d.mts +9 -9
- package/dist/endpoints/EndpointBuilder.mjs +7 -7
- package/dist/endpoints/EndpointFactory.cjs +8 -8
- package/dist/endpoints/EndpointFactory.d.cts +9 -9
- package/dist/endpoints/EndpointFactory.d.mts +10 -10
- package/dist/endpoints/EndpointFactory.mjs +8 -8
- package/dist/endpoints/HonoEndpointAdaptor.cjs +10 -9
- package/dist/endpoints/HonoEndpointAdaptor.d.cts +8 -8
- package/dist/endpoints/HonoEndpointAdaptor.d.mts +9 -9
- package/dist/endpoints/HonoEndpointAdaptor.mjs +10 -9
- package/dist/endpoints/TestEndpointAdaptor.cjs +8 -7
- package/dist/endpoints/TestEndpointAdaptor.d.cts +8 -8
- package/dist/endpoints/TestEndpointAdaptor.d.mts +9 -9
- package/dist/endpoints/TestEndpointAdaptor.mjs +8 -7
- package/dist/endpoints/audit.cjs +0 -0
- package/dist/endpoints/audit.d.cts +9 -0
- package/dist/endpoints/audit.d.mts +9 -0
- package/dist/endpoints/audit.mjs +0 -0
- package/dist/endpoints/helpers.cjs +7 -7
- package/dist/endpoints/helpers.d.cts +7 -7
- package/dist/endpoints/helpers.d.mts +8 -8
- package/dist/endpoints/helpers.mjs +7 -7
- package/dist/endpoints/index.cjs +8 -8
- package/dist/endpoints/index.cjs.map +1 -1
- package/dist/endpoints/index.d.cts +12 -12
- package/dist/endpoints/index.d.mts +13 -13
- package/dist/endpoints/index.mjs +8 -8
- package/dist/endpoints/index.mjs.map +1 -1
- package/dist/endpoints/parseHonoQuery.cjs +1 -1
- package/dist/endpoints/parseHonoQuery.mjs +1 -1
- package/dist/endpoints/parseQueryParams.cjs +1 -1
- package/dist/endpoints/parseQueryParams.mjs +1 -1
- package/dist/endpoints/processAudits.cjs +5 -0
- package/dist/endpoints/processAudits.d.cts +74 -0
- package/dist/endpoints/processAudits.d.mts +74 -0
- package/dist/endpoints/processAudits.mjs +3 -0
- package/dist/functions/AWSLambdaFunction.cjs +6 -6
- package/dist/functions/AWSLambdaFunction.d.cts +4 -4
- package/dist/functions/AWSLambdaFunction.d.mts +4 -4
- package/dist/functions/AWSLambdaFunction.mjs +6 -6
- package/dist/functions/BaseFunctionBuilder.cjs +2 -2
- package/dist/functions/BaseFunctionBuilder.d.cts +2 -2
- package/dist/functions/BaseFunctionBuilder.d.mts +2 -2
- package/dist/functions/BaseFunctionBuilder.mjs +2 -2
- package/dist/functions/Function.cjs +2 -2
- package/dist/functions/Function.d.cts +2 -2
- package/dist/functions/Function.d.mts +2 -2
- package/dist/functions/Function.mjs +2 -2
- package/dist/functions/FunctionBuilder.cjs +4 -4
- package/dist/functions/FunctionBuilder.d.cts +4 -4
- package/dist/functions/FunctionBuilder.d.mts +4 -4
- package/dist/functions/FunctionBuilder.mjs +4 -4
- package/dist/functions/FunctionExecutionWrapper.cjs +5 -5
- package/dist/functions/FunctionExecutionWrapper.d.cts +3 -3
- package/dist/functions/FunctionExecutionWrapper.d.mts +3 -3
- package/dist/functions/FunctionExecutionWrapper.mjs +5 -5
- package/dist/functions/TestFunctionAdaptor.cjs +38 -5
- package/dist/functions/TestFunctionAdaptor.cjs.map +1 -1
- package/dist/functions/TestFunctionAdaptor.d.cts +10 -7
- package/dist/functions/TestFunctionAdaptor.d.mts +10 -7
- package/dist/functions/TestFunctionAdaptor.mjs +38 -5
- package/dist/functions/TestFunctionAdaptor.mjs.map +1 -1
- package/dist/functions/index.cjs +5 -5
- package/dist/functions/index.d.cts +5 -5
- package/dist/functions/index.d.mts +5 -5
- package/dist/functions/index.mjs +5 -5
- package/dist/{functions-yg097ymU.cjs → functions-FCb-wWFC.cjs} +2 -2
- package/dist/{functions-yg097ymU.cjs.map → functions-FCb-wWFC.cjs.map} +1 -1
- package/dist/functions-JhRsNoAZ.mjs +8 -0
- package/dist/{functions-HCoZ4YKF.mjs.map → functions-JhRsNoAZ.mjs.map} +1 -1
- package/dist/{helpers-CHsIWAEx.mjs → helpers-2CLKTnRm.mjs} +2 -2
- package/dist/{helpers-CHsIWAEx.mjs.map → helpers-2CLKTnRm.mjs.map} +1 -1
- package/dist/{helpers-Cq6wjo7s.cjs → helpers-Khuhi_Qx.cjs} +2 -2
- package/dist/{helpers-Cq6wjo7s.cjs.map → helpers-Khuhi_Qx.cjs.map} +1 -1
- package/dist/index-Bomy7R9z.d.mts +10 -0
- package/dist/index-DRYfZHb3.d.cts +10 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/{parseHonoQuery-DopC24vB.cjs → parseHonoQuery-CT8Cvin-.cjs} +1 -1
- package/dist/{parseHonoQuery-DopC24vB.cjs.map → parseHonoQuery-CT8Cvin-.cjs.map} +1 -1
- package/dist/{parseHonoQuery-znDKBhdE.mjs → parseHonoQuery-CwFKw2ua.mjs} +1 -1
- package/dist/{parseHonoQuery-znDKBhdE.mjs.map → parseHonoQuery-CwFKw2ua.mjs.map} +1 -1
- package/dist/{parseQueryParams-BJaRh3OB.mjs → parseQueryParams-CHINupbZ.mjs} +1 -1
- package/dist/{parseQueryParams-BJaRh3OB.mjs.map → parseQueryParams-CHINupbZ.mjs.map} +1 -1
- package/dist/{parseQueryParams-BzPop4I1.cjs → parseQueryParams-CwvXXwkW.cjs} +1 -1
- package/dist/{parseQueryParams-BzPop4I1.cjs.map → parseQueryParams-CwvXXwkW.cjs.map} +1 -1
- package/dist/processAudits-BFokHhCO.cjs +174 -0
- package/dist/processAudits-BFokHhCO.cjs.map +1 -0
- package/dist/processAudits-DfcB-X-4.mjs +156 -0
- package/dist/processAudits-DfcB-X-4.mjs.map +1 -0
- package/dist/publisher-Bw4770Hi.mjs.map +1 -1
- package/dist/publisher-lFQleddL.cjs.map +1 -1
- package/dist/publisher.d.cts +3 -2
- package/dist/publisher.d.mts +3 -2
- package/dist/subscribers/AWSLambdaSubscriberAdaptor.cjs +1 -1
- package/dist/subscribers/AWSLambdaSubscriberAdaptor.d.cts +3 -3
- package/dist/subscribers/AWSLambdaSubscriberAdaptor.d.mts +3 -3
- package/dist/subscribers/AWSLambdaSubscriberAdaptor.mjs +1 -1
- package/dist/subscribers/Subscriber.cjs +2 -2
- package/dist/subscribers/Subscriber.d.cts +2 -2
- package/dist/subscribers/Subscriber.d.mts +2 -2
- package/dist/subscribers/Subscriber.mjs +2 -2
- package/dist/subscribers/SubscriberBuilder.cjs +3 -3
- package/dist/subscribers/SubscriberBuilder.d.cts +3 -3
- package/dist/subscribers/SubscriberBuilder.d.mts +3 -3
- package/dist/subscribers/SubscriberBuilder.mjs +3 -3
- package/dist/subscribers/index.cjs +3 -3
- package/dist/subscribers/index.d.cts +5 -5
- package/dist/subscribers/index.d.mts +5 -5
- package/dist/subscribers/index.mjs +3 -3
- package/dist/{types-CVq20-fE.d.mts → types-DKf0juBf.d.mts} +1 -1
- package/dist/types.d.mts +1 -1
- package/package.json +15 -11
- package/src/Construct.ts +8 -0
- package/src/crons/Cron.ts +12 -3
- package/src/crons/CronBuilder.ts +85 -13
- package/src/crons/__tests__/CronBuilder.state-isolation.spec.ts +2 -2
- package/src/endpoints/AmazonApiGatewayEndpointAdaptor.ts +112 -20
- package/src/endpoints/Endpoint.ts +208 -39
- package/src/endpoints/EndpointBuilder.ts +291 -21
- package/src/endpoints/EndpointFactory.ts +5 -1
- package/src/endpoints/HonoEndpointAdaptor.ts +144 -33
- package/src/endpoints/TestEndpointAdaptor.ts +116 -21
- package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.events.spec.ts +8 -0
- package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.spec.ts +29 -0
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.audits.spec.ts +626 -0
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.events.spec.ts +9 -0
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.kysely-audit.integration.spec.ts +757 -0
- package/src/endpoints/__tests__/Endpoint.cookies.spec.ts +3 -1
- package/src/endpoints/__tests__/Endpoint.manifest.spec.ts +1 -1
- package/src/endpoints/__tests__/Endpoint.spec.ts +19 -0
- package/src/endpoints/__tests__/EndpointBuilder.audit.spec.ts +448 -0
- package/src/endpoints/__tests__/EndpointFactory.authorizers.spec.ts +51 -14
- package/src/endpoints/__tests__/EndpointFactory.reference-audit.spec.ts +8 -8
- package/src/endpoints/__tests__/EndpointFactory.state-isolation.spec.ts +11 -11
- package/src/endpoints/__tests__/HonoEndpointAdaptor.audit-transactions.spec.ts +703 -0
- package/src/endpoints/__tests__/HonoEndpointAdaptor.audits.spec.ts +632 -0
- package/src/endpoints/__tests__/HonoEndpointAdaptor.events.spec.ts +8 -0
- package/src/endpoints/__tests__/HonoEndpointAdaptor.kysely-audit.integration.spec.ts +1063 -0
- package/src/endpoints/__tests__/HonoEndpointAdaptor.openapi.spec.ts +4 -0
- package/src/endpoints/__tests__/HonoEndpointAdaptor.spec.ts +25 -0
- package/src/endpoints/audit.ts +87 -0
- package/src/endpoints/index.ts +1 -0
- package/src/endpoints/processAudits.ts +348 -0
- package/src/functions/AWSLambdaFunction.ts +125 -12
- package/src/functions/BaseFunctionBuilder.ts +98 -7
- package/src/functions/Function.ts +83 -15
- package/src/functions/FunctionBuilder.ts +217 -17
- package/src/functions/FunctionExecutionWrapper.ts +133 -2
- package/src/functions/TestFunctionAdaptor.ts +94 -8
- package/src/functions/__tests__/AWSLambdaFunctionAdaptor.spec.ts +82 -0
- package/src/functions/__tests__/Function.audits.spec.ts +393 -0
- package/src/functions/__tests__/Function.spec.ts +76 -0
- package/src/functions/__tests__/FunctionBuilder.state-isolation.spec.ts +54 -7
- package/src/publisher.ts +12 -1
- package/dist/AWSLambdaFunction-BTSGYZSx.mjs.map +0 -1
- package/dist/AWSLambdaFunction-Bel0NFTl.d.mts +0 -27
- package/dist/AWSLambdaFunction-DcI_77u8.cjs.map +0 -1
- package/dist/AWSLambdaFunction-xyCenuD7.d.cts +0 -27
- package/dist/AmazonApiGatewayEndpointAdaptor-BTqB3c1_.cjs.map +0 -1
- package/dist/AmazonApiGatewayEndpointAdaptor-vi0D3dWg.mjs.map +0 -1
- package/dist/BaseFunctionBuilder-DSqF1r3a.mjs.map +0 -1
- package/dist/BaseFunctionBuilder-bTDKP7bd.cjs.map +0 -1
- package/dist/Construct-XCGKof_O.cjs.map +0 -1
- package/dist/Construct-rZQg2yus.mjs.map +0 -1
- package/dist/Cron-BnO1uXhh.mjs.map +0 -1
- package/dist/Cron-CYIhd0VE.cjs.map +0 -1
- package/dist/CronBuilder-BxKwHCdJ.mjs.map +0 -1
- package/dist/CronBuilder-D_3AiPFO.cjs.map +0 -1
- package/dist/Endpoint-BdIGWw1H.cjs.map +0 -1
- package/dist/Endpoint-ChzcIFdV.mjs.map +0 -1
- package/dist/EndpointBuilder-Cx6pUcCn.d.mts +0 -55
- package/dist/EndpointBuilder-Xka8ULR1.d.cts +0 -55
- package/dist/EndpointBuilder-dmMiNRm9.cjs.map +0 -1
- package/dist/EndpointBuilder-yo40Qkf_.mjs.map +0 -1
- package/dist/EndpointFactory-CNbcr8u_.cjs.map +0 -1
- package/dist/EndpointFactory-LD3upVQK.mjs.map +0 -1
- package/dist/Function-Cl9fiR3a.mjs.map +0 -1
- package/dist/Function-DDaSfL_E.cjs.map +0 -1
- package/dist/FunctionBuilder-LQuBiqRc.cjs.map +0 -1
- package/dist/FunctionBuilder-fU1H7tFN.d.cts +0 -26
- package/dist/FunctionBuilder-udObIGV0.d.mts +0 -26
- package/dist/FunctionBuilder-vW12WFOw.mjs.map +0 -1
- package/dist/FunctionExecutionWrapper-BBIoHUt6.cjs +0 -42
- package/dist/FunctionExecutionWrapper-BBIoHUt6.cjs.map +0 -1
- package/dist/FunctionExecutionWrapper-DYBy9OP3.d.mts +0 -24
- package/dist/FunctionExecutionWrapper-Dtyhid1Q.mjs +0 -36
- package/dist/FunctionExecutionWrapper-Dtyhid1Q.mjs.map +0 -1
- package/dist/FunctionExecutionWrapper-Dwr2ZKzC.d.cts +0 -24
- package/dist/HonoEndpointAdaptor-Bc61IS6Q.cjs.map +0 -1
- package/dist/HonoEndpointAdaptor-NR3h5gml.mjs.map +0 -1
- package/dist/TestEndpointAdaptor-DA1D6l-U.cjs.map +0 -1
- package/dist/TestEndpointAdaptor-DpmNXp7G.mjs.map +0 -1
- package/dist/functions-HCoZ4YKF.mjs +0 -8
- package/dist/index-RtxMVjUZ.d.mts +0 -9
- package/dist/index-fiIGH95t.d.cts +0 -9
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AuditStorage, AuditableAction } from '@geekmidas/audit';
|
|
1
2
|
import type { EnvironmentParser } from '@geekmidas/envkit';
|
|
2
3
|
import type { EventPublisher } from '@geekmidas/events';
|
|
3
4
|
import type { Logger } from '@geekmidas/logger';
|
|
@@ -26,6 +27,11 @@ import {
|
|
|
26
27
|
} from '@geekmidas/services';
|
|
27
28
|
import type { ContentfulStatusCode } from 'hono/utils/http-status';
|
|
28
29
|
import { publishConstructEvents } from '../publisher';
|
|
30
|
+
import type { MappedAudit } from './audit';
|
|
31
|
+
import {
|
|
32
|
+
createAuditContext,
|
|
33
|
+
executeWithAuditTransaction,
|
|
34
|
+
} from './processAudits';
|
|
29
35
|
|
|
30
36
|
export interface HonoEndpointOptions {
|
|
31
37
|
/**
|
|
@@ -53,6 +59,15 @@ export class HonoEndpoint<
|
|
|
53
59
|
TLogger extends Logger = Logger,
|
|
54
60
|
TSession = unknown,
|
|
55
61
|
TEventPublisher extends EventPublisher<any> | undefined = undefined,
|
|
62
|
+
TEventPublisherServiceName extends string = string,
|
|
63
|
+
TAuditStorage extends AuditStorage | undefined = undefined,
|
|
64
|
+
TAuditStorageServiceName extends string = string,
|
|
65
|
+
TAuditAction extends AuditableAction<string, unknown> = AuditableAction<
|
|
66
|
+
string,
|
|
67
|
+
unknown
|
|
68
|
+
>,
|
|
69
|
+
TDatabase = undefined,
|
|
70
|
+
TDatabaseServiceName extends string = string,
|
|
56
71
|
> {
|
|
57
72
|
constructor(
|
|
58
73
|
private readonly endpoint: Endpoint<
|
|
@@ -63,7 +78,13 @@ export class HonoEndpoint<
|
|
|
63
78
|
TServices,
|
|
64
79
|
TLogger,
|
|
65
80
|
TSession,
|
|
66
|
-
TEventPublisher
|
|
81
|
+
TEventPublisher,
|
|
82
|
+
TEventPublisherServiceName,
|
|
83
|
+
TAuditStorage,
|
|
84
|
+
TAuditStorageServiceName,
|
|
85
|
+
TAuditAction,
|
|
86
|
+
TDatabase,
|
|
87
|
+
TDatabaseServiceName
|
|
67
88
|
>,
|
|
68
89
|
) {}
|
|
69
90
|
|
|
@@ -111,11 +132,12 @@ export class HonoEndpoint<
|
|
|
111
132
|
any
|
|
112
133
|
>;
|
|
113
134
|
// @ts-ignore
|
|
114
|
-
const response = c.get('__response')
|
|
135
|
+
const response = c.get('__response');
|
|
115
136
|
// @ts-ignore
|
|
116
137
|
const logger = c.get('__logger') as Logger;
|
|
117
138
|
|
|
118
139
|
if (Endpoint.isSuccessStatus(c.res.status) && endpoint) {
|
|
140
|
+
// Process events (audits are handled in the handler with transaction support)
|
|
119
141
|
await publishConstructEvents<any, any>(
|
|
120
142
|
endpoint,
|
|
121
143
|
response,
|
|
@@ -215,6 +237,15 @@ export class HonoEndpoint<
|
|
|
215
237
|
TLogger extends Logger = Logger,
|
|
216
238
|
TSession = unknown,
|
|
217
239
|
TEventPublisher extends EventPublisher<any> | undefined = undefined,
|
|
240
|
+
TEventPublisherServiceName extends string = string,
|
|
241
|
+
TAuditStorage extends AuditStorage | undefined = undefined,
|
|
242
|
+
TAuditStorageServiceName extends string = string,
|
|
243
|
+
TAuditAction extends AuditableAction<string, unknown> = AuditableAction<
|
|
244
|
+
string,
|
|
245
|
+
unknown
|
|
246
|
+
>,
|
|
247
|
+
TDatabase = undefined,
|
|
248
|
+
TDatabaseServiceName extends string = string,
|
|
218
249
|
>(
|
|
219
250
|
endpoint: Endpoint<
|
|
220
251
|
TRoute,
|
|
@@ -224,7 +255,13 @@ export class HonoEndpoint<
|
|
|
224
255
|
TServices,
|
|
225
256
|
TLogger,
|
|
226
257
|
TSession,
|
|
227
|
-
TEventPublisher
|
|
258
|
+
TEventPublisher,
|
|
259
|
+
TEventPublisherServiceName,
|
|
260
|
+
TAuditStorage,
|
|
261
|
+
TAuditStorageServiceName,
|
|
262
|
+
TAuditAction,
|
|
263
|
+
TDatabase,
|
|
264
|
+
TDatabaseServiceName
|
|
228
265
|
>,
|
|
229
266
|
serviceDiscovery: ServiceDiscovery<ServiceRecord<TServices>, TLogger>,
|
|
230
267
|
app: Hono,
|
|
@@ -304,41 +341,114 @@ export class HonoEndpoint<
|
|
|
304
341
|
}
|
|
305
342
|
}
|
|
306
343
|
|
|
307
|
-
|
|
308
|
-
const
|
|
344
|
+
// Create audit context if audit storage is configured
|
|
345
|
+
const auditContext = await createAuditContext(
|
|
346
|
+
endpoint,
|
|
347
|
+
serviceDiscovery,
|
|
348
|
+
logger,
|
|
309
349
|
{
|
|
310
|
-
services,
|
|
311
|
-
logger,
|
|
312
|
-
body: c.req.valid('json'),
|
|
313
|
-
query: c.req.valid('query'),
|
|
314
|
-
params: c.req.valid('param'),
|
|
315
350
|
session,
|
|
316
|
-
header
|
|
317
|
-
cookie
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
TServices,
|
|
321
|
-
TLogger,
|
|
322
|
-
TSession
|
|
323
|
-
>,
|
|
324
|
-
responseBuilder,
|
|
351
|
+
header,
|
|
352
|
+
cookie,
|
|
353
|
+
services: services as Record<string, unknown>,
|
|
354
|
+
},
|
|
325
355
|
);
|
|
326
356
|
|
|
327
|
-
//
|
|
357
|
+
// Warn if declarative audits are configured but no audit storage
|
|
358
|
+
const audits = endpoint.audits as MappedAudit<
|
|
359
|
+
TAuditAction,
|
|
360
|
+
TOutSchema
|
|
361
|
+
>[];
|
|
362
|
+
if (!auditContext && audits?.length) {
|
|
363
|
+
logger.warn('No auditor storage service available');
|
|
364
|
+
}
|
|
328
365
|
|
|
329
|
-
//
|
|
366
|
+
// Resolve database service if configured
|
|
367
|
+
const rawDb = endpoint.databaseService
|
|
368
|
+
? await serviceDiscovery
|
|
369
|
+
.register([endpoint.databaseService])
|
|
370
|
+
.then(
|
|
371
|
+
(s) =>
|
|
372
|
+
s[endpoint.databaseService!.serviceName as keyof typeof s],
|
|
373
|
+
)
|
|
374
|
+
: undefined;
|
|
375
|
+
|
|
376
|
+
// Execute handler with automatic audit transaction support
|
|
377
|
+
const result = await executeWithAuditTransaction(
|
|
378
|
+
auditContext,
|
|
379
|
+
async (auditor) => {
|
|
380
|
+
// Use audit transaction as db only if the storage uses the same database service
|
|
381
|
+
const sameDatabase =
|
|
382
|
+
auditContext?.storage?.databaseServiceName &&
|
|
383
|
+
auditContext.storage.databaseServiceName ===
|
|
384
|
+
endpoint.databaseService?.serviceName;
|
|
385
|
+
const db = sameDatabase
|
|
386
|
+
? (auditor?.getTransaction?.() ?? rawDb)
|
|
387
|
+
: rawDb;
|
|
388
|
+
|
|
389
|
+
const responseBuilder = new ResponseBuilder();
|
|
390
|
+
const response = await endpoint.handler(
|
|
391
|
+
{
|
|
392
|
+
services,
|
|
393
|
+
logger,
|
|
394
|
+
body: c.req.valid('json'),
|
|
395
|
+
query: c.req.valid('query'),
|
|
396
|
+
params: c.req.valid('param'),
|
|
397
|
+
session,
|
|
398
|
+
header,
|
|
399
|
+
cookie,
|
|
400
|
+
auditor,
|
|
401
|
+
db,
|
|
402
|
+
} as unknown as EndpointContext<
|
|
403
|
+
TInput,
|
|
404
|
+
TServices,
|
|
405
|
+
TLogger,
|
|
406
|
+
TSession,
|
|
407
|
+
TAuditAction,
|
|
408
|
+
TDatabase,
|
|
409
|
+
TAuditStorage
|
|
410
|
+
>,
|
|
411
|
+
responseBuilder,
|
|
412
|
+
);
|
|
413
|
+
|
|
414
|
+
// Check if response has metadata
|
|
415
|
+
let data = response;
|
|
416
|
+
let metadata = responseBuilder.getMetadata();
|
|
417
|
+
|
|
418
|
+
if (Endpoint.hasMetadata(response)) {
|
|
419
|
+
data = response.data;
|
|
420
|
+
metadata = response.metadata;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
const output = endpoint.outputSchema
|
|
424
|
+
? await endpoint.parseOutput(data)
|
|
425
|
+
: undefined;
|
|
426
|
+
|
|
427
|
+
return { output, metadata, responseBuilder };
|
|
428
|
+
},
|
|
429
|
+
// Process declarative audits after handler (inside transaction)
|
|
430
|
+
async (result, auditor) => {
|
|
431
|
+
if (!audits?.length) return;
|
|
432
|
+
|
|
433
|
+
for (const audit of audits) {
|
|
434
|
+
if (audit.when && !audit.when(result.output as any)) {
|
|
435
|
+
continue;
|
|
436
|
+
}
|
|
437
|
+
const payload = audit.payload(result.output as any);
|
|
438
|
+
const entityId = audit.entityId?.(result.output as any);
|
|
439
|
+
auditor.audit(audit.type as any, payload as any, {
|
|
440
|
+
table: audit.table,
|
|
441
|
+
entityId,
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
},
|
|
445
|
+
);
|
|
446
|
+
|
|
447
|
+
const { output, metadata } = result;
|
|
330
448
|
|
|
331
449
|
try {
|
|
332
|
-
// Check if response has metadata
|
|
333
|
-
let data = response;
|
|
334
|
-
let metadata = responseBuilder.getMetadata();
|
|
335
450
|
let status = endpoint.status as ContentfulStatusCode;
|
|
336
451
|
|
|
337
|
-
if (Endpoint.hasMetadata(response)) {
|
|
338
|
-
data = response.data;
|
|
339
|
-
metadata = response.metadata;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
452
|
// Apply response metadata
|
|
343
453
|
if (metadata.status) {
|
|
344
454
|
status = metadata.status as ContentfulStatusCode;
|
|
@@ -356,21 +466,22 @@ export class HonoEndpoint<
|
|
|
356
466
|
}
|
|
357
467
|
}
|
|
358
468
|
|
|
359
|
-
const output = endpoint.outputSchema
|
|
360
|
-
? await endpoint.parseOutput(data)
|
|
361
|
-
: ({} as any);
|
|
362
469
|
// @ts-ignore
|
|
363
470
|
c.set('__response', output);
|
|
364
471
|
// @ts-ignore
|
|
365
472
|
c.set('__endpoint', endpoint);
|
|
366
473
|
// @ts-ignore
|
|
367
474
|
c.set('__logger', logger);
|
|
475
|
+
// @ts-ignore
|
|
476
|
+
c.set('__session', session);
|
|
477
|
+
// @ts-ignore
|
|
478
|
+
c.set('__services', services);
|
|
368
479
|
|
|
369
480
|
if (HonoEndpoint.isDev) {
|
|
370
481
|
logger.info({ status, body: output }, 'Outgoing response');
|
|
371
482
|
}
|
|
372
483
|
|
|
373
|
-
return c.json(output, status);
|
|
484
|
+
return c.json(output ?? {}, status);
|
|
374
485
|
} catch (validationError: any) {
|
|
375
486
|
logger.error(validationError, 'Output validation failed');
|
|
376
487
|
const error = wrapError(
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AuditStorage, AuditableAction } from '@geekmidas/audit';
|
|
1
2
|
import { EnvironmentParser } from '@geekmidas/envkit';
|
|
2
3
|
import type { EventPublisher } from '@geekmidas/events';
|
|
3
4
|
import type { Logger } from '@geekmidas/logger';
|
|
@@ -19,6 +20,11 @@ import {
|
|
|
19
20
|
type EndpointSchemas,
|
|
20
21
|
ResponseBuilder,
|
|
21
22
|
} from './Endpoint';
|
|
23
|
+
import type { MappedAudit } from './audit';
|
|
24
|
+
import {
|
|
25
|
+
createAuditContext,
|
|
26
|
+
executeWithAuditTransaction,
|
|
27
|
+
} from './processAudits';
|
|
22
28
|
|
|
23
29
|
export type TestHttpResponse<TBody = any> = {
|
|
24
30
|
body: TBody;
|
|
@@ -73,6 +79,12 @@ export class TestEndpointAdaptor<
|
|
|
73
79
|
TSession = unknown,
|
|
74
80
|
TEventPublisher extends EventPublisher<any> | undefined = undefined,
|
|
75
81
|
TEventPublisherServiceName extends string = string,
|
|
82
|
+
TAuditStorage extends AuditStorage | undefined = undefined,
|
|
83
|
+
TAuditStorageServiceName extends string = string,
|
|
84
|
+
TAuditAction extends AuditableAction<string, unknown> = AuditableAction<
|
|
85
|
+
string,
|
|
86
|
+
unknown
|
|
87
|
+
>,
|
|
76
88
|
> {
|
|
77
89
|
static getDefaultServiceDiscover<
|
|
78
90
|
TRoute extends string,
|
|
@@ -84,6 +96,12 @@ export class TestEndpointAdaptor<
|
|
|
84
96
|
TSession = unknown,
|
|
85
97
|
TEventPublisher extends EventPublisher<any> | undefined = undefined,
|
|
86
98
|
TEventPublisherServiceName extends string = string,
|
|
99
|
+
TAuditStorage extends AuditStorage | undefined = undefined,
|
|
100
|
+
TAuditStorageServiceName extends string = string,
|
|
101
|
+
TAuditAction extends AuditableAction<string, unknown> = AuditableAction<
|
|
102
|
+
string,
|
|
103
|
+
unknown
|
|
104
|
+
>,
|
|
87
105
|
>(
|
|
88
106
|
endpoint: Endpoint<
|
|
89
107
|
TRoute,
|
|
@@ -94,7 +112,10 @@ export class TestEndpointAdaptor<
|
|
|
94
112
|
TLogger,
|
|
95
113
|
TSession,
|
|
96
114
|
TEventPublisher,
|
|
97
|
-
TEventPublisherServiceName
|
|
115
|
+
TEventPublisherServiceName,
|
|
116
|
+
TAuditStorage,
|
|
117
|
+
TAuditStorageServiceName,
|
|
118
|
+
TAuditAction
|
|
98
119
|
>,
|
|
99
120
|
) {
|
|
100
121
|
return ServiceDiscovery.getInstance(
|
|
@@ -112,7 +133,10 @@ export class TestEndpointAdaptor<
|
|
|
112
133
|
TLogger,
|
|
113
134
|
TSession,
|
|
114
135
|
TEventPublisher,
|
|
115
|
-
TEventPublisherServiceName
|
|
136
|
+
TEventPublisherServiceName,
|
|
137
|
+
TAuditStorage,
|
|
138
|
+
TAuditStorageServiceName,
|
|
139
|
+
TAuditAction
|
|
116
140
|
>,
|
|
117
141
|
private serviceDiscovery: ServiceDiscovery<
|
|
118
142
|
any,
|
|
@@ -149,33 +173,102 @@ export class TestEndpointAdaptor<
|
|
|
149
173
|
cookie,
|
|
150
174
|
});
|
|
151
175
|
|
|
152
|
-
|
|
153
|
-
const
|
|
176
|
+
// Create audit context if audit storage is configured
|
|
177
|
+
const auditContext = await createAuditContext(
|
|
178
|
+
this.endpoint,
|
|
179
|
+
this.serviceDiscovery,
|
|
180
|
+
logger,
|
|
154
181
|
{
|
|
155
|
-
body,
|
|
156
|
-
query,
|
|
157
|
-
params,
|
|
158
182
|
session,
|
|
159
|
-
services: ctx.services,
|
|
160
|
-
logger,
|
|
161
183
|
header,
|
|
162
184
|
cookie,
|
|
163
|
-
|
|
164
|
-
|
|
185
|
+
services: ctx.services as Record<string, unknown>,
|
|
186
|
+
},
|
|
165
187
|
);
|
|
166
188
|
|
|
167
|
-
//
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
189
|
+
// Warn if declarative audits are configured but no audit storage
|
|
190
|
+
const audits = this.endpoint.audits as MappedAudit<
|
|
191
|
+
TAuditAction,
|
|
192
|
+
TOutSchema
|
|
193
|
+
>[];
|
|
194
|
+
if (!auditContext && audits?.length) {
|
|
195
|
+
logger.warn('No auditor storage service available');
|
|
174
196
|
}
|
|
175
197
|
|
|
176
|
-
|
|
177
|
-
|
|
198
|
+
// Resolve database service if configured
|
|
199
|
+
const rawDb = this.endpoint.databaseService
|
|
200
|
+
? await this.serviceDiscovery
|
|
201
|
+
.register([this.endpoint.databaseService])
|
|
202
|
+
.then(
|
|
203
|
+
(s) =>
|
|
204
|
+
s[this.endpoint.databaseService!.serviceName as keyof typeof s],
|
|
205
|
+
)
|
|
206
|
+
: undefined;
|
|
207
|
+
|
|
208
|
+
// Execute handler with automatic audit transaction support
|
|
209
|
+
const result = await executeWithAuditTransaction(
|
|
210
|
+
auditContext,
|
|
211
|
+
async (auditor) => {
|
|
212
|
+
// Use audit transaction as db only if the storage uses the same database service
|
|
213
|
+
const sameDatabase =
|
|
214
|
+
auditContext?.storage?.databaseServiceName &&
|
|
215
|
+
auditContext.storage.databaseServiceName ===
|
|
216
|
+
this.endpoint.databaseService?.serviceName;
|
|
217
|
+
const db = sameDatabase
|
|
218
|
+
? (auditor?.getTransaction?.() ?? rawDb)
|
|
219
|
+
: rawDb;
|
|
220
|
+
|
|
221
|
+
const responseBuilder = new ResponseBuilder();
|
|
222
|
+
const response = await this.endpoint.handler(
|
|
223
|
+
{
|
|
224
|
+
body,
|
|
225
|
+
query,
|
|
226
|
+
params,
|
|
227
|
+
session,
|
|
228
|
+
services: ctx.services,
|
|
229
|
+
logger,
|
|
230
|
+
header,
|
|
231
|
+
cookie,
|
|
232
|
+
auditor,
|
|
233
|
+
db,
|
|
234
|
+
} as any,
|
|
235
|
+
responseBuilder,
|
|
236
|
+
);
|
|
178
237
|
|
|
238
|
+
// Check if response has metadata
|
|
239
|
+
let data = response;
|
|
240
|
+
let metadata = responseBuilder.getMetadata();
|
|
241
|
+
|
|
242
|
+
if (Endpoint.hasMetadata(response)) {
|
|
243
|
+
data = response.data;
|
|
244
|
+
metadata = response.metadata;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
const output = await this.endpoint.parseOutput(data);
|
|
248
|
+
|
|
249
|
+
return { output, metadata, responseBuilder };
|
|
250
|
+
},
|
|
251
|
+
// Process declarative audits after handler (inside transaction)
|
|
252
|
+
async (result, auditor) => {
|
|
253
|
+
if (!audits?.length) return;
|
|
254
|
+
|
|
255
|
+
for (const audit of audits) {
|
|
256
|
+
if (audit.when && !audit.when(result.output as any)) {
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
const payload = audit.payload(result.output as any);
|
|
260
|
+
const entityId = audit.entityId?.(result.output as any);
|
|
261
|
+
auditor.audit(audit.type as any, payload as any, {
|
|
262
|
+
table: audit.table,
|
|
263
|
+
entityId,
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
);
|
|
268
|
+
|
|
269
|
+
const { output, metadata } = result;
|
|
270
|
+
|
|
271
|
+
ctx.publisher && (await this.serviceDiscovery.register([ctx.publisher]));
|
|
179
272
|
await publishConstructEvents(this.endpoint, output, this.serviceDiscovery);
|
|
180
273
|
|
|
181
274
|
// Convert cookies to Set-Cookie headers
|
|
@@ -186,7 +279,9 @@ export class TestEndpointAdaptor<
|
|
|
186
279
|
if (metadata.cookies && metadata.cookies.size > 0) {
|
|
187
280
|
const setCookieValues: string[] = [];
|
|
188
281
|
for (const [name, cookie] of metadata.cookies.entries()) {
|
|
189
|
-
setCookieValues.push(
|
|
282
|
+
setCookieValues.push(
|
|
283
|
+
serializeCookie(name, cookie.value, cookie.options),
|
|
284
|
+
);
|
|
190
285
|
}
|
|
191
286
|
headers['set-cookie'] = setCookieValues;
|
|
192
287
|
}
|
|
@@ -69,6 +69,7 @@ describe('AmazonApiGatewayV1Endpoint Events', () => {
|
|
|
69
69
|
services: [],
|
|
70
70
|
logger: mockLogger,
|
|
71
71
|
timeout: undefined,
|
|
72
|
+
memorySize: undefined,
|
|
72
73
|
status: 200,
|
|
73
74
|
getSession: undefined,
|
|
74
75
|
authorize: undefined,
|
|
@@ -135,6 +136,7 @@ describe('AmazonApiGatewayV1Endpoint Events', () => {
|
|
|
135
136
|
services: [],
|
|
136
137
|
logger: mockLogger,
|
|
137
138
|
timeout: undefined,
|
|
139
|
+
memorySize: undefined,
|
|
138
140
|
status: 201,
|
|
139
141
|
getSession: undefined,
|
|
140
142
|
authorize: undefined,
|
|
@@ -215,6 +217,7 @@ describe('AmazonApiGatewayV1Endpoint Events', () => {
|
|
|
215
217
|
services: [],
|
|
216
218
|
logger: mockLogger,
|
|
217
219
|
timeout: undefined,
|
|
220
|
+
memorySize: undefined,
|
|
218
221
|
status: 200,
|
|
219
222
|
getSession: undefined,
|
|
220
223
|
authorize: undefined,
|
|
@@ -274,6 +277,7 @@ describe('AmazonApiGatewayV1Endpoint Events', () => {
|
|
|
274
277
|
services: [],
|
|
275
278
|
logger: mockLogger,
|
|
276
279
|
timeout: undefined,
|
|
280
|
+
memorySize: undefined,
|
|
277
281
|
status: 200,
|
|
278
282
|
getSession: undefined,
|
|
279
283
|
authorize: undefined,
|
|
@@ -324,6 +328,7 @@ describe('AmazonApiGatewayV1Endpoint Events', () => {
|
|
|
324
328
|
services: [],
|
|
325
329
|
logger: mockLogger,
|
|
326
330
|
timeout: undefined,
|
|
331
|
+
memorySize: undefined,
|
|
327
332
|
status: 200,
|
|
328
333
|
getSession: undefined,
|
|
329
334
|
authorize: undefined,
|
|
@@ -384,6 +389,7 @@ describe('AmazonApiGatewayV1Endpoint Events', () => {
|
|
|
384
389
|
services: [],
|
|
385
390
|
logger: mockLogger,
|
|
386
391
|
timeout: undefined,
|
|
392
|
+
memorySize: undefined,
|
|
387
393
|
status: 200,
|
|
388
394
|
getSession: undefined,
|
|
389
395
|
authorize: undefined,
|
|
@@ -455,6 +461,7 @@ describe('AmazonApiGatewayV1Endpoint Events', () => {
|
|
|
455
461
|
services: [],
|
|
456
462
|
logger: mockLogger,
|
|
457
463
|
timeout: undefined,
|
|
464
|
+
memorySize: undefined,
|
|
458
465
|
status: 201,
|
|
459
466
|
getSession: undefined,
|
|
460
467
|
authorize: undefined,
|
|
@@ -526,6 +533,7 @@ describe('AmazonApiGatewayV1Endpoint Events', () => {
|
|
|
526
533
|
services: [],
|
|
527
534
|
logger: mockLogger,
|
|
528
535
|
timeout: undefined,
|
|
536
|
+
memorySize: undefined,
|
|
529
537
|
status: 200,
|
|
530
538
|
getSession: undefined,
|
|
531
539
|
authorize: undefined,
|