@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,269 @@
|
|
|
1
|
+
import type { EnvironmentParser } from '@geekmidas/envkit';
|
|
2
|
+
import { wrapError } from '@geekmidas/errors';
|
|
3
|
+
import type { EventPublisher } from '@geekmidas/events';
|
|
4
|
+
import type { Logger } from '@geekmidas/logger';
|
|
5
|
+
import type { Service, ServiceRecord } from '@geekmidas/services';
|
|
6
|
+
import { ServiceDiscovery } from '@geekmidas/services';
|
|
7
|
+
import middy, { type MiddlewareObj } from '@middy/core';
|
|
8
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
9
|
+
import type {
|
|
10
|
+
Context,
|
|
11
|
+
Handler,
|
|
12
|
+
SNSEvent,
|
|
13
|
+
SQSEvent,
|
|
14
|
+
SQSRecord,
|
|
15
|
+
} from 'aws-lambda';
|
|
16
|
+
|
|
17
|
+
import type { InferStandardSchema } from '@geekmidas/schema';
|
|
18
|
+
import type { Subscriber } from './Subscriber';
|
|
19
|
+
|
|
20
|
+
export type AWSLambdaHandler<TEvent = any, TResult = any> = Handler<
|
|
21
|
+
TEvent,
|
|
22
|
+
TResult
|
|
23
|
+
>;
|
|
24
|
+
|
|
25
|
+
type SubscriberEvent<TServices extends Service[], TLogger extends Logger> = {
|
|
26
|
+
events: any[];
|
|
27
|
+
services: ServiceRecord<TServices>;
|
|
28
|
+
logger: TLogger;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
type Middleware<
|
|
32
|
+
TServices extends Service[],
|
|
33
|
+
TLogger extends Logger,
|
|
34
|
+
TOutSchema extends StandardSchemaV1 | undefined,
|
|
35
|
+
> = MiddlewareObj<
|
|
36
|
+
SubscriberEvent<TServices, TLogger>,
|
|
37
|
+
InferStandardSchema<TOutSchema>,
|
|
38
|
+
Error,
|
|
39
|
+
Context
|
|
40
|
+
>;
|
|
41
|
+
|
|
42
|
+
export class AWSLambdaSubscriber<
|
|
43
|
+
TServices extends Service[] = [],
|
|
44
|
+
TLogger extends Logger = Logger,
|
|
45
|
+
OutSchema extends StandardSchemaV1 | undefined = undefined,
|
|
46
|
+
TEventPublisher extends EventPublisher<any> | undefined = undefined,
|
|
47
|
+
TEventPublisherServiceName extends string = string,
|
|
48
|
+
TSubscribedEvents extends any[] = [],
|
|
49
|
+
> {
|
|
50
|
+
private _logger!: TLogger;
|
|
51
|
+
private _services!: ServiceRecord<TServices>;
|
|
52
|
+
|
|
53
|
+
constructor(
|
|
54
|
+
private envParser: EnvironmentParser<{}>,
|
|
55
|
+
readonly subscriber: Subscriber<
|
|
56
|
+
TServices,
|
|
57
|
+
TLogger,
|
|
58
|
+
OutSchema,
|
|
59
|
+
TEventPublisher,
|
|
60
|
+
TEventPublisherServiceName,
|
|
61
|
+
TSubscribedEvents
|
|
62
|
+
>,
|
|
63
|
+
) {
|
|
64
|
+
this._logger = subscriber.logger;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
get logger(): TLogger {
|
|
68
|
+
return this._logger;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private async getServices(): Promise<ServiceRecord<TServices>> {
|
|
72
|
+
if (this._services) {
|
|
73
|
+
return this._services;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const serviceDiscovery = ServiceDiscovery.getInstance(
|
|
77
|
+
this.logger,
|
|
78
|
+
this.envParser,
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
if (this.subscriber.services.length > 0) {
|
|
82
|
+
const registered = await serviceDiscovery.register(
|
|
83
|
+
this.subscriber.services,
|
|
84
|
+
);
|
|
85
|
+
this._services = registered as ServiceRecord<TServices>;
|
|
86
|
+
} else {
|
|
87
|
+
this._services = {} as ServiceRecord<TServices>;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return this._services;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
private error(): Middleware<TServices, TLogger, OutSchema> {
|
|
94
|
+
return {
|
|
95
|
+
onError: (req) => {
|
|
96
|
+
const logger = req.event?.logger || this.subscriber.logger;
|
|
97
|
+
logger.error(req.error || {}, 'Error processing subscriber');
|
|
98
|
+
|
|
99
|
+
// Re-throw the wrapped error to let Lambda handle it
|
|
100
|
+
throw wrapError(req.error);
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
private loggerMiddleware(): Middleware<TServices, TLogger, OutSchema> {
|
|
106
|
+
return {
|
|
107
|
+
before: (req) => {
|
|
108
|
+
this._logger = this.subscriber.logger.child({
|
|
109
|
+
subscriber: {
|
|
110
|
+
name: req.context.functionName,
|
|
111
|
+
version: req.context.functionVersion,
|
|
112
|
+
memory: req.context.memoryLimitInMB,
|
|
113
|
+
},
|
|
114
|
+
req: {
|
|
115
|
+
id: req.context.awsRequestId,
|
|
116
|
+
},
|
|
117
|
+
}) as TLogger;
|
|
118
|
+
|
|
119
|
+
req.event.logger = this._logger;
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
private services(): Middleware<TServices, TLogger, OutSchema> {
|
|
125
|
+
return {
|
|
126
|
+
before: async (req) => {
|
|
127
|
+
req.event.services = await this.getServices();
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
private parseEvents(): Middleware<TServices, TLogger, OutSchema> {
|
|
133
|
+
return {
|
|
134
|
+
before: async (req) => {
|
|
135
|
+
const rawEvent = (req as any).event as SQSEvent | SNSEvent;
|
|
136
|
+
|
|
137
|
+
// Parse events based on the event type
|
|
138
|
+
const events: any[] = [];
|
|
139
|
+
|
|
140
|
+
if ('Records' in rawEvent) {
|
|
141
|
+
if (this.isSQSEvent(rawEvent)) {
|
|
142
|
+
// SQS Event
|
|
143
|
+
for (const record of rawEvent.Records) {
|
|
144
|
+
try {
|
|
145
|
+
const event = this.parseSQSRecord(record);
|
|
146
|
+
if (event && this.isSubscribedEvent(event.type)) {
|
|
147
|
+
events.push(event);
|
|
148
|
+
}
|
|
149
|
+
} catch (error) {
|
|
150
|
+
this.logger.error(
|
|
151
|
+
{ error, record },
|
|
152
|
+
'Failed to parse SQS record',
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
} else if (this.isSNSEvent(rawEvent)) {
|
|
157
|
+
// SNS Event
|
|
158
|
+
for (const record of rawEvent.Records) {
|
|
159
|
+
try {
|
|
160
|
+
const event = JSON.parse(record.Sns.Message);
|
|
161
|
+
if (event && this.isSubscribedEvent(event.type)) {
|
|
162
|
+
events.push(event);
|
|
163
|
+
}
|
|
164
|
+
} catch (error) {
|
|
165
|
+
this.logger.error(
|
|
166
|
+
{ error, record },
|
|
167
|
+
'Failed to parse SNS record',
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
(req.event as any).events = events;
|
|
175
|
+
},
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
private isSQSEvent(event: SQSEvent | SNSEvent): event is SQSEvent {
|
|
180
|
+
return (
|
|
181
|
+
'Records' in event &&
|
|
182
|
+
event.Records.length > 0 &&
|
|
183
|
+
'eventSource' in event.Records[0] &&
|
|
184
|
+
event.Records[0].eventSource === 'aws:sqs'
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
private isSNSEvent(event: SQSEvent | SNSEvent): event is SNSEvent {
|
|
189
|
+
return (
|
|
190
|
+
'Records' in event &&
|
|
191
|
+
event.Records.length > 0 &&
|
|
192
|
+
'EventSource' in event.Records[0] &&
|
|
193
|
+
event.Records[0].EventSource === 'aws:sns'
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
private parseSQSRecord(record: SQSRecord): any | null {
|
|
198
|
+
try {
|
|
199
|
+
const body = JSON.parse(record.body);
|
|
200
|
+
|
|
201
|
+
// Check if this is an SNS message wrapped in SQS
|
|
202
|
+
if (body.Type === 'Notification' && body.Message) {
|
|
203
|
+
// Parse the SNS message
|
|
204
|
+
const snsMessage = JSON.parse(body.Message);
|
|
205
|
+
return snsMessage;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// Direct SQS message
|
|
209
|
+
return body;
|
|
210
|
+
} catch (error) {
|
|
211
|
+
this.logger.error({ error, record }, 'Failed to parse SQS record body');
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
private isSubscribedEvent(eventType: string): boolean {
|
|
217
|
+
if (!this.subscriber.subscribedEvents) {
|
|
218
|
+
return true; // If no events specified, accept all
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return this.subscriber.subscribedEvents.includes(eventType as any);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
private async _handler(event: SubscriberEvent<TServices, TLogger>) {
|
|
225
|
+
// If no events after filtering, return early
|
|
226
|
+
if (event.events.length === 0) {
|
|
227
|
+
this.logger.info('No subscribed events to process');
|
|
228
|
+
return {
|
|
229
|
+
batchItemFailures: [],
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// Execute the subscriber with the parsed context
|
|
234
|
+
const result = await this.subscriber.handler({
|
|
235
|
+
events: event.events,
|
|
236
|
+
services: event.services,
|
|
237
|
+
logger: event.logger,
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
// Parse output if schema is provided
|
|
241
|
+
if (this.subscriber.outputSchema && result) {
|
|
242
|
+
const validationResult =
|
|
243
|
+
await this.subscriber.outputSchema['~standard'].validate(result);
|
|
244
|
+
|
|
245
|
+
if (validationResult.issues) {
|
|
246
|
+
this.logger.error(
|
|
247
|
+
{ issues: validationResult.issues },
|
|
248
|
+
'Subscriber output validation failed',
|
|
249
|
+
);
|
|
250
|
+
throw new Error('Subscriber output validation failed');
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
return validationResult.value;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
return result;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
get handler(): AWSLambdaHandler {
|
|
260
|
+
const handler = this._handler.bind(this);
|
|
261
|
+
|
|
262
|
+
// Apply middleware in order
|
|
263
|
+
return middy(handler)
|
|
264
|
+
.use(this.loggerMiddleware())
|
|
265
|
+
.use(this.error())
|
|
266
|
+
.use(this.services())
|
|
267
|
+
.use(this.parseEvents()) as unknown as AWSLambdaHandler;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { Logger } from '@geekmidas/logger';
|
|
2
|
+
import { ConsoleLogger } from '@geekmidas/logger/console';
|
|
3
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
4
|
+
|
|
5
|
+
import { Construct, ConstructType } from '../Construct';
|
|
6
|
+
|
|
7
|
+
import type {
|
|
8
|
+
EventPublisher,
|
|
9
|
+
ExtractPublisherMessage,
|
|
10
|
+
} from '@geekmidas/events';
|
|
11
|
+
import type { InferStandardSchema } from '@geekmidas/schema';
|
|
12
|
+
import type { Service, ServiceRecord } from '@geekmidas/services';
|
|
13
|
+
|
|
14
|
+
const DEFAULT_LOGGER = new ConsoleLogger() as any;
|
|
15
|
+
|
|
16
|
+
// Helper type to extract payload types for subscribed events
|
|
17
|
+
type ExtractEventPayloads<
|
|
18
|
+
TPublisher extends EventPublisher<any> | undefined,
|
|
19
|
+
TEventTypes extends any[],
|
|
20
|
+
> = TPublisher extends EventPublisher<any>
|
|
21
|
+
? Extract<ExtractPublisherMessage<TPublisher>, { type: TEventTypes[number] }>
|
|
22
|
+
: never;
|
|
23
|
+
|
|
24
|
+
export class Subscriber<
|
|
25
|
+
TServices extends Service[] = [],
|
|
26
|
+
TLogger extends Logger = Logger,
|
|
27
|
+
OutSchema extends StandardSchemaV1 | undefined = undefined,
|
|
28
|
+
TEventPublisher extends EventPublisher<any> | undefined = undefined,
|
|
29
|
+
TEventPublisherServiceName extends string = string,
|
|
30
|
+
TSubscribedEvents extends
|
|
31
|
+
ExtractPublisherMessage<TEventPublisher>['type'][] = ExtractPublisherMessage<TEventPublisher>['type'][],
|
|
32
|
+
> extends Construct<
|
|
33
|
+
TLogger,
|
|
34
|
+
TEventPublisherServiceName,
|
|
35
|
+
TEventPublisher,
|
|
36
|
+
OutSchema,
|
|
37
|
+
TServices
|
|
38
|
+
> {
|
|
39
|
+
__IS_SUBSCRIBER__ = true;
|
|
40
|
+
|
|
41
|
+
static isSubscriber(
|
|
42
|
+
obj: any,
|
|
43
|
+
): obj is Subscriber<any, any, any, any, any, any> {
|
|
44
|
+
return Boolean(
|
|
45
|
+
obj &&
|
|
46
|
+
obj.__IS_SUBSCRIBER__ === true &&
|
|
47
|
+
obj.type === ConstructType.Subscriber,
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
constructor(
|
|
52
|
+
public readonly handler: SubscriberHandler<
|
|
53
|
+
TEventPublisher,
|
|
54
|
+
TSubscribedEvents,
|
|
55
|
+
TServices,
|
|
56
|
+
TLogger,
|
|
57
|
+
OutSchema
|
|
58
|
+
>,
|
|
59
|
+
public readonly timeout: number = 30000,
|
|
60
|
+
protected _subscribedEvents?: TSubscribedEvents,
|
|
61
|
+
public readonly outputSchema?: OutSchema,
|
|
62
|
+
public readonly services: TServices = [] as unknown as TServices,
|
|
63
|
+
public readonly logger: TLogger = DEFAULT_LOGGER as TLogger,
|
|
64
|
+
public readonly publisherService?: Service<
|
|
65
|
+
TEventPublisherServiceName,
|
|
66
|
+
TEventPublisher
|
|
67
|
+
>,
|
|
68
|
+
) {
|
|
69
|
+
super(
|
|
70
|
+
ConstructType.Subscriber,
|
|
71
|
+
logger,
|
|
72
|
+
services,
|
|
73
|
+
[],
|
|
74
|
+
publisherService,
|
|
75
|
+
outputSchema,
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
get subscribedEvents(): TSubscribedEvents | undefined {
|
|
80
|
+
return this._subscribedEvents;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Handler type for subscribers that receives an array of events
|
|
85
|
+
export type SubscriberHandler<
|
|
86
|
+
TEventPublisher extends EventPublisher<any> | undefined,
|
|
87
|
+
TSubscribedEvents extends ExtractPublisherMessage<TEventPublisher>['type'][],
|
|
88
|
+
TServices extends Service[] = [],
|
|
89
|
+
TLogger extends Logger = Logger,
|
|
90
|
+
OutSchema extends StandardSchemaV1 | undefined = undefined,
|
|
91
|
+
> = (
|
|
92
|
+
ctx: SubscriberContext<
|
|
93
|
+
TEventPublisher,
|
|
94
|
+
TSubscribedEvents,
|
|
95
|
+
TServices,
|
|
96
|
+
TLogger
|
|
97
|
+
>,
|
|
98
|
+
) => OutSchema extends StandardSchemaV1
|
|
99
|
+
? InferStandardSchema<OutSchema> | Promise<InferStandardSchema<OutSchema>>
|
|
100
|
+
: any | Promise<any>;
|
|
101
|
+
|
|
102
|
+
// Context type for subscriber handlers
|
|
103
|
+
export type SubscriberContext<
|
|
104
|
+
TEventPublisher extends EventPublisher<any> | undefined,
|
|
105
|
+
TSubscribedEvents extends ExtractPublisherMessage<TEventPublisher>['type'][],
|
|
106
|
+
TServices extends Service[] = [],
|
|
107
|
+
TLogger extends Logger = Logger,
|
|
108
|
+
> = {
|
|
109
|
+
events: ExtractEventPayloads<TEventPublisher, TSubscribedEvents>[];
|
|
110
|
+
services: ServiceRecord<TServices>;
|
|
111
|
+
logger: TLogger;
|
|
112
|
+
};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
EventPublisher,
|
|
3
|
+
ExtractPublisherMessage,
|
|
4
|
+
} from '@geekmidas/events';
|
|
5
|
+
import type { Logger } from '@geekmidas/logger';
|
|
6
|
+
import { DEFAULT_LOGGER } from '@geekmidas/logger/console';
|
|
7
|
+
import type { Service } from '@geekmidas/services';
|
|
8
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
9
|
+
import { Subscriber, type SubscriberHandler } from './Subscriber';
|
|
10
|
+
|
|
11
|
+
export class SubscriberBuilder<
|
|
12
|
+
TServices extends Service[] = [],
|
|
13
|
+
TLogger extends Logger = Logger,
|
|
14
|
+
OutSchema extends StandardSchemaV1 | undefined = undefined,
|
|
15
|
+
TEventPublisher extends EventPublisher<any> | undefined = undefined,
|
|
16
|
+
TEventPublisherServiceName extends string = string,
|
|
17
|
+
TSubscribedEvents extends any[] = [],
|
|
18
|
+
> {
|
|
19
|
+
private _subscribedEvents: TSubscribedEvents = [] as any;
|
|
20
|
+
private _timeout?: number;
|
|
21
|
+
private outputSchema?: OutSchema;
|
|
22
|
+
private _services: TServices = [] as Service[] as TServices;
|
|
23
|
+
private _logger: TLogger = DEFAULT_LOGGER;
|
|
24
|
+
private _publisher?: Service<TEventPublisherServiceName, TEventPublisher>;
|
|
25
|
+
|
|
26
|
+
constructor() {
|
|
27
|
+
this._timeout = 30000; // Default timeout
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
timeout(timeout: number): this {
|
|
31
|
+
this._timeout = timeout;
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
output<T extends StandardSchemaV1>(
|
|
36
|
+
schema: T,
|
|
37
|
+
): SubscriberBuilder<
|
|
38
|
+
TServices,
|
|
39
|
+
TLogger,
|
|
40
|
+
T,
|
|
41
|
+
TEventPublisher,
|
|
42
|
+
TEventPublisherServiceName,
|
|
43
|
+
TSubscribedEvents
|
|
44
|
+
> {
|
|
45
|
+
this.outputSchema = schema as unknown as OutSchema;
|
|
46
|
+
return this as any;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
services<T extends Service[]>(
|
|
50
|
+
services: T,
|
|
51
|
+
): SubscriberBuilder<
|
|
52
|
+
[...TServices, ...T],
|
|
53
|
+
TLogger,
|
|
54
|
+
OutSchema,
|
|
55
|
+
TEventPublisher,
|
|
56
|
+
TEventPublisherServiceName,
|
|
57
|
+
TSubscribedEvents
|
|
58
|
+
> {
|
|
59
|
+
this._services = [...this._services, ...services] as any;
|
|
60
|
+
return this as any;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
logger<T extends Logger>(
|
|
64
|
+
logger: T,
|
|
65
|
+
): SubscriberBuilder<
|
|
66
|
+
TServices,
|
|
67
|
+
T,
|
|
68
|
+
OutSchema,
|
|
69
|
+
TEventPublisher,
|
|
70
|
+
TEventPublisherServiceName,
|
|
71
|
+
TSubscribedEvents
|
|
72
|
+
> {
|
|
73
|
+
this._logger = logger as unknown as TLogger;
|
|
74
|
+
return this as any;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
publisher<T extends EventPublisher<any>, TName extends string>(
|
|
78
|
+
publisher: Service<TName, T>,
|
|
79
|
+
): SubscriberBuilder<
|
|
80
|
+
TServices,
|
|
81
|
+
TLogger,
|
|
82
|
+
OutSchema,
|
|
83
|
+
T,
|
|
84
|
+
TName,
|
|
85
|
+
TSubscribedEvents
|
|
86
|
+
> {
|
|
87
|
+
this._publisher = publisher as any;
|
|
88
|
+
return this as any;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
subscribe<
|
|
92
|
+
TEvent extends TEventPublisher extends EventPublisher<any>
|
|
93
|
+
?
|
|
94
|
+
| ExtractPublisherMessage<TEventPublisher>['type']
|
|
95
|
+
| ExtractPublisherMessage<TEventPublisher>['type'][]
|
|
96
|
+
: never,
|
|
97
|
+
>(
|
|
98
|
+
event: TEvent,
|
|
99
|
+
): SubscriberBuilder<
|
|
100
|
+
TServices,
|
|
101
|
+
TLogger,
|
|
102
|
+
OutSchema,
|
|
103
|
+
TEventPublisher,
|
|
104
|
+
TEventPublisherServiceName,
|
|
105
|
+
TEvent extends any[]
|
|
106
|
+
? [...TSubscribedEvents, ...TEvent]
|
|
107
|
+
: [...TSubscribedEvents, TEvent]
|
|
108
|
+
> {
|
|
109
|
+
const eventsToAdd = Array.isArray(event) ? event : [event];
|
|
110
|
+
this._subscribedEvents = [...this._subscribedEvents, ...eventsToAdd] as any;
|
|
111
|
+
return this as any;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
handle(
|
|
115
|
+
fn: SubscriberHandler<
|
|
116
|
+
TEventPublisher,
|
|
117
|
+
TSubscribedEvents,
|
|
118
|
+
TServices,
|
|
119
|
+
TLogger,
|
|
120
|
+
OutSchema
|
|
121
|
+
>,
|
|
122
|
+
): Subscriber<
|
|
123
|
+
TServices,
|
|
124
|
+
TLogger,
|
|
125
|
+
OutSchema,
|
|
126
|
+
TEventPublisher,
|
|
127
|
+
TEventPublisherServiceName,
|
|
128
|
+
TSubscribedEvents
|
|
129
|
+
> {
|
|
130
|
+
const subscriber = new Subscriber(
|
|
131
|
+
fn,
|
|
132
|
+
this._timeout,
|
|
133
|
+
this._subscribedEvents,
|
|
134
|
+
this.outputSchema,
|
|
135
|
+
this._services,
|
|
136
|
+
this._logger,
|
|
137
|
+
this._publisher,
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
// Reset builder state after creating the subscriber to prevent pollution
|
|
141
|
+
this._services = [] as Service[] as TServices;
|
|
142
|
+
this._logger = DEFAULT_LOGGER;
|
|
143
|
+
this._publisher = undefined;
|
|
144
|
+
this._subscribedEvents = [] as any;
|
|
145
|
+
this._timeout = 30000; // Reset to default
|
|
146
|
+
this.outputSchema = undefined;
|
|
147
|
+
|
|
148
|
+
return subscriber;
|
|
149
|
+
}
|
|
150
|
+
}
|