@geekmidas/constructs 1.0.4 → 1.1.0

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.
Files changed (242) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/{AWSLambdaFunction-CDJX0Tr1.d.mts → AWSLambdaFunction-BF1gJJjG.d.mts} +3 -3
  3. package/dist/{AWSLambdaFunction-CDJX0Tr1.d.mts.map → AWSLambdaFunction-BF1gJJjG.d.mts.map} +1 -1
  4. package/dist/{AWSLambdaSubscriberAdaptor-Soie57uM.cjs → AWSLambdaSubscriberAdaptor-BtBKExsh.cjs} +38 -35
  5. package/dist/AWSLambdaSubscriberAdaptor-BtBKExsh.cjs.map +1 -0
  6. package/dist/{AWSLambdaSubscriberAdaptor-BfEGolJA.d.cts → AWSLambdaSubscriberAdaptor-Cj1wjkUP.d.cts} +3 -2
  7. package/dist/{AWSLambdaSubscriberAdaptor-BfEGolJA.d.cts.map → AWSLambdaSubscriberAdaptor-Cj1wjkUP.d.cts.map} +1 -1
  8. package/dist/{AWSLambdaSubscriberAdaptor-BUvb-v_n.mjs → AWSLambdaSubscriberAdaptor-DsRmmGm1.mjs} +38 -35
  9. package/dist/AWSLambdaSubscriberAdaptor-DsRmmGm1.mjs.map +1 -0
  10. package/dist/{AWSLambdaSubscriberAdaptor-Pb7Jof-i.d.mts → AWSLambdaSubscriberAdaptor-OQvj2lKI.d.mts} +4 -3
  11. package/dist/{AWSLambdaSubscriberAdaptor-Pb7Jof-i.d.mts.map → AWSLambdaSubscriberAdaptor-OQvj2lKI.d.mts.map} +1 -1
  12. package/dist/{AmazonApiGatewayEndpointAdaptor-DRG4hu-k.d.mts → AmazonApiGatewayEndpointAdaptor-CQSZArI6.d.mts} +4 -4
  13. package/dist/{AmazonApiGatewayEndpointAdaptor-DRG4hu-k.d.mts.map → AmazonApiGatewayEndpointAdaptor-CQSZArI6.d.mts.map} +1 -1
  14. package/dist/{AmazonApiGatewayV1EndpointAdaptor-Bj9BDhNM.d.mts → AmazonApiGatewayV1EndpointAdaptor-xTrFYt48.d.mts} +4 -4
  15. package/dist/{AmazonApiGatewayV1EndpointAdaptor-Bj9BDhNM.d.mts.map → AmazonApiGatewayV1EndpointAdaptor-xTrFYt48.d.mts.map} +1 -1
  16. package/dist/{AmazonApiGatewayV2EndpointAdaptor-C0199fdk.d.mts → AmazonApiGatewayV2EndpointAdaptor-BBayh2_k.d.mts} +4 -4
  17. package/dist/{AmazonApiGatewayV2EndpointAdaptor-C0199fdk.d.mts.map → AmazonApiGatewayV2EndpointAdaptor-BBayh2_k.d.mts.map} +1 -1
  18. package/dist/{Authorizer-BgjU8-z6.mjs → Authorizer-4unKN3Xn.mjs} +1 -1
  19. package/dist/{Authorizer-BgjU8-z6.mjs.map → Authorizer-4unKN3Xn.mjs.map} +1 -1
  20. package/dist/{Authorizer-DCcYOx3h.d.mts → Authorizer-DBsrDTuf.d.mts} +1 -1
  21. package/dist/{Authorizer-DCcYOx3h.d.mts.map → Authorizer-DBsrDTuf.d.mts.map} +1 -1
  22. package/dist/{Authorizer-BXxBee2P.cjs → Authorizer-Dx57psuM.cjs} +1 -1
  23. package/dist/{Authorizer-BXxBee2P.cjs.map → Authorizer-Dx57psuM.cjs.map} +1 -1
  24. package/dist/{BaseFunctionBuilder-JpN2FtB4.d.mts → BaseFunctionBuilder-CsvFjzA8.d.mts} +2 -2
  25. package/dist/{BaseFunctionBuilder-JpN2FtB4.d.mts.map → BaseFunctionBuilder-CsvFjzA8.d.mts.map} +1 -1
  26. package/dist/{Construct-DvXCkLOP.d.mts → Construct-C2SyofdS.d.mts} +1 -1
  27. package/dist/{Construct-DvXCkLOP.d.mts.map → Construct-C2SyofdS.d.mts.map} +1 -1
  28. package/dist/Construct.d.mts +1 -1
  29. package/dist/{Cron-D5NpDp6y.mjs → Cron-B3vrGuaD.mjs} +1 -1
  30. package/dist/{Cron-D5NpDp6y.mjs.map → Cron-B3vrGuaD.mjs.map} +1 -1
  31. package/dist/{Cron-BJWjEj3U.d.cts → Cron-BDxW6fYg.d.cts} +1 -1
  32. package/dist/{Cron-BJWjEj3U.d.cts.map → Cron-BDxW6fYg.d.cts.map} +1 -1
  33. package/dist/{Cron-BjNvt_Wj.d.mts → Cron-CWxjO2Fg.d.mts} +2 -2
  34. package/dist/{Cron-BjNvt_Wj.d.mts.map → Cron-CWxjO2Fg.d.mts.map} +1 -1
  35. package/dist/{Cron-BV6weqem.cjs → Cron-DEKZg5j4.cjs} +1 -1
  36. package/dist/{Cron-BV6weqem.cjs.map → Cron-DEKZg5j4.cjs.map} +1 -1
  37. package/dist/{CronBuilder-DzPkDCiP.cjs → CronBuilder-BHpY6w3b.cjs} +2 -2
  38. package/dist/{CronBuilder-DzPkDCiP.cjs.map → CronBuilder-BHpY6w3b.cjs.map} +1 -1
  39. package/dist/{CronBuilder-CmPYae1S.d.cts → CronBuilder-CginrW3H.d.cts} +2 -2
  40. package/dist/{CronBuilder-CmPYae1S.d.cts.map → CronBuilder-CginrW3H.d.cts.map} +1 -1
  41. package/dist/{CronBuilder-X4au0zTu.d.mts → CronBuilder-DJnXbDGK.d.mts} +4 -4
  42. package/dist/{CronBuilder-X4au0zTu.d.mts.map → CronBuilder-DJnXbDGK.d.mts.map} +1 -1
  43. package/dist/{CronBuilder-p1Ro6a0n.mjs → CronBuilder-VXpyNfp2.mjs} +2 -2
  44. package/dist/{CronBuilder-p1Ro6a0n.mjs.map → CronBuilder-VXpyNfp2.mjs.map} +1 -1
  45. package/dist/{Endpoint-DU20A9E8.d.mts → Endpoint-BiPM0glm.d.mts} +4 -4
  46. package/dist/{Endpoint-DU20A9E8.d.mts.map → Endpoint-BiPM0glm.d.mts.map} +1 -1
  47. package/dist/{EndpointBuilder-CuVlda7g.d.mts → EndpointBuilder-B0Aj5jbB.d.mts} +5 -5
  48. package/dist/{EndpointBuilder-CuVlda7g.d.mts.map → EndpointBuilder-B0Aj5jbB.d.mts.map} +1 -1
  49. package/dist/{EndpointBuilder-BfzI6Rpc.d.cts → EndpointBuilder-Bel6RS7W.d.cts} +1 -1
  50. package/dist/{EndpointBuilder-BfzI6Rpc.d.cts.map → EndpointBuilder-Bel6RS7W.d.cts.map} +1 -1
  51. package/dist/{EndpointBuilder-CF-ZWtdu.mjs → EndpointBuilder-D1RtrBu1.mjs} +3 -3
  52. package/dist/{EndpointBuilder-CF-ZWtdu.mjs.map → EndpointBuilder-D1RtrBu1.mjs.map} +1 -1
  53. package/dist/{EndpointBuilder-CyszO0bs.cjs → EndpointBuilder-fXmTxRyW.cjs} +3 -3
  54. package/dist/{EndpointBuilder-CyszO0bs.cjs.map → EndpointBuilder-fXmTxRyW.cjs.map} +1 -1
  55. package/dist/{EndpointFactory-Bj7vHtT6.d.mts → EndpointFactory-CWIeWCRG.d.mts} +7 -7
  56. package/dist/EndpointFactory-CWIeWCRG.d.mts.map +1 -0
  57. package/dist/{EndpointFactory-C1miOYUW.d.cts → EndpointFactory-CXvakOkn.d.cts} +5 -5
  58. package/dist/EndpointFactory-CXvakOkn.d.cts.map +1 -0
  59. package/dist/{EndpointFactory-B6fUZPhx.cjs → EndpointFactory-DBfTbSTX.cjs} +6 -6
  60. package/dist/EndpointFactory-DBfTbSTX.cjs.map +1 -0
  61. package/dist/{EndpointFactory-CyM-gSew.mjs → EndpointFactory-DkB8yxdQ.mjs} +6 -6
  62. package/dist/EndpointFactory-DkB8yxdQ.mjs.map +1 -0
  63. package/dist/{Function-DEX2O-SB.d.mts → Function-CZw1DRQ6.d.mts} +2 -2
  64. package/dist/{Function-DEX2O-SB.d.mts.map → Function-CZw1DRQ6.d.mts.map} +1 -1
  65. package/dist/{FunctionBuilder-DRw1s5uT.d.mts → FunctionBuilder-m5BNA2Ap.d.mts} +4 -4
  66. package/dist/{FunctionBuilder-DRw1s5uT.d.mts.map → FunctionBuilder-m5BNA2Ap.d.mts.map} +1 -1
  67. package/dist/{FunctionExecutionWrapper-D2kbmPJG.d.mts → FunctionExecutionWrapper-C7yYXIq-.d.mts} +2 -2
  68. package/dist/{FunctionExecutionWrapper-D2kbmPJG.d.mts.map → FunctionExecutionWrapper-C7yYXIq-.d.mts.map} +1 -1
  69. package/dist/{HonoEndpointAdaptor-C7BBBYuU.d.mts → HonoEndpointAdaptor-C3AdQ0xS.d.mts} +5 -5
  70. package/dist/{HonoEndpointAdaptor-C7BBBYuU.d.mts.map → HonoEndpointAdaptor-C3AdQ0xS.d.mts.map} +1 -1
  71. package/dist/{Subscriber-DKQK5gLD.mjs → Subscriber-BEhOdNQi.mjs} +1 -1
  72. package/dist/{Subscriber-DKQK5gLD.mjs.map → Subscriber-BEhOdNQi.mjs.map} +1 -1
  73. package/dist/{Subscriber-DCgMSkQA.d.mts → Subscriber-BgB3RRxb.d.mts} +2 -2
  74. package/dist/{Subscriber-DCgMSkQA.d.mts.map → Subscriber-BgB3RRxb.d.mts.map} +1 -1
  75. package/dist/{Subscriber-ClqSPbIZ.cjs → Subscriber-Scz7hrV6.cjs} +1 -1
  76. package/dist/{Subscriber-ClqSPbIZ.cjs.map → Subscriber-Scz7hrV6.cjs.map} +1 -1
  77. package/dist/{SubscriberBuilder-BS5B_688.cjs → SubscriberBuilder-B82h4v-S.cjs} +2 -2
  78. package/dist/{SubscriberBuilder-BS5B_688.cjs.map → SubscriberBuilder-B82h4v-S.cjs.map} +1 -1
  79. package/dist/{SubscriberBuilder-UIwW_wIY.d.cts → SubscriberBuilder-B9uva8fZ.d.cts} +1 -1
  80. package/dist/{SubscriberBuilder-BcyK44e_.d.mts.map → SubscriberBuilder-B9uva8fZ.d.cts.map} +1 -1
  81. package/dist/{SubscriberBuilder-BcyK44e_.d.mts → SubscriberBuilder-DaQkh2Nt.d.mts} +2 -2
  82. package/dist/{SubscriberBuilder-UIwW_wIY.d.cts.map → SubscriberBuilder-DaQkh2Nt.d.mts.map} +1 -1
  83. package/dist/{SubscriberBuilder-BswTuvUc.mjs → SubscriberBuilder-DlUaG0Ej.mjs} +2 -2
  84. package/dist/{SubscriberBuilder-BswTuvUc.mjs.map → SubscriberBuilder-DlUaG0Ej.mjs.map} +1 -1
  85. package/dist/{TestEndpointAdaptor-oWNADEl4.d.mts → TestEndpointAdaptor-qSWV8dpS.d.mts} +3 -3
  86. package/dist/{TestEndpointAdaptor-oWNADEl4.d.mts.map → TestEndpointAdaptor-qSWV8dpS.d.mts.map} +1 -1
  87. package/dist/TestFunctionAdaptor-BHk2bDOV.d.cts +30 -0
  88. package/dist/TestFunctionAdaptor-BHk2bDOV.d.cts.map +1 -0
  89. package/dist/TestFunctionAdaptor-CK-dbKpO.mjs +67 -0
  90. package/dist/TestFunctionAdaptor-CK-dbKpO.mjs.map +1 -0
  91. package/dist/TestFunctionAdaptor-CSMX7myB.cjs +73 -0
  92. package/dist/TestFunctionAdaptor-CSMX7myB.cjs.map +1 -0
  93. package/dist/TestFunctionAdaptor-DzT8GRdR.d.mts +30 -0
  94. package/dist/TestFunctionAdaptor-DzT8GRdR.d.mts.map +1 -0
  95. package/dist/TestSubscriberAdaptor-1m-2bM_j.cjs +49 -0
  96. package/dist/TestSubscriberAdaptor-1m-2bM_j.cjs.map +1 -0
  97. package/dist/TestSubscriberAdaptor-CPEiqSfE.d.mts +26 -0
  98. package/dist/TestSubscriberAdaptor-CPEiqSfE.d.mts.map +1 -0
  99. package/dist/TestSubscriberAdaptor-CrqLkyUE.mjs +43 -0
  100. package/dist/TestSubscriberAdaptor-CrqLkyUE.mjs.map +1 -0
  101. package/dist/TestSubscriberAdaptor-DQk5xzb0.d.cts +26 -0
  102. package/dist/TestSubscriberAdaptor-DQk5xzb0.d.cts.map +1 -0
  103. package/dist/adaptors/aws.cjs +1 -1
  104. package/dist/adaptors/aws.d.cts +2 -2
  105. package/dist/adaptors/aws.d.mts +16 -16
  106. package/dist/adaptors/aws.mjs +1 -1
  107. package/dist/adaptors/hono.d.cts +1 -1
  108. package/dist/adaptors/hono.d.mts +9 -9
  109. package/dist/adaptors/testing.cjs +5 -1
  110. package/dist/adaptors/testing.d.cts +5 -2
  111. package/dist/adaptors/testing.d.mts +13 -10
  112. package/dist/adaptors/testing.mjs +3 -1
  113. package/dist/crons/Cron.cjs +1 -1
  114. package/dist/crons/Cron.d.cts +2 -2
  115. package/dist/crons/Cron.d.mts +6 -6
  116. package/dist/crons/Cron.mjs +1 -1
  117. package/dist/crons/CronBuilder.cjs +2 -2
  118. package/dist/crons/CronBuilder.d.cts +3 -3
  119. package/dist/crons/CronBuilder.d.mts +7 -7
  120. package/dist/crons/CronBuilder.mjs +2 -2
  121. package/dist/crons/index.cjs +2 -2
  122. package/dist/crons/index.d.cts +3 -3
  123. package/dist/crons/index.d.mts +7 -7
  124. package/dist/crons/index.mjs +2 -2
  125. package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.d.cts +1 -1
  126. package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.d.mts +10 -10
  127. package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.d.cts +1 -1
  128. package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.d.mts +11 -11
  129. package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.d.cts +1 -1
  130. package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.d.mts +11 -11
  131. package/dist/endpoints/Authorizer.cjs +1 -1
  132. package/dist/endpoints/Authorizer.d.mts +1 -1
  133. package/dist/endpoints/Authorizer.mjs +1 -1
  134. package/dist/endpoints/Endpoint.d.cts +1 -1
  135. package/dist/endpoints/Endpoint.d.mts +8 -8
  136. package/dist/endpoints/EndpointBuilder.cjs +3 -3
  137. package/dist/endpoints/EndpointBuilder.d.cts +2 -2
  138. package/dist/endpoints/EndpointBuilder.d.mts +9 -9
  139. package/dist/endpoints/EndpointBuilder.mjs +3 -3
  140. package/dist/endpoints/EndpointFactory.cjs +4 -4
  141. package/dist/endpoints/EndpointFactory.d.cts +3 -3
  142. package/dist/endpoints/EndpointFactory.d.mts +10 -10
  143. package/dist/endpoints/EndpointFactory.mjs +4 -4
  144. package/dist/endpoints/HonoEndpointAdaptor.d.cts +1 -1
  145. package/dist/endpoints/HonoEndpointAdaptor.d.mts +9 -9
  146. package/dist/endpoints/TestEndpointAdaptor.d.cts +1 -1
  147. package/dist/endpoints/TestEndpointAdaptor.d.mts +9 -9
  148. package/dist/endpoints/audit.d.cts +1 -1
  149. package/dist/endpoints/audit.d.mts +8 -8
  150. package/dist/endpoints/helpers.d.cts +1 -1
  151. package/dist/endpoints/helpers.d.mts +8 -8
  152. package/dist/endpoints/index.cjs +4 -4
  153. package/dist/endpoints/index.d.cts +7 -7
  154. package/dist/endpoints/index.d.mts +14 -14
  155. package/dist/endpoints/index.mjs +4 -4
  156. package/dist/endpoints/lazyAccessors.d.cts +2 -2
  157. package/dist/endpoints/lazyAccessors.d.mts +9 -9
  158. package/dist/endpoints/processAudits.d.cts +1 -1
  159. package/dist/endpoints/processAudits.d.mts +8 -8
  160. package/dist/endpoints/rls.cjs +1 -1
  161. package/dist/endpoints/rls.d.cts +1 -1
  162. package/dist/endpoints/rls.d.mts +8 -8
  163. package/dist/endpoints/rls.mjs +1 -1
  164. package/dist/functions/AWSLambdaFunction.d.mts +4 -4
  165. package/dist/functions/BaseFunctionBuilder.d.mts +2 -2
  166. package/dist/functions/Function.d.mts +2 -2
  167. package/dist/functions/FunctionBuilder.d.mts +4 -4
  168. package/dist/functions/FunctionExecutionWrapper.d.mts +3 -3
  169. package/dist/functions/TestFunctionAdaptor.cjs +4 -67
  170. package/dist/functions/TestFunctionAdaptor.d.cts +3 -30
  171. package/dist/functions/TestFunctionAdaptor.d.mts +4 -31
  172. package/dist/functions/TestFunctionAdaptor.mjs +4 -66
  173. package/dist/functions/index.d.cts +1 -1
  174. package/dist/functions/index.d.mts +5 -5
  175. package/dist/index-BfeupgMl.d.cts +12 -0
  176. package/dist/{index-BRZODuxf.d.mts.map → index-BfeupgMl.d.cts.map} +1 -1
  177. package/dist/index-DQo_Csy7.d.mts +12 -0
  178. package/dist/{index-BnoOaBQV.d.cts.map → index-DQo_Csy7.d.mts.map} +1 -1
  179. package/dist/index.d.mts +3 -3
  180. package/dist/{lazyAccessors-D1tbdxUk.d.mts → lazyAccessors-DXkJpnyX.d.mts} +2 -2
  181. package/dist/{lazyAccessors-D1tbdxUk.d.mts.map → lazyAccessors-DXkJpnyX.d.mts.map} +1 -1
  182. package/dist/{lazyAccessors-ZRbwOONj.d.cts → lazyAccessors-DdZaA716.d.cts} +1 -1
  183. package/dist/{lazyAccessors-ZRbwOONj.d.cts.map → lazyAccessors-DdZaA716.d.cts.map} +1 -1
  184. package/dist/{publisher-DdPDps5m.d.cts → publisher-BrzPGnm4.d.cts} +1 -1
  185. package/dist/{publisher-BeouS9lG.d.mts.map → publisher-BrzPGnm4.d.cts.map} +1 -1
  186. package/dist/{publisher-BeouS9lG.d.mts → publisher-CP4gpv-4.d.mts} +2 -2
  187. package/dist/{publisher-DdPDps5m.d.cts.map → publisher-CP4gpv-4.d.mts.map} +1 -1
  188. package/dist/publisher.d.cts +1 -1
  189. package/dist/publisher.d.mts +2 -2
  190. package/dist/{rls-C0cWOnk4.mjs → rls-7XXX7DvY.mjs} +1 -1
  191. package/dist/{rls-C0cWOnk4.mjs.map → rls-7XXX7DvY.mjs.map} +1 -1
  192. package/dist/{rls-BrywnrQb.cjs → rls-DxFqdIA0.cjs} +1 -1
  193. package/dist/{rls-BrywnrQb.cjs.map → rls-DxFqdIA0.cjs.map} +1 -1
  194. package/dist/subscribers/AWSLambdaSubscriberAdaptor.cjs +1 -1
  195. package/dist/subscribers/AWSLambdaSubscriberAdaptor.d.cts +1 -1
  196. package/dist/subscribers/AWSLambdaSubscriberAdaptor.d.mts +3 -3
  197. package/dist/subscribers/AWSLambdaSubscriberAdaptor.mjs +1 -1
  198. package/dist/subscribers/Subscriber.cjs +1 -1
  199. package/dist/subscribers/Subscriber.d.mts +2 -2
  200. package/dist/subscribers/Subscriber.mjs +1 -1
  201. package/dist/subscribers/SubscriberBuilder.cjs +2 -2
  202. package/dist/subscribers/SubscriberBuilder.d.cts +1 -1
  203. package/dist/subscribers/SubscriberBuilder.d.mts +3 -3
  204. package/dist/subscribers/SubscriberBuilder.mjs +2 -2
  205. package/dist/subscribers/TestSubscriberAdaptor.cjs +4 -0
  206. package/dist/subscribers/TestSubscriberAdaptor.d.cts +4 -0
  207. package/dist/subscribers/TestSubscriberAdaptor.d.mts +4 -0
  208. package/dist/subscribers/TestSubscriberAdaptor.mjs +4 -0
  209. package/dist/subscribers/index.cjs +5 -2
  210. package/dist/subscribers/index.cjs.map +1 -1
  211. package/dist/subscribers/index.d.cts +3 -2
  212. package/dist/subscribers/index.d.cts.map +1 -1
  213. package/dist/subscribers/index.d.mts +5 -4
  214. package/dist/subscribers/index.d.mts.map +1 -1
  215. package/dist/subscribers/index.mjs +5 -3
  216. package/dist/subscribers/index.mjs.map +1 -1
  217. package/dist/{telemetry-yAHf5yDs.d.mts → telemetry-C-kNOW3C.d.mts} +1 -1
  218. package/dist/{telemetry-yAHf5yDs.d.mts.map → telemetry-C-kNOW3C.d.mts.map} +1 -1
  219. package/dist/telemetry.d.mts +1 -1
  220. package/dist/{types-Dw-iLd3Y.d.mts → types-aFmq5cKh.d.mts} +1 -1
  221. package/dist/{types-Dw-iLd3Y.d.mts.map → types-aFmq5cKh.d.mts.map} +1 -1
  222. package/dist/types.d.mts +1 -1
  223. package/package.json +10 -10
  224. package/src/adaptors/testing.ts +2 -0
  225. package/src/endpoints/EndpointFactory.ts +15 -12
  226. package/src/subscribers/AWSLambdaSubscriberAdaptor.ts +61 -37
  227. package/src/subscribers/TestSubscriberAdaptor.ts +127 -0
  228. package/src/subscribers/__tests__/AWSLambdaSubscriberAdaptor.spec.ts +239 -27
  229. package/src/subscribers/__tests__/TestSubscriberAdaptor.spec.ts +558 -0
  230. package/src/subscribers/index.ts +1 -0
  231. package/dist/AWSLambdaSubscriberAdaptor-BUvb-v_n.mjs.map +0 -1
  232. package/dist/AWSLambdaSubscriberAdaptor-Soie57uM.cjs.map +0 -1
  233. package/dist/EndpointFactory-B6fUZPhx.cjs.map +0 -1
  234. package/dist/EndpointFactory-Bj7vHtT6.d.mts.map +0 -1
  235. package/dist/EndpointFactory-C1miOYUW.d.cts.map +0 -1
  236. package/dist/EndpointFactory-CyM-gSew.mjs.map +0 -1
  237. package/dist/functions/TestFunctionAdaptor.cjs.map +0 -1
  238. package/dist/functions/TestFunctionAdaptor.d.cts.map +0 -1
  239. package/dist/functions/TestFunctionAdaptor.d.mts.map +0 -1
  240. package/dist/functions/TestFunctionAdaptor.mjs.map +0 -1
  241. package/dist/index-BRZODuxf.d.mts +0 -12
  242. package/dist/index-BnoOaBQV.d.cts +0 -12
