@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
|
@@ -393,28 +393,19 @@ describe('TestEndpointAdaptor', () => {
|
|
|
393
393
|
});
|
|
394
394
|
|
|
395
395
|
const adapter = new TestEndpointAdaptor(endpoint);
|
|
396
|
-
const result = await adapter.
|
|
396
|
+
const result = await adapter.fullRequest({
|
|
397
397
|
body: { email: 'test@example.com', password: 'pass123' },
|
|
398
398
|
services: mockServices,
|
|
399
399
|
headers: { host: 'example.com' },
|
|
400
400
|
});
|
|
401
401
|
|
|
402
|
-
expect(result).
|
|
403
|
-
expect(result).toHaveProperty('metadata');
|
|
404
|
-
expect((result as any).data).toEqual({
|
|
402
|
+
expect(result.body).toEqual({
|
|
405
403
|
id: 'user-1',
|
|
406
404
|
email: 'test@example.com',
|
|
407
405
|
});
|
|
408
|
-
expect(
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
options: {
|
|
412
|
-
httpOnly: true,
|
|
413
|
-
secure: true,
|
|
414
|
-
sameSite: 'strict',
|
|
415
|
-
maxAge: 3600,
|
|
416
|
-
},
|
|
417
|
-
});
|
|
406
|
+
expect(result.headers['set-cookie']).toEqual([
|
|
407
|
+
'session=abc123; Max-Age=3600; HttpOnly; Secure; SameSite=strict',
|
|
408
|
+
]);
|
|
418
409
|
});
|
|
419
410
|
|
|
420
411
|
it('should set custom response headers', async () => {
|
|
@@ -431,17 +422,17 @@ describe('TestEndpointAdaptor', () => {
|
|
|
431
422
|
});
|
|
432
423
|
|
|
433
424
|
const adapter = new TestEndpointAdaptor(endpoint);
|
|
434
|
-
const result = await adapter.
|
|
425
|
+
const result = await adapter.fullRequest({
|
|
435
426
|
body: { name: 'John Doe' },
|
|
436
427
|
services: mockServices,
|
|
437
428
|
headers: { host: 'example.com' },
|
|
438
429
|
});
|
|
439
430
|
|
|
440
|
-
expect(
|
|
431
|
+
expect(result.body).toEqual({
|
|
441
432
|
id: 'user-123',
|
|
442
433
|
name: 'John Doe',
|
|
443
434
|
});
|
|
444
|
-
expect(
|
|
435
|
+
expect(result.headers).toEqual({
|
|
445
436
|
Location: '/users/user-123',
|
|
446
437
|
'X-User-Id': 'user-123',
|
|
447
438
|
});
|
|
@@ -457,13 +448,13 @@ describe('TestEndpointAdaptor', () => {
|
|
|
457
448
|
});
|
|
458
449
|
|
|
459
450
|
const adapter = new TestEndpointAdaptor(endpoint);
|
|
460
|
-
const result = await adapter.
|
|
451
|
+
const result = await adapter.fullRequest({
|
|
461
452
|
body: { name: 'Resource' },
|
|
462
453
|
services: mockServices,
|
|
463
454
|
headers: { host: 'example.com' },
|
|
464
455
|
});
|
|
465
456
|
|
|
466
|
-
expect(
|
|
457
|
+
expect(result.status).toBe(201);
|
|
467
458
|
});
|
|
468
459
|
|
|
469
460
|
it('should delete cookies', async () => {
|
|
@@ -477,16 +468,17 @@ describe('TestEndpointAdaptor', () => {
|
|
|
477
468
|
});
|
|
478
469
|
|
|
479
470
|
const adapter = new TestEndpointAdaptor(endpoint);
|
|
480
|
-
const result = await adapter.
|
|
471
|
+
const result = await adapter.fullRequest({
|
|
481
472
|
services: mockServices,
|
|
482
473
|
headers: { host: 'example.com' },
|
|
483
474
|
});
|
|
484
475
|
|
|
485
|
-
expect(
|
|
486
|
-
const
|
|
487
|
-
expect(
|
|
488
|
-
expect(
|
|
489
|
-
expect(
|
|
476
|
+
expect(result.body.success).toBe(true);
|
|
477
|
+
const setCookieHeader = result.headers['set-cookie'] as string[];
|
|
478
|
+
expect(setCookieHeader).toHaveLength(1);
|
|
479
|
+
expect(setCookieHeader[0]).toContain('session=');
|
|
480
|
+
expect(setCookieHeader[0]).toContain('Max-Age=0');
|
|
481
|
+
expect(setCookieHeader[0]).toContain('Path=/');
|
|
490
482
|
});
|
|
491
483
|
|
|
492
484
|
it('should combine cookies, headers, and status', async () => {
|
|
@@ -505,28 +497,21 @@ describe('TestEndpointAdaptor', () => {
|
|
|
505
497
|
});
|
|
506
498
|
|
|
507
499
|
const adapter = new TestEndpointAdaptor(endpoint);
|
|
508
|
-
const result = await adapter.
|
|
500
|
+
const result = await adapter.fullRequest({
|
|
509
501
|
body: { data: 'test' },
|
|
510
502
|
services: mockServices,
|
|
511
503
|
headers: { host: 'example.com' },
|
|
512
504
|
});
|
|
513
505
|
|
|
514
|
-
expect(
|
|
506
|
+
expect(result.body).toEqual({
|
|
515
507
|
id: '123',
|
|
516
508
|
result: 'test',
|
|
517
509
|
});
|
|
518
|
-
expect(
|
|
519
|
-
expect(
|
|
510
|
+
expect(result.status).toBe(201);
|
|
511
|
+
expect(result.headers).toEqual({
|
|
520
512
|
Location: '/complete/123',
|
|
521
513
|
'X-Request-Id': 'req-456',
|
|
522
|
-
|
|
523
|
-
expect((result as any).metadata.cookies?.size).toBe(2);
|
|
524
|
-
expect((result as any).metadata.cookies?.get('tracking')?.value).toBe(
|
|
525
|
-
'track-789',
|
|
526
|
-
);
|
|
527
|
-
expect((result as any).metadata.cookies?.get('preference')).toEqual({
|
|
528
|
-
value: 'dark',
|
|
529
|
-
options: { maxAge: 86400 },
|
|
514
|
+
'set-cookie': ['tracking=track-789', 'preference=dark; Max-Age=86400'],
|
|
530
515
|
});
|
|
531
516
|
});
|
|
532
517
|
|
|
@@ -564,7 +549,7 @@ describe('TestEndpointAdaptor', () => {
|
|
|
564
549
|
});
|
|
565
550
|
|
|
566
551
|
const adapter = new TestEndpointAdaptor(endpoint);
|
|
567
|
-
const result = await adapter.
|
|
552
|
+
const result = await adapter.fullRequest({
|
|
568
553
|
services: mockServices,
|
|
569
554
|
headers: {
|
|
570
555
|
host: 'example.com',
|
|
@@ -572,13 +557,295 @@ describe('TestEndpointAdaptor', () => {
|
|
|
572
557
|
},
|
|
573
558
|
});
|
|
574
559
|
|
|
575
|
-
expect(
|
|
560
|
+
expect(result.body).toEqual({
|
|
576
561
|
theme: 'dark',
|
|
577
562
|
updated: true,
|
|
578
563
|
});
|
|
579
|
-
expect(
|
|
580
|
-
'dark',
|
|
581
|
-
);
|
|
564
|
+
expect(result.headers['set-cookie']).toEqual([
|
|
565
|
+
'theme=dark; Max-Age=86400',
|
|
566
|
+
]);
|
|
567
|
+
});
|
|
568
|
+
});
|
|
569
|
+
|
|
570
|
+
describe('fullRequest', () => {
|
|
571
|
+
it('should return full HTTP response with body, status, and headers', async () => {
|
|
572
|
+
const endpoint = e
|
|
573
|
+
.get('/test')
|
|
574
|
+
.output(z.object({ message: z.string() }))
|
|
575
|
+
.handle(() => ({ message: 'Hello World' }));
|
|
576
|
+
|
|
577
|
+
const adapter = new TestEndpointAdaptor(endpoint);
|
|
578
|
+
|
|
579
|
+
const result = await adapter.fullRequest({
|
|
580
|
+
services: mockServices,
|
|
581
|
+
headers: { host: 'example.com' },
|
|
582
|
+
});
|
|
583
|
+
|
|
584
|
+
expect(result).toEqual({
|
|
585
|
+
body: { message: 'Hello World' },
|
|
586
|
+
status: 200,
|
|
587
|
+
headers: {},
|
|
588
|
+
});
|
|
589
|
+
});
|
|
590
|
+
|
|
591
|
+
it('should return custom status code in HTTP response', async () => {
|
|
592
|
+
const endpoint = e
|
|
593
|
+
.post('/resources')
|
|
594
|
+
.body(z.object({ name: z.string() }))
|
|
595
|
+
.output(z.object({ id: z.string() }))
|
|
596
|
+
.handle(async (ctx, response) => {
|
|
597
|
+
return response.status(SuccessStatus.Created).send({ id: '123' });
|
|
598
|
+
});
|
|
599
|
+
|
|
600
|
+
const adapter = new TestEndpointAdaptor(endpoint);
|
|
601
|
+
const result = await adapter.fullRequest({
|
|
602
|
+
body: { name: 'Resource' },
|
|
603
|
+
services: mockServices,
|
|
604
|
+
headers: { host: 'example.com' },
|
|
605
|
+
});
|
|
606
|
+
|
|
607
|
+
expect(result.status).toBe(201);
|
|
608
|
+
expect(result.body).toEqual({ id: '123' });
|
|
609
|
+
});
|
|
610
|
+
|
|
611
|
+
it('should include custom headers in HTTP response', async () => {
|
|
612
|
+
const endpoint = e
|
|
613
|
+
.post('/users')
|
|
614
|
+
.body(z.object({ name: z.string() }))
|
|
615
|
+
.output(z.object({ id: z.string(), name: z.string() }))
|
|
616
|
+
.handle(async ({ body }, response) => {
|
|
617
|
+
const user = { id: 'user-123', name: body.name };
|
|
618
|
+
return response
|
|
619
|
+
.header('Location', `/users/${user.id}`)
|
|
620
|
+
.header('X-User-Id', user.id)
|
|
621
|
+
.send(user);
|
|
622
|
+
});
|
|
623
|
+
|
|
624
|
+
const adapter = new TestEndpointAdaptor(endpoint);
|
|
625
|
+
const result = await adapter.fullRequest({
|
|
626
|
+
body: { name: 'John Doe' },
|
|
627
|
+
services: mockServices,
|
|
628
|
+
headers: { host: 'example.com' },
|
|
629
|
+
});
|
|
630
|
+
|
|
631
|
+
expect(result.body).toEqual({
|
|
632
|
+
id: 'user-123',
|
|
633
|
+
name: 'John Doe',
|
|
634
|
+
});
|
|
635
|
+
expect(result.headers).toEqual({
|
|
636
|
+
Location: '/users/user-123',
|
|
637
|
+
'X-User-Id': 'user-123',
|
|
638
|
+
});
|
|
639
|
+
});
|
|
640
|
+
|
|
641
|
+
it('should convert cookies to Set-Cookie headers', async () => {
|
|
642
|
+
const endpoint = e
|
|
643
|
+
.post('/auth/login')
|
|
644
|
+
.body(z.object({ email: z.string(), password: z.string() }))
|
|
645
|
+
.output(z.object({ id: z.string(), email: z.string() }))
|
|
646
|
+
.handle(async ({ body }, response) => {
|
|
647
|
+
return response
|
|
648
|
+
.cookie('session', 'abc123', {
|
|
649
|
+
httpOnly: true,
|
|
650
|
+
secure: true,
|
|
651
|
+
sameSite: 'strict',
|
|
652
|
+
maxAge: 3600,
|
|
653
|
+
})
|
|
654
|
+
.send({ id: 'user-1', email: body.email });
|
|
655
|
+
});
|
|
656
|
+
|
|
657
|
+
const adapter = new TestEndpointAdaptor(endpoint);
|
|
658
|
+
const result = await adapter.fullRequest({
|
|
659
|
+
body: { email: 'test@example.com', password: 'pass123' },
|
|
660
|
+
services: mockServices,
|
|
661
|
+
headers: { host: 'example.com' },
|
|
662
|
+
});
|
|
663
|
+
|
|
664
|
+
expect(result.body).toEqual({
|
|
665
|
+
id: 'user-1',
|
|
666
|
+
email: 'test@example.com',
|
|
667
|
+
});
|
|
668
|
+
expect(result.headers['set-cookie']).toEqual([
|
|
669
|
+
'session=abc123; Max-Age=3600; HttpOnly; Secure; SameSite=strict',
|
|
670
|
+
]);
|
|
671
|
+
});
|
|
672
|
+
|
|
673
|
+
it('should handle multiple cookies as array of Set-Cookie headers', async () => {
|
|
674
|
+
const endpoint = e
|
|
675
|
+
.post('/complete')
|
|
676
|
+
.body(z.object({ data: z.string() }))
|
|
677
|
+
.output(z.object({ id: z.string(), result: z.string() }))
|
|
678
|
+
.handle(async ({ body }, response) => {
|
|
679
|
+
return response
|
|
680
|
+
.cookie('tracking', 'track-789')
|
|
681
|
+
.cookie('preference', 'dark', { maxAge: 86400, path: '/' })
|
|
682
|
+
.send({ id: '123', result: body.data });
|
|
683
|
+
});
|
|
684
|
+
|
|
685
|
+
const adapter = new TestEndpointAdaptor(endpoint);
|
|
686
|
+
const result = await adapter.fullRequest({
|
|
687
|
+
body: { data: 'test' },
|
|
688
|
+
services: mockServices,
|
|
689
|
+
headers: { host: 'example.com' },
|
|
690
|
+
});
|
|
691
|
+
|
|
692
|
+
expect(result.headers['set-cookie']).toEqual([
|
|
693
|
+
'tracking=track-789',
|
|
694
|
+
'preference=dark; Max-Age=86400; Path=/',
|
|
695
|
+
]);
|
|
696
|
+
});
|
|
697
|
+
|
|
698
|
+
it('should serialize all cookie options correctly', async () => {
|
|
699
|
+
const expires = new Date('2025-12-31T23:59:59Z');
|
|
700
|
+
const endpoint = e
|
|
701
|
+
.get('/cookies-full')
|
|
702
|
+
.output(z.object({ success: z.boolean() }))
|
|
703
|
+
.handle(async (ctx, response) => {
|
|
704
|
+
return response
|
|
705
|
+
.cookie('full-cookie', 'value123', {
|
|
706
|
+
domain: 'example.com',
|
|
707
|
+
path: '/api',
|
|
708
|
+
expires: expires,
|
|
709
|
+
maxAge: 7200,
|
|
710
|
+
httpOnly: true,
|
|
711
|
+
secure: true,
|
|
712
|
+
sameSite: 'lax',
|
|
713
|
+
})
|
|
714
|
+
.send({ success: true });
|
|
715
|
+
});
|
|
716
|
+
|
|
717
|
+
const adapter = new TestEndpointAdaptor(endpoint);
|
|
718
|
+
const result = await adapter.fullRequest({
|
|
719
|
+
services: mockServices,
|
|
720
|
+
headers: { host: 'example.com' },
|
|
721
|
+
});
|
|
722
|
+
|
|
723
|
+
expect(result.headers['set-cookie']).toEqual([
|
|
724
|
+
`full-cookie=value123; Max-Age=7200; Expires=${expires.toUTCString()}; Domain=example.com; Path=/api; HttpOnly; Secure; SameSite=lax`,
|
|
725
|
+
]);
|
|
726
|
+
});
|
|
727
|
+
|
|
728
|
+
it('should handle cookie deletion in Set-Cookie header', async () => {
|
|
729
|
+
const endpoint = e
|
|
730
|
+
.post('/auth/logout')
|
|
731
|
+
.output(z.object({ success: z.boolean() }))
|
|
732
|
+
.handle(async (ctx, response) => {
|
|
733
|
+
return response
|
|
734
|
+
.deleteCookie('session', { path: '/' })
|
|
735
|
+
.send({ success: true });
|
|
736
|
+
});
|
|
737
|
+
|
|
738
|
+
const adapter = new TestEndpointAdaptor(endpoint);
|
|
739
|
+
const result = await adapter.fullRequest({
|
|
740
|
+
services: mockServices,
|
|
741
|
+
headers: { host: 'example.com' },
|
|
742
|
+
});
|
|
743
|
+
|
|
744
|
+
expect(result.body.success).toBe(true);
|
|
745
|
+
const setCookieHeader = result.headers['set-cookie'] as string[];
|
|
746
|
+
expect(setCookieHeader).toHaveLength(1);
|
|
747
|
+
expect(setCookieHeader[0]).toContain('session=');
|
|
748
|
+
expect(setCookieHeader[0]).toContain('Max-Age=0');
|
|
749
|
+
expect(setCookieHeader[0]).toContain('Path=/');
|
|
750
|
+
expect(setCookieHeader[0]).toContain('Expires=');
|
|
751
|
+
});
|
|
752
|
+
|
|
753
|
+
it('should combine headers and cookies in HTTP response', async () => {
|
|
754
|
+
const endpoint = e
|
|
755
|
+
.post('/complete')
|
|
756
|
+
.body(z.object({ data: z.string() }))
|
|
757
|
+
.output(z.object({ id: z.string(), result: z.string() }))
|
|
758
|
+
.handle(async ({ body }, response) => {
|
|
759
|
+
return response
|
|
760
|
+
.status(SuccessStatus.Created)
|
|
761
|
+
.header('Location', '/complete/123')
|
|
762
|
+
.header('X-Request-Id', 'req-456')
|
|
763
|
+
.cookie('tracking', 'track-789')
|
|
764
|
+
.cookie('preference', 'dark', { maxAge: 86400 })
|
|
765
|
+
.send({ id: '123', result: body.data });
|
|
766
|
+
});
|
|
767
|
+
|
|
768
|
+
const adapter = new TestEndpointAdaptor(endpoint);
|
|
769
|
+
const result = await adapter.fullRequest({
|
|
770
|
+
body: { data: 'test' },
|
|
771
|
+
services: mockServices,
|
|
772
|
+
headers: { host: 'example.com' },
|
|
773
|
+
});
|
|
774
|
+
|
|
775
|
+
expect(result).toEqual({
|
|
776
|
+
body: { id: '123', result: 'test' },
|
|
777
|
+
status: 201,
|
|
778
|
+
headers: {
|
|
779
|
+
Location: '/complete/123',
|
|
780
|
+
'X-Request-Id': 'req-456',
|
|
781
|
+
'set-cookie': [
|
|
782
|
+
'tracking=track-789',
|
|
783
|
+
'preference=dark; Max-Age=86400',
|
|
784
|
+
],
|
|
785
|
+
},
|
|
786
|
+
});
|
|
787
|
+
});
|
|
788
|
+
|
|
789
|
+
it('should handle empty response metadata', async () => {
|
|
790
|
+
const endpoint = e
|
|
791
|
+
.get('/simple')
|
|
792
|
+
.output(z.object({ message: z.string() }))
|
|
793
|
+
.handle(async () => ({ message: 'Hello' }));
|
|
794
|
+
|
|
795
|
+
const adapter = new TestEndpointAdaptor(endpoint);
|
|
796
|
+
const result = await adapter.fullRequest({
|
|
797
|
+
services: mockServices,
|
|
798
|
+
headers: { host: 'example.com' },
|
|
799
|
+
});
|
|
800
|
+
|
|
801
|
+
expect(result).toEqual({
|
|
802
|
+
body: { message: 'Hello' },
|
|
803
|
+
status: 200,
|
|
804
|
+
headers: {},
|
|
805
|
+
});
|
|
806
|
+
});
|
|
807
|
+
});
|
|
808
|
+
|
|
809
|
+
describe('request method delegation', () => {
|
|
810
|
+
it('should return only body from fullRequest', async () => {
|
|
811
|
+
const endpoint = e
|
|
812
|
+
.post('/users')
|
|
813
|
+
.body(z.object({ name: z.string() }))
|
|
814
|
+
.output(z.object({ id: z.string(), name: z.string() }))
|
|
815
|
+
.handle(async ({ body }, response) => {
|
|
816
|
+
return response
|
|
817
|
+
.status(SuccessStatus.Created)
|
|
818
|
+
.header('Location', '/users/123')
|
|
819
|
+
.cookie('session', 'abc')
|
|
820
|
+
.send({ id: '123', name: body.name });
|
|
821
|
+
});
|
|
822
|
+
|
|
823
|
+
const adapter = new TestEndpointAdaptor(endpoint);
|
|
824
|
+
|
|
825
|
+
// Call request (should only return body)
|
|
826
|
+
const simpleResult = await adapter.request({
|
|
827
|
+
body: { name: 'John' },
|
|
828
|
+
services: mockServices,
|
|
829
|
+
headers: { host: 'example.com' },
|
|
830
|
+
});
|
|
831
|
+
|
|
832
|
+
// Call fullRequest (should return full HTTP response)
|
|
833
|
+
const fullResult = await adapter.fullRequest({
|
|
834
|
+
body: { name: 'John' },
|
|
835
|
+
services: mockServices,
|
|
836
|
+
headers: { host: 'example.com' },
|
|
837
|
+
});
|
|
838
|
+
|
|
839
|
+
// request should only return the body
|
|
840
|
+
expect(simpleResult).toEqual({ id: '123', name: 'John' });
|
|
841
|
+
expect(simpleResult).not.toHaveProperty('status');
|
|
842
|
+
expect(simpleResult).not.toHaveProperty('headers');
|
|
843
|
+
|
|
844
|
+
// fullRequest should return complete HTTP response
|
|
845
|
+
expect(fullResult.body).toEqual({ id: '123', name: 'John' });
|
|
846
|
+
expect(fullResult.status).toBe(201);
|
|
847
|
+
expect(fullResult.headers).toHaveProperty('Location');
|
|
848
|
+
expect(fullResult.headers).toHaveProperty('set-cookie');
|
|
582
849
|
});
|
|
583
850
|
});
|
|
584
851
|
});
|
|
@@ -125,7 +125,7 @@ export class Function<
|
|
|
125
125
|
|
|
126
126
|
constructor(
|
|
127
127
|
protected readonly fn: Fn,
|
|
128
|
-
|
|
128
|
+
timeout = 30000, // Default timeout of 30 seconds
|
|
129
129
|
type: ConstructType = ConstructType.Function,
|
|
130
130
|
public input?: TInput,
|
|
131
131
|
outputSchema?: OutSchema,
|
|
@@ -133,8 +133,18 @@ export class Function<
|
|
|
133
133
|
logger: TLogger = DEFAULT_LOGGER,
|
|
134
134
|
publisherService?: Service<TEventPublisherServiceName, TEventPublisher>,
|
|
135
135
|
events: MappedEvent<TEventPublisher, OutSchema>[] = [],
|
|
136
|
+
memorySize?: number,
|
|
136
137
|
) {
|
|
137
|
-
super(
|
|
138
|
+
super(
|
|
139
|
+
type,
|
|
140
|
+
logger,
|
|
141
|
+
services,
|
|
142
|
+
events,
|
|
143
|
+
publisherService,
|
|
144
|
+
outputSchema,
|
|
145
|
+
timeout,
|
|
146
|
+
memorySize,
|
|
147
|
+
);
|
|
138
148
|
}
|
|
139
149
|
}
|
|
140
150
|
|
|
@@ -27,6 +27,8 @@ export class FunctionBuilder<
|
|
|
27
27
|
TEventPublisher,
|
|
28
28
|
TEventPublisherServiceName
|
|
29
29
|
> {
|
|
30
|
+
protected _memorySize?: number;
|
|
31
|
+
|
|
30
32
|
constructor(public type = ConstructType.Function) {
|
|
31
33
|
super(type);
|
|
32
34
|
}
|
|
@@ -36,6 +38,11 @@ export class FunctionBuilder<
|
|
|
36
38
|
return this;
|
|
37
39
|
}
|
|
38
40
|
|
|
41
|
+
memorySize(memorySize: number): this {
|
|
42
|
+
this._memorySize = memorySize;
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
|
|
39
46
|
output<T extends StandardSchemaV1>(
|
|
40
47
|
schema: T,
|
|
41
48
|
): FunctionBuilder<
|
|
@@ -166,6 +173,7 @@ export class FunctionBuilder<
|
|
|
166
173
|
this._logger,
|
|
167
174
|
this._publisher,
|
|
168
175
|
this._events,
|
|
176
|
+
this._memorySize,
|
|
169
177
|
);
|
|
170
178
|
|
|
171
179
|
// Reset builder state after creating the function to prevent pollution
|
|
@@ -176,6 +184,7 @@ export class FunctionBuilder<
|
|
|
176
184
|
this.inputSchema = undefined;
|
|
177
185
|
this.outputSchema = undefined;
|
|
178
186
|
this._timeout = undefined;
|
|
187
|
+
this._memorySize = undefined;
|
|
179
188
|
|
|
180
189
|
return func;
|
|
181
190
|
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { ConsoleLogger } from '@geekmidas/logger/console';
|
|
3
|
+
import { FunctionBuilder } from '../FunctionBuilder';
|
|
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('FunctionBuilder - State Isolation', () => {
|
|
21
|
+
describe('singleton instance state reset', () => {
|
|
22
|
+
it('should reset services after handle() is called', () => {
|
|
23
|
+
const f = new FunctionBuilder();
|
|
24
|
+
|
|
25
|
+
// First function with ServiceA and ServiceB
|
|
26
|
+
const fn1 = f.services([ServiceA, ServiceB]).handle(async () => ({}));
|
|
27
|
+
|
|
28
|
+
// Second function should not have any services from first
|
|
29
|
+
const fn2 = f.handle(async () => ({}));
|
|
30
|
+
|
|
31
|
+
expect(fn1.services.map((s) => s.serviceName)).toEqual(['a', 'b']);
|
|
32
|
+
expect(fn2.services.map((s) => s.serviceName)).toEqual([]);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('should reset logger after handle() is called', () => {
|
|
36
|
+
const f = new FunctionBuilder();
|
|
37
|
+
const customLogger = new ConsoleLogger({ app: 'custom' });
|
|
38
|
+
|
|
39
|
+
// First function with custom logger
|
|
40
|
+
const fn1 = f.logger(customLogger).handle(async () => ({}));
|
|
41
|
+
|
|
42
|
+
// Second function should have default logger (not the custom one)
|
|
43
|
+
const fn2 = f.handle(async () => ({}));
|
|
44
|
+
|
|
45
|
+
expect(fn1.logger).toBe(customLogger);
|
|
46
|
+
expect(fn2.logger).not.toBe(customLogger);
|
|
47
|
+
expect(fn2.logger).toBeInstanceOf(ConsoleLogger);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('should reset events after handle() is called', () => {
|
|
51
|
+
const f = new FunctionBuilder();
|
|
52
|
+
|
|
53
|
+
// Create first function (events array should be empty initially)
|
|
54
|
+
const fn1 = f.handle(async () => ({}));
|
|
55
|
+
|
|
56
|
+
// Verify state was reset
|
|
57
|
+
expect((f as any)._events).toEqual([]);
|
|
58
|
+
expect((f as any)._services).toEqual([]);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('should reset input/output schemas after handle() is called', () => {
|
|
62
|
+
const f = new FunctionBuilder();
|
|
63
|
+
const inputSchema: any = { '~standard': { validate: () => ({}) } };
|
|
64
|
+
const outputSchema: any = { '~standard': { validate: () => ({}) } };
|
|
65
|
+
|
|
66
|
+
// First function with schemas
|
|
67
|
+
const fn1 = f.input(inputSchema).output(outputSchema).handle(async () => ({}));
|
|
68
|
+
|
|
69
|
+
// Second function should not have schemas
|
|
70
|
+
const fn2 = f.handle(async () => ({}));
|
|
71
|
+
|
|
72
|
+
expect(fn1.input).toBe(inputSchema);
|
|
73
|
+
expect(fn1.outputSchema).toBe(outputSchema);
|
|
74
|
+
expect(fn2.input).toBeUndefined();
|
|
75
|
+
expect(fn2.outputSchema).toBeUndefined();
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('should reset timeout after handle() is called', () => {
|
|
79
|
+
const f = new FunctionBuilder();
|
|
80
|
+
|
|
81
|
+
// First function with custom timeout
|
|
82
|
+
const fn1 = f.timeout(5000).handle(async () => ({}));
|
|
83
|
+
|
|
84
|
+
// Second function should have default timeout (30000)
|
|
85
|
+
const fn2 = f.handle(async () => ({}));
|
|
86
|
+
|
|
87
|
+
expect(fn1.timeout).toBe(5000);
|
|
88
|
+
expect(fn2.timeout).toBe(30000); // Default timeout
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
describe('method chaining before handle()', () => {
|
|
93
|
+
it('should accumulate services when chaining', () => {
|
|
94
|
+
const f = new FunctionBuilder();
|
|
95
|
+
|
|
96
|
+
const fn = f
|
|
97
|
+
.services([ServiceA])
|
|
98
|
+
.services([ServiceB])
|
|
99
|
+
.handle(async () => ({}));
|
|
100
|
+
|
|
101
|
+
expect(fn.services.map((s) => s.serviceName)).toEqual(['a', 'b']);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it('should not share references between different builder chains', () => {
|
|
105
|
+
const f = new FunctionBuilder();
|
|
106
|
+
|
|
107
|
+
// Start two separate chains
|
|
108
|
+
const builder1 = f.services([ServiceA]);
|
|
109
|
+
const builder2 = f.services([ServiceB]);
|
|
110
|
+
|
|
111
|
+
// They should be the same instance (singleton)
|
|
112
|
+
expect(builder1).toBe(builder2);
|
|
113
|
+
expect(builder1).toBe(f);
|
|
114
|
+
|
|
115
|
+
// But after handle, state is reset
|
|
116
|
+
const fn1 = builder1.handle(async () => ({}));
|
|
117
|
+
|
|
118
|
+
// Now builder2 should have reset state
|
|
119
|
+
expect((builder2 as any)._services).toEqual([]);
|
|
120
|
+
|
|
121
|
+
// Add services again
|
|
122
|
+
const fn2 = builder2.services([ServiceB]).handle(async () => ({}));
|
|
123
|
+
|
|
124
|
+
expect(fn1.services.map((s) => s.serviceName)).toEqual(['a', 'b']);
|
|
125
|
+
expect(fn2.services.map((s) => s.serviceName)).toEqual(['b']);
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
describe('sequential function creation', () => {
|
|
130
|
+
it('should create independent functions sequentially', () => {
|
|
131
|
+
const f = new FunctionBuilder();
|
|
132
|
+
|
|
133
|
+
const fn1 = f.services([ServiceA, ServiceB]).handle(async () => ({ result: 1 }));
|
|
134
|
+
const fn2 = f.services([ServiceA]).handle(async () => ({ result: 2 }));
|
|
135
|
+
const fn3 = f.handle(async () => ({ result: 3 }));
|
|
136
|
+
|
|
137
|
+
expect(fn1.services.map((s) => s.serviceName)).toEqual(['a', 'b']);
|
|
138
|
+
expect(fn2.services.map((s) => s.serviceName)).toEqual(['a']);
|
|
139
|
+
expect(fn3.services.map((s) => s.serviceName)).toEqual([]);
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
describe('publisher isolation', () => {
|
|
144
|
+
it('should reset publisher after handle() is called', () => {
|
|
145
|
+
const f = new FunctionBuilder();
|
|
146
|
+
const mockPublisher: any = {
|
|
147
|
+
serviceName: 'publisher',
|
|
148
|
+
async register() {
|
|
149
|
+
return { publish: () => {} };
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const fn1 = f.publisher(mockPublisher).handle(async () => ({}));
|
|
154
|
+
const fn2 = f.handle(async () => ({}));
|
|
155
|
+
|
|
156
|
+
expect((fn1 as any).publisherService).toBe(mockPublisher);
|
|
157
|
+
expect((fn2 as any).publisherService).toBeUndefined();
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Construct-BSEs6uwW.cjs","names":["type: ConstructType","logger: TLogger","services: TServices","events: MappedEvent<T, any>[]","publisherService?: Service<TServiceName, T>","outputSchema?: OutSchema","EnvironmentParser","services: Service[]","v: string"],"sources":["../src/Construct.ts"],"sourcesContent":["import { EnvironmentParser } from '@geekmidas/envkit';\nimport type { EventPublisher, MappedEvent } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport compact from 'lodash.compact';\n\nexport abstract class Construct<\n TLogger extends Logger = Logger,\n TServiceName extends string = string,\n T extends EventPublisher<any> | undefined = undefined,\n OutSchema extends StandardSchemaV1 | undefined = undefined,\n TServices extends Service[] = [],\n> {\n constructor(\n public readonly type: ConstructType,\n public readonly logger: TLogger,\n public readonly services: TServices,\n public readonly events: MappedEvent<T, any>[] = [],\n\n public readonly publisherService?: Service<TServiceName, T>,\n public outputSchema?: OutSchema,\n ) {}\n\n /**\n * Returns an array of environment variable names required by this construct's services.\n * This is determined by running a \"sniffer\" EnvironmentParser through each service's\n * register method to track which environment variables are accessed.\n *\n * @returns Promise that resolves to array of environment variable names, sorted alphabetically\n *\n * @example\n * ```typescript\n * const endpoint = e\n * .services([databaseService, authService])\n * .get('/users')\n * .handle(async () => []);\n *\n * const envVars = await endpoint.getEnvironment(); // ['AUTH_SECRET', 'DATABASE_URL']\n * ```\n */\n async getEnvironment(): Promise<string[]> {\n const envVars = new Set<string>();\n const sniffer = new EnvironmentParser({});\n const services: Service[] = compact([\n ...this.services,\n this.publisherService,\n ]);\n\n try {\n // Run each service's register method with the sniffer to track env var access\n for (const service of services) {\n try {\n const config = service.register(sniffer);\n\n // Await if it's a Promise (async services)\n const resolvedConfig =\n config && typeof config === 'object' && 'then' in config\n ? await Promise.resolve(config)\n : config;\n\n // If register returns a ConfigParser, collect its env vars\n if (\n resolvedConfig &&\n typeof resolvedConfig === 'object' &&\n 'getEnvironmentVariables' in resolvedConfig &&\n typeof resolvedConfig.getEnvironmentVariables === 'function'\n ) {\n const vars = resolvedConfig.getEnvironmentVariables();\n if (Array.isArray(vars)) {\n vars.forEach((v: string) => envVars.add(v));\n }\n }\n } catch (serviceError) {\n // Service registration failed (e.g., missing env vars during .parse())\n // But env vars were already tracked during .create(), so we continue\n continue;\n }\n }\n\n return Array.from(envVars).sort();\n } catch (error) {\n console.error(\n 'Error determining environment variables for construct:',\n error,\n );\n\n return [];\n }\n }\n}\n\nexport enum ConstructType {\n Cron = 'dev.geekmidas.function.cron',\n Endpoint = 'dev.geekmidas.function.endpoint',\n Function = 'dev.geekmidas.function.function',\n Subscriber = 'dev.geekmidas.function.subscriber',\n}\n"],"mappings":";;;;;AAOA,IAAsB,YAAtB,MAME;CACA,YACkBA,MACAC,QACAC,UACAC,SAAgC,CAAE,GAElCC,kBACTC,cACP;EAPgB;EACA;EACA;EACA;EAEA;EACT;CACL;;;;;;;;;;;;;;;;;;CAmBJ,MAAM,iBAAoC;EACxC,MAAM,0BAAU,IAAI;EACpB,MAAM,UAAU,IAAIC,qCAAkB,CAAE;EACxC,MAAMC,WAAsB,4BAAQ,CAClC,GAAG,KAAK,UACR,KAAK,gBACN,EAAC;AAEF,MAAI;AAEF,QAAK,MAAM,WAAW,SACpB,KAAI;IACF,MAAM,SAAS,QAAQ,SAAS,QAAQ;IAGxC,MAAM,iBACJ,iBAAiB,WAAW,YAAY,UAAU,SAC9C,MAAM,QAAQ,QAAQ,OAAO,GAC7B;AAGN,QACE,yBACO,mBAAmB,YAC1B,6BAA6B,yBACtB,eAAe,4BAA4B,YAClD;KACA,MAAM,OAAO,eAAe,yBAAyB;AACrD,SAAI,MAAM,QAAQ,KAAK,CACrB,MAAK,QAAQ,CAACC,MAAc,QAAQ,IAAI,EAAE,CAAC;IAE9C;GACF,SAAQ,cAAc;AAGrB;GACD;AAGH,UAAO,MAAM,KAAK,QAAQ,CAAC,MAAM;EAClC,SAAQ,OAAO;AACd,WAAQ,MACN,0DACA,MACD;AAED,UAAO,CAAE;EACV;CACF;AACF;AAED,IAAY,0DAAL;AACL;AACA;AACA;AACA;;AACD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Construct-BbKCIPQm.mjs","names":["type: ConstructType","logger: TLogger","services: TServices","events: MappedEvent<T, any>[]","publisherService?: Service<TServiceName, T>","outputSchema?: OutSchema","services: Service[]","v: string"],"sources":["../src/Construct.ts"],"sourcesContent":["import { EnvironmentParser } from '@geekmidas/envkit';\nimport type { EventPublisher, MappedEvent } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport compact from 'lodash.compact';\n\nexport abstract class Construct<\n TLogger extends Logger = Logger,\n TServiceName extends string = string,\n T extends EventPublisher<any> | undefined = undefined,\n OutSchema extends StandardSchemaV1 | undefined = undefined,\n TServices extends Service[] = [],\n> {\n constructor(\n public readonly type: ConstructType,\n public readonly logger: TLogger,\n public readonly services: TServices,\n public readonly events: MappedEvent<T, any>[] = [],\n\n public readonly publisherService?: Service<TServiceName, T>,\n public outputSchema?: OutSchema,\n ) {}\n\n /**\n * Returns an array of environment variable names required by this construct's services.\n * This is determined by running a \"sniffer\" EnvironmentParser through each service's\n * register method to track which environment variables are accessed.\n *\n * @returns Promise that resolves to array of environment variable names, sorted alphabetically\n *\n * @example\n * ```typescript\n * const endpoint = e\n * .services([databaseService, authService])\n * .get('/users')\n * .handle(async () => []);\n *\n * const envVars = await endpoint.getEnvironment(); // ['AUTH_SECRET', 'DATABASE_URL']\n * ```\n */\n async getEnvironment(): Promise<string[]> {\n const envVars = new Set<string>();\n const sniffer = new EnvironmentParser({});\n const services: Service[] = compact([\n ...this.services,\n this.publisherService,\n ]);\n\n try {\n // Run each service's register method with the sniffer to track env var access\n for (const service of services) {\n try {\n const config = service.register(sniffer);\n\n // Await if it's a Promise (async services)\n const resolvedConfig =\n config && typeof config === 'object' && 'then' in config\n ? await Promise.resolve(config)\n : config;\n\n // If register returns a ConfigParser, collect its env vars\n if (\n resolvedConfig &&\n typeof resolvedConfig === 'object' &&\n 'getEnvironmentVariables' in resolvedConfig &&\n typeof resolvedConfig.getEnvironmentVariables === 'function'\n ) {\n const vars = resolvedConfig.getEnvironmentVariables();\n if (Array.isArray(vars)) {\n vars.forEach((v: string) => envVars.add(v));\n }\n }\n } catch (serviceError) {\n // Service registration failed (e.g., missing env vars during .parse())\n // But env vars were already tracked during .create(), so we continue\n continue;\n }\n }\n\n return Array.from(envVars).sort();\n } catch (error) {\n console.error(\n 'Error determining environment variables for construct:',\n error,\n );\n\n return [];\n }\n }\n}\n\nexport enum ConstructType {\n Cron = 'dev.geekmidas.function.cron',\n Endpoint = 'dev.geekmidas.function.endpoint',\n Function = 'dev.geekmidas.function.function',\n Subscriber = 'dev.geekmidas.function.subscriber',\n}\n"],"mappings":";;;;AAOA,IAAsB,YAAtB,MAME;CACA,YACkBA,MACAC,QACAC,UACAC,SAAgC,CAAE,GAElCC,kBACTC,cACP;EAPgB;EACA;EACA;EACA;EAEA;EACT;CACL;;;;;;;;;;;;;;;;;;CAmBJ,MAAM,iBAAoC;EACxC,MAAM,0BAAU,IAAI;EACpB,MAAM,UAAU,IAAI,kBAAkB,CAAE;EACxC,MAAMC,WAAsB,QAAQ,CAClC,GAAG,KAAK,UACR,KAAK,gBACN,EAAC;AAEF,MAAI;AAEF,QAAK,MAAM,WAAW,SACpB,KAAI;IACF,MAAM,SAAS,QAAQ,SAAS,QAAQ;IAGxC,MAAM,iBACJ,iBAAiB,WAAW,YAAY,UAAU,SAC9C,MAAM,QAAQ,QAAQ,OAAO,GAC7B;AAGN,QACE,yBACO,mBAAmB,YAC1B,6BAA6B,yBACtB,eAAe,4BAA4B,YAClD;KACA,MAAM,OAAO,eAAe,yBAAyB;AACrD,SAAI,MAAM,QAAQ,KAAK,CACrB,MAAK,QAAQ,CAACC,MAAc,QAAQ,IAAI,EAAE,CAAC;IAE9C;GACF,SAAQ,cAAc;AAGrB;GACD;AAGH,UAAO,MAAM,KAAK,QAAQ,CAAC,MAAM;EAClC,SAAQ,OAAO;AACd,WAAQ,MACN,0DACA,MACD;AAED,UAAO,CAAE;EACV;CACF;AACF;AAED,IAAY,0DAAL;AACL;AACA;AACA;AACA;;AACD"}
|