@geekmidas/constructs 0.0.6 → 0.0.9
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-qA5LqPsv.cjs → AWSLambdaFunction-CMLZ3GaC.cjs} +3 -3
- package/dist/{AWSLambdaFunction-qA5LqPsv.cjs.map → AWSLambdaFunction-CMLZ3GaC.cjs.map} +1 -1
- package/dist/{AWSLambdaFunction-CANc3Qo2.d.mts → AWSLambdaFunction-D5V3YVqv.d.cts} +5 -5
- package/dist/{AWSLambdaFunction-CwagvPG3.d.cts → AWSLambdaFunction-_J0MjixY.d.mts} +5 -5
- package/dist/{AWSLambdaFunction-DWIZYsCy.mjs → AWSLambdaFunction-egVcP17n.mjs} +3 -3
- package/dist/{AWSLambdaFunction-DWIZYsCy.mjs.map → AWSLambdaFunction-egVcP17n.mjs.map} +1 -1
- package/dist/{AWSLambdaSubscriberAdaptor-QKVxR6qh.d.cts → AWSLambdaSubscriberAdaptor-DjG1ME3P.d.mts} +4 -4
- package/dist/{AWSLambdaSubscriberAdaptor-C6JYIZxn.d.mts → AWSLambdaSubscriberAdaptor-J_pSz6pu.d.cts} +4 -4
- package/dist/{AmazonApiGatewayEndpointAdaptor-BFhJ2Rpz.d.cts → AmazonApiGatewayEndpointAdaptor-BnNd8tCz.d.cts} +2 -2
- package/dist/{AmazonApiGatewayEndpointAdaptor-BrB3RfbI.d.mts → AmazonApiGatewayEndpointAdaptor-C-17dUai.d.mts} +2 -2
- package/dist/{AmazonApiGatewayEndpointAdaptor-Bmz6Cy1e.mjs → AmazonApiGatewayEndpointAdaptor-CQLjGSJe.mjs} +2 -2
- package/dist/{AmazonApiGatewayEndpointAdaptor-Bmz6Cy1e.mjs.map → AmazonApiGatewayEndpointAdaptor-CQLjGSJe.mjs.map} +1 -1
- package/dist/{AmazonApiGatewayEndpointAdaptor-B8mozTcG.cjs → AmazonApiGatewayEndpointAdaptor-DPaV_5wG.cjs} +2 -2
- package/dist/{AmazonApiGatewayEndpointAdaptor-B8mozTcG.cjs.map → AmazonApiGatewayEndpointAdaptor-DPaV_5wG.cjs.map} +1 -1
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-Bd-o8ese.d.cts → AmazonApiGatewayV1EndpointAdaptor-BC-a2tt3.d.cts} +3 -3
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-BtNXt0-4.d.mts → AmazonApiGatewayV1EndpointAdaptor-Cjud-a6p.d.mts} +3 -3
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-24g3dLn5.mjs → AmazonApiGatewayV1EndpointAdaptor-DEBcyZe0.mjs} +2 -2
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-24g3dLn5.mjs.map → AmazonApiGatewayV1EndpointAdaptor-DEBcyZe0.mjs.map} +1 -1
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-D4eZ-fx5.cjs → AmazonApiGatewayV1EndpointAdaptor-DkFcSRwT.cjs} +2 -2
- package/dist/{AmazonApiGatewayV1EndpointAdaptor-D4eZ-fx5.cjs.map → AmazonApiGatewayV1EndpointAdaptor-DkFcSRwT.cjs.map} +1 -1
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-Cc40RThv.mjs → AmazonApiGatewayV2EndpointAdaptor-BB7t7LE2.mjs} +2 -2
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-Cc40RThv.mjs.map → AmazonApiGatewayV2EndpointAdaptor-BB7t7LE2.mjs.map} +1 -1
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-J6tACl-N.cjs → AmazonApiGatewayV2EndpointAdaptor-BQ21ry6s.cjs} +2 -2
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-J6tACl-N.cjs.map → AmazonApiGatewayV2EndpointAdaptor-BQ21ry6s.cjs.map} +1 -1
- package/dist/{AmazonApiGatewayV2EndpointAdaptor-DAJdtgek.d.mts → AmazonApiGatewayV2EndpointAdaptor-C31Xcwmc.d.mts} +3 -3
- 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-B-kdtkzI.cjs} +2 -2
- package/dist/{BaseFunctionBuilder-DtO4Nwxm.cjs.map → BaseFunctionBuilder-B-kdtkzI.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-DOhEn5Ce.mjs} +2 -2
- package/dist/{BaseFunctionBuilder-BPE9JBbT.mjs.map → BaseFunctionBuilder-DOhEn5Ce.mjs.map} +1 -1
- package/dist/{Construct-BbKCIPQm.mjs → Construct-B-O9OBS1.mjs} +4 -2
- package/dist/Construct-B-O9OBS1.mjs.map +1 -0
- package/dist/{Construct-BSEs6uwW.cjs → Construct-BtfN2fcm.cjs} +4 -2
- package/dist/Construct-BtfN2fcm.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-z0RiwSnT.mjs → Cron-D8DPUXBd.mjs} +5 -5
- package/dist/Cron-D8DPUXBd.mjs.map +1 -0
- package/dist/{Cron-NDBlJhb3.d.mts → Cron-DkPL-Fms.d.cts} +4 -4
- package/dist/{Cron-D6MyCqby.cjs → Cron-sOrsPuQj.cjs} +5 -5
- package/dist/Cron-sOrsPuQj.cjs.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-BLTgwOWp.mjs → CronBuilder-ChyrDobL.mjs} +10 -5
- package/dist/CronBuilder-ChyrDobL.mjs.map +1 -0
- package/dist/{CronBuilder-BOsYnZIm.cjs → CronBuilder-Kvz1GiUp.cjs} +10 -5
- package/dist/CronBuilder-Kvz1GiUp.cjs.map +1 -0
- package/dist/{Endpoint-COGAflGh.cjs → Endpoint-Bghj0fiL.cjs} +21 -12
- package/dist/Endpoint-Bghj0fiL.cjs.map +1 -0
- package/dist/{Endpoint-C7jPJzAH.d.mts → Endpoint-C16whGI-.d.mts} +45 -13
- package/dist/{Endpoint-DLLZvqoh.mjs → Endpoint-DCJz2VQ_.mjs} +21 -12
- package/dist/Endpoint-DCJz2VQ_.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-DpmUw--c.mjs → EndpointBuilder-B6xIAruu.mjs} +28 -5
- package/dist/EndpointBuilder-B6xIAruu.mjs.map +1 -0
- package/dist/{EndpointBuilder-CFtWQhcv.d.mts → EndpointBuilder-BzqR0xvt.d.mts} +18 -12
- package/dist/{EndpointBuilder-DUE8ETVR.cjs → EndpointBuilder-i7-4ieP_.cjs} +28 -5
- package/dist/EndpointBuilder-i7-4ieP_.cjs.map +1 -0
- package/dist/{EndpointFactory-YAR24M2i.cjs → EndpointFactory-CYTBPu_G.cjs} +41 -10
- package/dist/EndpointFactory-CYTBPu_G.cjs.map +1 -0
- package/dist/{EndpointFactory-CuJUCyvZ.mjs → EndpointFactory-CYuT-nt-.mjs} +41 -10
- package/dist/EndpointFactory-CYuT-nt-.mjs.map +1 -0
- package/dist/{EndpointFactory-DInjHvFR.d.cts → EndpointFactory-KkyIOE62.d.cts} +28 -20
- package/dist/{EndpointFactory-DBRGrXAy.d.mts → EndpointFactory-VnSAdwdv.d.mts} +28 -20
- package/dist/{Function-CbO2NZx-.cjs → Function-BCEAZFyL.cjs} +4 -5
- package/dist/Function-BCEAZFyL.cjs.map +1 -0
- package/dist/{Function-BP58p9Mp.d.cts → Function-BbLYIKLL.d.cts} +3 -4
- package/dist/{Function-C5mW-38v.mjs → Function-CmfMIDoS.mjs} +4 -5
- package/dist/Function-CmfMIDoS.mjs.map +1 -0
- package/dist/{Function-C98H68DW.d.mts → Function-DFRZZCC-.d.mts} +3 -4
- package/dist/{FunctionBuilder-DuOeWCAl.cjs → FunctionBuilder-BqivB_cc.cjs} +11 -5
- package/dist/FunctionBuilder-BqivB_cc.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/{FunctionBuilder-CosgPmMl.mjs → FunctionBuilder-QvqvEyFa.mjs} +11 -5
- package/dist/FunctionBuilder-QvqvEyFa.mjs.map +1 -0
- package/dist/{FunctionExecutionWrapper-B0V7V8YS.d.mts → FunctionExecutionWrapper-CAHR74yI.d.mts} +2 -2
- package/dist/{FunctionExecutionWrapper-Bx-Dl-2a.d.cts → FunctionExecutionWrapper-CRYi047B.d.cts} +2 -2
- package/dist/{FunctionExecutionWrapper-XGrSAAPD.mjs → FunctionExecutionWrapper-JsZIHhcl.mjs} +2 -2
- package/dist/{FunctionExecutionWrapper-XGrSAAPD.mjs.map → FunctionExecutionWrapper-JsZIHhcl.mjs.map} +1 -1
- package/dist/{FunctionExecutionWrapper-CElXEjPe.cjs → FunctionExecutionWrapper-TJxf9p4v.cjs} +2 -2
- package/dist/{FunctionExecutionWrapper-CElXEjPe.cjs.map → FunctionExecutionWrapper-TJxf9p4v.cjs.map} +1 -1
- package/dist/{HonoEndpointAdaptor-BlT1rWHV.mjs → HonoEndpointAdaptor-8eYrSFRn.mjs} +33 -16
- package/dist/HonoEndpointAdaptor-8eYrSFRn.mjs.map +1 -0
- package/dist/{HonoEndpointAdaptor-C9Xe2pRp.d.mts → HonoEndpointAdaptor-DAsZoX2a.d.mts} +5 -4
- package/dist/{HonoEndpointAdaptor-CGSqpnCD.d.cts → HonoEndpointAdaptor-lYw6EN1Q.d.cts} +5 -4
- package/dist/{HonoEndpointAdaptor-Ds433Q8w.cjs → HonoEndpointAdaptor-vWSpXdNp.cjs} +20 -3
- package/dist/HonoEndpointAdaptor-vWSpXdNp.cjs.map +1 -0
- package/dist/{Subscriber-G7EUI3yc.cjs → Subscriber-BdiqU7da.cjs} +2 -2
- package/dist/{Subscriber-G7EUI3yc.cjs.map → Subscriber-BdiqU7da.cjs.map} +1 -1
- package/dist/{Subscriber-BoFm12i_.d.cts → Subscriber-Cy28j8MS.d.cts} +2 -2
- package/dist/{Subscriber-BTwKnz3c.mjs → Subscriber-bJSqvjdK.mjs} +2 -2
- package/dist/{Subscriber-BTwKnz3c.mjs.map → Subscriber-bJSqvjdK.mjs.map} +1 -1
- 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-C1me_972.mjs → SubscriberBuilder-CyCyjT6L.mjs} +2 -2
- package/dist/{SubscriberBuilder-C1me_972.mjs.map → SubscriberBuilder-CyCyjT6L.mjs.map} +1 -1
- package/dist/{SubscriberBuilder-C6iZvuDe.cjs → SubscriberBuilder-JTJcIZYy.cjs} +2 -2
- package/dist/{SubscriberBuilder-C6iZvuDe.cjs.map → SubscriberBuilder-JTJcIZYy.cjs.map} +1 -1
- package/dist/{SubscriberBuilder-DgljKtYu.d.cts → SubscriberBuilder-YjQ7qIpQ.d.mts} +3 -3
- package/dist/{TestEndpointAdaptor-BG6fzAOx.mjs → TestEndpointAdaptor-BevV2LLd.mjs} +33 -7
- package/dist/TestEndpointAdaptor-BevV2LLd.mjs.map +1 -0
- package/dist/{TestEndpointAdaptor-Db0cm1fb.d.mts → TestEndpointAdaptor-DGWuai69.d.mts} +10 -4
- package/dist/{TestEndpointAdaptor-BaQaTy_1.cjs → TestEndpointAdaptor-DupnzEnS.cjs} +33 -7
- package/dist/TestEndpointAdaptor-DupnzEnS.cjs.map +1 -0
- package/dist/{TestEndpointAdaptor-v7A-7hTs.d.cts → TestEndpointAdaptor-uXliWYjS.d.cts} +10 -4
- 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 +7 -7
- 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 +9 -8
- package/dist/endpoints/TestEndpointAdaptor.d.mts +9 -8
- 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 +4 -4
- package/dist/functions/TestFunctionAdaptor.d.cts +2 -2
- package/dist/functions/TestFunctionAdaptor.d.mts +2 -2
- package/dist/functions/TestFunctionAdaptor.mjs +4 -4
- package/dist/functions/index.cjs +5 -5
- package/dist/functions/index.d.cts +5 -5
- package/dist/functions/index.d.mts +5 -5
- package/dist/functions/index.mjs +5 -5
- package/dist/{functions-DVDb5wEA.cjs → functions-B9mEg9D9.cjs} +2 -2
- package/dist/{functions-DVDb5wEA.cjs.map → functions-B9mEg9D9.cjs.map} +1 -1
- package/dist/functions-DcQZSOHg.mjs +8 -0
- package/dist/{functions-mM-jcphA.mjs.map → functions-DcQZSOHg.mjs.map} +1 -1
- package/dist/{helpers-go4jiRvV.cjs → helpers-BJrzAmhb.cjs} +2 -2
- package/dist/{helpers-go4jiRvV.cjs.map → helpers-BJrzAmhb.cjs.map} +1 -1
- package/dist/{helpers-CM0U-4Vk.mjs → helpers-D_UKinz8.mjs} +2 -2
- package/dist/{helpers-CM0U-4Vk.mjs.map → helpers-D_UKinz8.mjs.map} +1 -1
- package/dist/index-DQt3pQtF.d.mts +9 -0
- package/dist/index-Dq-LQIwK.d.cts +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 +5 -5
- package/src/Construct.ts +2 -0
- 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/TestEndpointAdaptor.ts +75 -14
- 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/endpoints/__tests__/TestEndpointAdaptor.spec.ts +309 -42
- 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-D6MyCqby.cjs.map +0 -1
- package/dist/Cron-z0RiwSnT.mjs.map +0 -1
- package/dist/CronBuilder-BLTgwOWp.mjs.map +0 -1
- package/dist/CronBuilder-BOsYnZIm.cjs.map +0 -1
- package/dist/Endpoint-COGAflGh.cjs.map +0 -1
- package/dist/Endpoint-DLLZvqoh.mjs.map +0 -1
- package/dist/EndpointBuilder-DUE8ETVR.cjs.map +0 -1
- package/dist/EndpointBuilder-DpmUw--c.mjs.map +0 -1
- package/dist/EndpointFactory-CuJUCyvZ.mjs.map +0 -1
- package/dist/EndpointFactory-YAR24M2i.cjs.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/TestEndpointAdaptor-BG6fzAOx.mjs.map +0 -1
- package/dist/TestEndpointAdaptor-BaQaTy_1.cjs.map +0 -1
- package/dist/functions-mM-jcphA.mjs +0 -8
- package/dist/index-BXTN4mwI.d.mts +0 -9
- package/dist/index-BxApEwAF.d.cts +0 -9
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../Construct-
|
|
2
|
-
import "../Subscriber-
|
|
3
|
-
import { SubscriberBuilder } from "../SubscriberBuilder-
|
|
1
|
+
import "../Construct-B-O9OBS1.mjs";
|
|
2
|
+
import "../Subscriber-bJSqvjdK.mjs";
|
|
3
|
+
import { SubscriberBuilder } from "../SubscriberBuilder-CyCyjT6L.mjs";
|
|
4
4
|
|
|
5
5
|
export { SubscriberBuilder };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
require('../Construct-
|
|
2
|
-
const require_Subscriber = require('../Subscriber-
|
|
3
|
-
const require_SubscriberBuilder = require('../SubscriberBuilder-
|
|
1
|
+
require('../Construct-BtfN2fcm.cjs');
|
|
2
|
+
const require_Subscriber = require('../Subscriber-BdiqU7da.cjs');
|
|
3
|
+
const require_SubscriberBuilder = require('../SubscriberBuilder-JTJcIZYy.cjs');
|
|
4
4
|
|
|
5
5
|
//#region src/subscribers/index.ts
|
|
6
6
|
const s = new require_SubscriberBuilder.SubscriberBuilder();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import "../Construct-
|
|
2
|
-
import { Subscriber } from "../Subscriber-
|
|
3
|
-
import { SubscriberBuilder } from "../SubscriberBuilder-
|
|
4
|
-
import * as
|
|
1
|
+
import "../Construct-ci5u8Xnu.cjs";
|
|
2
|
+
import { Subscriber } from "../Subscriber-Cy28j8MS.cjs";
|
|
3
|
+
import { SubscriberBuilder } from "../SubscriberBuilder-BzK8kc2a.cjs";
|
|
4
|
+
import * as _geekmidas_logger8 from "@geekmidas/logger";
|
|
5
5
|
|
|
6
6
|
//#region src/subscribers/index.d.ts
|
|
7
|
-
declare const s: SubscriberBuilder<[],
|
|
7
|
+
declare const s: SubscriberBuilder<[], _geekmidas_logger8.Logger, undefined, undefined, string, []>;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { Subscriber, SubscriberBuilder, s };
|
|
10
10
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import "../Construct-
|
|
2
|
-
import { Subscriber } from "../Subscriber-
|
|
3
|
-
import { SubscriberBuilder } from "../SubscriberBuilder-
|
|
4
|
-
import * as
|
|
1
|
+
import "../Construct-zhmcmIdY.mjs";
|
|
2
|
+
import { Subscriber } from "../Subscriber-g3IWM1_d.mjs";
|
|
3
|
+
import { SubscriberBuilder } from "../SubscriberBuilder-YjQ7qIpQ.mjs";
|
|
4
|
+
import * as _geekmidas_logger4 from "@geekmidas/logger";
|
|
5
5
|
|
|
6
6
|
//#region src/subscribers/index.d.ts
|
|
7
|
-
declare const s: SubscriberBuilder<[],
|
|
7
|
+
declare const s: SubscriberBuilder<[], _geekmidas_logger4.Logger, undefined, undefined, string, []>;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { Subscriber, SubscriberBuilder, s };
|
|
10
10
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "../Construct-
|
|
2
|
-
import { Subscriber } from "../Subscriber-
|
|
3
|
-
import { SubscriberBuilder } from "../SubscriberBuilder-
|
|
1
|
+
import "../Construct-B-O9OBS1.mjs";
|
|
2
|
+
import { Subscriber } from "../Subscriber-bJSqvjdK.mjs";
|
|
3
|
+
import { SubscriberBuilder } from "../SubscriberBuilder-CyCyjT6L.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/subscribers/index.ts
|
|
6
6
|
const s = new SubscriberBuilder();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geekmidas/constructs",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -67,12 +67,12 @@
|
|
|
67
67
|
"openapi-types": "~12.1.3",
|
|
68
68
|
"fast-glob": "~3.3.3",
|
|
69
69
|
"@geekmidas/schema": "0.0.2",
|
|
70
|
+
"@geekmidas/services": "0.0.1",
|
|
70
71
|
"@geekmidas/logger": "0.0.1",
|
|
71
|
-
"@geekmidas/
|
|
72
|
+
"@geekmidas/events": "0.0.2",
|
|
72
73
|
"@geekmidas/rate-limit": "0.1.0",
|
|
73
|
-
"@geekmidas/
|
|
74
|
-
"@geekmidas/errors": "0.0.1"
|
|
75
|
-
"@geekmidas/events": "0.0.2"
|
|
74
|
+
"@geekmidas/cache": "0.0.7",
|
|
75
|
+
"@geekmidas/errors": "0.0.1"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@types/lodash.pick": "~4.4.9",
|
package/src/Construct.ts
CHANGED
package/src/crons/Cron.ts
CHANGED
|
@@ -42,6 +42,7 @@ export class Cron<
|
|
|
42
42
|
logger?: TLogger,
|
|
43
43
|
publisherService?: Service<TEventPublisherServiceName, TEventPublisher>,
|
|
44
44
|
events: any[] = [],
|
|
45
|
+
memorySize?: number,
|
|
45
46
|
) {
|
|
46
47
|
super(
|
|
47
48
|
fn,
|
|
@@ -53,6 +54,7 @@ export class Cron<
|
|
|
53
54
|
logger,
|
|
54
55
|
publisherService,
|
|
55
56
|
events,
|
|
57
|
+
memorySize,
|
|
56
58
|
);
|
|
57
59
|
}
|
|
58
60
|
|
package/src/crons/CronBuilder.ts
CHANGED
|
@@ -28,10 +28,16 @@ export class CronBuilder<
|
|
|
28
28
|
TEventPublisherServiceName
|
|
29
29
|
> {
|
|
30
30
|
private _schedule?: ScheduleExpression;
|
|
31
|
+
|
|
31
32
|
constructor() {
|
|
32
33
|
super(ConstructType.Cron);
|
|
33
34
|
}
|
|
34
35
|
|
|
36
|
+
memorySize(memorySize: number): this {
|
|
37
|
+
this._memorySize = memorySize;
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
|
|
35
41
|
schedule(
|
|
36
42
|
_expression: ScheduleExpression,
|
|
37
43
|
): CronBuilder<
|
|
@@ -175,6 +181,7 @@ export class CronBuilder<
|
|
|
175
181
|
this._logger,
|
|
176
182
|
this._publisher,
|
|
177
183
|
this._events,
|
|
184
|
+
this._memorySize,
|
|
178
185
|
);
|
|
179
186
|
|
|
180
187
|
// Reset builder state after creating the cron to prevent pollution
|
|
@@ -186,6 +193,7 @@ export class CronBuilder<
|
|
|
186
193
|
this.inputSchema = undefined;
|
|
187
194
|
this.outputSchema = undefined;
|
|
188
195
|
this._timeout = undefined;
|
|
196
|
+
this._memorySize = undefined;
|
|
189
197
|
|
|
190
198
|
return cron;
|
|
191
199
|
}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { ConsoleLogger } from '@geekmidas/logger/console';
|
|
3
|
+
import { CronBuilder } from '../CronBuilder';
|
|
4
|
+
import type { Service } from '@geekmidas/services';
|
|
5
|
+
|
|
6
|
+
const ServiceA = {
|
|
7
|
+
serviceName: 'a' as const,
|
|
8
|
+
async register() {
|
|
9
|
+
return { test: () => 'a' };
|
|
10
|
+
},
|
|
11
|
+
} satisfies Service<'a', any>;
|
|
12
|
+
|
|
13
|
+
const ServiceB = {
|
|
14
|
+
serviceName: 'b' as const,
|
|
15
|
+
async register() {
|
|
16
|
+
return { test: () => 'b' };
|
|
17
|
+
},
|
|
18
|
+
} satisfies Service<'b', any>;
|
|
19
|
+
|
|
20
|
+
describe('CronBuilder - State Isolation', () => {
|
|
21
|
+
describe('singleton instance state reset', () => {
|
|
22
|
+
it('should reset services after handle() is called', () => {
|
|
23
|
+
const c = new CronBuilder();
|
|
24
|
+
|
|
25
|
+
// First cron with ServiceA and ServiceB
|
|
26
|
+
const cron1 = c
|
|
27
|
+
.schedule('rate(5 minutes)')
|
|
28
|
+
.services([ServiceA, ServiceB])
|
|
29
|
+
.handle(async () => ({}));
|
|
30
|
+
|
|
31
|
+
// Second cron should not have any services from first
|
|
32
|
+
const cron2 = c.schedule('rate(10 minutes)').handle(async () => ({}));
|
|
33
|
+
|
|
34
|
+
expect(cron1.services.map((s) => s.serviceName)).toEqual(['a', 'b']);
|
|
35
|
+
expect(cron2.services.map((s) => s.serviceName)).toEqual([]);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('should reset logger after handle() is called', () => {
|
|
39
|
+
const c = new CronBuilder();
|
|
40
|
+
const customLogger = new ConsoleLogger({ app: 'custom' });
|
|
41
|
+
|
|
42
|
+
// First cron with custom logger
|
|
43
|
+
const cron1 = c
|
|
44
|
+
.schedule('rate(5 minutes)')
|
|
45
|
+
.logger(customLogger)
|
|
46
|
+
.handle(async () => ({}));
|
|
47
|
+
|
|
48
|
+
// Second cron should have default logger (not the custom one)
|
|
49
|
+
const cron2 = c.schedule('rate(10 minutes)').handle(async () => ({}));
|
|
50
|
+
|
|
51
|
+
expect(cron1.logger).toBe(customLogger);
|
|
52
|
+
expect(cron2.logger).not.toBe(customLogger);
|
|
53
|
+
expect(cron2.logger).toBeInstanceOf(ConsoleLogger);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('should reset schedule after handle() is called', () => {
|
|
57
|
+
const c = new CronBuilder();
|
|
58
|
+
|
|
59
|
+
// First cron with schedule
|
|
60
|
+
const cron1 = c.schedule('rate(5 minutes)').handle(async () => ({}));
|
|
61
|
+
|
|
62
|
+
// Second cron should not have schedule from first
|
|
63
|
+
const cron2 = c.schedule('rate(10 minutes)').handle(async () => ({}));
|
|
64
|
+
|
|
65
|
+
expect(cron1.schedule).toBe('rate(5 minutes)');
|
|
66
|
+
expect(cron2.schedule).toBe('rate(10 minutes)');
|
|
67
|
+
|
|
68
|
+
// Check internal state is reset
|
|
69
|
+
expect((c as any)._schedule).toBeUndefined();
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('should reset events after handle() is called', () => {
|
|
73
|
+
const c = new CronBuilder();
|
|
74
|
+
|
|
75
|
+
// Create first cron (events array should be empty initially)
|
|
76
|
+
const cron1 = c.schedule('rate(5 minutes)').handle(async () => ({}));
|
|
77
|
+
|
|
78
|
+
// Verify state was reset
|
|
79
|
+
expect((c as any)._events).toEqual([]);
|
|
80
|
+
expect((c as any)._services).toEqual([]);
|
|
81
|
+
expect((c as any)._schedule).toBeUndefined();
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it('should reset input/output schemas after handle() is called', () => {
|
|
85
|
+
const c = new CronBuilder();
|
|
86
|
+
const inputSchema: any = { '~standard': { validate: () => ({}) } };
|
|
87
|
+
const outputSchema: any = { '~standard': { validate: () => ({}) } };
|
|
88
|
+
|
|
89
|
+
// First cron with schemas
|
|
90
|
+
const cron1 = c
|
|
91
|
+
.schedule('rate(5 minutes)')
|
|
92
|
+
.input(inputSchema)
|
|
93
|
+
.output(outputSchema)
|
|
94
|
+
.handle(async () => ({}));
|
|
95
|
+
|
|
96
|
+
// Second cron should not have schemas
|
|
97
|
+
const cron2 = c.schedule('rate(10 minutes)').handle(async () => ({}));
|
|
98
|
+
|
|
99
|
+
expect(cron1.input).toBe(inputSchema);
|
|
100
|
+
expect(cron1.outputSchema).toBe(outputSchema);
|
|
101
|
+
expect(cron2.input).toBeUndefined();
|
|
102
|
+
expect(cron2.outputSchema).toBeUndefined();
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it('should reset timeout after handle() is called', () => {
|
|
106
|
+
const c = new CronBuilder();
|
|
107
|
+
|
|
108
|
+
// First cron with custom timeout
|
|
109
|
+
const cron1 = c
|
|
110
|
+
.schedule('rate(5 minutes)')
|
|
111
|
+
.timeout(5000)
|
|
112
|
+
.handle(async () => ({}));
|
|
113
|
+
|
|
114
|
+
// Second cron should have default timeout (30000)
|
|
115
|
+
const cron2 = c.schedule('rate(10 minutes)').handle(async () => ({}));
|
|
116
|
+
|
|
117
|
+
expect(cron1.timeout).toBe(5000);
|
|
118
|
+
expect(cron2.timeout).toBe(30000); // Default timeout
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
describe('method chaining before handle()', () => {
|
|
123
|
+
it('should accumulate services when chaining', () => {
|
|
124
|
+
const c = new CronBuilder();
|
|
125
|
+
|
|
126
|
+
const cron = c
|
|
127
|
+
.schedule('rate(5 minutes)')
|
|
128
|
+
.services([ServiceA])
|
|
129
|
+
.services([ServiceB])
|
|
130
|
+
.handle(async () => ({}));
|
|
131
|
+
|
|
132
|
+
expect(cron.services.map((s) => s.serviceName)).toEqual(['a', 'b']);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it('should not share references between different builder chains', () => {
|
|
136
|
+
const c = new CronBuilder();
|
|
137
|
+
|
|
138
|
+
// Start two separate chains
|
|
139
|
+
const builder1 = c.schedule('rate(5 minutes)').services([ServiceA]);
|
|
140
|
+
const builder2 = c.schedule('rate(10 minutes)').services([ServiceB]);
|
|
141
|
+
|
|
142
|
+
// They should be the same instance (singleton)
|
|
143
|
+
expect(builder1).toBe(builder2);
|
|
144
|
+
expect(builder1).toBe(c);
|
|
145
|
+
|
|
146
|
+
// But after handle, state is reset
|
|
147
|
+
const cron1 = builder1.handle(async () => ({}));
|
|
148
|
+
|
|
149
|
+
// Now builder2 should have reset state
|
|
150
|
+
expect((builder2 as any)._services).toEqual([]);
|
|
151
|
+
|
|
152
|
+
// Add services again
|
|
153
|
+
const cron2 = builder2
|
|
154
|
+
.schedule('rate(15 minutes)')
|
|
155
|
+
.services([ServiceB])
|
|
156
|
+
.handle(async () => ({}));
|
|
157
|
+
|
|
158
|
+
expect(cron1.services.map((s) => s.serviceName)).toEqual(['a', 'b']);
|
|
159
|
+
expect(cron2.services.map((s) => s.serviceName)).toEqual(['b']);
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
describe('sequential cron creation', () => {
|
|
164
|
+
it('should create independent crons sequentially', () => {
|
|
165
|
+
const c = new CronBuilder();
|
|
166
|
+
|
|
167
|
+
const cron1 = c
|
|
168
|
+
.schedule('rate(5 minutes)')
|
|
169
|
+
.services([ServiceA, ServiceB])
|
|
170
|
+
.handle(async () => ({ result: 1 }));
|
|
171
|
+
|
|
172
|
+
const cron2 = c
|
|
173
|
+
.schedule('rate(10 minutes)')
|
|
174
|
+
.services([ServiceA])
|
|
175
|
+
.handle(async () => ({ result: 2 }));
|
|
176
|
+
|
|
177
|
+
const cron3 = c
|
|
178
|
+
.schedule('rate(15 minutes)')
|
|
179
|
+
.handle(async () => ({ result: 3 }));
|
|
180
|
+
|
|
181
|
+
expect(cron1.services.map((s) => s.serviceName)).toEqual(['a', 'b']);
|
|
182
|
+
expect(cron1.schedule).toBe('rate(5 minutes)');
|
|
183
|
+
|
|
184
|
+
expect(cron2.services.map((s) => s.serviceName)).toEqual(['a']);
|
|
185
|
+
expect(cron2.schedule).toBe('rate(10 minutes)');
|
|
186
|
+
|
|
187
|
+
expect(cron3.services.map((s) => s.serviceName)).toEqual([]);
|
|
188
|
+
expect(cron3.schedule).toBe('rate(15 minutes)');
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
describe('publisher isolation', () => {
|
|
193
|
+
it('should reset publisher after handle() is called', () => {
|
|
194
|
+
const c = new CronBuilder();
|
|
195
|
+
const mockPublisher: any = {
|
|
196
|
+
serviceName: 'publisher',
|
|
197
|
+
async register() {
|
|
198
|
+
return { publish: () => {} };
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
const cron1 = c
|
|
203
|
+
.schedule('rate(5 minutes)')
|
|
204
|
+
.publisher(mockPublisher)
|
|
205
|
+
.handle(async () => ({}));
|
|
206
|
+
|
|
207
|
+
const cron2 = c.schedule('rate(10 minutes)').handle(async () => ({}));
|
|
208
|
+
|
|
209
|
+
expect((cron1 as any).publisherService).toBe(mockPublisher);
|
|
210
|
+
expect((cron2 as any).publisherService).toBeUndefined();
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
describe('cron expression types', () => {
|
|
215
|
+
it('should handle different schedule expression formats', () => {
|
|
216
|
+
const c = new CronBuilder();
|
|
217
|
+
|
|
218
|
+
const cron1 = c.schedule('rate(5 minutes)').handle(async () => ({}));
|
|
219
|
+
const cron2 = c.schedule('cron(0 12 * * ? *)').handle(async () => ({}));
|
|
220
|
+
const cron3 = c.schedule('rate(1 hour)').handle(async () => ({}));
|
|
221
|
+
|
|
222
|
+
expect(cron1.schedule).toBe('rate(5 minutes)');
|
|
223
|
+
expect(cron2.schedule).toBe('cron(0 12 * * ? *)');
|
|
224
|
+
expect(cron3.schedule).toBe('rate(1 hour)');
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents an authorizer configuration for endpoints
|
|
3
|
+
*/
|
|
4
|
+
export interface Authorizer {
|
|
5
|
+
/**
|
|
6
|
+
* Unique identifier for the authorizer
|
|
7
|
+
*/
|
|
8
|
+
name: string;
|
|
9
|
+
/**
|
|
10
|
+
* Type of authorizer (e.g., 'iam', 'jwt', 'custom')
|
|
11
|
+
*/
|
|
12
|
+
type?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Description of what this authorizer does
|
|
15
|
+
*/
|
|
16
|
+
description?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Additional metadata specific to the authorizer type
|
|
19
|
+
*/
|
|
20
|
+
metadata?: Record<string, any>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Helper to create an authorizer configuration
|
|
25
|
+
*/
|
|
26
|
+
export function createAuthorizer(
|
|
27
|
+
name: string,
|
|
28
|
+
options?: Omit<Authorizer, 'name'>,
|
|
29
|
+
): Authorizer {
|
|
30
|
+
return {
|
|
31
|
+
name,
|
|
32
|
+
...options,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -5,6 +5,7 @@ import set from 'lodash.set';
|
|
|
5
5
|
import type { OpenAPIV3_1 } from 'openapi-types';
|
|
6
6
|
|
|
7
7
|
import type { Service, ServiceRecord } from '@geekmidas/services';
|
|
8
|
+
import type { Authorizer } from './Authorizer';
|
|
8
9
|
import { ConstructType } from '../Construct';
|
|
9
10
|
import { Function, type FunctionHandler } from '../functions';
|
|
10
11
|
|
|
@@ -93,6 +94,8 @@ export class Endpoint<
|
|
|
93
94
|
public authorize: AuthorizeFn<TServices, TLogger, TSession> = () => true;
|
|
94
95
|
/** Optional rate limiting configuration */
|
|
95
96
|
public rateLimit?: RateLimitConfig;
|
|
97
|
+
/** Optional authorizer for this endpoint */
|
|
98
|
+
public authorizer?: Authorizer;
|
|
96
99
|
/** The endpoint handler function */
|
|
97
100
|
private endpointFn!: EndpointHandler<
|
|
98
101
|
TInput,
|
|
@@ -174,12 +177,13 @@ export class Endpoint<
|
|
|
174
177
|
* Creates a case-insensitive header lookup function from a headers object.
|
|
175
178
|
*
|
|
176
179
|
* @param headers - Object containing header key-value pairs
|
|
177
|
-
* @returns Function to retrieve header values by case-insensitive key
|
|
180
|
+
* @returns Function to retrieve header values by case-insensitive key, or all headers
|
|
178
181
|
*
|
|
179
182
|
* @example
|
|
180
183
|
* ```typescript
|
|
181
184
|
* const headerFn = Endpoint.createHeaders({ 'Content-Type': 'application/json' });
|
|
182
185
|
* headerFn('content-type'); // Returns 'application/json'
|
|
186
|
+
* headerFn(); // Returns { 'content-type': 'application/json' }
|
|
183
187
|
* ```
|
|
184
188
|
*/
|
|
185
189
|
static createHeaders(headers: Record<string, string>): HeaderFn {
|
|
@@ -189,22 +193,30 @@ export class Endpoint<
|
|
|
189
193
|
headerMap.set(key, v);
|
|
190
194
|
}
|
|
191
195
|
|
|
192
|
-
|
|
196
|
+
function get(): Record<string, string>;
|
|
197
|
+
function get(key: string): string | undefined;
|
|
198
|
+
function get(key?: string): string | undefined | Record<string, string> {
|
|
199
|
+
if (key === undefined) {
|
|
200
|
+
// Return all headers as plain object
|
|
201
|
+
return Object.fromEntries(headerMap.entries());
|
|
202
|
+
}
|
|
193
203
|
return headerMap.get(key.toLowerCase());
|
|
194
|
-
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return get;
|
|
195
207
|
}
|
|
196
208
|
|
|
197
209
|
/**
|
|
198
210
|
* Parses cookie string and creates a cookie lookup function.
|
|
199
211
|
*
|
|
200
212
|
* @param cookieHeader - The Cookie header value
|
|
201
|
-
* @returns Function to retrieve cookie values by name
|
|
213
|
+
* @returns Function to retrieve cookie values by name, or all cookies
|
|
202
214
|
*
|
|
203
215
|
* @example
|
|
204
216
|
* ```typescript
|
|
205
217
|
* const cookieFn = Endpoint.createCookies('session=abc123; theme=dark');
|
|
206
218
|
* cookieFn('session'); // Returns 'abc123'
|
|
207
|
-
* cookieFn(
|
|
219
|
+
* cookieFn(); // Returns { session: 'abc123', theme: 'dark' }
|
|
208
220
|
* ```
|
|
209
221
|
*/
|
|
210
222
|
static createCookies(cookieHeader: string | undefined): CookieFn {
|
|
@@ -222,9 +234,17 @@ export class Endpoint<
|
|
|
222
234
|
}
|
|
223
235
|
}
|
|
224
236
|
|
|
225
|
-
|
|
237
|
+
function get(): Record<string, string>;
|
|
238
|
+
function get(name: string): string | undefined;
|
|
239
|
+
function get(name?: string): string | undefined | Record<string, string> {
|
|
240
|
+
if (name === undefined) {
|
|
241
|
+
// Return all cookies as plain object
|
|
242
|
+
return Object.fromEntries(cookieMap.entries());
|
|
243
|
+
}
|
|
226
244
|
return cookieMap.get(name);
|
|
227
|
-
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
return get;
|
|
228
248
|
}
|
|
229
249
|
|
|
230
250
|
/**
|
|
@@ -499,6 +519,7 @@ export class Endpoint<
|
|
|
499
519
|
* @param options.getSession - Session extraction function
|
|
500
520
|
* @param options.authorize - Authorization check function
|
|
501
521
|
* @param options.status - Success HTTP status code (default: 200)
|
|
522
|
+
* @param options.authorizer - Optional authorizer configuration
|
|
502
523
|
*/
|
|
503
524
|
constructor({
|
|
504
525
|
fn,
|
|
@@ -511,12 +532,14 @@ export class Endpoint<
|
|
|
511
532
|
output: outputSchema,
|
|
512
533
|
services,
|
|
513
534
|
timeout,
|
|
535
|
+
memorySize,
|
|
514
536
|
getSession,
|
|
515
537
|
authorize,
|
|
516
538
|
rateLimit,
|
|
517
539
|
status = SuccessStatus.OK,
|
|
518
540
|
publisherService,
|
|
519
541
|
events,
|
|
542
|
+
authorizer,
|
|
520
543
|
}: EndpointOptions<
|
|
521
544
|
TRoute,
|
|
522
545
|
TMethod,
|
|
@@ -539,6 +562,7 @@ export class Endpoint<
|
|
|
539
562
|
logger,
|
|
540
563
|
publisherService,
|
|
541
564
|
events,
|
|
565
|
+
memorySize,
|
|
542
566
|
);
|
|
543
567
|
|
|
544
568
|
this.route = route;
|
|
@@ -559,6 +583,10 @@ export class Endpoint<
|
|
|
559
583
|
if (rateLimit) {
|
|
560
584
|
this.rateLimit = rateLimit;
|
|
561
585
|
}
|
|
586
|
+
|
|
587
|
+
if (authorizer) {
|
|
588
|
+
this.authorizer = authorizer;
|
|
589
|
+
}
|
|
562
590
|
}
|
|
563
591
|
}
|
|
564
592
|
|
|
@@ -625,6 +653,8 @@ export interface EndpointOptions<
|
|
|
625
653
|
tags?: string[];
|
|
626
654
|
/** Optional execution timeout in milliseconds */
|
|
627
655
|
timeout: number | undefined;
|
|
656
|
+
/** Optional memory size in MB for serverless deployments */
|
|
657
|
+
memorySize: number | undefined;
|
|
628
658
|
/** Input validation schemas */
|
|
629
659
|
input: TInput | undefined;
|
|
630
660
|
/** Output validation schema */
|
|
@@ -645,6 +675,8 @@ export interface EndpointOptions<
|
|
|
645
675
|
publisherService?: Service<TEventPublisherServiceName, TEventPublisher>;
|
|
646
676
|
|
|
647
677
|
events?: MappedEvent<TEventPublisher, OutSchema>[];
|
|
678
|
+
/** Optional authorizer configuration */
|
|
679
|
+
authorizer?: Authorizer;
|
|
648
680
|
}
|
|
649
681
|
|
|
650
682
|
/**
|
|
@@ -780,24 +812,45 @@ export type EndpointHeaders = Map<string, string>;
|
|
|
780
812
|
|
|
781
813
|
/**
|
|
782
814
|
* Function type for retrieving HTTP header values.
|
|
815
|
+
* Supports two calling patterns:
|
|
816
|
+
* - `header(key)` - Get a single header value (case-insensitive)
|
|
817
|
+
* - `header()` - Get all headers as a plain object
|
|
783
818
|
*
|
|
784
|
-
* @
|
|
785
|
-
*
|
|
819
|
+
* @example
|
|
820
|
+
* ```typescript
|
|
821
|
+
* // Get single header
|
|
822
|
+
* const contentType = header('content-type');
|
|
823
|
+
*
|
|
824
|
+
* // Get all headers
|
|
825
|
+
* const allHeaders = header();
|
|
826
|
+
* // { 'content-type': 'application/json', 'host': 'example.com', ... }
|
|
827
|
+
* ```
|
|
786
828
|
*/
|
|
787
|
-
export
|
|
829
|
+
export interface HeaderFn {
|
|
830
|
+
(): Record<string, string>;
|
|
831
|
+
(key: string): string | undefined;
|
|
832
|
+
}
|
|
788
833
|
|
|
789
834
|
/**
|
|
790
835
|
* Function type for retrieving cookie values.
|
|
791
|
-
*
|
|
792
|
-
*
|
|
793
|
-
*
|
|
836
|
+
* Supports two calling patterns:
|
|
837
|
+
* - `cookie(name)` - Get a single cookie value
|
|
838
|
+
* - `cookie()` - Get all cookies as a plain object
|
|
794
839
|
*
|
|
795
840
|
* @example
|
|
796
841
|
* ```typescript
|
|
842
|
+
* // Get single cookie
|
|
797
843
|
* const sessionId = cookie('session');
|
|
844
|
+
*
|
|
845
|
+
* // Get all cookies
|
|
846
|
+
* const allCookies = cookie();
|
|
847
|
+
* // { session: 'abc123', theme: 'dark', ... }
|
|
798
848
|
* ```
|
|
799
849
|
*/
|
|
800
|
-
export
|
|
850
|
+
export interface CookieFn {
|
|
851
|
+
(): Record<string, string>;
|
|
852
|
+
(name: string): string | undefined;
|
|
853
|
+
}
|
|
801
854
|
|
|
802
855
|
/**
|
|
803
856
|
* Cookie options matching standard Set-Cookie attributes
|