@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
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AuditableAction, Auditor, AuditStorage } from '@geekmidas/audit';
|
|
2
2
|
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
EventPublisher,
|
|
4
|
+
ExtractPublisherMessage,
|
|
5
|
+
MappedEvent,
|
|
6
6
|
} from '@geekmidas/events';
|
|
7
7
|
import type { Logger } from '@geekmidas/logger';
|
|
8
8
|
import type { RateLimitConfig } from '@geekmidas/rate-limit';
|
|
9
9
|
import type {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
InferComposableStandardSchema,
|
|
11
|
+
InferStandardSchema,
|
|
12
12
|
} from '@geekmidas/schema';
|
|
13
13
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
convertSchemaWithComponents,
|
|
15
|
+
convertStandardSchemaToJsonSchema,
|
|
16
16
|
} from '@geekmidas/schema/conversion';
|
|
17
17
|
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
buildOpenApiSchema,
|
|
19
|
+
type ComponentCollector,
|
|
20
|
+
type OpenApiSchemaOptions,
|
|
21
21
|
} from '@geekmidas/schema/openapi';
|
|
22
22
|
import type { Service, ServiceRecord } from '@geekmidas/services';
|
|
23
23
|
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
@@ -57,623 +57,623 @@ import type { RlsConfig } from './rls';
|
|
|
57
57
|
* ```
|
|
58
58
|
*/
|
|
59
59
|
export class Endpoint<
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
60
|
+
TRoute extends string,
|
|
61
|
+
TMethod extends HttpMethod,
|
|
62
|
+
TInput extends EndpointSchemas = {},
|
|
63
|
+
OutSchema extends StandardSchemaV1 | undefined = undefined,
|
|
64
|
+
TServices extends Service[] = [],
|
|
65
|
+
TLogger extends Logger = Logger,
|
|
66
|
+
TSession = unknown,
|
|
67
|
+
TEventPublisher extends EventPublisher<any> | undefined = undefined,
|
|
68
|
+
TEventPublisherServiceName extends string = string,
|
|
69
|
+
TAuditStorage extends AuditStorage | undefined = undefined,
|
|
70
|
+
TAuditStorageServiceName extends string = string,
|
|
71
|
+
TAuditAction extends AuditableAction<string, unknown> = AuditableAction<
|
|
72
|
+
string,
|
|
73
|
+
unknown
|
|
74
|
+
>,
|
|
75
|
+
TDatabase = undefined,
|
|
76
|
+
TDatabaseServiceName extends string = string,
|
|
77
77
|
> extends Function<
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
78
|
+
TInput,
|
|
79
|
+
TServices,
|
|
80
|
+
TLogger,
|
|
81
|
+
OutSchema,
|
|
82
|
+
TEventPublisher,
|
|
83
|
+
TEventPublisherServiceName,
|
|
84
|
+
TAuditStorage,
|
|
85
|
+
TAuditStorageServiceName,
|
|
86
|
+
TDatabase,
|
|
87
|
+
TDatabaseServiceName,
|
|
88
|
+
TAuditAction,
|
|
89
|
+
FunctionHandler<
|
|
90
|
+
TInput,
|
|
91
|
+
TServices,
|
|
92
|
+
TLogger,
|
|
93
|
+
OutSchema,
|
|
94
|
+
TDatabase,
|
|
95
|
+
TAuditStorage,
|
|
96
|
+
TAuditAction
|
|
97
|
+
>
|
|
98
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
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
99
|
+
operationId?: string;
|
|
100
|
+
/** The route path pattern with parameter placeholders */
|
|
101
|
+
route: TRoute;
|
|
102
|
+
/** The HTTP method for this endpoint */
|
|
103
|
+
method: TMethod;
|
|
104
|
+
/** Optional description for OpenAPI documentation */
|
|
105
|
+
description?: string;
|
|
106
|
+
/** Optional tags for OpenAPI documentation */
|
|
107
|
+
tags?: string[];
|
|
108
|
+
/** The HTTP success status code to return (default: 200) */
|
|
109
|
+
public readonly status: SuccessStatus;
|
|
110
|
+
/** Default headers to apply to all responses */
|
|
111
|
+
public readonly defaultHeaders: Record<string, string> = {};
|
|
112
|
+
/** Function to extract session data from the request context */
|
|
113
|
+
public getSession: SessionFn<TServices, TLogger, TSession, TDatabase> = () =>
|
|
114
|
+
({}) as TSession;
|
|
115
|
+
/** Function to determine if the request is authorized */
|
|
116
|
+
public authorize: AuthorizeFn<TServices, TLogger, TSession> = () => true;
|
|
117
|
+
/** Optional rate limiting configuration */
|
|
118
|
+
public rateLimit?: RateLimitConfig;
|
|
119
|
+
/** Optional authorizer for this endpoint */
|
|
120
|
+
public authorizer?: Authorizer;
|
|
121
|
+
/** Optional actor extractor for audit records */
|
|
122
|
+
public actorExtractor?: ActorExtractor<TServices, TSession, TLogger>;
|
|
123
|
+
/** Declarative audit definitions */
|
|
124
|
+
public audits: MappedAudit<TAuditAction, OutSchema>[] = [];
|
|
125
|
+
/** Database service for this endpoint */
|
|
126
|
+
public declare databaseService?: Service<TDatabaseServiceName, TDatabase>;
|
|
127
|
+
/** RLS configuration for this endpoint */
|
|
128
|
+
public rlsConfig?: RlsConfig<TServices, TSession, TLogger>;
|
|
129
|
+
/** Whether to bypass RLS for this endpoint */
|
|
130
|
+
public rlsBypass?: boolean;
|
|
131
|
+
/** The endpoint handler function */
|
|
132
|
+
private endpointFn!: EndpointHandler<
|
|
133
|
+
TInput,
|
|
134
|
+
TServices,
|
|
135
|
+
TLogger,
|
|
136
|
+
OutSchema,
|
|
137
|
+
TSession,
|
|
138
|
+
TDatabase,
|
|
139
|
+
TAuditStorage,
|
|
140
|
+
TAuditAction
|
|
141
|
+
>;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Builds a complete OpenAPI 3.1 schema from an array of endpoints.
|
|
145
|
+
*
|
|
146
|
+
* @param endpoints - Array of endpoint instances to document
|
|
147
|
+
* @param options - Optional configuration for OpenAPI generation
|
|
148
|
+
* @returns OpenAPI 3.1 specification object
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```typescript
|
|
152
|
+
* const schema = await Endpoint.buildOpenApiSchema([
|
|
153
|
+
* getUserEndpoint,
|
|
154
|
+
* createUserEndpoint
|
|
155
|
+
* ], {
|
|
156
|
+
* title: 'User API',
|
|
157
|
+
* version: '1.0.0'
|
|
158
|
+
* });
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
static async buildOpenApiSchema(
|
|
162
|
+
endpoints: Endpoint<any, any, any, any, any, any>[],
|
|
163
|
+
options?: OpenApiSchemaOptions,
|
|
164
|
+
) {
|
|
165
|
+
return buildOpenApiSchema(endpoints, options);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Gets the full path including HTTP method and route.
|
|
170
|
+
* @returns Formatted string like 'GET /users/{id}'
|
|
171
|
+
*/
|
|
172
|
+
get fullPath() {
|
|
173
|
+
return `${this.method} ${this._path}` as const;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Parses and validates input data for a specific input type (body, query, params).
|
|
178
|
+
*
|
|
179
|
+
* @param input - The raw input data to validate
|
|
180
|
+
* @param key - The input type key ('body', 'query', or 'params')
|
|
181
|
+
* @returns The validated input data for the specified key
|
|
182
|
+
* @throws {UnprocessableEntityError} When validation fails
|
|
183
|
+
*/
|
|
184
|
+
async parseInput<K extends keyof TInput>(
|
|
185
|
+
input: unknown,
|
|
186
|
+
key: K,
|
|
187
|
+
): Promise<InferComposableStandardSchema<TInput[K]>> {
|
|
188
|
+
const schema = this.input?.[key];
|
|
189
|
+
return Endpoint.parseSchema(schema as StandardSchemaV1, input) as Promise<
|
|
190
|
+
InferComposableStandardSchema<TInput[K]>
|
|
191
|
+
>;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Parses and validates the request body against the body schema.
|
|
196
|
+
*
|
|
197
|
+
* @param body - The raw request body to validate
|
|
198
|
+
* @returns The validated body data
|
|
199
|
+
* @throws {UnprocessableEntityError} When body validation fails
|
|
200
|
+
*/
|
|
201
|
+
async parseBody(body: unknown): Promise<InferStandardSchema<TInput['body']>> {
|
|
202
|
+
return this.parseInput(body, 'body') as Promise<
|
|
203
|
+
InferStandardSchema<TInput['body']>
|
|
204
|
+
>;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
static isSuccessStatus(status: number): boolean {
|
|
208
|
+
return status >= 200 && status < 300;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Creates a case-insensitive header lookup function from a headers object.
|
|
213
|
+
*
|
|
214
|
+
* @param headers - Object containing header key-value pairs
|
|
215
|
+
* @returns Function to retrieve header values by case-insensitive key, or all headers
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* ```typescript
|
|
219
|
+
* const headerFn = Endpoint.createHeaders({ 'Content-Type': 'application/json' });
|
|
220
|
+
* headerFn('content-type'); // Returns 'application/json'
|
|
221
|
+
* headerFn(); // Returns { 'content-type': 'application/json' }
|
|
222
|
+
* ```
|
|
223
|
+
*/
|
|
224
|
+
static createHeaders(headers: Record<string, string>): HeaderFn {
|
|
225
|
+
const headerMap = new Map<string, string>();
|
|
226
|
+
for (const [k, v] of Object.entries(headers)) {
|
|
227
|
+
const key = k.toLowerCase();
|
|
228
|
+
headerMap.set(key, v);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function get(): Record<string, string>;
|
|
232
|
+
function get(key: string): string | undefined;
|
|
233
|
+
function get(key?: string): string | undefined | Record<string, string> {
|
|
234
|
+
if (key === undefined) {
|
|
235
|
+
// Return all headers as plain object
|
|
236
|
+
return Object.fromEntries(headerMap.entries());
|
|
237
|
+
}
|
|
238
|
+
return headerMap.get(key.toLowerCase());
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return get;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Parses cookie string and creates a cookie lookup function.
|
|
246
|
+
*
|
|
247
|
+
* @param cookieHeader - The Cookie header value
|
|
248
|
+
* @returns Function to retrieve cookie values by name, or all cookies
|
|
249
|
+
*
|
|
250
|
+
* @example
|
|
251
|
+
* ```typescript
|
|
252
|
+
* const cookieFn = Endpoint.createCookies('session=abc123; theme=dark');
|
|
253
|
+
* cookieFn('session'); // Returns 'abc123'
|
|
254
|
+
* cookieFn(); // Returns { session: 'abc123', theme: 'dark' }
|
|
255
|
+
* ```
|
|
256
|
+
*/
|
|
257
|
+
static createCookies(cookieHeader: string | undefined): CookieFn {
|
|
258
|
+
const cookieMap = new Map<string, string>();
|
|
259
|
+
|
|
260
|
+
if (cookieHeader) {
|
|
261
|
+
// Parse cookie string: "name1=value1; name2=value2"
|
|
262
|
+
const cookies = cookieHeader.split(';');
|
|
263
|
+
for (const cookie of cookies) {
|
|
264
|
+
const [name, ...valueParts] = cookie.trim().split('=');
|
|
265
|
+
if (name) {
|
|
266
|
+
const value = valueParts.join('='); // Handle values with = in them
|
|
267
|
+
cookieMap.set(name, decodeURIComponent(value));
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function get(): Record<string, string>;
|
|
273
|
+
function get(name: string): string | undefined;
|
|
274
|
+
function get(name?: string): string | undefined | Record<string, string> {
|
|
275
|
+
if (name === undefined) {
|
|
276
|
+
// Return all cookies as plain object
|
|
277
|
+
return Object.fromEntries(cookieMap.entries());
|
|
278
|
+
}
|
|
279
|
+
return cookieMap.get(name);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
return get;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Formats a cookie as a Set-Cookie header string.
|
|
287
|
+
*
|
|
288
|
+
* @param name - Cookie name
|
|
289
|
+
* @param value - Cookie value
|
|
290
|
+
* @param options - Cookie options (httpOnly, secure, sameSite, etc.)
|
|
291
|
+
* @returns Formatted Set-Cookie header string
|
|
292
|
+
*
|
|
293
|
+
* @example
|
|
294
|
+
* ```typescript
|
|
295
|
+
* const header = Endpoint.formatCookieHeader('session', 'abc123', {
|
|
296
|
+
* httpOnly: true,
|
|
297
|
+
* secure: true,
|
|
298
|
+
* sameSite: 'strict',
|
|
299
|
+
* maxAge: 3600
|
|
300
|
+
* });
|
|
301
|
+
* // Returns: "session=abc123; Max-Age=3600; HttpOnly; Secure; SameSite=Strict"
|
|
302
|
+
* ```
|
|
303
|
+
*/
|
|
304
|
+
static formatCookieHeader(
|
|
305
|
+
name: string,
|
|
306
|
+
value: string,
|
|
307
|
+
options?: CookieOptions,
|
|
308
|
+
): string {
|
|
309
|
+
let cookie = `${name}=${value}`;
|
|
310
|
+
|
|
311
|
+
if (options) {
|
|
312
|
+
if (options.domain) cookie += `; Domain=${options.domain}`;
|
|
313
|
+
if (options.path) cookie += `; Path=${options.path}`;
|
|
314
|
+
if (options.expires)
|
|
315
|
+
cookie += `; Expires=${options.expires.toUTCString()}`;
|
|
316
|
+
if (options.maxAge !== undefined) cookie += `; Max-Age=${options.maxAge}`;
|
|
317
|
+
if (options.httpOnly) cookie += '; HttpOnly';
|
|
318
|
+
if (options.secure) cookie += '; Secure';
|
|
319
|
+
if (options.sameSite) {
|
|
320
|
+
cookie += `; SameSite=${options.sameSite.charAt(0).toUpperCase() + options.sameSite.slice(1)}`;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
return cookie;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Extracts and refines input data from the endpoint context.
|
|
329
|
+
*
|
|
330
|
+
* @param ctx - The endpoint execution context
|
|
331
|
+
* @returns Object containing only the input data (body, query, params)
|
|
332
|
+
* @internal
|
|
333
|
+
*/
|
|
334
|
+
refineInput(
|
|
335
|
+
ctx: EndpointContext<TInput, TServices, TLogger, TSession>,
|
|
336
|
+
): InferComposableStandardSchema<TInput> {
|
|
337
|
+
const input = pick(ctx, [
|
|
338
|
+
'body',
|
|
339
|
+
'query',
|
|
340
|
+
'params',
|
|
341
|
+
]) as InferComposableStandardSchema<TInput>;
|
|
342
|
+
|
|
343
|
+
return input;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
handler = (
|
|
347
|
+
ctx: EndpointContext<
|
|
348
|
+
TInput,
|
|
349
|
+
TServices,
|
|
350
|
+
TLogger,
|
|
351
|
+
TSession,
|
|
352
|
+
TAuditAction,
|
|
353
|
+
TDatabase,
|
|
354
|
+
TAuditStorage
|
|
355
|
+
>,
|
|
356
|
+
response: ResponseBuilder,
|
|
357
|
+
): OutSchema extends StandardSchemaV1
|
|
358
|
+
?
|
|
359
|
+
| InferStandardSchema<OutSchema>
|
|
360
|
+
| ResponseWithMetadata<InferStandardSchema<OutSchema>>
|
|
361
|
+
| Promise<InferStandardSchema<OutSchema>>
|
|
362
|
+
| Promise<ResponseWithMetadata<InferStandardSchema<OutSchema>>>
|
|
363
|
+
:
|
|
364
|
+
| any
|
|
365
|
+
| ResponseWithMetadata<any>
|
|
366
|
+
| Promise<any>
|
|
367
|
+
| Promise<ResponseWithMetadata<any>> => {
|
|
368
|
+
// Apply default headers to response builder
|
|
369
|
+
for (const [key, value] of Object.entries(this.defaultHeaders)) {
|
|
370
|
+
response.header(key, value);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
// Build context object, conditionally including auditor and db
|
|
374
|
+
const handlerCtx = {
|
|
375
|
+
...this.refineInput(ctx),
|
|
376
|
+
services: ctx.services,
|
|
377
|
+
logger: ctx.logger,
|
|
378
|
+
header: ctx.header,
|
|
379
|
+
cookie: ctx.cookie,
|
|
380
|
+
session: ctx.session,
|
|
381
|
+
// These are conditionally present based on configuration
|
|
382
|
+
...('auditor' in ctx && { auditor: ctx.auditor }),
|
|
383
|
+
...('db' in ctx && { db: ctx.db }),
|
|
384
|
+
} as EndpointContext<
|
|
385
|
+
TInput,
|
|
386
|
+
TServices,
|
|
387
|
+
TLogger,
|
|
388
|
+
TSession,
|
|
389
|
+
TAuditAction,
|
|
390
|
+
TDatabase,
|
|
391
|
+
TAuditStorage
|
|
392
|
+
>;
|
|
393
|
+
|
|
394
|
+
return this.endpointFn(handlerCtx, response);
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Type guard to check if an object is an Endpoint instance.
|
|
399
|
+
*
|
|
400
|
+
* @param obj - The object to check
|
|
401
|
+
* @returns True if the object is an Endpoint
|
|
402
|
+
*/
|
|
403
|
+
static isEndpoint(obj: any): obj is Endpoint<any, any, any, any> {
|
|
404
|
+
return Boolean(
|
|
405
|
+
obj &&
|
|
406
|
+
(obj as Function).__IS_FUNCTION__ === true &&
|
|
407
|
+
obj.type === ConstructType.Endpoint,
|
|
408
|
+
);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Helper to check if response has metadata
|
|
413
|
+
*/
|
|
414
|
+
static hasMetadata<T>(
|
|
415
|
+
response: T | ResponseWithMetadata<T>,
|
|
416
|
+
): response is ResponseWithMetadata<T> {
|
|
417
|
+
return (
|
|
418
|
+
response !== null &&
|
|
419
|
+
typeof response === 'object' &&
|
|
420
|
+
'data' in response &&
|
|
421
|
+
'metadata' in response
|
|
422
|
+
);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* Converts Express-style route params to OpenAPI format.
|
|
427
|
+
* @returns Route with ':param' converted to '{param}'
|
|
428
|
+
* @internal
|
|
429
|
+
*/
|
|
430
|
+
get _path() {
|
|
431
|
+
return this.route.replace(/:(\w+)/g, '{$1}') as ConvertRouteParams<TRoute>;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Generates OpenAPI 3.1 schema for this endpoint.
|
|
436
|
+
*
|
|
437
|
+
* @returns OpenAPI route definition with operation details
|
|
438
|
+
*/
|
|
439
|
+
async toOpenApi3Route(
|
|
440
|
+
componentCollector?: ComponentCollector,
|
|
441
|
+
): Promise<EndpointOpenApiSchema<TRoute, TMethod>> {
|
|
442
|
+
const operation: OpenAPIV3_1.OperationObject = {
|
|
443
|
+
operationId: this.operationId,
|
|
444
|
+
...(this.description && { description: this.description }),
|
|
445
|
+
...(this.tags && this.tags.length > 0 && { tags: this.tags }),
|
|
446
|
+
responses: {
|
|
447
|
+
'200': {
|
|
448
|
+
description: 'Successful response',
|
|
449
|
+
} as OpenAPIV3_1.ResponseObject,
|
|
450
|
+
},
|
|
451
|
+
};
|
|
452
|
+
|
|
453
|
+
// Add response schema
|
|
454
|
+
if (this.outputSchema) {
|
|
455
|
+
const responseSchema = await convertSchemaWithComponents(
|
|
456
|
+
this.outputSchema,
|
|
457
|
+
componentCollector,
|
|
458
|
+
);
|
|
459
|
+
if (responseSchema) {
|
|
460
|
+
set(
|
|
461
|
+
operation,
|
|
462
|
+
['responses', '200', 'content', 'application/json', 'schema'],
|
|
463
|
+
responseSchema,
|
|
464
|
+
);
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
// Separate path and query parameters
|
|
469
|
+
const pathParameters: OpenAPIV3_1.ParameterObject[] = [];
|
|
470
|
+
const queryParameters: OpenAPIV3_1.ParameterObject[] = [];
|
|
471
|
+
|
|
472
|
+
// Since the EndpointBuilder doesn't have body/search/params methods yet,
|
|
473
|
+
// and the input is a composite type, we need to check if input exists
|
|
474
|
+
// and has the expected shape
|
|
475
|
+
if (this.input && typeof this.input === 'object') {
|
|
476
|
+
// Add request body for methods that support it
|
|
477
|
+
if (
|
|
478
|
+
['POST', 'PUT', 'PATCH'].includes(this.method) &&
|
|
479
|
+
'body' in this.input &&
|
|
480
|
+
this.input.body
|
|
481
|
+
) {
|
|
482
|
+
const bodySchema = await convertSchemaWithComponents(
|
|
483
|
+
this.input.body as StandardSchemaV1,
|
|
484
|
+
componentCollector,
|
|
485
|
+
);
|
|
486
|
+
if (bodySchema) {
|
|
487
|
+
set(operation, ['requestBody'], {
|
|
488
|
+
required: true,
|
|
489
|
+
content: {
|
|
490
|
+
'application/json': {
|
|
491
|
+
schema: bodySchema,
|
|
492
|
+
},
|
|
493
|
+
},
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
// Add path parameters
|
|
499
|
+
if ('params' in this.input && this.input.params) {
|
|
500
|
+
const paramsSchema = await convertStandardSchemaToJsonSchema(
|
|
501
|
+
this.input.params as StandardSchemaV1,
|
|
502
|
+
);
|
|
503
|
+
if (
|
|
504
|
+
paramsSchema &&
|
|
505
|
+
paramsSchema.type === 'object' &&
|
|
506
|
+
paramsSchema.properties
|
|
507
|
+
) {
|
|
508
|
+
for (const [name, schema] of Object.entries(
|
|
509
|
+
paramsSchema.properties,
|
|
510
|
+
)) {
|
|
511
|
+
pathParameters.push({
|
|
512
|
+
name,
|
|
513
|
+
in: 'path',
|
|
514
|
+
required: paramsSchema.required?.includes(name) ?? true,
|
|
515
|
+
schema: schema as any,
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
// Add query parameters
|
|
522
|
+
if ('query' in this.input && this.input.query) {
|
|
523
|
+
const querySchema = await convertStandardSchemaToJsonSchema(
|
|
524
|
+
this.input.query,
|
|
525
|
+
);
|
|
526
|
+
if (
|
|
527
|
+
querySchema &&
|
|
528
|
+
querySchema.type === 'object' &&
|
|
529
|
+
querySchema.properties
|
|
530
|
+
) {
|
|
531
|
+
for (const [name, schema] of Object.entries(querySchema.properties)) {
|
|
532
|
+
queryParameters.push({
|
|
533
|
+
name,
|
|
534
|
+
in: 'query',
|
|
535
|
+
required: querySchema.required?.includes(name) ?? false,
|
|
536
|
+
schema: schema as any,
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
// Only add query parameters to the operation
|
|
544
|
+
if (queryParameters.length > 0) {
|
|
545
|
+
operation.parameters = queryParameters;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
// Build the route object with path parameters at the route level
|
|
549
|
+
const routeObject: any = {};
|
|
550
|
+
if (pathParameters.length > 0) {
|
|
551
|
+
routeObject.parameters = pathParameters;
|
|
552
|
+
}
|
|
553
|
+
routeObject[this.method.toLowerCase()] = operation;
|
|
554
|
+
|
|
555
|
+
return {
|
|
556
|
+
[this._path]: routeObject,
|
|
557
|
+
} as EndpointOpenApiSchema<TRoute, TMethod>;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* Creates a new Endpoint instance.
|
|
562
|
+
*
|
|
563
|
+
* @param options - Configuration options for the endpoint
|
|
564
|
+
* @param options.fn - The handler function to execute
|
|
565
|
+
* @param options.method - HTTP method
|
|
566
|
+
* @param options.route - Route path with parameter placeholders
|
|
567
|
+
* @param options.description - Optional description for documentation
|
|
568
|
+
* @param options.input - Input schemas for validation
|
|
569
|
+
* @param options.logger - Logger instance
|
|
570
|
+
* @param options.output - Output schema for response validation
|
|
571
|
+
* @param options.services - Service dependencies
|
|
572
|
+
* @param options.timeout - Execution timeout in milliseconds
|
|
573
|
+
* @param options.getSession - Session extraction function
|
|
574
|
+
* @param options.authorize - Authorization check function
|
|
575
|
+
* @param options.status - Success HTTP status code (default: 200)
|
|
576
|
+
* @param options.authorizer - Optional authorizer configuration
|
|
577
|
+
*/
|
|
578
|
+
constructor({
|
|
579
|
+
fn,
|
|
580
|
+
method,
|
|
581
|
+
route,
|
|
582
|
+
description,
|
|
583
|
+
tags,
|
|
584
|
+
input,
|
|
585
|
+
logger,
|
|
586
|
+
output: outputSchema,
|
|
587
|
+
services,
|
|
588
|
+
timeout,
|
|
589
|
+
memorySize,
|
|
590
|
+
getSession,
|
|
591
|
+
authorize,
|
|
592
|
+
rateLimit,
|
|
593
|
+
status = SuccessStatus.OK,
|
|
594
|
+
publisherService,
|
|
595
|
+
events,
|
|
596
|
+
authorizer,
|
|
597
|
+
auditorStorageService,
|
|
598
|
+
actorExtractor,
|
|
599
|
+
audits,
|
|
600
|
+
databaseService,
|
|
601
|
+
rlsConfig,
|
|
602
|
+
rlsBypass,
|
|
603
|
+
}: EndpointOptions<
|
|
604
|
+
TRoute,
|
|
605
|
+
TMethod,
|
|
606
|
+
TInput,
|
|
607
|
+
OutSchema,
|
|
608
|
+
TServices,
|
|
609
|
+
TLogger,
|
|
610
|
+
TSession,
|
|
611
|
+
OutSchema,
|
|
612
|
+
TEventPublisher,
|
|
613
|
+
TEventPublisherServiceName,
|
|
614
|
+
TAuditStorage,
|
|
615
|
+
TAuditStorageServiceName,
|
|
616
|
+
TAuditAction,
|
|
617
|
+
TDatabase,
|
|
618
|
+
TDatabaseServiceName
|
|
619
|
+
>) {
|
|
620
|
+
super(
|
|
621
|
+
fn as unknown as FunctionHandler<TInput, TServices, TLogger, OutSchema>,
|
|
622
|
+
timeout,
|
|
623
|
+
ConstructType.Endpoint,
|
|
624
|
+
input,
|
|
625
|
+
outputSchema,
|
|
626
|
+
services,
|
|
627
|
+
logger,
|
|
628
|
+
publisherService,
|
|
629
|
+
events,
|
|
630
|
+
memorySize,
|
|
631
|
+
auditorStorageService,
|
|
632
|
+
);
|
|
633
|
+
|
|
634
|
+
this.route = route;
|
|
635
|
+
this.method = method;
|
|
636
|
+
this.description = description;
|
|
637
|
+
this.tags = tags;
|
|
638
|
+
this.status = status;
|
|
639
|
+
this.endpointFn = fn;
|
|
640
|
+
|
|
641
|
+
if (getSession) {
|
|
642
|
+
this.getSession = getSession;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
if (authorize) {
|
|
646
|
+
this.authorize = authorize;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
if (rateLimit) {
|
|
650
|
+
this.rateLimit = rateLimit;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
if (authorizer) {
|
|
654
|
+
this.authorizer = authorizer;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
if (actorExtractor) {
|
|
658
|
+
this.actorExtractor = actorExtractor;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
if (audits) {
|
|
662
|
+
this.audits = audits;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
if (databaseService) {
|
|
666
|
+
this.databaseService = databaseService;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
if (rlsConfig) {
|
|
670
|
+
this.rlsConfig = rlsConfig;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
if (rlsBypass) {
|
|
674
|
+
this.rlsBypass = rlsBypass;
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
677
|
}
|
|
678
678
|
|
|
679
679
|
/**
|
|
@@ -693,13 +693,13 @@ export class Endpoint<
|
|
|
693
693
|
* ```
|
|
694
694
|
*/
|
|
695
695
|
export type EndpointInput<
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
696
|
+
TBody extends StandardSchemaV1 | undefined = undefined,
|
|
697
|
+
TSearch extends StandardSchemaV1 | undefined = undefined,
|
|
698
|
+
TParams extends StandardSchemaV1 | undefined = undefined,
|
|
699
699
|
> = RemoveUndefined<{
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
700
|
+
body: TBody;
|
|
701
|
+
search: TSearch;
|
|
702
|
+
params: TParams;
|
|
703
703
|
}>;
|
|
704
704
|
|
|
705
705
|
/**
|
|
@@ -714,86 +714,86 @@ export type EndpointInput<
|
|
|
714
714
|
* @template TSession - Session data type
|
|
715
715
|
*/
|
|
716
716
|
export interface EndpointOptions<
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
717
|
+
TRoute extends string,
|
|
718
|
+
TMethod extends HttpMethod,
|
|
719
|
+
TInput extends EndpointSchemas = {},
|
|
720
|
+
TOutput extends StandardSchemaV1 | undefined = undefined,
|
|
721
|
+
TServices extends Service[] = [],
|
|
722
|
+
TLogger extends Logger = Logger,
|
|
723
|
+
TSession = unknown,
|
|
724
|
+
OutSchema extends StandardSchemaV1 | undefined = undefined,
|
|
725
|
+
TEventPublisher extends EventPublisher<any> | undefined = undefined,
|
|
726
|
+
TEventPublisherServiceName extends string = string,
|
|
727
|
+
TAuditStorage extends AuditStorage | undefined = undefined,
|
|
728
|
+
TAuditStorageServiceName extends string = string,
|
|
729
|
+
TAuditAction extends AuditableAction<string, unknown> = AuditableAction<
|
|
730
|
+
string,
|
|
731
|
+
unknown
|
|
732
|
+
>,
|
|
733
|
+
TDatabase = undefined,
|
|
734
|
+
TDatabaseServiceName extends string = string,
|
|
735
735
|
> {
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
736
|
+
/** The route path with parameter placeholders */
|
|
737
|
+
route: TRoute;
|
|
738
|
+
/** The HTTP method for this endpoint */
|
|
739
|
+
method: TMethod;
|
|
740
|
+
/** The handler function that implements the endpoint logic */
|
|
741
|
+
fn: EndpointHandler<
|
|
742
|
+
TInput,
|
|
743
|
+
TServices,
|
|
744
|
+
TLogger,
|
|
745
|
+
TOutput,
|
|
746
|
+
TSession,
|
|
747
|
+
TDatabase,
|
|
748
|
+
TAuditStorage,
|
|
749
|
+
TAuditAction
|
|
750
|
+
>;
|
|
751
|
+
/** Optional authorization check function */
|
|
752
|
+
authorize: AuthorizeFn<TServices, TLogger, TSession> | undefined;
|
|
753
|
+
/** Optional description for documentation */
|
|
754
|
+
description: string | undefined;
|
|
755
|
+
/** Optional tags for OpenAPI documentation */
|
|
756
|
+
tags?: string[];
|
|
757
|
+
/** Optional execution timeout in milliseconds */
|
|
758
|
+
timeout: number | undefined;
|
|
759
|
+
/** Optional memory size in MB for serverless deployments */
|
|
760
|
+
memorySize: number | undefined;
|
|
761
|
+
/** Input validation schemas */
|
|
762
|
+
input: TInput | undefined;
|
|
763
|
+
/** Output validation schema */
|
|
764
|
+
output: TOutput | undefined;
|
|
765
|
+
/** Service dependencies to inject */
|
|
766
|
+
services: TServices;
|
|
767
|
+
/** Logger instance */
|
|
768
|
+
logger: TLogger;
|
|
769
|
+
/** Optional session extraction function */
|
|
770
|
+
getSession: SessionFn<TServices, TLogger, TSession, TDatabase> | undefined;
|
|
771
|
+
/** Optional rate limiting configuration */
|
|
772
|
+
rateLimit?: RateLimitConfig;
|
|
773
|
+
/** Success HTTP status code */
|
|
774
|
+
status: SuccessStatus | undefined;
|
|
775
|
+
/**
|
|
776
|
+
* Event publisher service for publishing events from this endpoint
|
|
777
|
+
*/
|
|
778
|
+
publisherService?: Service<TEventPublisherServiceName, TEventPublisher>;
|
|
779
|
+
|
|
780
|
+
events?: MappedEvent<TEventPublisher, OutSchema>[];
|
|
781
|
+
/** Optional authorizer configuration */
|
|
782
|
+
authorizer?: Authorizer;
|
|
783
|
+
/**
|
|
784
|
+
* Auditor storage service for persisting audit records from this endpoint
|
|
785
|
+
*/
|
|
786
|
+
auditorStorageService?: Service<TAuditStorageServiceName, TAuditStorage>;
|
|
787
|
+
/** Optional actor extractor function for audit records */
|
|
788
|
+
actorExtractor?: ActorExtractor<TServices, TSession, TLogger>;
|
|
789
|
+
/** Declarative audit definitions */
|
|
790
|
+
audits?: MappedAudit<TAuditAction, OutSchema>[];
|
|
791
|
+
/** Database service for this endpoint */
|
|
792
|
+
databaseService?: Service<TDatabaseServiceName, TDatabase>;
|
|
793
|
+
/** RLS configuration for this endpoint */
|
|
794
|
+
rlsConfig?: RlsConfig<TServices, TSession, TLogger>;
|
|
795
|
+
/** Whether to bypass RLS for this endpoint */
|
|
796
|
+
rlsBypass?: boolean;
|
|
797
797
|
}
|
|
798
798
|
|
|
799
799
|
/**
|
|
@@ -801,24 +801,24 @@ export interface EndpointOptions<
|
|
|
801
801
|
* Each property represents a different part of the HTTP request.
|
|
802
802
|
*/
|
|
803
803
|
export type EndpointSchemas = Partial<{
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
804
|
+
/** Schema for URL path parameters (e.g., /users/:id) */
|
|
805
|
+
params: StandardSchemaV1;
|
|
806
|
+
/** Schema for query string parameters */
|
|
807
|
+
query: StandardSchemaV1;
|
|
808
|
+
/** Schema for request body (POST, PUT, PATCH) */
|
|
809
|
+
body: StandardSchemaV1;
|
|
810
810
|
}>;
|
|
811
811
|
|
|
812
812
|
export type AuthorizeContext<
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
813
|
+
TServices extends Service[] = [],
|
|
814
|
+
TLogger extends Logger = Logger,
|
|
815
|
+
TSession = unknown,
|
|
816
816
|
> = {
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
817
|
+
services: ServiceRecord<TServices>;
|
|
818
|
+
logger: TLogger;
|
|
819
|
+
header: HeaderFn;
|
|
820
|
+
cookie: CookieFn;
|
|
821
|
+
session: TSession;
|
|
822
822
|
};
|
|
823
823
|
/**
|
|
824
824
|
* Function type for endpoint authorization checks.
|
|
@@ -838,44 +838,44 @@ export type AuthorizeContext<
|
|
|
838
838
|
* ```
|
|
839
839
|
*/
|
|
840
840
|
export type AuthorizeFn<
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
841
|
+
TServices extends Service[] = [],
|
|
842
|
+
TLogger extends Logger = Logger,
|
|
843
|
+
TSession = unknown,
|
|
844
844
|
> = (
|
|
845
|
-
|
|
845
|
+
ctx: AuthorizeContext<TServices, TLogger, TSession>,
|
|
846
846
|
) => Promise<boolean> | boolean;
|
|
847
847
|
|
|
848
848
|
/**
|
|
849
849
|
* Base session context without database
|
|
850
850
|
*/
|
|
851
851
|
type BaseSessionContext<
|
|
852
|
-
|
|
853
|
-
|
|
852
|
+
TServices extends Service[] = [],
|
|
853
|
+
TLogger extends Logger = Logger,
|
|
854
854
|
> = {
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
855
|
+
services: ServiceRecord<TServices>;
|
|
856
|
+
logger: TLogger;
|
|
857
|
+
header: HeaderFn;
|
|
858
|
+
cookie: CookieFn;
|
|
859
859
|
};
|
|
860
860
|
|
|
861
861
|
/**
|
|
862
862
|
* Conditional database context for session - only present when database service is configured
|
|
863
863
|
*/
|
|
864
864
|
type SessionDatabaseContext<TDatabase = undefined> = TDatabase extends undefined
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
865
|
+
? {}
|
|
866
|
+
: {
|
|
867
|
+
/**
|
|
868
|
+
* Database instance for session extraction.
|
|
869
|
+
* Available when a database service is configured via `.database()`.
|
|
870
|
+
* Useful for looking up user data from the database based on auth tokens.
|
|
871
|
+
*/
|
|
872
|
+
db: TDatabase;
|
|
873
|
+
};
|
|
874
874
|
|
|
875
875
|
export type SessionContext<
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
876
|
+
TServices extends Service[] = [],
|
|
877
|
+
TLogger extends Logger = Logger,
|
|
878
|
+
TDatabase = undefined,
|
|
879
879
|
> = BaseSessionContext<TServices, TLogger> & SessionDatabaseContext<TDatabase>;
|
|
880
880
|
/**
|
|
881
881
|
* Function type for extracting session data from a request.
|
|
@@ -905,12 +905,12 @@ export type SessionContext<
|
|
|
905
905
|
* ```
|
|
906
906
|
*/
|
|
907
907
|
export type SessionFn<
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
908
|
+
TServices extends Service[] = [],
|
|
909
|
+
TLogger extends Logger = Logger,
|
|
910
|
+
TSession = unknown,
|
|
911
|
+
TDatabase = undefined,
|
|
912
912
|
> = (
|
|
913
|
-
|
|
913
|
+
ctx: SessionContext<TServices, TLogger, TDatabase>,
|
|
914
914
|
) => Promise<TSession> | TSession;
|
|
915
915
|
|
|
916
916
|
/**
|
|
@@ -926,11 +926,11 @@ export type SessionFn<
|
|
|
926
926
|
* ```
|
|
927
927
|
*/
|
|
928
928
|
export type ConvertRouteParams<T extends string> =
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
929
|
+
T extends `${infer Start}:${infer Param}/${infer Rest}`
|
|
930
|
+
? `${Start}{${Param}}/${ConvertRouteParams<Rest>}`
|
|
931
|
+
: T extends `${infer Start}:${infer Param}`
|
|
932
|
+
? `${Start}{${Param}}`
|
|
933
|
+
: T;
|
|
934
934
|
|
|
935
935
|
/**
|
|
936
936
|
* Type representing the OpenAPI schema structure for an endpoint.
|
|
@@ -945,14 +945,14 @@ export type ConvertRouteParams<T extends string> =
|
|
|
945
945
|
* ```
|
|
946
946
|
*/
|
|
947
947
|
export type EndpointOpenApiSchema<
|
|
948
|
-
|
|
949
|
-
|
|
948
|
+
TRoute extends string,
|
|
949
|
+
TMethod extends HttpMethod,
|
|
950
950
|
> = {
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
951
|
+
[key in ConvertRouteParams<TRoute>]: {
|
|
952
|
+
[key in LowerHttpMethod<TMethod>]: OpenAPIV3_1.OperationObject<{}>;
|
|
953
|
+
} & {
|
|
954
|
+
parameters?: OpenAPIV3_1.ParameterObject[];
|
|
955
|
+
};
|
|
956
956
|
};
|
|
957
957
|
|
|
958
958
|
export type SingleHeaderFn = (key: string) => string | undefined;
|
|
@@ -979,8 +979,8 @@ export type EndpointHeaders = Map<string, string>;
|
|
|
979
979
|
* ```
|
|
980
980
|
*/
|
|
981
981
|
export interface HeaderFn {
|
|
982
|
-
|
|
983
|
-
|
|
982
|
+
(): Record<string, string>;
|
|
983
|
+
(key: string): string | undefined;
|
|
984
984
|
}
|
|
985
985
|
|
|
986
986
|
/**
|
|
@@ -1000,139 +1000,139 @@ export interface HeaderFn {
|
|
|
1000
1000
|
* ```
|
|
1001
1001
|
*/
|
|
1002
1002
|
export interface CookieFn {
|
|
1003
|
-
|
|
1004
|
-
|
|
1003
|
+
(): Record<string, string>;
|
|
1004
|
+
(name: string): string | undefined;
|
|
1005
1005
|
}
|
|
1006
1006
|
|
|
1007
1007
|
/**
|
|
1008
1008
|
* Cookie options matching standard Set-Cookie attributes
|
|
1009
1009
|
*/
|
|
1010
1010
|
export interface CookieOptions {
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1011
|
+
domain?: string;
|
|
1012
|
+
path?: string;
|
|
1013
|
+
expires?: Date;
|
|
1014
|
+
maxAge?: number;
|
|
1015
|
+
httpOnly?: boolean;
|
|
1016
|
+
secure?: boolean;
|
|
1017
|
+
sameSite?: 'strict' | 'lax' | 'none';
|
|
1018
1018
|
}
|
|
1019
1019
|
|
|
1020
1020
|
/**
|
|
1021
1021
|
* Response metadata that handlers can set
|
|
1022
1022
|
*/
|
|
1023
1023
|
export interface ResponseMetadata {
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1024
|
+
headers?: Record<string, string>;
|
|
1025
|
+
cookies?: Map<string, { value: string; options?: CookieOptions }>;
|
|
1026
|
+
status?: SuccessStatus;
|
|
1027
1027
|
}
|
|
1028
1028
|
|
|
1029
1029
|
/**
|
|
1030
1030
|
* Return type for handlers that want to set response metadata
|
|
1031
1031
|
*/
|
|
1032
1032
|
export interface ResponseWithMetadata<T> {
|
|
1033
|
-
|
|
1034
|
-
|
|
1033
|
+
data: T;
|
|
1034
|
+
metadata: ResponseMetadata;
|
|
1035
1035
|
}
|
|
1036
1036
|
|
|
1037
1037
|
/**
|
|
1038
1038
|
* Response builder for fluent API in handlers
|
|
1039
1039
|
*/
|
|
1040
1040
|
export class ResponseBuilder {
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1041
|
+
private metadata: ResponseMetadata = {
|
|
1042
|
+
headers: {},
|
|
1043
|
+
cookies: new Map(),
|
|
1044
|
+
};
|
|
1045
|
+
|
|
1046
|
+
header(key: string, value: string): this {
|
|
1047
|
+
this.metadata.headers![key] = value;
|
|
1048
|
+
return this;
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
cookie(name: string, value: string, options?: CookieOptions): this {
|
|
1052
|
+
this.metadata.cookies?.set(name, { value, options });
|
|
1053
|
+
return this;
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
deleteCookie(
|
|
1057
|
+
name: string,
|
|
1058
|
+
options?: Pick<CookieOptions, 'domain' | 'path'>,
|
|
1059
|
+
): this {
|
|
1060
|
+
this.metadata.cookies?.set(name, {
|
|
1061
|
+
value: '',
|
|
1062
|
+
options: { ...options, maxAge: 0, expires: new Date(0) },
|
|
1063
|
+
});
|
|
1064
|
+
return this;
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
status(code: SuccessStatus): this {
|
|
1068
|
+
this.metadata.status = code;
|
|
1069
|
+
return this;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
send<T>(data: T): ResponseWithMetadata<T> {
|
|
1073
|
+
return { data, metadata: this.metadata };
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
getMetadata(): ResponseMetadata {
|
|
1077
|
+
return this.metadata;
|
|
1078
|
+
}
|
|
1079
1079
|
}
|
|
1080
1080
|
|
|
1081
1081
|
/**
|
|
1082
1082
|
* Base context properties that are always available
|
|
1083
1083
|
*/
|
|
1084
1084
|
type BaseEndpointContext<
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1085
|
+
TServices extends Service[] = [],
|
|
1086
|
+
TLogger extends Logger = Logger,
|
|
1087
|
+
TSession = unknown,
|
|
1088
1088
|
> = {
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1089
|
+
/** Injected service instances */
|
|
1090
|
+
services: ServiceRecord<TServices>;
|
|
1091
|
+
/** Logger instance for this request */
|
|
1092
|
+
logger: TLogger;
|
|
1093
|
+
/** Function to retrieve request headers */
|
|
1094
|
+
header: HeaderFn;
|
|
1095
|
+
/** Function to retrieve request cookies */
|
|
1096
|
+
cookie: CookieFn;
|
|
1097
|
+
/** Session data extracted by getSession */
|
|
1098
|
+
session: TSession;
|
|
1099
1099
|
};
|
|
1100
1100
|
|
|
1101
1101
|
/**
|
|
1102
1102
|
* Conditional auditor context - only present when audit storage is configured
|
|
1103
1103
|
*/
|
|
1104
1104
|
type AuditorContext<
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1105
|
+
TAuditAction extends AuditableAction<string, unknown> = AuditableAction<
|
|
1106
|
+
string,
|
|
1107
|
+
unknown
|
|
1108
|
+
>,
|
|
1109
|
+
TAuditStorage = undefined,
|
|
1110
1110
|
> = TAuditStorage extends undefined
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1111
|
+
? {}
|
|
1112
|
+
: {
|
|
1113
|
+
/**
|
|
1114
|
+
* Auditor instance for recording audit events.
|
|
1115
|
+
* Only present when audit storage is configured on the endpoint.
|
|
1116
|
+
* When a transactional database is used for audit storage,
|
|
1117
|
+
* the auditor is pre-configured with the transaction context.
|
|
1118
|
+
*/
|
|
1119
|
+
auditor: Auditor<TAuditAction>;
|
|
1120
|
+
};
|
|
1121
1121
|
|
|
1122
1122
|
/**
|
|
1123
1123
|
* Conditional database context - only present when database service is configured
|
|
1124
1124
|
*/
|
|
1125
1125
|
type DatabaseContext<TDatabase = undefined> = TDatabase extends undefined
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1126
|
+
? {}
|
|
1127
|
+
: {
|
|
1128
|
+
/**
|
|
1129
|
+
* Database instance for this request.
|
|
1130
|
+
* When audit storage is configured and uses the same database,
|
|
1131
|
+
* this will be the transaction for ACID compliance.
|
|
1132
|
+
* Otherwise, it's the raw database connection.
|
|
1133
|
+
*/
|
|
1134
|
+
db: TDatabase;
|
|
1135
|
+
};
|
|
1136
1136
|
|
|
1137
1137
|
/**
|
|
1138
1138
|
* The execution context provided to endpoint handlers.
|
|
@@ -1147,20 +1147,20 @@ type DatabaseContext<TDatabase = undefined> = TDatabase extends undefined
|
|
|
1147
1147
|
* @template TAuditStorage - Audit storage type (determines if auditor is present)
|
|
1148
1148
|
*/
|
|
1149
1149
|
export type EndpointContext<
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1150
|
+
Input extends EndpointSchemas | undefined = undefined,
|
|
1151
|
+
TServices extends Service[] = [],
|
|
1152
|
+
TLogger extends Logger = Logger,
|
|
1153
|
+
TSession = unknown,
|
|
1154
|
+
TAuditAction extends AuditableAction<string, unknown> = AuditableAction<
|
|
1155
|
+
string,
|
|
1156
|
+
unknown
|
|
1157
|
+
>,
|
|
1158
|
+
TDatabase = undefined,
|
|
1159
|
+
TAuditStorage = undefined,
|
|
1160
1160
|
> = BaseEndpointContext<TServices, TLogger, TSession> &
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1161
|
+
InferComposableStandardSchema<Input> &
|
|
1162
|
+
AuditorContext<TAuditAction, TAuditStorage> &
|
|
1163
|
+
DatabaseContext<TDatabase>;
|
|
1164
1164
|
|
|
1165
1165
|
/**
|
|
1166
1166
|
* Handler function type for endpoint implementations.
|
|
@@ -1192,80 +1192,64 @@ export type EndpointContext<
|
|
|
1192
1192
|
* ```
|
|
1193
1193
|
*/
|
|
1194
1194
|
export type EndpointHandler<
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1195
|
+
TInput extends EndpointSchemas | undefined = undefined,
|
|
1196
|
+
TServices extends Service[] = [],
|
|
1197
|
+
TLogger extends Logger = Logger,
|
|
1198
|
+
OutSchema extends StandardSchemaV1 | undefined = undefined,
|
|
1199
|
+
TSession = unknown,
|
|
1200
|
+
TDatabase = undefined,
|
|
1201
|
+
TAuditStorage = undefined,
|
|
1202
|
+
TAuditAction extends AuditableAction<string, unknown> = AuditableAction<
|
|
1203
|
+
string,
|
|
1204
|
+
unknown
|
|
1205
|
+
>,
|
|
1206
1206
|
> = (
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1207
|
+
ctx: EndpointContext<
|
|
1208
|
+
TInput,
|
|
1209
|
+
TServices,
|
|
1210
|
+
TLogger,
|
|
1211
|
+
TSession,
|
|
1212
|
+
TAuditAction,
|
|
1213
|
+
TDatabase,
|
|
1214
|
+
TAuditStorage
|
|
1215
|
+
>,
|
|
1216
|
+
response: ResponseBuilder,
|
|
1217
1217
|
) => OutSchema extends StandardSchemaV1
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1218
|
+
?
|
|
1219
|
+
| InferStandardSchema<OutSchema>
|
|
1220
|
+
| ResponseWithMetadata<InferStandardSchema<OutSchema>>
|
|
1221
|
+
| Promise<InferStandardSchema<OutSchema>>
|
|
1222
|
+
| Promise<ResponseWithMetadata<InferStandardSchema<OutSchema>>>
|
|
1223
|
+
:
|
|
1224
|
+
| unknown
|
|
1225
|
+
| ResponseWithMetadata<unknown>
|
|
1226
|
+
| Promise<unknown>
|
|
1227
|
+
| Promise<ResponseWithMetadata<unknown>>;
|
|
1228
1228
|
|
|
1229
1229
|
/**
|
|
1230
1230
|
* HTTP success status codes that can be returned by endpoints.
|
|
1231
1231
|
*/
|
|
1232
1232
|
export enum SuccessStatus {
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1233
|
+
/** Standard response for successful HTTP requests */
|
|
1234
|
+
OK = 200,
|
|
1235
|
+
/** Request has been fulfilled and resulted in a new resource being created */
|
|
1236
|
+
Created = 201,
|
|
1237
|
+
/** Request has been accepted for processing, but processing is not complete */
|
|
1238
|
+
Accepted = 202,
|
|
1239
|
+
/** Server successfully processed the request but is not returning any content */
|
|
1240
|
+
NoContent = 204,
|
|
1241
|
+
/** Server successfully processed the request and is not returning any content, client should reset the document view */
|
|
1242
|
+
ResetContent = 205,
|
|
1243
|
+
/** Server is delivering only part of the resource due to a range header */
|
|
1244
|
+
PartialContent = 206,
|
|
1245
1245
|
}
|
|
1246
1246
|
|
|
1247
|
-
export type EndpointOutput<T> =
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
>
|
|
1257
|
-
? InferStandardSchema<OutSchema>
|
|
1258
|
-
: never;
|
|
1259
|
-
|
|
1260
|
-
export type EndpointEvent<T> = T extends Endpoint<
|
|
1261
|
-
any,
|
|
1262
|
-
any,
|
|
1263
|
-
any,
|
|
1264
|
-
any,
|
|
1265
|
-
any,
|
|
1266
|
-
any,
|
|
1267
|
-
any,
|
|
1268
|
-
infer TEventPublisher
|
|
1269
|
-
>
|
|
1270
|
-
? ExtractPublisherMessage<TEventPublisher>
|
|
1271
|
-
: never;
|
|
1247
|
+
export type EndpointOutput<T> =
|
|
1248
|
+
T extends Endpoint<any, any, any, infer OutSchema, any, any, any, any>
|
|
1249
|
+
? InferStandardSchema<OutSchema>
|
|
1250
|
+
: never;
|
|
1251
|
+
|
|
1252
|
+
export type EndpointEvent<T> =
|
|
1253
|
+
T extends Endpoint<any, any, any, any, any, any, any, infer TEventPublisher>
|
|
1254
|
+
? ExtractPublisherMessage<TEventPublisher>
|
|
1255
|
+
: never;
|