@geekmidas/constructs 0.0.1
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/README.md +614 -0
- package/dist/AWSLambdaFunction-CpHFE2m6.d.mts +27 -0
- package/dist/AWSLambdaFunction-CwagvPG3.d.cts +27 -0
- package/dist/AWSLambdaFunction-DWIZYsCy.mjs +79 -0
- package/dist/AWSLambdaFunction-DWIZYsCy.mjs.map +1 -0
- package/dist/AWSLambdaFunction-qA5LqPsv.cjs +85 -0
- package/dist/AWSLambdaFunction-qA5LqPsv.cjs.map +1 -0
- package/dist/AWSLambdaSubscriberAdaptor-C1wQuucQ.d.mts +32 -0
- package/dist/AWSLambdaSubscriberAdaptor-CmPZ10JF.cjs +138 -0
- package/dist/AWSLambdaSubscriberAdaptor-CmPZ10JF.cjs.map +1 -0
- package/dist/AWSLambdaSubscriberAdaptor-G8y3YkWj.mjs +132 -0
- package/dist/AWSLambdaSubscriberAdaptor-G8y3YkWj.mjs.map +1 -0
- package/dist/AWSLambdaSubscriberAdaptor-QKVxR6qh.d.cts +32 -0
- package/dist/AmazonApiGatewayEndpointAdaptor-BoBh7vvD.d.mts +61 -0
- package/dist/AmazonApiGatewayEndpointAdaptor-Cx1oqcqh.mjs +124 -0
- package/dist/AmazonApiGatewayEndpointAdaptor-Cx1oqcqh.mjs.map +1 -0
- package/dist/AmazonApiGatewayEndpointAdaptor-DtzgQ9Vb.d.cts +61 -0
- package/dist/AmazonApiGatewayEndpointAdaptor-i74DEUbc.cjs +130 -0
- package/dist/AmazonApiGatewayEndpointAdaptor-i74DEUbc.cjs.map +1 -0
- package/dist/AmazonApiGatewayV1EndpointAdaptor-CLmBDYsl.mjs +42 -0
- package/dist/AmazonApiGatewayV1EndpointAdaptor-CLmBDYsl.mjs.map +1 -0
- package/dist/AmazonApiGatewayV1EndpointAdaptor-EhMd1YqV.d.mts +21 -0
- package/dist/AmazonApiGatewayV1EndpointAdaptor-GkMAUPL5.cjs +47 -0
- package/dist/AmazonApiGatewayV1EndpointAdaptor-GkMAUPL5.cjs.map +1 -0
- package/dist/AmazonApiGatewayV1EndpointAdaptor-Gw-j61qM.d.cts +21 -0
- package/dist/AmazonApiGatewayV2EndpointAdaptor-3RqegmJC.mjs +41 -0
- package/dist/AmazonApiGatewayV2EndpointAdaptor-3RqegmJC.mjs.map +1 -0
- package/dist/AmazonApiGatewayV2EndpointAdaptor-LUlpwmUW.d.cts +21 -0
- package/dist/AmazonApiGatewayV2EndpointAdaptor-YlFoFSS9.cjs +46 -0
- package/dist/AmazonApiGatewayV2EndpointAdaptor-YlFoFSS9.cjs.map +1 -0
- package/dist/AmazonApiGatewayV2EndpointAdaptor-zfd1gqXA.d.mts +21 -0
- package/dist/BaseFunctionBuilder-5QCHkchp.d.cts +31 -0
- package/dist/BaseFunctionBuilder-BFPVGnKi.d.mts +31 -0
- package/dist/BaseFunctionBuilder-BPE9JBbT.mjs +56 -0
- package/dist/BaseFunctionBuilder-BPE9JBbT.mjs.map +1 -0
- package/dist/BaseFunctionBuilder-DtO4Nwxm.cjs +62 -0
- package/dist/BaseFunctionBuilder-DtO4Nwxm.cjs.map +1 -0
- package/dist/Construct-BSEs6uwW.cjs +75 -0
- package/dist/Construct-BSEs6uwW.cjs.map +1 -0
- package/dist/Construct-BbKCIPQm.mjs +63 -0
- package/dist/Construct-BbKCIPQm.mjs.map +1 -0
- package/dist/Construct-Bm-PSO2V.d.cts +42 -0
- package/dist/Construct-DIguIyw4.d.mts +42 -0
- package/dist/Construct.cjs +4 -0
- package/dist/Construct.d.cts +2 -0
- package/dist/Construct.d.mts +2 -0
- package/dist/Construct.mjs +3 -0
- package/dist/Cron-Bgs6EQOb.mjs +20 -0
- package/dist/Cron-Bgs6EQOb.mjs.map +1 -0
- package/dist/Cron-DQiCj3ef.cjs +25 -0
- package/dist/Cron-DQiCj3ef.cjs.map +1 -0
- package/dist/Cron-FpAw03k6.d.mts +25 -0
- package/dist/Cron-ztnK6zgU.d.cts +25 -0
- package/dist/CronBuilder-B2clNQSP.d.mts +24 -0
- package/dist/CronBuilder-Cje9K8lZ.d.cts +24 -0
- package/dist/CronBuilder-DIBqJkh_.cjs +60 -0
- package/dist/CronBuilder-DIBqJkh_.cjs.map +1 -0
- package/dist/CronBuilder-DecAvvcn.mjs +54 -0
- package/dist/CronBuilder-DecAvvcn.mjs.map +1 -0
- package/dist/Endpoint-BaHC9y4Z.cjs +291 -0
- package/dist/Endpoint-BaHC9y4Z.cjs.map +1 -0
- package/dist/Endpoint-C7z9YJHK.d.cts +405 -0
- package/dist/Endpoint-DCn53Vd8.d.mts +405 -0
- package/dist/Endpoint-ierdM62O.mjs +279 -0
- package/dist/Endpoint-ierdM62O.mjs.map +1 -0
- package/dist/EndpointBuilder-BHFSpbPR.cjs +107 -0
- package/dist/EndpointBuilder-BHFSpbPR.cjs.map +1 -0
- package/dist/EndpointBuilder-BLUsoK3l.mjs +101 -0
- package/dist/EndpointBuilder-BLUsoK3l.mjs.map +1 -0
- package/dist/EndpointBuilder-Bfnb2oJr.d.mts +49 -0
- package/dist/EndpointBuilder-CP9RGwZH.d.cts +49 -0
- package/dist/EndpointFactory-BYdDVCNj.mjs +127 -0
- package/dist/EndpointFactory-BYdDVCNj.mjs.map +1 -0
- package/dist/EndpointFactory-CNtMXgIh.d.mts +52 -0
- package/dist/EndpointFactory-CXX4E6Gx.cjs +139 -0
- package/dist/EndpointFactory-CXX4E6Gx.cjs.map +1 -0
- package/dist/EndpointFactory-D2zgWbXZ.d.cts +52 -0
- package/dist/Function-BP58p9Mp.d.cts +59 -0
- package/dist/Function-BsBxc2wA.d.mts +59 -0
- package/dist/Function-C5mW-38v.mjs +72 -0
- package/dist/Function-C5mW-38v.mjs.map +1 -0
- package/dist/Function-CbO2NZx-.cjs +84 -0
- package/dist/Function-CbO2NZx-.cjs.map +1 -0
- package/dist/FunctionBuilder-BS1KgxA_.d.cts +24 -0
- package/dist/FunctionBuilder-C-PfPN3r.d.mts +24 -0
- package/dist/FunctionBuilder-CosgPmMl.mjs +53 -0
- package/dist/FunctionBuilder-CosgPmMl.mjs.map +1 -0
- package/dist/FunctionBuilder-DuOeWCAl.cjs +59 -0
- package/dist/FunctionBuilder-DuOeWCAl.cjs.map +1 -0
- package/dist/FunctionExecutionWrapper-Bx-Dl-2a.d.cts +24 -0
- package/dist/FunctionExecutionWrapper-CElXEjPe.cjs +42 -0
- package/dist/FunctionExecutionWrapper-CElXEjPe.cjs.map +1 -0
- package/dist/FunctionExecutionWrapper-DvglBBjE.d.mts +24 -0
- package/dist/FunctionExecutionWrapper-XGrSAAPD.mjs +36 -0
- package/dist/FunctionExecutionWrapper-XGrSAAPD.mjs.map +1 -0
- package/dist/HonoEndpointAdaptor-B0IO1zj2.d.mts +41 -0
- package/dist/HonoEndpointAdaptor-B4snrp7v.cjs +154 -0
- package/dist/HonoEndpointAdaptor-B4snrp7v.cjs.map +1 -0
- package/dist/HonoEndpointAdaptor-B6lW9Q1k.d.cts +41 -0
- package/dist/HonoEndpointAdaptor-D-M4-6Tf.mjs +148 -0
- package/dist/HonoEndpointAdaptor-D-M4-6Tf.mjs.map +1 -0
- package/dist/Subscriber-BoFm12i_.d.cts +33 -0
- package/dist/Subscriber-BwuCaC9G.mjs +28 -0
- package/dist/Subscriber-BwuCaC9G.mjs.map +1 -0
- package/dist/Subscriber-THGsj7Iy.d.mts +33 -0
- package/dist/Subscriber-iMRFG7ba.cjs +34 -0
- package/dist/Subscriber-iMRFG7ba.cjs.map +1 -0
- package/dist/SubscriberBuilder-CiPxgnKT.d.mts +26 -0
- package/dist/SubscriberBuilder-Dhz0C_t-.mjs +54 -0
- package/dist/SubscriberBuilder-Dhz0C_t-.mjs.map +1 -0
- package/dist/SubscriberBuilder-DuIgxuzc.d.cts +26 -0
- package/dist/SubscriberBuilder-wthr-FL9.cjs +60 -0
- package/dist/SubscriberBuilder-wthr-FL9.cjs.map +1 -0
- package/dist/adaptors/aws.cjs +19 -0
- package/dist/adaptors/aws.d.cts +15 -0
- package/dist/adaptors/aws.d.mts +15 -0
- package/dist/adaptors/aws.mjs +16 -0
- package/dist/adaptors/hono.cjs +12 -0
- package/dist/adaptors/hono.d.cts +9 -0
- package/dist/adaptors/hono.d.mts +9 -0
- package/dist/adaptors/hono.mjs +12 -0
- package/dist/chunk-CUT6urMc.cjs +30 -0
- package/dist/crons/Cron.cjs +8 -0
- package/dist/crons/Cron.d.cts +7 -0
- package/dist/crons/Cron.d.mts +7 -0
- package/dist/crons/Cron.mjs +8 -0
- package/dist/crons/CronBuilder.cjs +9 -0
- package/dist/crons/CronBuilder.d.cts +8 -0
- package/dist/crons/CronBuilder.d.mts +8 -0
- package/dist/crons/CronBuilder.mjs +9 -0
- package/dist/crons/index.cjs +16 -0
- package/dist/crons/index.cjs.map +1 -0
- package/dist/crons/index.d.cts +16 -0
- package/dist/crons/index.d.mts +16 -0
- package/dist/crons/index.mjs +14 -0
- package/dist/crons/index.mjs.map +1 -0
- package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.cjs +10 -0
- package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.d.cts +9 -0
- package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.d.mts +9 -0
- package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.mjs +10 -0
- package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.cjs +12 -0
- package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.d.cts +10 -0
- package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.d.mts +10 -0
- package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.mjs +12 -0
- package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.cjs +12 -0
- package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.d.cts +10 -0
- package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.d.mts +10 -0
- package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.mjs +12 -0
- package/dist/endpoints/Endpoint.cjs +9 -0
- package/dist/endpoints/Endpoint.d.cts +8 -0
- package/dist/endpoints/Endpoint.d.mts +8 -0
- package/dist/endpoints/Endpoint.mjs +8 -0
- package/dist/endpoints/EndpointBuilder.cjs +9 -0
- package/dist/endpoints/EndpointBuilder.d.cts +9 -0
- package/dist/endpoints/EndpointBuilder.d.mts +9 -0
- package/dist/endpoints/EndpointBuilder.mjs +9 -0
- package/dist/endpoints/EndpointFactory.cjs +11 -0
- package/dist/endpoints/EndpointFactory.d.cts +10 -0
- package/dist/endpoints/EndpointFactory.d.mts +10 -0
- package/dist/endpoints/EndpointFactory.mjs +10 -0
- package/dist/endpoints/HonoEndpointAdaptor.cjs +12 -0
- package/dist/endpoints/HonoEndpointAdaptor.d.cts +9 -0
- package/dist/endpoints/HonoEndpointAdaptor.d.mts +9 -0
- package/dist/endpoints/HonoEndpointAdaptor.mjs +12 -0
- package/dist/endpoints/TestEndpointAdaptor.cjs +54 -0
- package/dist/endpoints/TestEndpointAdaptor.cjs.map +1 -0
- package/dist/endpoints/TestEndpointAdaptor.d.cts +29 -0
- package/dist/endpoints/TestEndpointAdaptor.d.mts +29 -0
- package/dist/endpoints/TestEndpointAdaptor.mjs +53 -0
- package/dist/endpoints/TestEndpointAdaptor.mjs.map +1 -0
- package/dist/endpoints/helpers.cjs +10 -0
- package/dist/endpoints/helpers.d.cts +58 -0
- package/dist/endpoints/helpers.d.mts +58 -0
- package/dist/endpoints/helpers.mjs +9 -0
- package/dist/endpoints/index.cjs +16 -0
- package/dist/endpoints/index.cjs.map +1 -0
- package/dist/endpoints/index.d.cts +16 -0
- package/dist/endpoints/index.d.mts +16 -0
- package/dist/endpoints/index.mjs +15 -0
- package/dist/endpoints/index.mjs.map +1 -0
- package/dist/endpoints/parseHonoQuery.cjs +3 -0
- package/dist/endpoints/parseHonoQuery.d.cts +12 -0
- package/dist/endpoints/parseHonoQuery.d.mts +12 -0
- package/dist/endpoints/parseHonoQuery.mjs +3 -0
- package/dist/endpoints/parseQueryParams.cjs +3 -0
- package/dist/endpoints/parseQueryParams.d.cts +13 -0
- package/dist/endpoints/parseQueryParams.d.mts +13 -0
- package/dist/endpoints/parseQueryParams.mjs +3 -0
- package/dist/functions/AWSLambdaFunction.cjs +9 -0
- package/dist/functions/AWSLambdaFunction.d.cts +5 -0
- package/dist/functions/AWSLambdaFunction.d.mts +5 -0
- package/dist/functions/AWSLambdaFunction.mjs +9 -0
- package/dist/functions/BaseFunctionBuilder.cjs +4 -0
- package/dist/functions/BaseFunctionBuilder.d.cts +3 -0
- package/dist/functions/BaseFunctionBuilder.d.mts +3 -0
- package/dist/functions/BaseFunctionBuilder.mjs +4 -0
- package/dist/functions/Function.cjs +5 -0
- package/dist/functions/Function.d.cts +3 -0
- package/dist/functions/Function.d.mts +3 -0
- package/dist/functions/Function.mjs +4 -0
- package/dist/functions/FunctionBuilder.cjs +6 -0
- package/dist/functions/FunctionBuilder.d.cts +5 -0
- package/dist/functions/FunctionBuilder.d.mts +5 -0
- package/dist/functions/FunctionBuilder.mjs +6 -0
- package/dist/functions/FunctionExecutionWrapper.cjs +8 -0
- package/dist/functions/FunctionExecutionWrapper.d.cts +4 -0
- package/dist/functions/FunctionExecutionWrapper.d.mts +4 -0
- package/dist/functions/FunctionExecutionWrapper.mjs +8 -0
- package/dist/functions/TestFunctionAdaptor.cjs +38 -0
- package/dist/functions/TestFunctionAdaptor.cjs.map +1 -0
- package/dist/functions/TestFunctionAdaptor.d.cts +26 -0
- package/dist/functions/TestFunctionAdaptor.d.mts +26 -0
- package/dist/functions/TestFunctionAdaptor.mjs +37 -0
- package/dist/functions/TestFunctionAdaptor.mjs.map +1 -0
- package/dist/functions/index.cjs +10 -0
- package/dist/functions/index.d.cts +6 -0
- package/dist/functions/index.d.mts +6 -0
- package/dist/functions/index.mjs +7 -0
- package/dist/functions-DVDb5wEA.cjs +13 -0
- package/dist/functions-DVDb5wEA.cjs.map +1 -0
- package/dist/functions-mM-jcphA.mjs +8 -0
- package/dist/functions-mM-jcphA.mjs.map +1 -0
- package/dist/helpers-BeGM4pP_.cjs +95 -0
- package/dist/helpers-BeGM4pP_.cjs.map +1 -0
- package/dist/helpers-DbpO95aE.mjs +83 -0
- package/dist/helpers-DbpO95aE.mjs.map +1 -0
- package/dist/index-CuGR4L7O.d.mts +9 -0
- package/dist/index-Fg3N3EKD.d.cts +9 -0
- package/dist/index.cjs +4 -0
- package/dist/index.d.cts +4 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.mjs +3 -0
- package/dist/parseHonoQuery-DopC24vB.cjs +37 -0
- package/dist/parseHonoQuery-DopC24vB.cjs.map +1 -0
- package/dist/parseHonoQuery-znDKBhdE.mjs +31 -0
- package/dist/parseHonoQuery-znDKBhdE.mjs.map +1 -0
- package/dist/parseQueryParams-BJaRh3OB.mjs +32 -0
- package/dist/parseQueryParams-BJaRh3OB.mjs.map +1 -0
- package/dist/parseQueryParams-BzPop4I1.cjs +38 -0
- package/dist/parseQueryParams-BzPop4I1.cjs.map +1 -0
- package/dist/publisher-Bw4770Hi.mjs +41 -0
- package/dist/publisher-Bw4770Hi.mjs.map +1 -0
- package/dist/publisher-lFQleddL.cjs +53 -0
- package/dist/publisher-lFQleddL.cjs.map +1 -0
- package/dist/publisher.cjs +4 -0
- package/dist/publisher.d.cts +13 -0
- package/dist/publisher.d.mts +13 -0
- package/dist/publisher.mjs +3 -0
- package/dist/subscribers/AWSLambdaSubscriberAdaptor.cjs +3 -0
- package/dist/subscribers/AWSLambdaSubscriberAdaptor.d.cts +4 -0
- package/dist/subscribers/AWSLambdaSubscriberAdaptor.d.mts +4 -0
- package/dist/subscribers/AWSLambdaSubscriberAdaptor.mjs +3 -0
- package/dist/subscribers/Subscriber.cjs +4 -0
- package/dist/subscribers/Subscriber.d.cts +3 -0
- package/dist/subscribers/Subscriber.d.mts +3 -0
- package/dist/subscribers/Subscriber.mjs +4 -0
- package/dist/subscribers/SubscriberBuilder.cjs +5 -0
- package/dist/subscribers/SubscriberBuilder.d.cts +4 -0
- package/dist/subscribers/SubscriberBuilder.d.mts +4 -0
- package/dist/subscribers/SubscriberBuilder.mjs +5 -0
- package/dist/subscribers/index.cjs +12 -0
- package/dist/subscribers/index.cjs.map +1 -0
- package/dist/subscribers/index.d.cts +10 -0
- package/dist/subscribers/index.d.mts +10 -0
- package/dist/subscribers/index.mjs +10 -0
- package/dist/subscribers/index.mjs.map +1 -0
- package/dist/types-Bp9ysFXd.d.cts +7 -0
- package/dist/types-DBKNYvsW.d.mts +7 -0
- package/dist/types.cjs +0 -0
- package/dist/types.d.cts +2 -0
- package/dist/types.d.mts +2 -0
- package/dist/types.mjs +0 -0
- package/package.json +91 -0
- package/src/Construct.ts +98 -0
- package/src/__tests__/Construct.environment.spec.ts +360 -0
- package/src/__tests__/publisher.setting.spec.ts +511 -0
- package/src/__tests__/publisher.spec.ts +454 -0
- package/src/adaptors/aws.ts +4 -0
- package/src/adaptors/hono.ts +1 -0
- package/src/crons/Cron.ts +137 -0
- package/src/crons/CronBuilder.ts +192 -0
- package/src/crons/__tests__/Cron.spec.ts +464 -0
- package/src/crons/index.ts +11 -0
- package/src/endpoints/AmazonApiGatewayEndpointAdaptor.ts +315 -0
- package/src/endpoints/AmazonApiGatewayV1EndpointAdaptor.ts +101 -0
- package/src/endpoints/AmazonApiGatewayV2EndpointAdaptor.ts +95 -0
- package/src/endpoints/Endpoint.ts +771 -0
- package/src/endpoints/EndpointBuilder.ts +308 -0
- package/src/endpoints/EndpointFactory.ts +329 -0
- package/src/endpoints/HonoEndpointAdaptor.ts +365 -0
- package/src/endpoints/TestEndpointAdaptor.ts +130 -0
- package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.events.spec.ts +553 -0
- package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.spec.ts +927 -0
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.events.spec.ts +721 -0
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.factory-publisher.spec.ts +296 -0
- package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.spec.ts +441 -0
- package/src/endpoints/__tests__/Endpoint.spec.ts +800 -0
- package/src/endpoints/__tests__/EndpointBuilder.spec.ts +488 -0
- package/src/endpoints/__tests__/EndpointFactory.spec.ts +479 -0
- package/src/endpoints/__tests__/HonoEndpointAdaptor.events.spec.ts +569 -0
- package/src/endpoints/__tests__/HonoEndpointAdaptor.openapi.spec.ts +313 -0
- package/src/endpoints/__tests__/HonoEndpointAdaptor.spec.ts +1078 -0
- package/src/endpoints/__tests__/TestEndpointAdaptor.spec.ts +236 -0
- package/src/endpoints/__tests__/__snapshots__/HonoEndpointAdaptor.spec.ts.snap +54 -0
- package/src/endpoints/__tests__/endpoint-types.test.ts +88 -0
- package/src/endpoints/helpers.ts +99 -0
- package/src/endpoints/index.ts +5 -0
- package/src/endpoints/parseHonoQuery.ts +51 -0
- package/src/endpoints/parseQueryParams.ts +51 -0
- package/src/functions/AWSLambdaFunction.ts +222 -0
- package/src/functions/BaseFunctionBuilder.ts +110 -0
- package/src/functions/Function.ts +160 -0
- package/src/functions/FunctionBuilder.ts +182 -0
- package/src/functions/FunctionExecutionWrapper.ts +86 -0
- package/src/functions/TestFunctionAdaptor.ts +125 -0
- package/src/functions/__tests__/AWSLambdaFunctionAdaptor.spec.ts +376 -0
- package/src/functions/__tests__/Function.spec.ts +402 -0
- package/src/functions/__tests__/TestFunctionAdaptor.spec.ts +398 -0
- package/src/functions/index.ts +10 -0
- package/src/index.ts +14 -0
- package/src/publisher.ts +83 -0
- package/src/subscribers/AWSLambdaSubscriberAdaptor.ts +269 -0
- package/src/subscribers/Subscriber.ts +112 -0
- package/src/subscribers/SubscriberBuilder.ts +150 -0
- package/src/subscribers/__tests__/AWSLambdaSubscriberAdaptor.spec.ts +623 -0
- package/src/subscribers/__tests__/Subscriber.spec.ts +432 -0
- package/src/subscribers/index.ts +5 -0
- package/src/types.ts +13 -0
- package/tsdown.config.ts +3 -0
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
import { EnvironmentParser } from '@geekmidas/envkit';
|
|
2
|
+
import type { APIGatewayProxyEventV2, Context } from 'aws-lambda';
|
|
3
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { AmazonApiGatewayV2Endpoint } from '../AmazonApiGatewayV2EndpointAdaptor';
|
|
6
|
+
import { e } from '../EndpointFactory';
|
|
7
|
+
|
|
8
|
+
describe('AmazonApiGatewayV2Endpoint', () => {
|
|
9
|
+
let envParser: EnvironmentParser<{}>;
|
|
10
|
+
let mockContext: Context;
|
|
11
|
+
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
envParser = new EnvironmentParser({});
|
|
14
|
+
mockContext = {
|
|
15
|
+
functionName: 'test-function',
|
|
16
|
+
functionVersion: '1',
|
|
17
|
+
awsRequestId: 'test-request-id',
|
|
18
|
+
invokedFunctionArn: 'arn:aws:lambda:us-east-1:123456789012:function:test',
|
|
19
|
+
memoryLimitInMB: '128',
|
|
20
|
+
logGroupName: '/aws/lambda/test',
|
|
21
|
+
logStreamName: '2024/01/01/[$LATEST]test',
|
|
22
|
+
callbackWaitsForEmptyEventLoop: true,
|
|
23
|
+
getRemainingTimeInMillis: () => 30000,
|
|
24
|
+
done: vi.fn(),
|
|
25
|
+
fail: vi.fn(),
|
|
26
|
+
succeed: vi.fn(),
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
describe('getInput', () => {
|
|
31
|
+
it('should parse request body, query, and params', () => {
|
|
32
|
+
const endpoint = e.get('/test').handle(() => ({ success: true }));
|
|
33
|
+
const adapter = new AmazonApiGatewayV2Endpoint(envParser, endpoint);
|
|
34
|
+
|
|
35
|
+
const event: APIGatewayProxyEventV2 = {
|
|
36
|
+
version: '2.0',
|
|
37
|
+
routeKey: 'GET /test',
|
|
38
|
+
rawPath: '/test',
|
|
39
|
+
rawQueryString: 'foo=bar&baz=qux',
|
|
40
|
+
cookies: [],
|
|
41
|
+
headers: {},
|
|
42
|
+
queryStringParameters: { foo: 'bar', baz: 'qux' },
|
|
43
|
+
pathParameters: { id: '123' },
|
|
44
|
+
requestContext: {
|
|
45
|
+
accountId: '123456789012',
|
|
46
|
+
apiId: 'api-id',
|
|
47
|
+
domainName: 'api.example.com',
|
|
48
|
+
domainPrefix: 'api',
|
|
49
|
+
http: {
|
|
50
|
+
method: 'GET',
|
|
51
|
+
path: '/test',
|
|
52
|
+
protocol: 'HTTP/1.1',
|
|
53
|
+
sourceIp: '127.0.0.1',
|
|
54
|
+
userAgent: 'test-agent',
|
|
55
|
+
},
|
|
56
|
+
requestId: 'request-id',
|
|
57
|
+
routeKey: 'GET /test',
|
|
58
|
+
stage: 'prod',
|
|
59
|
+
time: '01/Jan/2024:00:00:00 +0000',
|
|
60
|
+
timeEpoch: 1704067200000,
|
|
61
|
+
},
|
|
62
|
+
body: JSON.stringify({ name: 'test' }),
|
|
63
|
+
isBase64Encoded: false,
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const result = adapter.getInput(event);
|
|
67
|
+
|
|
68
|
+
expect(result).toEqual({
|
|
69
|
+
body: { name: 'test' },
|
|
70
|
+
query: { foo: 'bar', baz: 'qux' },
|
|
71
|
+
params: { id: '123' },
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('should handle missing body, query, and params', () => {
|
|
76
|
+
const endpoint = e.get('/test').handle(() => ({ success: true }));
|
|
77
|
+
const adapter = new AmazonApiGatewayV2Endpoint(envParser, endpoint);
|
|
78
|
+
|
|
79
|
+
const event: APIGatewayProxyEventV2 = {
|
|
80
|
+
version: '2.0',
|
|
81
|
+
routeKey: 'GET /test',
|
|
82
|
+
rawPath: '/test',
|
|
83
|
+
rawQueryString: '',
|
|
84
|
+
cookies: [],
|
|
85
|
+
headers: {},
|
|
86
|
+
requestContext: {
|
|
87
|
+
accountId: '123456789012',
|
|
88
|
+
apiId: 'api-id',
|
|
89
|
+
domainName: 'api.example.com',
|
|
90
|
+
domainPrefix: 'api',
|
|
91
|
+
http: {
|
|
92
|
+
method: 'GET',
|
|
93
|
+
path: '/test',
|
|
94
|
+
protocol: 'HTTP/1.1',
|
|
95
|
+
sourceIp: '127.0.0.1',
|
|
96
|
+
userAgent: 'test-agent',
|
|
97
|
+
},
|
|
98
|
+
requestId: 'request-id',
|
|
99
|
+
routeKey: 'GET /test',
|
|
100
|
+
stage: 'prod',
|
|
101
|
+
time: '01/Jan/2024:00:00:00 +0000',
|
|
102
|
+
timeEpoch: 1704067200000,
|
|
103
|
+
},
|
|
104
|
+
isBase64Encoded: false,
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const result = adapter.getInput(event);
|
|
108
|
+
|
|
109
|
+
expect(result).toEqual({
|
|
110
|
+
body: undefined,
|
|
111
|
+
query: {},
|
|
112
|
+
params: {},
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
describe('getLoggerContext', () => {
|
|
118
|
+
it('should extract logger context from event and context', () => {
|
|
119
|
+
const endpoint = e.get('/test').handle(() => ({ success: true }));
|
|
120
|
+
const adapter = new AmazonApiGatewayV2Endpoint(envParser, endpoint);
|
|
121
|
+
|
|
122
|
+
const event: APIGatewayProxyEventV2 = {
|
|
123
|
+
version: '2.0',
|
|
124
|
+
routeKey: 'GET /test',
|
|
125
|
+
rawPath: '/test',
|
|
126
|
+
rawQueryString: '',
|
|
127
|
+
cookies: [],
|
|
128
|
+
headers: {},
|
|
129
|
+
requestContext: {
|
|
130
|
+
accountId: '123456789012',
|
|
131
|
+
apiId: 'api-id',
|
|
132
|
+
domainName: 'api.example.com',
|
|
133
|
+
domainPrefix: 'api',
|
|
134
|
+
http: {
|
|
135
|
+
method: 'GET',
|
|
136
|
+
path: '/test/123',
|
|
137
|
+
protocol: 'HTTP/1.1',
|
|
138
|
+
sourceIp: '192.168.1.1',
|
|
139
|
+
userAgent: 'Mozilla/5.0 Test',
|
|
140
|
+
},
|
|
141
|
+
requestId: 'event-request-id',
|
|
142
|
+
routeKey: 'GET /test',
|
|
143
|
+
stage: 'prod',
|
|
144
|
+
time: '01/Jan/2024:00:00:00 +0000',
|
|
145
|
+
timeEpoch: 1704067200000,
|
|
146
|
+
},
|
|
147
|
+
isBase64Encoded: false,
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const result = adapter.getLoggerContext(event, mockContext);
|
|
151
|
+
|
|
152
|
+
expect(result).toEqual({
|
|
153
|
+
fn: {
|
|
154
|
+
name: 'test-function',
|
|
155
|
+
version: '1',
|
|
156
|
+
},
|
|
157
|
+
req: {
|
|
158
|
+
id: 'event-request-id',
|
|
159
|
+
awsRequestId: 'test-request-id',
|
|
160
|
+
ip: '192.168.1.1',
|
|
161
|
+
userAgent: 'Mozilla/5.0 Test',
|
|
162
|
+
path: '/test/123',
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
it('should handle missing user agent', () => {
|
|
168
|
+
const endpoint = e.get('/test').handle(() => ({ success: true }));
|
|
169
|
+
const adapter = new AmazonApiGatewayV2Endpoint(envParser, endpoint);
|
|
170
|
+
|
|
171
|
+
const event: APIGatewayProxyEventV2 = {
|
|
172
|
+
version: '2.0',
|
|
173
|
+
routeKey: 'GET /test',
|
|
174
|
+
rawPath: '/test',
|
|
175
|
+
rawQueryString: '',
|
|
176
|
+
cookies: [],
|
|
177
|
+
headers: {},
|
|
178
|
+
requestContext: {
|
|
179
|
+
accountId: '123456789012',
|
|
180
|
+
apiId: 'api-id',
|
|
181
|
+
domainName: 'api.example.com',
|
|
182
|
+
domainPrefix: 'api',
|
|
183
|
+
http: {
|
|
184
|
+
method: 'GET',
|
|
185
|
+
path: '/test',
|
|
186
|
+
protocol: 'HTTP/1.1',
|
|
187
|
+
sourceIp: '127.0.0.1',
|
|
188
|
+
userAgent: '',
|
|
189
|
+
},
|
|
190
|
+
requestId: 'request-id',
|
|
191
|
+
routeKey: 'GET /test',
|
|
192
|
+
stage: 'prod',
|
|
193
|
+
time: '01/Jan/2024:00:00:00 +0000',
|
|
194
|
+
timeEpoch: 1704067200000,
|
|
195
|
+
},
|
|
196
|
+
isBase64Encoded: false,
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
const result = adapter.getLoggerContext(event, mockContext);
|
|
200
|
+
|
|
201
|
+
expect(result.req.userAgent).toBeUndefined();
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
describe('integration', () => {
|
|
206
|
+
it('should handle endpoint with body schema validation', async () => {
|
|
207
|
+
const endpoint = e
|
|
208
|
+
.post('/users')
|
|
209
|
+
.body(z.object({ name: z.string(), age: z.number() }))
|
|
210
|
+
.output(z.object({ id: z.string(), name: z.string() }))
|
|
211
|
+
.handle(async ({ body }) => ({
|
|
212
|
+
id: '123',
|
|
213
|
+
name: body.name,
|
|
214
|
+
}));
|
|
215
|
+
|
|
216
|
+
const adapter = new AmazonApiGatewayV2Endpoint(envParser, endpoint);
|
|
217
|
+
|
|
218
|
+
const event: APIGatewayProxyEventV2 = {
|
|
219
|
+
version: '2.0',
|
|
220
|
+
routeKey: 'POST /users',
|
|
221
|
+
rawPath: '/users',
|
|
222
|
+
rawQueryString: '',
|
|
223
|
+
cookies: [],
|
|
224
|
+
headers: { 'content-type': 'application/json' },
|
|
225
|
+
requestContext: {
|
|
226
|
+
accountId: '123456789012',
|
|
227
|
+
apiId: 'api-id',
|
|
228
|
+
domainName: 'api.example.com',
|
|
229
|
+
domainPrefix: 'api',
|
|
230
|
+
http: {
|
|
231
|
+
method: 'POST',
|
|
232
|
+
path: '/users',
|
|
233
|
+
protocol: 'HTTP/1.1',
|
|
234
|
+
sourceIp: '127.0.0.1',
|
|
235
|
+
userAgent: 'test',
|
|
236
|
+
},
|
|
237
|
+
requestId: 'request-id',
|
|
238
|
+
routeKey: 'POST /users',
|
|
239
|
+
stage: 'prod',
|
|
240
|
+
time: '01/Jan/2024:00:00:00 +0000',
|
|
241
|
+
timeEpoch: 1704067200000,
|
|
242
|
+
},
|
|
243
|
+
body: JSON.stringify({ name: 'John', age: 30 }),
|
|
244
|
+
isBase64Encoded: false,
|
|
245
|
+
};
|
|
246
|
+
// @ts-ignore
|
|
247
|
+
const response = await adapter.handler(event, mockContext);
|
|
248
|
+
|
|
249
|
+
expect(response).toEqual({
|
|
250
|
+
statusCode: 200,
|
|
251
|
+
body: JSON.stringify({ id: '123', name: 'John' }),
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
it('should handle array query parameters (comma-separated)', async () => {
|
|
256
|
+
const endpoint = e
|
|
257
|
+
.get('/search')
|
|
258
|
+
.query(
|
|
259
|
+
z.object({
|
|
260
|
+
tags: z.array(z.string()),
|
|
261
|
+
limit: z.coerce.number().default(10),
|
|
262
|
+
}),
|
|
263
|
+
)
|
|
264
|
+
.output(
|
|
265
|
+
z.object({
|
|
266
|
+
tags: z.array(z.string()),
|
|
267
|
+
limit: z.number(),
|
|
268
|
+
}),
|
|
269
|
+
)
|
|
270
|
+
.handle(async ({ query }) => ({
|
|
271
|
+
tags: query.tags,
|
|
272
|
+
limit: query.limit,
|
|
273
|
+
}));
|
|
274
|
+
|
|
275
|
+
const adapter = new AmazonApiGatewayV2Endpoint(envParser, endpoint);
|
|
276
|
+
|
|
277
|
+
const event: APIGatewayProxyEventV2 = {
|
|
278
|
+
version: '2.0',
|
|
279
|
+
routeKey: 'GET /search',
|
|
280
|
+
rawPath: '/search',
|
|
281
|
+
rawQueryString: 'tags=nodejs,typescript,javascript&limit=20',
|
|
282
|
+
cookies: [],
|
|
283
|
+
headers: {},
|
|
284
|
+
queryStringParameters: {
|
|
285
|
+
tags: 'nodejs,typescript,javascript',
|
|
286
|
+
limit: '20',
|
|
287
|
+
},
|
|
288
|
+
requestContext: {
|
|
289
|
+
accountId: '123456789012',
|
|
290
|
+
apiId: 'api-id',
|
|
291
|
+
domainName: 'api.example.com',
|
|
292
|
+
domainPrefix: 'api',
|
|
293
|
+
http: {
|
|
294
|
+
method: 'GET',
|
|
295
|
+
path: '/search',
|
|
296
|
+
protocol: 'HTTP/1.1',
|
|
297
|
+
sourceIp: '127.0.0.1',
|
|
298
|
+
userAgent: 'test',
|
|
299
|
+
},
|
|
300
|
+
requestId: 'request-id',
|
|
301
|
+
routeKey: 'GET /search',
|
|
302
|
+
stage: 'prod',
|
|
303
|
+
time: '01/Jan/2024:00:00:00 +0000',
|
|
304
|
+
timeEpoch: 1704067200000,
|
|
305
|
+
},
|
|
306
|
+
isBase64Encoded: false,
|
|
307
|
+
};
|
|
308
|
+
// @ts-ignore
|
|
309
|
+
const response = await adapter.handler(event, mockContext);
|
|
310
|
+
|
|
311
|
+
expect(response).toEqual({
|
|
312
|
+
statusCode: 200,
|
|
313
|
+
body: JSON.stringify({
|
|
314
|
+
tags: ['nodejs', 'typescript', 'javascript'],
|
|
315
|
+
limit: 20,
|
|
316
|
+
}),
|
|
317
|
+
});
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
it('should handle object query parameters with dot notation', async () => {
|
|
321
|
+
const endpoint = e
|
|
322
|
+
.get('/search')
|
|
323
|
+
.query(
|
|
324
|
+
z.object({
|
|
325
|
+
filter: z.object({
|
|
326
|
+
category: z.string(),
|
|
327
|
+
active: z.coerce.boolean(),
|
|
328
|
+
}),
|
|
329
|
+
}),
|
|
330
|
+
)
|
|
331
|
+
.output(
|
|
332
|
+
z.object({
|
|
333
|
+
filter: z.object({
|
|
334
|
+
category: z.string(),
|
|
335
|
+
active: z.boolean(),
|
|
336
|
+
}),
|
|
337
|
+
}),
|
|
338
|
+
)
|
|
339
|
+
.handle(async ({ query }) => ({
|
|
340
|
+
filter: query.filter,
|
|
341
|
+
}));
|
|
342
|
+
|
|
343
|
+
const adapter = new AmazonApiGatewayV2Endpoint(envParser, endpoint);
|
|
344
|
+
|
|
345
|
+
const event: APIGatewayProxyEventV2 = {
|
|
346
|
+
version: '2.0',
|
|
347
|
+
routeKey: 'GET /search',
|
|
348
|
+
rawPath: '/search',
|
|
349
|
+
rawQueryString: 'filter.category=electronics&filter.active=true',
|
|
350
|
+
cookies: [],
|
|
351
|
+
headers: {},
|
|
352
|
+
queryStringParameters: {
|
|
353
|
+
'filter.category': 'electronics',
|
|
354
|
+
'filter.active': 'true',
|
|
355
|
+
},
|
|
356
|
+
requestContext: {
|
|
357
|
+
accountId: '123456789012',
|
|
358
|
+
apiId: 'api-id',
|
|
359
|
+
domainName: 'api.example.com',
|
|
360
|
+
domainPrefix: 'api',
|
|
361
|
+
http: {
|
|
362
|
+
method: 'GET',
|
|
363
|
+
path: '/search',
|
|
364
|
+
protocol: 'HTTP/1.1',
|
|
365
|
+
sourceIp: '127.0.0.1',
|
|
366
|
+
userAgent: 'test',
|
|
367
|
+
},
|
|
368
|
+
requestId: 'request-id',
|
|
369
|
+
routeKey: 'GET /search',
|
|
370
|
+
stage: 'prod',
|
|
371
|
+
time: '01/Jan/2024:00:00:00 +0000',
|
|
372
|
+
timeEpoch: 1704067200000,
|
|
373
|
+
},
|
|
374
|
+
isBase64Encoded: false,
|
|
375
|
+
};
|
|
376
|
+
// @ts-ignore
|
|
377
|
+
const response = await adapter.handler(event, mockContext);
|
|
378
|
+
|
|
379
|
+
expect(response).toEqual({
|
|
380
|
+
statusCode: 200,
|
|
381
|
+
body: JSON.stringify({
|
|
382
|
+
filter: {
|
|
383
|
+
category: 'electronics',
|
|
384
|
+
active: true,
|
|
385
|
+
},
|
|
386
|
+
}),
|
|
387
|
+
});
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
it('should handle endpoint with query and params', async () => {
|
|
391
|
+
const endpoint = e
|
|
392
|
+
.get('/users/:id')
|
|
393
|
+
.params(z.object({ id: z.string() }))
|
|
394
|
+
.query(z.object({ include: z.string().optional() }))
|
|
395
|
+
.output(z.object({ id: z.string(), include: z.string().optional() }))
|
|
396
|
+
.handle(async ({ params, query }) => ({
|
|
397
|
+
id: params.id,
|
|
398
|
+
include: query.include,
|
|
399
|
+
}));
|
|
400
|
+
|
|
401
|
+
const adapter = new AmazonApiGatewayV2Endpoint(envParser, endpoint);
|
|
402
|
+
|
|
403
|
+
const event: APIGatewayProxyEventV2 = {
|
|
404
|
+
version: '2.0',
|
|
405
|
+
routeKey: 'GET /users/{id}',
|
|
406
|
+
rawPath: '/users/123',
|
|
407
|
+
rawQueryString: 'include=profile',
|
|
408
|
+
cookies: [],
|
|
409
|
+
headers: {},
|
|
410
|
+
queryStringParameters: { include: 'profile' },
|
|
411
|
+
pathParameters: { id: '123' },
|
|
412
|
+
requestContext: {
|
|
413
|
+
accountId: '123456789012',
|
|
414
|
+
apiId: 'api-id',
|
|
415
|
+
domainName: 'api.example.com',
|
|
416
|
+
domainPrefix: 'api',
|
|
417
|
+
http: {
|
|
418
|
+
method: 'GET',
|
|
419
|
+
path: '/users/123',
|
|
420
|
+
protocol: 'HTTP/1.1',
|
|
421
|
+
sourceIp: '127.0.0.1',
|
|
422
|
+
userAgent: 'test',
|
|
423
|
+
},
|
|
424
|
+
requestId: 'request-id',
|
|
425
|
+
routeKey: 'GET /users/{id}',
|
|
426
|
+
stage: 'prod',
|
|
427
|
+
time: '01/Jan/2024:00:00:00 +0000',
|
|
428
|
+
timeEpoch: 1704067200000,
|
|
429
|
+
},
|
|
430
|
+
isBase64Encoded: false,
|
|
431
|
+
};
|
|
432
|
+
// @ts-ignore
|
|
433
|
+
const response = await adapter.handler(event, mockContext);
|
|
434
|
+
|
|
435
|
+
expect(response).toEqual({
|
|
436
|
+
statusCode: 200,
|
|
437
|
+
body: JSON.stringify({ id: '123', include: 'profile' }),
|
|
438
|
+
});
|
|
439
|
+
});
|
|
440
|
+
});
|
|
441
|
+
});
|