@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 { Logger } from '@geekmidas/logger';
|
|
2
3
|
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
3
4
|
import type { HttpMethod } from '../types';
|
|
@@ -29,6 +30,12 @@ import type {
|
|
|
29
30
|
InferStandardSchema,
|
|
30
31
|
} from '@geekmidas/schema';
|
|
31
32
|
import { publishConstructEvents } from '../publisher';
|
|
33
|
+
import type { CookieFn, HeaderFn } from './Endpoint';
|
|
34
|
+
import type { MappedAudit } from './audit';
|
|
35
|
+
import {
|
|
36
|
+
createAuditContext,
|
|
37
|
+
executeWithAuditTransaction,
|
|
38
|
+
} from './processAudits';
|
|
32
39
|
|
|
33
40
|
// Helper function to publish events
|
|
34
41
|
|
|
@@ -46,6 +53,12 @@ export abstract class AmazonApiGatewayEndpoint<
|
|
|
46
53
|
TSession = unknown,
|
|
47
54
|
TEventPublisher extends EventPublisher<any> | undefined = undefined,
|
|
48
55
|
TEventPublisherServiceName extends string = string,
|
|
56
|
+
TAuditStorage extends AuditStorage | undefined = undefined,
|
|
57
|
+
TAuditStorageServiceName extends string = string,
|
|
58
|
+
TAuditAction extends AuditableAction<string, unknown> = AuditableAction<
|
|
59
|
+
string,
|
|
60
|
+
unknown
|
|
61
|
+
>,
|
|
49
62
|
> {
|
|
50
63
|
constructor(
|
|
51
64
|
protected envParser: EnvironmentParser<{}>,
|
|
@@ -58,7 +71,10 @@ export abstract class AmazonApiGatewayEndpoint<
|
|
|
58
71
|
TLogger,
|
|
59
72
|
TSession,
|
|
60
73
|
TEventPublisher,
|
|
61
|
-
TEventPublisherServiceName
|
|
74
|
+
TEventPublisherServiceName,
|
|
75
|
+
TAuditStorage,
|
|
76
|
+
TAuditStorageServiceName,
|
|
77
|
+
TAuditAction
|
|
62
78
|
>,
|
|
63
79
|
) {}
|
|
64
80
|
|
|
@@ -199,12 +215,15 @@ export abstract class AmazonApiGatewayEndpoint<
|
|
|
199
215
|
const statusCode = req.response?.statusCode ?? this.endpoint.status;
|
|
200
216
|
|
|
201
217
|
// Only publish events on successful responses (2xx status codes)
|
|
218
|
+
// Note: Audits are processed inside the handler's transaction
|
|
202
219
|
if (Endpoint.isSuccessStatus(statusCode)) {
|
|
203
220
|
const logger = event.logger as TLogger;
|
|
204
221
|
const serviceDiscovery = ServiceDiscovery.getInstance<
|
|
205
222
|
ServiceRecord<TServices>,
|
|
206
223
|
TLogger
|
|
207
224
|
>(logger, this.envParser);
|
|
225
|
+
|
|
226
|
+
// Publish events
|
|
208
227
|
await publishConstructEvents(
|
|
209
228
|
this.endpoint,
|
|
210
229
|
response,
|
|
@@ -220,33 +239,106 @@ export abstract class AmazonApiGatewayEndpoint<
|
|
|
220
239
|
event: Event<TEvent, TInput, TServices, TLogger, TSession>,
|
|
221
240
|
) {
|
|
222
241
|
const input = this.endpoint.refineInput(event);
|
|
223
|
-
|
|
224
|
-
const
|
|
225
|
-
|
|
242
|
+
const logger = event.logger as TLogger;
|
|
243
|
+
const serviceDiscovery = ServiceDiscovery.getInstance<
|
|
244
|
+
ServiceRecord<TServices>,
|
|
245
|
+
TLogger
|
|
246
|
+
>(logger, this.envParser);
|
|
247
|
+
|
|
248
|
+
// Create audit context if audit storage is configured
|
|
249
|
+
const auditContext = await createAuditContext(
|
|
250
|
+
this.endpoint,
|
|
251
|
+
serviceDiscovery,
|
|
252
|
+
logger,
|
|
226
253
|
{
|
|
254
|
+
session: event.session,
|
|
227
255
|
header: event.header,
|
|
228
256
|
cookie: event.cookie,
|
|
229
|
-
|
|
230
|
-
services: event.services,
|
|
231
|
-
session: event.session,
|
|
232
|
-
...input,
|
|
257
|
+
services: event.services as Record<string, unknown>,
|
|
233
258
|
},
|
|
234
|
-
responseBuilder,
|
|
235
259
|
);
|
|
236
260
|
|
|
237
|
-
//
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
261
|
+
// Warn if declarative audits are configured but no audit storage
|
|
262
|
+
const audits = this.endpoint.audits as MappedAudit<
|
|
263
|
+
TAuditAction,
|
|
264
|
+
TOutSchema
|
|
265
|
+
>[];
|
|
266
|
+
if (!auditContext && audits?.length) {
|
|
267
|
+
logger.warn('No auditor storage service available');
|
|
244
268
|
}
|
|
245
269
|
|
|
246
|
-
|
|
247
|
-
|
|
270
|
+
// Resolve database service if configured
|
|
271
|
+
const rawDb = this.endpoint.databaseService
|
|
272
|
+
? await serviceDiscovery
|
|
273
|
+
.register([this.endpoint.databaseService])
|
|
274
|
+
.then(
|
|
275
|
+
(s) =>
|
|
276
|
+
s[this.endpoint.databaseService!.serviceName as keyof typeof s],
|
|
277
|
+
)
|
|
248
278
|
: undefined;
|
|
249
279
|
|
|
280
|
+
// Execute handler with automatic audit transaction support
|
|
281
|
+
const result = await executeWithAuditTransaction(
|
|
282
|
+
auditContext,
|
|
283
|
+
async (auditor) => {
|
|
284
|
+
// Use audit transaction as db only if the storage uses the same database service
|
|
285
|
+
const sameDatabase =
|
|
286
|
+
auditContext?.storage?.databaseServiceName &&
|
|
287
|
+
auditContext.storage.databaseServiceName ===
|
|
288
|
+
this.endpoint.databaseService?.serviceName;
|
|
289
|
+
const db = sameDatabase
|
|
290
|
+
? (auditor?.getTransaction?.() ?? rawDb)
|
|
291
|
+
: rawDb;
|
|
292
|
+
|
|
293
|
+
const responseBuilder = new ResponseBuilder();
|
|
294
|
+
const response = await this.endpoint.handler(
|
|
295
|
+
{
|
|
296
|
+
header: event.header,
|
|
297
|
+
cookie: event.cookie,
|
|
298
|
+
logger: event.logger,
|
|
299
|
+
services: event.services,
|
|
300
|
+
session: event.session,
|
|
301
|
+
auditor,
|
|
302
|
+
db,
|
|
303
|
+
...input,
|
|
304
|
+
} as any,
|
|
305
|
+
responseBuilder,
|
|
306
|
+
);
|
|
307
|
+
|
|
308
|
+
// Check if response has metadata
|
|
309
|
+
let data = response;
|
|
310
|
+
let metadata = responseBuilder.getMetadata();
|
|
311
|
+
|
|
312
|
+
if (Endpoint.hasMetadata(response)) {
|
|
313
|
+
data = response.data;
|
|
314
|
+
metadata = response.metadata;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
const output = this.endpoint.outputSchema
|
|
318
|
+
? await this.endpoint.parseOutput(data)
|
|
319
|
+
: undefined;
|
|
320
|
+
|
|
321
|
+
return { output, metadata, responseBuilder };
|
|
322
|
+
},
|
|
323
|
+
// Process declarative audits after handler (inside transaction)
|
|
324
|
+
async (result, auditor) => {
|
|
325
|
+
if (!audits?.length) return;
|
|
326
|
+
|
|
327
|
+
for (const audit of audits) {
|
|
328
|
+
if (audit.when && !audit.when(result.output as any)) {
|
|
329
|
+
continue;
|
|
330
|
+
}
|
|
331
|
+
const payload = audit.payload(result.output as any);
|
|
332
|
+
const entityId = audit.entityId?.(result.output as any);
|
|
333
|
+
auditor.audit(audit.type as any, payload as any, {
|
|
334
|
+
table: audit.table,
|
|
335
|
+
entityId,
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
);
|
|
340
|
+
|
|
341
|
+
const { output, metadata } = result;
|
|
250
342
|
const body = output !== undefined ? JSON.stringify(output) : undefined;
|
|
251
343
|
|
|
252
344
|
// Store response for middleware access
|
|
@@ -305,8 +397,8 @@ export type Event<
|
|
|
305
397
|
> = {
|
|
306
398
|
services: ServiceRecord<TServices>;
|
|
307
399
|
logger: TLogger;
|
|
308
|
-
header
|
|
309
|
-
cookie
|
|
400
|
+
header: HeaderFn;
|
|
401
|
+
cookie: CookieFn;
|
|
310
402
|
session: TSession;
|
|
311
403
|
} & TEvent &
|
|
312
404
|
InferComposableStandardSchema<TInput>;
|
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
3
|
-
import pick from 'lodash.pick';
|
|
4
|
-
import set from 'lodash.set';
|
|
5
|
-
import type { OpenAPIV3_1 } from 'openapi-types';
|
|
6
|
-
|
|
7
|
-
import type { Service, ServiceRecord } from '@geekmidas/services';
|
|
8
|
-
import type { Authorizer } from './Authorizer';
|
|
9
|
-
import { ConstructType } from '../Construct';
|
|
10
|
-
import { Function, type FunctionHandler } from '../functions';
|
|
11
|
-
|
|
1
|
+
import type { AuditStorage, AuditableAction, Auditor } from '@geekmidas/audit';
|
|
12
2
|
import type {
|
|
13
3
|
EventPublisher,
|
|
14
4
|
ExtractPublisherMessage,
|
|
15
5
|
MappedEvent,
|
|
16
6
|
} from '@geekmidas/events';
|
|
7
|
+
import type { Logger } from '@geekmidas/logger';
|
|
17
8
|
import type { RateLimitConfig } from '@geekmidas/rate-limit';
|
|
18
9
|
import type {
|
|
19
10
|
InferComposableStandardSchema,
|
|
@@ -28,7 +19,16 @@ import {
|
|
|
28
19
|
type OpenApiSchemaOptions,
|
|
29
20
|
buildOpenApiSchema,
|
|
30
21
|
} from '@geekmidas/schema/openapi';
|
|
22
|
+
import type { Service, ServiceRecord } from '@geekmidas/services';
|
|
23
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
24
|
+
import pick from 'lodash.pick';
|
|
25
|
+
import set from 'lodash.set';
|
|
26
|
+
import type { OpenAPIV3_1 } from 'openapi-types';
|
|
27
|
+
import { ConstructType } from '../Construct';
|
|
28
|
+
import { Function, type FunctionHandler } from '../functions';
|
|
31
29
|
import type { HttpMethod, LowerHttpMethod, RemoveUndefined } from '../types';
|
|
30
|
+
import type { Authorizer } from './Authorizer';
|
|
31
|
+
import type { ActorExtractor, MappedAudit } from './audit';
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* Represents an HTTP endpoint that can handle requests with type-safe input/output validation,
|
|
@@ -65,14 +65,35 @@ export class Endpoint<
|
|
|
65
65
|
TSession = unknown,
|
|
66
66
|
TEventPublisher extends EventPublisher<any> | undefined = undefined,
|
|
67
67
|
TEventPublisherServiceName extends string = string,
|
|
68
|
+
TAuditStorage extends AuditStorage | undefined = undefined,
|
|
69
|
+
TAuditStorageServiceName extends string = string,
|
|
70
|
+
TAuditAction extends AuditableAction<string, unknown> = AuditableAction<
|
|
71
|
+
string,
|
|
72
|
+
unknown
|
|
73
|
+
>,
|
|
74
|
+
TDatabase = undefined,
|
|
75
|
+
TDatabaseServiceName extends string = string,
|
|
68
76
|
> extends Function<
|
|
69
77
|
TInput,
|
|
70
78
|
TServices,
|
|
71
79
|
TLogger,
|
|
72
80
|
OutSchema,
|
|
73
|
-
FunctionHandler<TInput, TServices, TLogger, OutSchema>,
|
|
74
81
|
TEventPublisher,
|
|
75
|
-
TEventPublisherServiceName
|
|
82
|
+
TEventPublisherServiceName,
|
|
83
|
+
TAuditStorage,
|
|
84
|
+
TAuditStorageServiceName,
|
|
85
|
+
TDatabase,
|
|
86
|
+
TDatabaseServiceName,
|
|
87
|
+
TAuditAction,
|
|
88
|
+
FunctionHandler<
|
|
89
|
+
TInput,
|
|
90
|
+
TServices,
|
|
91
|
+
TLogger,
|
|
92
|
+
OutSchema,
|
|
93
|
+
TDatabase,
|
|
94
|
+
TAuditStorage,
|
|
95
|
+
TAuditAction
|
|
96
|
+
>
|
|
76
97
|
> {
|
|
77
98
|
operationId?: string;
|
|
78
99
|
/** The route path pattern with parameter placeholders */
|
|
@@ -96,13 +117,22 @@ export class Endpoint<
|
|
|
96
117
|
public rateLimit?: RateLimitConfig;
|
|
97
118
|
/** Optional authorizer for this endpoint */
|
|
98
119
|
public authorizer?: Authorizer;
|
|
120
|
+
/** Optional actor extractor for audit records */
|
|
121
|
+
public actorExtractor?: ActorExtractor<TServices, TSession, TLogger>;
|
|
122
|
+
/** Declarative audit definitions */
|
|
123
|
+
public audits: MappedAudit<TAuditAction, OutSchema>[] = [];
|
|
124
|
+
/** Database service for this endpoint */
|
|
125
|
+
public databaseService?: Service<TDatabaseServiceName, TDatabase>;
|
|
99
126
|
/** The endpoint handler function */
|
|
100
127
|
private endpointFn!: EndpointHandler<
|
|
101
128
|
TInput,
|
|
102
129
|
TServices,
|
|
103
130
|
TLogger,
|
|
104
131
|
OutSchema,
|
|
105
|
-
TSession
|
|
132
|
+
TSession,
|
|
133
|
+
TDatabase,
|
|
134
|
+
TAuditStorage,
|
|
135
|
+
TAuditAction
|
|
106
136
|
>;
|
|
107
137
|
|
|
108
138
|
/**
|
|
@@ -309,7 +339,15 @@ export class Endpoint<
|
|
|
309
339
|
}
|
|
310
340
|
|
|
311
341
|
handler = (
|
|
312
|
-
ctx: EndpointContext<
|
|
342
|
+
ctx: EndpointContext<
|
|
343
|
+
TInput,
|
|
344
|
+
TServices,
|
|
345
|
+
TLogger,
|
|
346
|
+
TSession,
|
|
347
|
+
TAuditAction,
|
|
348
|
+
TDatabase,
|
|
349
|
+
TAuditStorage
|
|
350
|
+
>,
|
|
313
351
|
response: ResponseBuilder,
|
|
314
352
|
): OutSchema extends StandardSchemaV1
|
|
315
353
|
?
|
|
@@ -327,17 +365,28 @@ export class Endpoint<
|
|
|
327
365
|
response.header(key, value);
|
|
328
366
|
}
|
|
329
367
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
368
|
+
// Build context object, conditionally including auditor and db
|
|
369
|
+
const handlerCtx = {
|
|
370
|
+
...this.refineInput(ctx),
|
|
371
|
+
services: ctx.services,
|
|
372
|
+
logger: ctx.logger,
|
|
373
|
+
header: ctx.header,
|
|
374
|
+
cookie: ctx.cookie,
|
|
375
|
+
session: ctx.session,
|
|
376
|
+
// These are conditionally present based on configuration
|
|
377
|
+
...('auditor' in ctx && { auditor: ctx.auditor }),
|
|
378
|
+
...('db' in ctx && { db: ctx.db }),
|
|
379
|
+
} as EndpointContext<
|
|
380
|
+
TInput,
|
|
381
|
+
TServices,
|
|
382
|
+
TLogger,
|
|
383
|
+
TSession,
|
|
384
|
+
TAuditAction,
|
|
385
|
+
TDatabase,
|
|
386
|
+
TAuditStorage
|
|
387
|
+
>;
|
|
388
|
+
|
|
389
|
+
return this.endpointFn(handlerCtx, response);
|
|
341
390
|
};
|
|
342
391
|
|
|
343
392
|
/**
|
|
@@ -540,6 +589,10 @@ export class Endpoint<
|
|
|
540
589
|
publisherService,
|
|
541
590
|
events,
|
|
542
591
|
authorizer,
|
|
592
|
+
auditorStorageService,
|
|
593
|
+
actorExtractor,
|
|
594
|
+
audits,
|
|
595
|
+
databaseService,
|
|
543
596
|
}: EndpointOptions<
|
|
544
597
|
TRoute,
|
|
545
598
|
TMethod,
|
|
@@ -550,7 +603,12 @@ export class Endpoint<
|
|
|
550
603
|
TSession,
|
|
551
604
|
OutSchema,
|
|
552
605
|
TEventPublisher,
|
|
553
|
-
TEventPublisherServiceName
|
|
606
|
+
TEventPublisherServiceName,
|
|
607
|
+
TAuditStorage,
|
|
608
|
+
TAuditStorageServiceName,
|
|
609
|
+
TAuditAction,
|
|
610
|
+
TDatabase,
|
|
611
|
+
TDatabaseServiceName
|
|
554
612
|
>) {
|
|
555
613
|
super(
|
|
556
614
|
fn as unknown as FunctionHandler<TInput, TServices, TLogger, OutSchema>,
|
|
@@ -563,6 +621,7 @@ export class Endpoint<
|
|
|
563
621
|
publisherService,
|
|
564
622
|
events,
|
|
565
623
|
memorySize,
|
|
624
|
+
auditorStorageService,
|
|
566
625
|
);
|
|
567
626
|
|
|
568
627
|
this.route = route;
|
|
@@ -587,6 +646,18 @@ export class Endpoint<
|
|
|
587
646
|
if (authorizer) {
|
|
588
647
|
this.authorizer = authorizer;
|
|
589
648
|
}
|
|
649
|
+
|
|
650
|
+
if (actorExtractor) {
|
|
651
|
+
this.actorExtractor = actorExtractor;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
if (audits) {
|
|
655
|
+
this.audits = audits;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
if (databaseService) {
|
|
659
|
+
this.databaseService = databaseService;
|
|
660
|
+
}
|
|
590
661
|
}
|
|
591
662
|
}
|
|
592
663
|
|
|
@@ -638,13 +709,30 @@ export interface EndpointOptions<
|
|
|
638
709
|
OutSchema extends StandardSchemaV1 | undefined = undefined,
|
|
639
710
|
TEventPublisher extends EventPublisher<any> | undefined = undefined,
|
|
640
711
|
TEventPublisherServiceName extends string = string,
|
|
712
|
+
TAuditStorage extends AuditStorage | undefined = undefined,
|
|
713
|
+
TAuditStorageServiceName extends string = string,
|
|
714
|
+
TAuditAction extends AuditableAction<string, unknown> = AuditableAction<
|
|
715
|
+
string,
|
|
716
|
+
unknown
|
|
717
|
+
>,
|
|
718
|
+
TDatabase = undefined,
|
|
719
|
+
TDatabaseServiceName extends string = string,
|
|
641
720
|
> {
|
|
642
721
|
/** The route path with parameter placeholders */
|
|
643
722
|
route: TRoute;
|
|
644
723
|
/** The HTTP method for this endpoint */
|
|
645
724
|
method: TMethod;
|
|
646
725
|
/** The handler function that implements the endpoint logic */
|
|
647
|
-
fn: EndpointHandler<
|
|
726
|
+
fn: EndpointHandler<
|
|
727
|
+
TInput,
|
|
728
|
+
TServices,
|
|
729
|
+
TLogger,
|
|
730
|
+
TOutput,
|
|
731
|
+
TSession,
|
|
732
|
+
TDatabase,
|
|
733
|
+
TAuditStorage,
|
|
734
|
+
TAuditAction
|
|
735
|
+
>;
|
|
648
736
|
/** Optional authorization check function */
|
|
649
737
|
authorize: AuthorizeFn<TServices, TLogger, TSession> | undefined;
|
|
650
738
|
/** Optional description for documentation */
|
|
@@ -677,6 +765,16 @@ export interface EndpointOptions<
|
|
|
677
765
|
events?: MappedEvent<TEventPublisher, OutSchema>[];
|
|
678
766
|
/** Optional authorizer configuration */
|
|
679
767
|
authorizer?: Authorizer;
|
|
768
|
+
/**
|
|
769
|
+
* Auditor storage service for persisting audit records from this endpoint
|
|
770
|
+
*/
|
|
771
|
+
auditorStorageService?: Service<TAuditStorageServiceName, TAuditStorage>;
|
|
772
|
+
/** Optional actor extractor function for audit records */
|
|
773
|
+
actorExtractor?: ActorExtractor<TServices, TSession, TLogger>;
|
|
774
|
+
/** Declarative audit definitions */
|
|
775
|
+
audits?: MappedAudit<TAuditAction, OutSchema>[];
|
|
776
|
+
/** Database service for this endpoint */
|
|
777
|
+
databaseService?: Service<TDatabaseServiceName, TDatabase>;
|
|
680
778
|
}
|
|
681
779
|
|
|
682
780
|
/**
|
|
@@ -927,16 +1025,9 @@ export class ResponseBuilder {
|
|
|
927
1025
|
}
|
|
928
1026
|
|
|
929
1027
|
/**
|
|
930
|
-
*
|
|
931
|
-
* Contains all parsed input data, services, logger, headers, cookies, and session.
|
|
932
|
-
*
|
|
933
|
-
* @template Input - The input schemas (body, query, params)
|
|
934
|
-
* @template TServices - Available service dependencies
|
|
935
|
-
* @template TLogger - Logger type
|
|
936
|
-
* @template TSession - Session data type
|
|
1028
|
+
* Base context properties that are always available
|
|
937
1029
|
*/
|
|
938
|
-
|
|
939
|
-
Input extends EndpointSchemas | undefined = undefined,
|
|
1030
|
+
type BaseEndpointContext<
|
|
940
1031
|
TServices extends Service[] = [],
|
|
941
1032
|
TLogger extends Logger = Logger,
|
|
942
1033
|
TSession = unknown,
|
|
@@ -951,7 +1042,71 @@ export type EndpointContext<
|
|
|
951
1042
|
cookie: CookieFn;
|
|
952
1043
|
/** Session data extracted by getSession */
|
|
953
1044
|
session: TSession;
|
|
954
|
-
}
|
|
1045
|
+
};
|
|
1046
|
+
|
|
1047
|
+
/**
|
|
1048
|
+
* Conditional auditor context - only present when audit storage is configured
|
|
1049
|
+
*/
|
|
1050
|
+
type AuditorContext<
|
|
1051
|
+
TAuditAction extends AuditableAction<string, unknown> = AuditableAction<
|
|
1052
|
+
string,
|
|
1053
|
+
unknown
|
|
1054
|
+
>,
|
|
1055
|
+
TAuditStorage = undefined,
|
|
1056
|
+
> = TAuditStorage extends undefined
|
|
1057
|
+
? {}
|
|
1058
|
+
: {
|
|
1059
|
+
/**
|
|
1060
|
+
* Auditor instance for recording audit events.
|
|
1061
|
+
* Only present when audit storage is configured on the endpoint.
|
|
1062
|
+
* When a transactional database is used for audit storage,
|
|
1063
|
+
* the auditor is pre-configured with the transaction context.
|
|
1064
|
+
*/
|
|
1065
|
+
auditor: Auditor<TAuditAction>;
|
|
1066
|
+
};
|
|
1067
|
+
|
|
1068
|
+
/**
|
|
1069
|
+
* Conditional database context - only present when database service is configured
|
|
1070
|
+
*/
|
|
1071
|
+
type DatabaseContext<TDatabase = undefined> = TDatabase extends undefined
|
|
1072
|
+
? {}
|
|
1073
|
+
: {
|
|
1074
|
+
/**
|
|
1075
|
+
* Database instance for this request.
|
|
1076
|
+
* When audit storage is configured and uses the same database,
|
|
1077
|
+
* this will be the transaction for ACID compliance.
|
|
1078
|
+
* Otherwise, it's the raw database connection.
|
|
1079
|
+
*/
|
|
1080
|
+
db: TDatabase;
|
|
1081
|
+
};
|
|
1082
|
+
|
|
1083
|
+
/**
|
|
1084
|
+
* The execution context provided to endpoint handlers.
|
|
1085
|
+
* Contains all parsed input data, services, logger, headers, cookies, and session.
|
|
1086
|
+
*
|
|
1087
|
+
* @template Input - The input schemas (body, query, params)
|
|
1088
|
+
* @template TServices - Available service dependencies
|
|
1089
|
+
* @template TLogger - Logger type
|
|
1090
|
+
* @template TSession - Session data type
|
|
1091
|
+
* @template TAuditAction - Audit action types (when auditor is configured)
|
|
1092
|
+
* @template TDatabase - Database type (when database service is configured)
|
|
1093
|
+
* @template TAuditStorage - Audit storage type (determines if auditor is present)
|
|
1094
|
+
*/
|
|
1095
|
+
export type EndpointContext<
|
|
1096
|
+
Input extends EndpointSchemas | undefined = undefined,
|
|
1097
|
+
TServices extends Service[] = [],
|
|
1098
|
+
TLogger extends Logger = Logger,
|
|
1099
|
+
TSession = unknown,
|
|
1100
|
+
TAuditAction extends AuditableAction<string, unknown> = AuditableAction<
|
|
1101
|
+
string,
|
|
1102
|
+
unknown
|
|
1103
|
+
>,
|
|
1104
|
+
TDatabase = undefined,
|
|
1105
|
+
TAuditStorage = undefined,
|
|
1106
|
+
> = BaseEndpointContext<TServices, TLogger, TSession> &
|
|
1107
|
+
InferComposableStandardSchema<Input> &
|
|
1108
|
+
AuditorContext<TAuditAction, TAuditStorage> &
|
|
1109
|
+
DatabaseContext<TDatabase>;
|
|
955
1110
|
|
|
956
1111
|
/**
|
|
957
1112
|
* Handler function type for endpoint implementations.
|
|
@@ -988,8 +1143,22 @@ export type EndpointHandler<
|
|
|
988
1143
|
TLogger extends Logger = Logger,
|
|
989
1144
|
OutSchema extends StandardSchemaV1 | undefined = undefined,
|
|
990
1145
|
TSession = unknown,
|
|
1146
|
+
TDatabase = undefined,
|
|
1147
|
+
TAuditStorage = undefined,
|
|
1148
|
+
TAuditAction extends AuditableAction<string, unknown> = AuditableAction<
|
|
1149
|
+
string,
|
|
1150
|
+
unknown
|
|
1151
|
+
>,
|
|
991
1152
|
> = (
|
|
992
|
-
ctx: EndpointContext<
|
|
1153
|
+
ctx: EndpointContext<
|
|
1154
|
+
TInput,
|
|
1155
|
+
TServices,
|
|
1156
|
+
TLogger,
|
|
1157
|
+
TSession,
|
|
1158
|
+
TAuditAction,
|
|
1159
|
+
TDatabase,
|
|
1160
|
+
TAuditStorage
|
|
1161
|
+
>,
|
|
993
1162
|
response: ResponseBuilder,
|
|
994
1163
|
) => OutSchema extends StandardSchemaV1
|
|
995
1164
|
?
|