@geekmidas/constructs 0.0.7 → 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-D6hnZLk7.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-CmZ6esMM.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-Dfv5JguE.mjs → CronBuilder-ChyrDobL.mjs} +10 -5
- package/dist/CronBuilder-ChyrDobL.mjs.map +1 -0
- package/dist/{CronBuilder-Di7QK8Rt.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-oXO_ka1-.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-FJktpPOu.cjs → EndpointBuilder-i7-4ieP_.cjs} +28 -5
- package/dist/EndpointBuilder-i7-4ieP_.cjs.map +1 -0
- package/dist/{EndpointFactory-Kk1tpifs.cjs → EndpointFactory-CYTBPu_G.cjs} +41 -10
- package/dist/EndpointFactory-CYTBPu_G.cjs.map +1 -0
- package/dist/{EndpointFactory-eG8bDhOh.mjs → EndpointFactory-CYuT-nt-.mjs} +41 -10
- package/dist/EndpointFactory-CYuT-nt-.mjs.map +1 -0
- package/dist/{EndpointFactory-DBRGrXAy.d.mts → EndpointFactory-KkyIOE62.d.cts} +29 -21
- package/dist/{EndpointFactory-DInjHvFR.d.cts → EndpointFactory-VnSAdwdv.d.mts} +29 -21
- 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-BrbM9vxd.d.cts → HonoEndpointAdaptor-DAsZoX2a.d.mts} +9 -8
- package/dist/{HonoEndpointAdaptor-CxcYKdzT.d.mts → HonoEndpointAdaptor-lYw6EN1Q.d.cts} +7 -6
- package/dist/{HonoEndpointAdaptor-Ds433Q8w.cjs → HonoEndpointAdaptor-vWSpXdNp.cjs} +20 -3
- package/dist/HonoEndpointAdaptor-vWSpXdNp.cjs.map +1 -0
- package/dist/{Subscriber-CSt7EOlT.cjs → Subscriber-BdiqU7da.cjs} +2 -2
- package/dist/{Subscriber-CSt7EOlT.cjs.map → Subscriber-BdiqU7da.cjs.map} +1 -1
- package/dist/{Subscriber-BoFm12i_.d.cts → Subscriber-Cy28j8MS.d.cts} +2 -2
- package/dist/{Subscriber-DkCDcTUL.mjs → Subscriber-bJSqvjdK.mjs} +2 -2
- package/dist/{Subscriber-DkCDcTUL.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-Bn9Hyi28.mjs → SubscriberBuilder-CyCyjT6L.mjs} +2 -2
- package/dist/{SubscriberBuilder-Bn9Hyi28.mjs.map → SubscriberBuilder-CyCyjT6L.mjs.map} +1 -1
- package/dist/{SubscriberBuilder-RsiOmnwq.cjs → SubscriberBuilder-JTJcIZYy.cjs} +2 -2
- package/dist/{SubscriberBuilder-RsiOmnwq.cjs.map → SubscriberBuilder-JTJcIZYy.cjs.map} +1 -1
- package/dist/{SubscriberBuilder-DgljKtYu.d.cts → SubscriberBuilder-YjQ7qIpQ.d.mts} +3 -3
- package/dist/{TestEndpointAdaptor-Ct4I-gDo.mjs → TestEndpointAdaptor-BevV2LLd.mjs} +2 -2
- package/dist/{TestEndpointAdaptor-Ct4I-gDo.mjs.map → TestEndpointAdaptor-BevV2LLd.mjs.map} +1 -1
- package/dist/{TestEndpointAdaptor-vboVyJ0w.d.mts → TestEndpointAdaptor-DGWuai69.d.mts} +2 -2
- package/dist/{TestEndpointAdaptor-FJUob2W_.cjs → TestEndpointAdaptor-DupnzEnS.cjs} +2 -2
- package/dist/{TestEndpointAdaptor-FJUob2W_.cjs.map → TestEndpointAdaptor-DupnzEnS.cjs.map} +1 -1
- 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 +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 +3 -3
- 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/__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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { HttpMethod, LowerHttpMethod, RemoveUndefined } from "./types-Bp9ysFXd.cjs";
|
|
2
|
-
import {
|
|
2
|
+
import { Authorizer } from "./Authorizer-iXsSB600.cjs";
|
|
3
|
+
import { Function, FunctionHandler } from "./Function-BbLYIKLL.cjs";
|
|
3
4
|
import { EventPublisher, ExtractPublisherMessage, MappedEvent } from "@geekmidas/events";
|
|
4
5
|
import { Logger } from "@geekmidas/logger";
|
|
5
6
|
import { Service, ServiceRecord } from "@geekmidas/services";
|
|
@@ -56,6 +57,8 @@ declare class Endpoint<TRoute extends string, TMethod extends HttpMethod, TInput
|
|
|
56
57
|
authorize: AuthorizeFn<TServices, TLogger, TSession>;
|
|
57
58
|
/** Optional rate limiting configuration */
|
|
58
59
|
rateLimit?: RateLimitConfig;
|
|
60
|
+
/** Optional authorizer for this endpoint */
|
|
61
|
+
authorizer?: Authorizer;
|
|
59
62
|
/** The endpoint handler function */
|
|
60
63
|
private endpointFn;
|
|
61
64
|
/**
|
|
@@ -104,12 +107,13 @@ declare class Endpoint<TRoute extends string, TMethod extends HttpMethod, TInput
|
|
|
104
107
|
* Creates a case-insensitive header lookup function from a headers object.
|
|
105
108
|
*
|
|
106
109
|
* @param headers - Object containing header key-value pairs
|
|
107
|
-
* @returns Function to retrieve header values by case-insensitive key
|
|
110
|
+
* @returns Function to retrieve header values by case-insensitive key, or all headers
|
|
108
111
|
*
|
|
109
112
|
* @example
|
|
110
113
|
* ```typescript
|
|
111
114
|
* const headerFn = Endpoint.createHeaders({ 'Content-Type': 'application/json' });
|
|
112
115
|
* headerFn('content-type'); // Returns 'application/json'
|
|
116
|
+
* headerFn(); // Returns { 'content-type': 'application/json' }
|
|
113
117
|
* ```
|
|
114
118
|
*/
|
|
115
119
|
static createHeaders(headers: Record<string, string>): HeaderFn;
|
|
@@ -117,13 +121,13 @@ declare class Endpoint<TRoute extends string, TMethod extends HttpMethod, TInput
|
|
|
117
121
|
* Parses cookie string and creates a cookie lookup function.
|
|
118
122
|
*
|
|
119
123
|
* @param cookieHeader - The Cookie header value
|
|
120
|
-
* @returns Function to retrieve cookie values by name
|
|
124
|
+
* @returns Function to retrieve cookie values by name, or all cookies
|
|
121
125
|
*
|
|
122
126
|
* @example
|
|
123
127
|
* ```typescript
|
|
124
128
|
* const cookieFn = Endpoint.createCookies('session=abc123; theme=dark');
|
|
125
129
|
* cookieFn('session'); // Returns 'abc123'
|
|
126
|
-
* cookieFn(
|
|
130
|
+
* cookieFn(); // Returns { session: 'abc123', theme: 'dark' }
|
|
127
131
|
* ```
|
|
128
132
|
*/
|
|
129
133
|
static createCookies(cookieHeader: string | undefined): CookieFn;
|
|
@@ -195,6 +199,7 @@ declare class Endpoint<TRoute extends string, TMethod extends HttpMethod, TInput
|
|
|
195
199
|
* @param options.getSession - Session extraction function
|
|
196
200
|
* @param options.authorize - Authorization check function
|
|
197
201
|
* @param options.status - Success HTTP status code (default: 200)
|
|
202
|
+
* @param options.authorizer - Optional authorizer configuration
|
|
198
203
|
*/
|
|
199
204
|
constructor({
|
|
200
205
|
fn,
|
|
@@ -207,12 +212,14 @@ declare class Endpoint<TRoute extends string, TMethod extends HttpMethod, TInput
|
|
|
207
212
|
output: outputSchema,
|
|
208
213
|
services,
|
|
209
214
|
timeout,
|
|
215
|
+
memorySize,
|
|
210
216
|
getSession,
|
|
211
217
|
authorize,
|
|
212
218
|
rateLimit,
|
|
213
219
|
status,
|
|
214
220
|
publisherService,
|
|
215
|
-
events
|
|
221
|
+
events,
|
|
222
|
+
authorizer
|
|
216
223
|
}: EndpointOptions<TRoute, TMethod, TInput, OutSchema, TServices, TLogger, TSession, OutSchema, TEventPublisher, TEventPublisherServiceName>);
|
|
217
224
|
}
|
|
218
225
|
/**
|
|
@@ -262,6 +269,8 @@ interface EndpointOptions<TRoute extends string, TMethod extends HttpMethod, TIn
|
|
|
262
269
|
tags?: string[];
|
|
263
270
|
/** Optional execution timeout in milliseconds */
|
|
264
271
|
timeout: number | undefined;
|
|
272
|
+
/** Optional memory size in MB for serverless deployments */
|
|
273
|
+
memorySize: number | undefined;
|
|
265
274
|
/** Input validation schemas */
|
|
266
275
|
input: TInput | undefined;
|
|
267
276
|
/** Output validation schema */
|
|
@@ -281,6 +290,8 @@ interface EndpointOptions<TRoute extends string, TMethod extends HttpMethod, TIn
|
|
|
281
290
|
*/
|
|
282
291
|
publisherService?: Service<TEventPublisherServiceName, TEventPublisher>;
|
|
283
292
|
events?: MappedEvent<TEventPublisher, OutSchema>[];
|
|
293
|
+
/** Optional authorizer configuration */
|
|
294
|
+
authorizer?: Authorizer;
|
|
284
295
|
}
|
|
285
296
|
/**
|
|
286
297
|
* Defines the possible input schema types for an endpoint.
|
|
@@ -380,23 +391,44 @@ type MultiHeaderFn = () => EndpointHeaders;
|
|
|
380
391
|
type EndpointHeaders = Map<string, string>;
|
|
381
392
|
/**
|
|
382
393
|
* Function type for retrieving HTTP header values.
|
|
394
|
+
* Supports two calling patterns:
|
|
395
|
+
* - `header(key)` - Get a single header value (case-insensitive)
|
|
396
|
+
* - `header()` - Get all headers as a plain object
|
|
383
397
|
*
|
|
384
|
-
* @
|
|
385
|
-
*
|
|
398
|
+
* @example
|
|
399
|
+
* ```typescript
|
|
400
|
+
* // Get single header
|
|
401
|
+
* const contentType = header('content-type');
|
|
402
|
+
*
|
|
403
|
+
* // Get all headers
|
|
404
|
+
* const allHeaders = header();
|
|
405
|
+
* // { 'content-type': 'application/json', 'host': 'example.com', ... }
|
|
406
|
+
* ```
|
|
386
407
|
*/
|
|
387
|
-
|
|
408
|
+
interface HeaderFn {
|
|
409
|
+
(): Record<string, string>;
|
|
410
|
+
(key: string): string | undefined;
|
|
411
|
+
}
|
|
388
412
|
/**
|
|
389
413
|
* Function type for retrieving cookie values.
|
|
390
|
-
*
|
|
391
|
-
*
|
|
392
|
-
*
|
|
414
|
+
* Supports two calling patterns:
|
|
415
|
+
* - `cookie(name)` - Get a single cookie value
|
|
416
|
+
* - `cookie()` - Get all cookies as a plain object
|
|
393
417
|
*
|
|
394
418
|
* @example
|
|
395
419
|
* ```typescript
|
|
420
|
+
* // Get single cookie
|
|
396
421
|
* const sessionId = cookie('session');
|
|
422
|
+
*
|
|
423
|
+
* // Get all cookies
|
|
424
|
+
* const allCookies = cookie();
|
|
425
|
+
* // { session: 'abc123', theme: 'dark', ... }
|
|
397
426
|
* ```
|
|
398
427
|
*/
|
|
399
|
-
|
|
428
|
+
interface CookieFn {
|
|
429
|
+
(): Record<string, string>;
|
|
430
|
+
(name: string): string | undefined;
|
|
431
|
+
}
|
|
400
432
|
/**
|
|
401
433
|
* Cookie options matching standard Set-Cookie attributes
|
|
402
434
|
*/
|
|
@@ -511,4 +543,4 @@ type EndpointOutput<T> = T extends Endpoint<any, any, any, infer OutSchema, any,
|
|
|
511
543
|
type EndpointEvent<T> = T extends Endpoint<any, any, any, any, any, any, any, infer TEventPublisher> ? ExtractPublisherMessage<TEventPublisher> : never;
|
|
512
544
|
//#endregion
|
|
513
545
|
export { AuthorizeContext, AuthorizeFn, ConvertRouteParams, CookieFn, CookieOptions, Endpoint, EndpointContext, EndpointEvent, EndpointHandler, EndpointHeaders, EndpointInput, EndpointOpenApiSchema, EndpointOptions, EndpointOutput, EndpointSchemas, HeaderFn, MultiHeaderFn, ResponseBuilder, ResponseMetadata, ResponseWithMetadata, SessionContext, SessionFn, SingleHeaderFn, SuccessStatus };
|
|
514
|
-
//# sourceMappingURL=Endpoint-
|
|
546
|
+
//# sourceMappingURL=Endpoint-zHPjZ35J.d.cts.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { HttpMethod } from "./types-Bp9ysFXd.cjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { Authorizer } from "./Authorizer-iXsSB600.cjs";
|
|
3
|
+
import { BaseFunctionBuilder } from "./BaseFunctionBuilder-C4ZJPkIZ.cjs";
|
|
4
|
+
import { AuthorizeFn, Endpoint, EndpointHandler, EndpointSchemas, SessionFn, SuccessStatus } from "./Endpoint-zHPjZ35J.cjs";
|
|
4
5
|
import { EventPublisher, MappedEvent } from "@geekmidas/events";
|
|
5
6
|
import { Logger } from "@geekmidas/logger";
|
|
6
7
|
import { Service } from "@geekmidas/services";
|
|
@@ -8,42 +9,47 @@ import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
|
8
9
|
import { RateLimitConfig } from "@geekmidas/rate-limit";
|
|
9
10
|
|
|
10
11
|
//#region src/endpoints/EndpointBuilder.d.ts
|
|
11
|
-
declare class EndpointBuilder<TRoute extends string, TMethod extends HttpMethod, TInput extends EndpointSchemas = {}, TServices extends Service[] = [], TLogger extends Logger = Logger, OutSchema extends StandardSchemaV1 | undefined = undefined, TSession = unknown, TEventPublisher extends EventPublisher<any> | undefined = undefined, TEventPublisherServiceName extends string = string> extends BaseFunctionBuilder<TInput, OutSchema, TServices, TLogger, TEventPublisher, TEventPublisherServiceName> {
|
|
12
|
+
declare class EndpointBuilder<TRoute extends string, TMethod extends HttpMethod, TInput extends EndpointSchemas = {}, TServices extends Service[] = [], TLogger extends Logger = Logger, OutSchema extends StandardSchemaV1 | undefined = undefined, TSession = unknown, TEventPublisher extends EventPublisher<any> | undefined = undefined, TEventPublisherServiceName extends string = string, TAuthorizers extends readonly string[] = readonly string[]> extends BaseFunctionBuilder<TInput, OutSchema, TServices, TLogger, TEventPublisher, TEventPublisherServiceName> {
|
|
12
13
|
readonly route: TRoute;
|
|
13
14
|
readonly method: TMethod;
|
|
14
15
|
protected schemas: TInput;
|
|
15
16
|
protected _description?: string;
|
|
16
17
|
protected _status?: SuccessStatus;
|
|
17
18
|
protected _tags?: string[];
|
|
19
|
+
protected _memorySize?: number;
|
|
18
20
|
_getSession: SessionFn<TServices, TLogger, TSession>;
|
|
19
21
|
_authorize: AuthorizeFn<TServices, TLogger, TSession>;
|
|
20
22
|
_rateLimit?: RateLimitConfig;
|
|
23
|
+
_availableAuthorizers: Authorizer[];
|
|
24
|
+
_authorizerName?: TAuthorizers[number];
|
|
21
25
|
constructor(route: TRoute, method: TMethod);
|
|
22
26
|
_setPublisher(publisher: Service<TEventPublisherServiceName, TEventPublisher>): void;
|
|
23
27
|
description(description: string): this;
|
|
24
28
|
status(status: SuccessStatus): this;
|
|
25
29
|
event<TEvent extends MappedEvent<TEventPublisher, OutSchema>>(event: TEvent): this;
|
|
26
30
|
tags(tags: string[]): this;
|
|
27
|
-
|
|
31
|
+
memorySize(memorySize: number): this;
|
|
32
|
+
publisher<T extends EventPublisher<any>, TName extends string>(publisher: Service<TName, T>): EndpointBuilder<TRoute, TMethod, TInput, TServices, TLogger, OutSchema, TSession, T, TName, TAuthorizers>;
|
|
28
33
|
body<T extends StandardSchemaV1>(schema: T): EndpointBuilder<TRoute, TMethod, Omit<TInput, 'body'> & {
|
|
29
34
|
body: T;
|
|
30
|
-
}, TServices, TLogger, OutSchema, TSession, TEventPublisher>;
|
|
35
|
+
}, TServices, TLogger, OutSchema, TSession, TEventPublisher, TEventPublisherServiceName, TAuthorizers>;
|
|
31
36
|
search<T extends StandardSchemaV1>(schema: T): EndpointBuilder<TRoute, TMethod, Omit<TInput, 'query'> & {
|
|
32
37
|
query: T;
|
|
33
|
-
}, TServices, TLogger, OutSchema, TSession, TEventPublisher>;
|
|
38
|
+
}, TServices, TLogger, OutSchema, TSession, TEventPublisher, TEventPublisherServiceName, TAuthorizers>;
|
|
34
39
|
query<T extends StandardSchemaV1>(schema: T): EndpointBuilder<TRoute, TMethod, Omit<TInput, 'query'> & {
|
|
35
40
|
query: T;
|
|
36
|
-
}, TServices, TLogger, OutSchema, TSession, TEventPublisher>;
|
|
41
|
+
}, TServices, TLogger, OutSchema, TSession, TEventPublisher, TEventPublisherServiceName, TAuthorizers>;
|
|
37
42
|
params<T extends StandardSchemaV1>(schema: T): EndpointBuilder<TRoute, TMethod, Omit<TInput, 'params'> & {
|
|
38
43
|
params: T;
|
|
39
|
-
}, TServices, TLogger, OutSchema, TSession, TEventPublisher>;
|
|
44
|
+
}, TServices, TLogger, OutSchema, TSession, TEventPublisher, TEventPublisherServiceName, TAuthorizers>;
|
|
40
45
|
rateLimit(config: RateLimitConfig): this;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
authorizer(name: TAuthorizers[number] | 'none'): EndpointBuilder<TRoute, TMethod, TInput, TServices, TLogger, OutSchema, TSession, TEventPublisher, TEventPublisherServiceName, TAuthorizers>;
|
|
47
|
+
services<T extends Service[]>(services: T): EndpointBuilder<TRoute, TMethod, TInput, [...TServices, ...T], TLogger, OutSchema, TSession, TEventPublisher, TEventPublisherServiceName, TAuthorizers>;
|
|
48
|
+
logger<T extends Logger>(logger: T): EndpointBuilder<TRoute, TMethod, TInput, TServices, T, OutSchema, TSession, TEventPublisher, TEventPublisherServiceName, TAuthorizers>;
|
|
49
|
+
output<T extends StandardSchemaV1>(schema: T): EndpointBuilder<TRoute, TMethod, TInput, TServices, TLogger, T, TSession, TEventPublisher, TEventPublisherServiceName, TAuthorizers>;
|
|
44
50
|
input(_schema: any): any;
|
|
45
51
|
handle(fn: EndpointHandler<TInput, TServices, TLogger, OutSchema, TSession>): Endpoint<TRoute, TMethod, TInput, OutSchema, TServices, TLogger, TSession, TEventPublisher>;
|
|
46
52
|
}
|
|
47
53
|
//#endregion
|
|
48
54
|
export { EndpointBuilder };
|
|
49
|
-
//# sourceMappingURL=EndpointBuilder-
|
|
55
|
+
//# sourceMappingURL=EndpointBuilder-B5l7zQU1.d.cts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ConstructType } from "./Construct-
|
|
2
|
-
import { BaseFunctionBuilder } from "./BaseFunctionBuilder-
|
|
3
|
-
import { Endpoint } from "./Endpoint-
|
|
1
|
+
import { ConstructType } from "./Construct-B-O9OBS1.mjs";
|
|
2
|
+
import { BaseFunctionBuilder } from "./BaseFunctionBuilder-DOhEn5Ce.mjs";
|
|
3
|
+
import { Endpoint } from "./Endpoint-DCJz2VQ_.mjs";
|
|
4
4
|
import uniqBy from "lodash.uniqby";
|
|
5
5
|
|
|
6
6
|
//#region src/endpoints/EndpointBuilder.ts
|
|
@@ -9,9 +9,12 @@ var EndpointBuilder = class extends BaseFunctionBuilder {
|
|
|
9
9
|
_description;
|
|
10
10
|
_status;
|
|
11
11
|
_tags;
|
|
12
|
+
_memorySize;
|
|
12
13
|
_getSession = () => ({});
|
|
13
14
|
_authorize = () => true;
|
|
14
15
|
_rateLimit;
|
|
16
|
+
_availableAuthorizers = [];
|
|
17
|
+
_authorizerName;
|
|
15
18
|
constructor(route, method) {
|
|
16
19
|
super(ConstructType.Endpoint);
|
|
17
20
|
this.route = route;
|
|
@@ -36,6 +39,10 @@ var EndpointBuilder = class extends BaseFunctionBuilder {
|
|
|
36
39
|
this._tags = tags;
|
|
37
40
|
return this;
|
|
38
41
|
}
|
|
42
|
+
memorySize(memorySize) {
|
|
43
|
+
this._memorySize = memorySize;
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
39
46
|
publisher(publisher) {
|
|
40
47
|
this._publisher = publisher;
|
|
41
48
|
return this;
|
|
@@ -59,6 +66,19 @@ var EndpointBuilder = class extends BaseFunctionBuilder {
|
|
|
59
66
|
this._rateLimit = config;
|
|
60
67
|
return this;
|
|
61
68
|
}
|
|
69
|
+
authorizer(name) {
|
|
70
|
+
if (name === "none") {
|
|
71
|
+
this._authorizerName = void 0;
|
|
72
|
+
return this;
|
|
73
|
+
}
|
|
74
|
+
const authorizerExists = this._availableAuthorizers.some((a) => a.name === name);
|
|
75
|
+
if (!authorizerExists && this._availableAuthorizers.length > 0) {
|
|
76
|
+
const available = this._availableAuthorizers.map((a) => a.name).join(", ");
|
|
77
|
+
throw new Error(`Authorizer "${name}" not found in available authorizers: ${available}`);
|
|
78
|
+
}
|
|
79
|
+
this._authorizerName = name;
|
|
80
|
+
return this;
|
|
81
|
+
}
|
|
62
82
|
services(services) {
|
|
63
83
|
this._services = uniqBy([...this._services, ...services], (s) => s.serviceName);
|
|
64
84
|
return this;
|
|
@@ -75,6 +95,7 @@ var EndpointBuilder = class extends BaseFunctionBuilder {
|
|
|
75
95
|
throw new Error("EndpointBuilder does not support generic input. Use body(), query(), or params() instead.");
|
|
76
96
|
}
|
|
77
97
|
handle(fn) {
|
|
98
|
+
const authorizer = this._authorizerName ? this._availableAuthorizers.find((a) => a.name === this._authorizerName) : void 0;
|
|
78
99
|
return new Endpoint({
|
|
79
100
|
fn,
|
|
80
101
|
method: this.method,
|
|
@@ -86,16 +107,18 @@ var EndpointBuilder = class extends BaseFunctionBuilder {
|
|
|
86
107
|
services: this._services,
|
|
87
108
|
logger: this._logger,
|
|
88
109
|
timeout: this._timeout,
|
|
110
|
+
memorySize: this._memorySize,
|
|
89
111
|
authorize: this._authorize,
|
|
90
112
|
status: this._status,
|
|
91
113
|
getSession: this._getSession,
|
|
92
114
|
rateLimit: this._rateLimit,
|
|
93
115
|
publisherService: this._publisher,
|
|
94
|
-
events: this._events
|
|
116
|
+
events: this._events,
|
|
117
|
+
authorizer
|
|
95
118
|
});
|
|
96
119
|
}
|
|
97
120
|
};
|
|
98
121
|
|
|
99
122
|
//#endregion
|
|
100
123
|
export { EndpointBuilder };
|
|
101
|
-
//# sourceMappingURL=EndpointBuilder-
|
|
124
|
+
//# sourceMappingURL=EndpointBuilder-B6xIAruu.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EndpointBuilder-B6xIAruu.mjs","names":["route: TRoute","method: TMethod","publisher: Service<TEventPublisherServiceName, TEventPublisher>","description: string","status: SuccessStatus","event: TEvent","tags: string[]","memorySize: number","publisher: Service<TName, T>","schema: T","config: RateLimitConfig","name: TAuthorizers[number] | 'none'","services: T","logger: T","_schema: any","fn: EndpointHandler<TInput, TServices, TLogger, OutSchema, TSession>"],"sources":["../src/endpoints/EndpointBuilder.ts"],"sourcesContent":["import type { Logger } from '@geekmidas/logger';\nimport type { RateLimitConfig } from '@geekmidas/rate-limit';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport uniqBy from 'lodash.uniqby';\nimport type { Authorizer } from './Authorizer';\nimport { ConstructType } from '../Construct';\nimport { BaseFunctionBuilder } from '../functions';\nimport { Endpoint, type EndpointSchemas } from './Endpoint';\nimport type {\n AuthorizeFn,\n EndpointHandler,\n SessionFn,\n SuccessStatus,\n} from './Endpoint';\n\nimport type { EventPublisher, MappedEvent } from '@geekmidas/events';\nimport type { HttpMethod } from '../types';\n\nexport class EndpointBuilder<\n TRoute extends string,\n TMethod extends HttpMethod,\n TInput extends EndpointSchemas = {},\n TServices extends Service[] = [],\n TLogger extends Logger = Logger,\n OutSchema extends StandardSchemaV1 | undefined = undefined,\n TSession = unknown,\n TEventPublisher extends EventPublisher<any> | undefined = undefined,\n TEventPublisherServiceName extends string = string,\n TAuthorizers extends readonly string[] = readonly string[],\n> extends BaseFunctionBuilder<\n TInput,\n OutSchema,\n TServices,\n TLogger,\n TEventPublisher,\n TEventPublisherServiceName\n> {\n protected schemas: TInput = {} as TInput;\n protected _description?: string;\n protected _status?: SuccessStatus;\n protected _tags?: string[];\n protected _memorySize?: number;\n _getSession: SessionFn<TServices, TLogger, TSession> = () => ({}) as TSession;\n _authorize: AuthorizeFn<TServices, TLogger, TSession> = () => true;\n _rateLimit?: RateLimitConfig;\n _availableAuthorizers: Authorizer[] = [];\n _authorizerName?: TAuthorizers[number];\n\n constructor(\n readonly route: TRoute,\n readonly method: TMethod,\n ) {\n super(ConstructType.Endpoint);\n }\n\n // Internal setter for EndpointFactory to set default publisher\n _setPublisher(\n publisher: Service<TEventPublisherServiceName, TEventPublisher>,\n ) {\n this._publisher = publisher;\n }\n\n description(description: string): this {\n this._description = description;\n return this;\n }\n\n status(status: SuccessStatus): this {\n this._status = status;\n return this;\n }\n\n event<TEvent extends MappedEvent<TEventPublisher, OutSchema>>(\n event: TEvent,\n ): this {\n this._events.push(event);\n return this;\n }\n\n tags(tags: string[]): this {\n this._tags = tags;\n return this;\n }\n\n memorySize(memorySize: number): this {\n this._memorySize = memorySize;\n return this;\n }\n\n publisher<T extends EventPublisher<any>, TName extends string>(\n publisher: Service<TName, T>,\n ): EndpointBuilder<\n TRoute,\n TMethod,\n TInput,\n TServices,\n TLogger,\n OutSchema,\n TSession,\n T,\n TName,\n TAuthorizers\n > {\n this._publisher = publisher as unknown as Service<\n TEventPublisherServiceName,\n TEventPublisher\n >;\n\n return this as unknown as EndpointBuilder<\n TRoute,\n TMethod,\n TInput,\n TServices,\n TLogger,\n OutSchema,\n TSession,\n T,\n TName,\n TAuthorizers\n >;\n }\n\n body<T extends StandardSchemaV1>(\n schema: T,\n ): EndpointBuilder<\n TRoute,\n TMethod,\n Omit<TInput, 'body'> & { body: T },\n TServices,\n TLogger,\n OutSchema,\n TSession,\n TEventPublisher,\n TEventPublisherServiceName,\n TAuthorizers\n > {\n this.schemas.body = schema as unknown as T;\n // @ts-ignore\n return this;\n }\n\n search<T extends StandardSchemaV1>(\n schema: T,\n ): EndpointBuilder<\n TRoute,\n TMethod,\n Omit<TInput, 'query'> & { query: T },\n TServices,\n TLogger,\n OutSchema,\n TSession,\n TEventPublisher,\n TEventPublisherServiceName,\n TAuthorizers\n > {\n this.schemas.query = schema as unknown as T;\n // @ts-ignore\n return this;\n }\n\n query<T extends StandardSchemaV1>(\n schema: T,\n ): EndpointBuilder<\n TRoute,\n TMethod,\n Omit<TInput, 'query'> & { query: T },\n TServices,\n TLogger,\n OutSchema,\n TSession,\n TEventPublisher,\n TEventPublisherServiceName,\n TAuthorizers\n > {\n return this.search(schema);\n }\n\n params<T extends StandardSchemaV1>(\n schema: T,\n ): EndpointBuilder<\n TRoute,\n TMethod,\n Omit<TInput, 'params'> & { params: T },\n TServices,\n TLogger,\n OutSchema,\n TSession,\n TEventPublisher,\n TEventPublisherServiceName,\n TAuthorizers\n > {\n this.schemas.params = schema as unknown as T;\n // @ts-ignore\n return this;\n }\n\n rateLimit(config: RateLimitConfig): this {\n this._rateLimit = config;\n return this;\n }\n\n authorizer(\n name: TAuthorizers[number] | 'none',\n ): EndpointBuilder<\n TRoute,\n TMethod,\n TInput,\n TServices,\n TLogger,\n OutSchema,\n TSession,\n TEventPublisher,\n TEventPublisherServiceName,\n TAuthorizers\n > {\n // Special case: 'none' explicitly marks endpoint as having no authorizer\n if (name === 'none') {\n this._authorizerName = undefined;\n return this;\n }\n\n // Validate that the authorizer exists in available authorizers\n const authorizerExists = this._availableAuthorizers.some(\n (a) => a.name === name,\n );\n if (!authorizerExists && this._availableAuthorizers.length > 0) {\n const available = this._availableAuthorizers.map((a) => a.name).join(', ');\n throw new Error(\n `Authorizer \"${name as string}\" not found in available authorizers: ${available}`,\n );\n }\n this._authorizerName = name;\n return this;\n }\n\n services<T extends Service[]>(\n services: T,\n ): EndpointBuilder<\n TRoute,\n TMethod,\n TInput,\n [...TServices, ...T],\n TLogger,\n OutSchema,\n TSession,\n TEventPublisher,\n TEventPublisherServiceName,\n TAuthorizers\n > {\n this._services = uniqBy(\n [...this._services, ...services],\n (s) => s.serviceName,\n ) as TServices;\n\n return this as unknown as EndpointBuilder<\n TRoute,\n TMethod,\n TInput,\n [...TServices, ...T],\n TLogger,\n OutSchema,\n TSession,\n TEventPublisher,\n TEventPublisherServiceName,\n TAuthorizers\n >;\n }\n\n logger<T extends Logger>(\n logger: T,\n ): EndpointBuilder<\n TRoute,\n TMethod,\n TInput,\n TServices,\n T,\n OutSchema,\n TSession,\n TEventPublisher,\n TEventPublisherServiceName,\n TAuthorizers\n > {\n this._logger = logger as unknown as TLogger;\n\n return this as unknown as EndpointBuilder<\n TRoute,\n TMethod,\n TInput,\n TServices,\n T,\n OutSchema,\n TSession,\n TEventPublisher,\n TEventPublisherServiceName,\n TAuthorizers\n >;\n }\n\n output<T extends StandardSchemaV1>(\n schema: T,\n ): EndpointBuilder<\n TRoute,\n TMethod,\n TInput,\n TServices,\n TLogger,\n T,\n TSession,\n TEventPublisher,\n TEventPublisherServiceName,\n TAuthorizers\n > {\n this.outputSchema = schema as unknown as OutSchema;\n\n return this as unknown as EndpointBuilder<\n TRoute,\n TMethod,\n TInput,\n TServices,\n TLogger,\n T,\n TSession,\n TEventPublisher,\n TEventPublisherServiceName,\n TAuthorizers\n >;\n }\n\n // EndpointBuilder doesn't have a generic input method - it uses body, query, params instead\n input(_schema: any): any {\n throw new Error(\n 'EndpointBuilder does not support generic input. Use body(), query(), or params() instead.',\n );\n }\n\n handle(\n fn: EndpointHandler<TInput, TServices, TLogger, OutSchema, TSession>,\n ): Endpoint<\n TRoute,\n TMethod,\n TInput,\n OutSchema,\n TServices,\n TLogger,\n TSession,\n TEventPublisher\n > {\n // Find authorizer metadata if name is set\n const authorizer = this._authorizerName\n ? this._availableAuthorizers.find((a) => a.name === this._authorizerName)\n : undefined;\n\n return new Endpoint({\n fn,\n method: this.method,\n route: this.route,\n description: this._description,\n tags: this._tags,\n input: this.schemas,\n output: this.outputSchema,\n services: this._services,\n logger: this._logger,\n timeout: this._timeout,\n memorySize: this._memorySize,\n authorize: this._authorize,\n status: this._status,\n getSession: this._getSession,\n rateLimit: this._rateLimit,\n publisherService: this._publisher,\n events: this._events,\n authorizer,\n });\n }\n}\n"],"mappings":";;;;;;AAmBA,IAAa,kBAAb,cAWU,oBAOR;CACA,AAAU,UAAkB,CAAE;CAC9B,AAAU;CACV,AAAU;CACV,AAAU;CACV,AAAU;CACV,cAAuD,OAAO,CAAE;CAChE,aAAwD,MAAM;CAC9D;CACA,wBAAsC,CAAE;CACxC;CAEA,YACWA,OACAC,QACT;AACA,QAAM,cAAc,SAAS;EAHpB;EACA;CAGV;CAGD,cACEC,WACA;AACA,OAAK,aAAa;CACnB;CAED,YAAYC,aAA2B;AACrC,OAAK,eAAe;AACpB,SAAO;CACR;CAED,OAAOC,QAA6B;AAClC,OAAK,UAAU;AACf,SAAO;CACR;CAED,MACEC,OACM;AACN,OAAK,QAAQ,KAAK,MAAM;AACxB,SAAO;CACR;CAED,KAAKC,MAAsB;AACzB,OAAK,QAAQ;AACb,SAAO;CACR;CAED,WAAWC,YAA0B;AACnC,OAAK,cAAc;AACnB,SAAO;CACR;CAED,UACEC,WAYA;AACA,OAAK,aAAa;AAKlB,SAAO;CAYR;CAED,KACEC,QAYA;AACA,OAAK,QAAQ,OAAO;AAEpB,SAAO;CACR;CAED,OACEA,QAYA;AACA,OAAK,QAAQ,QAAQ;AAErB,SAAO;CACR;CAED,MACEA,QAYA;AACA,SAAO,KAAK,OAAO,OAAO;CAC3B;CAED,OACEA,QAYA;AACA,OAAK,QAAQ,SAAS;AAEtB,SAAO;CACR;CAED,UAAUC,QAA+B;AACvC,OAAK,aAAa;AAClB,SAAO;CACR;CAED,WACEC,MAYA;AAEA,MAAI,SAAS,QAAQ;AACnB,QAAK;AACL,UAAO;EACR;EAGD,MAAM,mBAAmB,KAAK,sBAAsB,KAClD,CAAC,MAAM,EAAE,SAAS,KACnB;AACD,OAAK,oBAAoB,KAAK,sBAAsB,SAAS,GAAG;GAC9D,MAAM,YAAY,KAAK,sBAAsB,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,KAAK;AAC1E,SAAM,IAAI,OACP,cAAc,KAAe,wCAAwC,UAAU;EAEnF;AACD,OAAK,kBAAkB;AACvB,SAAO;CACR;CAED,SACEC,UAYA;AACA,OAAK,YAAY,OACf,CAAC,GAAG,KAAK,WAAW,GAAG,QAAS,GAChC,CAAC,MAAM,EAAE,YACV;AAED,SAAO;CAYR;CAED,OACEC,QAYA;AACA,OAAK,UAAU;AAEf,SAAO;CAYR;CAED,OACEJ,QAYA;AACA,OAAK,eAAe;AAEpB,SAAO;CAYR;CAGD,MAAMK,SAAmB;AACvB,QAAM,IAAI,MACR;CAEH;CAED,OACEC,IAUA;EAEA,MAAM,aAAa,KAAK,kBACpB,KAAK,sBAAsB,KAAK,CAAC,MAAM,EAAE,SAAS,KAAK,gBAAgB;AAG3E,SAAO,IAAI,SAAS;GAClB;GACA,QAAQ,KAAK;GACb,OAAO,KAAK;GACZ,aAAa,KAAK;GAClB,MAAM,KAAK;GACX,OAAO,KAAK;GACZ,QAAQ,KAAK;GACb,UAAU,KAAK;GACf,QAAQ,KAAK;GACb,SAAS,KAAK;GACd,YAAY,KAAK;GACjB,WAAW,KAAK;GAChB,QAAQ,KAAK;GACb,YAAY,KAAK;GACjB,WAAW,KAAK;GAChB,kBAAkB,KAAK;GACvB,QAAQ,KAAK;GACb;EACD;CACF;AACF"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { HttpMethod } from "./types-CVq20-fE.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { Authorizer } from "./Authorizer-Bbk9ziuG.mjs";
|
|
3
|
+
import { BaseFunctionBuilder } from "./BaseFunctionBuilder-CxBX0arJ.mjs";
|
|
4
|
+
import { AuthorizeFn, Endpoint, EndpointHandler, EndpointSchemas, SessionFn, SuccessStatus } from "./Endpoint-C16whGI-.mjs";
|
|
4
5
|
import { Service } from "@geekmidas/services";
|
|
5
6
|
import { RateLimitConfig } from "@geekmidas/rate-limit";
|
|
6
7
|
import { EventPublisher, MappedEvent } from "@geekmidas/events";
|
|
@@ -8,42 +9,47 @@ import { Logger } from "@geekmidas/logger";
|
|
|
8
9
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
9
10
|
|
|
10
11
|
//#region src/endpoints/EndpointBuilder.d.ts
|
|
11
|
-
declare class EndpointBuilder<TRoute extends string, TMethod extends HttpMethod, TInput extends EndpointSchemas = {}, TServices extends Service[] = [], TLogger extends Logger = Logger, OutSchema extends StandardSchemaV1 | undefined = undefined, TSession = unknown, TEventPublisher extends EventPublisher<any> | undefined = undefined, TEventPublisherServiceName extends string = string> extends BaseFunctionBuilder<TInput, OutSchema, TServices, TLogger, TEventPublisher, TEventPublisherServiceName> {
|
|
12
|
+
declare class EndpointBuilder<TRoute extends string, TMethod extends HttpMethod, TInput extends EndpointSchemas = {}, TServices extends Service[] = [], TLogger extends Logger = Logger, OutSchema extends StandardSchemaV1 | undefined = undefined, TSession = unknown, TEventPublisher extends EventPublisher<any> | undefined = undefined, TEventPublisherServiceName extends string = string, TAuthorizers extends readonly string[] = readonly string[]> extends BaseFunctionBuilder<TInput, OutSchema, TServices, TLogger, TEventPublisher, TEventPublisherServiceName> {
|
|
12
13
|
readonly route: TRoute;
|
|
13
14
|
readonly method: TMethod;
|
|
14
15
|
protected schemas: TInput;
|
|
15
16
|
protected _description?: string;
|
|
16
17
|
protected _status?: SuccessStatus;
|
|
17
18
|
protected _tags?: string[];
|
|
19
|
+
protected _memorySize?: number;
|
|
18
20
|
_getSession: SessionFn<TServices, TLogger, TSession>;
|
|
19
21
|
_authorize: AuthorizeFn<TServices, TLogger, TSession>;
|
|
20
22
|
_rateLimit?: RateLimitConfig;
|
|
23
|
+
_availableAuthorizers: Authorizer[];
|
|
24
|
+
_authorizerName?: TAuthorizers[number];
|
|
21
25
|
constructor(route: TRoute, method: TMethod);
|
|
22
26
|
_setPublisher(publisher: Service<TEventPublisherServiceName, TEventPublisher>): void;
|
|
23
27
|
description(description: string): this;
|
|
24
28
|
status(status: SuccessStatus): this;
|
|
25
29
|
event<TEvent extends MappedEvent<TEventPublisher, OutSchema>>(event: TEvent): this;
|
|
26
30
|
tags(tags: string[]): this;
|
|
27
|
-
|
|
31
|
+
memorySize(memorySize: number): this;
|
|
32
|
+
publisher<T extends EventPublisher<any>, TName extends string>(publisher: Service<TName, T>): EndpointBuilder<TRoute, TMethod, TInput, TServices, TLogger, OutSchema, TSession, T, TName, TAuthorizers>;
|
|
28
33
|
body<T extends StandardSchemaV1>(schema: T): EndpointBuilder<TRoute, TMethod, Omit<TInput, 'body'> & {
|
|
29
34
|
body: T;
|
|
30
|
-
}, TServices, TLogger, OutSchema, TSession, TEventPublisher>;
|
|
35
|
+
}, TServices, TLogger, OutSchema, TSession, TEventPublisher, TEventPublisherServiceName, TAuthorizers>;
|
|
31
36
|
search<T extends StandardSchemaV1>(schema: T): EndpointBuilder<TRoute, TMethod, Omit<TInput, 'query'> & {
|
|
32
37
|
query: T;
|
|
33
|
-
}, TServices, TLogger, OutSchema, TSession, TEventPublisher>;
|
|
38
|
+
}, TServices, TLogger, OutSchema, TSession, TEventPublisher, TEventPublisherServiceName, TAuthorizers>;
|
|
34
39
|
query<T extends StandardSchemaV1>(schema: T): EndpointBuilder<TRoute, TMethod, Omit<TInput, 'query'> & {
|
|
35
40
|
query: T;
|
|
36
|
-
}, TServices, TLogger, OutSchema, TSession, TEventPublisher>;
|
|
41
|
+
}, TServices, TLogger, OutSchema, TSession, TEventPublisher, TEventPublisherServiceName, TAuthorizers>;
|
|
37
42
|
params<T extends StandardSchemaV1>(schema: T): EndpointBuilder<TRoute, TMethod, Omit<TInput, 'params'> & {
|
|
38
43
|
params: T;
|
|
39
|
-
}, TServices, TLogger, OutSchema, TSession, TEventPublisher>;
|
|
44
|
+
}, TServices, TLogger, OutSchema, TSession, TEventPublisher, TEventPublisherServiceName, TAuthorizers>;
|
|
40
45
|
rateLimit(config: RateLimitConfig): this;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
authorizer(name: TAuthorizers[number] | 'none'): EndpointBuilder<TRoute, TMethod, TInput, TServices, TLogger, OutSchema, TSession, TEventPublisher, TEventPublisherServiceName, TAuthorizers>;
|
|
47
|
+
services<T extends Service[]>(services: T): EndpointBuilder<TRoute, TMethod, TInput, [...TServices, ...T], TLogger, OutSchema, TSession, TEventPublisher, TEventPublisherServiceName, TAuthorizers>;
|
|
48
|
+
logger<T extends Logger>(logger: T): EndpointBuilder<TRoute, TMethod, TInput, TServices, T, OutSchema, TSession, TEventPublisher, TEventPublisherServiceName, TAuthorizers>;
|
|
49
|
+
output<T extends StandardSchemaV1>(schema: T): EndpointBuilder<TRoute, TMethod, TInput, TServices, TLogger, T, TSession, TEventPublisher, TEventPublisherServiceName, TAuthorizers>;
|
|
44
50
|
input(_schema: any): any;
|
|
45
51
|
handle(fn: EndpointHandler<TInput, TServices, TLogger, OutSchema, TSession>): Endpoint<TRoute, TMethod, TInput, OutSchema, TServices, TLogger, TSession, TEventPublisher>;
|
|
46
52
|
}
|
|
47
53
|
//#endregion
|
|
48
54
|
export { EndpointBuilder };
|
|
49
|
-
//# sourceMappingURL=EndpointBuilder-
|
|
55
|
+
//# sourceMappingURL=EndpointBuilder-BzqR0xvt.d.mts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
-
const require_Construct = require('./Construct-
|
|
3
|
-
const require_BaseFunctionBuilder = require('./BaseFunctionBuilder-
|
|
4
|
-
const require_Endpoint = require('./Endpoint-
|
|
2
|
+
const require_Construct = require('./Construct-BtfN2fcm.cjs');
|
|
3
|
+
const require_BaseFunctionBuilder = require('./BaseFunctionBuilder-B-kdtkzI.cjs');
|
|
4
|
+
const require_Endpoint = require('./Endpoint-Bghj0fiL.cjs');
|
|
5
5
|
const lodash_uniqby = require_chunk.__toESM(require("lodash.uniqby"));
|
|
6
6
|
|
|
7
7
|
//#region src/endpoints/EndpointBuilder.ts
|
|
@@ -10,9 +10,12 @@ var EndpointBuilder = class extends require_BaseFunctionBuilder.BaseFunctionBuil
|
|
|
10
10
|
_description;
|
|
11
11
|
_status;
|
|
12
12
|
_tags;
|
|
13
|
+
_memorySize;
|
|
13
14
|
_getSession = () => ({});
|
|
14
15
|
_authorize = () => true;
|
|
15
16
|
_rateLimit;
|
|
17
|
+
_availableAuthorizers = [];
|
|
18
|
+
_authorizerName;
|
|
16
19
|
constructor(route, method) {
|
|
17
20
|
super(require_Construct.ConstructType.Endpoint);
|
|
18
21
|
this.route = route;
|
|
@@ -37,6 +40,10 @@ var EndpointBuilder = class extends require_BaseFunctionBuilder.BaseFunctionBuil
|
|
|
37
40
|
this._tags = tags;
|
|
38
41
|
return this;
|
|
39
42
|
}
|
|
43
|
+
memorySize(memorySize) {
|
|
44
|
+
this._memorySize = memorySize;
|
|
45
|
+
return this;
|
|
46
|
+
}
|
|
40
47
|
publisher(publisher) {
|
|
41
48
|
this._publisher = publisher;
|
|
42
49
|
return this;
|
|
@@ -60,6 +67,19 @@ var EndpointBuilder = class extends require_BaseFunctionBuilder.BaseFunctionBuil
|
|
|
60
67
|
this._rateLimit = config;
|
|
61
68
|
return this;
|
|
62
69
|
}
|
|
70
|
+
authorizer(name) {
|
|
71
|
+
if (name === "none") {
|
|
72
|
+
this._authorizerName = void 0;
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
const authorizerExists = this._availableAuthorizers.some((a) => a.name === name);
|
|
76
|
+
if (!authorizerExists && this._availableAuthorizers.length > 0) {
|
|
77
|
+
const available = this._availableAuthorizers.map((a) => a.name).join(", ");
|
|
78
|
+
throw new Error(`Authorizer "${name}" not found in available authorizers: ${available}`);
|
|
79
|
+
}
|
|
80
|
+
this._authorizerName = name;
|
|
81
|
+
return this;
|
|
82
|
+
}
|
|
63
83
|
services(services) {
|
|
64
84
|
this._services = (0, lodash_uniqby.default)([...this._services, ...services], (s) => s.serviceName);
|
|
65
85
|
return this;
|
|
@@ -76,6 +96,7 @@ var EndpointBuilder = class extends require_BaseFunctionBuilder.BaseFunctionBuil
|
|
|
76
96
|
throw new Error("EndpointBuilder does not support generic input. Use body(), query(), or params() instead.");
|
|
77
97
|
}
|
|
78
98
|
handle(fn) {
|
|
99
|
+
const authorizer = this._authorizerName ? this._availableAuthorizers.find((a) => a.name === this._authorizerName) : void 0;
|
|
79
100
|
return new require_Endpoint.Endpoint({
|
|
80
101
|
fn,
|
|
81
102
|
method: this.method,
|
|
@@ -87,12 +108,14 @@ var EndpointBuilder = class extends require_BaseFunctionBuilder.BaseFunctionBuil
|
|
|
87
108
|
services: this._services,
|
|
88
109
|
logger: this._logger,
|
|
89
110
|
timeout: this._timeout,
|
|
111
|
+
memorySize: this._memorySize,
|
|
90
112
|
authorize: this._authorize,
|
|
91
113
|
status: this._status,
|
|
92
114
|
getSession: this._getSession,
|
|
93
115
|
rateLimit: this._rateLimit,
|
|
94
116
|
publisherService: this._publisher,
|
|
95
|
-
events: this._events
|
|
117
|
+
events: this._events,
|
|
118
|
+
authorizer
|
|
96
119
|
});
|
|
97
120
|
}
|
|
98
121
|
};
|
|
@@ -104,4 +127,4 @@ Object.defineProperty(exports, 'EndpointBuilder', {
|
|
|
104
127
|
return EndpointBuilder;
|
|
105
128
|
}
|
|
106
129
|
});
|
|
107
|
-
//# sourceMappingURL=EndpointBuilder-
|
|
130
|
+
//# sourceMappingURL=EndpointBuilder-i7-4ieP_.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EndpointBuilder-i7-4ieP_.cjs","names":["BaseFunctionBuilder","route: TRoute","method: TMethod","ConstructType","publisher: Service<TEventPublisherServiceName, TEventPublisher>","description: string","status: SuccessStatus","event: TEvent","tags: string[]","memorySize: number","publisher: Service<TName, T>","schema: T","config: RateLimitConfig","name: TAuthorizers[number] | 'none'","services: T","logger: T","_schema: any","fn: EndpointHandler<TInput, TServices, TLogger, OutSchema, TSession>","Endpoint"],"sources":["../src/endpoints/EndpointBuilder.ts"],"sourcesContent":["import type { Logger } from '@geekmidas/logger';\nimport type { RateLimitConfig } from '@geekmidas/rate-limit';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport uniqBy from 'lodash.uniqby';\nimport type { Authorizer } from './Authorizer';\nimport { ConstructType } from '../Construct';\nimport { BaseFunctionBuilder } from '../functions';\nimport { Endpoint, type EndpointSchemas } from './Endpoint';\nimport type {\n AuthorizeFn,\n EndpointHandler,\n SessionFn,\n SuccessStatus,\n} from './Endpoint';\n\nimport type { EventPublisher, MappedEvent } from '@geekmidas/events';\nimport type { HttpMethod } from '../types';\n\nexport class EndpointBuilder<\n TRoute extends string,\n TMethod extends HttpMethod,\n TInput extends EndpointSchemas = {},\n TServices extends Service[] = [],\n TLogger extends Logger = Logger,\n OutSchema extends StandardSchemaV1 | undefined = undefined,\n TSession = unknown,\n TEventPublisher extends EventPublisher<any> | undefined = undefined,\n TEventPublisherServiceName extends string = string,\n TAuthorizers extends readonly string[] = readonly string[],\n> extends BaseFunctionBuilder<\n TInput,\n OutSchema,\n TServices,\n TLogger,\n TEventPublisher,\n TEventPublisherServiceName\n> {\n protected schemas: TInput = {} as TInput;\n protected _description?: string;\n protected _status?: SuccessStatus;\n protected _tags?: string[];\n protected _memorySize?: number;\n _getSession: SessionFn<TServices, TLogger, TSession> = () => ({}) as TSession;\n _authorize: AuthorizeFn<TServices, TLogger, TSession> = () => true;\n _rateLimit?: RateLimitConfig;\n _availableAuthorizers: Authorizer[] = [];\n _authorizerName?: TAuthorizers[number];\n\n constructor(\n readonly route: TRoute,\n readonly method: TMethod,\n ) {\n super(ConstructType.Endpoint);\n }\n\n // Internal setter for EndpointFactory to set default publisher\n _setPublisher(\n publisher: Service<TEventPublisherServiceName, TEventPublisher>,\n ) {\n this._publisher = publisher;\n }\n\n description(description: string): this {\n this._description = description;\n return this;\n }\n\n status(status: SuccessStatus): this {\n this._status = status;\n return this;\n }\n\n event<TEvent extends MappedEvent<TEventPublisher, OutSchema>>(\n event: TEvent,\n ): this {\n this._events.push(event);\n return this;\n }\n\n tags(tags: string[]): this {\n this._tags = tags;\n return this;\n }\n\n memorySize(memorySize: number): this {\n this._memorySize = memorySize;\n return this;\n }\n\n publisher<T extends EventPublisher<any>, TName extends string>(\n publisher: Service<TName, T>,\n ): EndpointBuilder<\n TRoute,\n TMethod,\n TInput,\n TServices,\n TLogger,\n OutSchema,\n TSession,\n T,\n TName,\n TAuthorizers\n > {\n this._publisher = publisher as unknown as Service<\n TEventPublisherServiceName,\n TEventPublisher\n >;\n\n return this as unknown as EndpointBuilder<\n TRoute,\n TMethod,\n TInput,\n TServices,\n TLogger,\n OutSchema,\n TSession,\n T,\n TName,\n TAuthorizers\n >;\n }\n\n body<T extends StandardSchemaV1>(\n schema: T,\n ): EndpointBuilder<\n TRoute,\n TMethod,\n Omit<TInput, 'body'> & { body: T },\n TServices,\n TLogger,\n OutSchema,\n TSession,\n TEventPublisher,\n TEventPublisherServiceName,\n TAuthorizers\n > {\n this.schemas.body = schema as unknown as T;\n // @ts-ignore\n return this;\n }\n\n search<T extends StandardSchemaV1>(\n schema: T,\n ): EndpointBuilder<\n TRoute,\n TMethod,\n Omit<TInput, 'query'> & { query: T },\n TServices,\n TLogger,\n OutSchema,\n TSession,\n TEventPublisher,\n TEventPublisherServiceName,\n TAuthorizers\n > {\n this.schemas.query = schema as unknown as T;\n // @ts-ignore\n return this;\n }\n\n query<T extends StandardSchemaV1>(\n schema: T,\n ): EndpointBuilder<\n TRoute,\n TMethod,\n Omit<TInput, 'query'> & { query: T },\n TServices,\n TLogger,\n OutSchema,\n TSession,\n TEventPublisher,\n TEventPublisherServiceName,\n TAuthorizers\n > {\n return this.search(schema);\n }\n\n params<T extends StandardSchemaV1>(\n schema: T,\n ): EndpointBuilder<\n TRoute,\n TMethod,\n Omit<TInput, 'params'> & { params: T },\n TServices,\n TLogger,\n OutSchema,\n TSession,\n TEventPublisher,\n TEventPublisherServiceName,\n TAuthorizers\n > {\n this.schemas.params = schema as unknown as T;\n // @ts-ignore\n return this;\n }\n\n rateLimit(config: RateLimitConfig): this {\n this._rateLimit = config;\n return this;\n }\n\n authorizer(\n name: TAuthorizers[number] | 'none',\n ): EndpointBuilder<\n TRoute,\n TMethod,\n TInput,\n TServices,\n TLogger,\n OutSchema,\n TSession,\n TEventPublisher,\n TEventPublisherServiceName,\n TAuthorizers\n > {\n // Special case: 'none' explicitly marks endpoint as having no authorizer\n if (name === 'none') {\n this._authorizerName = undefined;\n return this;\n }\n\n // Validate that the authorizer exists in available authorizers\n const authorizerExists = this._availableAuthorizers.some(\n (a) => a.name === name,\n );\n if (!authorizerExists && this._availableAuthorizers.length > 0) {\n const available = this._availableAuthorizers.map((a) => a.name).join(', ');\n throw new Error(\n `Authorizer \"${name as string}\" not found in available authorizers: ${available}`,\n );\n }\n this._authorizerName = name;\n return this;\n }\n\n services<T extends Service[]>(\n services: T,\n ): EndpointBuilder<\n TRoute,\n TMethod,\n TInput,\n [...TServices, ...T],\n TLogger,\n OutSchema,\n TSession,\n TEventPublisher,\n TEventPublisherServiceName,\n TAuthorizers\n > {\n this._services = uniqBy(\n [...this._services, ...services],\n (s) => s.serviceName,\n ) as TServices;\n\n return this as unknown as EndpointBuilder<\n TRoute,\n TMethod,\n TInput,\n [...TServices, ...T],\n TLogger,\n OutSchema,\n TSession,\n TEventPublisher,\n TEventPublisherServiceName,\n TAuthorizers\n >;\n }\n\n logger<T extends Logger>(\n logger: T,\n ): EndpointBuilder<\n TRoute,\n TMethod,\n TInput,\n TServices,\n T,\n OutSchema,\n TSession,\n TEventPublisher,\n TEventPublisherServiceName,\n TAuthorizers\n > {\n this._logger = logger as unknown as TLogger;\n\n return this as unknown as EndpointBuilder<\n TRoute,\n TMethod,\n TInput,\n TServices,\n T,\n OutSchema,\n TSession,\n TEventPublisher,\n TEventPublisherServiceName,\n TAuthorizers\n >;\n }\n\n output<T extends StandardSchemaV1>(\n schema: T,\n ): EndpointBuilder<\n TRoute,\n TMethod,\n TInput,\n TServices,\n TLogger,\n T,\n TSession,\n TEventPublisher,\n TEventPublisherServiceName,\n TAuthorizers\n > {\n this.outputSchema = schema as unknown as OutSchema;\n\n return this as unknown as EndpointBuilder<\n TRoute,\n TMethod,\n TInput,\n TServices,\n TLogger,\n T,\n TSession,\n TEventPublisher,\n TEventPublisherServiceName,\n TAuthorizers\n >;\n }\n\n // EndpointBuilder doesn't have a generic input method - it uses body, query, params instead\n input(_schema: any): any {\n throw new Error(\n 'EndpointBuilder does not support generic input. Use body(), query(), or params() instead.',\n );\n }\n\n handle(\n fn: EndpointHandler<TInput, TServices, TLogger, OutSchema, TSession>,\n ): Endpoint<\n TRoute,\n TMethod,\n TInput,\n OutSchema,\n TServices,\n TLogger,\n TSession,\n TEventPublisher\n > {\n // Find authorizer metadata if name is set\n const authorizer = this._authorizerName\n ? this._availableAuthorizers.find((a) => a.name === this._authorizerName)\n : undefined;\n\n return new Endpoint({\n fn,\n method: this.method,\n route: this.route,\n description: this._description,\n tags: this._tags,\n input: this.schemas,\n output: this.outputSchema,\n services: this._services,\n logger: this._logger,\n timeout: this._timeout,\n memorySize: this._memorySize,\n authorize: this._authorize,\n status: this._status,\n getSession: this._getSession,\n rateLimit: this._rateLimit,\n publisherService: this._publisher,\n events: this._events,\n authorizer,\n });\n }\n}\n"],"mappings":";;;;;;;AAmBA,IAAa,kBAAb,cAWUA,gDAOR;CACA,AAAU,UAAkB,CAAE;CAC9B,AAAU;CACV,AAAU;CACV,AAAU;CACV,AAAU;CACV,cAAuD,OAAO,CAAE;CAChE,aAAwD,MAAM;CAC9D;CACA,wBAAsC,CAAE;CACxC;CAEA,YACWC,OACAC,QACT;AACA,QAAMC,gCAAc,SAAS;EAHpB;EACA;CAGV;CAGD,cACEC,WACA;AACA,OAAK,aAAa;CACnB;CAED,YAAYC,aAA2B;AACrC,OAAK,eAAe;AACpB,SAAO;CACR;CAED,OAAOC,QAA6B;AAClC,OAAK,UAAU;AACf,SAAO;CACR;CAED,MACEC,OACM;AACN,OAAK,QAAQ,KAAK,MAAM;AACxB,SAAO;CACR;CAED,KAAKC,MAAsB;AACzB,OAAK,QAAQ;AACb,SAAO;CACR;CAED,WAAWC,YAA0B;AACnC,OAAK,cAAc;AACnB,SAAO;CACR;CAED,UACEC,WAYA;AACA,OAAK,aAAa;AAKlB,SAAO;CAYR;CAED,KACEC,QAYA;AACA,OAAK,QAAQ,OAAO;AAEpB,SAAO;CACR;CAED,OACEA,QAYA;AACA,OAAK,QAAQ,QAAQ;AAErB,SAAO;CACR;CAED,MACEA,QAYA;AACA,SAAO,KAAK,OAAO,OAAO;CAC3B;CAED,OACEA,QAYA;AACA,OAAK,QAAQ,SAAS;AAEtB,SAAO;CACR;CAED,UAAUC,QAA+B;AACvC,OAAK,aAAa;AAClB,SAAO;CACR;CAED,WACEC,MAYA;AAEA,MAAI,SAAS,QAAQ;AACnB,QAAK;AACL,UAAO;EACR;EAGD,MAAM,mBAAmB,KAAK,sBAAsB,KAClD,CAAC,MAAM,EAAE,SAAS,KACnB;AACD,OAAK,oBAAoB,KAAK,sBAAsB,SAAS,GAAG;GAC9D,MAAM,YAAY,KAAK,sBAAsB,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,KAAK;AAC1E,SAAM,IAAI,OACP,cAAc,KAAe,wCAAwC,UAAU;EAEnF;AACD,OAAK,kBAAkB;AACvB,SAAO;CACR;CAED,SACEC,UAYA;AACA,OAAK,YAAY,2BACf,CAAC,GAAG,KAAK,WAAW,GAAG,QAAS,GAChC,CAAC,MAAM,EAAE,YACV;AAED,SAAO;CAYR;CAED,OACEC,QAYA;AACA,OAAK,UAAU;AAEf,SAAO;CAYR;CAED,OACEJ,QAYA;AACA,OAAK,eAAe;AAEpB,SAAO;CAYR;CAGD,MAAMK,SAAmB;AACvB,QAAM,IAAI,MACR;CAEH;CAED,OACEC,IAUA;EAEA,MAAM,aAAa,KAAK,kBACpB,KAAK,sBAAsB,KAAK,CAAC,MAAM,EAAE,SAAS,KAAK,gBAAgB;AAG3E,SAAO,IAAIC,0BAAS;GAClB;GACA,QAAQ,KAAK;GACb,OAAO,KAAK;GACZ,aAAa,KAAK;GAClB,MAAM,KAAK;GACX,OAAO,KAAK;GACZ,QAAQ,KAAK;GACb,UAAU,KAAK;GACf,QAAQ,KAAK;GACb,SAAS,KAAK;GACd,YAAY,KAAK;GACjB,WAAW,KAAK;GAChB,QAAQ,KAAK;GACb,YAAY,KAAK;GACjB,WAAW,KAAK;GAChB,kBAAkB,KAAK;GACvB,QAAQ,KAAK;GACb;EACD;CACF;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
-
const require_EndpointBuilder = require('./EndpointBuilder-
|
|
2
|
+
const require_EndpointBuilder = require('./EndpointBuilder-i7-4ieP_.cjs');
|
|
3
3
|
const lodash_uniqby = require_chunk.__toESM(require("lodash.uniqby"));
|
|
4
4
|
const __geekmidas_logger_console = require_chunk.__toESM(require("@geekmidas/logger/console"));
|
|
5
5
|
|
|
@@ -12,13 +12,17 @@ var EndpointFactory = class EndpointFactory {
|
|
|
12
12
|
defaultEventPublisher;
|
|
13
13
|
defaultSessionExtractor;
|
|
14
14
|
defaultLogger = DEFAULT_LOGGER;
|
|
15
|
-
|
|
15
|
+
availableAuthorizers = [];
|
|
16
|
+
defaultAuthorizerName;
|
|
17
|
+
constructor({ basePath, defaultAuthorizeFn, defaultLogger, defaultSessionExtractor, defaultServices = [], defaultEventPublisher, availableAuthorizers = [], defaultAuthorizerName } = {}) {
|
|
16
18
|
this.defaultServices = (0, lodash_uniqby.default)(defaultServices, (s) => s.serviceName);
|
|
17
19
|
this.basePath = basePath || "";
|
|
18
20
|
this.defaultAuthorizeFn = defaultAuthorizeFn;
|
|
19
21
|
this.defaultLogger = defaultLogger || DEFAULT_LOGGER;
|
|
20
22
|
this.defaultSessionExtractor = defaultSessionExtractor;
|
|
21
23
|
this.defaultEventPublisher = defaultEventPublisher;
|
|
24
|
+
this.availableAuthorizers = availableAuthorizers;
|
|
25
|
+
this.defaultAuthorizerName = defaultAuthorizerName;
|
|
22
26
|
}
|
|
23
27
|
static joinPaths(path, basePath = "") {
|
|
24
28
|
if (!basePath && !path) return "/";
|
|
@@ -32,6 +36,19 @@ var EndpointFactory = class EndpointFactory {
|
|
|
32
36
|
if (result.length > 1 && result.endsWith("/")) result = result.slice(0, -1);
|
|
33
37
|
return result;
|
|
34
38
|
}
|
|
39
|
+
authorizers(authorizers) {
|
|
40
|
+
const authorizerConfigs = authorizers.map((name) => ({ name }));
|
|
41
|
+
return new EndpointFactory({
|
|
42
|
+
defaultServices: this.defaultServices,
|
|
43
|
+
basePath: this.basePath,
|
|
44
|
+
defaultAuthorizeFn: this.defaultAuthorizeFn,
|
|
45
|
+
defaultLogger: this.defaultLogger,
|
|
46
|
+
defaultSessionExtractor: this.defaultSessionExtractor,
|
|
47
|
+
defaultEventPublisher: this.defaultEventPublisher,
|
|
48
|
+
availableAuthorizers: authorizerConfigs,
|
|
49
|
+
defaultAuthorizerName: this.defaultAuthorizerName
|
|
50
|
+
});
|
|
51
|
+
}
|
|
35
52
|
route(path) {
|
|
36
53
|
const newBasePath = EndpointFactory.joinPaths(path, this.basePath);
|
|
37
54
|
return new EndpointFactory({
|
|
@@ -40,7 +57,9 @@ var EndpointFactory = class EndpointFactory {
|
|
|
40
57
|
defaultAuthorizeFn: this.defaultAuthorizeFn,
|
|
41
58
|
defaultLogger: this.defaultLogger,
|
|
42
59
|
defaultSessionExtractor: this.defaultSessionExtractor,
|
|
43
|
-
defaultEventPublisher: this.defaultEventPublisher
|
|
60
|
+
defaultEventPublisher: this.defaultEventPublisher,
|
|
61
|
+
availableAuthorizers: this.availableAuthorizers,
|
|
62
|
+
defaultAuthorizerName: this.defaultAuthorizerName
|
|
44
63
|
});
|
|
45
64
|
}
|
|
46
65
|
authorize(fn) {
|
|
@@ -50,7 +69,9 @@ var EndpointFactory = class EndpointFactory {
|
|
|
50
69
|
defaultAuthorizeFn: fn,
|
|
51
70
|
defaultLogger: this.defaultLogger,
|
|
52
71
|
defaultSessionExtractor: this.defaultSessionExtractor,
|
|
53
|
-
defaultEventPublisher: this.defaultEventPublisher
|
|
72
|
+
defaultEventPublisher: this.defaultEventPublisher,
|
|
73
|
+
availableAuthorizers: this.availableAuthorizers,
|
|
74
|
+
defaultAuthorizerName: this.defaultAuthorizerName
|
|
54
75
|
});
|
|
55
76
|
}
|
|
56
77
|
services(services) {
|
|
@@ -60,7 +81,9 @@ var EndpointFactory = class EndpointFactory {
|
|
|
60
81
|
defaultAuthorizeFn: this.defaultAuthorizeFn,
|
|
61
82
|
defaultLogger: this.defaultLogger,
|
|
62
83
|
defaultSessionExtractor: this.defaultSessionExtractor,
|
|
63
|
-
defaultEventPublisher: this.defaultEventPublisher
|
|
84
|
+
defaultEventPublisher: this.defaultEventPublisher,
|
|
85
|
+
availableAuthorizers: this.availableAuthorizers,
|
|
86
|
+
defaultAuthorizerName: this.defaultAuthorizerName
|
|
64
87
|
});
|
|
65
88
|
}
|
|
66
89
|
logger(logger) {
|
|
@@ -70,7 +93,9 @@ var EndpointFactory = class EndpointFactory {
|
|
|
70
93
|
defaultAuthorizeFn: this.defaultAuthorizeFn,
|
|
71
94
|
defaultLogger: logger,
|
|
72
95
|
defaultSessionExtractor: this.defaultSessionExtractor,
|
|
73
|
-
defaultEventPublisher: this.defaultEventPublisher
|
|
96
|
+
defaultEventPublisher: this.defaultEventPublisher,
|
|
97
|
+
availableAuthorizers: this.availableAuthorizers,
|
|
98
|
+
defaultAuthorizerName: this.defaultAuthorizerName
|
|
74
99
|
});
|
|
75
100
|
}
|
|
76
101
|
publisher(publisher) {
|
|
@@ -80,7 +105,9 @@ var EndpointFactory = class EndpointFactory {
|
|
|
80
105
|
defaultAuthorizeFn: this.defaultAuthorizeFn,
|
|
81
106
|
defaultLogger: this.defaultLogger,
|
|
82
107
|
defaultSessionExtractor: this.defaultSessionExtractor,
|
|
83
|
-
defaultEventPublisher: publisher
|
|
108
|
+
defaultEventPublisher: publisher,
|
|
109
|
+
availableAuthorizers: this.availableAuthorizers,
|
|
110
|
+
defaultAuthorizerName: this.defaultAuthorizerName
|
|
84
111
|
});
|
|
85
112
|
}
|
|
86
113
|
session(session) {
|
|
@@ -90,17 +117,21 @@ var EndpointFactory = class EndpointFactory {
|
|
|
90
117
|
defaultAuthorizeFn: this.defaultAuthorizeFn,
|
|
91
118
|
defaultLogger: this.defaultLogger,
|
|
92
119
|
defaultSessionExtractor: session,
|
|
93
|
-
defaultEventPublisher: this.defaultEventPublisher
|
|
120
|
+
defaultEventPublisher: this.defaultEventPublisher,
|
|
121
|
+
availableAuthorizers: this.availableAuthorizers,
|
|
122
|
+
defaultAuthorizerName: this.defaultAuthorizerName
|
|
94
123
|
});
|
|
95
124
|
}
|
|
96
125
|
createBuilder(method, path) {
|
|
97
126
|
const fullPath = EndpointFactory.joinPaths(path, this.basePath);
|
|
98
127
|
const builder = new require_EndpointBuilder.EndpointBuilder(fullPath, method);
|
|
99
128
|
if (this.defaultAuthorizeFn) builder._authorize = this.defaultAuthorizeFn;
|
|
100
|
-
if (this.defaultServices.length) builder._services = this.defaultServices;
|
|
129
|
+
if (this.defaultServices.length) builder._services = [...this.defaultServices];
|
|
101
130
|
if (this.defaultLogger) builder._logger = this.defaultLogger;
|
|
102
131
|
if (this.defaultSessionExtractor) builder._getSession = this.defaultSessionExtractor;
|
|
103
132
|
if (this.defaultEventPublisher) builder._setPublisher(this.defaultEventPublisher);
|
|
133
|
+
builder._availableAuthorizers = this.availableAuthorizers;
|
|
134
|
+
if (this.defaultAuthorizerName) builder._authorizerName = this.defaultAuthorizerName;
|
|
104
135
|
return builder;
|
|
105
136
|
}
|
|
106
137
|
post(path) {
|
|
@@ -137,4 +168,4 @@ Object.defineProperty(exports, 'e', {
|
|
|
137
168
|
return e;
|
|
138
169
|
}
|
|
139
170
|
});
|
|
140
|
-
//# sourceMappingURL=EndpointFactory-
|
|
171
|
+
//# sourceMappingURL=EndpointFactory-CYTBPu_G.cjs.map
|