@@ -1,6 +1,7 @@
1
- import "../Construct-DvXCkLOP.mjs";
2
- import { Subscriber } from "../Subscriber-DCgMSkQA.mjs";
3
- import { SubscriberBuilder } from "../SubscriberBuilder-BcyK44e_.mjs";
1
+ import "../Construct-C2SyofdS.mjs";
2
+ import { Subscriber } from "../Subscriber-BgB3RRxb.mjs";
3
+ import { TestSubscriberAdaptor } from "../TestSubscriberAdaptor-CPEiqSfE.mjs";
4
+ import { SubscriberBuilder } from "../SubscriberBuilder-DaQkh2Nt.mjs";
4
5
  import * as _geekmidas_logger10 from "@geekmidas/logger";
5
6
 
6
7
  //#region src/subscribers/index.d.ts
@@ -8,5 +9,5 @@ declare const s: SubscriberBuilder<[], _geekmidas_logger10.Logger, undefined, un
8
9
  //# sourceMappingURL=index.d.ts.map
9
10
 
10
11
  //#endregion
11
- export { Subscriber, SubscriberBuilder, s };
12
+ export { Subscriber, SubscriberBuilder, TestSubscriberAdaptor, s };
12
13
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/subscribers/index.ts"],"sourcesContent":[],"mappings":";;;;;;cAKa,GAAC,sBAA0B,mBAAA,CAA1B,MAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/subscribers/index.ts"],"sourcesContent":[],"mappings":";;;;;;;cAMa,GAAC,sBAA0B,mBAAA,CAA1B,MAAA"}
@@ -1,10 +1,12 @@
1
1
  import "../Construct-CQ9zV58W.mjs";
