@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, Auditor } from '@geekmidas/audit';
|
|
1
2
|
import type { EnvironmentParser } from '@geekmidas/envkit';
|
|
2
3
|
import middy, { type MiddlewareObj } from '@middy/core';
|
|
3
4
|
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
@@ -26,10 +27,17 @@ type FunctionEvent<
|
|
|
26
27
|
TInput extends ComposableStandardSchema | undefined,
|
|
27
28
|
TServices extends Service[],
|
|
28
29
|
TLogger extends Logger,
|
|
30
|
+
TDatabase = undefined,
|
|
31
|
+
TAuditAction extends AuditableAction<string, unknown> = AuditableAction<
|
|
32
|
+
string,
|
|
33
|
+
unknown
|
|
34
|
+
>,
|
|
29
35
|
> = TEvent & {
|
|
30
36
|
parsedInput: InferComposableStandardSchema<TInput>;
|
|
31
37
|
services: ServiceRecord<TServices>;
|
|
32
38
|
logger: TLogger;
|
|
39
|
+
db: TDatabase | undefined;
|
|
40
|
+
auditor: Auditor<TAuditAction> | undefined;
|
|
33
41
|
};
|
|
34
42
|
|
|
35
43
|
type Middleware<
|
|
@@ -38,8 +46,13 @@ type Middleware<
|
|
|
38
46
|
TServices extends Service[],
|
|
39
47
|
TLogger extends Logger,
|
|
40
48
|
TOutSchema extends StandardSchemaV1 | undefined,
|
|
49
|
+
TDatabase = undefined,
|
|
50
|
+
TAuditAction extends AuditableAction<string, unknown> = AuditableAction<
|
|
51
|
+
string,
|
|
52
|
+
unknown
|
|
53
|
+
>,
|
|
41
54
|
> = MiddlewareObj<
|
|
42
|
-
FunctionEvent<TEvent, TInput, TServices, TLogger>,
|
|
55
|
+
FunctionEvent<TEvent, TInput, TServices, TLogger, TDatabase, TAuditAction>,
|
|
43
56
|
InferComposableStandardSchema<TOutSchema>,
|
|
44
57
|
Error,
|
|
45
58
|
Context
|
|
@@ -52,13 +65,26 @@ export class AWSLambdaFunction<
|
|
|
52
65
|
TLogger extends Logger = Logger,
|
|
53
66
|
TEventPublisher extends EventPublisher<any> | undefined = undefined,
|
|
54
67
|
TEventPublisherServiceName extends string = string,
|
|
68
|
+
TAuditStorage extends AuditStorage | undefined = undefined,
|
|
69
|
+
TAuditStorageServiceName extends string = string,
|
|
70
|
+
TDatabase = undefined,
|
|
71
|
+
TDatabaseServiceName extends string = string,
|
|
72
|
+
TAuditAction extends AuditableAction<string, unknown> = AuditableAction<
|
|
73
|
+
string,
|
|
74
|
+
unknown
|
|
75
|
+
>,
|
|
55
76
|
> extends FunctionExecutionWrapper<
|
|
56
77
|
TInput,
|
|
57
78
|
TOutSchema,
|
|
58
79
|
TServices,
|
|
59
80
|
TLogger,
|
|
60
81
|
TEventPublisher,
|
|
61
|
-
TEventPublisherServiceName
|
|
82
|
+
TEventPublisherServiceName,
|
|
83
|
+
TAuditStorage,
|
|
84
|
+
TAuditStorageServiceName,
|
|
85
|
+
TDatabase,
|
|
86
|
+
TDatabaseServiceName,
|
|
87
|
+
TAuditAction
|
|
62
88
|
> {
|
|
63
89
|
constructor(
|
|
64
90
|
envParser: EnvironmentParser<{}>,
|
|
@@ -67,9 +93,22 @@ export class AWSLambdaFunction<
|
|
|
67
93
|
TServices,
|
|
68
94
|
TLogger,
|
|
69
95
|
TOutSchema,
|
|
70
|
-
FunctionHandler<TInput, TServices, TLogger, TOutSchema>,
|
|
71
96
|
TEventPublisher,
|
|
72
|
-
TEventPublisherServiceName
|
|
97
|
+
TEventPublisherServiceName,
|
|
98
|
+
TAuditStorage,
|
|
99
|
+
TAuditStorageServiceName,
|
|
100
|
+
TDatabase,
|
|
101
|
+
TDatabaseServiceName,
|
|
102
|
+
TAuditAction,
|
|
103
|
+
FunctionHandler<
|
|
104
|
+
TInput,
|
|
105
|
+
TServices,
|
|
106
|
+
TLogger,
|
|
107
|
+
TOutSchema,
|
|
108
|
+
TDatabase,
|
|
109
|
+
TAuditStorage,
|
|
110
|
+
TAuditAction
|
|
111
|
+
>
|
|
73
112
|
>,
|
|
74
113
|
) {
|
|
75
114
|
super(envParser, fn);
|
|
@@ -80,7 +119,9 @@ export class AWSLambdaFunction<
|
|
|
80
119
|
TInput,
|
|
81
120
|
TServices,
|
|
82
121
|
TLogger,
|
|
83
|
-
TOutSchema
|
|
122
|
+
TOutSchema,
|
|
123
|
+
TDatabase,
|
|
124
|
+
TAuditAction
|
|
84
125
|
> {
|
|
85
126
|
return {
|
|
86
127
|
onError: (req) => {
|
|
@@ -98,7 +139,9 @@ export class AWSLambdaFunction<
|
|
|
98
139
|
TInput,
|
|
99
140
|
TServices,
|
|
100
141
|
TLogger,
|
|
101
|
-
TOutSchema
|
|
142
|
+
TOutSchema,
|
|
143
|
+
TDatabase,
|
|
144
|
+
TAuditAction
|
|
102
145
|
> {
|
|
103
146
|
return {
|
|
104
147
|
before: (req) => {},
|
|
@@ -107,7 +150,15 @@ export class AWSLambdaFunction<
|
|
|
107
150
|
|
|
108
151
|
private input<
|
|
109
152
|
TEvent extends { input: InferComposableStandardSchema<TInput> },
|
|
110
|
-
>(): Middleware<
|
|
153
|
+
>(): Middleware<
|
|
154
|
+
TEvent,
|
|
155
|
+
TInput,
|
|
156
|
+
TServices,
|
|
157
|
+
TLogger,
|
|
158
|
+
TOutSchema,
|
|
159
|
+
TDatabase,
|
|
160
|
+
TAuditAction
|
|
161
|
+
> {
|
|
111
162
|
return {
|
|
112
163
|
before: async (req) => {
|
|
113
164
|
try {
|
|
@@ -141,7 +192,9 @@ export class AWSLambdaFunction<
|
|
|
141
192
|
TInput,
|
|
142
193
|
TServices,
|
|
143
194
|
TLogger,
|
|
144
|
-
TOutSchema
|
|
195
|
+
TOutSchema,
|
|
196
|
+
TDatabase,
|
|
197
|
+
TAuditAction
|
|
145
198
|
> {
|
|
146
199
|
return {
|
|
147
200
|
before: (req) => {
|
|
@@ -166,7 +219,9 @@ export class AWSLambdaFunction<
|
|
|
166
219
|
TInput,
|
|
167
220
|
TServices,
|
|
168
221
|
TLogger,
|
|
169
|
-
TOutSchema
|
|
222
|
+
TOutSchema,
|
|
223
|
+
TDatabase,
|
|
224
|
+
TAuditAction
|
|
170
225
|
> {
|
|
171
226
|
return {
|
|
172
227
|
before: async (req) => {
|
|
@@ -175,12 +230,59 @@ export class AWSLambdaFunction<
|
|
|
175
230
|
};
|
|
176
231
|
}
|
|
177
232
|
|
|
233
|
+
private database<TEvent>(): Middleware<
|
|
234
|
+
TEvent,
|
|
235
|
+
TInput,
|
|
236
|
+
TServices,
|
|
237
|
+
TLogger,
|
|
238
|
+
TOutSchema,
|
|
239
|
+
TDatabase,
|
|
240
|
+
TAuditAction
|
|
241
|
+
> {
|
|
242
|
+
return {
|
|
243
|
+
before: async (req) => {
|
|
244
|
+
req.event.db = await this.getDatabase();
|
|
245
|
+
},
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
private auditor<TEvent>(): Middleware<
|
|
250
|
+
TEvent,
|
|
251
|
+
TInput,
|
|
252
|
+
TServices,
|
|
253
|
+
TLogger,
|
|
254
|
+
TOutSchema,
|
|
255
|
+
TDatabase,
|
|
256
|
+
TAuditAction
|
|
257
|
+
> {
|
|
258
|
+
return {
|
|
259
|
+
before: async (req) => {
|
|
260
|
+
req.event.auditor = await this.createAuditor();
|
|
261
|
+
},
|
|
262
|
+
after: async (req) => {
|
|
263
|
+
// Flush any pending audits after successful execution
|
|
264
|
+
if (req.event.auditor) {
|
|
265
|
+
const records = req.event.auditor.getRecords();
|
|
266
|
+
if (records.length > 0) {
|
|
267
|
+
this.logger.debug(
|
|
268
|
+
{ auditCount: records.length },
|
|
269
|
+
'Flushing function audits',
|
|
270
|
+
);
|
|
271
|
+
await req.event.auditor.flush();
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
|
|
178
278
|
private events<TEvent>(): Middleware<
|
|
179
279
|
TEvent,
|
|
180
280
|
TInput,
|
|
181
281
|
TServices,
|
|
182
282
|
TLogger,
|
|
183
|
-
TOutSchema
|
|
283
|
+
TOutSchema,
|
|
284
|
+
TDatabase,
|
|
285
|
+
TAuditAction
|
|
184
286
|
> {
|
|
185
287
|
return {
|
|
186
288
|
after: async (req) => {
|
|
@@ -192,14 +294,23 @@ export class AWSLambdaFunction<
|
|
|
192
294
|
}
|
|
193
295
|
|
|
194
296
|
private async _handler<TEvent>(
|
|
195
|
-
event: FunctionEvent<
|
|
297
|
+
event: FunctionEvent<
|
|
298
|
+
TEvent,
|
|
299
|
+
TInput,
|
|
300
|
+
TServices,
|
|
301
|
+
TLogger,
|
|
302
|
+
TDatabase,
|
|
303
|
+
TAuditAction
|
|
304
|
+
>,
|
|
196
305
|
) {
|
|
197
306
|
// Execute the function with the parsed context
|
|
198
307
|
const result = await this.fn['fn']({
|
|
199
308
|
input: event.parsedInput,
|
|
200
309
|
services: event.services,
|
|
201
310
|
logger: event.logger,
|
|
202
|
-
|
|
311
|
+
db: event.db,
|
|
312
|
+
auditor: event.auditor,
|
|
313
|
+
} as any);
|
|
203
314
|
|
|
204
315
|
// Parse output if schema is provided
|
|
205
316
|
const output = await this.fn.parseOutput(result);
|
|
@@ -216,6 +327,8 @@ export class AWSLambdaFunction<
|
|
|
216
327
|
.use(this.baseInput())
|
|
217
328
|
.use(this.error())
|
|
218
329
|
.use(this.services())
|
|
330
|
+
.use(this.database())
|
|
331
|
+
.use(this.auditor())
|
|
219
332
|
.use(this.input())
|
|
220
333
|
.use(this.events()) as unknown as AWSLambdaHandler;
|
|
221
334
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import type { AuditStorage } from '@geekmidas/audit';
|
|
2
|
+
import type { EventPublisher, MappedEvent } from '@geekmidas/events';
|
|
1
3
|
import type { Logger } from '@geekmidas/logger';
|
|
2
4
|
import { ConsoleLogger } from '@geekmidas/logger/console';
|
|
3
|
-
import type { Service } from '@geekmidas/services';
|
|
4
|
-
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
5
|
-
import get from 'lodash.get';
|
|
6
|
-
import { ConstructType } from '../Construct';
|
|
7
|
-
|
|
8
|
-
import type { EventPublisher, MappedEvent } from '@geekmidas/events';
|
|
9
5
|
import type {
|
|
10
6
|
ComposableStandardSchema,
|
|
11
7
|
InferComposableStandardSchema,
|
|
12
8
|
} from '@geekmidas/schema';
|
|
9
|
+
import type { Service } from '@geekmidas/services';
|
|
10
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
11
|
+
import get from 'lodash.get';
|
|
12
|
+
import { ConstructType } from '../Construct';
|
|
13
13
|
|
|
14
14
|
const DEFAULT_LOGGER = new ConsoleLogger() as any;
|
|
15
15
|
|
|
@@ -20,6 +20,10 @@ export abstract class BaseFunctionBuilder<
|
|
|
20
20
|
TLogger extends Logger = Logger,
|
|
21
21
|
TEventPublisher extends EventPublisher<any> | undefined = undefined,
|
|
22
22
|
TEventPublisherServiceName extends string = string,
|
|
23
|
+
TAuditStorage extends AuditStorage | undefined = undefined,
|
|
24
|
+
TAuditStorageServiceName extends string = string,
|
|
25
|
+
TDatabase = undefined,
|
|
26
|
+
TDatabaseServiceName extends string = string,
|
|
23
27
|
> {
|
|
24
28
|
protected inputSchema?: TInput;
|
|
25
29
|
protected outputSchema?: OutSchema;
|
|
@@ -30,6 +34,8 @@ export abstract class BaseFunctionBuilder<
|
|
|
30
34
|
|
|
31
35
|
protected _events: MappedEvent<TEventPublisher, OutSchema>[] = [];
|
|
32
36
|
protected _publisher?: Service<TEventPublisherServiceName, TEventPublisher>;
|
|
37
|
+
protected _auditorStorage?: Service<TAuditStorageServiceName, TAuditStorage>;
|
|
38
|
+
protected _databaseService?: Service<TDatabaseServiceName, TDatabase>;
|
|
33
39
|
|
|
34
40
|
static isStandardSchemaV1(s: unknown): s is StandardSchemaV1 {
|
|
35
41
|
const schema = (s as StandardSchemaV1)['~standard'];
|
|
@@ -92,7 +98,18 @@ export abstract class BaseFunctionBuilder<
|
|
|
92
98
|
|
|
93
99
|
publisher<T extends EventPublisher<any>, TName extends string>(
|
|
94
100
|
publisher: Service<TName, T>,
|
|
95
|
-
): BaseFunctionBuilder<
|
|
101
|
+
): BaseFunctionBuilder<
|
|
102
|
+
TInput,
|
|
103
|
+
OutSchema,
|
|
104
|
+
TServices,
|
|
105
|
+
TLogger,
|
|
106
|
+
T,
|
|
107
|
+
TName,
|
|
108
|
+
TAuditStorage,
|
|
109
|
+
TAuditStorageServiceName,
|
|
110
|
+
TDatabase,
|
|
111
|
+
TDatabaseServiceName
|
|
112
|
+
> {
|
|
96
113
|
this._publisher = publisher as unknown as Service<
|
|
97
114
|
TEventPublisherServiceName,
|
|
98
115
|
TEventPublisher
|
|
@@ -104,6 +121,80 @@ export abstract class BaseFunctionBuilder<
|
|
|
104
121
|
TServices,
|
|
105
122
|
TLogger,
|
|
106
123
|
T,
|
|
124
|
+
TName,
|
|
125
|
+
TAuditStorage,
|
|
126
|
+
TAuditStorageServiceName,
|
|
127
|
+
TDatabase,
|
|
128
|
+
TDatabaseServiceName
|
|
129
|
+
>;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
auditor<T extends AuditStorage, TName extends string>(
|
|
133
|
+
storage: Service<TName, T>,
|
|
134
|
+
): BaseFunctionBuilder<
|
|
135
|
+
TInput,
|
|
136
|
+
OutSchema,
|
|
137
|
+
TServices,
|
|
138
|
+
TLogger,
|
|
139
|
+
TEventPublisher,
|
|
140
|
+
TEventPublisherServiceName,
|
|
141
|
+
T,
|
|
142
|
+
TName,
|
|
143
|
+
TDatabase,
|
|
144
|
+
TDatabaseServiceName
|
|
145
|
+
> {
|
|
146
|
+
this._auditorStorage = storage as unknown as Service<
|
|
147
|
+
TAuditStorageServiceName,
|
|
148
|
+
TAuditStorage
|
|
149
|
+
>;
|
|
150
|
+
|
|
151
|
+
return this as unknown as BaseFunctionBuilder<
|
|
152
|
+
TInput,
|
|
153
|
+
OutSchema,
|
|
154
|
+
TServices,
|
|
155
|
+
TLogger,
|
|
156
|
+
TEventPublisher,
|
|
157
|
+
TEventPublisherServiceName,
|
|
158
|
+
T,
|
|
159
|
+
TName,
|
|
160
|
+
TDatabase,
|
|
161
|
+
TDatabaseServiceName
|
|
162
|
+
>;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Set the database service for this function.
|
|
167
|
+
* The database will be available in the handler context as `db`.
|
|
168
|
+
*/
|
|
169
|
+
database<T, TName extends string>(
|
|
170
|
+
service: Service<TName, T>,
|
|
171
|
+
): BaseFunctionBuilder<
|
|
172
|
+
TInput,
|
|
173
|
+
OutSchema,
|
|
174
|
+
TServices,
|
|
175
|
+
TLogger,
|
|
176
|
+
TEventPublisher,
|
|
177
|
+
TEventPublisherServiceName,
|
|
178
|
+
TAuditStorage,
|
|
179
|
+
TAuditStorageServiceName,
|
|
180
|
+
T,
|
|
181
|
+
TName
|
|
182
|
+
> {
|
|
183
|
+
this._databaseService = service as unknown as Service<
|
|
184
|
+
TDatabaseServiceName,
|
|
185
|
+
TDatabase
|
|
186
|
+
>;
|
|
187
|
+
|
|
188
|
+
return this as unknown as BaseFunctionBuilder<
|
|
189
|
+
TInput,
|
|
190
|
+
OutSchema,
|
|
191
|
+
TServices,
|
|
192
|
+
TLogger,
|
|
193
|
+
TEventPublisher,
|
|
194
|
+
TEventPublisherServiceName,
|
|
195
|
+
TAuditStorage,
|
|
196
|
+
TAuditStorageServiceName,
|
|
197
|
+
T,
|
|
107
198
|
TName
|
|
108
199
|
>;
|
|
109
200
|
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import type { Service, ServiceRecord } from '@geekmidas/services';
|
|
5
|
-
import { Construct, ConstructType } from '../Construct';
|
|
6
|
-
|
|
1
|
+
import type { AuditStorage, AuditableAction, Auditor } from '@geekmidas/audit';
|
|
2
|
+
import { UnprocessableEntityError } from '@geekmidas/errors';
|
|
7
3
|
import type { EventPublisher, MappedEvent } from '@geekmidas/events';
|
|
8
4
|
import type { Logger } from '@geekmidas/logger';
|
|
9
5
|
import { ConsoleLogger } from '@geekmidas/logger/console';
|
|
@@ -12,9 +8,11 @@ import type {
|
|
|
12
8
|
InferComposableStandardSchema,
|
|
13
9
|
InferStandardSchema,
|
|
14
10
|
} from '@geekmidas/schema';
|
|
15
|
-
|
|
16
|
-
import { UnprocessableEntityError } from '@geekmidas/errors';
|
|
17
11
|
import { parseSchema } from '@geekmidas/schema/parser';
|
|
12
|
+
import type { Service, ServiceRecord } from '@geekmidas/services';
|
|
13
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
14
|
+
import uniqBy from 'lodash.uniqby';
|
|
15
|
+
import { Construct, ConstructType } from '../Construct';
|
|
18
16
|
|
|
19
17
|
const DEFAULT_LOGGER = new ConsoleLogger() as any;
|
|
20
18
|
|
|
@@ -54,20 +52,41 @@ export class Function<
|
|
|
54
52
|
TServices extends Service[] = [],
|
|
55
53
|
TLogger extends Logger = Logger,
|
|
56
54
|
OutSchema extends StandardSchemaV1 | undefined = undefined,
|
|
55
|
+
TEventPublisher extends EventPublisher<any> | undefined = undefined,
|
|
56
|
+
TEventPublisherServiceName extends string = string,
|
|
57
|
+
TAuditStorage extends AuditStorage | undefined = undefined,
|
|
58
|
+
TAuditStorageServiceName extends string = string,
|
|
59
|
+
TDatabase = undefined,
|
|
60
|
+
TDatabaseServiceName extends string = string,
|
|
61
|
+
TAuditAction extends AuditableAction<string, unknown> = AuditableAction<
|
|
62
|
+
string,
|
|
63
|
+
unknown
|
|
64
|
+
>,
|
|
57
65
|
Fn extends FunctionHandler<
|
|
58
66
|
TInput,
|
|
59
67
|
TServices,
|
|
60
68
|
TLogger,
|
|
61
|
-
OutSchema
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
69
|
+
OutSchema,
|
|
70
|
+
TDatabase,
|
|
71
|
+
TAuditStorage,
|
|
72
|
+
TAuditAction
|
|
73
|
+
> = FunctionHandler<
|
|
74
|
+
TInput,
|
|
75
|
+
TServices,
|
|
76
|
+
TLogger,
|
|
77
|
+
OutSchema,
|
|
78
|
+
TDatabase,
|
|
79
|
+
TAuditStorage,
|
|
80
|
+
TAuditAction
|
|
81
|
+
>,
|
|
65
82
|
> extends Construct<
|
|
66
83
|
TLogger,
|
|
67
84
|
TEventPublisherServiceName,
|
|
68
85
|
TEventPublisher,
|
|
69
86
|
OutSchema,
|
|
70
|
-
TServices
|
|
87
|
+
TServices,
|
|
88
|
+
TAuditStorageServiceName,
|
|
89
|
+
TAuditStorage
|
|
71
90
|
> {
|
|
72
91
|
__IS_FUNCTION__ = true;
|
|
73
92
|
|
|
@@ -134,6 +153,8 @@ export class Function<
|
|
|
134
153
|
publisherService?: Service<TEventPublisherServiceName, TEventPublisher>,
|
|
135
154
|
events: MappedEvent<TEventPublisher, OutSchema>[] = [],
|
|
136
155
|
memorySize?: number,
|
|
156
|
+
auditorStorageService?: Service<TAuditStorageServiceName, TAuditStorage>,
|
|
157
|
+
public databaseService?: Service<TDatabaseServiceName, TDatabase>,
|
|
137
158
|
) {
|
|
138
159
|
super(
|
|
139
160
|
type,
|
|
@@ -144,6 +165,7 @@ export class Function<
|
|
|
144
165
|
outputSchema,
|
|
145
166
|
timeout,
|
|
146
167
|
memorySize,
|
|
168
|
+
auditorStorageService,
|
|
147
169
|
);
|
|
148
170
|
}
|
|
149
171
|
}
|
|
@@ -153,18 +175,64 @@ export type FunctionHandler<
|
|
|
153
175
|
TServices extends Service[] = [],
|
|
154
176
|
TLogger extends Logger = Logger,
|
|
155
177
|
OutSchema extends StandardSchemaV1 | undefined = undefined,
|
|
178
|
+
TDatabase = undefined,
|
|
179
|
+
TAuditStorage extends AuditStorage | undefined = undefined,
|
|
180
|
+
TAuditAction extends AuditableAction<string, unknown> = AuditableAction<
|
|
181
|
+
string,
|
|
182
|
+
unknown
|
|
183
|
+
>,
|
|
156
184
|
> = (
|
|
157
|
-
ctx: FunctionContext<
|
|
185
|
+
ctx: FunctionContext<
|
|
186
|
+
TInput,
|
|
187
|
+
TServices,
|
|
188
|
+
TLogger,
|
|
189
|
+
TDatabase,
|
|
190
|
+
TAuditStorage,
|
|
191
|
+
TAuditAction
|
|
192
|
+
>,
|
|
158
193
|
) => OutSchema extends StandardSchemaV1
|
|
159
194
|
? InferStandardSchema<OutSchema> | Promise<InferStandardSchema<OutSchema>>
|
|
160
195
|
: any | Promise<any>;
|
|
161
196
|
|
|
197
|
+
/**
|
|
198
|
+
* Conditional type that adds `db` property only when TDatabase is configured.
|
|
199
|
+
*/
|
|
200
|
+
type DatabaseContext<TDatabase> = TDatabase extends undefined
|
|
201
|
+
? {}
|
|
202
|
+
: { db: TDatabase };
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Conditional auditor context - only present when audit storage is configured.
|
|
206
|
+
*/
|
|
207
|
+
type AuditorContext<
|
|
208
|
+
TAuditAction extends AuditableAction<string, unknown> = AuditableAction<
|
|
209
|
+
string,
|
|
210
|
+
unknown
|
|
211
|
+
>,
|
|
212
|
+
TAuditStorage = undefined,
|
|
213
|
+
> = TAuditStorage extends undefined
|
|
214
|
+
? {}
|
|
215
|
+
: {
|
|
216
|
+
/**
|
|
217
|
+
* Auditor instance for recording audit events.
|
|
218
|
+
* Only present when audit storage is configured on the function.
|
|
219
|
+
*/
|
|
220
|
+
auditor: Auditor<TAuditAction>;
|
|
221
|
+
};
|
|
222
|
+
|
|
162
223
|
export type FunctionContext<
|
|
163
224
|
Input extends ComposableStandardSchema | undefined = undefined,
|
|
164
225
|
TServices extends Service[] = [],
|
|
165
226
|
TLogger extends Logger = Logger,
|
|
227
|
+
TDatabase = undefined,
|
|
228
|
+
TAuditStorage extends AuditStorage | undefined = undefined,
|
|
229
|
+
TAuditAction extends AuditableAction<string, unknown> = AuditableAction<
|
|
230
|
+
string,
|
|
231
|
+
unknown
|
|
232
|
+
>,
|
|
166
233
|
> = {
|
|
167
234
|
services: ServiceRecord<TServices>;
|
|
168
235
|
logger: TLogger;
|
|
169
236
|
input: InferComposableStandardSchema<Input>;
|
|
170
|
-
}
|
|
237
|
+
} & DatabaseContext<TDatabase> &
|
|
238
|
+
AuditorContext<TAuditAction, TAuditStorage>;
|