@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,360 @@
|
|
|
1
|
+
import type { EnvironmentParser } from '@geekmidas/envkit';
|
|
2
|
+
import type { PublishableMessage } from '@geekmidas/events';
|
|
3
|
+
import type { Service } from '@geekmidas/services';
|
|
4
|
+
import { describe, expect, it } from 'vitest';
|
|
5
|
+
import { z } from 'zod/v4';
|
|
6
|
+
import { c } from '../crons';
|
|
7
|
+
import { e } from '../endpoints';
|
|
8
|
+
import { f } from '../functions';
|
|
9
|
+
import { s } from '../subscribers';
|
|
10
|
+
|
|
11
|
+
describe('Construct environment getter', () => {
|
|
12
|
+
describe('Function', () => {
|
|
13
|
+
it('should return empty array when no services are provided', async () => {
|
|
14
|
+
const fn = f.handle(async () => ({ success: true }));
|
|
15
|
+
|
|
16
|
+
expect(await fn.getEnvironment()).toEqual([]);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should detect environment variables from a single service', async () => {
|
|
20
|
+
const databaseService = {
|
|
21
|
+
serviceName: 'database' as const,
|
|
22
|
+
register(envParser: EnvironmentParser<{}>) {
|
|
23
|
+
return envParser.create((get) => ({
|
|
24
|
+
url: get('DATABASE_URL').string(),
|
|
25
|
+
port: get('DATABASE_PORT').string().transform(Number).default(5432),
|
|
26
|
+
}));
|
|
27
|
+
},
|
|
28
|
+
} satisfies Service<'database', any>;
|
|
29
|
+
|
|
30
|
+
const fn = f
|
|
31
|
+
.services([databaseService])
|
|
32
|
+
.handle(async () => ({ success: true }));
|
|
33
|
+
|
|
34
|
+
const envVars = await fn.getEnvironment();
|
|
35
|
+
|
|
36
|
+
expect(envVars).toEqual(['DATABASE_PORT', 'DATABASE_URL']);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('should detect environment variables from multiple services', async () => {
|
|
40
|
+
const databaseService = {
|
|
41
|
+
serviceName: 'database' as const,
|
|
42
|
+
register(envParser: EnvironmentParser<{}>) {
|
|
43
|
+
return envParser.create((get) => ({
|
|
44
|
+
url: get('DATABASE_URL').string(),
|
|
45
|
+
}));
|
|
46
|
+
},
|
|
47
|
+
} satisfies Service<'database', any>;
|
|
48
|
+
|
|
49
|
+
const redisService = {
|
|
50
|
+
serviceName: 'redis' as const,
|
|
51
|
+
register(envParser: EnvironmentParser<{}>) {
|
|
52
|
+
return envParser.create((get) => ({
|
|
53
|
+
url: get('REDIS_URL').string(),
|
|
54
|
+
ttl: get('REDIS_TTL').string().transform(Number).default(3600),
|
|
55
|
+
}));
|
|
56
|
+
},
|
|
57
|
+
} satisfies Service<'redis', any>;
|
|
58
|
+
|
|
59
|
+
const fn = f
|
|
60
|
+
.services([databaseService, redisService])
|
|
61
|
+
.handle(async () => ({ success: true }));
|
|
62
|
+
|
|
63
|
+
const envVars = await fn.getEnvironment();
|
|
64
|
+
|
|
65
|
+
expect(envVars).toEqual(['DATABASE_URL', 'REDIS_TTL', 'REDIS_URL']);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('should deduplicate environment variables across services', async () => {
|
|
69
|
+
const service1 = {
|
|
70
|
+
serviceName: 'service1' as const,
|
|
71
|
+
register(envParser: EnvironmentParser<{}>) {
|
|
72
|
+
return envParser.create((get) => ({
|
|
73
|
+
apiKey: get('SHARED_API_KEY').string(),
|
|
74
|
+
}));
|
|
75
|
+
},
|
|
76
|
+
} satisfies Service<'service1', any>;
|
|
77
|
+
|
|
78
|
+
const service2 = {
|
|
79
|
+
serviceName: 'service2' as const,
|
|
80
|
+
register(envParser: EnvironmentParser<{}>) {
|
|
81
|
+
return envParser.create((get) => ({
|
|
82
|
+
apiKey: get('SHARED_API_KEY').string(),
|
|
83
|
+
}));
|
|
84
|
+
},
|
|
85
|
+
} satisfies Service<'service2', any>;
|
|
86
|
+
|
|
87
|
+
const fn = f
|
|
88
|
+
.services([service1, service2])
|
|
89
|
+
.handle(async () => ({ success: true }));
|
|
90
|
+
|
|
91
|
+
const envVars = await fn.getEnvironment();
|
|
92
|
+
|
|
93
|
+
// Should only appear once despite being used in both services
|
|
94
|
+
expect(envVars).toEqual(['SHARED_API_KEY']);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('should handle services with nested configuration', async () => {
|
|
98
|
+
const configService = {
|
|
99
|
+
serviceName: 'config' as const,
|
|
100
|
+
register(envParser: EnvironmentParser<{}>) {
|
|
101
|
+
return envParser.create((get) => ({
|
|
102
|
+
database: {
|
|
103
|
+
host: get('DB_HOST').string(),
|
|
104
|
+
port: get('DB_PORT').string().transform(Number),
|
|
105
|
+
},
|
|
106
|
+
api: {
|
|
107
|
+
key: get('API_KEY').string(),
|
|
108
|
+
url: get('API_URL').string().url(),
|
|
109
|
+
},
|
|
110
|
+
}));
|
|
111
|
+
},
|
|
112
|
+
} satisfies Service<'config', any>;
|
|
113
|
+
|
|
114
|
+
const fn = f
|
|
115
|
+
.services([configService])
|
|
116
|
+
.handle(async () => ({ success: true }));
|
|
117
|
+
|
|
118
|
+
const envVars = await fn.getEnvironment();
|
|
119
|
+
|
|
120
|
+
expect(envVars).toEqual(['API_KEY', 'API_URL', 'DB_HOST', 'DB_PORT']);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it('should handle services that return non-ConfigParser values', async () => {
|
|
124
|
+
const simpleService = {
|
|
125
|
+
serviceName: 'simple' as const,
|
|
126
|
+
register(_envParser: EnvironmentParser<{}>) {
|
|
127
|
+
// This service doesn't use envParser - just returns a plain object
|
|
128
|
+
return { value: 'test' };
|
|
129
|
+
},
|
|
130
|
+
} satisfies Service<'simple', any>;
|
|
131
|
+
|
|
132
|
+
const databaseService = {
|
|
133
|
+
serviceName: 'database' as const,
|
|
134
|
+
register(envParser: EnvironmentParser<{}>) {
|
|
135
|
+
return envParser.create((get) => ({
|
|
136
|
+
url: get('DATABASE_URL').string(),
|
|
137
|
+
}));
|
|
138
|
+
},
|
|
139
|
+
} satisfies Service<'database', any>;
|
|
140
|
+
|
|
141
|
+
const fn = f
|
|
142
|
+
.services([simpleService, databaseService])
|
|
143
|
+
.handle(async () => ({ success: true }));
|
|
144
|
+
|
|
145
|
+
const envVars = await fn.getEnvironment();
|
|
146
|
+
|
|
147
|
+
// Should only include env vars from databaseService
|
|
148
|
+
expect(envVars).toEqual(['DATABASE_URL']);
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
describe('Endpoint', () => {
|
|
153
|
+
it('should detect environment variables from endpoint services', async () => {
|
|
154
|
+
const authService = {
|
|
155
|
+
serviceName: 'auth' as const,
|
|
156
|
+
register(envParser: EnvironmentParser<{}>) {
|
|
157
|
+
return envParser.create((get) => ({
|
|
158
|
+
secret: get('JWT_SECRET').string(),
|
|
159
|
+
expiresIn: get('JWT_EXPIRES_IN').string().default('15m'),
|
|
160
|
+
}));
|
|
161
|
+
},
|
|
162
|
+
} satisfies Service<'auth', any>;
|
|
163
|
+
|
|
164
|
+
const endpoint = e
|
|
165
|
+
.services([authService])
|
|
166
|
+
.get('/users')
|
|
167
|
+
.handle(async () => []);
|
|
168
|
+
|
|
169
|
+
const envVars = await endpoint.getEnvironment();
|
|
170
|
+
|
|
171
|
+
expect(envVars).toEqual(['JWT_EXPIRES_IN', 'JWT_SECRET']);
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
it('should work with different HTTP methods', async () => {
|
|
175
|
+
const storageService = {
|
|
176
|
+
serviceName: 'storage' as const,
|
|
177
|
+
register(envParser: EnvironmentParser<{}>) {
|
|
178
|
+
return envParser.create((get) => ({
|
|
179
|
+
bucket: get('S3_BUCKET').string(),
|
|
180
|
+
region: get('AWS_REGION').string().default('us-east-1'),
|
|
181
|
+
}));
|
|
182
|
+
},
|
|
183
|
+
} satisfies Service<'storage', any>;
|
|
184
|
+
|
|
185
|
+
const postEndpoint = e
|
|
186
|
+
.services([storageService])
|
|
187
|
+
.post('/upload')
|
|
188
|
+
.handle(async () => ({ success: true }));
|
|
189
|
+
|
|
190
|
+
const getEndpoint = e
|
|
191
|
+
.services([storageService])
|
|
192
|
+
.get('/files')
|
|
193
|
+
.handle(async () => []);
|
|
194
|
+
|
|
195
|
+
expect(await postEndpoint.getEnvironment()).toEqual([
|
|
196
|
+
'AWS_REGION',
|
|
197
|
+
'S3_BUCKET',
|
|
198
|
+
]);
|
|
199
|
+
expect(await getEndpoint.getEnvironment()).toEqual([
|
|
200
|
+
'AWS_REGION',
|
|
201
|
+
'S3_BUCKET',
|
|
202
|
+
]);
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
describe('Cron', () => {
|
|
207
|
+
it('should detect environment variables from cron services', async () => {
|
|
208
|
+
const emailService = {
|
|
209
|
+
serviceName: 'email' as const,
|
|
210
|
+
register(envParser: EnvironmentParser<{}>) {
|
|
211
|
+
return envParser.create((get) => ({
|
|
212
|
+
smtpHost: get('SMTP_HOST').string(),
|
|
213
|
+
smtpPort: get('SMTP_PORT').string().transform(Number).default(587),
|
|
214
|
+
smtpUser: get('SMTP_USER').string(),
|
|
215
|
+
smtpPass: get('SMTP_PASS').string(),
|
|
216
|
+
}));
|
|
217
|
+
},
|
|
218
|
+
} satisfies Service<'email', any>;
|
|
219
|
+
|
|
220
|
+
const cronJob = c
|
|
221
|
+
.services([emailService])
|
|
222
|
+
.schedule('rate(1 hour)')
|
|
223
|
+
.handle(async () => {
|
|
224
|
+
// Send daily report email
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
const envVars = await cronJob.getEnvironment();
|
|
228
|
+
|
|
229
|
+
expect(envVars).toEqual([
|
|
230
|
+
'SMTP_HOST',
|
|
231
|
+
'SMTP_PASS',
|
|
232
|
+
'SMTP_PORT',
|
|
233
|
+
'SMTP_USER',
|
|
234
|
+
]);
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
describe('Subscriber', () => {
|
|
239
|
+
it('should detect environment variables from subscriber services', async () => {
|
|
240
|
+
type UserEvents =
|
|
241
|
+
| PublishableMessage<'user.created', { userId: string }>
|
|
242
|
+
| PublishableMessage<'user.updated', { userId: string }>;
|
|
243
|
+
|
|
244
|
+
const notificationService = {
|
|
245
|
+
serviceName: 'notification' as const,
|
|
246
|
+
register(envParser: EnvironmentParser<{}>) {
|
|
247
|
+
return envParser.create((get) => ({
|
|
248
|
+
apiKey: get('NOTIFICATION_API_KEY').string(),
|
|
249
|
+
endpoint: get('NOTIFICATION_ENDPOINT')
|
|
250
|
+
.string()
|
|
251
|
+
.url()
|
|
252
|
+
.default('https://api.example.com/notify'),
|
|
253
|
+
}));
|
|
254
|
+
},
|
|
255
|
+
} satisfies Service<'notification', any>;
|
|
256
|
+
|
|
257
|
+
const subscriber = s
|
|
258
|
+
.services([notificationService])
|
|
259
|
+
.subscribe('user.created')
|
|
260
|
+
.handle(async ({ events }) => {
|
|
261
|
+
// Handle user created events
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
const envVars = await subscriber.getEnvironment();
|
|
265
|
+
|
|
266
|
+
expect(envVars).toEqual([
|
|
267
|
+
'NOTIFICATION_API_KEY',
|
|
268
|
+
'NOTIFICATION_ENDPOINT',
|
|
269
|
+
]);
|
|
270
|
+
});
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
describe('Edge cases', () => {
|
|
274
|
+
it('should return empty array when services array is empty', async () => {
|
|
275
|
+
const fn = f.services([]).handle(async () => ({ success: true }));
|
|
276
|
+
|
|
277
|
+
expect(await fn.getEnvironment()).toEqual([]);
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
it('should handle service with optional environment variables', async () => {
|
|
281
|
+
const optionalConfigService = {
|
|
282
|
+
serviceName: 'optionalConfig' as const,
|
|
283
|
+
register(envParser: EnvironmentParser<{}>) {
|
|
284
|
+
return envParser.create((get) => ({
|
|
285
|
+
required: get('REQUIRED_VAR').string(),
|
|
286
|
+
optional1: get('OPTIONAL_VAR_1').string().optional(),
|
|
287
|
+
optional2: get('OPTIONAL_VAR_2').string().optional(),
|
|
288
|
+
}));
|
|
289
|
+
},
|
|
290
|
+
} satisfies Service<'optionalConfig', any>;
|
|
291
|
+
|
|
292
|
+
const fn = f
|
|
293
|
+
.services([optionalConfigService])
|
|
294
|
+
.handle(async () => ({ success: true }));
|
|
295
|
+
|
|
296
|
+
const envVars = await fn.getEnvironment();
|
|
297
|
+
|
|
298
|
+
// Should include both required and optional variables
|
|
299
|
+
expect(envVars).toEqual([
|
|
300
|
+
'OPTIONAL_VAR_1',
|
|
301
|
+
'OPTIONAL_VAR_2',
|
|
302
|
+
'REQUIRED_VAR',
|
|
303
|
+
]);
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
it('should be callable multiple times with consistent results', async () => {
|
|
307
|
+
const service = {
|
|
308
|
+
serviceName: 'testService' as const,
|
|
309
|
+
register(envParser: EnvironmentParser<{}>) {
|
|
310
|
+
return envParser.create((get) => ({
|
|
311
|
+
var1: get('VAR_1').string(),
|
|
312
|
+
var2: get('VAR_2').string(),
|
|
313
|
+
}));
|
|
314
|
+
},
|
|
315
|
+
} satisfies Service<'testService', any>;
|
|
316
|
+
|
|
317
|
+
const fn = f.services([service]).handle(async () => ({ success: true }));
|
|
318
|
+
|
|
319
|
+
const firstCall = await fn.getEnvironment();
|
|
320
|
+
const secondCall = await fn.getEnvironment();
|
|
321
|
+
const thirdCall = await fn.getEnvironment();
|
|
322
|
+
|
|
323
|
+
expect(firstCall).toEqual(['VAR_1', 'VAR_2']);
|
|
324
|
+
expect(secondCall).toEqual(['VAR_1', 'VAR_2']);
|
|
325
|
+
expect(thirdCall).toEqual(['VAR_1', 'VAR_2']);
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
it('should handle services with complex transformations', async () => {
|
|
329
|
+
const complexService = {
|
|
330
|
+
serviceName: 'complex' as const,
|
|
331
|
+
register(envParser: EnvironmentParser<{}>) {
|
|
332
|
+
return envParser.create((get) => ({
|
|
333
|
+
origins: get('ALLOWED_ORIGINS')
|
|
334
|
+
.string()
|
|
335
|
+
.transform((v) => v.split(',')),
|
|
336
|
+
flags: get('FEATURE_FLAGS')
|
|
337
|
+
.string()
|
|
338
|
+
.transform((v) => v.split(',').map((f) => f.trim())),
|
|
339
|
+
config: get('JSON_CONFIG')
|
|
340
|
+
.string()
|
|
341
|
+
.transform((v) => JSON.parse(v))
|
|
342
|
+
.pipe(z.record(z.string(), z.boolean())),
|
|
343
|
+
}));
|
|
344
|
+
},
|
|
345
|
+
} satisfies Service<'complex', any>;
|
|
346
|
+
|
|
347
|
+
const fn = f
|
|
348
|
+
.services([complexService])
|
|
349
|
+
.handle(async () => ({ success: true }));
|
|
350
|
+
|
|
351
|
+
const envVars = await fn.getEnvironment();
|
|
352
|
+
|
|
353
|
+
expect(envVars).toEqual([
|
|
354
|
+
'ALLOWED_ORIGINS',
|
|
355
|
+
'FEATURE_FLAGS',
|
|
356
|
+
'JSON_CONFIG',
|
|
357
|
+
]);
|
|
358
|
+
});
|
|
359
|
+
});
|
|
360
|
+
});
|