2
- import { Subscriber } from "../Subscriber-DKQK5gLD.mjs";
3
- import { SubscriberBuilder } from "../SubscriberBuilder-BswTuvUc.mjs";
2
+ import "../publisher-Bw4770Hi.mjs";
3
+ import { TestSubscriberAdaptor } from "../TestSubscriberAdaptor-CrqLkyUE.mjs";
4
+ import { Subscriber } from "../Subscriber-BEhOdNQi.mjs";
5
+ import { SubscriberBuilder } from "../SubscriberBuilder-DlUaG0Ej.mjs";
4
6
 
5
7
  //#region src/subscribers/index.ts
6
8
  const s = new SubscriberBuilder();
7
9
 
8
10
  //#endregion
9
- export { Subscriber, SubscriberBuilder, s };
11
+ export { Subscriber, SubscriberBuilder, TestSubscriberAdaptor, s };
10
12
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/subscribers/index.ts"],"sourcesContent":["import { SubscriberBuilder } from './SubscriberBuilder';\n\nexport { Subscriber } from './Subscriber';\nexport { SubscriberBuilder };\n\nexport const s = new SubscriberBuilder();\n"],"mappings":";;;;;AAKA,MAAa,IAAI,IAAI"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/subscribers/index.ts"],"sourcesContent":["import { SubscriberBuilder } from './SubscriberBuilder';\n\nexport { Subscriber } from './Subscriber';\nexport { SubscriberBuilder };\nexport { TestSubscriberAdaptor } from './TestSubscriberAdaptor';\n\nexport const s = new SubscriberBuilder();\n"],"mappings":";;;;;;;AAMA,MAAa,IAAI,IAAI"}
@@ -92,4 +92,4 @@ interface Telemetry {
92
92
  //# sourceMappingURL=telemetry.d.ts.map
93
93
  //#endregion
94
94
  export { Telemetry, TelemetryContext, TelemetryRequest, TelemetryResponse };
95
- //# sourceMappingURL=telemetry-yAHf5yDs.d.mts.map
95
+ //# sourceMappingURL=telemetry-C-kNOW3C.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry-yAHf5yDs.d.mts","names":[],"sources":["../src/telemetry.ts"],"sourcesContent":[],"mappings":";;;;;;;AA6FmB,UAlFF,gBAAA,CAkFE;EAAgB;;;EAQgB,CAAA,GAAA,EAAA,MAAA,CAAA,EAAA,OAAA;;;;;UAhFlC,gBAAA;;;;;;;;WASP;;;;;UAMO,iBAAA;;;;;;;;;;;;YAcN;;;;;;;;;;;;;;;;;;;;;;;;;;;UA4BM,SAAA;;;;;;;0BAOQ,mBAAmB;;;;;;;oBAQzB,4BAA4B;;;;;;;sBAQ1B,yBAAyB"}
1
+ {"version":3,"file":"telemetry-C-kNOW3C.d.mts","names":[],"sources":["../src/telemetry.ts"],"sourcesContent":[],"mappings":";;;;;;;AA6FmB,UAlFF,gBAAA,CAkFE;EAAgB;;;EAQgB,CAAA,GAAA,EAAA,MAAA,CAAA,EAAA,OAAA;;;;;UAhFlC,gBAAA;;;;;;;;WASP;;;;;UAMO,iBAAA;;;;;;;;;;;;YAcN;;;;;;;;;;;;;;;;;;;;;;;;;;;UA4BM,SAAA;;;;;;;0BAOQ,mBAAmB;;;;;;;oBAQzB,4BAA4B;;;;;;;sBAQ1B,yBAAyB"}
@@ -1,2 +1,2 @@
1
- import { Telemetry, TelemetryContext, TelemetryRequest, TelemetryResponse } from "./telemetry-yAHf5yDs.mjs";
1
+ import { Telemetry, TelemetryContext, TelemetryRequest, TelemetryResponse } from "./telemetry-C-kNOW3C.mjs";
2
2
  export { Telemetry, TelemetryContext, TelemetryRequest, TelemetryResponse };
@@ -6,4 +6,4 @@ type LowerHttpMethod<T extends HttpMethod> = Lowercase<T>;
6
6
 
7
7
  //#endregion
8
8
  export { HttpMethod, LowerHttpMethod, RemoveUndefined };
9
- //# sourceMappingURL=types-Dw-iLd3Y.d.mts.map
9
+ //# sourceMappingURL=types-aFmq5cKh.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types-Dw-iLd3Y.d.mts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";KAAY,6BAAA,MACC,CADD,IACM,CADS,CACP,CADO,CAAA,SAAA,SAAA,GAAA,KAAA,GACwB,CADxB,GAC4B,CAD5B,CAC8B,CAD9B,CAAA,EAAA;AACd,KAGD,UAAA,GAHC,KAAA,GAAA,MAAA,GAAA,KAAA,GAAA,OAAA,GAAA,QAAA,GAAA,SAAA;AAAK,KAWN,eAXM,CAAA,UAWoB,UAXpB,CAAA,GAWkC,SAXlC,CAW4C,CAX5C,CAAA"}
1
+ {"version":3,"file":"types-aFmq5cKh.d.mts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";KAAY,6BAAA,MACC,CADD,IACM,CADS,CACP,CADO,CAAA,SAAA,SAAA,GAAA,KAAA,GACwB,CADxB,GAC4B,CAD5B,CAC8B,CAD9B,CAAA,EAAA;AACd,KAGD,UAAA,GAHC,KAAA,GAAA,MAAA,GAAA,KAAA,GAAA,OAAA,GAAA,QAAA,GAAA,SAAA;AAAK,KAWN,eAXM,CAAA,UAWoB,UAXpB,CAAA,GAWkC,SAXlC,CAW4C,CAX5C,CAAA"}
package/dist/types.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { HttpMethod, LowerHttpMethod, RemoveUndefined } from "./types-Dw-iLd3Y.mjs";
1
+ import { HttpMethod, LowerHttpMethod, RemoveUndefined } from "./types-aFmq5cKh.mjs";
2
2
  export { HttpMethod, LowerHttpMethod, RemoveUndefined };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geekmidas/constructs",
3
- "version": "1.0.4",
3
+ "version": "1.1.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {
@@ -74,21 +74,21 @@
74
74
  "@types/lodash.set": "~4.3.9",
75
75
  "@types/lodash.uniqby": "~4.7.9",
76
76
  "@types/pg": "~8.15.6",
77
- "better-auth": "~1.4.12",
77
+ "better-auth": "~1.4.18",
78
78
  "kysely": "~0.28.8",
79
79
  "pg": "~8.16.3",
80
80
  "zod": "~4.1.13",
81
81
  "@geekmidas/audit": "^1.0.0",
82
82
  "@geekmidas/cache": "^1.0.0",
83
- "@geekmidas/db": "^1.0.0",
84
- "@geekmidas/envkit": "^1.0.1",
83
+ "@geekmidas/envkit": "^1.0.2",
85
84
  "@geekmidas/errors": "^1.0.0",
85
+ "@geekmidas/db": "^1.0.0",
86
86
  "@geekmidas/events": "^1.0.0",
87
87
  "@geekmidas/logger": "^1.0.0",
88
88
  "@geekmidas/rate-limit": "^1.0.0",
89
- "@geekmidas/services": "^1.0.0",
90
- "@geekmidas/testkit": "^1.0.1",
91
- "@geekmidas/schema": "^1.0.0"
89
+ "@geekmidas/schema": "^1.0.0",
90
+ "@geekmidas/services": "^1.0.1",
91
+ "@geekmidas/testkit": "^1.0.1"
92
92
  },
93
93
  "peerDependencies": {
94
94
  "@middy/core": ">=6.3.1",
@@ -97,13 +97,13 @@
97
97
  "@geekmidas/audit": "^1.0.0",
98
98
  "@geekmidas/cache": "^1.0.0",
99
99
  "@geekmidas/db": "^1.0.0",
100
+ "@geekmidas/envkit": "^1.0.2",
100
101
  "@geekmidas/errors": "^1.0.0",
101
102
  "@geekmidas/events": "^1.0.0",
102
- "@geekmidas/envkit": "^1.0.1",
103
103
  "@geekmidas/logger": "^1.0.0",
104
+ "@geekmidas/rate-limit": "^1.0.0",
104
105
  "@geekmidas/schema": "^1.0.0",
105
- "@geekmidas/services": "^1.0.0",
106
- "@geekmidas/rate-limit": "^1.0.0"
106
+ "@geekmidas/services": "^1.0.1"
107
107
  },
108
108
  "peerDependenciesMeta": {
109
109
  "@geekmidas/audit": {
@@ -1 +1,3 @@
1
1
  export { TestEndpointAdaptor } from '../endpoints/TestEndpointAdaptor';
2
+ export { TestFunctionAdaptor } from '../functions/TestFunctionAdaptor';
3
+ export { TestSubscriberAdaptor } from '../subscribers/TestSubscriberAdaptor';
@@ -485,7 +485,7 @@ export class EndpointFactory<
485
485
  TDatabase,
486
486
  TDatabaseServiceName,
487
487
  TSecuritySchemes,
488
- undefined // Reset RLS config when services change - user should call .rls() after .services()
488
+ RlsConfig<[...S, ...TServices], TSession, TLogger> | undefined
489
489
  > {
490
490
  return new EndpointFactory<
491
491
  [...S, ...TServices],
@@ -501,7 +501,7 @@ export class EndpointFactory<
501
501
  TDatabase,
502
502
  TDatabaseServiceName,
503
503
  TSecuritySchemes,
504
- undefined
504
+ RlsConfig<[...S, ...TServices], TSession, TLogger> | undefined
505
505
  >({
506
506
  defaultServices: [...services, ...this.defaultServices],
507
507
  basePath: this.basePath,
@@ -523,8 +523,9 @@ export class EndpointFactory<
523
523
  | ActorExtractor<[...S, ...TServices], TSession, TLogger>
524
524
  | undefined,
525
525
  customSecuritySchemes: this.customSecuritySchemes,
526
- // Reset RLS config when services change since it depends on TServices
527
- defaultRlsConfig: undefined,
526
+ defaultRlsConfig: this.defaultRlsConfig as unknown as
527
+ | RlsConfig<[...S, ...TServices], TSession, TLogger>
528
+ | undefined,
528
529
  });
529
530
  }
530
531
 
@@ -544,7 +545,7 @@ export class EndpointFactory<
544
545
  TDatabase,
545
546
  TDatabaseServiceName,
546
547
  TSecuritySchemes,
547
- undefined // Reset RLS config when logger type changes - user should call .rls() after .logger()
548
+ RlsConfig<TServices, TSession, L> | undefined
548
549
  > {
549
550
  return new EndpointFactory<
550
551
  TServices,
@@ -560,7 +561,7 @@ export class EndpointFactory<
560
561
  TDatabase,
561
562
  TDatabaseServiceName,
562
563
  TSecuritySchemes,
563
- undefined
564
+ RlsConfig<TServices, TSession, L> | undefined
564
565
  >({
565
566
  defaultServices: this.defaultServices,
566
567
  basePath: this.basePath,
@@ -588,8 +589,9 @@ export class EndpointFactory<
588
589
  L
589
590
  >,
590
591
  customSecuritySchemes: this.customSecuritySchemes,
591
- // Reset RLS config when logger type changes since it depends on TLogger
592
- defaultRlsConfig: undefined,
592
+ defaultRlsConfig: this.defaultRlsConfig as unknown as
593
+ | RlsConfig<TServices, TSession, L>
594
+ | undefined,
593
595
  });
594
596
  }
595
597
 
@@ -662,7 +664,7 @@ export class EndpointFactory<
662
664
  TDatabase,
663
665
  TDatabaseServiceName,
664
666
  TSecuritySchemes,
665
- undefined // Reset RLS config when session type changes - user should call .rls() after .session()
667
+ RlsConfig<TServices, T, TLogger> | undefined
666
668
  > {
667
669
  return new EndpointFactory<
668
670
  TServices,
@@ -678,7 +680,7 @@ export class EndpointFactory<
678
680
  TDatabase,
679
681
  TDatabaseServiceName,
680
682
  TSecuritySchemes,
681
- undefined
683
+ RlsConfig<TServices, T, TLogger> | undefined
682
684
  >({
683
685
  defaultServices: this.defaultServices,
684
686
  basePath: this.basePath,
@@ -701,8 +703,9 @@ export class EndpointFactory<
701
703
  TLogger
702
704
  >,
703
705
  customSecuritySchemes: this.customSecuritySchemes,
704
- // Reset RLS config when session type changes since it depends on TSession
705
- defaultRlsConfig: undefined,
706
+ defaultRlsConfig: this.defaultRlsConfig as unknown as
707
+ | RlsConfig<TServices, T, TLogger>
708
+ | undefined,
706
709
  });
707
710
  }
708
711
 
@@ -145,7 +145,7 @@ export class AWSLambdaSubscriber<
145
145
  for (const record of rawEvent.Records) {
146
146
  try {
147
147
  const event = this.parseSQSRecord(record);
148
- if (event && this.isSubscribedEvent(event.type)) {
148
+ if (this.shouldIncludeEvent(event)) {
149
149
  events.push(event);
150
150
  }
151
151
  } catch (error) {
@@ -160,7 +160,7 @@ export class AWSLambdaSubscriber<
160
160
  for (const record of rawEvent.Records) {
161
161
  try {
162
162
  const event = this.parseSNSRecord(record);
163
- if (event && this.isSubscribedEvent(event.type)) {
163
+ if (this.shouldIncludeEvent(event)) {
164
164
  events.push(event);
165
165
  }
166
166
  } catch (error) {
@@ -200,59 +200,83 @@ export class AWSLambdaSubscriber<
200
200
  );
201
201
  }
202
202
 
203
- private parseSNSRecord(record: SNSEventRecord): any | null {
204
- try {
205
- const message = JSON.parse(record.Sns.Message);
206
- // Resolve type from MessageAttributes (preferred) or message body
207
- const messageType =
208
- record.Sns.MessageAttributes?.type?.Value ?? message.type;
203
+ private parseSNSRecord(record: SNSEventRecord): any {
204
+ const message = this.safeJsonParse(record.Sns.Message);
205
+ const messageType = record.Sns.MessageAttributes?.type?.Value;
209
206
 
210
- if (message.type) {
211
- return message; // Full event format: { type, payload }
212
- }
207
+ // Not JSON — wrap raw string with type from MessageAttributes if available
208
+ if (message === null) {
209
+ return messageType
210
+ ? { type: messageType, payload: record.Sns.Message }
211
+ : record.Sns.Message;
212
+ }
213
213
 
214
- // Payload-only format: type is in MessageAttributes
215
- return messageType ? { type: messageType, payload: message } : message;
216
- } catch (error) {
217
- this.logger.error({ error, record }, 'Failed to parse SNS record body');
218
- return null;
214
+ // Resolve type from MessageAttributes (preferred) or message body
215
+ const resolvedType = messageType ?? message.type;
216
+
217
+ if (message.type) {
218
+ return message; // Full event format: { type, payload }
219
219
  }
220
+
221
+ // Payload-only format: type is in MessageAttributes
222
+ return resolvedType ? { type: resolvedType, payload: message } : message;
220
223
  }
221
224
 
222
- private parseSQSRecord(record: SQSRecord): any | null {
223
- try {
224
- const body = JSON.parse(record.body);
225
+ private parseSQSRecord(record: SQSRecord): any {
226
+ const body = this.safeJsonParse(record.body);
225
227
 
226
- // Check if this is an SNS message wrapped in SQS
227
- if (body.Type === 'Notification' && body.Message) {
228
- const snsMessage = JSON.parse(body.Message);
228
+ // Not JSON return raw body as-is
229
+ if (body === null) {
230
+ return record.body;
231
+ }
229
232
 
230
- if (snsMessage.type) {
231
- return snsMessage; // Full event format: { type, payload }
232
- }
233
+ // Check if this is an SNS message wrapped in SQS
234
+ if (body.Type === 'Notification' && body.Message) {
235
+ const snsMessage = this.safeJsonParse(body.Message);
236
+ const messageType = body.MessageAttributes?.type?.Value;
233
237
 
234
- // Payload-only format: type is in MessageAttributes
235
- const messageType =
236
- body.MessageAttributes?.type?.Value ?? snsMessage.type;
238
+ // SNS Message not JSON — wrap with type from MessageAttributes if available
239
+ if (snsMessage === null) {
237
240
  return messageType
238
- ? { type: messageType, payload: snsMessage }
239
- : snsMessage;
241
+ ? { type: messageType, payload: body.Message }
242
+ : body.Message;
240
243
  }
241
244
 
242
- // Direct SQS message
243
- return body;
244
- } catch (error) {
245
- this.logger.error({ error, record }, 'Failed to parse SQS record body');
245
+ if (snsMessage.type) {
246
+ return snsMessage; // Full event format: { type, payload }
247
+ }
248
+
249
+ // Payload-only format: type is in MessageAttributes
250
+ const resolvedType = messageType ?? snsMessage.type;
251
+ return resolvedType
252
+ ? { type: resolvedType, payload: snsMessage }
253
+ : snsMessage;
254
+ }
255
+
256
+ // Direct SQS message
257
+ return body;
258
+ }
259
+
260
+ private safeJsonParse(value: string): any | null {
261
+ try {
262
+ return JSON.parse(value);
263
+ } catch {
246
264
  return null;
247
265
  }
248
266
  }
249
267
 
250
- private isSubscribedEvent(eventType: string): boolean {
268
+ private shouldIncludeEvent(event: any): boolean {
269
+ // No event type (raw string/non-object) — always include
270
+ if (typeof event !== 'object' || !event?.type) {
271
+ return true;
272
+ }
273
+
274
+ // No filter configured — accept all
251
275
  if (!this.subscriber.subscribedEvents) {
252
- return true; // If no events specified, accept all
276
+ return true;
253
277
  }
254
278
 
255
- return this.subscriber.subscribedEvents.includes(eventType as any);
279
+ return this.subscriber.subscribedEvents.includes(event.type as any);
256
280
  }
257
281
 
258
282
  private async _handler(event: SubscriberEvent<TServices, TLogger>) {
@@ -0,0 +1,127 @@
1
+ import { EnvironmentParser } from '@geekmidas/envkit';
2
+ import type {
3
+ EventPublisher,
4
+ ExtractPublisherMessage,
5
+ } from '@geekmidas/events';
6
+ import type { Logger } from '@geekmidas/logger';
7
+ import type { InferStandardSchema } from '@geekmidas/schema';
8
+ import type { Service, ServiceRecord } from '@geekmidas/services';
9
+ import { ServiceDiscovery } from '@geekmidas/services';
10
+ import type { StandardSchemaV1 } from '@standard-schema/spec';
11
+ import { publishEvents } from '../publisher';
12
+ import type { Subscriber } from './Subscriber';
13
+
14
+ // Helper type to extract payload types for subscribed events
15
+ type ExtractEventPayloads<
16
+ TPublisher extends EventPublisher<any> | undefined,
17
+ TEventTypes extends any[],
18
+ > = TPublisher extends EventPublisher<any>
19
+ ? Extract<ExtractPublisherMessage<TPublisher>, { type: TEventTypes[number] }>
20
+ : never;
21
+
22
+ export class TestSubscriberAdaptor<
23
+ TServices extends Service[] = [],
24
+ TLogger extends Logger = Logger,
25
+ OutSchema extends StandardSchemaV1 | undefined = undefined,
26
+ TEventPublisher extends EventPublisher<any> | undefined = undefined,
27
+ TEventPublisherServiceName extends string = string,
28
+ TSubscribedEvents extends
29
+ ExtractPublisherMessage<TEventPublisher>['type'][] = ExtractPublisherMessage<TEventPublisher>['type'][],
30
+ > {
31
+ static getDefaultServiceDiscovery() {
32
+ return ServiceDiscovery.getInstance(new EnvironmentParser({}));
33
+ }
34
+
35
+ constructor(
36
+ private readonly subscriber: Subscriber<
37
+ TServices,
38
+ TLogger,
39
+ OutSchema,
40
+ TEventPublisher,
41
+ TEventPublisherServiceName,
42
+ TSubscribedEvents
43
+ >,
44
+ private serviceDiscovery: ServiceDiscovery<any> = TestSubscriberAdaptor.getDefaultServiceDiscovery(),
45
+ ) {}
46
+
47
+ async invoke(
48
+ request: TestSubscriberRequest<
49
+ TEventPublisher,
50
+ TSubscribedEvents,
51
+ TServices
52
+ >,
53
+ ): Promise<InferStandardSchema<OutSchema>> {
54
+ // Create logger with test context
55
+ const logger = this.subscriber.logger.child({
56
+ test: true,
57
+ }) as TLogger;
58
+
59
+ // Resolve services (use provided or auto-register)
60
+ let services: ServiceRecord<TServices>;
61
+ if (request.services) {
62
+ services = request.services;
63
+ } else {
64
+ services = await this.serviceDiscovery.register(this.subscriber.services);
65
+ }
66
+
67
+ // Filter events to only subscribed types
68
+ const filteredEvents = this.filterEvents(request.events);
69
+
70
+ // Return early if no events after filtering (mirrors AWSLambdaSubscriber)
71
+ if (filteredEvents.length === 0) {
72
+ return { batchItemFailures: [] } as any;
73
+ }
74
+
75
+ // Execute the subscriber handler
76
+ const result = await this.subscriber.handler({
77
+ events: filteredEvents,
78
+ services,
79
+ logger,
80
+ });
81
+
82
+ // Validate output if schema is provided
83
+ let output = result;
84
+ if (this.subscriber.outputSchema && result) {
85
+ const validationResult =
86
+ await this.subscriber.outputSchema['~standard'].validate(result);
87
+
88
+ if (validationResult.issues) {
89
+ throw new Error('Subscriber output validation failed');
90
+ }
91
+
92
+ output = validationResult.value;
93
+ }
94
+
95
+ // Publish events if configured
96
+ await publishEvents(
97
+ logger,
98
+ this.serviceDiscovery,
99
+ this.subscriber.events,
100
+ output,
101
+ this.subscriber.publisherService,
102
+ );
103
+
104
+ return output;
105
+ }
106
+
107
+ private filterEvents(
108
+ events: ExtractEventPayloads<TEventPublisher, TSubscribedEvents>[],
109
+ ): ExtractEventPayloads<TEventPublisher, TSubscribedEvents>[] {
110
+ if (!this.subscriber.subscribedEvents) {
111
+ return events;
112
+ }
113
+
114
+ return events.filter((event: any) =>
115
+ this.subscriber.subscribedEvents!.includes(event.type),
116
+ );
117
+ }
118
+ }
119
+
120
+ export type TestSubscriberRequest<
121
+ TEventPublisher extends EventPublisher<any> | undefined = undefined,
122
+ TSubscribedEvents extends any[] = [],
123
+ TServices extends Service[] = [],
124
+ > = {
125
+ events: ExtractEventPayloads<TEventPublisher, TSubscribedEvents>[];
126
+ services?: ServiceRecord<TServices>;
127
+ };