@geekmidas/constructs 0.0.7 → 0.0.10
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-CANc3Qo2.d.mts → AWSLambdaFunction-D5V3YVqv.d.cts} +5 -5
- package/dist/{AWSLambdaFunction-DWIZYsCy.mjs → AWSLambdaFunction-D_V-ZQmS.mjs} +3 -3
- package/dist/{AWSLambdaFunction-DWIZYsCy.mjs.map → AWSLambdaFunction-D_V-ZQmS.mjs.map} +1 -1
- package/dist/{AWSLambdaFunction-qA5LqPsv.cjs → AWSLambdaFunction-DhUb-Vs6.cjs} +3 -3
- package/dist/{AWSLambdaFunction-qA5LqPsv.cjs.map → AWSLambdaFunction-DhUb-Vs6.cjs.map} +1 -1
- package/dist/{AWSLambdaFunction-CwagvPG3.d.cts → AWSLambdaFunction-DvZcnL8a.d.mts} +5 -5
- package/dist/{AWSLambdaSubscriberAdaptor-QKVxR6qh.d.cts → AWSLambdaSubscriberAdaptor-D6kjKjSf.d.mts} +4 -4
- package/dist/{AWSLambdaSubscriberAdaptor-C6JYIZxn.d.mts → AWSLambdaSubscriberAdaptor-J_pSz6pu.d.cts} +4 -4
- package/dist/{AmazonApiGatewayEndpointAdaptor-BrB3RfbI.d.mts → AmazonApiGatewayEndpointAdaptor-B7MKo8h3.d.mts} +3 -3
- package/dist/{AmazonApiGatewayEndpointAdaptor-BFhJ2Rpz.d.cts → AmazonApiGatewayEndpointAdaptor-BnNd8tCz.d.cts} +2 -2
- package/dist/{AmazonApiGatewayEndpointAdaptor-B8mozTcG.cjs → AmazonApiGatewayEndpointAdaptor-DHBF_5jn.cjs} +2 -2
- package/dist/{AmazonApiGatewayEndpointAdaptor-B8mozTcG.cjs.map → AmazonApiGatewayEndpointAdaptor-DHBF_5jn.cjs.map} +1 -1
- package/dist/{AmazonApiGatewayEndpointAdaptor-Bmz6Cy1e.mjs → AmazonApiGatewayEndpointAdaptor-DHcUetbw.mjs} +2 -2
- package/dist/{AmazonApiGatewayEndpointAdaptor-Bmz6Cy1e.mjs.map → AmazonApiGatewayEndpointAdaptor-DHcUetbw.mjs.map} +1 -1
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-Bd-o8ese.d.cts → AmazonApiGatewayV1EndpointAdaptor-BC-a2tt3.d.cts} +3 -3
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-D4eZ-fx5.cjs → AmazonApiGatewayV1EndpointAdaptor-CmUxFoPx.cjs} +2 -2
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-D4eZ-fx5.cjs.map → AmazonApiGatewayV1EndpointAdaptor-CmUxFoPx.cjs.map} +1 -1
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-24g3dLn5.mjs → AmazonApiGatewayV1EndpointAdaptor-CsV6zyvn.mjs} +2 -2
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-24g3dLn5.mjs.map → AmazonApiGatewayV1EndpointAdaptor-CsV6zyvn.mjs.map} +1 -1
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-BtNXt0-4.d.mts → AmazonApiGatewayV1EndpointAdaptor-gO9OxdZl.d.mts} +4 -4
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-DAJdtgek.d.mts → AmazonApiGatewayV2EndpointAdaptor-D1uz4wNg.d.mts} +4 -4
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-Cc40RThv.mjs → AmazonApiGatewayV2EndpointAdaptor-_bFcbEa-.mjs} +2 -2
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-Cc40RThv.mjs.map → AmazonApiGatewayV2EndpointAdaptor-_bFcbEa-.mjs.map} +1 -1
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-J6tACl-N.cjs → AmazonApiGatewayV2EndpointAdaptor-cZbaqiUi.cjs} +2 -2
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-J6tACl-N.cjs.map → AmazonApiGatewayV2EndpointAdaptor-cZbaqiUi.cjs.map} +1 -1
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-DX-Uci5w.d.cts → AmazonApiGatewayV2EndpointAdaptor-zNFUPxSY.d.cts} +3 -3
- package/dist/Authorizer-Bbk9ziuG.d.mts +29 -0
- package/dist/Authorizer-iXsSB600.d.cts +29 -0
- package/dist/{BaseFunctionBuilder-DtO4Nwxm.cjs → BaseFunctionBuilder-BmsbV0BU.cjs} +2 -2
- package/dist/{BaseFunctionBuilder-DtO4Nwxm.cjs.map → BaseFunctionBuilder-BmsbV0BU.cjs.map} +1 -1
- package/dist/{BaseFunctionBuilder-5QCHkchp.d.cts → BaseFunctionBuilder-C4ZJPkIZ.d.cts} +2 -2
- package/dist/{BaseFunctionBuilder-Dda7AiID.d.mts → BaseFunctionBuilder-CxBX0arJ.d.mts} +2 -2
- package/dist/{BaseFunctionBuilder-BPE9JBbT.mjs → BaseFunctionBuilder-DCUtCdVL.mjs} +2 -2
- package/dist/{BaseFunctionBuilder-BPE9JBbT.mjs.map → BaseFunctionBuilder-DCUtCdVL.mjs.map} +1 -1
- package/dist/{Construct-BbKCIPQm.mjs → Construct-C3hsQBy4.mjs} +10 -13
- package/dist/Construct-C3hsQBy4.mjs.map +1 -0
- package/dist/{Construct-BSEs6uwW.cjs → Construct-VEI7M3fs.cjs} +10 -13
- package/dist/Construct-VEI7M3fs.cjs.map +1 -0
- package/dist/{Construct-Bm-PSO2V.d.cts → Construct-ci5u8Xnu.d.cts} +4 -2
- package/dist/{Construct-DdyYENBD.d.mts → Construct-zhmcmIdY.d.mts} +4 -2
- package/dist/Construct.cjs +1 -1
- package/dist/Construct.d.cts +1 -1
- package/dist/Construct.d.mts +1 -1
- package/dist/Construct.mjs +1 -1
- package/dist/{Cron-BxMXmn4t.d.cts → Cron-ByNYsQDH.d.mts} +4 -4
- package/dist/{Cron-CmZ6esMM.cjs → Cron-Dfgr8F9d.cjs} +5 -5
- package/dist/Cron-Dfgr8F9d.cjs.map +1 -0
- package/dist/{Cron-NDBlJhb3.d.mts → Cron-DkPL-Fms.d.cts} +4 -4
- package/dist/{Cron-D6hnZLk7.mjs → Cron-wP6Ob48_.mjs} +5 -5
- package/dist/Cron-wP6Ob48_.mjs.map +1 -0
- package/dist/{CronBuilder-C6K5AbIO.d.cts → CronBuilder-BknVTWLE.d.mts} +6 -5
- package/dist/{CronBuilder-s5x8V8hH.d.mts → CronBuilder-BqTTozUi.d.cts} +6 -5
- package/dist/{CronBuilder-Dfv5JguE.mjs → CronBuilder-C27c5oqh.mjs} +10 -5
- package/dist/CronBuilder-C27c5oqh.mjs.map +1 -0
- package/dist/{CronBuilder-Di7QK8Rt.cjs → CronBuilder-W1ZqCJ7m.cjs} +10 -5
- package/dist/CronBuilder-W1ZqCJ7m.cjs.map +1 -0
- package/dist/{Endpoint-COGAflGh.cjs → Endpoint-BjpQmTek.cjs} +21 -12
- package/dist/Endpoint-BjpQmTek.cjs.map +1 -0
- package/dist/{Endpoint-C7jPJzAH.d.mts → Endpoint-C16whGI-.d.mts} +45 -13
- package/dist/{Endpoint-DLLZvqoh.mjs → Endpoint-C98BwZjA.mjs} +21 -12
- package/dist/Endpoint-C98BwZjA.mjs.map +1 -0
- package/dist/{Endpoint-XUMNAXYy.d.cts → Endpoint-zHPjZ35J.d.cts} +45 -13
- package/dist/{EndpointBuilder-t6fVEKBH.d.cts → EndpointBuilder-B5l7zQU1.d.cts} +18 -12
- package/dist/{EndpointBuilder-CFtWQhcv.d.mts → EndpointBuilder-BzqR0xvt.d.mts} +18 -12
- package/dist/{EndpointBuilder-oXO_ka1-.mjs → EndpointBuilder-CCUx4vep.mjs} +28 -5
- package/dist/EndpointBuilder-CCUx4vep.mjs.map +1 -0
- package/dist/{EndpointBuilder-FJktpPOu.cjs → EndpointBuilder-D2Zu8i9b.cjs} +28 -5
- package/dist/EndpointBuilder-D2Zu8i9b.cjs.map +1 -0
- package/dist/{EndpointFactory-Kk1tpifs.cjs → EndpointFactory-C4YhgXOc.cjs} +41 -10
- package/dist/EndpointFactory-C4YhgXOc.cjs.map +1 -0
- package/dist/{EndpointFactory-DBRGrXAy.d.mts → EndpointFactory-KkyIOE62.d.cts} +29 -21
- package/dist/{EndpointFactory-eG8bDhOh.mjs → EndpointFactory-RAb2zcw0.mjs} +41 -10
- package/dist/EndpointFactory-RAb2zcw0.mjs.map +1 -0
- package/dist/{EndpointFactory-DInjHvFR.d.cts → EndpointFactory-VnSAdwdv.d.mts} +29 -21
- package/dist/{Function-CbO2NZx-.cjs → Function-1Fh6Tdkg.cjs} +4 -5
- package/dist/Function-1Fh6Tdkg.cjs.map +1 -0
- package/dist/{Function-BP58p9Mp.d.cts → Function-BbLYIKLL.d.cts} +3 -4
- package/dist/{Function-C5mW-38v.mjs → Function-D-QEfH7k.mjs} +4 -5
- package/dist/Function-D-QEfH7k.mjs.map +1 -0
- package/dist/{Function-C98H68DW.d.mts → Function-DFRZZCC-.d.mts} +3 -4
- package/dist/{FunctionBuilder-CosgPmMl.mjs → FunctionBuilder-Bxyr1Pf9.mjs} +11 -5
- package/dist/FunctionBuilder-Bxyr1Pf9.mjs.map +1 -0
- package/dist/{FunctionBuilder-DuOeWCAl.cjs → FunctionBuilder-DcEFYgbn.cjs} +11 -5
- package/dist/FunctionBuilder-DcEFYgbn.cjs.map +1 -0
- package/dist/{FunctionBuilder-BS1KgxA_.d.cts → FunctionBuilder-DdGjpiFT.d.cts} +6 -4
- package/dist/{FunctionBuilder-DBwR7jg7.d.mts → FunctionBuilder-DuktGyZc.d.mts} +6 -4
- package/dist/{FunctionExecutionWrapper-XGrSAAPD.mjs → FunctionExecutionWrapper-BL6PE6Dv.mjs} +2 -2
- package/dist/{FunctionExecutionWrapper-XGrSAAPD.mjs.map → FunctionExecutionWrapper-BL6PE6Dv.mjs.map} +1 -1
- package/dist/{FunctionExecutionWrapper-B0V7V8YS.d.mts → FunctionExecutionWrapper-CRYi047B.d.cts} +4 -4
- package/dist/{FunctionExecutionWrapper-Bx-Dl-2a.d.cts → FunctionExecutionWrapper-DaR-dSLw.d.mts} +4 -4
- package/dist/{FunctionExecutionWrapper-CElXEjPe.cjs → FunctionExecutionWrapper-Ee-CE8Fz.cjs} +2 -2
- package/dist/{FunctionExecutionWrapper-CElXEjPe.cjs.map → FunctionExecutionWrapper-Ee-CE8Fz.cjs.map} +1 -1
- package/dist/{HonoEndpointAdaptor-BrbM9vxd.d.cts → HonoEndpointAdaptor-CY1mXTe6.d.mts} +7 -6
- package/dist/{HonoEndpointAdaptor-CxcYKdzT.d.mts → HonoEndpointAdaptor-CYvrXBe-.d.cts} +9 -8
- package/dist/{HonoEndpointAdaptor-BlT1rWHV.mjs → HonoEndpointAdaptor-CyVPl4w2.mjs} +33 -16
- package/dist/HonoEndpointAdaptor-CyVPl4w2.mjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-Ds433Q8w.cjs → HonoEndpointAdaptor-DcvZdYzx.cjs} +20 -3
- package/dist/HonoEndpointAdaptor-DcvZdYzx.cjs.map +1 -0
- package/dist/{Subscriber-CSt7EOlT.cjs → Subscriber-BL30GpWp.cjs} +2 -2
- package/dist/{Subscriber-CSt7EOlT.cjs.map → Subscriber-BL30GpWp.cjs.map} +1 -1
- package/dist/{Subscriber-DkCDcTUL.mjs → Subscriber-CTczVFsF.mjs} +2 -2
- package/dist/{Subscriber-DkCDcTUL.mjs.map → Subscriber-CTczVFsF.mjs.map} +1 -1
- package/dist/{Subscriber-BoFm12i_.d.cts → Subscriber-Cy28j8MS.d.cts} +2 -2
- package/dist/{Subscriber-BxH6n8zQ.d.mts → Subscriber-g3IWM1_d.d.mts} +2 -2
- package/dist/{SubscriberBuilder-BpSDPzBz.d.mts → SubscriberBuilder-BzK8kc2a.d.cts} +3 -3
- package/dist/{SubscriberBuilder-Bn9Hyi28.mjs → SubscriberBuilder-CekL3BoP.mjs} +2 -2
- package/dist/{SubscriberBuilder-Bn9Hyi28.mjs.map → SubscriberBuilder-CekL3BoP.mjs.map} +1 -1
- package/dist/{SubscriberBuilder-RsiOmnwq.cjs → SubscriberBuilder-D1hojYLa.cjs} +2 -2
- package/dist/{SubscriberBuilder-RsiOmnwq.cjs.map → SubscriberBuilder-D1hojYLa.cjs.map} +1 -1
- package/dist/{SubscriberBuilder-DgljKtYu.d.cts → SubscriberBuilder-YjQ7qIpQ.d.mts} +3 -3
- package/dist/{TestEndpointAdaptor-Ct4I-gDo.mjs → TestEndpointAdaptor-B4z9G5Ap.mjs} +3 -3
- package/dist/{TestEndpointAdaptor-Ct4I-gDo.mjs.map → TestEndpointAdaptor-B4z9G5Ap.mjs.map} +1 -1
- package/dist/{TestEndpointAdaptor-FJUob2W_.cjs → TestEndpointAdaptor-C-ahwGW6.cjs} +3 -3
- package/dist/{TestEndpointAdaptor-FJUob2W_.cjs.map → TestEndpointAdaptor-C-ahwGW6.cjs.map} +1 -1
- package/dist/{TestEndpointAdaptor-vboVyJ0w.d.mts → TestEndpointAdaptor-DGWuai69.d.mts} +2 -2
- package/dist/{TestEndpointAdaptor-wwEaVHAt.d.cts → TestEndpointAdaptor-uXliWYjS.d.cts} +2 -2
- package/dist/adaptors/aws.cjs +11 -11
- package/dist/adaptors/aws.d.cts +14 -13
- package/dist/adaptors/aws.d.mts +14 -13
- package/dist/adaptors/aws.mjs +11 -11
- package/dist/adaptors/hono.cjs +8 -8
- package/dist/adaptors/hono.d.cts +8 -7
- package/dist/adaptors/hono.d.mts +8 -7
- package/dist/adaptors/hono.mjs +8 -8
- package/dist/adaptors/testing.cjs +7 -7
- package/dist/adaptors/testing.d.cts +8 -7
- package/dist/adaptors/testing.d.mts +8 -7
- package/dist/adaptors/testing.mjs +7 -7
- package/dist/crons/Cron.cjs +6 -6
- package/dist/crons/Cron.d.cts +6 -6
- package/dist/crons/Cron.d.mts +6 -6
- package/dist/crons/Cron.mjs +6 -6
- package/dist/crons/CronBuilder.cjs +7 -7
- package/dist/crons/CronBuilder.d.cts +7 -7
- package/dist/crons/CronBuilder.d.mts +7 -7
- package/dist/crons/CronBuilder.mjs +7 -7
- package/dist/crons/index.cjs +7 -7
- package/dist/crons/index.d.cts +11 -11
- package/dist/crons/index.d.mts +11 -11
- package/dist/crons/index.mjs +7 -7
- package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.cjs +7 -7
- package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.d.cts +8 -7
- package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.d.mts +8 -7
- package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.mjs +7 -7
- package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.cjs +8 -8
- package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.d.cts +9 -8
- package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.d.mts +9 -8
- package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.mjs +8 -8
- package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.cjs +8 -8
- package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.d.cts +9 -8
- package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.d.mts +9 -8
- package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.mjs +8 -8
- package/dist/endpoints/Authorizer.cjs +15 -0
- package/dist/endpoints/Authorizer.cjs.map +1 -0
- package/dist/endpoints/Authorizer.d.cts +2 -0
- package/dist/endpoints/Authorizer.d.mts +2 -0
- package/dist/endpoints/Authorizer.mjs +14 -0
- package/dist/endpoints/Authorizer.mjs.map +1 -0
- package/dist/endpoints/Endpoint.cjs +6 -6
- package/dist/endpoints/Endpoint.d.cts +7 -6
- package/dist/endpoints/Endpoint.d.mts +7 -6
- package/dist/endpoints/Endpoint.mjs +6 -6
- package/dist/endpoints/EndpointBuilder.cjs +7 -7
- package/dist/endpoints/EndpointBuilder.d.cts +8 -7
- package/dist/endpoints/EndpointBuilder.d.mts +8 -7
- package/dist/endpoints/EndpointBuilder.mjs +7 -7
- package/dist/endpoints/EndpointFactory.cjs +8 -8
- package/dist/endpoints/EndpointFactory.d.cts +9 -8
- package/dist/endpoints/EndpointFactory.d.mts +9 -8
- package/dist/endpoints/EndpointFactory.mjs +8 -8
- package/dist/endpoints/HonoEndpointAdaptor.cjs +8 -8
- package/dist/endpoints/HonoEndpointAdaptor.d.cts +8 -7
- package/dist/endpoints/HonoEndpointAdaptor.d.mts +8 -7
- package/dist/endpoints/HonoEndpointAdaptor.mjs +8 -8
- package/dist/endpoints/TestEndpointAdaptor.cjs +7 -7
- package/dist/endpoints/TestEndpointAdaptor.d.cts +8 -7
- package/dist/endpoints/TestEndpointAdaptor.d.mts +8 -7
- package/dist/endpoints/TestEndpointAdaptor.mjs +7 -7
- package/dist/endpoints/helpers.cjs +7 -7
- package/dist/endpoints/helpers.d.cts +7 -6
- package/dist/endpoints/helpers.d.mts +7 -6
- package/dist/endpoints/helpers.mjs +7 -7
- package/dist/endpoints/index.cjs +8 -8
- package/dist/endpoints/index.d.cts +11 -10
- package/dist/endpoints/index.d.mts +11 -10
- package/dist/endpoints/index.mjs +8 -8
- 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 +5 -5
- package/dist/functions/TestFunctionAdaptor.d.cts +2 -2
- package/dist/functions/TestFunctionAdaptor.d.mts +2 -2
- package/dist/functions/TestFunctionAdaptor.mjs +5 -5
- 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-DVDb5wEA.cjs → functions-BtgBiuC_.cjs} +2 -2
- package/dist/{functions-DVDb5wEA.cjs.map → functions-BtgBiuC_.cjs.map} +1 -1
- package/dist/functions-DD-00sWF.mjs +8 -0
- package/dist/{functions-mM-jcphA.mjs.map → functions-DD-00sWF.mjs.map} +1 -1
- package/dist/{helpers-CM0U-4Vk.mjs → helpers-DtPeOhUV.mjs} +2 -2
- package/dist/{helpers-CM0U-4Vk.mjs.map → helpers-DtPeOhUV.mjs.map} +1 -1
- package/dist/{helpers-go4jiRvV.cjs → helpers-QM_FSjPY.cjs} +2 -2
- package/dist/{helpers-go4jiRvV.cjs.map → helpers-QM_FSjPY.cjs.map} +1 -1
- package/dist/index-CcmV3PKF.d.cts +9 -0
- package/dist/index-DQt3pQtF.d.mts +9 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/publisher.d.cts +1 -1
- package/dist/publisher.d.mts +1 -1
- package/dist/subscribers/AWSLambdaSubscriberAdaptor.d.cts +3 -3
- package/dist/subscribers/AWSLambdaSubscriberAdaptor.d.mts +3 -3
- package/dist/subscribers/Subscriber.cjs +2 -2
- package/dist/subscribers/Subscriber.d.cts +2 -2
- package/dist/subscribers/Subscriber.d.mts +2 -2
- package/dist/subscribers/Subscriber.mjs +2 -2
- package/dist/subscribers/SubscriberBuilder.cjs +3 -3
- package/dist/subscribers/SubscriberBuilder.d.cts +3 -3
- package/dist/subscribers/SubscriberBuilder.d.mts +3 -3
- package/dist/subscribers/SubscriberBuilder.mjs +3 -3
- package/dist/subscribers/index.cjs +3 -3
- package/dist/subscribers/index.d.cts +5 -5
- package/dist/subscribers/index.d.mts +5 -5
- package/dist/subscribers/index.mjs +3 -3
- package/package.json +6 -6
- package/src/Construct.ts +11 -24
- package/src/crons/Cron.ts +2 -0
- package/src/crons/CronBuilder.ts +8 -0
- package/src/crons/__tests__/CronBuilder.state-isolation.spec.ts +227 -0
- package/src/endpoints/Authorizer.ts +34 -0
- package/src/endpoints/Endpoint.ts +67 -14
- package/src/endpoints/EndpointBuilder.ts +79 -12
- package/src/endpoints/EndpointFactory.ts +106 -27
- package/src/endpoints/HonoEndpointAdaptor.ts +29 -0
- package/src/endpoints/__tests__/Endpoint.cookies.spec.ts +85 -0
- package/src/endpoints/__tests__/Endpoint.headers.spec.ts +187 -0
- package/src/endpoints/__tests__/Endpoint.manifest.spec.ts +176 -0
- package/src/endpoints/__tests__/EndpointFactory.authorizers.spec.ts +259 -0
- package/src/endpoints/__tests__/EndpointFactory.reference-audit.spec.ts +190 -0
- package/src/endpoints/__tests__/EndpointFactory.state-isolation.spec.ts +155 -0
- package/src/functions/Function.ts +12 -2
- package/src/functions/FunctionBuilder.ts +9 -0
- package/src/functions/__tests__/FunctionBuilder.state-isolation.spec.ts +160 -0
- package/dist/Construct-BSEs6uwW.cjs.map +0 -1
- package/dist/Construct-BbKCIPQm.mjs.map +0 -1
- package/dist/Cron-CmZ6esMM.cjs.map +0 -1
- package/dist/Cron-D6hnZLk7.mjs.map +0 -1
- package/dist/CronBuilder-Dfv5JguE.mjs.map +0 -1
- package/dist/CronBuilder-Di7QK8Rt.cjs.map +0 -1
- package/dist/Endpoint-COGAflGh.cjs.map +0 -1
- package/dist/Endpoint-DLLZvqoh.mjs.map +0 -1
- package/dist/EndpointBuilder-FJktpPOu.cjs.map +0 -1
- package/dist/EndpointBuilder-oXO_ka1-.mjs.map +0 -1
- package/dist/EndpointFactory-Kk1tpifs.cjs.map +0 -1
- package/dist/EndpointFactory-eG8bDhOh.mjs.map +0 -1
- package/dist/Function-C5mW-38v.mjs.map +0 -1
- package/dist/Function-CbO2NZx-.cjs.map +0 -1
- package/dist/FunctionBuilder-CosgPmMl.mjs.map +0 -1
- package/dist/FunctionBuilder-DuOeWCAl.cjs.map +0 -1
- package/dist/HonoEndpointAdaptor-BlT1rWHV.mjs.map +0 -1
- package/dist/HonoEndpointAdaptor-Ds433Q8w.cjs.map +0 -1
- package/dist/functions-mM-jcphA.mjs +0 -8
- package/dist/index-BGr5gFrX.d.cts +0 -9
- package/dist/index-YM4W9XUq.d.mts +0 -9
|
@@ -2,6 +2,7 @@ import type { Logger } from '@geekmidas/logger';
|
|
|
2
2
|
import { ConsoleLogger } from '@geekmidas/logger/console';
|
|
3
3
|
import type { Service } from '@geekmidas/services';
|
|
4
4
|
import uniqBy from 'lodash.uniqby';
|
|
5
|
+
import type { Authorizer } from './Authorizer';
|
|
5
6
|
import type { AuthorizeFn, SessionFn } from './Endpoint';
|
|
6
7
|
import { EndpointBuilder } from './EndpointBuilder';
|
|
7
8
|
|
|
@@ -17,6 +18,7 @@ export class EndpointFactory<
|
|
|
17
18
|
TSession = unknown,
|
|
18
19
|
TEventPublisher extends EventPublisher<any> | undefined = undefined,
|
|
19
20
|
TEventPublisherServiceName extends string = string,
|
|
21
|
+
TAuthorizers extends readonly string[] = readonly string[],
|
|
20
22
|
> {
|
|
21
23
|
// @ts-ignore
|
|
22
24
|
private defaultServices: TServices;
|
|
@@ -27,6 +29,8 @@ export class EndpointFactory<
|
|
|
27
29
|
| undefined;
|
|
28
30
|
private defaultSessionExtractor?: SessionFn<TServices, TLogger, TSession>;
|
|
29
31
|
private defaultLogger: TLogger = DEFAULT_LOGGER;
|
|
32
|
+
private availableAuthorizers: Authorizer[] = [];
|
|
33
|
+
private defaultAuthorizerName?: TAuthorizers[number];
|
|
30
34
|
|
|
31
35
|
constructor({
|
|
32
36
|
basePath,
|
|
@@ -36,13 +40,16 @@ export class EndpointFactory<
|
|
|
36
40
|
// @ts-ignore
|
|
37
41
|
defaultServices = [] as TServices,
|
|
38
42
|
defaultEventPublisher,
|
|
43
|
+
availableAuthorizers = [],
|
|
44
|
+
defaultAuthorizerName,
|
|
39
45
|
}: EndpointFactoryOptions<
|
|
40
46
|
TServices,
|
|
41
47
|
TBasePath,
|
|
42
48
|
TLogger,
|
|
43
49
|
TSession,
|
|
44
50
|
TEventPublisher,
|
|
45
|
-
TEventPublisherServiceName
|
|
51
|
+
TEventPublisherServiceName,
|
|
52
|
+
TAuthorizers
|
|
46
53
|
> = {}) {
|
|
47
54
|
// Initialize default services
|
|
48
55
|
this.defaultServices = uniqBy(
|
|
@@ -55,6 +62,8 @@ export class EndpointFactory<
|
|
|
55
62
|
this.defaultLogger = defaultLogger || (DEFAULT_LOGGER as TLogger);
|
|
56
63
|
this.defaultSessionExtractor = defaultSessionExtractor;
|
|
57
64
|
this.defaultEventPublisher = defaultEventPublisher;
|
|
65
|
+
this.availableAuthorizers = availableAuthorizers;
|
|
66
|
+
this.defaultAuthorizerName = defaultAuthorizerName;
|
|
58
67
|
}
|
|
59
68
|
|
|
60
69
|
static joinPaths<TBasePath extends string, P extends string>(
|
|
@@ -94,6 +103,41 @@ export class EndpointFactory<
|
|
|
94
103
|
return result as JoinPaths<TBasePath, P>;
|
|
95
104
|
}
|
|
96
105
|
|
|
106
|
+
// Configure available authorizers
|
|
107
|
+
authorizers<const T extends readonly string[]>(
|
|
108
|
+
authorizers: T,
|
|
109
|
+
): EndpointFactory<
|
|
110
|
+
TServices,
|
|
111
|
+
TBasePath,
|
|
112
|
+
TLogger,
|
|
113
|
+
TSession,
|
|
114
|
+
TEventPublisher,
|
|
115
|
+
TEventPublisherServiceName,
|
|
116
|
+
T
|
|
117
|
+
> {
|
|
118
|
+
const authorizerConfigs = authorizers.map((name) => ({
|
|
119
|
+
name,
|
|
120
|
+
}));
|
|
121
|
+
return new EndpointFactory<
|
|
122
|
+
TServices,
|
|
123
|
+
TBasePath,
|
|
124
|
+
TLogger,
|
|
125
|
+
TSession,
|
|
126
|
+
TEventPublisher,
|
|
127
|
+
TEventPublisherServiceName,
|
|
128
|
+
T
|
|
129
|
+
>({
|
|
130
|
+
defaultServices: this.defaultServices,
|
|
131
|
+
basePath: this.basePath,
|
|
132
|
+
defaultAuthorizeFn: this.defaultAuthorizeFn,
|
|
133
|
+
defaultLogger: this.defaultLogger,
|
|
134
|
+
defaultSessionExtractor: this.defaultSessionExtractor,
|
|
135
|
+
defaultEventPublisher: this.defaultEventPublisher,
|
|
136
|
+
availableAuthorizers: authorizerConfigs,
|
|
137
|
+
defaultAuthorizerName: this.defaultAuthorizerName,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
97
141
|
// Create a sub-router with a path prefix
|
|
98
142
|
route<TPath extends string>(
|
|
99
143
|
path: TPath,
|
|
@@ -103,7 +147,8 @@ export class EndpointFactory<
|
|
|
103
147
|
TLogger,
|
|
104
148
|
TSession,
|
|
105
149
|
TEventPublisher,
|
|
106
|
-
TEventPublisherServiceName
|
|
150
|
+
TEventPublisherServiceName,
|
|
151
|
+
TAuthorizers
|
|
107
152
|
> {
|
|
108
153
|
const newBasePath = EndpointFactory.joinPaths(path, this.basePath);
|
|
109
154
|
return new EndpointFactory<
|
|
@@ -112,7 +157,8 @@ export class EndpointFactory<
|
|
|
112
157
|
TLogger,
|
|
113
158
|
TSession,
|
|
114
159
|
TEventPublisher,
|
|
115
|
-
TEventPublisherServiceName
|
|
160
|
+
TEventPublisherServiceName,
|
|
161
|
+
TAuthorizers
|
|
116
162
|
>({
|
|
117
163
|
defaultServices: this.defaultServices,
|
|
118
164
|
basePath: newBasePath,
|
|
@@ -120,6 +166,8 @@ export class EndpointFactory<
|
|
|
120
166
|
defaultLogger: this.defaultLogger,
|
|
121
167
|
defaultSessionExtractor: this.defaultSessionExtractor,
|
|
122
168
|
defaultEventPublisher: this.defaultEventPublisher,
|
|
169
|
+
availableAuthorizers: this.availableAuthorizers,
|
|
170
|
+
defaultAuthorizerName: this.defaultAuthorizerName,
|
|
123
171
|
});
|
|
124
172
|
}
|
|
125
173
|
|
|
@@ -132,7 +180,8 @@ export class EndpointFactory<
|
|
|
132
180
|
TLogger,
|
|
133
181
|
TSession,
|
|
134
182
|
TEventPublisher,
|
|
135
|
-
TEventPublisherServiceName
|
|
183
|
+
TEventPublisherServiceName,
|
|
184
|
+
TAuthorizers
|
|
136
185
|
> {
|
|
137
186
|
return new EndpointFactory<
|
|
138
187
|
TServices,
|
|
@@ -140,7 +189,8 @@ export class EndpointFactory<
|
|
|
140
189
|
TLogger,
|
|
141
190
|
TSession,
|
|
142
191
|
TEventPublisher,
|
|
143
|
-
TEventPublisherServiceName
|
|
192
|
+
TEventPublisherServiceName,
|
|
193
|
+
TAuthorizers
|
|
144
194
|
>({
|
|
145
195
|
defaultServices: this.defaultServices,
|
|
146
196
|
basePath: this.basePath,
|
|
@@ -148,6 +198,8 @@ export class EndpointFactory<
|
|
|
148
198
|
defaultLogger: this.defaultLogger,
|
|
149
199
|
defaultSessionExtractor: this.defaultSessionExtractor,
|
|
150
200
|
defaultEventPublisher: this.defaultEventPublisher,
|
|
201
|
+
availableAuthorizers: this.availableAuthorizers,
|
|
202
|
+
defaultAuthorizerName: this.defaultAuthorizerName,
|
|
151
203
|
});
|
|
152
204
|
}
|
|
153
205
|
|
|
@@ -160,7 +212,8 @@ export class EndpointFactory<
|
|
|
160
212
|
TLogger,
|
|
161
213
|
TSession,
|
|
162
214
|
TEventPublisher,
|
|
163
|
-
TEventPublisherServiceName
|
|
215
|
+
TEventPublisherServiceName,
|
|
216
|
+
TAuthorizers
|
|
164
217
|
> {
|
|
165
218
|
return new EndpointFactory<
|
|
166
219
|
[...S, ...TServices],
|
|
@@ -168,7 +221,8 @@ export class EndpointFactory<
|
|
|
168
221
|
TLogger,
|
|
169
222
|
TSession,
|
|
170
223
|
TEventPublisher,
|
|
171
|
-
TEventPublisherServiceName
|
|
224
|
+
TEventPublisherServiceName,
|
|
225
|
+
TAuthorizers
|
|
172
226
|
>({
|
|
173
227
|
defaultServices: [...services, ...this.defaultServices],
|
|
174
228
|
basePath: this.basePath,
|
|
@@ -176,6 +230,8 @@ export class EndpointFactory<
|
|
|
176
230
|
defaultLogger: this.defaultLogger,
|
|
177
231
|
defaultSessionExtractor: this.defaultSessionExtractor,
|
|
178
232
|
defaultEventPublisher: this.defaultEventPublisher,
|
|
233
|
+
availableAuthorizers: this.availableAuthorizers,
|
|
234
|
+
defaultAuthorizerName: this.defaultAuthorizerName,
|
|
179
235
|
});
|
|
180
236
|
}
|
|
181
237
|
|
|
@@ -187,7 +243,8 @@ export class EndpointFactory<
|
|
|
187
243
|
L,
|
|
188
244
|
TSession,
|
|
189
245
|
TEventPublisher,
|
|
190
|
-
TEventPublisherServiceName
|
|
246
|
+
TEventPublisherServiceName,
|
|
247
|
+
TAuthorizers
|
|
191
248
|
> {
|
|
192
249
|
return new EndpointFactory<
|
|
193
250
|
TServices,
|
|
@@ -195,7 +252,8 @@ export class EndpointFactory<
|
|
|
195
252
|
L,
|
|
196
253
|
TSession,
|
|
197
254
|
TEventPublisher,
|
|
198
|
-
TEventPublisherServiceName
|
|
255
|
+
TEventPublisherServiceName,
|
|
256
|
+
TAuthorizers
|
|
199
257
|
>({
|
|
200
258
|
defaultServices: this.defaultServices,
|
|
201
259
|
basePath: this.basePath,
|
|
@@ -208,6 +266,8 @@ export class EndpointFactory<
|
|
|
208
266
|
defaultSessionExtractor: this
|
|
209
267
|
.defaultSessionExtractor as unknown as SessionFn<TServices, L, TSession>,
|
|
210
268
|
defaultEventPublisher: this.defaultEventPublisher,
|
|
269
|
+
availableAuthorizers: this.availableAuthorizers,
|
|
270
|
+
defaultAuthorizerName: this.defaultAuthorizerName,
|
|
211
271
|
});
|
|
212
272
|
}
|
|
213
273
|
|
|
@@ -216,14 +276,23 @@ export class EndpointFactory<
|
|
|
216
276
|
TServiceName extends string = string,
|
|
217
277
|
>(
|
|
218
278
|
publisher: Service<TServiceName, T>,
|
|
219
|
-
): EndpointFactory<
|
|
279
|
+
): EndpointFactory<
|
|
280
|
+
TServices,
|
|
281
|
+
TBasePath,
|
|
282
|
+
TLogger,
|
|
283
|
+
TSession,
|
|
284
|
+
T,
|
|
285
|
+
TServiceName,
|
|
286
|
+
TAuthorizers
|
|
287
|
+
> {
|
|
220
288
|
return new EndpointFactory<
|
|
221
289
|
TServices,
|
|
222
290
|
TBasePath,
|
|
223
291
|
TLogger,
|
|
224
292
|
TSession,
|
|
225
293
|
T,
|
|
226
|
-
TServiceName
|
|
294
|
+
TServiceName,
|
|
295
|
+
TAuthorizers
|
|
227
296
|
>({
|
|
228
297
|
defaultServices: this.defaultServices,
|
|
229
298
|
basePath: this.basePath,
|
|
@@ -231,6 +300,8 @@ export class EndpointFactory<
|
|
|
231
300
|
defaultLogger: this.defaultLogger,
|
|
232
301
|
defaultSessionExtractor: this.defaultSessionExtractor,
|
|
233
302
|
defaultEventPublisher: publisher,
|
|
303
|
+
availableAuthorizers: this.availableAuthorizers,
|
|
304
|
+
defaultAuthorizerName: this.defaultAuthorizerName,
|
|
234
305
|
});
|
|
235
306
|
}
|
|
236
307
|
|
|
@@ -242,7 +313,8 @@ export class EndpointFactory<
|
|
|
242
313
|
TLogger,
|
|
243
314
|
T,
|
|
244
315
|
TEventPublisher,
|
|
245
|
-
TEventPublisherServiceName
|
|
316
|
+
TEventPublisherServiceName,
|
|
317
|
+
TAuthorizers
|
|
246
318
|
> {
|
|
247
319
|
return new EndpointFactory<
|
|
248
320
|
TServices,
|
|
@@ -250,7 +322,8 @@ export class EndpointFactory<
|
|
|
250
322
|
TLogger,
|
|
251
323
|
T,
|
|
252
324
|
TEventPublisher,
|
|
253
|
-
TEventPublisherServiceName
|
|
325
|
+
TEventPublisherServiceName,
|
|
326
|
+
TAuthorizers
|
|
254
327
|
>({
|
|
255
328
|
defaultServices: this.defaultServices,
|
|
256
329
|
basePath: this.basePath,
|
|
@@ -262,6 +335,8 @@ export class EndpointFactory<
|
|
|
262
335
|
defaultLogger: this.defaultLogger,
|
|
263
336
|
defaultSessionExtractor: session,
|
|
264
337
|
defaultEventPublisher: this.defaultEventPublisher,
|
|
338
|
+
availableAuthorizers: this.availableAuthorizers,
|
|
339
|
+
defaultAuthorizerName: this.defaultAuthorizerName,
|
|
265
340
|
});
|
|
266
341
|
}
|
|
267
342
|
|
|
@@ -276,7 +351,9 @@ export class EndpointFactory<
|
|
|
276
351
|
TLogger,
|
|
277
352
|
undefined,
|
|
278
353
|
TSession,
|
|
279
|
-
TEventPublisher
|
|
354
|
+
TEventPublisher,
|
|
355
|
+
TEventPublisherServiceName,
|
|
356
|
+
TAuthorizers
|
|
280
357
|
> {
|
|
281
358
|
const fullPath = EndpointFactory.joinPaths(path, this.basePath);
|
|
282
359
|
const builder = new EndpointBuilder<
|
|
@@ -287,7 +364,9 @@ export class EndpointFactory<
|
|
|
287
364
|
TLogger,
|
|
288
365
|
undefined,
|
|
289
366
|
TSession,
|
|
290
|
-
TEventPublisher
|
|
367
|
+
TEventPublisher,
|
|
368
|
+
TEventPublisherServiceName,
|
|
369
|
+
TAuthorizers
|
|
291
370
|
>(fullPath, method);
|
|
292
371
|
|
|
293
372
|
if (this.defaultAuthorizeFn) {
|
|
@@ -295,7 +374,8 @@ export class EndpointFactory<
|
|
|
295
374
|
builder._authorize = this.defaultAuthorizeFn;
|
|
296
375
|
}
|
|
297
376
|
if (this.defaultServices.length) {
|
|
298
|
-
|
|
377
|
+
// Create a copy to avoid sharing references between builders
|
|
378
|
+
builder._services = [...this.defaultServices] as TServices;
|
|
299
379
|
}
|
|
300
380
|
|
|
301
381
|
if (this.defaultLogger) {
|
|
@@ -314,17 +394,13 @@ export class EndpointFactory<
|
|
|
314
394
|
builder._setPublisher(this.defaultEventPublisher);
|
|
315
395
|
}
|
|
316
396
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
TSession,
|
|
325
|
-
TEventPublisher,
|
|
326
|
-
TEventPublisherServiceName
|
|
327
|
-
>;
|
|
397
|
+
// Set available authorizers and default
|
|
398
|
+
builder._availableAuthorizers = this.availableAuthorizers;
|
|
399
|
+
if (this.defaultAuthorizerName) {
|
|
400
|
+
builder._authorizerName = this.defaultAuthorizerName;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
return builder;
|
|
328
404
|
}
|
|
329
405
|
|
|
330
406
|
post<TPath extends string>(path: TPath) {
|
|
@@ -386,6 +462,7 @@ export interface EndpointFactoryOptions<
|
|
|
386
462
|
TSession = unknown,
|
|
387
463
|
TEventPublisher extends EventPublisher<any> | undefined = undefined,
|
|
388
464
|
TEventPublisherServiceName extends string = string,
|
|
465
|
+
TAuthorizers extends readonly string[] = readonly string[],
|
|
389
466
|
> {
|
|
390
467
|
defaultServices?: TServices;
|
|
391
468
|
basePath?: TBasePath;
|
|
@@ -394,6 +471,8 @@ export interface EndpointFactoryOptions<
|
|
|
394
471
|
defaultSessionExtractor?: SessionFn<TServices, TLogger, TSession>;
|
|
395
472
|
defaultEventPublisher?: Service<TEventPublisherServiceName, TEventPublisher>;
|
|
396
473
|
defaultEvents?: MappedEvent<TEventPublisher, undefined>[];
|
|
474
|
+
availableAuthorizers?: Authorizer[];
|
|
475
|
+
defaultAuthorizerName?: TAuthorizers[number];
|
|
397
476
|
}
|
|
398
477
|
|
|
399
478
|
export const e = new EndpointFactory();
|
|
@@ -5,6 +5,8 @@ import { checkRateLimit, getRateLimitHeaders } from '@geekmidas/rate-limit';
|
|
|
5
5
|
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
6
6
|
import { type Context, Hono } from 'hono';
|
|
7
7
|
import { setCookie } from 'hono/cookie';
|
|
8
|
+
import { logger as honoLogger } from 'hono/logger';
|
|
9
|
+
import { timing } from 'hono/timing';
|
|
8
10
|
import { validator } from 'hono/validator';
|
|
9
11
|
import type { HttpMethod, LowerHttpMethod } from '../types';
|
|
10
12
|
import {
|
|
@@ -65,6 +67,8 @@ export class HonoEndpoint<
|
|
|
65
67
|
>,
|
|
66
68
|
) {}
|
|
67
69
|
|
|
70
|
+
static isDev = process.env.NODE_ENV === 'development';
|
|
71
|
+
|
|
68
72
|
static async validate<T extends StandardSchemaV1>(
|
|
69
73
|
c: Context<any, string, {}>,
|
|
70
74
|
data: unknown,
|
|
@@ -150,6 +154,15 @@ export class HonoEndpoint<
|
|
|
150
154
|
app: Hono,
|
|
151
155
|
options?: HonoEndpointOptions,
|
|
152
156
|
): void {
|
|
157
|
+
// Add timing middleware (always enabled)
|
|
158
|
+
app.use('*', timing());
|
|
159
|
+
|
|
160
|
+
// Add logger middleware in development mode
|
|
161
|
+
|
|
162
|
+
if (HonoEndpoint.isDev) {
|
|
163
|
+
app.use('*', honoLogger());
|
|
164
|
+
}
|
|
165
|
+
|
|
153
166
|
// Add docs route if not disabled
|
|
154
167
|
const docsPath =
|
|
155
168
|
options?.docsPath !== false ? options?.docsPath || '/docs' : null;
|
|
@@ -353,6 +366,10 @@ export class HonoEndpoint<
|
|
|
353
366
|
// @ts-ignore
|
|
354
367
|
c.set('__logger', logger);
|
|
355
368
|
|
|
369
|
+
if (HonoEndpoint.isDev) {
|
|
370
|
+
logger.info({ status, body: output }, 'Outgoing response');
|
|
371
|
+
}
|
|
372
|
+
|
|
356
373
|
return c.json(output, status);
|
|
357
374
|
} catch (validationError: any) {
|
|
358
375
|
logger.error(validationError, 'Output validation failed');
|
|
@@ -361,11 +378,23 @@ export class HonoEndpoint<
|
|
|
361
378
|
422,
|
|
362
379
|
'Response validation failed',
|
|
363
380
|
);
|
|
381
|
+
if (HonoEndpoint.isDev) {
|
|
382
|
+
logger.info(
|
|
383
|
+
{ status: error.statusCode, body: error },
|
|
384
|
+
'Outgoing response',
|
|
385
|
+
);
|
|
386
|
+
}
|
|
364
387
|
return c.json(error, error.statusCode as ContentfulStatusCode);
|
|
365
388
|
}
|
|
366
389
|
} catch (e: any) {
|
|
367
390
|
logger.error(e, 'Error processing endpoint request');
|
|
368
391
|
const error = wrapError(e, 500, 'Internal Server Error');
|
|
392
|
+
if (HonoEndpoint.isDev) {
|
|
393
|
+
logger.info(
|
|
394
|
+
{ status: error.statusCode, body: error },
|
|
395
|
+
'Outgoing response',
|
|
396
|
+
);
|
|
397
|
+
}
|
|
369
398
|
return c.json(error, error.statusCode as ContentfulStatusCode);
|
|
370
399
|
}
|
|
371
400
|
},
|
|
@@ -117,4 +117,89 @@ describe('Endpoint.createCookies', () => {
|
|
|
117
117
|
expect(cookieFn('_ga')).toBe('GA1.2.123456789.1234567890');
|
|
118
118
|
expect(cookieFn('authenticated')).toBe('true');
|
|
119
119
|
});
|
|
120
|
+
|
|
121
|
+
describe('cookie() - get all cookies', () => {
|
|
122
|
+
it('should return all cookies as object when called without arguments', () => {
|
|
123
|
+
const cookieFn = Endpoint.createCookies(
|
|
124
|
+
'session=abc123; theme=dark; lang=en',
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
const allCookies = cookieFn();
|
|
128
|
+
|
|
129
|
+
expect(allCookies).toEqual({
|
|
130
|
+
session: 'abc123',
|
|
131
|
+
theme: 'dark',
|
|
132
|
+
lang: 'en',
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
it('should return empty object when no cookies exist', () => {
|
|
137
|
+
const cookieFn = Endpoint.createCookies(undefined);
|
|
138
|
+
|
|
139
|
+
const allCookies = cookieFn();
|
|
140
|
+
|
|
141
|
+
expect(allCookies).toEqual({});
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it('should return empty object for empty cookie string', () => {
|
|
145
|
+
const cookieFn = Endpoint.createCookies('');
|
|
146
|
+
|
|
147
|
+
const allCookies = cookieFn();
|
|
148
|
+
|
|
149
|
+
expect(allCookies).toEqual({});
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
it('should decode URL-encoded values in all cookies', () => {
|
|
153
|
+
const cookieFn = Endpoint.createCookies(
|
|
154
|
+
'user=John%20Doe; email=john%40example.com',
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
const allCookies = cookieFn();
|
|
158
|
+
|
|
159
|
+
expect(allCookies).toEqual({
|
|
160
|
+
user: 'John Doe',
|
|
161
|
+
email: 'john@example.com',
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
it('should preserve case in cookie names when getting all', () => {
|
|
166
|
+
const cookieFn = Endpoint.createCookies('Session=abc; session=xyz; TOKEN=123');
|
|
167
|
+
|
|
168
|
+
const allCookies = cookieFn();
|
|
169
|
+
|
|
170
|
+
expect(allCookies).toEqual({
|
|
171
|
+
Session: 'abc',
|
|
172
|
+
session: 'xyz',
|
|
173
|
+
TOKEN: '123',
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
it('should handle cookies with equals sign in values', () => {
|
|
178
|
+
const cookieFn = Endpoint.createCookies(
|
|
179
|
+
'data=key=value; token=abc=123=xyz',
|
|
180
|
+
);
|
|
181
|
+
|
|
182
|
+
const allCookies = cookieFn();
|
|
183
|
+
|
|
184
|
+
expect(allCookies).toEqual({
|
|
185
|
+
data: 'key=value',
|
|
186
|
+
token: 'abc=123=xyz',
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
it('should work with complex real-world cookie string', () => {
|
|
191
|
+
const cookieFn = Endpoint.createCookies(
|
|
192
|
+
'session=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9; user_id=12345; preferences=%7B%22theme%22%3A%22dark%22%7D; authenticated=true',
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
const allCookies = cookieFn();
|
|
196
|
+
|
|
197
|
+
expect(allCookies).toEqual({
|
|
198
|
+
session: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
|
|
199
|
+
user_id: '12345',
|
|
200
|
+
preferences: '{"theme":"dark"}',
|
|
201
|
+
authenticated: 'true',
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
});
|
|
120
205
|
});
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { Endpoint } from '../Endpoint';
|
|
3
|
+
|
|
4
|
+
describe('Endpoint.createHeaders', () => {
|
|
5
|
+
it('should get single header value', () => {
|
|
6
|
+
const headerFn = Endpoint.createHeaders({
|
|
7
|
+
'Content-Type': 'application/json',
|
|
8
|
+
Host: 'example.com',
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
expect(headerFn('content-type')).toBe('application/json');
|
|
12
|
+
expect(headerFn('host')).toBe('example.com');
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('should be case-insensitive for header names', () => {
|
|
16
|
+
const headerFn = Endpoint.createHeaders({
|
|
17
|
+
'Content-Type': 'application/json',
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
expect(headerFn('content-type')).toBe('application/json');
|
|
21
|
+
expect(headerFn('Content-Type')).toBe('application/json');
|
|
22
|
+
expect(headerFn('CONTENT-TYPE')).toBe('application/json');
|
|
23
|
+
expect(headerFn('CoNtEnT-tYpE')).toBe('application/json');
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('should return undefined for non-existent header', () => {
|
|
27
|
+
const headerFn = Endpoint.createHeaders({
|
|
28
|
+
'Content-Type': 'application/json',
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
expect(headerFn('Authorization')).toBeUndefined();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('should handle empty headers object', () => {
|
|
35
|
+
const headerFn = Endpoint.createHeaders({});
|
|
36
|
+
|
|
37
|
+
expect(headerFn('Content-Type')).toBeUndefined();
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('should handle headers with special characters', () => {
|
|
41
|
+
const headerFn = Endpoint.createHeaders({
|
|
42
|
+
'X-Custom-Header': 'value-with-dashes',
|
|
43
|
+
'X-Request-ID': '12345-67890-abcdef',
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
expect(headerFn('x-custom-header')).toBe('value-with-dashes');
|
|
47
|
+
expect(headerFn('X-REQUEST-ID')).toBe('12345-67890-abcdef');
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('should handle standard HTTP headers', () => {
|
|
51
|
+
const headerFn = Endpoint.createHeaders({
|
|
52
|
+
'Content-Type': 'application/json',
|
|
53
|
+
'Content-Length': '1234',
|
|
54
|
+
Authorization: 'Bearer token123',
|
|
55
|
+
'User-Agent': 'Mozilla/5.0',
|
|
56
|
+
Accept: 'application/json',
|
|
57
|
+
'Accept-Language': 'en-US,en;q=0.9',
|
|
58
|
+
'Cache-Control': 'no-cache',
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
expect(headerFn('content-type')).toBe('application/json');
|
|
62
|
+
expect(headerFn('content-length')).toBe('1234');
|
|
63
|
+
expect(headerFn('authorization')).toBe('Bearer token123');
|
|
64
|
+
expect(headerFn('user-agent')).toBe('Mozilla/5.0');
|
|
65
|
+
expect(headerFn('accept')).toBe('application/json');
|
|
66
|
+
expect(headerFn('accept-language')).toBe('en-US,en;q=0.9');
|
|
67
|
+
expect(headerFn('cache-control')).toBe('no-cache');
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('should handle forwarded headers', () => {
|
|
71
|
+
const headerFn = Endpoint.createHeaders({
|
|
72
|
+
'X-Forwarded-For': '203.0.113.1',
|
|
73
|
+
'X-Forwarded-Proto': 'https',
|
|
74
|
+
'X-Real-IP': '203.0.113.1',
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
expect(headerFn('x-forwarded-for')).toBe('203.0.113.1');
|
|
78
|
+
expect(headerFn('x-forwarded-proto')).toBe('https');
|
|
79
|
+
expect(headerFn('x-real-ip')).toBe('203.0.113.1');
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
describe('header() - get all headers', () => {
|
|
83
|
+
it('should return all headers as object when called without arguments', () => {
|
|
84
|
+
const headerFn = Endpoint.createHeaders({
|
|
85
|
+
'Content-Type': 'application/json',
|
|
86
|
+
Host: 'example.com',
|
|
87
|
+
Authorization: 'Bearer token123',
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
const allHeaders = headerFn();
|
|
91
|
+
|
|
92
|
+
expect(allHeaders).toEqual({
|
|
93
|
+
'content-type': 'application/json',
|
|
94
|
+
host: 'example.com',
|
|
95
|
+
authorization: 'Bearer token123',
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('should return empty object when no headers exist', () => {
|
|
100
|
+
const headerFn = Endpoint.createHeaders({});
|
|
101
|
+
|
|
102
|
+
const allHeaders = headerFn();
|
|
103
|
+
|
|
104
|
+
expect(allHeaders).toEqual({});
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it('should normalize all header names to lowercase', () => {
|
|
108
|
+
const headerFn = Endpoint.createHeaders({
|
|
109
|
+
'Content-Type': 'application/json',
|
|
110
|
+
HOST: 'example.com',
|
|
111
|
+
'X-Custom-Header': 'value',
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
const allHeaders = headerFn();
|
|
115
|
+
|
|
116
|
+
expect(allHeaders).toEqual({
|
|
117
|
+
'content-type': 'application/json',
|
|
118
|
+
host: 'example.com',
|
|
119
|
+
'x-custom-header': 'value',
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it('should work with standard HTTP headers', () => {
|
|
124
|
+
const headerFn = Endpoint.createHeaders({
|
|
125
|
+
'Content-Type': 'application/json',
|
|
126
|
+
'Content-Length': '1234',
|
|
127
|
+
Authorization: 'Bearer token123',
|
|
128
|
+
'User-Agent': 'Mozilla/5.0',
|
|
129
|
+
Accept: 'application/json',
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
const allHeaders = headerFn();
|
|
133
|
+
|
|
134
|
+
expect(allHeaders).toEqual({
|
|
135
|
+
'content-type': 'application/json',
|
|
136
|
+
'content-length': '1234',
|
|
137
|
+
authorization: 'Bearer token123',
|
|
138
|
+
'user-agent': 'Mozilla/5.0',
|
|
139
|
+
accept: 'application/json',
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
it('should work with custom and forwarded headers', () => {
|
|
144
|
+
const headerFn = Endpoint.createHeaders({
|
|
145
|
+
'X-Forwarded-For': '203.0.113.1',
|
|
146
|
+
'X-Forwarded-Proto': 'https',
|
|
147
|
+
'X-Request-ID': 'req-123',
|
|
148
|
+
'X-Custom-Header': 'custom-value',
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
const allHeaders = headerFn();
|
|
152
|
+
|
|
153
|
+
expect(allHeaders).toEqual({
|
|
154
|
+
'x-forwarded-for': '203.0.113.1',
|
|
155
|
+
'x-forwarded-proto': 'https',
|
|
156
|
+
'x-request-id': 'req-123',
|
|
157
|
+
'x-custom-header': 'custom-value',
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
it('should handle complex real-world headers', () => {
|
|
162
|
+
const headerFn = Endpoint.createHeaders({
|
|
163
|
+
'Content-Type': 'application/json; charset=utf-8',
|
|
164
|
+
Host: 'api.example.com',
|
|
165
|
+
Connection: 'keep-alive',
|
|
166
|
+
'User-Agent':
|
|
167
|
+
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
|
|
168
|
+
Accept: '*/*',
|
|
169
|
+
'Accept-Encoding': 'gzip, deflate, br',
|
|
170
|
+
'Accept-Language': 'en-US,en;q=0.9',
|
|
171
|
+
Authorization: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
|
|
172
|
+
'Cache-Control': 'no-cache',
|
|
173
|
+
Origin: 'https://example.com',
|
|
174
|
+
Referer: 'https://example.com/dashboard',
|
|
175
|
+
'X-Requested-With': 'XMLHttpRequest',
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
const allHeaders = headerFn();
|
|
179
|
+
|
|
180
|
+
expect(allHeaders).toHaveProperty('content-type');
|
|
181
|
+
expect(allHeaders).toHaveProperty('host');
|
|
182
|
+
expect(allHeaders).toHaveProperty('authorization');
|
|
183
|
+
expect(allHeaders).toHaveProperty('user-agent');
|
|
184
|
+
expect(Object.keys(allHeaders).length).toBe(12);
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
});
|