@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,454 @@
|
|
|
1
|
+
import type { Logger } from '@geekmidas/logger';
|
|
2
|
+
import { type Service, ServiceDiscovery } from '@geekmidas/services';
|
|
3
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
|
|
6
|
+
import { EnvironmentParser } from '@geekmidas/envkit';
|
|
7
|
+
import type { EventPublisher, PublishableMessage } from '@geekmidas/events';
|
|
8
|
+
import { e } from '../endpoints';
|
|
9
|
+
import { publishConstructEvents } from '../publisher';
|
|
10
|
+
|
|
11
|
+
// Test event types
|
|
12
|
+
type TestEvent =
|
|
13
|
+
| PublishableMessage<'user.created', { userId: string; email: string }>
|
|
14
|
+
| PublishableMessage<'user.updated', { userId: string; changes: string[] }>
|
|
15
|
+
| PublishableMessage<'user.deleted', { userId: string }>;
|
|
16
|
+
|
|
17
|
+
describe('publishEndpointEvents', () => {
|
|
18
|
+
const mockLogger: Logger = {
|
|
19
|
+
debug: vi.fn(),
|
|
20
|
+
info: vi.fn(),
|
|
21
|
+
warn: vi.fn(),
|
|
22
|
+
error: vi.fn(),
|
|
23
|
+
fatal: vi.fn(),
|
|
24
|
+
trace: vi.fn(),
|
|
25
|
+
child: vi.fn(() => mockLogger),
|
|
26
|
+
};
|
|
27
|
+
const debugSpy = mockLogger.debug as any;
|
|
28
|
+
const warnSpy = mockLogger.warn as any;
|
|
29
|
+
const errorSpy = mockLogger.error as any;
|
|
30
|
+
|
|
31
|
+
const serviceDiscovery = ServiceDiscovery.getInstance(
|
|
32
|
+
mockLogger,
|
|
33
|
+
new EnvironmentParser({}),
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
beforeEach(() => {
|
|
37
|
+
vi.clearAllMocks();
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('should return early when no events are defined', async () => {
|
|
41
|
+
const endpoint = e
|
|
42
|
+
.logger(mockLogger)
|
|
43
|
+
.post('/test')
|
|
44
|
+
.output(z.object({ success: z.boolean() }))
|
|
45
|
+
.handle(async () => ({ success: true }));
|
|
46
|
+
|
|
47
|
+
await publishConstructEvents(
|
|
48
|
+
endpoint,
|
|
49
|
+
{ success: true },
|
|
50
|
+
serviceDiscovery as ServiceDiscovery<any, any>,
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
expect(debugSpy).toHaveBeenCalledWith('No events to publish');
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('should return early when events array is empty', async () => {
|
|
57
|
+
const mockPublisher: EventPublisher<TestEvent> = {
|
|
58
|
+
publish: vi.fn(),
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const mockPublisherService: Service<string, EventPublisher<TestEvent>> = {
|
|
62
|
+
serviceName: Math.random().toString(),
|
|
63
|
+
register: vi.fn().mockResolvedValue(mockPublisher),
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const endpoint = e
|
|
67
|
+
.logger(mockLogger)
|
|
68
|
+
.publisher(mockPublisherService)
|
|
69
|
+
.post('/test')
|
|
70
|
+
.output(z.object({ success: z.boolean() }))
|
|
71
|
+
.handle(async () => ({ success: true }));
|
|
72
|
+
|
|
73
|
+
await publishConstructEvents(
|
|
74
|
+
endpoint,
|
|
75
|
+
{ success: true },
|
|
76
|
+
serviceDiscovery as ServiceDiscovery<any, any>,
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
expect(debugSpy).toHaveBeenCalledWith('No events to publish');
|
|
80
|
+
expect(mockPublisher.publish).not.toHaveBeenCalled();
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it('should warn when publisher is not available', async () => {
|
|
84
|
+
const outputSchema = z.object({ id: z.string(), email: z.string() });
|
|
85
|
+
|
|
86
|
+
const endpoint = e
|
|
87
|
+
.logger(mockLogger)
|
|
88
|
+
.post('/test')
|
|
89
|
+
.output(outputSchema)
|
|
90
|
+
|
|
91
|
+
.event({
|
|
92
|
+
// @ts-ignore
|
|
93
|
+
type: 'user.created',
|
|
94
|
+
// @ts-ignore
|
|
95
|
+
payload: (response) => ({
|
|
96
|
+
userId: response.id,
|
|
97
|
+
email: response.email,
|
|
98
|
+
}),
|
|
99
|
+
})
|
|
100
|
+
.handle(async () => ({ id: '123', email: 'test@example.com' }));
|
|
101
|
+
|
|
102
|
+
await publishConstructEvents(
|
|
103
|
+
endpoint,
|
|
104
|
+
{
|
|
105
|
+
id: '123',
|
|
106
|
+
email: 'test@example.com',
|
|
107
|
+
},
|
|
108
|
+
serviceDiscovery as ServiceDiscovery<any, any>,
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
expect(warnSpy).toHaveBeenCalledWith('No publisher service available');
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it('should publish single event successfully', async () => {
|
|
115
|
+
const mockPublisher: EventPublisher<TestEvent> = {
|
|
116
|
+
publish: vi.fn().mockResolvedValue(undefined),
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const mockPublisherService: Service<string, EventPublisher<TestEvent>> = {
|
|
120
|
+
serviceName: Math.random().toString(),
|
|
121
|
+
register: vi.fn().mockResolvedValue(mockPublisher),
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const outputSchema = z.object({ id: z.string(), email: z.string() });
|
|
125
|
+
|
|
126
|
+
const endpoint = e
|
|
127
|
+
.logger(mockLogger)
|
|
128
|
+
.publisher(mockPublisherService)
|
|
129
|
+
.post('/test')
|
|
130
|
+
.output(outputSchema)
|
|
131
|
+
.event({
|
|
132
|
+
type: 'user.created',
|
|
133
|
+
payload: (response) => ({
|
|
134
|
+
userId: response.id,
|
|
135
|
+
email: response.email,
|
|
136
|
+
}),
|
|
137
|
+
})
|
|
138
|
+
.handle(async () => ({ id: '123', email: 'test@example.com' }));
|
|
139
|
+
|
|
140
|
+
await publishConstructEvents(
|
|
141
|
+
endpoint,
|
|
142
|
+
{
|
|
143
|
+
id: '123',
|
|
144
|
+
email: 'test@example.com',
|
|
145
|
+
},
|
|
146
|
+
serviceDiscovery as ServiceDiscovery<any, any>,
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
expect(debugSpy).toHaveBeenCalledWith(
|
|
150
|
+
{ event: 'user.created' },
|
|
151
|
+
'Processing event',
|
|
152
|
+
);
|
|
153
|
+
expect(debugSpy).toHaveBeenCalledWith(
|
|
154
|
+
{ eventCount: 1 },
|
|
155
|
+
'Publishing events',
|
|
156
|
+
);
|
|
157
|
+
expect(mockPublisher.publish).toHaveBeenCalledWith([
|
|
158
|
+
{
|
|
159
|
+
type: 'user.created',
|
|
160
|
+
payload: { userId: '123', email: 'test@example.com' },
|
|
161
|
+
},
|
|
162
|
+
]);
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
it('should publish multiple events successfully', async () => {
|
|
166
|
+
const mockPublisher: EventPublisher<TestEvent> = {
|
|
167
|
+
publish: vi.fn().mockResolvedValue(undefined),
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const mockPublisherService: Service<string, EventPublisher<TestEvent>> = {
|
|
171
|
+
serviceName: Math.random().toString(),
|
|
172
|
+
register: vi.fn().mockResolvedValue(mockPublisher),
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const outputSchema = z.object({ id: z.string(), email: z.string() });
|
|
176
|
+
|
|
177
|
+
const endpoint = e
|
|
178
|
+
.publisher(mockPublisherService)
|
|
179
|
+
|
|
180
|
+
.post('/test')
|
|
181
|
+
.output(outputSchema)
|
|
182
|
+
.event({
|
|
183
|
+
type: 'user.created',
|
|
184
|
+
payload: (response) => ({
|
|
185
|
+
userId: response.id,
|
|
186
|
+
email: response.email,
|
|
187
|
+
}),
|
|
188
|
+
})
|
|
189
|
+
.event({
|
|
190
|
+
type: 'user.updated',
|
|
191
|
+
payload: (response) => ({ userId: response.id, changes: ['email'] }),
|
|
192
|
+
})
|
|
193
|
+
|
|
194
|
+
.handle(async () => ({ id: '123', email: 'test@example.com' }));
|
|
195
|
+
|
|
196
|
+
await publishConstructEvents(
|
|
197
|
+
endpoint,
|
|
198
|
+
{
|
|
199
|
+
id: '123',
|
|
200
|
+
email: 'test@example.com',
|
|
201
|
+
},
|
|
202
|
+
serviceDiscovery as ServiceDiscovery<any, any>,
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
expect(mockPublisher.publish).toHaveBeenCalledWith([
|
|
206
|
+
{
|
|
207
|
+
type: 'user.created',
|
|
208
|
+
payload: { userId: '123', email: 'test@example.com' },
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
type: 'user.updated',
|
|
212
|
+
payload: { userId: '123', changes: ['email'] },
|
|
213
|
+
},
|
|
214
|
+
]);
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
it('should respect when condition for events', async () => {
|
|
218
|
+
const mockPublisher: EventPublisher<TestEvent> = {
|
|
219
|
+
publish: vi.fn().mockResolvedValue(undefined),
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
const mockPublisherService: Service<string, EventPublisher<TestEvent>> = {
|
|
223
|
+
serviceName: Math.random().toString(),
|
|
224
|
+
register: vi.fn().mockResolvedValue(mockPublisher),
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
const outputSchema = z.object({
|
|
228
|
+
id: z.string(),
|
|
229
|
+
email: z.string(),
|
|
230
|
+
isNew: z.boolean(),
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
const endpoint = e
|
|
234
|
+
.logger(mockLogger)
|
|
235
|
+
.publisher(mockPublisherService)
|
|
236
|
+
.post('/test')
|
|
237
|
+
.output(outputSchema)
|
|
238
|
+
.event({
|
|
239
|
+
type: 'user.created',
|
|
240
|
+
payload: (response) => ({
|
|
241
|
+
userId: response.id,
|
|
242
|
+
email: response.email,
|
|
243
|
+
}),
|
|
244
|
+
when: (response) => response.isNew === true,
|
|
245
|
+
})
|
|
246
|
+
.event({
|
|
247
|
+
type: 'user.updated',
|
|
248
|
+
payload: (response) => ({ userId: response.id, changes: ['email'] }),
|
|
249
|
+
when: (response) => response.isNew === false,
|
|
250
|
+
})
|
|
251
|
+
.handle(async () => ({
|
|
252
|
+
id: '123',
|
|
253
|
+
email: 'test@example.com',
|
|
254
|
+
isNew: false,
|
|
255
|
+
}));
|
|
256
|
+
|
|
257
|
+
await publishConstructEvents(
|
|
258
|
+
endpoint,
|
|
259
|
+
{
|
|
260
|
+
id: '123',
|
|
261
|
+
email: 'test@example.com',
|
|
262
|
+
isNew: false,
|
|
263
|
+
},
|
|
264
|
+
serviceDiscovery as ServiceDiscovery<any, any>,
|
|
265
|
+
);
|
|
266
|
+
|
|
267
|
+
// Only the user.updated event should be published
|
|
268
|
+
expect(mockPublisher.publish).toHaveBeenCalledWith([
|
|
269
|
+
{
|
|
270
|
+
type: 'user.updated',
|
|
271
|
+
payload: { userId: '123', changes: ['email'] },
|
|
272
|
+
},
|
|
273
|
+
]);
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
it('should not publish any events when all when conditions are false', async () => {
|
|
277
|
+
const mockPublisher: EventPublisher<TestEvent> = {
|
|
278
|
+
publish: vi.fn().mockResolvedValue(undefined),
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
const mockPublisherService: Service<string, EventPublisher<TestEvent>> = {
|
|
282
|
+
serviceName: Math.random().toString(),
|
|
283
|
+
register: vi.fn().mockResolvedValue(mockPublisher),
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
const outputSchema = z.object({ id: z.string(), email: z.string() });
|
|
287
|
+
|
|
288
|
+
const endpoint = e
|
|
289
|
+
.logger(mockLogger)
|
|
290
|
+
.publisher(mockPublisherService)
|
|
291
|
+
.post('/test')
|
|
292
|
+
.output(outputSchema)
|
|
293
|
+
.event({
|
|
294
|
+
type: 'user.created',
|
|
295
|
+
payload: (response) => ({
|
|
296
|
+
userId: response.id,
|
|
297
|
+
email: response.email,
|
|
298
|
+
}),
|
|
299
|
+
when: () => false,
|
|
300
|
+
})
|
|
301
|
+
.event({
|
|
302
|
+
type: 'user.updated',
|
|
303
|
+
payload: (response) => ({ userId: response.id, changes: ['email'] }),
|
|
304
|
+
when: () => false,
|
|
305
|
+
})
|
|
306
|
+
.handle(async () => ({ id: '123', email: 'test@example.com' }));
|
|
307
|
+
|
|
308
|
+
await publishConstructEvents(
|
|
309
|
+
endpoint,
|
|
310
|
+
{
|
|
311
|
+
id: '123',
|
|
312
|
+
email: 'test@example.com',
|
|
313
|
+
},
|
|
314
|
+
serviceDiscovery as ServiceDiscovery<any, any>,
|
|
315
|
+
);
|
|
316
|
+
|
|
317
|
+
expect(mockPublisher.publish).not.toHaveBeenCalled();
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
it('should handle async payload functions', async () => {
|
|
321
|
+
const mockPublisher: EventPublisher<TestEvent> = {
|
|
322
|
+
publish: vi.fn().mockResolvedValue(undefined),
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
const mockPublisherService: Service<string, EventPublisher<TestEvent>> = {
|
|
326
|
+
serviceName: Math.random().toString(),
|
|
327
|
+
register: vi.fn().mockResolvedValue(mockPublisher),
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
const outputSchema = z.object({ id: z.string(), email: z.string() });
|
|
331
|
+
|
|
332
|
+
const endpoint = e
|
|
333
|
+
.logger(mockLogger)
|
|
334
|
+
.publisher(mockPublisherService)
|
|
335
|
+
.post('/test')
|
|
336
|
+
.output(outputSchema)
|
|
337
|
+
.event({
|
|
338
|
+
type: 'user.created',
|
|
339
|
+
payload: (response) => ({
|
|
340
|
+
// Simulate async operation
|
|
341
|
+
userId: response.id,
|
|
342
|
+
email: response.email,
|
|
343
|
+
}),
|
|
344
|
+
})
|
|
345
|
+
.handle(async () => ({ id: '123', email: 'test@example.com' }));
|
|
346
|
+
|
|
347
|
+
await publishConstructEvents(
|
|
348
|
+
endpoint,
|
|
349
|
+
{
|
|
350
|
+
id: '123',
|
|
351
|
+
email: 'test@example.com',
|
|
352
|
+
},
|
|
353
|
+
serviceDiscovery as ServiceDiscovery<any, any>,
|
|
354
|
+
);
|
|
355
|
+
|
|
356
|
+
expect(mockPublisher.publish).toHaveBeenCalledWith([
|
|
357
|
+
{
|
|
358
|
+
type: 'user.created',
|
|
359
|
+
payload: { userId: '123', email: 'test@example.com' },
|
|
360
|
+
},
|
|
361
|
+
]);
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
it('should catch and log publish errors', async () => {
|
|
365
|
+
const publishError = new Error('Failed to connect to event bus');
|
|
366
|
+
const mockPublisher: EventPublisher<TestEvent> = {
|
|
367
|
+
publish: vi.fn().mockRejectedValue(publishError),
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
const mockPublisherService: Service<string, EventPublisher<TestEvent>> = {
|
|
371
|
+
serviceName: Math.random().toString(),
|
|
372
|
+
register: vi.fn().mockResolvedValue(mockPublisher),
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
const outputSchema = z.object({ id: z.string(), email: z.string() });
|
|
376
|
+
|
|
377
|
+
const endpoint = e
|
|
378
|
+
.logger(mockLogger)
|
|
379
|
+
.publisher(mockPublisherService)
|
|
380
|
+
.post('/test')
|
|
381
|
+
.output(outputSchema)
|
|
382
|
+
.event({
|
|
383
|
+
type: 'user.created',
|
|
384
|
+
payload: (response) => ({
|
|
385
|
+
userId: response.id,
|
|
386
|
+
email: response.email,
|
|
387
|
+
}),
|
|
388
|
+
})
|
|
389
|
+
.handle(async () => ({ id: '123', email: 'test@example.com' }));
|
|
390
|
+
|
|
391
|
+
// Should not throw
|
|
392
|
+
await publishConstructEvents(
|
|
393
|
+
endpoint,
|
|
394
|
+
{
|
|
395
|
+
id: '123',
|
|
396
|
+
email: 'test@example.com',
|
|
397
|
+
},
|
|
398
|
+
serviceDiscovery as ServiceDiscovery<any, any>,
|
|
399
|
+
);
|
|
400
|
+
|
|
401
|
+
expect(errorSpy).toHaveBeenCalledWith(
|
|
402
|
+
publishError,
|
|
403
|
+
'Failed to publish events',
|
|
404
|
+
);
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
it('should preserve additional event properties', async () => {
|
|
408
|
+
const mockPublisher: EventPublisher<TestEvent> = {
|
|
409
|
+
publish: vi.fn().mockResolvedValue(undefined),
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
const mockPublisherService: Service<string, EventPublisher<TestEvent>> = {
|
|
413
|
+
serviceName: Math.random().toString(),
|
|
414
|
+
register: vi.fn().mockResolvedValue(mockPublisher),
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
const outputSchema = z.object({ id: z.string(), email: z.string() });
|
|
418
|
+
|
|
419
|
+
const endpoint = e
|
|
420
|
+
.logger(mockLogger)
|
|
421
|
+
.publisher(mockPublisherService)
|
|
422
|
+
.post('/test')
|
|
423
|
+
.output(outputSchema)
|
|
424
|
+
.event({
|
|
425
|
+
type: 'user.created',
|
|
426
|
+
payload: (response) => ({
|
|
427
|
+
userId: response.id,
|
|
428
|
+
email: response.email,
|
|
429
|
+
}),
|
|
430
|
+
// Additional properties that should be preserved
|
|
431
|
+
metadata: { source: 'api', version: '1.0' },
|
|
432
|
+
priority: 'high',
|
|
433
|
+
})
|
|
434
|
+
.handle(async () => ({ id: '123', email: 'test@example.com' }));
|
|
435
|
+
|
|
436
|
+
await publishConstructEvents(
|
|
437
|
+
endpoint,
|
|
438
|
+
{
|
|
439
|
+
id: '123',
|
|
440
|
+
email: 'test@example.com',
|
|
441
|
+
},
|
|
442
|
+
serviceDiscovery as ServiceDiscovery<any, any>,
|
|
443
|
+
);
|
|
444
|
+
|
|
445
|
+
expect(mockPublisher.publish).toHaveBeenCalledWith([
|
|
446
|
+
{
|
|
447
|
+
type: 'user.created',
|
|
448
|
+
payload: { userId: '123', email: 'test@example.com' },
|
|
449
|
+
metadata: { source: 'api', version: '1.0' },
|
|
450
|
+
priority: 'high',
|
|
451
|
+
},
|
|
452
|
+
]);
|
|
453
|
+
});
|
|
454
|
+
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { AmazonApiGatewayV1Endpoint } from '../endpoints/AmazonApiGatewayV1EndpointAdaptor';
|
|
2
|
+
export { AmazonApiGatewayV2Endpoint } from '../endpoints/AmazonApiGatewayV2EndpointAdaptor';
|
|
3
|
+
export { AWSLambdaFunction } from '../functions/AWSLambdaFunction';
|
|
4
|
+
export { AWSLambdaSubscriber } from '../subscribers/AWSLambdaSubscriberAdaptor';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { HonoEndpoint } from '../endpoints/HonoEndpointAdaptor';
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import type { Logger } from '@geekmidas/logger';
|
|
2
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
3
|
+
|
|
4
|
+
import { ConstructType } from '../Construct';
|
|
5
|
+
import { Function, type FunctionHandler } from '../functions';
|
|
6
|
+
|
|
7
|
+
import type { EventPublisher } from '@geekmidas/events';
|
|
8
|
+
import type { ComposableStandardSchema } from '@geekmidas/schema';
|
|
9
|
+
import type { Service } from '@geekmidas/services';
|
|
10
|
+
|
|
11
|
+
export class Cron<
|
|
12
|
+
TInput extends ComposableStandardSchema | undefined = undefined,
|
|
13
|
+
TServices extends Service[] = [],
|
|
14
|
+
TLogger extends Logger = Logger,
|
|
15
|
+
OutSchema extends StandardSchemaV1 | undefined = undefined,
|
|
16
|
+
TEventPublisher extends EventPublisher<any> | undefined = undefined,
|
|
17
|
+
TEventPublisherServiceName extends string = string,
|
|
18
|
+
> extends Function<
|
|
19
|
+
TInput,
|
|
20
|
+
TServices,
|
|
21
|
+
TLogger,
|
|
22
|
+
OutSchema,
|
|
23
|
+
FunctionHandler<TInput, TServices, TLogger, OutSchema>,
|
|
24
|
+
TEventPublisher,
|
|
25
|
+
TEventPublisherServiceName
|
|
26
|
+
> {
|
|
27
|
+
static isCron(obj: any): obj is Cron<any, any, any, any> {
|
|
28
|
+
return Boolean(
|
|
29
|
+
obj &&
|
|
30
|
+
(obj as Function).__IS_FUNCTION__ === true &&
|
|
31
|
+
obj.type === ConstructType.Cron,
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
constructor(
|
|
36
|
+
fn: FunctionHandler<TInput, TServices, TLogger, OutSchema>,
|
|
37
|
+
timeout?: number,
|
|
38
|
+
protected _schedule?: ScheduleExpression,
|
|
39
|
+
input?: TInput,
|
|
40
|
+
outputSchema?: OutSchema,
|
|
41
|
+
services: TServices = [] as unknown as TServices,
|
|
42
|
+
logger?: TLogger,
|
|
43
|
+
publisherService?: Service<TEventPublisherServiceName, TEventPublisher>,
|
|
44
|
+
events: any[] = [],
|
|
45
|
+
) {
|
|
46
|
+
super(
|
|
47
|
+
fn,
|
|
48
|
+
timeout,
|
|
49
|
+
ConstructType.Cron,
|
|
50
|
+
input,
|
|
51
|
+
outputSchema,
|
|
52
|
+
services,
|
|
53
|
+
logger,
|
|
54
|
+
publisherService,
|
|
55
|
+
events,
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
get schedule(): ScheduleExpression | undefined {
|
|
60
|
+
return this._schedule;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type RateExpression = `rate(${string})`;
|
|
65
|
+
|
|
66
|
+
type CronMinute =
|
|
67
|
+
| '*'
|
|
68
|
+
| number
|
|
69
|
+
| `${number}`
|
|
70
|
+
| `${number}-${number}`
|
|
71
|
+
| `${number}/${number}`
|
|
72
|
+
| `*/${number}`
|
|
73
|
+
| `${number},${number}`
|
|
74
|
+
| string; // Allow more complex patterns
|
|
75
|
+
|
|
76
|
+
type CronHour =
|
|
77
|
+
| '*'
|
|
78
|
+
| number
|
|
79
|
+
| `${number}`
|
|
80
|
+
| `${number}-${number}`
|
|
81
|
+
| `${number}/${number}`
|
|
82
|
+
| `*/${number}`
|
|
83
|
+
| `${number},${number}`
|
|
84
|
+
| string; // Allow more complex patterns
|
|
85
|
+
|
|
86
|
+
type CronDay =
|
|
87
|
+
| '*'
|
|
88
|
+
| number
|
|
89
|
+
| `${number}`
|
|
90
|
+
| `${number}-${number}`
|
|
91
|
+
| `${number}/${number}`
|
|
92
|
+
| `*/${number}`
|
|
93
|
+
| `${number},${number}`
|
|
94
|
+
| string; // Allow more complex patterns
|
|
95
|
+
|
|
96
|
+
type CronMonth =
|
|
97
|
+
| '*'
|
|
98
|
+
| number
|
|
99
|
+
| `${number}`
|
|
100
|
+
| `${number}-${number}`
|
|
101
|
+
| `${number}/${number}`
|
|
102
|
+
| `*/${number}`
|
|
103
|
+
| 'JAN'
|
|
104
|
+
| 'FEB'
|
|
105
|
+
| 'MAR'
|
|
106
|
+
| 'APR'
|
|
107
|
+
| 'MAY'
|
|
108
|
+
| 'JUN'
|
|
109
|
+
| 'JUL'
|
|
110
|
+
| 'AUG'
|
|
111
|
+
| 'SEP'
|
|
112
|
+
| 'OCT'
|
|
113
|
+
| 'NOV'
|
|
114
|
+
| 'DEC'
|
|
115
|
+
| string; // Allow more complex patterns
|
|
116
|
+
|
|
117
|
+
type CronWeekday =
|
|
118
|
+
| '*'
|
|
119
|
+
| number
|
|
120
|
+
| `${number}`
|
|
121
|
+
| `${number}-${number}`
|
|
122
|
+
| `${number}/${number}`
|
|
123
|
+
| `*/${number}`
|
|
124
|
+
| 'SUN'
|
|
125
|
+
| 'MON'
|
|
126
|
+
| 'TUE'
|
|
127
|
+
| 'WED'
|
|
128
|
+
| 'THU'
|
|
129
|
+
| 'FRI'
|
|
130
|
+
| 'SAT'
|
|
131
|
+
| `${string}-${string}` // Allow patterns like MON-FRI
|
|
132
|
+
| string; // Allow more complex patterns
|
|
133
|
+
|
|
134
|
+
export type CronExpression =
|
|
135
|
+
`cron(${CronMinute} ${CronHour} ${CronDay} ${CronMonth} ${CronWeekday})`;
|
|
136
|
+
|
|
137
|
+
export type ScheduleExpression = RateExpression | CronExpression;
|