@geekmidas/constructs 0.0.10 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AWSLambdaFunction-DhUb-Vs6.cjs → AWSLambdaFunction-DMxScuaw.cjs} +3 -3
- package/dist/{AWSLambdaFunction-DhUb-Vs6.cjs.map → AWSLambdaFunction-DMxScuaw.cjs.map} +1 -1
- package/dist/{AWSLambdaFunction-D5V3YVqv.d.cts → AWSLambdaFunction-DSB2oaFG.d.mts} +5 -5
- package/dist/{AWSLambdaFunction-D_V-ZQmS.mjs → AWSLambdaFunction-cL8A169J.mjs} +3 -3
- package/dist/{AWSLambdaFunction-D_V-ZQmS.mjs.map → AWSLambdaFunction-cL8A169J.mjs.map} +1 -1
- package/dist/{AWSLambdaFunction-DvZcnL8a.d.mts → AWSLambdaFunction-t6q2o8EL.d.cts} +5 -5
- package/dist/{AWSLambdaSubscriberAdaptor-J_pSz6pu.d.cts → AWSLambdaSubscriberAdaptor-Cknp_nn1.d.cts} +2 -2
- 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-D6kjKjSf.d.mts → AWSLambdaSubscriberAdaptor-DpHzp-AM.d.mts} +2 -2
- 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-DHcUetbw.mjs → AmazonApiGatewayEndpointAdaptor-CIEhW1TQ.mjs} +47 -16
- package/dist/AmazonApiGatewayEndpointAdaptor-CIEhW1TQ.mjs.map +1 -0
- package/dist/{AmazonApiGatewayEndpointAdaptor-BnNd8tCz.d.cts → AmazonApiGatewayEndpointAdaptor-CwItKPz2.d.cts} +6 -5
- package/dist/{AmazonApiGatewayEndpointAdaptor-DHBF_5jn.cjs → AmazonApiGatewayEndpointAdaptor-H8YvtfQm.cjs} +47 -16
- package/dist/AmazonApiGatewayEndpointAdaptor-H8YvtfQm.cjs.map +1 -0
- package/dist/{AmazonApiGatewayEndpointAdaptor-B7MKo8h3.d.mts → AmazonApiGatewayEndpointAdaptor-eDQgPNLH.d.mts} +7 -6
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-CmUxFoPx.cjs → AmazonApiGatewayV1EndpointAdaptor-0n71d3gq.cjs} +3 -3
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-CmUxFoPx.cjs.map → AmazonApiGatewayV1EndpointAdaptor-0n71d3gq.cjs.map} +1 -1
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-CsV6zyvn.mjs → AmazonApiGatewayV1EndpointAdaptor-B36zXLJ7.mjs} +3 -3
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-CsV6zyvn.mjs.map → AmazonApiGatewayV1EndpointAdaptor-B36zXLJ7.mjs.map} +1 -1
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-gO9OxdZl.d.mts → AmazonApiGatewayV1EndpointAdaptor-CnGVpA38.d.mts} +4 -4
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-BC-a2tt3.d.cts → AmazonApiGatewayV1EndpointAdaptor-DaCvUL6y.d.cts} +3 -3
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-D1uz4wNg.d.mts → AmazonApiGatewayV2EndpointAdaptor-BELz2ijs.d.mts} +4 -4
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-_bFcbEa-.mjs → AmazonApiGatewayV2EndpointAdaptor-CE3wZEb8.mjs} +3 -3
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-_bFcbEa-.mjs.map → AmazonApiGatewayV2EndpointAdaptor-CE3wZEb8.mjs.map} +1 -1
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-zNFUPxSY.d.cts → AmazonApiGatewayV2EndpointAdaptor-DA1PH0nc.d.cts} +3 -3
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-cZbaqiUi.cjs → AmazonApiGatewayV2EndpointAdaptor-DtU3Cb8F.cjs} +3 -3
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-cZbaqiUi.cjs.map → AmazonApiGatewayV2EndpointAdaptor-DtU3Cb8F.cjs.map} +1 -1
- package/dist/{Authorizer-Bbk9ziuG.d.mts → Authorizer-BRCVPz_O.d.mts} +1 -1
- package/dist/{Authorizer-iXsSB600.d.cts → Authorizer-DG54w1m2.d.cts} +1 -1
- package/dist/{BaseFunctionBuilder-BmsbV0BU.cjs → BaseFunctionBuilder-B8rT07QR.cjs} +7 -2
- package/dist/BaseFunctionBuilder-B8rT07QR.cjs.map +1 -0
- package/dist/{BaseFunctionBuilder-DCUtCdVL.mjs → BaseFunctionBuilder-CT7p10K1.mjs} +7 -2
- package/dist/BaseFunctionBuilder-CT7p10K1.mjs.map +1 -0
- package/dist/{BaseFunctionBuilder-C4ZJPkIZ.d.cts → BaseFunctionBuilder-Cf0op65o.d.cts} +7 -4
- package/dist/{BaseFunctionBuilder-CxBX0arJ.d.mts → BaseFunctionBuilder-DilipY1y.d.mts} +7 -4
- package/dist/{Construct-VEI7M3fs.cjs → Construct-BYSPikVm.cjs} +28 -10
- package/dist/Construct-BYSPikVm.cjs.map +1 -0
- package/dist/{Construct-C3hsQBy4.mjs → Construct-LWeB1rSQ.mjs} +28 -10
- package/dist/Construct-LWeB1rSQ.mjs.map +1 -0
- package/dist/{Construct-ci5u8Xnu.d.cts → Construct-ZPqE0vhn.d.mts} +9 -4
- package/dist/{Construct-zhmcmIdY.d.mts → Construct-dI_rgdSp.d.cts} +9 -4
- 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-ByNYsQDH.d.mts → Cron-6lOgKqSA.d.cts} +3 -3
- package/dist/{Cron-DkPL-Fms.d.cts → Cron-BH_07atD.d.mts} +3 -3
- package/dist/{Cron-Dfgr8F9d.cjs → Cron-Bnd-2pgE.cjs} +3 -3
- package/dist/{Cron-Dfgr8F9d.cjs.map → Cron-Bnd-2pgE.cjs.map} +1 -1
- package/dist/{Cron-wP6Ob48_.mjs → Cron-DNRjf2cp.mjs} +3 -3
- package/dist/{Cron-wP6Ob48_.mjs.map → Cron-DNRjf2cp.mjs.map} +1 -1
- package/dist/{CronBuilder-BknVTWLE.d.mts → CronBuilder-5oK2AL2n.d.cts} +5 -5
- package/dist/{CronBuilder-BqTTozUi.d.cts → CronBuilder-D2b4zY4l.d.mts} +5 -5
- package/dist/{CronBuilder-C27c5oqh.mjs → CronBuilder-DdR2TuQa.mjs} +5 -5
- package/dist/{CronBuilder-C27c5oqh.mjs.map → CronBuilder-DdR2TuQa.mjs.map} +1 -1
- package/dist/{CronBuilder-W1ZqCJ7m.cjs → CronBuilder-dtw4ZyH6.cjs} +5 -5
- package/dist/{CronBuilder-W1ZqCJ7m.cjs.map → CronBuilder-dtw4ZyH6.cjs.map} +1 -1
- package/dist/{Endpoint-C98BwZjA.mjs → Endpoint-B69TqESg.mjs} +15 -8
- package/dist/Endpoint-B69TqESg.mjs.map +1 -0
- package/dist/{Endpoint-BjpQmTek.cjs → Endpoint-B9PryZES.cjs} +15 -8
- package/dist/Endpoint-B9PryZES.cjs.map +1 -0
- package/dist/{Endpoint-zHPjZ35J.d.cts → Endpoint-Cs-MsYlY.d.cts} +80 -12
- package/dist/{Endpoint-C16whGI-.d.mts → Endpoint-DuZlyjd4.d.mts} +80 -12
- package/dist/EndpointBuilder-BrB-K1jO.d.mts +86 -0
- package/dist/EndpointBuilder-C-PHInEW.d.cts +86 -0
- package/dist/{EndpointBuilder-CCUx4vep.mjs → EndpointBuilder-DnVL-EU_.mjs} +47 -5
- package/dist/EndpointBuilder-DnVL-EU_.mjs.map +1 -0
- package/dist/{EndpointBuilder-D2Zu8i9b.cjs → EndpointBuilder-DofwCnWJ.cjs} +47 -5
- package/dist/EndpointBuilder-DofwCnWJ.cjs.map +1 -0
- package/dist/{EndpointFactory-KkyIOE62.d.cts → EndpointFactory-6zNpVSYp.d.mts} +12 -11
- package/dist/{EndpointFactory-C4YhgXOc.cjs → EndpointFactory-Ba9mx9MU.cjs} +3 -3
- package/dist/{EndpointFactory-C4YhgXOc.cjs.map → EndpointFactory-Ba9mx9MU.cjs.map} +1 -1
- package/dist/{EndpointFactory-VnSAdwdv.d.mts → EndpointFactory-e5WYVR6t.d.cts} +12 -11
- package/dist/{EndpointFactory-RAb2zcw0.mjs → EndpointFactory-pPaIGFHV.mjs} +3 -3
- package/dist/{EndpointFactory-RAb2zcw0.mjs.map → EndpointFactory-pPaIGFHV.mjs.map} +1 -1
- package/dist/{Function-BbLYIKLL.d.cts → Function-6EWabl_X.d.cts} +5 -4
- package/dist/{Function-1Fh6Tdkg.cjs → Function-CO-s2pB8.cjs} +6 -6
- package/dist/Function-CO-s2pB8.cjs.map +1 -0
- package/dist/{Function-D-QEfH7k.mjs → Function-COnc-tWM.mjs} +6 -6
- package/dist/Function-COnc-tWM.mjs.map +1 -0
- package/dist/{Function-DFRZZCC-.d.mts → Function-G3JPHMaY.d.mts} +5 -4
- package/dist/{FunctionBuilder-DdGjpiFT.d.cts → FunctionBuilder-B3fpp3hA.d.cts} +13 -11
- package/dist/{FunctionBuilder-DuktGyZc.d.mts → FunctionBuilder-ByaB_LQ4.d.mts} +13 -11
- package/dist/{FunctionBuilder-Bxyr1Pf9.mjs → FunctionBuilder-CMhLQ4dt.mjs} +11 -6
- package/dist/FunctionBuilder-CMhLQ4dt.mjs.map +1 -0
- package/dist/{FunctionBuilder-DcEFYgbn.cjs → FunctionBuilder-_hMwZUof.cjs} +11 -6
- package/dist/FunctionBuilder-_hMwZUof.cjs.map +1 -0
- package/dist/{FunctionExecutionWrapper-CRYi047B.d.cts → FunctionExecutionWrapper-Ci-ookJG.d.cts} +2 -2
- package/dist/{FunctionExecutionWrapper-DaR-dSLw.d.mts → FunctionExecutionWrapper-DHFMLrOl.d.mts} +2 -2
- package/dist/{FunctionExecutionWrapper-BL6PE6Dv.mjs → FunctionExecutionWrapper-i9v5L3Av.mjs} +2 -2
- package/dist/{FunctionExecutionWrapper-BL6PE6Dv.mjs.map → FunctionExecutionWrapper-i9v5L3Av.mjs.map} +1 -1
- package/dist/{FunctionExecutionWrapper-Ee-CE8Fz.cjs → FunctionExecutionWrapper-sxJNTpuc.cjs} +2 -2
- package/dist/{FunctionExecutionWrapper-Ee-CE8Fz.cjs.map → FunctionExecutionWrapper-sxJNTpuc.cjs.map} +1 -1
- package/dist/{HonoEndpointAdaptor-CY1mXTe6.d.mts → HonoEndpointAdaptor-BElil8O5.d.mts} +9 -8
- package/dist/{HonoEndpointAdaptor-DcvZdYzx.cjs → HonoEndpointAdaptor-Cw2if5cG.cjs} +51 -20
- package/dist/HonoEndpointAdaptor-Cw2if5cG.cjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-CyVPl4w2.mjs → HonoEndpointAdaptor-DAfnTFVS.mjs} +51 -20
- package/dist/HonoEndpointAdaptor-DAfnTFVS.mjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-CYvrXBe-.d.cts → HonoEndpointAdaptor-DSHl8ZCY.d.cts} +8 -7
- package/dist/{Subscriber-Cy28j8MS.d.cts → Subscriber-BhzqUzs-.d.cts} +2 -2
- package/dist/{Subscriber-CTczVFsF.mjs → Subscriber-CGb8LjZa.mjs} +2 -2
- package/dist/{Subscriber-CTczVFsF.mjs.map → Subscriber-CGb8LjZa.mjs.map} +1 -1
- package/dist/{Subscriber-BL30GpWp.cjs → Subscriber-D-FPWts6.cjs} +2 -2
- package/dist/{Subscriber-BL30GpWp.cjs.map → Subscriber-D-FPWts6.cjs.map} +1 -1
- package/dist/{Subscriber-g3IWM1_d.d.mts → Subscriber-s6yfjeOc.d.mts} +2 -2
- package/dist/{SubscriberBuilder-BzK8kc2a.d.cts → SubscriberBuilder-BCVkp-ga.d.cts} +2 -2
- package/dist/{SubscriberBuilder-CekL3BoP.mjs → SubscriberBuilder-BcAspHv9.mjs} +2 -2
- package/dist/{SubscriberBuilder-CekL3BoP.mjs.map → SubscriberBuilder-BcAspHv9.mjs.map} +1 -1
- package/dist/{SubscriberBuilder-D1hojYLa.cjs → SubscriberBuilder-BfE2cL1q.cjs} +2 -2
- package/dist/{SubscriberBuilder-D1hojYLa.cjs.map → SubscriberBuilder-BfE2cL1q.cjs.map} +1 -1
- package/dist/{SubscriberBuilder-YjQ7qIpQ.d.mts → SubscriberBuilder-aCua5_wA.d.mts} +2 -2
- package/dist/{TestEndpointAdaptor-C-ahwGW6.cjs → TestEndpointAdaptor-Bn1WRFph.cjs} +47 -18
- package/dist/TestEndpointAdaptor-Bn1WRFph.cjs.map +1 -0
- package/dist/{TestEndpointAdaptor-DGWuai69.d.mts → TestEndpointAdaptor-DnlAA_rm.d.mts} +7 -6
- package/dist/{TestEndpointAdaptor-B4z9G5Ap.mjs → TestEndpointAdaptor-DubQOJk_.mjs} +47 -18
- package/dist/TestEndpointAdaptor-DubQOJk_.mjs.map +1 -0
- package/dist/{TestEndpointAdaptor-uXliWYjS.d.cts → TestEndpointAdaptor-o-xtSyQ3.d.cts} +6 -5
- 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 +11 -11
- 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 +4 -4
- package/dist/functions/TestFunctionAdaptor.d.cts +2 -2
- package/dist/functions/TestFunctionAdaptor.d.mts +2 -2
- package/dist/functions/TestFunctionAdaptor.mjs +4 -4
- 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-BYqZAob8.mjs +8 -0
- package/dist/{functions-DD-00sWF.mjs.map → functions-BYqZAob8.mjs.map} +1 -1
- package/dist/{functions-BtgBiuC_.cjs → functions-D03lqK-r.cjs} +2 -2
- package/dist/{functions-BtgBiuC_.cjs.map → functions-D03lqK-r.cjs.map} +1 -1
- package/dist/{helpers-QM_FSjPY.cjs → helpers-BApRyhly.cjs} +2 -2
- package/dist/{helpers-QM_FSjPY.cjs.map → helpers-BApRyhly.cjs.map} +1 -1
- package/dist/{helpers-DtPeOhUV.mjs → helpers-BPDogwac.mjs} +2 -2
- package/dist/{helpers-DtPeOhUV.mjs.map → helpers-BPDogwac.mjs.map} +1 -1
- package/dist/index-CUg_hSq-.d.cts +9 -0
- package/dist/index-D-a7e2gv.d.mts +9 -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.d.cts +1 -1
- package/dist/publisher.d.mts +1 -1
- 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 +14 -10
- package/src/Construct.ts +31 -5
- package/src/endpoints/AmazonApiGatewayEndpointAdaptor.ts +88 -19
- package/src/endpoints/Endpoint.ts +66 -13
- package/src/endpoints/EndpointBuilder.ts +183 -19
- package/src/endpoints/HonoEndpointAdaptor.ts +114 -33
- package/src/endpoints/TestEndpointAdaptor.ts +96 -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 +718 -0
- package/src/endpoints/__tests__/Endpoint.spec.ts +19 -0
- package/src/endpoints/__tests__/EndpointBuilder.audit.spec.ts +424 -0
- package/src/endpoints/__tests__/HonoEndpointAdaptor.audit-transactions.spec.ts +685 -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 +678 -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 +339 -0
- package/src/functions/BaseFunctionBuilder.ts +50 -7
- package/src/functions/Function.ts +13 -9
- package/src/functions/FunctionBuilder.ts +78 -14
- package/src/functions/__tests__/FunctionBuilder.state-isolation.spec.ts +43 -2
- package/dist/AmazonApiGatewayEndpointAdaptor-DHBF_5jn.cjs.map +0 -1
- package/dist/AmazonApiGatewayEndpointAdaptor-DHcUetbw.mjs.map +0 -1
- package/dist/BaseFunctionBuilder-BmsbV0BU.cjs.map +0 -1
- package/dist/BaseFunctionBuilder-DCUtCdVL.mjs.map +0 -1
- package/dist/Construct-C3hsQBy4.mjs.map +0 -1
- package/dist/Construct-VEI7M3fs.cjs.map +0 -1
- package/dist/Endpoint-BjpQmTek.cjs.map +0 -1
- package/dist/Endpoint-C98BwZjA.mjs.map +0 -1
- package/dist/EndpointBuilder-B5l7zQU1.d.cts +0 -55
- package/dist/EndpointBuilder-BzqR0xvt.d.mts +0 -55
- package/dist/EndpointBuilder-CCUx4vep.mjs.map +0 -1
- package/dist/EndpointBuilder-D2Zu8i9b.cjs.map +0 -1
- package/dist/Function-1Fh6Tdkg.cjs.map +0 -1
- package/dist/Function-D-QEfH7k.mjs.map +0 -1
- package/dist/FunctionBuilder-Bxyr1Pf9.mjs.map +0 -1
- package/dist/FunctionBuilder-DcEFYgbn.cjs.map +0 -1
- package/dist/HonoEndpointAdaptor-CyVPl4w2.mjs.map +0 -1
- package/dist/HonoEndpointAdaptor-DcvZdYzx.cjs.map +0 -1
- package/dist/TestEndpointAdaptor-B4z9G5Ap.mjs.map +0 -1
- package/dist/TestEndpointAdaptor-C-ahwGW6.cjs.map +0 -1
- package/dist/functions-DD-00sWF.mjs +0 -8
- package/dist/index-CcmV3PKF.d.cts +0 -9
- package/dist/index-DQt3pQtF.d.mts +0 -9
package/dist/types.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { HttpMethod, LowerHttpMethod, RemoveUndefined } from "./types-
|
|
1
|
+
import { HttpMethod, LowerHttpMethod, RemoveUndefined } from "./types-DKf0juBf.mjs";
|
|
2
2
|
export { HttpMethod, LowerHttpMethod, RemoveUndefined };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geekmidas/constructs",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -59,27 +59,31 @@
|
|
|
59
59
|
"access": "public"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
+
"fast-glob": "~3.3.3",
|
|
63
|
+
"lodash.compact": "~3.0.1",
|
|
64
|
+
"lodash.get": "~4.4.2",
|
|
62
65
|
"lodash.pick": "~4.4.0",
|
|
63
66
|
"lodash.set": "~4.3.2",
|
|
64
|
-
"lodash.get": "~4.4.2",
|
|
65
67
|
"lodash.uniqby": "~4.7.0",
|
|
66
|
-
"lodash.compact": "~3.0.1",
|
|
67
68
|
"openapi-types": "~12.1.3",
|
|
68
|
-
"
|
|
69
|
+
"@geekmidas/cache": "0.0.7",
|
|
70
|
+
"@geekmidas/audit": "0.0.1",
|
|
71
|
+
"@geekmidas/logger": "0.0.1",
|
|
72
|
+
"@geekmidas/rate-limit": "0.1.0",
|
|
69
73
|
"@geekmidas/schema": "0.0.2",
|
|
70
74
|
"@geekmidas/services": "0.0.1",
|
|
71
|
-
"@geekmidas/logger": "0.0.1",
|
|
72
|
-
"@geekmidas/errors": "0.0.1",
|
|
73
|
-
"@geekmidas/cache": "0.0.7",
|
|
74
75
|
"@geekmidas/events": "0.0.2",
|
|
75
|
-
"@geekmidas/
|
|
76
|
+
"@geekmidas/errors": "0.0.1"
|
|
76
77
|
},
|
|
77
78
|
"devDependencies": {
|
|
79
|
+
"@types/lodash.compact": "~3.0.9",
|
|
80
|
+
"@types/lodash.get": "~4.4.9",
|
|
78
81
|
"@types/lodash.pick": "~4.4.9",
|
|
79
82
|
"@types/lodash.set": "~4.3.9",
|
|
80
|
-
"@types/lodash.get": "~4.4.9",
|
|
81
83
|
"@types/lodash.uniqby": "~4.7.9",
|
|
82
|
-
"@types/
|
|
84
|
+
"@types/pg": "~8.15.6",
|
|
85
|
+
"kysely": "~0.28.8",
|
|
86
|
+
"pg": "~8.16.3",
|
|
83
87
|
"zod": "~4.1.12",
|
|
84
88
|
"@geekmidas/testkit": "0.0.17"
|
|
85
89
|
},
|
package/src/Construct.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AuditStorage } from '@geekmidas/audit';
|
|
1
2
|
import { SnifferEnvironmentParser } from '@geekmidas/envkit/sniffer';
|
|
2
3
|
import type { EventPublisher, MappedEvent } from '@geekmidas/events';
|
|
3
4
|
import type { Logger } from '@geekmidas/logger';
|
|
@@ -5,12 +6,18 @@ import type { Service } from '@geekmidas/services';
|
|
|
5
6
|
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
6
7
|
import compact from 'lodash.compact';
|
|
7
8
|
|
|
9
|
+
// Cache for service environment variables to handle singleton services
|
|
10
|
+
// Key: service class/constructor, Value: array of env var names
|
|
11
|
+
const serviceEnvCache = new Map<Service, string[]>();
|
|
12
|
+
|
|
8
13
|
export abstract class Construct<
|
|
9
14
|
TLogger extends Logger = Logger,
|
|
10
15
|
TServiceName extends string = string,
|
|
11
16
|
T extends EventPublisher<any> | undefined = undefined,
|
|
12
17
|
OutSchema extends StandardSchemaV1 | undefined = undefined,
|
|
13
18
|
TServices extends Service[] = [],
|
|
19
|
+
TAuditStorageServiceName extends string = string,
|
|
20
|
+
TAuditStorage extends AuditStorage | undefined = undefined,
|
|
14
21
|
> {
|
|
15
22
|
constructor(
|
|
16
23
|
public readonly type: ConstructType,
|
|
@@ -22,6 +29,10 @@ export abstract class Construct<
|
|
|
22
29
|
public outputSchema?: OutSchema,
|
|
23
30
|
public readonly timeout?: number,
|
|
24
31
|
public readonly memorySize?: number,
|
|
32
|
+
public readonly auditorStorageService?: Service<
|
|
33
|
+
TAuditStorageServiceName,
|
|
34
|
+
TAuditStorage
|
|
35
|
+
>,
|
|
25
36
|
) {}
|
|
26
37
|
|
|
27
38
|
/**
|
|
@@ -29,6 +40,9 @@ export abstract class Construct<
|
|
|
29
40
|
* This is determined by running a "sniffer" EnvironmentParser through each service's
|
|
30
41
|
* register method to track which environment variables are accessed.
|
|
31
42
|
*
|
|
43
|
+
* Results are cached per service class to handle singleton patterns where
|
|
44
|
+
* subsequent register() calls may short-circuit and not access env vars.
|
|
45
|
+
*
|
|
32
46
|
* @returns Promise that resolves to array of environment variable names, sorted alphabetically
|
|
33
47
|
*
|
|
34
48
|
* @example
|
|
@@ -42,15 +56,24 @@ export abstract class Construct<
|
|
|
42
56
|
* ```
|
|
43
57
|
*/
|
|
44
58
|
async getEnvironment(): Promise<string[]> {
|
|
45
|
-
const
|
|
59
|
+
const envVars = new Set<string>();
|
|
46
60
|
const services: Service[] = compact([
|
|
47
61
|
...this.services,
|
|
48
62
|
this.publisherService,
|
|
63
|
+
this.auditorStorageService,
|
|
49
64
|
]);
|
|
50
65
|
|
|
51
66
|
try {
|
|
52
|
-
// Run each service's register method with the sniffer to track env var access
|
|
53
67
|
for (const service of services) {
|
|
68
|
+
// Check cache first - handles singleton services that short-circuit
|
|
69
|
+
if (serviceEnvCache.has(service)) {
|
|
70
|
+
const cached = serviceEnvCache.get(service)!;
|
|
71
|
+
cached.forEach((v) => envVars.add(v));
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Sniff the service for env vars
|
|
76
|
+
const sniffer = new SnifferEnvironmentParser();
|
|
54
77
|
try {
|
|
55
78
|
const result = service.register(sniffer as any);
|
|
56
79
|
|
|
@@ -60,12 +83,15 @@ export abstract class Construct<
|
|
|
60
83
|
}
|
|
61
84
|
} catch {
|
|
62
85
|
// Service registration may fail but env vars are still tracked
|
|
63
|
-
continue;
|
|
64
86
|
}
|
|
87
|
+
|
|
88
|
+
// Cache and collect the env vars
|
|
89
|
+
const serviceEnvVars = sniffer.getEnvironmentVariables();
|
|
90
|
+
serviceEnvCache.set(service, serviceEnvVars);
|
|
91
|
+
serviceEnvVars.forEach((v) => envVars.add(v));
|
|
65
92
|
}
|
|
66
93
|
|
|
67
|
-
|
|
68
|
-
return sniffer.getEnvironmentVariables();
|
|
94
|
+
return Array.from(envVars).sort();
|
|
69
95
|
} catch (error) {
|
|
70
96
|
console.error(
|
|
71
97
|
'Error determining environment variables for construct:',
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AuditableAction, Auditor, AuditStorage } 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 {
|
|
34
|
+
type AuditExecutionContext,
|
|
35
|
+
createAuditContext,
|
|
36
|
+
executeWithAuditTransaction,
|
|
37
|
+
} from './processAudits';
|
|
38
|
+
import type { MappedAudit } from './audit';
|
|
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,83 @@ 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
|
-
if (Endpoint.hasMetadata(response)) {
|
|
242
|
-
data = response.data;
|
|
243
|
-
metadata = response.metadata;
|
|
261
|
+
// Warn if declarative audits are configured but no audit storage
|
|
262
|
+
const audits = this.endpoint.audits as MappedAudit<TAuditAction, TOutSchema>[];
|
|
263
|
+
if (!auditContext && audits?.length) {
|
|
264
|
+
logger.warn('No auditor storage service available');
|
|
244
265
|
}
|
|
245
266
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
267
|
+
// Execute handler with automatic audit transaction support
|
|
268
|
+
const result = await executeWithAuditTransaction(
|
|
269
|
+
auditContext,
|
|
270
|
+
async (auditor) => {
|
|
271
|
+
const responseBuilder = new ResponseBuilder();
|
|
272
|
+
const response = await this.endpoint.handler(
|
|
273
|
+
{
|
|
274
|
+
header: event.header,
|
|
275
|
+
cookie: event.cookie,
|
|
276
|
+
logger: event.logger,
|
|
277
|
+
services: event.services,
|
|
278
|
+
session: event.session,
|
|
279
|
+
auditor,
|
|
280
|
+
...input,
|
|
281
|
+
} as any,
|
|
282
|
+
responseBuilder,
|
|
283
|
+
);
|
|
284
|
+
|
|
285
|
+
// Check if response has metadata
|
|
286
|
+
let data = response;
|
|
287
|
+
let metadata = responseBuilder.getMetadata();
|
|
288
|
+
|
|
289
|
+
if (Endpoint.hasMetadata(response)) {
|
|
290
|
+
data = response.data;
|
|
291
|
+
metadata = response.metadata;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
const output = this.endpoint.outputSchema
|
|
295
|
+
? await this.endpoint.parseOutput(data)
|
|
296
|
+
: undefined;
|
|
297
|
+
|
|
298
|
+
return { output, metadata, responseBuilder };
|
|
299
|
+
},
|
|
300
|
+
// Process declarative audits after handler (inside transaction)
|
|
301
|
+
async (result, auditor) => {
|
|
302
|
+
if (!audits?.length) return;
|
|
303
|
+
|
|
304
|
+
for (const audit of audits) {
|
|
305
|
+
if (audit.when && !audit.when(result.output as any)) {
|
|
306
|
+
continue;
|
|
307
|
+
}
|
|
308
|
+
const payload = audit.payload(result.output as any);
|
|
309
|
+
const entityId = audit.entityId?.(result.output as any);
|
|
310
|
+
auditor.audit(audit.type as any, payload as any, {
|
|
311
|
+
table: audit.table,
|
|
312
|
+
entityId,
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
);
|
|
249
317
|
|
|
318
|
+
const { output, metadata } = result;
|
|
250
319
|
const body = output !== undefined ? JSON.stringify(output) : undefined;
|
|
251
320
|
|
|
252
321
|
// Store response for middleware access
|
|
@@ -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 { AuditableAction, Auditor, AuditStorage } 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 { ActorExtractor, MappedAudit } from './audit';
|
|
31
|
+
import type { Authorizer } from './Authorizer';
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* Represents an HTTP endpoint that can handle requests with type-safe input/output validation,
|
|
@@ -65,6 +65,12 @@ 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
|
+
>,
|
|
68
74
|
> extends Function<
|
|
69
75
|
TInput,
|
|
70
76
|
TServices,
|
|
@@ -72,7 +78,9 @@ export class Endpoint<
|
|
|
72
78
|
OutSchema,
|
|
73
79
|
FunctionHandler<TInput, TServices, TLogger, OutSchema>,
|
|
74
80
|
TEventPublisher,
|
|
75
|
-
TEventPublisherServiceName
|
|
81
|
+
TEventPublisherServiceName,
|
|
82
|
+
TAuditStorage,
|
|
83
|
+
TAuditStorageServiceName
|
|
76
84
|
> {
|
|
77
85
|
operationId?: string;
|
|
78
86
|
/** The route path pattern with parameter placeholders */
|
|
@@ -96,6 +104,10 @@ export class Endpoint<
|
|
|
96
104
|
public rateLimit?: RateLimitConfig;
|
|
97
105
|
/** Optional authorizer for this endpoint */
|
|
98
106
|
public authorizer?: Authorizer;
|
|
107
|
+
/** Optional actor extractor for audit records */
|
|
108
|
+
public actorExtractor?: ActorExtractor<TServices, TSession, TLogger>;
|
|
109
|
+
/** Declarative audit definitions */
|
|
110
|
+
public audits: MappedAudit<TAuditAction, OutSchema>[] = [];
|
|
99
111
|
/** The endpoint handler function */
|
|
100
112
|
private endpointFn!: EndpointHandler<
|
|
101
113
|
TInput,
|
|
@@ -335,6 +347,7 @@ export class Endpoint<
|
|
|
335
347
|
header: ctx.header,
|
|
336
348
|
cookie: ctx.cookie,
|
|
337
349
|
session: ctx.session,
|
|
350
|
+
auditor: ctx.auditor,
|
|
338
351
|
} as EndpointContext<TInput, TServices, TLogger, TSession>,
|
|
339
352
|
response,
|
|
340
353
|
);
|
|
@@ -540,6 +553,9 @@ export class Endpoint<
|
|
|
540
553
|
publisherService,
|
|
541
554
|
events,
|
|
542
555
|
authorizer,
|
|
556
|
+
auditorStorageService,
|
|
557
|
+
actorExtractor,
|
|
558
|
+
audits,
|
|
543
559
|
}: EndpointOptions<
|
|
544
560
|
TRoute,
|
|
545
561
|
TMethod,
|
|
@@ -550,7 +566,10 @@ export class Endpoint<
|
|
|
550
566
|
TSession,
|
|
551
567
|
OutSchema,
|
|
552
568
|
TEventPublisher,
|
|
553
|
-
TEventPublisherServiceName
|
|
569
|
+
TEventPublisherServiceName,
|
|
570
|
+
TAuditStorage,
|
|
571
|
+
TAuditStorageServiceName,
|
|
572
|
+
TAuditAction
|
|
554
573
|
>) {
|
|
555
574
|
super(
|
|
556
575
|
fn as unknown as FunctionHandler<TInput, TServices, TLogger, OutSchema>,
|
|
@@ -563,6 +582,7 @@ export class Endpoint<
|
|
|
563
582
|
publisherService,
|
|
564
583
|
events,
|
|
565
584
|
memorySize,
|
|
585
|
+
auditorStorageService,
|
|
566
586
|
);
|
|
567
587
|
|
|
568
588
|
this.route = route;
|
|
@@ -587,6 +607,14 @@ export class Endpoint<
|
|
|
587
607
|
if (authorizer) {
|
|
588
608
|
this.authorizer = authorizer;
|
|
589
609
|
}
|
|
610
|
+
|
|
611
|
+
if (actorExtractor) {
|
|
612
|
+
this.actorExtractor = actorExtractor;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
if (audits) {
|
|
616
|
+
this.audits = audits;
|
|
617
|
+
}
|
|
590
618
|
}
|
|
591
619
|
}
|
|
592
620
|
|
|
@@ -638,6 +666,12 @@ export interface EndpointOptions<
|
|
|
638
666
|
OutSchema extends StandardSchemaV1 | undefined = undefined,
|
|
639
667
|
TEventPublisher extends EventPublisher<any> | undefined = undefined,
|
|
640
668
|
TEventPublisherServiceName extends string = string,
|
|
669
|
+
TAuditStorage extends AuditStorage | undefined = undefined,
|
|
670
|
+
TAuditStorageServiceName extends string = string,
|
|
671
|
+
TAuditAction extends AuditableAction<string, unknown> = AuditableAction<
|
|
672
|
+
string,
|
|
673
|
+
unknown
|
|
674
|
+
>,
|
|
641
675
|
> {
|
|
642
676
|
/** The route path with parameter placeholders */
|
|
643
677
|
route: TRoute;
|
|
@@ -677,6 +711,14 @@ export interface EndpointOptions<
|
|
|
677
711
|
events?: MappedEvent<TEventPublisher, OutSchema>[];
|
|
678
712
|
/** Optional authorizer configuration */
|
|
679
713
|
authorizer?: Authorizer;
|
|
714
|
+
/**
|
|
715
|
+
* Auditor storage service for persisting audit records from this endpoint
|
|
716
|
+
*/
|
|
717
|
+
auditorStorageService?: Service<TAuditStorageServiceName, TAuditStorage>;
|
|
718
|
+
/** Optional actor extractor function for audit records */
|
|
719
|
+
actorExtractor?: ActorExtractor<TServices, TSession, TLogger>;
|
|
720
|
+
/** Declarative audit definitions */
|
|
721
|
+
audits?: MappedAudit<TAuditAction, OutSchema>[];
|
|
680
722
|
}
|
|
681
723
|
|
|
682
724
|
/**
|
|
@@ -940,6 +982,10 @@ export type EndpointContext<
|
|
|
940
982
|
TServices extends Service[] = [],
|
|
941
983
|
TLogger extends Logger = Logger,
|
|
942
984
|
TSession = unknown,
|
|
985
|
+
TAuditAction extends AuditableAction<string, unknown> = AuditableAction<
|
|
986
|
+
string,
|
|
987
|
+
unknown
|
|
988
|
+
>,
|
|
943
989
|
> = {
|
|
944
990
|
/** Injected service instances */
|
|
945
991
|
services: ServiceRecord<TServices>;
|
|
@@ -951,6 +997,13 @@ export type EndpointContext<
|
|
|
951
997
|
cookie: CookieFn;
|
|
952
998
|
/** Session data extracted by getSession */
|
|
953
999
|
session: TSession;
|
|
1000
|
+
/**
|
|
1001
|
+
* Auditor instance for recording audit events.
|
|
1002
|
+
* Only present when audit storage is configured on the endpoint.
|
|
1003
|
+
* When a transactional database is used for audit storage,
|
|
1004
|
+
* the auditor is pre-configured with the transaction context.
|
|
1005
|
+
*/
|
|
1006
|
+
auditor?: Auditor<TAuditAction>;
|
|
954
1007
|
} & InferComposableStandardSchema<Input>;
|
|
955
1008
|
|
|
956
1009
|
/**
|