@geekmidas/constructs 0.3.2 → 0.6.0
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-C54a1doJ.mjs → AWSLambdaFunction-BMTaCrG9.mjs} +6 -6
- package/dist/AWSLambdaFunction-BMTaCrG9.mjs.map +1 -0
- package/dist/{AWSLambdaFunction-BdebRMUh.d.mts → AWSLambdaFunction-BfLF5vNa.d.cts} +6 -6
- package/dist/AWSLambdaFunction-BfLF5vNa.d.cts.map +1 -0
- package/dist/{AWSLambdaFunction-EPGY4s7i.cjs → AWSLambdaFunction-C1gRqLO7.cjs} +6 -6
- package/dist/AWSLambdaFunction-C1gRqLO7.cjs.map +1 -0
- package/dist/{AWSLambdaFunction-D0tEOTXQ.d.cts → AWSLambdaFunction-K94K8JU2.d.mts} +6 -6
- package/dist/AWSLambdaFunction-K94K8JU2.d.mts.map +1 -0
- package/dist/{AWSLambdaSubscriberAdaptor-Dx-Ks1Jp.d.cts → AWSLambdaSubscriberAdaptor-B2Gk3fgx.d.cts} +2 -2
- package/dist/AWSLambdaSubscriberAdaptor-B2Gk3fgx.d.cts.map +1 -0
- package/dist/{AWSLambdaSubscriberAdaptor-BLfO612H.mjs → AWSLambdaSubscriberAdaptor-BD3FwGUb.mjs} +3 -3
- package/dist/AWSLambdaSubscriberAdaptor-BD3FwGUb.mjs.map +1 -0
- package/dist/{AWSLambdaSubscriberAdaptor-BNcYYZ-P.cjs → AWSLambdaSubscriberAdaptor-DQDnt1Xk.cjs} +3 -3
- package/dist/AWSLambdaSubscriberAdaptor-DQDnt1Xk.cjs.map +1 -0
- package/dist/{AWSLambdaSubscriberAdaptor-DrFAvHOp.d.mts → AWSLambdaSubscriberAdaptor-QuMFwltJ.d.mts} +2 -2
- package/dist/AWSLambdaSubscriberAdaptor-QuMFwltJ.d.mts.map +1 -0
- package/dist/{AmazonApiGatewayEndpointAdaptor-BT9JXihC.mjs → AmazonApiGatewayEndpointAdaptor-B4gLJ2dx.mjs} +56 -14
- package/dist/AmazonApiGatewayEndpointAdaptor-B4gLJ2dx.mjs.map +1 -0
- package/dist/{AmazonApiGatewayEndpointAdaptor-DLqnYQ4E.d.cts → AmazonApiGatewayEndpointAdaptor-C987ZCsM.d.cts} +51 -5
- package/dist/AmazonApiGatewayEndpointAdaptor-C987ZCsM.d.cts.map +1 -0
- package/dist/{AmazonApiGatewayEndpointAdaptor-DNFvvdmW.cjs → AmazonApiGatewayEndpointAdaptor-CwRKMRr_.cjs} +55 -13
- package/dist/AmazonApiGatewayEndpointAdaptor-CwRKMRr_.cjs.map +1 -0
- package/dist/{AmazonApiGatewayEndpointAdaptor-qlKXuZxy.d.mts → AmazonApiGatewayEndpointAdaptor-DpPfO6Vj.d.mts} +52 -6
- package/dist/AmazonApiGatewayEndpointAdaptor-DpPfO6Vj.d.mts.map +1 -0
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-Ccl8B8kG.cjs → AmazonApiGatewayV1EndpointAdaptor-BeZMu5DZ.cjs} +4 -4
- package/dist/AmazonApiGatewayV1EndpointAdaptor-BeZMu5DZ.cjs.map +1 -0
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-MRUxs3Xi.d.mts → AmazonApiGatewayV1EndpointAdaptor-DI_5kdqw.d.mts} +5 -5
- package/dist/AmazonApiGatewayV1EndpointAdaptor-DI_5kdqw.d.mts.map +1 -0
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-DyUaJIhB.d.cts → AmazonApiGatewayV1EndpointAdaptor-DkGMOpoB.d.cts} +4 -4
- package/dist/AmazonApiGatewayV1EndpointAdaptor-DkGMOpoB.d.cts.map +1 -0
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-CShQI8Gk.mjs → AmazonApiGatewayV1EndpointAdaptor-VccB6FKp.mjs} +4 -4
- package/dist/AmazonApiGatewayV1EndpointAdaptor-VccB6FKp.mjs.map +1 -0
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-M1-w0U5R.d.cts → AmazonApiGatewayV2EndpointAdaptor-BtBnMJS_.d.cts} +4 -6
- package/dist/AmazonApiGatewayV2EndpointAdaptor-BtBnMJS_.d.cts.map +1 -0
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-D8-0Aab4.cjs → AmazonApiGatewayV2EndpointAdaptor-BwsL9Gia.cjs} +4 -4
- package/dist/AmazonApiGatewayV2EndpointAdaptor-BwsL9Gia.cjs.map +1 -0
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-lCRzGE4q.mjs → AmazonApiGatewayV2EndpointAdaptor-CljxmUfz.mjs} +4 -4
- package/dist/AmazonApiGatewayV2EndpointAdaptor-CljxmUfz.mjs.map +1 -0
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-fuLM6M9k.d.mts → AmazonApiGatewayV2EndpointAdaptor-DnCoqlvw.d.mts} +5 -7
- package/dist/AmazonApiGatewayV2EndpointAdaptor-DnCoqlvw.d.mts.map +1 -0
- package/dist/{Authorizer-C0ge_tc8.cjs → Authorizer-BXxBee2P.cjs} +1 -1
- package/dist/Authorizer-BXxBee2P.cjs.map +1 -0
- package/dist/{Authorizer-r9U3y_ms.mjs → Authorizer-BgjU8-z6.mjs} +1 -1
- package/dist/Authorizer-BgjU8-z6.mjs.map +1 -0
- package/dist/{Authorizer-gWxYsGEp.d.mts → Authorizer-DCcYOx3h.d.mts} +1 -1
- package/dist/Authorizer-DCcYOx3h.d.mts.map +1 -0
- package/dist/{Authorizer-B-btowNd.d.cts → Authorizer-DWtwC8we.d.cts} +1 -1
- package/dist/Authorizer-DWtwC8we.d.cts.map +1 -0
- package/dist/{BaseFunctionBuilder-BAtutR6q.d.cts → BaseFunctionBuilder-BqZCqIeU.d.mts} +3 -3
- package/dist/BaseFunctionBuilder-BqZCqIeU.d.mts.map +1 -0
- package/dist/{BaseFunctionBuilder-DRY419e7.d.mts → BaseFunctionBuilder-CcK691ni.d.cts} +3 -3
- package/dist/BaseFunctionBuilder-CcK691ni.d.cts.map +1 -0
- package/dist/{BaseFunctionBuilder-Czi1Jwza.mjs → BaseFunctionBuilder-Dsqe6pnn.mjs} +2 -2
- package/dist/BaseFunctionBuilder-Dsqe6pnn.mjs.map +1 -0
- package/dist/{BaseFunctionBuilder-MYG3C9ug.cjs → BaseFunctionBuilder-Z0XwrKB5.cjs} +2 -2
- package/dist/BaseFunctionBuilder-Z0XwrKB5.cjs.map +1 -0
- package/dist/Construct-BNDLJJfD.mjs +150 -0
- package/dist/Construct-BNDLJJfD.mjs.map +1 -0
- package/dist/{Construct-Ba5cMxib.cjs → Construct-CPrCF8NK.cjs} +93 -9
- package/dist/Construct-CPrCF8NK.cjs.map +1 -0
- package/dist/{Construct-C4rPE67v.d.cts → Construct-Dl0l2d8d.d.cts} +30 -4
- package/dist/Construct-Dl0l2d8d.d.cts.map +1 -0
- package/dist/{Construct-XrijZFFh.d.mts → Construct-E8QPyHh4.d.mts} +30 -4
- package/dist/Construct-E8QPyHh4.d.mts.map +1 -0
- package/dist/Construct.cjs +4 -2
- package/dist/Construct.d.cts +2 -2
- package/dist/Construct.d.mts +2 -2
- package/dist/Construct.mjs +2 -2
- package/dist/{Cron-CGF4YAfM.cjs → Cron-BmPNTLla.cjs} +3 -3
- package/dist/Cron-BmPNTLla.cjs.map +1 -0
- package/dist/{Cron-BxhGs5up.mjs → Cron-BpJONaFv.mjs} +3 -3
- package/dist/Cron-BpJONaFv.mjs.map +1 -0
- package/dist/{Cron-bDLcTvV5.d.cts → Cron-CnmLLh3E.d.mts} +3 -3
- package/dist/Cron-CnmLLh3E.d.mts.map +1 -0
- package/dist/{Cron-cdjlSKNp.d.mts → Cron-DufAeHry.d.cts} +3 -3
- package/dist/Cron-DufAeHry.d.cts.map +1 -0
- package/dist/{CronBuilder-d2jh-IB2.mjs → CronBuilder-02HSIHJr.mjs} +4 -4
- package/dist/CronBuilder-02HSIHJr.mjs.map +1 -0
- package/dist/{CronBuilder-CcxKRtVP.cjs → CronBuilder-DC2zUS8a.cjs} +4 -4
- package/dist/CronBuilder-DC2zUS8a.cjs.map +1 -0
- package/dist/{CronBuilder-BC4m5-p1.d.mts → CronBuilder-anUSbMxb.d.mts} +4 -4
- package/dist/CronBuilder-anUSbMxb.d.mts.map +1 -0
- package/dist/{CronBuilder-DKVXyE0Q.d.cts → CronBuilder-fyqf_X8n.d.cts} +4 -4
- package/dist/CronBuilder-fyqf_X8n.d.cts.map +1 -0
- package/dist/{Endpoint-BVGZXFyV.cjs → Endpoint-BCWVbi8l.cjs} +6 -6
- package/dist/Endpoint-BCWVbi8l.cjs.map +1 -0
- package/dist/{Endpoint-BPv9_-m_.d.cts → Endpoint-BlcHiGNx.d.cts} +3 -3
- package/dist/Endpoint-BlcHiGNx.d.cts.map +1 -0
- package/dist/{Endpoint-BdwG75G_.d.mts → Endpoint-DEHuy46S.d.mts} +4 -4
- package/dist/Endpoint-DEHuy46S.d.mts.map +1 -0
- package/dist/{Endpoint-CuOEswxJ.mjs → Endpoint-ygxv2Ia6.mjs} +6 -6
- package/dist/Endpoint-ygxv2Ia6.mjs.map +1 -0
- package/dist/{EndpointBuilder-DIy_m1bu.d.cts → EndpointBuilder-DPLAUHqg.d.cts} +4 -4
- package/dist/EndpointBuilder-DPLAUHqg.d.cts.map +1 -0
- package/dist/{EndpointBuilder-B3az942t.d.mts → EndpointBuilder-DaeCeneF.d.mts} +5 -5
- package/dist/EndpointBuilder-DaeCeneF.d.mts.map +1 -0
- package/dist/{EndpointBuilder-Cgj1P_ra.cjs → EndpointBuilder-J5D67Y6a.cjs} +6 -6
- package/dist/EndpointBuilder-J5D67Y6a.cjs.map +1 -0
- package/dist/{EndpointBuilder-DnCB1h1j.mjs → EndpointBuilder-tn4zqoyw.mjs} +6 -6
- package/dist/EndpointBuilder-tn4zqoyw.mjs.map +1 -0
- package/dist/{EndpointFactory-CbdxPCIH.mjs → EndpointFactory-CIUZTTAF.mjs} +7 -7
- package/dist/EndpointFactory-CIUZTTAF.mjs.map +1 -0
- package/dist/{EndpointFactory-CyPbm3AD.d.cts → EndpointFactory-CiKcb5PX.d.cts} +4 -4
- package/dist/EndpointFactory-CiKcb5PX.d.cts.map +1 -0
- package/dist/{EndpointFactory-C-0nE6Jg.d.mts → EndpointFactory-DufM0t2z.d.mts} +4 -4
- package/dist/EndpointFactory-DufM0t2z.d.mts.map +1 -0
- package/dist/{EndpointFactory-CYj6BYok.cjs → EndpointFactory-d5uwWFkK.cjs} +7 -7
- package/dist/EndpointFactory-d5uwWFkK.cjs.map +1 -0
- package/dist/{Function-DDZb1525.cjs → Function-2qWSZqYB.cjs} +3 -3
- package/dist/Function-2qWSZqYB.cjs.map +1 -0
- package/dist/{Function-Cf7f_kCz.d.cts → Function-CbEohg13.d.cts} +3 -3
- package/dist/Function-CbEohg13.d.cts.map +1 -0
- package/dist/{Function-BVHqIDp9.mjs → Function-CdF1HmFu.mjs} +3 -3
- package/dist/Function-CdF1HmFu.mjs.map +1 -0
- package/dist/{Function-DN2G6OT5.d.mts → Function-EjIOLxlh.d.mts} +3 -3
- package/dist/Function-EjIOLxlh.d.mts.map +1 -0
- package/dist/{FunctionBuilder-DswJ-9sD.cjs → FunctionBuilder-B-pbgm09.cjs} +4 -4
- package/dist/FunctionBuilder-B-pbgm09.cjs.map +1 -0
- package/dist/{FunctionBuilder-CJBzzXL3.d.cts → FunctionBuilder-CX3ooNdq.d.cts} +4 -4
- package/dist/FunctionBuilder-CX3ooNdq.d.cts.map +1 -0
- package/dist/{FunctionBuilder-Cxx8D2na.d.mts → FunctionBuilder-D11ytDyy.d.mts} +4 -4
- package/dist/FunctionBuilder-D11ytDyy.d.mts.map +1 -0
- package/dist/{FunctionBuilder-CrDYgfiI.mjs → FunctionBuilder-DaWVthAJ.mjs} +4 -4
- package/dist/FunctionBuilder-DaWVthAJ.mjs.map +1 -0
- package/dist/{FunctionExecutionWrapper-DF260Aaj.d.mts → FunctionExecutionWrapper-BJcRjH9Z.d.cts} +5 -5
- package/dist/FunctionExecutionWrapper-BJcRjH9Z.d.cts.map +1 -0
- package/dist/{FunctionExecutionWrapper-BYI2bGTL.cjs → FunctionExecutionWrapper-C6ChBNHs.cjs} +3 -3
- package/dist/FunctionExecutionWrapper-C6ChBNHs.cjs.map +1 -0
- package/dist/{FunctionExecutionWrapper-Qy8bmgFR.d.cts → FunctionExecutionWrapper-D3RNjGIR.d.mts} +5 -5
- package/dist/FunctionExecutionWrapper-D3RNjGIR.d.mts.map +1 -0
- package/dist/{FunctionExecutionWrapper-CLDh7Z2_.mjs → FunctionExecutionWrapper-Dj3pmXaN.mjs} +3 -3
- package/dist/FunctionExecutionWrapper-Dj3pmXaN.mjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-BaPlUhz0.d.mts → HonoEndpointAdaptor-CKP6nrG2.d.mts} +11 -6
- package/dist/HonoEndpointAdaptor-CKP6nrG2.d.mts.map +1 -0
- package/dist/HonoEndpointAdaptor-Cc8Rnp9G.mjs +251 -0
- package/dist/HonoEndpointAdaptor-Cc8Rnp9G.mjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-YcRHYALH.d.cts → HonoEndpointAdaptor-hrrvyfw9.d.cts} +10 -5
- package/dist/HonoEndpointAdaptor-hrrvyfw9.d.cts.map +1 -0
- package/dist/HonoEndpointAdaptor-xGnDZa3a.cjs +257 -0
- package/dist/HonoEndpointAdaptor-xGnDZa3a.cjs.map +1 -0
- package/dist/{Subscriber-COYMSevD.d.cts → Subscriber-BBcIOkhW.d.cts} +2 -2
- package/dist/Subscriber-BBcIOkhW.d.cts.map +1 -0
- package/dist/{Subscriber-ikctpU3I.d.mts → Subscriber-BpTAXvbM.d.mts} +2 -2
- package/dist/Subscriber-BpTAXvbM.d.mts.map +1 -0
- package/dist/{Subscriber-BiHjVXtM.cjs → Subscriber-CL4iYm01.cjs} +2 -2
- package/dist/Subscriber-CL4iYm01.cjs.map +1 -0
- package/dist/{Subscriber-BmPf9GFb.mjs → Subscriber-CZ8Smwd2.mjs} +2 -2
- package/dist/Subscriber-CZ8Smwd2.mjs.map +1 -0
- package/dist/{SubscriberBuilder-DJPEeYDJ.mjs → SubscriberBuilder-CxQg3TTm.mjs} +2 -2
- package/dist/SubscriberBuilder-CxQg3TTm.mjs.map +1 -0
- package/dist/{SubscriberBuilder-Cp1C-xtT.cjs → SubscriberBuilder-D0OS3hd7.cjs} +2 -2
- package/dist/SubscriberBuilder-D0OS3hd7.cjs.map +1 -0
- package/dist/{SubscriberBuilder-D_9zzllj.d.mts → SubscriberBuilder-D7IgufwB.d.cts} +3 -3
- package/dist/SubscriberBuilder-D7IgufwB.d.cts.map +1 -0
- package/dist/{SubscriberBuilder-ivHAGIVi.d.cts → SubscriberBuilder-DOFBbWLt.d.mts} +3 -3
- package/dist/SubscriberBuilder-DOFBbWLt.d.mts.map +1 -0
- package/dist/{TestEndpointAdaptor-DB7bREhS.d.mts → TestEndpointAdaptor-BnJusjf7.d.mts} +4 -4
- package/dist/TestEndpointAdaptor-BnJusjf7.d.mts.map +1 -0
- package/dist/TestEndpointAdaptor-CPL8ru6q.mjs +170 -0
- package/dist/TestEndpointAdaptor-CPL8ru6q.mjs.map +1 -0
- package/dist/TestEndpointAdaptor-Ca4K26_d.cjs +176 -0
- package/dist/TestEndpointAdaptor-Ca4K26_d.cjs.map +1 -0
- package/dist/{TestEndpointAdaptor-C10xBI--.d.cts → TestEndpointAdaptor-EPPTjntv.d.cts} +3 -3
- package/dist/TestEndpointAdaptor-EPPTjntv.d.cts.map +1 -0
- package/dist/adaptors/aws.cjs +12 -12
- package/dist/adaptors/aws.d.cts +15 -14
- package/dist/adaptors/aws.d.mts +16 -15
- package/dist/adaptors/aws.mjs +12 -12
- 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.cjs.map +1 -1
- package/dist/crons/index.d.cts +11 -11
- package/dist/crons/index.d.mts +7 -7
- package/dist/crons/index.mjs +7 -7
- package/dist/crons/index.mjs.map +1 -1
- package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.cjs +7 -7
- package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.d.cts +10 -9
- package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.d.mts +11 -10
- package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.mjs +7 -7
- package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.cjs +8 -8
- package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.d.cts +10 -9
- package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.d.mts +11 -10
- package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.mjs +8 -8
- package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.cjs +8 -8
- package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.d.cts +11 -10
- package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.d.mts +12 -11
- package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.mjs +8 -8
- package/dist/endpoints/Authorizer.cjs +1 -1
- package/dist/endpoints/Authorizer.d.cts +1 -1
- package/dist/endpoints/Authorizer.d.mts +1 -1
- package/dist/endpoints/Authorizer.mjs +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 +9 -9
- package/dist/endpoints/EndpointBuilder.d.cts +8 -8
- package/dist/endpoints/EndpointBuilder.d.mts +9 -9
- package/dist/endpoints/EndpointBuilder.mjs +9 -9
- package/dist/endpoints/EndpointFactory.cjs +10 -10
- package/dist/endpoints/EndpointFactory.d.cts +9 -9
- package/dist/endpoints/EndpointFactory.d.mts +10 -10
- package/dist/endpoints/EndpointFactory.mjs +10 -10
- 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.d.cts +7 -7
- package/dist/endpoints/audit.d.mts +8 -8
- package/dist/endpoints/helpers.cjs +7 -7
- package/dist/endpoints/helpers.d.cts +7 -7
- package/dist/endpoints/helpers.d.cts.map +1 -1
- package/dist/endpoints/helpers.d.mts +8 -8
- package/dist/endpoints/helpers.d.mts.map +1 -1
- package/dist/endpoints/helpers.mjs +7 -7
- package/dist/endpoints/index.cjs +20 -10
- package/dist/endpoints/index.cjs.map +1 -1
- package/dist/endpoints/index.d.cts +14 -12
- package/dist/endpoints/index.d.cts.map +1 -1
- package/dist/endpoints/index.d.mts +15 -13
- package/dist/endpoints/index.d.mts.map +1 -1
- package/dist/endpoints/index.mjs +13 -11
- package/dist/endpoints/index.mjs.map +1 -1
- package/dist/endpoints/lazyAccessors.cjs +10 -0
- package/dist/endpoints/lazyAccessors.d.cts +10 -0
- package/dist/endpoints/lazyAccessors.d.mts +10 -0
- package/dist/endpoints/lazyAccessors.mjs +3 -0
- package/dist/endpoints/parseHonoQuery.cjs +1 -1
- package/dist/endpoints/parseHonoQuery.mjs +1 -1
- package/dist/endpoints/parseQueryParams.d.cts.map +1 -1
- package/dist/endpoints/parseQueryParams.d.mts.map +1 -1
- package/dist/endpoints/processAudits.d.cts +7 -7
- package/dist/endpoints/processAudits.d.cts.map +1 -1
- package/dist/endpoints/processAudits.d.mts +8 -8
- package/dist/endpoints/processAudits.d.mts.map +1 -1
- package/dist/endpoints/rls.cjs +1 -1
- package/dist/endpoints/rls.d.cts +7 -7
- package/dist/endpoints/rls.d.mts +8 -8
- package/dist/endpoints/rls.mjs +1 -1
- 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 +7 -7
- package/dist/functions/TestFunctionAdaptor.cjs.map +1 -1
- package/dist/functions/TestFunctionAdaptor.d.cts +3 -3
- package/dist/functions/TestFunctionAdaptor.d.cts.map +1 -1
- package/dist/functions/TestFunctionAdaptor.d.mts +3 -3
- package/dist/functions/TestFunctionAdaptor.d.mts.map +1 -1
- package/dist/functions/TestFunctionAdaptor.mjs +7 -7
- 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-fTid0RMK.cjs → functions-CUEv5NC3.cjs} +2 -2
- package/dist/functions-CUEv5NC3.cjs.map +1 -0
- package/dist/functions-DOYBrb7n.mjs +8 -0
- package/dist/functions-DOYBrb7n.mjs.map +1 -0
- package/dist/{helpers-ByRTDO_m.mjs → helpers-Dl1eszfi.mjs} +2 -2
- package/dist/helpers-Dl1eszfi.mjs.map +1 -0
- package/dist/{helpers-BcP1tXAi.cjs → helpers-QMdfdnvU.cjs} +2 -2
- package/dist/helpers-QMdfdnvU.cjs.map +1 -0
- package/dist/{index-BWzGIj06.d.mts → index-BrGtMlpJ.d.cts} +2 -2
- package/dist/index-BrGtMlpJ.d.cts.map +1 -0
- package/dist/index-Dn4py3Db.d.mts +12 -0
- package/dist/index-Dn4py3Db.d.mts.map +1 -0
- package/dist/index.cjs +4 -2
- package/dist/index.d.cts +3 -2
- package/dist/index.d.mts +4 -3
- package/dist/index.mjs +2 -2
- package/dist/lazyAccessors-B-Jgkg2o.mjs +175 -0
- package/dist/lazyAccessors-B-Jgkg2o.mjs.map +1 -0
- package/dist/lazyAccessors-B8Hhras9.cjs +223 -0
- package/dist/lazyAccessors-B8Hhras9.cjs.map +1 -0
- package/dist/lazyAccessors-BFAj2-S4.d.mts +49 -0
- package/dist/lazyAccessors-BFAj2-S4.d.mts.map +1 -0
- package/dist/lazyAccessors-knaNZuTN.d.cts +49 -0
- package/dist/lazyAccessors-knaNZuTN.d.cts.map +1 -0
- package/dist/{parseHonoQuery-CZC5_97v.cjs → parseHonoQuery-D4MhxTRc.cjs} +1 -1
- package/dist/parseHonoQuery-D4MhxTRc.cjs.map +1 -0
- package/dist/{parseHonoQuery-DDgIkTO4.mjs → parseHonoQuery-DpK3sGPc.mjs} +1 -1
- package/dist/parseHonoQuery-DpK3sGPc.mjs.map +1 -0
- package/dist/parseQueryParams-BSNkjmZ9.cjs.map +1 -1
- package/dist/parseQueryParams-UMTRnRrW.mjs.map +1 -1
- package/dist/processAudits-CzHkPokQ.cjs.map +1 -1
- package/dist/processAudits-Dj8UGqcW.mjs.map +1 -1
- package/dist/publisher-BXG9YiRi.d.mts +16 -0
- package/dist/publisher-BXG9YiRi.d.mts.map +1 -0
- package/dist/publisher-Bw4770Hi.mjs.map +1 -1
- package/dist/publisher-D9ngDXg3.d.cts +16 -0
- package/dist/publisher-D9ngDXg3.d.cts.map +1 -0
- package/dist/publisher-lFQleddL.cjs.map +1 -1
- package/dist/publisher.d.cts +3 -16
- package/dist/publisher.d.mts +3 -16
- package/dist/{rls-CmJ7bRsz.cjs → rls-BrywnrQb.cjs} +1 -1
- package/dist/{rls-CmJ7bRsz.cjs.map → rls-BrywnrQb.cjs.map} +1 -1
- package/dist/{rls-Bf3FRwto.mjs → rls-C0cWOnk4.mjs} +1 -1
- package/dist/{rls-Bf3FRwto.mjs.map → rls-C0cWOnk4.mjs.map} +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.cjs.map +1 -1
- package/dist/subscribers/index.d.cts +5 -5
- package/dist/subscribers/index.d.cts.map +1 -1
- package/dist/subscribers/index.d.mts +5 -5
- package/dist/subscribers/index.d.mts.map +1 -1
- package/dist/subscribers/index.mjs +3 -3
- package/dist/subscribers/index.mjs.map +1 -1
- package/dist/telemetry-BTaiRqPo.d.cts +95 -0
- package/dist/telemetry-BTaiRqPo.d.cts.map +1 -0
- package/dist/telemetry-yAHf5yDs.d.mts +95 -0
- package/dist/telemetry-yAHf5yDs.d.mts.map +1 -0
- package/dist/telemetry.cjs +0 -0
- package/dist/telemetry.d.cts +2 -0
- package/dist/telemetry.d.mts +2 -0
- package/dist/telemetry.mjs +0 -0
- package/dist/types-B5H3piDg.d.cts.map +1 -1
- package/dist/{types-DdIlpxAd.d.mts → types-Dw-iLd3Y.d.mts} +1 -1
- package/dist/types-Dw-iLd3Y.d.mts.map +1 -0
- package/dist/types.d.mts +1 -1
- package/package.json +19 -18
- package/src/Construct.ts +189 -94
- package/src/__benchmarks__/build-time-optimization.bench.ts +274 -0
- package/src/__benchmarks__/endpoint.bench.ts +375 -375
- package/src/__benchmarks__/fixtures.ts +241 -0
- package/src/__benchmarks__/hono-adaptor.bench.ts +533 -0
- package/src/__benchmarks__/hono-server.bench.ts +206 -206
- package/src/__benchmarks__/response-builder.bench.ts +428 -0
- package/src/__benchmarks__/strategies/strategy-a-lazy-services.ts +319 -0
- package/src/__benchmarks__/strategies/strategy-c-middleware.ts +530 -0
- package/src/__benchmarks__/strategies/strategy-d-opt-in-events.ts +567 -0
- package/src/__tests__/Construct.environment.spec.ts +572 -351
- package/src/__tests__/publisher.setting.spec.ts +496 -499
- package/src/__tests__/publisher.spec.ts +440 -442
- package/src/crons/Cron.ts +117 -117
- package/src/crons/CronBuilder.ts +237 -238
- package/src/crons/__tests__/Cron.spec.ts +448 -448
- package/src/crons/__tests__/CronBuilder.state-isolation.spec.ts +214 -214
- package/src/crons/index.ts +4 -4
- package/src/endpoints/AmazonApiGatewayEndpointAdaptor.ts +571 -463
- package/src/endpoints/AmazonApiGatewayV1EndpointAdaptor.ts +86 -86
- package/src/endpoints/AmazonApiGatewayV2EndpointAdaptor.ts +85 -81
- package/src/endpoints/Authorizer.ts +100 -100
- package/src/endpoints/Endpoint.ts +921 -937
- package/src/endpoints/EndpointBuilder.ts +703 -703
- package/src/endpoints/EndpointFactory.ts +1054 -1056
- package/src/endpoints/HonoEndpointAdaptor.ts +621 -548
- package/src/endpoints/TestEndpointAdaptor.ts +372 -353
- package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.audits.spec.ts +499 -0
- package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.events.spec.ts +541 -542
- package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.spec.ts +1172 -1174
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.audits.spec.ts +599 -599
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.events.spec.ts +710 -710
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.factory-publisher.spec.ts +280 -280
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.kysely-audit.integration.spec.ts +924 -730
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.rls.spec.ts +307 -0
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.spec.ts +408 -408
- package/src/endpoints/__tests__/Authorizer.spec.ts +286 -0
- package/src/endpoints/__tests__/Endpoint.cookies.spec.ts +162 -162
- package/src/endpoints/__tests__/Endpoint.headers.spec.ts +182 -182
- package/src/endpoints/__tests__/Endpoint.manifest.spec.ts +158 -159
- package/src/endpoints/__tests__/Endpoint.spec.ts +819 -822
- package/src/endpoints/__tests__/EndpointBuilder.audit.spec.ts +427 -427
- package/src/endpoints/__tests__/EndpointBuilder.spec.ts +478 -478
- package/src/endpoints/__tests__/EndpointFactory.authorizers.spec.ts +426 -426
- package/src/endpoints/__tests__/EndpointFactory.database-auditor.spec.ts +501 -501
- package/src/endpoints/__tests__/EndpointFactory.reference-audit.spec.ts +177 -177
- package/src/endpoints/__tests__/EndpointFactory.spec.ts +471 -471
- package/src/endpoints/__tests__/EndpointFactory.state-isolation.spec.ts +143 -143
- package/src/endpoints/__tests__/HonoEndpointAdaptor.audit-transactions.spec.ts +663 -663
- package/src/endpoints/__tests__/HonoEndpointAdaptor.audits.spec.ts +608 -608
- package/src/endpoints/__tests__/HonoEndpointAdaptor.events.spec.ts +561 -561
- package/src/endpoints/__tests__/HonoEndpointAdaptor.kysely-audit.integration.spec.ts +1036 -1036
- package/src/endpoints/__tests__/HonoEndpointAdaptor.openapi.spec.ts +278 -278
- package/src/endpoints/__tests__/HonoEndpointAdaptor.spec.ts +1093 -1093
- package/src/endpoints/__tests__/ResponseBuilder.spec.ts +230 -230
- package/src/endpoints/__tests__/TestEndpointAdaptor.audits.spec.ts +569 -569
- package/src/endpoints/__tests__/TestEndpointAdaptor.spec.ts +841 -841
- package/src/endpoints/__tests__/endpoint-types.test.ts +68 -68
- package/src/endpoints/__tests__/helpers.spec.ts +37 -0
- package/src/endpoints/__tests__/lazyAccessors.spec.ts +330 -0
- package/src/endpoints/__tests__/processAudits.spec.ts +631 -0
- package/src/endpoints/audit.ts +51 -51
- package/src/endpoints/helpers.ts +34 -35
- package/src/endpoints/index.ts +33 -23
- package/src/endpoints/lazyAccessors.ts +241 -0
- package/src/endpoints/parseHonoQuery.ts +41 -41
- package/src/endpoints/parseQueryParams.ts +36 -36
- package/src/endpoints/processAudits.ts +269 -269
- package/src/endpoints/rls.ts +16 -16
- package/src/functions/AWSLambdaFunction.ts +294 -295
- package/src/functions/BaseFunctionBuilder.ts +185 -185
- package/src/functions/Function.ts +190 -190
- package/src/functions/FunctionBuilder.ts +353 -353
- package/src/functions/FunctionExecutionWrapper.ts +199 -200
- package/src/functions/TestFunctionAdaptor.ts +191 -191
- package/src/functions/__tests__/AWSLambdaFunctionAdaptor.spec.ts +424 -424
- package/src/functions/__tests__/Function.audits.spec.ts +364 -364
- package/src/functions/__tests__/Function.spec.ts +453 -454
- package/src/functions/__tests__/FunctionBuilder.state-isolation.spec.ts +179 -179
- package/src/functions/__tests__/TestFunctionAdaptor.spec.ts +369 -369
- package/src/functions/index.ts +6 -4
- package/src/index.ts +18 -9
- package/src/publisher.ts +71 -72
- package/src/subscribers/AWSLambdaSubscriberAdaptor.ts +244 -248
- package/src/subscribers/Subscriber.ts +82 -84
- package/src/subscribers/SubscriberBuilder.ts +129 -129
- package/src/subscribers/__tests__/AWSLambdaSubscriberAdaptor.spec.ts +589 -589
- package/src/subscribers/__tests__/Subscriber.spec.ts +402 -404
- package/src/subscribers/index.ts +1 -0
- package/src/telemetry.ts +103 -0
- package/src/types.ts +7 -7
- package/test.ts +58 -59
- package/dist/AWSLambdaFunction-BdebRMUh.d.mts.map +0 -1
- package/dist/AWSLambdaFunction-C54a1doJ.mjs.map +0 -1
- package/dist/AWSLambdaFunction-D0tEOTXQ.d.cts.map +0 -1
- package/dist/AWSLambdaFunction-EPGY4s7i.cjs.map +0 -1
- package/dist/AWSLambdaSubscriberAdaptor-BLfO612H.mjs.map +0 -1
- package/dist/AWSLambdaSubscriberAdaptor-BNcYYZ-P.cjs.map +0 -1
- package/dist/AWSLambdaSubscriberAdaptor-DrFAvHOp.d.mts.map +0 -1
- package/dist/AWSLambdaSubscriberAdaptor-Dx-Ks1Jp.d.cts.map +0 -1
- package/dist/AmazonApiGatewayEndpointAdaptor-BT9JXihC.mjs.map +0 -1
- package/dist/AmazonApiGatewayEndpointAdaptor-DLqnYQ4E.d.cts.map +0 -1
- package/dist/AmazonApiGatewayEndpointAdaptor-DNFvvdmW.cjs.map +0 -1
- package/dist/AmazonApiGatewayEndpointAdaptor-qlKXuZxy.d.mts.map +0 -1
- package/dist/AmazonApiGatewayV1EndpointAdaptor-CShQI8Gk.mjs.map +0 -1
- package/dist/AmazonApiGatewayV1EndpointAdaptor-Ccl8B8kG.cjs.map +0 -1
- package/dist/AmazonApiGatewayV1EndpointAdaptor-DyUaJIhB.d.cts.map +0 -1
- package/dist/AmazonApiGatewayV1EndpointAdaptor-MRUxs3Xi.d.mts.map +0 -1
- package/dist/AmazonApiGatewayV2EndpointAdaptor-D8-0Aab4.cjs.map +0 -1
- package/dist/AmazonApiGatewayV2EndpointAdaptor-M1-w0U5R.d.cts.map +0 -1
- package/dist/AmazonApiGatewayV2EndpointAdaptor-fuLM6M9k.d.mts.map +0 -1
- package/dist/AmazonApiGatewayV2EndpointAdaptor-lCRzGE4q.mjs.map +0 -1
- package/dist/Authorizer-B-btowNd.d.cts.map +0 -1
- package/dist/Authorizer-C0ge_tc8.cjs.map +0 -1
- package/dist/Authorizer-gWxYsGEp.d.mts.map +0 -1
- package/dist/Authorizer-r9U3y_ms.mjs.map +0 -1
- package/dist/BaseFunctionBuilder-BAtutR6q.d.cts.map +0 -1
- package/dist/BaseFunctionBuilder-Czi1Jwza.mjs.map +0 -1
- package/dist/BaseFunctionBuilder-DRY419e7.d.mts.map +0 -1
- package/dist/BaseFunctionBuilder-MYG3C9ug.cjs.map +0 -1
- package/dist/Construct-Ba5cMxib.cjs.map +0 -1
- package/dist/Construct-C4rPE67v.d.cts.map +0 -1
- package/dist/Construct-DdyGHuag.mjs +0 -78
- package/dist/Construct-DdyGHuag.mjs.map +0 -1
- package/dist/Construct-XrijZFFh.d.mts.map +0 -1
- package/dist/Cron-BxhGs5up.mjs.map +0 -1
- package/dist/Cron-CGF4YAfM.cjs.map +0 -1
- package/dist/Cron-bDLcTvV5.d.cts.map +0 -1
- package/dist/Cron-cdjlSKNp.d.mts.map +0 -1
- package/dist/CronBuilder-BC4m5-p1.d.mts.map +0 -1
- package/dist/CronBuilder-CcxKRtVP.cjs.map +0 -1
- package/dist/CronBuilder-DKVXyE0Q.d.cts.map +0 -1
- package/dist/CronBuilder-d2jh-IB2.mjs.map +0 -1
- package/dist/Endpoint-BPv9_-m_.d.cts.map +0 -1
- package/dist/Endpoint-BVGZXFyV.cjs.map +0 -1
- package/dist/Endpoint-BdwG75G_.d.mts.map +0 -1
- package/dist/Endpoint-CuOEswxJ.mjs.map +0 -1
- package/dist/EndpointBuilder-B3az942t.d.mts.map +0 -1
- package/dist/EndpointBuilder-Cgj1P_ra.cjs.map +0 -1
- package/dist/EndpointBuilder-DIy_m1bu.d.cts.map +0 -1
- package/dist/EndpointBuilder-DnCB1h1j.mjs.map +0 -1
- package/dist/EndpointFactory-C-0nE6Jg.d.mts.map +0 -1
- package/dist/EndpointFactory-CYj6BYok.cjs.map +0 -1
- package/dist/EndpointFactory-CbdxPCIH.mjs.map +0 -1
- package/dist/EndpointFactory-CyPbm3AD.d.cts.map +0 -1
- package/dist/Function-BVHqIDp9.mjs.map +0 -1
- package/dist/Function-Cf7f_kCz.d.cts.map +0 -1
- package/dist/Function-DDZb1525.cjs.map +0 -1
- package/dist/Function-DN2G6OT5.d.mts.map +0 -1
- package/dist/FunctionBuilder-CJBzzXL3.d.cts.map +0 -1
- package/dist/FunctionBuilder-CrDYgfiI.mjs.map +0 -1
- package/dist/FunctionBuilder-Cxx8D2na.d.mts.map +0 -1
- package/dist/FunctionBuilder-DswJ-9sD.cjs.map +0 -1
- package/dist/FunctionExecutionWrapper-BYI2bGTL.cjs.map +0 -1
- package/dist/FunctionExecutionWrapper-CLDh7Z2_.mjs.map +0 -1
- package/dist/FunctionExecutionWrapper-DF260Aaj.d.mts.map +0 -1
- package/dist/FunctionExecutionWrapper-Qy8bmgFR.d.cts.map +0 -1
- package/dist/HonoEndpointAdaptor-BaPlUhz0.d.mts.map +0 -1
- package/dist/HonoEndpointAdaptor-CQe2FqMR.cjs +0 -234
- package/dist/HonoEndpointAdaptor-CQe2FqMR.cjs.map +0 -1
- package/dist/HonoEndpointAdaptor-Ce-2HBxn.mjs +0 -228
- package/dist/HonoEndpointAdaptor-Ce-2HBxn.mjs.map +0 -1
- package/dist/HonoEndpointAdaptor-YcRHYALH.d.cts.map +0 -1
- package/dist/Subscriber-BiHjVXtM.cjs.map +0 -1
- package/dist/Subscriber-BmPf9GFb.mjs.map +0 -1
- package/dist/Subscriber-COYMSevD.d.cts.map +0 -1
- package/dist/Subscriber-ikctpU3I.d.mts.map +0 -1
- package/dist/SubscriberBuilder-Cp1C-xtT.cjs.map +0 -1
- package/dist/SubscriberBuilder-DJPEeYDJ.mjs.map +0 -1
- package/dist/SubscriberBuilder-D_9zzllj.d.mts.map +0 -1
- package/dist/SubscriberBuilder-ivHAGIVi.d.cts.map +0 -1
- package/dist/TestEndpointAdaptor-C10xBI--.d.cts.map +0 -1
- package/dist/TestEndpointAdaptor-DB7bREhS.d.mts.map +0 -1
- package/dist/TestEndpointAdaptor-DJgik2Wj.mjs +0 -160
- package/dist/TestEndpointAdaptor-DJgik2Wj.mjs.map +0 -1
- package/dist/TestEndpointAdaptor-ZbtQiuHE.cjs +0 -166
- package/dist/TestEndpointAdaptor-ZbtQiuHE.cjs.map +0 -1
- package/dist/functions-C6EK1xL6.mjs +0 -8
- package/dist/functions-C6EK1xL6.mjs.map +0 -1
- package/dist/functions-fTid0RMK.cjs.map +0 -1
- package/dist/helpers-BcP1tXAi.cjs.map +0 -1
- package/dist/helpers-ByRTDO_m.mjs.map +0 -1
- package/dist/index-BWzGIj06.d.mts.map +0 -1
- package/dist/index-DmFozqLd.d.cts +0 -12
- package/dist/index-DmFozqLd.d.cts.map +0 -1
- package/dist/parseHonoQuery-CZC5_97v.cjs.map +0 -1
- package/dist/parseHonoQuery-DDgIkTO4.mjs.map +0 -1
- package/dist/publisher.d.cts.map +0 -1
- package/dist/publisher.d.mts.map +0 -1
- package/dist/types-DdIlpxAd.d.mts.map +0 -1
|
@@ -10,449 +10,449 @@ import { Function } from '../Function';
|
|
|
10
10
|
|
|
11
11
|
// Mock services
|
|
12
12
|
class TestService implements Service<'TestService', TestService> {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
serviceName = 'TestService' as const;
|
|
14
|
+
static serviceName = 'TestService';
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
async register() {
|
|
17
|
+
return this;
|
|
18
|
+
}
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
getValue() {
|
|
21
|
+
return 'test-value';
|
|
22
|
+
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
// Mock event publisher
|
|
26
26
|
type TestEvent = PublishableMessage<'test.event', { data: string }>;
|
|
27
27
|
|
|
28
28
|
class TestPublisher implements EventPublisher<TestEvent> {
|
|
29
|
-
|
|
29
|
+
publishedEvents: TestEvent[] = [];
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
async publish(events: TestEvent[]): Promise<void> {
|
|
32
|
+
this.publishedEvents.push(...events);
|
|
33
|
+
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
class TestPublisherService
|
|
37
|
-
|
|
37
|
+
implements Service<'TestPublisherService', TestPublisher>
|
|
38
38
|
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
serviceName = 'TestPublisherService' as const;
|
|
40
|
+
static serviceName = 'TestPublisherService';
|
|
41
|
+
publisher = new TestPublisher();
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
async register() {
|
|
44
|
+
return this.publisher;
|
|
45
|
+
}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
// Mock Lambda context
|
|
49
49
|
const createMockContext = (): Context => ({
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
50
|
+
functionName: 'test-function',
|
|
51
|
+
functionVersion: '1',
|
|
52
|
+
invokedFunctionArn: 'arn:aws:lambda:region:account:function:test-function',
|
|
53
|
+
memoryLimitInMB: '128',
|
|
54
|
+
awsRequestId: 'test-request-id',
|
|
55
|
+
logGroupName: '/aws/lambda/test-function',
|
|
56
|
+
logStreamName: '2023/01/01/[$LATEST]test-stream',
|
|
57
|
+
getRemainingTimeInMillis: () => 30000,
|
|
58
|
+
done: vi.fn(),
|
|
59
|
+
fail: vi.fn(),
|
|
60
|
+
succeed: vi.fn(),
|
|
61
|
+
callbackWaitsForEmptyEventLoop: true,
|
|
62
62
|
});
|
|
63
63
|
|
|
64
64
|
describe('AWSLambdaFunction', () => {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
65
|
+
let envParser: EnvironmentParser<{}>;
|
|
66
|
+
let logger: ConsoleLogger;
|
|
67
|
+
|
|
68
|
+
beforeEach(() => {
|
|
69
|
+
envParser = new EnvironmentParser({});
|
|
70
|
+
logger = new ConsoleLogger();
|
|
71
|
+
vi.clearAllMocks();
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
describe('basic function execution', () => {
|
|
75
|
+
it('should execute a simple function without input/output schemas', async () => {
|
|
76
|
+
const fn = new Function(async ({ input }) => {
|
|
77
|
+
return { message: `Hello ` };
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const adaptor = new AWSLambdaFunction(envParser, fn);
|
|
81
|
+
const handler = adaptor.handler;
|
|
82
|
+
|
|
83
|
+
const result = await handler(
|
|
84
|
+
{ name: 'World' },
|
|
85
|
+
createMockContext(),
|
|
86
|
+
vi.fn(),
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
expect(result).toBeUndefined();
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it('should execute a function with input schema validation', async () => {
|
|
93
|
+
const inputSchema = { name: z.string() };
|
|
94
|
+
const outputSchema = z.object({ message: z.string() });
|
|
95
|
+
const handler = vi.fn(async ({ input }) => ({
|
|
96
|
+
message: `Hello ${input.name}`,
|
|
97
|
+
}));
|
|
98
|
+
|
|
99
|
+
const fn = new Function(
|
|
100
|
+
handler,
|
|
101
|
+
undefined,
|
|
102
|
+
undefined,
|
|
103
|
+
inputSchema,
|
|
104
|
+
outputSchema,
|
|
105
|
+
[],
|
|
106
|
+
logger,
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
const adaptor = new AWSLambdaFunction(envParser, fn);
|
|
110
|
+
const lambdaHandler = adaptor.handler;
|
|
111
|
+
|
|
112
|
+
const result = await lambdaHandler(
|
|
113
|
+
{ name: 'TypeScript' },
|
|
114
|
+
createMockContext(),
|
|
115
|
+
vi.fn(),
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
expect(result).toEqual({ message: 'Hello TypeScript' });
|
|
119
|
+
expect(handler).toHaveBeenCalledWith(
|
|
120
|
+
expect.objectContaining({
|
|
121
|
+
input: { name: 'TypeScript' },
|
|
122
|
+
}),
|
|
123
|
+
);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it('should fail with invalid input', async () => {
|
|
127
|
+
const inputSchema = { age: z.number() };
|
|
128
|
+
const fn = new Function(
|
|
129
|
+
async () => ({ success: true }),
|
|
130
|
+
undefined,
|
|
131
|
+
undefined,
|
|
132
|
+
inputSchema,
|
|
133
|
+
undefined,
|
|
134
|
+
[],
|
|
135
|
+
logger,
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
const adaptor = new AWSLambdaFunction(envParser, fn);
|
|
139
|
+
const handler = adaptor.handler;
|
|
140
|
+
|
|
141
|
+
await expect(
|
|
142
|
+
handler({ age: 'not a number' }, createMockContext(), vi.fn()),
|
|
143
|
+
).rejects.toThrow();
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
it('should validate output schema', async () => {
|
|
147
|
+
const outputSchema = z.object({
|
|
148
|
+
id: z.string(),
|
|
149
|
+
timestamp: z.number(),
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
const fn = new Function(
|
|
153
|
+
async () => ({
|
|
154
|
+
id: '123',
|
|
155
|
+
timestamp: Date.now(),
|
|
156
|
+
}),
|
|
157
|
+
undefined,
|
|
158
|
+
undefined,
|
|
159
|
+
undefined,
|
|
160
|
+
outputSchema,
|
|
161
|
+
[],
|
|
162
|
+
logger,
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
const adaptor = new AWSLambdaFunction(envParser, fn);
|
|
166
|
+
const handler = adaptor.handler;
|
|
167
|
+
|
|
168
|
+
const result = await handler({}, createMockContext(), vi.fn());
|
|
169
|
+
|
|
170
|
+
expect(result).toMatchObject({
|
|
171
|
+
id: '123',
|
|
172
|
+
timestamp: expect.any(Number),
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
it('should fail with invalid output', async () => {
|
|
177
|
+
const outputSchema = z.object({
|
|
178
|
+
id: z.string(),
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
const fn = new Function(
|
|
182
|
+
// @ts-expect-error
|
|
183
|
+
async () => ({
|
|
184
|
+
id: 123, // Invalid type, should be string
|
|
185
|
+
}),
|
|
186
|
+
undefined,
|
|
187
|
+
undefined,
|
|
188
|
+
undefined,
|
|
189
|
+
outputSchema,
|
|
190
|
+
[],
|
|
191
|
+
logger,
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
const adaptor = new AWSLambdaFunction(envParser, fn);
|
|
195
|
+
const handler = adaptor.handler;
|
|
196
|
+
|
|
197
|
+
await expect(handler({}, createMockContext(), vi.fn())).rejects.toThrow();
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
describe('services', () => {
|
|
202
|
+
it('should inject services into function context', async () => {
|
|
203
|
+
const service = new TestService();
|
|
204
|
+
const handler = vi.fn(async ({ services }) => ({
|
|
205
|
+
value: services.TestService.getValue(),
|
|
206
|
+
}));
|
|
207
|
+
|
|
208
|
+
const schema = z.object({ value: z.string() });
|
|
209
|
+
const fn = new Function(
|
|
210
|
+
handler,
|
|
211
|
+
undefined,
|
|
212
|
+
undefined,
|
|
213
|
+
undefined,
|
|
214
|
+
schema,
|
|
215
|
+
[service],
|
|
216
|
+
logger,
|
|
217
|
+
);
|
|
218
|
+
|
|
219
|
+
const adaptor = new AWSLambdaFunction(envParser, fn);
|
|
220
|
+
const lambdaHandler = adaptor.handler;
|
|
221
|
+
|
|
222
|
+
const result = await lambdaHandler({}, createMockContext(), vi.fn());
|
|
223
|
+
|
|
224
|
+
expect(result).toEqual({ value: 'test-value' });
|
|
225
|
+
expect(handler).toHaveBeenCalledWith(
|
|
226
|
+
expect.objectContaining({
|
|
227
|
+
services: expect.objectContaining({
|
|
228
|
+
TestService: expect.any(TestService),
|
|
229
|
+
}),
|
|
230
|
+
}),
|
|
231
|
+
);
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
describe('logging', () => {
|
|
236
|
+
it('should create child logger with Lambda context', async () => {
|
|
237
|
+
const mockLogger = {
|
|
238
|
+
child: vi.fn().mockReturnThis(),
|
|
239
|
+
info: vi.fn(),
|
|
240
|
+
error: vi.fn(),
|
|
241
|
+
warn: vi.fn(),
|
|
242
|
+
debug: vi.fn(),
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
const fn = new Function(
|
|
246
|
+
async ({ logger }) => {
|
|
247
|
+
logger.info('Function executed');
|
|
248
|
+
return { success: true };
|
|
249
|
+
},
|
|
250
|
+
undefined,
|
|
251
|
+
undefined,
|
|
252
|
+
undefined,
|
|
253
|
+
undefined,
|
|
254
|
+
[],
|
|
255
|
+
mockLogger as any,
|
|
256
|
+
);
|
|
257
|
+
|
|
258
|
+
const adaptor = new AWSLambdaFunction(envParser, fn);
|
|
259
|
+
const handler = adaptor.handler;
|
|
260
|
+
|
|
261
|
+
const context = createMockContext();
|
|
262
|
+
await handler({}, context, vi.fn());
|
|
263
|
+
|
|
264
|
+
expect(mockLogger.child).toHaveBeenCalledWith({
|
|
265
|
+
fn: {
|
|
266
|
+
name: 'test-function',
|
|
267
|
+
version: '1',
|
|
268
|
+
memory: '128',
|
|
269
|
+
},
|
|
270
|
+
req: {
|
|
271
|
+
id: 'test-request-id',
|
|
272
|
+
},
|
|
273
|
+
});
|
|
274
|
+
expect(mockLogger.info).toHaveBeenCalledWith('Function executed');
|
|
275
|
+
});
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
describe('error handling', () => {
|
|
279
|
+
it('should wrap and log errors', async () => {
|
|
280
|
+
const mockLogger = {
|
|
281
|
+
child: vi.fn().mockReturnThis(),
|
|
282
|
+
error: vi.fn(),
|
|
283
|
+
info: vi.fn(),
|
|
284
|
+
warn: vi.fn(),
|
|
285
|
+
debug: vi.fn(),
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
const fn = new Function(
|
|
289
|
+
async () => {
|
|
290
|
+
throw new Error('Function failed');
|
|
291
|
+
},
|
|
292
|
+
undefined,
|
|
293
|
+
undefined,
|
|
294
|
+
undefined,
|
|
295
|
+
undefined,
|
|
296
|
+
[],
|
|
297
|
+
mockLogger as any,
|
|
298
|
+
);
|
|
299
|
+
|
|
300
|
+
const adaptor = new AWSLambdaFunction(envParser, fn);
|
|
301
|
+
const handler = adaptor.handler;
|
|
302
|
+
|
|
303
|
+
await expect(handler({}, createMockContext(), vi.fn())).rejects.toThrow();
|
|
304
|
+
|
|
305
|
+
expect(mockLogger.error).toHaveBeenCalledWith(
|
|
306
|
+
expect.any(Error),
|
|
307
|
+
'Error processing function',
|
|
308
|
+
);
|
|
309
|
+
});
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
describe('events', () => {
|
|
313
|
+
it('should publish events after successful execution', async () => {
|
|
314
|
+
const publisherService = new TestPublisherService();
|
|
315
|
+
|
|
316
|
+
const fn = new Function(
|
|
317
|
+
async () => ({ id: '123' }),
|
|
318
|
+
undefined,
|
|
319
|
+
undefined,
|
|
320
|
+
undefined,
|
|
321
|
+
z.object({ id: z.string() }),
|
|
322
|
+
[],
|
|
323
|
+
logger,
|
|
324
|
+
publisherService,
|
|
325
|
+
[
|
|
326
|
+
{
|
|
327
|
+
type: 'test.event',
|
|
328
|
+
payload: (response) => ({ data: response.id }),
|
|
329
|
+
},
|
|
330
|
+
],
|
|
331
|
+
);
|
|
332
|
+
|
|
333
|
+
const adaptor = new AWSLambdaFunction(envParser, fn);
|
|
334
|
+
const handler = adaptor.handler;
|
|
335
|
+
|
|
336
|
+
await handler({}, createMockContext(), vi.fn());
|
|
337
|
+
|
|
338
|
+
expect(publisherService.publisher.publishedEvents).toHaveLength(1);
|
|
339
|
+
expect(publisherService.publisher.publishedEvents[0]).toEqual({
|
|
340
|
+
type: 'test.event',
|
|
341
|
+
payload: { data: '123' },
|
|
342
|
+
});
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
it('should conditionally publish events based on when clause', async () => {
|
|
346
|
+
const publisherService = new TestPublisherService();
|
|
347
|
+
|
|
348
|
+
const fn = new Function(
|
|
349
|
+
async () => ({ success: false }),
|
|
350
|
+
undefined,
|
|
351
|
+
undefined,
|
|
352
|
+
undefined,
|
|
353
|
+
z.object({ success: z.boolean() }),
|
|
354
|
+
[],
|
|
355
|
+
logger,
|
|
356
|
+
publisherService,
|
|
357
|
+
[
|
|
358
|
+
{
|
|
359
|
+
type: 'test.event',
|
|
360
|
+
payload: () => ({ data: 'test' }),
|
|
361
|
+
when: (response) => response.success === true,
|
|
362
|
+
},
|
|
363
|
+
],
|
|
364
|
+
);
|
|
365
|
+
|
|
366
|
+
const adaptor = new AWSLambdaFunction(envParser, fn);
|
|
367
|
+
const handler = adaptor.handler;
|
|
368
|
+
|
|
369
|
+
await handler({}, createMockContext(), vi.fn());
|
|
370
|
+
|
|
371
|
+
expect(publisherService.publisher.publishedEvents).toHaveLength(0);
|
|
372
|
+
});
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
// Skipping timeout tests for now as middleware order needs to be adjusted
|
|
376
|
+
|
|
377
|
+
describe('database', () => {
|
|
378
|
+
// Mock database service
|
|
379
|
+
class MockDatabase {
|
|
380
|
+
async query(_sql: string) {
|
|
381
|
+
return [{ id: '1', name: 'Test User' }];
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
class DatabaseService implements Service<'database', MockDatabase> {
|
|
386
|
+
serviceName = 'database' as const;
|
|
387
|
+
db = new MockDatabase();
|
|
388
|
+
|
|
389
|
+
async register() {
|
|
390
|
+
return this.db;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
it('should inject database into function context', async () => {
|
|
395
|
+
const databaseService = new DatabaseService();
|
|
396
|
+
const handler = vi.fn(async ({ db }) => {
|
|
397
|
+
const result = await db.query('SELECT * FROM users');
|
|
398
|
+
return { users: result };
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
const outputSchema = z.object({
|
|
402
|
+
users: z.array(z.object({ id: z.string(), name: z.string() })),
|
|
403
|
+
});
|
|
404
|
+
|
|
405
|
+
const fn = new Function(
|
|
406
|
+
handler,
|
|
407
|
+
undefined,
|
|
408
|
+
undefined,
|
|
409
|
+
undefined,
|
|
410
|
+
outputSchema,
|
|
411
|
+
[],
|
|
412
|
+
logger,
|
|
413
|
+
undefined,
|
|
414
|
+
[],
|
|
415
|
+
undefined,
|
|
416
|
+
undefined,
|
|
417
|
+
databaseService,
|
|
418
|
+
);
|
|
419
|
+
|
|
420
|
+
const adaptor = new AWSLambdaFunction(envParser, fn);
|
|
421
|
+
const lambdaHandler = adaptor.handler;
|
|
422
|
+
|
|
423
|
+
const result = await lambdaHandler({}, createMockContext(), vi.fn());
|
|
424
|
+
|
|
425
|
+
expect(result).toEqual({ users: [{ id: '1', name: 'Test User' }] });
|
|
426
|
+
expect(handler).toHaveBeenCalledWith(
|
|
427
|
+
expect.objectContaining({
|
|
428
|
+
db: expect.any(MockDatabase),
|
|
429
|
+
}),
|
|
430
|
+
);
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
it('should have db as undefined when no database service is configured', async () => {
|
|
434
|
+
const handler = vi.fn(async ({ db }) => {
|
|
435
|
+
return { hasDb: db !== undefined };
|
|
436
|
+
});
|
|
437
|
+
|
|
438
|
+
const outputSchema = z.object({ hasDb: z.boolean() });
|
|
439
|
+
|
|
440
|
+
const fn = new Function(
|
|
441
|
+
handler,
|
|
442
|
+
undefined,
|
|
443
|
+
undefined,
|
|
444
|
+
undefined,
|
|
445
|
+
outputSchema,
|
|
446
|
+
[],
|
|
447
|
+
logger,
|
|
448
|
+
);
|
|
449
|
+
|
|
450
|
+
const adaptor = new AWSLambdaFunction(envParser, fn);
|
|
451
|
+
const lambdaHandler = adaptor.handler;
|
|
452
|
+
|
|
453
|
+
const result = await lambdaHandler({}, createMockContext(), vi.fn());
|
|
454
|
+
|
|
455
|
+
expect(result).toEqual({ hasDb: false });
|
|
456
|
+
});
|
|
457
|
+
});
|
|
458
458
|
});
|