@geekmidas/constructs 0.0.11 → 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-DcI_77u8.cjs → AWSLambdaFunction-DMxScuaw.cjs} +3 -3
- package/dist/{AWSLambdaFunction-DcI_77u8.cjs.map → AWSLambdaFunction-DMxScuaw.cjs.map} +1 -1
- package/dist/{AWSLambdaFunction-xyCenuD7.d.cts → AWSLambdaFunction-DSB2oaFG.d.mts} +5 -5
- package/dist/{AWSLambdaFunction-BTSGYZSx.mjs → AWSLambdaFunction-cL8A169J.mjs} +3 -3
- package/dist/{AWSLambdaFunction-BTSGYZSx.mjs.map → AWSLambdaFunction-cL8A169J.mjs.map} +1 -1
- package/dist/{AWSLambdaFunction-Bel0NFTl.d.mts → AWSLambdaFunction-t6q2o8EL.d.cts} +5 -5
- 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-vi0D3dWg.mjs → AmazonApiGatewayEndpointAdaptor-CIEhW1TQ.mjs} +47 -16
- package/dist/AmazonApiGatewayEndpointAdaptor-CIEhW1TQ.mjs.map +1 -0
- package/dist/{AmazonApiGatewayEndpointAdaptor-BwtDtS-i.d.cts → AmazonApiGatewayEndpointAdaptor-CwItKPz2.d.cts} +6 -5
- package/dist/{AmazonApiGatewayEndpointAdaptor-BTqB3c1_.cjs → AmazonApiGatewayEndpointAdaptor-H8YvtfQm.cjs} +47 -16
- package/dist/AmazonApiGatewayEndpointAdaptor-H8YvtfQm.cjs.map +1 -0
- package/dist/{AmazonApiGatewayEndpointAdaptor-CATWBIJo.d.mts → AmazonApiGatewayEndpointAdaptor-eDQgPNLH.d.mts} +7 -6
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-nwrtG5L9.cjs → AmazonApiGatewayV1EndpointAdaptor-0n71d3gq.cjs} +3 -3
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-nwrtG5L9.cjs.map → AmazonApiGatewayV1EndpointAdaptor-0n71d3gq.cjs.map} +1 -1
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-D2_u_zR6.mjs → AmazonApiGatewayV1EndpointAdaptor-B36zXLJ7.mjs} +3 -3
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-D2_u_zR6.mjs.map → AmazonApiGatewayV1EndpointAdaptor-B36zXLJ7.mjs.map} +1 -1
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-2Rd0LLz4.d.mts → AmazonApiGatewayV1EndpointAdaptor-CnGVpA38.d.mts} +4 -4
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-B1AVk2MM.d.cts → AmazonApiGatewayV1EndpointAdaptor-DaCvUL6y.d.cts} +3 -3
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-cBDfwdBx.d.mts → AmazonApiGatewayV2EndpointAdaptor-BELz2ijs.d.mts} +4 -4
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-DoWAJ9oN.mjs → AmazonApiGatewayV2EndpointAdaptor-CE3wZEb8.mjs} +3 -3
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-DoWAJ9oN.mjs.map → AmazonApiGatewayV2EndpointAdaptor-CE3wZEb8.mjs.map} +1 -1
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-DmY_QfjO.d.cts → AmazonApiGatewayV2EndpointAdaptor-DA1PH0nc.d.cts} +3 -3
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-FSIdXYV6.cjs → AmazonApiGatewayV2EndpointAdaptor-DtU3Cb8F.cjs} +3 -3
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-FSIdXYV6.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-bTDKP7bd.cjs → BaseFunctionBuilder-B8rT07QR.cjs} +7 -2
- package/dist/BaseFunctionBuilder-B8rT07QR.cjs.map +1 -0
- package/dist/{BaseFunctionBuilder-DSqF1r3a.mjs → BaseFunctionBuilder-CT7p10K1.mjs} +7 -2
- package/dist/BaseFunctionBuilder-CT7p10K1.mjs.map +1 -0
- package/dist/{BaseFunctionBuilder-DOcm1heZ.d.mts → BaseFunctionBuilder-Cf0op65o.d.cts} +8 -5
- package/dist/{BaseFunctionBuilder-hWNVKXQB.d.cts → BaseFunctionBuilder-DilipY1y.d.mts} +8 -5
- 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-D5HGEt6g.d.mts → Cron-6lOgKqSA.d.cts} +3 -3
- package/dist/{Cron-DbJNPTbP.d.cts → Cron-BH_07atD.d.mts} +3 -3
- package/dist/{Cron-CYIhd0VE.cjs → Cron-Bnd-2pgE.cjs} +3 -3
- package/dist/{Cron-CYIhd0VE.cjs.map → Cron-Bnd-2pgE.cjs.map} +1 -1
- package/dist/{Cron-BnO1uXhh.mjs → Cron-DNRjf2cp.mjs} +3 -3
- package/dist/{Cron-BnO1uXhh.mjs.map → Cron-DNRjf2cp.mjs.map} +1 -1
- package/dist/{CronBuilder-D-546XtP.d.cts → CronBuilder-5oK2AL2n.d.cts} +4 -4
- package/dist/{CronBuilder-vRiZb1_N.d.mts → CronBuilder-D2b4zY4l.d.mts} +4 -4
- package/dist/{CronBuilder-BxKwHCdJ.mjs → CronBuilder-DdR2TuQa.mjs} +5 -5
- package/dist/{CronBuilder-BxKwHCdJ.mjs.map → CronBuilder-DdR2TuQa.mjs.map} +1 -1
- package/dist/{CronBuilder-D_3AiPFO.cjs → CronBuilder-dtw4ZyH6.cjs} +5 -5
- package/dist/{CronBuilder-D_3AiPFO.cjs.map → CronBuilder-dtw4ZyH6.cjs.map} +1 -1
- package/dist/{Endpoint-ChzcIFdV.mjs → Endpoint-B69TqESg.mjs} +15 -8
- package/dist/Endpoint-B69TqESg.mjs.map +1 -0
- package/dist/{Endpoint-BdIGWw1H.cjs → Endpoint-B9PryZES.cjs} +15 -8
- package/dist/Endpoint-B9PryZES.cjs.map +1 -0
- package/dist/{Endpoint-BpTSQn7W.d.cts → Endpoint-Cs-MsYlY.d.cts} +80 -12
- package/dist/{Endpoint-DqZkc6ft.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-yo40Qkf_.mjs → EndpointBuilder-DnVL-EU_.mjs} +47 -5
- package/dist/EndpointBuilder-DnVL-EU_.mjs.map +1 -0
- package/dist/{EndpointBuilder-dmMiNRm9.cjs → EndpointBuilder-DofwCnWJ.cjs} +47 -5
- package/dist/EndpointBuilder-DofwCnWJ.cjs.map +1 -0
- package/dist/{EndpointFactory-JPhk0Qom.d.cts → EndpointFactory-6zNpVSYp.d.mts} +12 -11
- package/dist/{EndpointFactory-CNbcr8u_.cjs → EndpointFactory-Ba9mx9MU.cjs} +3 -3
- package/dist/{EndpointFactory-CNbcr8u_.cjs.map → EndpointFactory-Ba9mx9MU.cjs.map} +1 -1
- package/dist/{EndpointFactory-D_mmO7Gu.d.mts → EndpointFactory-e5WYVR6t.d.cts} +12 -11
- package/dist/{EndpointFactory-LD3upVQK.mjs → EndpointFactory-pPaIGFHV.mjs} +3 -3
- package/dist/{EndpointFactory-LD3upVQK.mjs.map → EndpointFactory-pPaIGFHV.mjs.map} +1 -1
- package/dist/{Function-C-5_23Wi.d.mts → Function-6EWabl_X.d.cts} +6 -5
- package/dist/{Function-DDaSfL_E.cjs → Function-CO-s2pB8.cjs} +6 -6
- package/dist/Function-CO-s2pB8.cjs.map +1 -0
- package/dist/{Function-Cl9fiR3a.mjs → Function-COnc-tWM.mjs} +6 -6
- package/dist/Function-COnc-tWM.mjs.map +1 -0
- package/dist/{Function-CW-WcZTu.d.cts → Function-G3JPHMaY.d.mts} +6 -5
- package/dist/{FunctionBuilder-fU1H7tFN.d.cts → FunctionBuilder-B3fpp3hA.d.cts} +13 -11
- package/dist/{FunctionBuilder-udObIGV0.d.mts → FunctionBuilder-ByaB_LQ4.d.mts} +13 -11
- package/dist/{FunctionBuilder-vW12WFOw.mjs → FunctionBuilder-CMhLQ4dt.mjs} +11 -6
- package/dist/FunctionBuilder-CMhLQ4dt.mjs.map +1 -0
- package/dist/{FunctionBuilder-LQuBiqRc.cjs → FunctionBuilder-_hMwZUof.cjs} +11 -6
- package/dist/FunctionBuilder-_hMwZUof.cjs.map +1 -0
- package/dist/{FunctionExecutionWrapper-DYBy9OP3.d.mts → FunctionExecutionWrapper-Ci-ookJG.d.cts} +4 -4
- package/dist/{FunctionExecutionWrapper-Dwr2ZKzC.d.cts → FunctionExecutionWrapper-DHFMLrOl.d.mts} +4 -4
- package/dist/{FunctionExecutionWrapper-Dtyhid1Q.mjs → FunctionExecutionWrapper-i9v5L3Av.mjs} +2 -2
- package/dist/{FunctionExecutionWrapper-Dtyhid1Q.mjs.map → FunctionExecutionWrapper-i9v5L3Av.mjs.map} +1 -1
- package/dist/{FunctionExecutionWrapper-BBIoHUt6.cjs → FunctionExecutionWrapper-sxJNTpuc.cjs} +2 -2
- package/dist/{FunctionExecutionWrapper-BBIoHUt6.cjs.map → FunctionExecutionWrapper-sxJNTpuc.cjs.map} +1 -1
- package/dist/{HonoEndpointAdaptor-W-disJnm.d.mts → HonoEndpointAdaptor-BElil8O5.d.mts} +7 -6
- package/dist/{HonoEndpointAdaptor-Bc61IS6Q.cjs → HonoEndpointAdaptor-Cw2if5cG.cjs} +51 -20
- package/dist/HonoEndpointAdaptor-Cw2if5cG.cjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-NR3h5gml.mjs → HonoEndpointAdaptor-DAfnTFVS.mjs} +51 -20
- package/dist/HonoEndpointAdaptor-DAfnTFVS.mjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-BVQtyvna.d.cts → HonoEndpointAdaptor-DSHl8ZCY.d.cts} +8 -7
- package/dist/{Subscriber-BVq3ST4C.d.cts → Subscriber-BhzqUzs-.d.cts} +2 -2
- package/dist/{Subscriber-BKftCzwT.mjs → Subscriber-CGb8LjZa.mjs} +2 -2
- package/dist/{Subscriber-BKftCzwT.mjs.map → Subscriber-CGb8LjZa.mjs.map} +1 -1
- package/dist/{Subscriber-C2OPATI8.cjs → Subscriber-D-FPWts6.cjs} +2 -2
- package/dist/{Subscriber-C2OPATI8.cjs.map → Subscriber-D-FPWts6.cjs.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-BcAspHv9.mjs} +2 -2
- package/dist/{SubscriberBuilder-yDfpHPZE.mjs.map → SubscriberBuilder-BcAspHv9.mjs.map} +1 -1
- package/dist/{SubscriberBuilder-yikoQ8ND.cjs → SubscriberBuilder-BfE2cL1q.cjs} +2 -2
- package/dist/{SubscriberBuilder-yikoQ8ND.cjs.map → SubscriberBuilder-BfE2cL1q.cjs.map} +1 -1
- package/dist/{SubscriberBuilder-CHIRyNjy.d.cts → SubscriberBuilder-aCua5_wA.d.mts} +3 -3
- package/dist/{TestEndpointAdaptor-DA1D6l-U.cjs → TestEndpointAdaptor-Bn1WRFph.cjs} +47 -18
- package/dist/TestEndpointAdaptor-Bn1WRFph.cjs.map +1 -0
- package/dist/{TestEndpointAdaptor-B10J-cI-.d.mts → TestEndpointAdaptor-DnlAA_rm.d.mts} +7 -6
- package/dist/{TestEndpointAdaptor-DpmNXp7G.mjs → TestEndpointAdaptor-DubQOJk_.mjs} +47 -18
- package/dist/TestEndpointAdaptor-DubQOJk_.mjs.map +1 -0
- package/dist/{TestEndpointAdaptor-BrE5Rs4U.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-HCoZ4YKF.mjs.map → functions-BYqZAob8.mjs.map} +1 -1
- package/dist/{functions-yg097ymU.cjs → functions-D03lqK-r.cjs} +2 -2
- package/dist/{functions-yg097ymU.cjs.map → functions-D03lqK-r.cjs.map} +1 -1
- package/dist/{helpers-Cq6wjo7s.cjs → helpers-BApRyhly.cjs} +2 -2
- package/dist/{helpers-Cq6wjo7s.cjs.map → helpers-BApRyhly.cjs.map} +1 -1
- package/dist/{helpers-CHsIWAEx.mjs → helpers-BPDogwac.mjs} +2 -2
- package/dist/{helpers-CHsIWAEx.mjs.map → helpers-BPDogwac.mjs.map} +1 -1
- package/dist/{index-RtxMVjUZ.d.mts → index-CUg_hSq-.d.cts} +3 -3
- 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 +8 -0
- 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-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/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/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-vW12WFOw.mjs.map +0 -1
- 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-fiIGH95t.d.cts +0 -9
|
@@ -21,6 +21,7 @@ describe('Endpoint', () => {
|
|
|
21
21
|
services: [],
|
|
22
22
|
logger: {} as any,
|
|
23
23
|
timeout: undefined,
|
|
24
|
+
memorySize: undefined,
|
|
24
25
|
});
|
|
25
26
|
|
|
26
27
|
const spec = await endpoint.toOpenApi3Route();
|
|
@@ -58,6 +59,7 @@ describe('Endpoint', () => {
|
|
|
58
59
|
getSession: undefined,
|
|
59
60
|
logger: {} as any,
|
|
60
61
|
timeout: undefined,
|
|
62
|
+
memorySize: undefined,
|
|
61
63
|
});
|
|
62
64
|
|
|
63
65
|
const spec = await endpoint.toOpenApi3Route();
|
|
@@ -96,6 +98,7 @@ describe('Endpoint', () => {
|
|
|
96
98
|
services: [],
|
|
97
99
|
logger: {} as any,
|
|
98
100
|
timeout: undefined,
|
|
101
|
+
memorySize: undefined,
|
|
99
102
|
});
|
|
100
103
|
|
|
101
104
|
const spec = await endpoint.toOpenApi3Route();
|
|
@@ -142,6 +145,7 @@ describe('Endpoint', () => {
|
|
|
142
145
|
services: [],
|
|
143
146
|
logger: {} as any,
|
|
144
147
|
timeout: undefined,
|
|
148
|
+
memorySize: undefined,
|
|
145
149
|
});
|
|
146
150
|
|
|
147
151
|
const spec = await endpoint.toOpenApi3Route();
|
|
@@ -190,6 +194,7 @@ describe('Endpoint', () => {
|
|
|
190
194
|
services: [],
|
|
191
195
|
logger: {} as any,
|
|
192
196
|
timeout: undefined,
|
|
197
|
+
memorySize: undefined,
|
|
193
198
|
status: undefined,
|
|
194
199
|
getSession: undefined,
|
|
195
200
|
});
|
|
@@ -255,6 +260,7 @@ describe('Endpoint', () => {
|
|
|
255
260
|
services: [],
|
|
256
261
|
logger: {} as any,
|
|
257
262
|
timeout: undefined,
|
|
263
|
+
memorySize: undefined,
|
|
258
264
|
});
|
|
259
265
|
|
|
260
266
|
const spec = await endpoint.toOpenApi3Route();
|
|
@@ -312,6 +318,7 @@ describe('Endpoint', () => {
|
|
|
312
318
|
services: [],
|
|
313
319
|
logger: {} as any,
|
|
314
320
|
timeout: undefined,
|
|
321
|
+
memorySize: undefined,
|
|
315
322
|
description: undefined,
|
|
316
323
|
});
|
|
317
324
|
|
|
@@ -351,6 +358,7 @@ describe('Endpoint', () => {
|
|
|
351
358
|
services: [],
|
|
352
359
|
logger: {} as any,
|
|
353
360
|
timeout: undefined,
|
|
361
|
+
memorySize: undefined,
|
|
354
362
|
description: undefined,
|
|
355
363
|
});
|
|
356
364
|
|
|
@@ -383,6 +391,7 @@ describe('Endpoint', () => {
|
|
|
383
391
|
services: [],
|
|
384
392
|
logger: {} as any,
|
|
385
393
|
timeout: undefined,
|
|
394
|
+
memorySize: undefined,
|
|
386
395
|
status: undefined,
|
|
387
396
|
getSession: undefined,
|
|
388
397
|
authorize: undefined,
|
|
@@ -458,6 +467,7 @@ describe('Endpoint', () => {
|
|
|
458
467
|
authorize: undefined,
|
|
459
468
|
logger: mockLogger,
|
|
460
469
|
timeout: undefined,
|
|
470
|
+
memorySize: undefined,
|
|
461
471
|
status: undefined,
|
|
462
472
|
getSession: undefined,
|
|
463
473
|
description: undefined,
|
|
@@ -485,6 +495,7 @@ describe('Endpoint', () => {
|
|
|
485
495
|
logger: mockLogger,
|
|
486
496
|
authorize: undefined,
|
|
487
497
|
timeout: undefined,
|
|
498
|
+
memorySize: undefined,
|
|
488
499
|
status: undefined,
|
|
489
500
|
getSession: undefined,
|
|
490
501
|
description: undefined,
|
|
@@ -517,6 +528,7 @@ describe('Endpoint', () => {
|
|
|
517
528
|
services: [],
|
|
518
529
|
logger: mockLogger,
|
|
519
530
|
timeout: undefined,
|
|
531
|
+
memorySize: undefined,
|
|
520
532
|
authorize: undefined,
|
|
521
533
|
status: undefined,
|
|
522
534
|
getSession: undefined,
|
|
@@ -551,6 +563,7 @@ describe('Endpoint', () => {
|
|
|
551
563
|
authorize: undefined,
|
|
552
564
|
logger: mockLogger,
|
|
553
565
|
timeout: undefined,
|
|
566
|
+
memorySize: undefined,
|
|
554
567
|
status: undefined,
|
|
555
568
|
getSession: undefined,
|
|
556
569
|
description: undefined,
|
|
@@ -596,6 +609,7 @@ describe('Endpoint', () => {
|
|
|
596
609
|
services: [TestService],
|
|
597
610
|
logger: mockLogger,
|
|
598
611
|
timeout: undefined,
|
|
612
|
+
memorySize: undefined,
|
|
599
613
|
status: undefined,
|
|
600
614
|
authorize: async ({ services }) => {
|
|
601
615
|
return services.TestService.validateUser('valid');
|
|
@@ -626,6 +640,7 @@ describe('Endpoint', () => {
|
|
|
626
640
|
services: [],
|
|
627
641
|
logger: mockLogger,
|
|
628
642
|
timeout: undefined,
|
|
643
|
+
memorySize: undefined,
|
|
629
644
|
status: undefined,
|
|
630
645
|
getSession: undefined,
|
|
631
646
|
description: undefined,
|
|
@@ -665,6 +680,7 @@ describe('Endpoint', () => {
|
|
|
665
680
|
services: [],
|
|
666
681
|
logger: mockLogger,
|
|
667
682
|
timeout: undefined,
|
|
683
|
+
memorySize: undefined,
|
|
668
684
|
status: undefined,
|
|
669
685
|
getSession: () => ({ role: 'admin' }),
|
|
670
686
|
description: undefined,
|
|
@@ -701,6 +717,7 @@ describe('Endpoint', () => {
|
|
|
701
717
|
|
|
702
718
|
logger: mockLogger,
|
|
703
719
|
timeout: undefined,
|
|
720
|
+
memorySize: undefined,
|
|
704
721
|
status: undefined,
|
|
705
722
|
getSession: undefined,
|
|
706
723
|
description: undefined,
|
|
@@ -727,6 +744,7 @@ describe('Endpoint', () => {
|
|
|
727
744
|
services: [],
|
|
728
745
|
logger: mockLogger,
|
|
729
746
|
timeout: undefined,
|
|
747
|
+
memorySize: undefined,
|
|
730
748
|
authorize: undefined,
|
|
731
749
|
status: undefined,
|
|
732
750
|
getSession: undefined,
|
|
@@ -759,6 +777,7 @@ describe('Endpoint', () => {
|
|
|
759
777
|
services: [],
|
|
760
778
|
logger: mockLogger,
|
|
761
779
|
timeout: undefined,
|
|
780
|
+
memorySize: undefined,
|
|
762
781
|
status: undefined,
|
|
763
782
|
getSession: undefined,
|
|
764
783
|
description: undefined,
|
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AuditableAction,
|
|
3
|
+
AuditRecord,
|
|
4
|
+
AuditStorage,
|
|
5
|
+
} from '@geekmidas/audit';
|
|
6
|
+
import type { Service } from '@geekmidas/services';
|
|
7
|
+
import { describe, expect, it } from 'vitest';
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
import { EndpointBuilder } from '../EndpointBuilder';
|
|
10
|
+
import type { ActorExtractor, MappedAudit } from '../audit';
|
|
11
|
+
|
|
12
|
+
// In-memory audit storage for testing
|
|
13
|
+
class InMemoryAuditStorage implements AuditStorage {
|
|
14
|
+
records: AuditRecord[] = [];
|
|
15
|
+
|
|
16
|
+
async write(records: AuditRecord[]): Promise<void> {
|
|
17
|
+
this.records.push(...records);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async query(): Promise<AuditRecord[]> {
|
|
21
|
+
return this.records;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const auditStorageService = {
|
|
26
|
+
serviceName: 'auditStorage' as const,
|
|
27
|
+
async register() {
|
|
28
|
+
return new InMemoryAuditStorage();
|
|
29
|
+
},
|
|
30
|
+
} satisfies Service<'auditStorage', InMemoryAuditStorage>;
|
|
31
|
+
|
|
32
|
+
// Define test audit actions
|
|
33
|
+
type TestAuditAction =
|
|
34
|
+
| AuditableAction<'user.created', { userId: string; email: string }>
|
|
35
|
+
| AuditableAction<'user.updated', { userId: string; changes: string[] }>
|
|
36
|
+
| AuditableAction<'user.deleted', { userId: string }>;
|
|
37
|
+
|
|
38
|
+
describe('EndpointBuilder audit methods', () => {
|
|
39
|
+
describe('auditor', () => {
|
|
40
|
+
it('should set auditor storage service', () => {
|
|
41
|
+
const builder = new EndpointBuilder('/users', 'POST').auditor(
|
|
42
|
+
auditStorageService,
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
expect((builder as any)._auditorStorage).toBe(auditStorageService);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('should return builder for chaining', () => {
|
|
49
|
+
const builder = new EndpointBuilder('/users', 'POST');
|
|
50
|
+
const result = builder.auditor(auditStorageService);
|
|
51
|
+
|
|
52
|
+
expect(result).toBe(builder);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('should pass auditor storage service to endpoint', () => {
|
|
56
|
+
const endpoint = new EndpointBuilder('/users', 'POST')
|
|
57
|
+
.auditor(auditStorageService)
|
|
58
|
+
.handle(async () => ({ id: '123' }));
|
|
59
|
+
|
|
60
|
+
expect(endpoint.auditorStorageService).toBe(auditStorageService);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('should allow chaining with other methods', () => {
|
|
64
|
+
const bodySchema = z.object({ name: z.string() });
|
|
65
|
+
const outputSchema = z.object({ id: z.string() });
|
|
66
|
+
|
|
67
|
+
const endpoint = new EndpointBuilder('/users', 'POST')
|
|
68
|
+
.body(bodySchema)
|
|
69
|
+
.output(outputSchema)
|
|
70
|
+
.auditor(auditStorageService)
|
|
71
|
+
.status(201)
|
|
72
|
+
.handle(async () => ({ id: '123' }));
|
|
73
|
+
|
|
74
|
+
expect(endpoint.auditorStorageService).toBe(auditStorageService);
|
|
75
|
+
expect(endpoint.input?.body).toBe(bodySchema);
|
|
76
|
+
expect(endpoint.outputSchema).toBe(outputSchema);
|
|
77
|
+
expect(endpoint.status).toBe(201);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
describe('actor', () => {
|
|
82
|
+
it('should set actor extractor function', () => {
|
|
83
|
+
const actorExtractor: ActorExtractor = ({ session }) => ({
|
|
84
|
+
id: (session as any)?.userId ?? 'anonymous',
|
|
85
|
+
type: 'user',
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
const builder = new EndpointBuilder('/users', 'POST').actor(
|
|
89
|
+
actorExtractor,
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
expect((builder as any)._actorExtractor).toBe(actorExtractor);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it('should return builder for chaining', () => {
|
|
96
|
+
const builder = new EndpointBuilder('/users', 'POST');
|
|
97
|
+
const result = builder.actor(() => ({ id: '123', type: 'user' }));
|
|
98
|
+
|
|
99
|
+
expect(result).toBe(builder);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it('should pass actor extractor to endpoint', () => {
|
|
103
|
+
const actorExtractor: ActorExtractor = ({ header }) => ({
|
|
104
|
+
id: header('x-user-id') ?? 'anonymous',
|
|
105
|
+
type: 'user',
|
|
106
|
+
ip: header('x-forwarded-for'),
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
const endpoint = new EndpointBuilder('/users', 'POST')
|
|
110
|
+
.auditor(auditStorageService)
|
|
111
|
+
.actor(actorExtractor)
|
|
112
|
+
.handle(async () => ({ id: '123' }));
|
|
113
|
+
|
|
114
|
+
expect(endpoint.actorExtractor).toBe(actorExtractor);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it('should work with async actor extractor', () => {
|
|
118
|
+
const asyncActorExtractor: ActorExtractor = async ({ services }) => {
|
|
119
|
+
// Simulate async lookup
|
|
120
|
+
await Promise.resolve();
|
|
121
|
+
return { id: 'async-user', type: 'user' };
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const endpoint = new EndpointBuilder('/users', 'POST')
|
|
125
|
+
.auditor(auditStorageService)
|
|
126
|
+
.actor(asyncActorExtractor)
|
|
127
|
+
.handle(async () => ({ id: '123' }));
|
|
128
|
+
|
|
129
|
+
expect(endpoint.actorExtractor).toBe(asyncActorExtractor);
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
it('should allow chaining auditor and actor in any order', () => {
|
|
133
|
+
const actorExtractor: ActorExtractor = () => ({ id: '123', type: 'user' });
|
|
134
|
+
|
|
135
|
+
// auditor then actor
|
|
136
|
+
const endpoint1 = new EndpointBuilder('/users', 'POST')
|
|
137
|
+
.auditor(auditStorageService)
|
|
138
|
+
.actor(actorExtractor)
|
|
139
|
+
.handle(async () => ({ id: '123' }));
|
|
140
|
+
|
|
141
|
+
// actor then auditor
|
|
142
|
+
const endpoint2 = new EndpointBuilder('/users', 'POST')
|
|
143
|
+
.actor(actorExtractor)
|
|
144
|
+
.auditor(auditStorageService)
|
|
145
|
+
.handle(async () => ({ id: '123' }));
|
|
146
|
+
|
|
147
|
+
expect(endpoint1.auditorStorageService).toBe(auditStorageService);
|
|
148
|
+
expect(endpoint1.actorExtractor).toBe(actorExtractor);
|
|
149
|
+
expect(endpoint2.auditorStorageService).toBe(auditStorageService);
|
|
150
|
+
expect(endpoint2.actorExtractor).toBe(actorExtractor);
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
describe('audit', () => {
|
|
155
|
+
it('should set declarative audit definitions', () => {
|
|
156
|
+
const outputSchema = z.object({
|
|
157
|
+
id: z.string(),
|
|
158
|
+
email: z.string(),
|
|
159
|
+
active: z.boolean(),
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
const audits: MappedAudit<TestAuditAction, typeof outputSchema>[] = [
|
|
163
|
+
{
|
|
164
|
+
type: 'user.created',
|
|
165
|
+
payload: (response) => ({
|
|
166
|
+
userId: response.id,
|
|
167
|
+
email: response.email,
|
|
168
|
+
}),
|
|
169
|
+
},
|
|
170
|
+
];
|
|
171
|
+
|
|
172
|
+
const builder = new EndpointBuilder('/users', 'POST')
|
|
173
|
+
.output(outputSchema)
|
|
174
|
+
.audit<TestAuditAction>(audits);
|
|
175
|
+
|
|
176
|
+
expect((builder as any)._audits).toBe(audits);
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
it('should return builder for chaining', () => {
|
|
180
|
+
const builder = new EndpointBuilder('/users', 'POST');
|
|
181
|
+
const result = builder.audit([]);
|
|
182
|
+
|
|
183
|
+
expect(result).toBe(builder);
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
it('should pass audit definitions to endpoint', () => {
|
|
187
|
+
const outputSchema = z.object({
|
|
188
|
+
id: z.string(),
|
|
189
|
+
email: z.string(),
|
|
190
|
+
active: z.boolean(),
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
const audits: MappedAudit<TestAuditAction, typeof outputSchema>[] = [
|
|
194
|
+
{
|
|
195
|
+
type: 'user.created',
|
|
196
|
+
payload: (response) => ({
|
|
197
|
+
userId: response.id,
|
|
198
|
+
email: response.email,
|
|
199
|
+
}),
|
|
200
|
+
when: (response) => response.active,
|
|
201
|
+
entityId: (response) => response.id,
|
|
202
|
+
table: 'users',
|
|
203
|
+
},
|
|
204
|
+
];
|
|
205
|
+
|
|
206
|
+
const endpoint = new EndpointBuilder('/users', 'POST')
|
|
207
|
+
.output(outputSchema)
|
|
208
|
+
.auditor(auditStorageService)
|
|
209
|
+
.audit<TestAuditAction>(audits)
|
|
210
|
+
.handle(async () => ({ id: '123', email: 'test@test.com', active: true }));
|
|
211
|
+
|
|
212
|
+
expect(endpoint.audits).toBe(audits);
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
it('should support multiple audit definitions', () => {
|
|
216
|
+
const outputSchema = z.object({
|
|
217
|
+
id: z.string(),
|
|
218
|
+
email: z.string(),
|
|
219
|
+
changes: z.array(z.string()),
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
const audits: MappedAudit<TestAuditAction, typeof outputSchema>[] = [
|
|
223
|
+
{
|
|
224
|
+
type: 'user.created',
|
|
225
|
+
payload: (response) => ({
|
|
226
|
+
userId: response.id,
|
|
227
|
+
email: response.email,
|
|
228
|
+
}),
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
type: 'user.updated',
|
|
232
|
+
payload: (response) => ({
|
|
233
|
+
userId: response.id,
|
|
234
|
+
changes: response.changes,
|
|
235
|
+
}),
|
|
236
|
+
when: (response) => response.changes.length > 0,
|
|
237
|
+
},
|
|
238
|
+
];
|
|
239
|
+
|
|
240
|
+
const endpoint = new EndpointBuilder('/users', 'POST')
|
|
241
|
+
.output(outputSchema)
|
|
242
|
+
.auditor(auditStorageService)
|
|
243
|
+
.audit<TestAuditAction>(audits)
|
|
244
|
+
.handle(async () => ({
|
|
245
|
+
id: '123',
|
|
246
|
+
email: 'test@test.com',
|
|
247
|
+
changes: ['name'],
|
|
248
|
+
}));
|
|
249
|
+
|
|
250
|
+
expect(endpoint.audits).toHaveLength(2);
|
|
251
|
+
expect(endpoint.audits[0].type).toBe('user.created');
|
|
252
|
+
expect(endpoint.audits[1].type).toBe('user.updated');
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
it('should support conditional audits with when function', () => {
|
|
256
|
+
const outputSchema = z.object({
|
|
257
|
+
id: z.string(),
|
|
258
|
+
email: z.string(),
|
|
259
|
+
active: z.boolean(),
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
const audits: MappedAudit<TestAuditAction, typeof outputSchema>[] = [
|
|
263
|
+
{
|
|
264
|
+
type: 'user.created',
|
|
265
|
+
payload: (response) => ({
|
|
266
|
+
userId: response.id,
|
|
267
|
+
email: response.email,
|
|
268
|
+
}),
|
|
269
|
+
when: (response) => response.active,
|
|
270
|
+
},
|
|
271
|
+
];
|
|
272
|
+
|
|
273
|
+
const endpoint = new EndpointBuilder('/users', 'POST')
|
|
274
|
+
.output(outputSchema)
|
|
275
|
+
.audit<TestAuditAction>(audits)
|
|
276
|
+
.handle(async () => ({ id: '123', email: 'test@test.com', active: true }));
|
|
277
|
+
|
|
278
|
+
// Verify the when function works
|
|
279
|
+
const whenFn = endpoint.audits[0].when!;
|
|
280
|
+
expect(whenFn({ id: '1', email: 'a@b.com', active: true })).toBe(true);
|
|
281
|
+
expect(whenFn({ id: '1', email: 'a@b.com', active: false })).toBe(false);
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
it('should support entityId extraction', () => {
|
|
285
|
+
const outputSchema = z.object({
|
|
286
|
+
id: z.string(),
|
|
287
|
+
email: z.string(),
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
const audits: MappedAudit<TestAuditAction, typeof outputSchema>[] = [
|
|
291
|
+
{
|
|
292
|
+
type: 'user.created',
|
|
293
|
+
payload: (response) => ({
|
|
294
|
+
userId: response.id,
|
|
295
|
+
email: response.email,
|
|
296
|
+
}),
|
|
297
|
+
entityId: (response) => response.id,
|
|
298
|
+
},
|
|
299
|
+
];
|
|
300
|
+
|
|
301
|
+
const endpoint = new EndpointBuilder('/users', 'POST')
|
|
302
|
+
.output(outputSchema)
|
|
303
|
+
.audit<TestAuditAction>(audits)
|
|
304
|
+
.handle(async () => ({ id: '123', email: 'test@test.com' }));
|
|
305
|
+
|
|
306
|
+
const entityIdFn = endpoint.audits[0].entityId!;
|
|
307
|
+
expect(entityIdFn({ id: 'user-456', email: 'a@b.com' })).toBe('user-456');
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
it('should support composite entityId', () => {
|
|
311
|
+
const outputSchema = z.object({
|
|
312
|
+
id: z.string(),
|
|
313
|
+
orgId: z.string(),
|
|
314
|
+
email: z.string(),
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
const audits: MappedAudit<TestAuditAction, typeof outputSchema>[] = [
|
|
318
|
+
{
|
|
319
|
+
type: 'user.created',
|
|
320
|
+
payload: (response) => ({
|
|
321
|
+
userId: response.id,
|
|
322
|
+
email: response.email,
|
|
323
|
+
}),
|
|
324
|
+
entityId: (response) => ({ userId: response.id, orgId: response.orgId }),
|
|
325
|
+
},
|
|
326
|
+
];
|
|
327
|
+
|
|
328
|
+
const endpoint = new EndpointBuilder('/users', 'POST')
|
|
329
|
+
.output(outputSchema)
|
|
330
|
+
.audit<TestAuditAction>(audits)
|
|
331
|
+
.handle(async () => ({ id: '123', orgId: 'org-1', email: 'test@test.com' }));
|
|
332
|
+
|
|
333
|
+
const entityIdFn = endpoint.audits[0].entityId!;
|
|
334
|
+
expect(entityIdFn({ id: 'u-1', orgId: 'o-1', email: 'a@b.com' })).toEqual({
|
|
335
|
+
userId: 'u-1',
|
|
336
|
+
orgId: 'o-1',
|
|
337
|
+
});
|
|
338
|
+
});
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
describe('full audit chain', () => {
|
|
342
|
+
it('should support complete audit configuration', () => {
|
|
343
|
+
const outputSchema = z.object({
|
|
344
|
+
id: z.string(),
|
|
345
|
+
email: z.string(),
|
|
346
|
+
active: z.boolean(),
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
const actorExtractor: ActorExtractor = ({ session, header }) => ({
|
|
350
|
+
id: (session as any)?.userId ?? 'anonymous',
|
|
351
|
+
type: 'user',
|
|
352
|
+
ip: header('x-forwarded-for'),
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
const audits: MappedAudit<TestAuditAction, typeof outputSchema>[] = [
|
|
356
|
+
{
|
|
357
|
+
type: 'user.created',
|
|
358
|
+
payload: (response) => ({
|
|
359
|
+
userId: response.id,
|
|
360
|
+
email: response.email,
|
|
361
|
+
}),
|
|
362
|
+
when: (response) => response.active,
|
|
363
|
+
entityId: (response) => response.id,
|
|
364
|
+
table: 'users',
|
|
365
|
+
},
|
|
366
|
+
];
|
|
367
|
+
|
|
368
|
+
const endpoint = new EndpointBuilder('/users', 'POST')
|
|
369
|
+
.output(outputSchema)
|
|
370
|
+
.auditor(auditStorageService)
|
|
371
|
+
.actor(actorExtractor)
|
|
372
|
+
.audit<TestAuditAction>(audits)
|
|
373
|
+
.handle(async () => ({ id: '123', email: 'test@test.com', active: true }));
|
|
374
|
+
|
|
375
|
+
expect(endpoint.auditorStorageService).toBe(auditStorageService);
|
|
376
|
+
expect(endpoint.actorExtractor).toBe(actorExtractor);
|
|
377
|
+
expect(endpoint.audits).toBe(audits);
|
|
378
|
+
expect(endpoint.audits[0].table).toBe('users');
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
it('should work without actor extractor', () => {
|
|
382
|
+
const outputSchema = z.object({ id: z.string(), email: z.string() });
|
|
383
|
+
|
|
384
|
+
const audits: MappedAudit<TestAuditAction, typeof outputSchema>[] = [
|
|
385
|
+
{
|
|
386
|
+
type: 'user.created',
|
|
387
|
+
payload: (response) => ({
|
|
388
|
+
userId: response.id,
|
|
389
|
+
email: response.email,
|
|
390
|
+
}),
|
|
391
|
+
},
|
|
392
|
+
];
|
|
393
|
+
|
|
394
|
+
const endpoint = new EndpointBuilder('/users', 'POST')
|
|
395
|
+
.output(outputSchema)
|
|
396
|
+
.auditor(auditStorageService)
|
|
397
|
+
.audit<TestAuditAction>(audits)
|
|
398
|
+
.handle(async () => ({ id: '123', email: 'test@test.com' }));
|
|
399
|
+
|
|
400
|
+
expect(endpoint.auditorStorageService).toBe(auditStorageService);
|
|
401
|
+
expect(endpoint.actorExtractor).toBeUndefined();
|
|
402
|
+
expect(endpoint.audits).toBe(audits);
|
|
403
|
+
});
|
|
404
|
+
|
|
405
|
+
it('should work without audit definitions (imperative auditing only)', () => {
|
|
406
|
+
const endpoint = new EndpointBuilder('/users', 'POST')
|
|
407
|
+
.auditor(auditStorageService)
|
|
408
|
+
.actor(() => ({ id: '123', type: 'user' }))
|
|
409
|
+
.handle(async () => ({ id: '123' }));
|
|
410
|
+
|
|
411
|
+
expect(endpoint.auditorStorageService).toBe(auditStorageService);
|
|
412
|
+
expect(endpoint.actorExtractor).toBeDefined();
|
|
413
|
+
expect(endpoint.audits).toEqual([]);
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
it('should default to empty audits array', () => {
|
|
417
|
+
const endpoint = new EndpointBuilder('/users', 'GET').handle(
|
|
418
|
+
async () => ({}),
|
|
419
|
+
);
|
|
420
|
+
|
|
421
|
+
expect(endpoint.audits).toEqual([]);
|
|
422
|
+
});
|
|
423
|
+
});
|
|
424
|
+
});
|