@geekmidas/constructs 0.3.1 → 0.5.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 (549) hide show
  1. package/dist/{AWSLambdaFunction-EPGY4s7i.cjs → AWSLambdaFunction-Ba1DcsW2.cjs} +6 -6
  2. package/dist/AWSLambdaFunction-Ba1DcsW2.cjs.map +1 -0
  3. package/dist/{AWSLambdaFunction-BdebRMUh.d.mts → AWSLambdaFunction-CKe73Qr0.d.cts} +6 -6
  4. package/dist/AWSLambdaFunction-CKe73Qr0.d.cts.map +1 -0
  5. package/dist/{AWSLambdaFunction-D0tEOTXQ.d.cts → AWSLambdaFunction-CuG3HNZx.d.mts} +6 -6
  6. package/dist/AWSLambdaFunction-CuG3HNZx.d.mts.map +1 -0
  7. package/dist/{AWSLambdaFunction-C54a1doJ.mjs → AWSLambdaFunction-DnMm4xvz.mjs} +6 -6
  8. package/dist/AWSLambdaFunction-DnMm4xvz.mjs.map +1 -0
  9. package/dist/{AWSLambdaSubscriberAdaptor-Dx-Ks1Jp.d.cts → AWSLambdaSubscriberAdaptor-B4HH-WuQ.d.mts} +4 -4
  10. package/dist/AWSLambdaSubscriberAdaptor-B4HH-WuQ.d.mts.map +1 -0
  11. package/dist/{AWSLambdaSubscriberAdaptor-BLfO612H.mjs → AWSLambdaSubscriberAdaptor-BD3FwGUb.mjs} +3 -3
  12. package/dist/AWSLambdaSubscriberAdaptor-BD3FwGUb.mjs.map +1 -0
  13. package/dist/{AWSLambdaSubscriberAdaptor-DrFAvHOp.d.mts → AWSLambdaSubscriberAdaptor-BEqQ96VJ.d.cts} +4 -4
  14. package/dist/AWSLambdaSubscriberAdaptor-BEqQ96VJ.d.cts.map +1 -0
  15. package/dist/{AWSLambdaSubscriberAdaptor-BNcYYZ-P.cjs → AWSLambdaSubscriberAdaptor-DQDnt1Xk.cjs} +3 -3
  16. package/dist/AWSLambdaSubscriberAdaptor-DQDnt1Xk.cjs.map +1 -0
  17. package/dist/{AmazonApiGatewayEndpointAdaptor-BT9JXihC.mjs → AmazonApiGatewayEndpointAdaptor-Bvy-Hgjf.mjs} +56 -14
  18. package/dist/AmazonApiGatewayEndpointAdaptor-Bvy-Hgjf.mjs.map +1 -0
  19. package/dist/{AmazonApiGatewayEndpointAdaptor-DNFvvdmW.cjs → AmazonApiGatewayEndpointAdaptor-Cpxluhfg.cjs} +55 -13
  20. package/dist/AmazonApiGatewayEndpointAdaptor-Cpxluhfg.cjs.map +1 -0
  21. package/dist/{AmazonApiGatewayEndpointAdaptor-qlKXuZxy.d.mts → AmazonApiGatewayEndpointAdaptor-DTgdZ8I1.d.mts} +52 -6
  22. package/dist/AmazonApiGatewayEndpointAdaptor-DTgdZ8I1.d.mts.map +1 -0
  23. package/dist/{AmazonApiGatewayEndpointAdaptor-DLqnYQ4E.d.cts → AmazonApiGatewayEndpointAdaptor-DsWnO6x9.d.cts} +51 -5
  24. package/dist/AmazonApiGatewayEndpointAdaptor-DsWnO6x9.d.cts.map +1 -0
  25. package/dist/{AmazonApiGatewayV1EndpointAdaptor-DyUaJIhB.d.cts → AmazonApiGatewayV1EndpointAdaptor-7ELXUBFK.d.cts} +4 -4
  26. package/dist/AmazonApiGatewayV1EndpointAdaptor-7ELXUBFK.d.cts.map +1 -0
  27. package/dist/{AmazonApiGatewayV1EndpointAdaptor-Ccl8B8kG.cjs → AmazonApiGatewayV1EndpointAdaptor-B8vIYYNh.cjs} +4 -4
  28. package/dist/AmazonApiGatewayV1EndpointAdaptor-B8vIYYNh.cjs.map +1 -0
  29. package/dist/{AmazonApiGatewayV1EndpointAdaptor-CShQI8Gk.mjs → AmazonApiGatewayV1EndpointAdaptor-ByXGIju8.mjs} +4 -4
  30. package/dist/AmazonApiGatewayV1EndpointAdaptor-ByXGIju8.mjs.map +1 -0
  31. package/dist/{AmazonApiGatewayV1EndpointAdaptor-MRUxs3Xi.d.mts → AmazonApiGatewayV1EndpointAdaptor-RWRmFPrN.d.mts} +5 -5
  32. package/dist/AmazonApiGatewayV1EndpointAdaptor-RWRmFPrN.d.mts.map +1 -0
  33. package/dist/{AmazonApiGatewayV2EndpointAdaptor-D8-0Aab4.cjs → AmazonApiGatewayV2EndpointAdaptor-DIetspUm.cjs} +4 -4
  34. package/dist/AmazonApiGatewayV2EndpointAdaptor-DIetspUm.cjs.map +1 -0
  35. package/dist/{AmazonApiGatewayV2EndpointAdaptor-lCRzGE4q.mjs → AmazonApiGatewayV2EndpointAdaptor-DWemCZvl.mjs} +4 -4
  36. package/dist/AmazonApiGatewayV2EndpointAdaptor-DWemCZvl.mjs.map +1 -0
  37. package/dist/{AmazonApiGatewayV2EndpointAdaptor-M1-w0U5R.d.cts → AmazonApiGatewayV2EndpointAdaptor-D_uMTmuJ.d.cts} +4 -6
  38. package/dist/AmazonApiGatewayV2EndpointAdaptor-D_uMTmuJ.d.cts.map +1 -0
  39. package/dist/{AmazonApiGatewayV2EndpointAdaptor-fuLM6M9k.d.mts → AmazonApiGatewayV2EndpointAdaptor-wnOMDv6o.d.mts} +5 -7
  40. package/dist/AmazonApiGatewayV2EndpointAdaptor-wnOMDv6o.d.mts.map +1 -0
  41. package/dist/{Authorizer-C0ge_tc8.cjs → Authorizer-BXxBee2P.cjs} +1 -1
  42. package/dist/Authorizer-BXxBee2P.cjs.map +1 -0
  43. package/dist/{Authorizer-r9U3y_ms.mjs → Authorizer-BgjU8-z6.mjs} +1 -1
  44. package/dist/Authorizer-BgjU8-z6.mjs.map +1 -0
  45. package/dist/{Authorizer-gWxYsGEp.d.mts → Authorizer-DCcYOx3h.d.mts} +1 -1
  46. package/dist/Authorizer-DCcYOx3h.d.mts.map +1 -0
  47. package/dist/{Authorizer-B-btowNd.d.cts → Authorizer-DWtwC8we.d.cts} +1 -1
  48. package/dist/Authorizer-DWtwC8we.d.cts.map +1 -0
  49. package/dist/{BaseFunctionBuilder-Czi1Jwza.mjs → BaseFunctionBuilder-0qlenb9z.mjs} +2 -2
  50. package/dist/BaseFunctionBuilder-0qlenb9z.mjs.map +1 -0
  51. package/dist/BaseFunctionBuilder-BAtutR6q.d.cts.map +1 -1
  52. package/dist/{BaseFunctionBuilder-DRY419e7.d.mts → BaseFunctionBuilder-CDfDWWAQ.d.mts} +2 -2
  53. package/dist/BaseFunctionBuilder-CDfDWWAQ.d.mts.map +1 -0
  54. package/dist/{BaseFunctionBuilder-MYG3C9ug.cjs → BaseFunctionBuilder-D7o93EGv.cjs} +2 -2
  55. package/dist/BaseFunctionBuilder-D7o93EGv.cjs.map +1 -0
  56. package/dist/{Construct-Ba5cMxib.cjs → Construct-BlnyYtJC.cjs} +31 -2
  57. package/dist/Construct-BlnyYtJC.cjs.map +1 -0
  58. package/dist/Construct-C4rPE67v.d.cts.map +1 -1
  59. package/dist/{Construct-DdyGHuag.mjs → Construct-D5dCvxZ3.mjs} +31 -2
  60. package/dist/Construct-D5dCvxZ3.mjs.map +1 -0
  61. package/dist/{Construct-XrijZFFh.d.mts → Construct-dZiwVo0q.d.mts} +1 -1
  62. package/dist/Construct-dZiwVo0q.d.mts.map +1 -0
  63. package/dist/Construct.cjs +1 -1
  64. package/dist/Construct.d.mts +1 -1
  65. package/dist/Construct.mjs +1 -1
  66. package/dist/{Cron-bDLcTvV5.d.cts → Cron-B6FnTu7k.d.cts} +2 -2
  67. package/dist/Cron-B6FnTu7k.d.cts.map +1 -0
  68. package/dist/{Cron-CGF4YAfM.cjs → Cron-BAPQetlC.cjs} +3 -3
  69. package/dist/Cron-BAPQetlC.cjs.map +1 -0
  70. package/dist/{Cron-BxhGs5up.mjs → Cron-CAk_ddH8.mjs} +3 -3
  71. package/dist/Cron-CAk_ddH8.mjs.map +1 -0
  72. package/dist/{Cron-cdjlSKNp.d.mts → Cron-D3bEljxQ.d.mts} +2 -2
  73. package/dist/Cron-D3bEljxQ.d.mts.map +1 -0
  74. package/dist/{CronBuilder-DKVXyE0Q.d.cts → CronBuilder-CA8euP0z.d.cts} +4 -4
  75. package/dist/CronBuilder-CA8euP0z.d.cts.map +1 -0
  76. package/dist/{CronBuilder-BC4m5-p1.d.mts → CronBuilder-DvdiKzhq.d.mts} +4 -4
  77. package/dist/CronBuilder-DvdiKzhq.d.mts.map +1 -0
  78. package/dist/{CronBuilder-CcxKRtVP.cjs → CronBuilder-DxXA5ymv.cjs} +4 -4
  79. package/dist/CronBuilder-DxXA5ymv.cjs.map +1 -0
  80. package/dist/{CronBuilder-d2jh-IB2.mjs → CronBuilder-e8TaHPYm.mjs} +4 -4
  81. package/dist/CronBuilder-e8TaHPYm.mjs.map +1 -0
  82. package/dist/{Endpoint-BPv9_-m_.d.cts → Endpoint-BOlbY5iq.d.cts} +3 -3
  83. package/dist/Endpoint-BOlbY5iq.d.cts.map +1 -0
  84. package/dist/{Endpoint-CuOEswxJ.mjs → Endpoint-BbdNmtlM.mjs} +6 -6
  85. package/dist/Endpoint-BbdNmtlM.mjs.map +1 -0
  86. package/dist/{Endpoint-BdwG75G_.d.mts → Endpoint-Dlv7nxgj.d.mts} +4 -4
  87. package/dist/Endpoint-Dlv7nxgj.d.mts.map +1 -0
  88. package/dist/{Endpoint-BVGZXFyV.cjs → Endpoint-DxvnlfXg.cjs} +6 -6
  89. package/dist/Endpoint-DxvnlfXg.cjs.map +1 -0
  90. package/dist/{EndpointBuilder-Cgj1P_ra.cjs → EndpointBuilder-40Iz5CjY.cjs} +6 -6
  91. package/dist/EndpointBuilder-40Iz5CjY.cjs.map +1 -0
  92. package/dist/{EndpointBuilder-DnCB1h1j.mjs → EndpointBuilder-BaVvhW9m.mjs} +6 -6
  93. package/dist/EndpointBuilder-BaVvhW9m.mjs.map +1 -0
  94. package/dist/{EndpointBuilder-DIy_m1bu.d.cts → EndpointBuilder-CFfWWjUa.d.cts} +3 -3
  95. package/dist/EndpointBuilder-CFfWWjUa.d.cts.map +1 -0
  96. package/dist/{EndpointBuilder-B3az942t.d.mts → EndpointBuilder-T_K2NLWw.d.mts} +5 -5
  97. package/dist/EndpointBuilder-T_K2NLWw.d.mts.map +1 -0
  98. package/dist/{EndpointFactory-CyPbm3AD.d.cts → EndpointFactory-ChzBVEM9.d.cts} +4 -4
  99. package/dist/EndpointFactory-ChzBVEM9.d.cts.map +1 -0
  100. package/dist/{EndpointFactory-CbdxPCIH.mjs → EndpointFactory-DfNjSgVG.mjs} +7 -7
  101. package/dist/EndpointFactory-DfNjSgVG.mjs.map +1 -0
  102. package/dist/{EndpointFactory-C-0nE6Jg.d.mts → EndpointFactory-GAL_tuPf.d.mts} +4 -4
  103. package/dist/EndpointFactory-GAL_tuPf.d.mts.map +1 -0
  104. package/dist/{EndpointFactory-CYj6BYok.cjs → EndpointFactory-r6jxPvQ8.cjs} +7 -7
  105. package/dist/EndpointFactory-r6jxPvQ8.cjs.map +1 -0
  106. package/dist/{Function-BVHqIDp9.mjs → Function-D8tBamM3.mjs} +3 -3
  107. package/dist/Function-D8tBamM3.mjs.map +1 -0
  108. package/dist/{Function-DN2G6OT5.d.mts → Function-DBmU3uGI.d.mts} +3 -3
  109. package/dist/Function-DBmU3uGI.d.mts.map +1 -0
  110. package/dist/{Function-Cf7f_kCz.d.cts → Function-PNW4HdNE.d.cts} +2 -2
  111. package/dist/Function-PNW4HdNE.d.cts.map +1 -0
  112. package/dist/{Function-DDZb1525.cjs → Function-iLKrUXuw.cjs} +3 -3
  113. package/dist/Function-iLKrUXuw.cjs.map +1 -0
  114. package/dist/{FunctionBuilder-DswJ-9sD.cjs → FunctionBuilder-BEpPgeho.cjs} +4 -4
  115. package/dist/FunctionBuilder-BEpPgeho.cjs.map +1 -0
  116. package/dist/{FunctionBuilder-Cxx8D2na.d.mts → FunctionBuilder-Bv4H2I1a.d.mts} +4 -4
  117. package/dist/FunctionBuilder-Bv4H2I1a.d.mts.map +1 -0
  118. package/dist/{FunctionBuilder-CrDYgfiI.mjs → FunctionBuilder-BwNF99AB.mjs} +4 -4
  119. package/dist/FunctionBuilder-BwNF99AB.mjs.map +1 -0
  120. package/dist/{FunctionBuilder-CJBzzXL3.d.cts → FunctionBuilder-DCqXIHaq.d.cts} +2 -2
  121. package/dist/FunctionBuilder-DCqXIHaq.d.cts.map +1 -0
  122. package/dist/{FunctionExecutionWrapper-CLDh7Z2_.mjs → FunctionExecutionWrapper-B__HE_B-.mjs} +3 -3
  123. package/dist/FunctionExecutionWrapper-B__HE_B-.mjs.map +1 -0
  124. package/dist/{FunctionExecutionWrapper-DF260Aaj.d.mts → FunctionExecutionWrapper-BclgIztn.d.cts} +5 -5
  125. package/dist/FunctionExecutionWrapper-BclgIztn.d.cts.map +1 -0
  126. package/dist/{FunctionExecutionWrapper-BYI2bGTL.cjs → FunctionExecutionWrapper-BjF6t9Hb.cjs} +3 -3
  127. package/dist/FunctionExecutionWrapper-BjF6t9Hb.cjs.map +1 -0
  128. package/dist/{FunctionExecutionWrapper-Qy8bmgFR.d.cts → FunctionExecutionWrapper-Dq21c6vt.d.mts} +5 -5
  129. package/dist/FunctionExecutionWrapper-Dq21c6vt.d.mts.map +1 -0
  130. package/dist/HonoEndpointAdaptor-C_ym_Sbr.mjs +251 -0
  131. package/dist/HonoEndpointAdaptor-C_ym_Sbr.mjs.map +1 -0
  132. package/dist/HonoEndpointAdaptor-DiQH0eTb.cjs +257 -0
  133. package/dist/HonoEndpointAdaptor-DiQH0eTb.cjs.map +1 -0
  134. package/dist/{HonoEndpointAdaptor-Bqm6SEuP.d.cts → HonoEndpointAdaptor-Dkkemmbo.d.cts} +9 -4
  135. package/dist/HonoEndpointAdaptor-Dkkemmbo.d.cts.map +1 -0
  136. package/dist/{HonoEndpointAdaptor-CRe-ij5f.d.mts → HonoEndpointAdaptor-HukjdF6M.d.mts} +10 -5
  137. package/dist/HonoEndpointAdaptor-HukjdF6M.d.mts.map +1 -0
  138. package/dist/{Subscriber-COYMSevD.d.cts → Subscriber--zUjZDR6.d.cts} +1 -1
  139. package/dist/Subscriber--zUjZDR6.d.cts.map +1 -0
  140. package/dist/{Subscriber-ikctpU3I.d.mts → Subscriber-0Ac7cXID.d.mts} +2 -2
  141. package/dist/Subscriber-0Ac7cXID.d.mts.map +1 -0
  142. package/dist/{Subscriber-BmPf9GFb.mjs → Subscriber-BgZ8T-O2.mjs} +2 -2
  143. package/dist/Subscriber-BgZ8T-O2.mjs.map +1 -0
  144. package/dist/{Subscriber-BiHjVXtM.cjs → Subscriber-CoFmHMIM.cjs} +2 -2
  145. package/dist/Subscriber-CoFmHMIM.cjs.map +1 -0
  146. package/dist/{SubscriberBuilder-D_9zzllj.d.mts → SubscriberBuilder-D8cmUHee.d.mts} +2 -2
  147. package/dist/SubscriberBuilder-D8cmUHee.d.mts.map +1 -0
  148. package/dist/{SubscriberBuilder-DJPEeYDJ.mjs → SubscriberBuilder-DWXWZBPo.mjs} +2 -2
  149. package/dist/SubscriberBuilder-DWXWZBPo.mjs.map +1 -0
  150. package/dist/{SubscriberBuilder-ivHAGIVi.d.cts → SubscriberBuilder-DciTqb-7.d.cts} +2 -2
  151. package/dist/SubscriberBuilder-DciTqb-7.d.cts.map +1 -0
  152. package/dist/{SubscriberBuilder-Cp1C-xtT.cjs → SubscriberBuilder-JlxhyqGp.cjs} +2 -2
  153. package/dist/SubscriberBuilder-JlxhyqGp.cjs.map +1 -0
  154. package/dist/{TestEndpointAdaptor-DB7bREhS.d.mts → TestEndpointAdaptor-Boijwbmz.d.mts} +4 -4
  155. package/dist/TestEndpointAdaptor-Boijwbmz.d.mts.map +1 -0
  156. package/dist/{TestEndpointAdaptor-C10xBI--.d.cts → TestEndpointAdaptor-DdwpRyNh.d.cts} +3 -3
  157. package/dist/TestEndpointAdaptor-DdwpRyNh.d.cts.map +1 -0
  158. package/dist/TestEndpointAdaptor-Dk75ExxE.cjs +176 -0
  159. package/dist/TestEndpointAdaptor-Dk75ExxE.cjs.map +1 -0
  160. package/dist/TestEndpointAdaptor-OiA2JLDp.mjs +170 -0
  161. package/dist/TestEndpointAdaptor-OiA2JLDp.mjs.map +1 -0
  162. package/dist/adaptors/aws.cjs +12 -12
  163. package/dist/adaptors/aws.d.cts +13 -12
  164. package/dist/adaptors/aws.d.mts +16 -15
  165. package/dist/adaptors/aws.mjs +12 -12
  166. package/dist/adaptors/hono.cjs +10 -9
  167. package/dist/adaptors/hono.d.cts +6 -6
  168. package/dist/adaptors/hono.d.mts +9 -9
  169. package/dist/adaptors/hono.mjs +10 -9
  170. package/dist/adaptors/testing.cjs +8 -7
  171. package/dist/adaptors/testing.d.cts +6 -6
  172. package/dist/adaptors/testing.d.mts +9 -9
  173. package/dist/adaptors/testing.mjs +8 -7
  174. package/dist/crons/Cron.cjs +6 -6
  175. package/dist/crons/Cron.d.cts +4 -4
  176. package/dist/crons/Cron.d.mts +6 -6
  177. package/dist/crons/Cron.mjs +6 -6
  178. package/dist/crons/CronBuilder.cjs +7 -7
  179. package/dist/crons/CronBuilder.d.cts +5 -5
  180. package/dist/crons/CronBuilder.d.mts +7 -7
  181. package/dist/crons/CronBuilder.mjs +7 -7
  182. package/dist/crons/index.cjs +7 -7
  183. package/dist/crons/index.cjs.map +1 -1
  184. package/dist/crons/index.d.cts +5 -5
  185. package/dist/crons/index.d.mts +7 -7
  186. package/dist/crons/index.mjs +7 -7
  187. package/dist/crons/index.mjs.map +1 -1
  188. package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.cjs +7 -7
  189. package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.d.cts +8 -7
  190. package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.d.mts +11 -10
  191. package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.mjs +7 -7
  192. package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.cjs +8 -8
  193. package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.d.cts +8 -7
  194. package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.d.mts +11 -10
  195. package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.mjs +8 -8
  196. package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.cjs +8 -8
  197. package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.d.cts +9 -8
  198. package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.d.mts +12 -11
  199. package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.mjs +8 -8
  200. package/dist/endpoints/Authorizer.cjs +1 -1
  201. package/dist/endpoints/Authorizer.d.cts +1 -1
  202. package/dist/endpoints/Authorizer.d.mts +1 -1
  203. package/dist/endpoints/Authorizer.mjs +1 -1
  204. package/dist/endpoints/Endpoint.cjs +6 -6
  205. package/dist/endpoints/Endpoint.d.cts +5 -5
  206. package/dist/endpoints/Endpoint.d.mts +8 -8
  207. package/dist/endpoints/Endpoint.mjs +6 -6
  208. package/dist/endpoints/EndpointBuilder.cjs +9 -9
  209. package/dist/endpoints/EndpointBuilder.d.cts +6 -6
  210. package/dist/endpoints/EndpointBuilder.d.mts +9 -9
  211. package/dist/endpoints/EndpointBuilder.mjs +9 -9
  212. package/dist/endpoints/EndpointFactory.cjs +10 -10
  213. package/dist/endpoints/EndpointFactory.d.cts +7 -7
  214. package/dist/endpoints/EndpointFactory.d.mts +10 -10
  215. package/dist/endpoints/EndpointFactory.mjs +10 -10
  216. package/dist/endpoints/HonoEndpointAdaptor.cjs +10 -9
  217. package/dist/endpoints/HonoEndpointAdaptor.d.cts +6 -6
  218. package/dist/endpoints/HonoEndpointAdaptor.d.mts +9 -9
  219. package/dist/endpoints/HonoEndpointAdaptor.mjs +10 -9
  220. package/dist/endpoints/TestEndpointAdaptor.cjs +8 -7
  221. package/dist/endpoints/TestEndpointAdaptor.d.cts +6 -6
  222. package/dist/endpoints/TestEndpointAdaptor.d.mts +9 -9
  223. package/dist/endpoints/TestEndpointAdaptor.mjs +8 -7
  224. package/dist/endpoints/audit.d.cts +5 -5
  225. package/dist/endpoints/audit.d.mts +8 -8
  226. package/dist/endpoints/helpers.cjs +7 -7
  227. package/dist/endpoints/helpers.d.cts +5 -5
  228. package/dist/endpoints/helpers.d.cts.map +1 -1
  229. package/dist/endpoints/helpers.d.mts +8 -8
  230. package/dist/endpoints/helpers.d.mts.map +1 -1
  231. package/dist/endpoints/helpers.mjs +7 -7
  232. package/dist/endpoints/index.cjs +20 -10
  233. package/dist/endpoints/index.cjs.map +1 -1
  234. package/dist/endpoints/index.d.cts +10 -8
  235. package/dist/endpoints/index.d.cts.map +1 -1
  236. package/dist/endpoints/index.d.mts +13 -11
  237. package/dist/endpoints/index.d.mts.map +1 -1
  238. package/dist/endpoints/index.mjs +13 -11
  239. package/dist/endpoints/index.mjs.map +1 -1
  240. package/dist/endpoints/lazyAccessors.cjs +10 -0
  241. package/dist/endpoints/lazyAccessors.d.cts +10 -0
  242. package/dist/endpoints/lazyAccessors.d.mts +10 -0
  243. package/dist/endpoints/lazyAccessors.mjs +3 -0
  244. package/dist/endpoints/parseHonoQuery.cjs +1 -1
  245. package/dist/endpoints/parseHonoQuery.mjs +1 -1
  246. package/dist/endpoints/parseQueryParams.d.cts.map +1 -1
  247. package/dist/endpoints/parseQueryParams.d.mts.map +1 -1
  248. package/dist/endpoints/processAudits.d.cts +5 -5
  249. package/dist/endpoints/processAudits.d.cts.map +1 -1
  250. package/dist/endpoints/processAudits.d.mts +8 -8
  251. package/dist/endpoints/processAudits.d.mts.map +1 -1
  252. package/dist/endpoints/rls.cjs +1 -1
  253. package/dist/endpoints/rls.d.cts +5 -5
  254. package/dist/endpoints/rls.d.mts +8 -8
  255. package/dist/endpoints/rls.mjs +1 -1
  256. package/dist/functions/AWSLambdaFunction.cjs +6 -6
  257. package/dist/functions/AWSLambdaFunction.d.cts +3 -3
  258. package/dist/functions/AWSLambdaFunction.d.mts +4 -4
  259. package/dist/functions/AWSLambdaFunction.mjs +6 -6
  260. package/dist/functions/BaseFunctionBuilder.cjs +2 -2
  261. package/dist/functions/BaseFunctionBuilder.d.mts +2 -2
  262. package/dist/functions/BaseFunctionBuilder.mjs +2 -2
  263. package/dist/functions/Function.cjs +2 -2
  264. package/dist/functions/Function.d.cts +1 -1
  265. package/dist/functions/Function.d.mts +2 -2
  266. package/dist/functions/Function.mjs +2 -2
  267. package/dist/functions/FunctionBuilder.cjs +4 -4
  268. package/dist/functions/FunctionBuilder.d.cts +2 -2
  269. package/dist/functions/FunctionBuilder.d.mts +4 -4
  270. package/dist/functions/FunctionBuilder.mjs +4 -4
  271. package/dist/functions/FunctionExecutionWrapper.cjs +5 -5
  272. package/dist/functions/FunctionExecutionWrapper.d.cts +2 -2
  273. package/dist/functions/FunctionExecutionWrapper.d.mts +3 -3
  274. package/dist/functions/FunctionExecutionWrapper.mjs +5 -5
  275. package/dist/functions/TestFunctionAdaptor.cjs +7 -7
  276. package/dist/functions/TestFunctionAdaptor.cjs.map +1 -1
  277. package/dist/functions/TestFunctionAdaptor.d.cts +2 -2
  278. package/dist/functions/TestFunctionAdaptor.d.cts.map +1 -1
  279. package/dist/functions/TestFunctionAdaptor.d.mts +3 -3
  280. package/dist/functions/TestFunctionAdaptor.d.mts.map +1 -1
  281. package/dist/functions/TestFunctionAdaptor.mjs +7 -7
  282. package/dist/functions/TestFunctionAdaptor.mjs.map +1 -1
  283. package/dist/functions/index.cjs +5 -5
  284. package/dist/functions/index.d.cts +3 -3
  285. package/dist/functions/index.d.mts +5 -5
  286. package/dist/functions/index.mjs +5 -5
  287. package/dist/{functions-fTid0RMK.cjs → functions-BkKXVeHm.cjs} +2 -2
  288. package/dist/functions-BkKXVeHm.cjs.map +1 -0
  289. package/dist/functions-C3A1vMRW.mjs +8 -0
  290. package/dist/functions-C3A1vMRW.mjs.map +1 -0
  291. package/dist/{helpers-BcP1tXAi.cjs → helpers-BelEzV4U.cjs} +2 -2
  292. package/dist/helpers-BelEzV4U.cjs.map +1 -0
  293. package/dist/{helpers-ByRTDO_m.mjs → helpers-DgsMFMUV.mjs} +2 -2
  294. package/dist/helpers-DgsMFMUV.mjs.map +1 -0
  295. package/dist/{index-SI4V0XwK.d.cts → index-CgAQHr3f.d.mts} +2 -2
  296. package/dist/index-CgAQHr3f.d.mts.map +1 -0
  297. package/dist/{index-BWzGIj06.d.mts → index-D0fp_IK1.d.cts} +2 -2
  298. package/dist/index-D0fp_IK1.d.cts.map +1 -0
  299. package/dist/index.cjs +1 -1
  300. package/dist/index.d.cts +2 -1
  301. package/dist/index.d.mts +4 -3
  302. package/dist/index.mjs +1 -1
  303. package/dist/lazyAccessors-B-Jgkg2o.mjs +175 -0
  304. package/dist/lazyAccessors-B-Jgkg2o.mjs.map +1 -0
  305. package/dist/lazyAccessors-B2ILzU-j.d.mts +49 -0
  306. package/dist/lazyAccessors-B2ILzU-j.d.mts.map +1 -0
  307. package/dist/lazyAccessors-B8Hhras9.cjs +223 -0
  308. package/dist/lazyAccessors-B8Hhras9.cjs.map +1 -0
  309. package/dist/lazyAccessors-Bcpi06ed.d.cts +49 -0
  310. package/dist/lazyAccessors-Bcpi06ed.d.cts.map +1 -0
  311. package/dist/{parseHonoQuery-CZC5_97v.cjs → parseHonoQuery-D4MhxTRc.cjs} +1 -1
  312. package/dist/parseHonoQuery-D4MhxTRc.cjs.map +1 -0
  313. package/dist/{parseHonoQuery-DDgIkTO4.mjs → parseHonoQuery-DpK3sGPc.mjs} +1 -1
  314. package/dist/parseHonoQuery-DpK3sGPc.mjs.map +1 -0
  315. package/dist/parseQueryParams-BSNkjmZ9.cjs.map +1 -1
  316. package/dist/parseQueryParams-UMTRnRrW.mjs.map +1 -1
  317. package/dist/processAudits-CzHkPokQ.cjs.map +1 -1
  318. package/dist/processAudits-Dj8UGqcW.mjs.map +1 -1
  319. package/dist/publisher-Bw4770Hi.mjs.map +1 -1
  320. package/dist/publisher-C4BhHB5I.d.cts +16 -0
  321. package/dist/publisher-C4BhHB5I.d.cts.map +1 -0
  322. package/dist/publisher-NE-GnXL8.d.mts +16 -0
  323. package/dist/publisher-NE-GnXL8.d.mts.map +1 -0
  324. package/dist/publisher-lFQleddL.cjs.map +1 -1
  325. package/dist/publisher.d.cts +3 -16
  326. package/dist/publisher.d.mts +3 -16
  327. package/dist/{rls-CmJ7bRsz.cjs → rls-BrywnrQb.cjs} +1 -1
  328. package/dist/{rls-CmJ7bRsz.cjs.map → rls-BrywnrQb.cjs.map} +1 -1
  329. package/dist/{rls-Bf3FRwto.mjs → rls-C0cWOnk4.mjs} +1 -1
  330. package/dist/{rls-Bf3FRwto.mjs.map → rls-C0cWOnk4.mjs.map} +1 -1
  331. package/dist/subscribers/AWSLambdaSubscriberAdaptor.cjs +1 -1
  332. package/dist/subscribers/AWSLambdaSubscriberAdaptor.d.cts +2 -2
  333. package/dist/subscribers/AWSLambdaSubscriberAdaptor.d.mts +3 -3
  334. package/dist/subscribers/AWSLambdaSubscriberAdaptor.mjs +1 -1
  335. package/dist/subscribers/Subscriber.cjs +2 -2
  336. package/dist/subscribers/Subscriber.d.cts +1 -1
  337. package/dist/subscribers/Subscriber.d.mts +2 -2
  338. package/dist/subscribers/Subscriber.mjs +2 -2
  339. package/dist/subscribers/SubscriberBuilder.cjs +3 -3
  340. package/dist/subscribers/SubscriberBuilder.d.cts +2 -2
  341. package/dist/subscribers/SubscriberBuilder.d.mts +3 -3
  342. package/dist/subscribers/SubscriberBuilder.mjs +3 -3
  343. package/dist/subscribers/index.cjs +3 -3
  344. package/dist/subscribers/index.cjs.map +1 -1
  345. package/dist/subscribers/index.d.cts +2 -2
  346. package/dist/subscribers/index.d.cts.map +1 -1
  347. package/dist/subscribers/index.d.mts +3 -3
  348. package/dist/subscribers/index.d.mts.map +1 -1
  349. package/dist/subscribers/index.mjs +3 -3
  350. package/dist/subscribers/index.mjs.map +1 -1
  351. package/dist/telemetry-BTaiRqPo.d.cts +95 -0
  352. package/dist/telemetry-BTaiRqPo.d.cts.map +1 -0
  353. package/dist/telemetry-yAHf5yDs.d.mts +95 -0
  354. package/dist/telemetry-yAHf5yDs.d.mts.map +1 -0
  355. package/dist/telemetry.cjs +0 -0
  356. package/dist/telemetry.d.cts +2 -0
  357. package/dist/telemetry.d.mts +2 -0
  358. package/dist/telemetry.mjs +0 -0
  359. package/dist/types-B5H3piDg.d.cts.map +1 -1
  360. package/dist/{types-DdIlpxAd.d.mts → types-Dw-iLd3Y.d.mts} +1 -1
  361. package/dist/types-Dw-iLd3Y.d.mts.map +1 -0
  362. package/dist/types.d.mts +1 -1
  363. package/package.json +18 -18
  364. package/src/Construct.ts +117 -86
  365. package/src/__benchmarks__/build-time-optimization.bench.ts +274 -0
  366. package/src/__benchmarks__/endpoint.bench.ts +375 -375
  367. package/src/__benchmarks__/fixtures.ts +241 -0
  368. package/src/__benchmarks__/hono-adaptor.bench.ts +533 -0
  369. package/src/__benchmarks__/hono-server.bench.ts +206 -206
  370. package/src/__benchmarks__/response-builder.bench.ts +428 -0
  371. package/src/__benchmarks__/strategies/strategy-a-lazy-services.ts +319 -0
  372. package/src/__benchmarks__/strategies/strategy-c-middleware.ts +530 -0
  373. package/src/__benchmarks__/strategies/strategy-d-opt-in-events.ts +567 -0
  374. package/src/__tests__/Construct.environment.spec.ts +349 -350
  375. package/src/__tests__/publisher.setting.spec.ts +496 -499
  376. package/src/__tests__/publisher.spec.ts +440 -442
  377. package/src/crons/Cron.ts +117 -117
  378. package/src/crons/CronBuilder.ts +237 -238
  379. package/src/crons/__tests__/Cron.spec.ts +448 -448
  380. package/src/crons/__tests__/CronBuilder.state-isolation.spec.ts +214 -214
  381. package/src/crons/index.ts +4 -4
  382. package/src/endpoints/AmazonApiGatewayEndpointAdaptor.ts +571 -463
  383. package/src/endpoints/AmazonApiGatewayV1EndpointAdaptor.ts +86 -86
  384. package/src/endpoints/AmazonApiGatewayV2EndpointAdaptor.ts +85 -81
  385. package/src/endpoints/Authorizer.ts +100 -100
  386. package/src/endpoints/Endpoint.ts +921 -937
  387. package/src/endpoints/EndpointBuilder.ts +703 -703
  388. package/src/endpoints/EndpointFactory.ts +1054 -1056
  389. package/src/endpoints/HonoEndpointAdaptor.ts +621 -548
  390. package/src/endpoints/TestEndpointAdaptor.ts +373 -354
  391. package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.audits.spec.ts +499 -0
  392. package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.events.spec.ts +541 -542
  393. package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.spec.ts +1172 -1174
  394. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.audits.spec.ts +599 -599
  395. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.events.spec.ts +710 -710
  396. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.factory-publisher.spec.ts +280 -280
  397. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.kysely-audit.integration.spec.ts +924 -730
  398. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.rls.spec.ts +307 -0
  399. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.spec.ts +408 -408
  400. package/src/endpoints/__tests__/Authorizer.spec.ts +286 -0
  401. package/src/endpoints/__tests__/Endpoint.cookies.spec.ts +162 -162
  402. package/src/endpoints/__tests__/Endpoint.headers.spec.ts +182 -182
  403. package/src/endpoints/__tests__/Endpoint.manifest.spec.ts +158 -159
  404. package/src/endpoints/__tests__/Endpoint.spec.ts +819 -822
  405. package/src/endpoints/__tests__/EndpointBuilder.audit.spec.ts +427 -427
  406. package/src/endpoints/__tests__/EndpointBuilder.spec.ts +478 -478
  407. package/src/endpoints/__tests__/EndpointFactory.authorizers.spec.ts +426 -426
  408. package/src/endpoints/__tests__/EndpointFactory.database-auditor.spec.ts +501 -501
  409. package/src/endpoints/__tests__/EndpointFactory.reference-audit.spec.ts +177 -177
  410. package/src/endpoints/__tests__/EndpointFactory.spec.ts +471 -471
  411. package/src/endpoints/__tests__/EndpointFactory.state-isolation.spec.ts +143 -143
  412. package/src/endpoints/__tests__/HonoEndpointAdaptor.audit-transactions.spec.ts +663 -663
  413. package/src/endpoints/__tests__/HonoEndpointAdaptor.audits.spec.ts +608 -608
  414. package/src/endpoints/__tests__/HonoEndpointAdaptor.events.spec.ts +561 -561
  415. package/src/endpoints/__tests__/HonoEndpointAdaptor.kysely-audit.integration.spec.ts +1036 -1036
  416. package/src/endpoints/__tests__/HonoEndpointAdaptor.openapi.spec.ts +278 -278
  417. package/src/endpoints/__tests__/HonoEndpointAdaptor.spec.ts +1093 -1093
  418. package/src/endpoints/__tests__/ResponseBuilder.spec.ts +230 -230
  419. package/src/endpoints/__tests__/TestEndpointAdaptor.audits.spec.ts +569 -569
  420. package/src/endpoints/__tests__/TestEndpointAdaptor.spec.ts +841 -841
  421. package/src/endpoints/__tests__/endpoint-types.test.ts +68 -68
  422. package/src/endpoints/__tests__/helpers.spec.ts +37 -0
  423. package/src/endpoints/__tests__/lazyAccessors.spec.ts +330 -0
  424. package/src/endpoints/__tests__/processAudits.spec.ts +631 -0
  425. package/src/endpoints/audit.ts +51 -51
  426. package/src/endpoints/helpers.ts +34 -35
  427. package/src/endpoints/index.ts +33 -23
  428. package/src/endpoints/lazyAccessors.ts +241 -0
  429. package/src/endpoints/parseHonoQuery.ts +41 -41
  430. package/src/endpoints/parseQueryParams.ts +36 -36
  431. package/src/endpoints/processAudits.ts +269 -269
  432. package/src/endpoints/rls.ts +16 -16
  433. package/src/functions/AWSLambdaFunction.ts +294 -295
  434. package/src/functions/BaseFunctionBuilder.ts +185 -185
  435. package/src/functions/Function.ts +190 -190
  436. package/src/functions/FunctionBuilder.ts +353 -353
  437. package/src/functions/FunctionExecutionWrapper.ts +199 -200
  438. package/src/functions/TestFunctionAdaptor.ts +191 -191
  439. package/src/functions/__tests__/AWSLambdaFunctionAdaptor.spec.ts +424 -424
  440. package/src/functions/__tests__/Function.audits.spec.ts +364 -364
  441. package/src/functions/__tests__/Function.spec.ts +453 -454
  442. package/src/functions/__tests__/FunctionBuilder.state-isolation.spec.ts +179 -179
  443. package/src/functions/__tests__/TestFunctionAdaptor.spec.ts +369 -369
  444. package/src/functions/index.ts +6 -4
  445. package/src/index.ts +13 -9
  446. package/src/publisher.ts +71 -72
  447. package/src/subscribers/AWSLambdaSubscriberAdaptor.ts +244 -248
  448. package/src/subscribers/Subscriber.ts +82 -84
  449. package/src/subscribers/SubscriberBuilder.ts +129 -129
  450. package/src/subscribers/__tests__/AWSLambdaSubscriberAdaptor.spec.ts +589 -589
  451. package/src/subscribers/__tests__/Subscriber.spec.ts +402 -404
  452. package/src/subscribers/index.ts +1 -0
  453. package/src/telemetry.ts +103 -0
  454. package/src/types.ts +7 -7
  455. package/test.ts +58 -59
  456. package/dist/AWSLambdaFunction-BdebRMUh.d.mts.map +0 -1
  457. package/dist/AWSLambdaFunction-C54a1doJ.mjs.map +0 -1
  458. package/dist/AWSLambdaFunction-D0tEOTXQ.d.cts.map +0 -1
  459. package/dist/AWSLambdaFunction-EPGY4s7i.cjs.map +0 -1
  460. package/dist/AWSLambdaSubscriberAdaptor-BLfO612H.mjs.map +0 -1
  461. package/dist/AWSLambdaSubscriberAdaptor-BNcYYZ-P.cjs.map +0 -1
  462. package/dist/AWSLambdaSubscriberAdaptor-DrFAvHOp.d.mts.map +0 -1
  463. package/dist/AWSLambdaSubscriberAdaptor-Dx-Ks1Jp.d.cts.map +0 -1
  464. package/dist/AmazonApiGatewayEndpointAdaptor-BT9JXihC.mjs.map +0 -1
  465. package/dist/AmazonApiGatewayEndpointAdaptor-DLqnYQ4E.d.cts.map +0 -1
  466. package/dist/AmazonApiGatewayEndpointAdaptor-DNFvvdmW.cjs.map +0 -1
  467. package/dist/AmazonApiGatewayEndpointAdaptor-qlKXuZxy.d.mts.map +0 -1
  468. package/dist/AmazonApiGatewayV1EndpointAdaptor-CShQI8Gk.mjs.map +0 -1
  469. package/dist/AmazonApiGatewayV1EndpointAdaptor-Ccl8B8kG.cjs.map +0 -1
  470. package/dist/AmazonApiGatewayV1EndpointAdaptor-DyUaJIhB.d.cts.map +0 -1
  471. package/dist/AmazonApiGatewayV1EndpointAdaptor-MRUxs3Xi.d.mts.map +0 -1
  472. package/dist/AmazonApiGatewayV2EndpointAdaptor-D8-0Aab4.cjs.map +0 -1
  473. package/dist/AmazonApiGatewayV2EndpointAdaptor-M1-w0U5R.d.cts.map +0 -1
  474. package/dist/AmazonApiGatewayV2EndpointAdaptor-fuLM6M9k.d.mts.map +0 -1
  475. package/dist/AmazonApiGatewayV2EndpointAdaptor-lCRzGE4q.mjs.map +0 -1
  476. package/dist/Authorizer-B-btowNd.d.cts.map +0 -1
  477. package/dist/Authorizer-C0ge_tc8.cjs.map +0 -1
  478. package/dist/Authorizer-gWxYsGEp.d.mts.map +0 -1
  479. package/dist/Authorizer-r9U3y_ms.mjs.map +0 -1
  480. package/dist/BaseFunctionBuilder-Czi1Jwza.mjs.map +0 -1
  481. package/dist/BaseFunctionBuilder-DRY419e7.d.mts.map +0 -1
  482. package/dist/BaseFunctionBuilder-MYG3C9ug.cjs.map +0 -1
  483. package/dist/Construct-Ba5cMxib.cjs.map +0 -1
  484. package/dist/Construct-DdyGHuag.mjs.map +0 -1
  485. package/dist/Construct-XrijZFFh.d.mts.map +0 -1
  486. package/dist/Cron-BxhGs5up.mjs.map +0 -1
  487. package/dist/Cron-CGF4YAfM.cjs.map +0 -1
  488. package/dist/Cron-bDLcTvV5.d.cts.map +0 -1
  489. package/dist/Cron-cdjlSKNp.d.mts.map +0 -1
  490. package/dist/CronBuilder-BC4m5-p1.d.mts.map +0 -1
  491. package/dist/CronBuilder-CcxKRtVP.cjs.map +0 -1
  492. package/dist/CronBuilder-DKVXyE0Q.d.cts.map +0 -1
  493. package/dist/CronBuilder-d2jh-IB2.mjs.map +0 -1
  494. package/dist/Endpoint-BPv9_-m_.d.cts.map +0 -1
  495. package/dist/Endpoint-BVGZXFyV.cjs.map +0 -1
  496. package/dist/Endpoint-BdwG75G_.d.mts.map +0 -1
  497. package/dist/Endpoint-CuOEswxJ.mjs.map +0 -1
  498. package/dist/EndpointBuilder-B3az942t.d.mts.map +0 -1
  499. package/dist/EndpointBuilder-Cgj1P_ra.cjs.map +0 -1
  500. package/dist/EndpointBuilder-DIy_m1bu.d.cts.map +0 -1
  501. package/dist/EndpointBuilder-DnCB1h1j.mjs.map +0 -1
  502. package/dist/EndpointFactory-C-0nE6Jg.d.mts.map +0 -1
  503. package/dist/EndpointFactory-CYj6BYok.cjs.map +0 -1
  504. package/dist/EndpointFactory-CbdxPCIH.mjs.map +0 -1
  505. package/dist/EndpointFactory-CyPbm3AD.d.cts.map +0 -1
  506. package/dist/Function-BVHqIDp9.mjs.map +0 -1
  507. package/dist/Function-Cf7f_kCz.d.cts.map +0 -1
  508. package/dist/Function-DDZb1525.cjs.map +0 -1
  509. package/dist/Function-DN2G6OT5.d.mts.map +0 -1
  510. package/dist/FunctionBuilder-CJBzzXL3.d.cts.map +0 -1
  511. package/dist/FunctionBuilder-CrDYgfiI.mjs.map +0 -1
  512. package/dist/FunctionBuilder-Cxx8D2na.d.mts.map +0 -1
  513. package/dist/FunctionBuilder-DswJ-9sD.cjs.map +0 -1
  514. package/dist/FunctionExecutionWrapper-BYI2bGTL.cjs.map +0 -1
  515. package/dist/FunctionExecutionWrapper-CLDh7Z2_.mjs.map +0 -1
  516. package/dist/FunctionExecutionWrapper-DF260Aaj.d.mts.map +0 -1
  517. package/dist/FunctionExecutionWrapper-Qy8bmgFR.d.cts.map +0 -1
  518. package/dist/HonoEndpointAdaptor-Bqm6SEuP.d.cts.map +0 -1
  519. package/dist/HonoEndpointAdaptor-CQe2FqMR.cjs +0 -234
  520. package/dist/HonoEndpointAdaptor-CQe2FqMR.cjs.map +0 -1
  521. package/dist/HonoEndpointAdaptor-CRe-ij5f.d.mts.map +0 -1
  522. package/dist/HonoEndpointAdaptor-Ce-2HBxn.mjs +0 -228
  523. package/dist/HonoEndpointAdaptor-Ce-2HBxn.mjs.map +0 -1
  524. package/dist/Subscriber-BiHjVXtM.cjs.map +0 -1
  525. package/dist/Subscriber-BmPf9GFb.mjs.map +0 -1
  526. package/dist/Subscriber-COYMSevD.d.cts.map +0 -1
  527. package/dist/Subscriber-ikctpU3I.d.mts.map +0 -1
  528. package/dist/SubscriberBuilder-Cp1C-xtT.cjs.map +0 -1
  529. package/dist/SubscriberBuilder-DJPEeYDJ.mjs.map +0 -1
  530. package/dist/SubscriberBuilder-D_9zzllj.d.mts.map +0 -1
  531. package/dist/SubscriberBuilder-ivHAGIVi.d.cts.map +0 -1
  532. package/dist/TestEndpointAdaptor-BXTofAKc.mjs +0 -163
  533. package/dist/TestEndpointAdaptor-BXTofAKc.mjs.map +0 -1
  534. package/dist/TestEndpointAdaptor-C10xBI--.d.cts.map +0 -1
  535. package/dist/TestEndpointAdaptor-D9IwhIYg.cjs +0 -169
  536. package/dist/TestEndpointAdaptor-D9IwhIYg.cjs.map +0 -1
  537. package/dist/TestEndpointAdaptor-DB7bREhS.d.mts.map +0 -1
  538. package/dist/functions-C6EK1xL6.mjs +0 -8
  539. package/dist/functions-C6EK1xL6.mjs.map +0 -1
  540. package/dist/functions-fTid0RMK.cjs.map +0 -1
  541. package/dist/helpers-BcP1tXAi.cjs.map +0 -1
  542. package/dist/helpers-ByRTDO_m.mjs.map +0 -1
  543. package/dist/index-BWzGIj06.d.mts.map +0 -1
  544. package/dist/index-SI4V0XwK.d.cts.map +0 -1
  545. package/dist/parseHonoQuery-CZC5_97v.cjs.map +0 -1
  546. package/dist/parseHonoQuery-DDgIkTO4.mjs.map +0 -1
  547. package/dist/publisher.d.cts.map +0 -1
  548. package/dist/publisher.d.mts.map +0 -1
  549. package/dist/types-DdIlpxAd.d.mts.map +0 -1
@@ -1,511 +1,508 @@
1
+ import { EnvironmentParser } from '@geekmidas/envkit';
2
+ import type { EventPublisher, PublishableMessage } from '@geekmidas/events';
1
3
  import type { Logger } from '@geekmidas/logger';
2
4
  import { type Service, ServiceDiscovery } from '@geekmidas/services';
3
5
  import { beforeEach, describe, expect, it, vi } from 'vitest';
4
6
  import { z } from 'zod/v4';
5
-
6
- import { EnvironmentParser } from '@geekmidas/envkit';
7
7
  import { e } from '../endpoints';
8
-
9
- import type { EventPublisher, PublishableMessage } from '@geekmidas/events';
10
8
  import { publishConstructEvents } from '../publisher';
11
9
 
12
10
  // Test event types
13
11
  type TestEvent =
14
- | PublishableMessage<'test.created', { id: string }>
15
- | PublishableMessage<'test.updated', { id: string; changes: string[] }>
16
- | PublishableMessage<'test.deleted', { id: string }>;
12
+ | PublishableMessage<'test.created', { id: string }>
13
+ | PublishableMessage<'test.updated', { id: string; changes: string[] }>
14
+ | PublishableMessage<'test.deleted', { id: string }>;
17
15
 
18
16
  describe('publisher service setting combinations', () => {
19
- const mockLogger: Logger = {
20
- debug: vi.fn(),
21
- info: vi.fn(),
22
- warn: vi.fn(),
23
- error: vi.fn(),
24
- fatal: vi.fn(),
25
- trace: vi.fn(),
26
- child: vi.fn(() => mockLogger),
27
- };
28
-
29
- const serviceDiscovery = ServiceDiscovery.getInstance(
30
- mockLogger,
31
- new EnvironmentParser({}),
32
- );
33
-
34
- // Create mock publishers
35
- const createMockPublisher = (_name: string): EventPublisher<TestEvent> => ({
36
- publish: vi.fn().mockResolvedValue(undefined),
37
- });
38
-
39
- const createMockPublisherService = (
40
- name: string,
41
- ): Service<string, EventPublisher<TestEvent>> => {
42
- const publisher = createMockPublisher(name);
43
- return {
44
- serviceName: `${name}-publisher-${Math.random()}`,
45
- register: vi.fn().mockResolvedValue(publisher),
46
- };
47
- };
48
-
49
- beforeEach(() => {
50
- vi.clearAllMocks();
51
- });
52
-
53
- describe('setting publisher via endpoint.publisher()', () => {
54
- it('should use publisher set directly on endpoint', async () => {
55
- const mockPublisher = createMockPublisher('endpoint');
56
- const mockPublisherService = createMockPublisherService('endpoint');
57
- mockPublisherService.register = vi.fn().mockResolvedValue(mockPublisher);
58
-
59
- const endpoint = e
60
- .logger(mockLogger)
61
- .post('/test')
62
- .publisher(mockPublisherService)
63
- .output(z.object({ id: z.string() }))
64
- .event({
65
- type: 'test.created',
66
- payload: (response) => ({ id: response.id }),
67
- })
68
- .handle(async () => ({ id: '123' }));
69
-
70
- await publishConstructEvents(
71
- endpoint,
72
- { id: '123' },
73
- serviceDiscovery as ServiceDiscovery<any, any>,
74
- );
75
-
76
- expect(mockPublisher.publish).toHaveBeenCalledWith([
77
- {
78
- type: 'test.created',
79
- payload: { id: '123' },
80
- },
81
- ]);
82
- });
83
- });
84
-
85
- describe('setting publisher via factory.publisher()', () => {
86
- it('should use publisher from factory when not overridden', async () => {
87
- const mockPublisher = createMockPublisher('factory');
88
- const mockPublisherService = createMockPublisherService('factory');
89
- mockPublisherService.register = vi.fn().mockResolvedValue(mockPublisher);
90
-
91
- // Create factory with publisher
92
- const factory = e.logger(mockLogger).publisher(mockPublisherService);
93
-
94
- // Create endpoint using factory
95
- const endpoint = factory
96
- .post('/test')
97
- .output(z.object({ id: z.string() }))
98
- .event({
99
- type: 'test.created',
100
- payload: (response) => ({ id: response.id }),
101
- })
102
- .handle(async () => ({ id: '123' }));
103
-
104
- // Verify the publisher service is set on the endpoint
105
- expect(endpoint.publisherService).toBeDefined();
106
- expect(endpoint.publisherService?.serviceName).toBe(
107
- mockPublisherService.serviceName,
108
- );
109
-
110
- await publishConstructEvents(
111
- endpoint,
112
- { id: '123' },
113
- serviceDiscovery as ServiceDiscovery<any, any>,
114
- );
115
-
116
- expect(mockPublisher.publish).toHaveBeenCalledWith([
117
- {
118
- type: 'test.created',
119
- payload: { id: '123' },
120
- },
121
- ]);
122
- });
123
-
124
- it('should work with factory that has logger and services', async () => {
125
- const mockPublisher = createMockPublisher('factory-with-services');
126
- const mockPublisherService = createMockPublisherService(
127
- 'factory-with-services',
128
- );
129
- mockPublisherService.register = vi.fn().mockResolvedValue(mockPublisher);
130
-
131
- // Create factory with logger, services, and publisher
132
- const factory = e
133
- .logger(mockLogger)
134
- .services([])
135
- .publisher(mockPublisherService);
136
-
137
- const endpoint = factory
138
- .post('/test')
139
- .output(z.object({ id: z.string() }))
140
- .event({
141
- type: 'test.created',
142
- payload: (response) => ({ id: response.id }),
143
- })
144
- .handle(async () => ({ id: '456' }));
145
-
146
- // Verify the publisher service is set
147
- expect(endpoint.publisherService).toBeDefined();
148
- expect(endpoint.publisherService?.serviceName).toBe(
149
- mockPublisherService.serviceName,
150
- );
151
-
152
- await publishConstructEvents(
153
- endpoint,
154
- { id: '456' },
155
- serviceDiscovery as ServiceDiscovery<any, any>,
156
- );
157
-
158
- expect(mockPublisher.publish).toHaveBeenCalledWith([
159
- {
160
- type: 'test.created',
161
- payload: { id: '456' },
162
- },
163
- ]);
164
- });
165
- });
166
-
167
- describe('overriding factory publisher at endpoint level', () => {
168
- it('should use endpoint publisher over factory publisher', async () => {
169
- const factoryPublisher = createMockPublisher('factory');
170
- const factoryPublisherService = createMockPublisherService('factory');
171
- factoryPublisherService.register = vi
172
- .fn()
173
- .mockResolvedValue(factoryPublisher);
174
-
175
- const endpointPublisher = createMockPublisher('endpoint-override');
176
- const endpointPublisherService =
177
- createMockPublisherService('endpoint-override');
178
- endpointPublisherService.register = vi
179
- .fn()
180
- .mockResolvedValue(endpointPublisher);
181
-
182
- // Create factory with publisher
183
- const factory = e.logger(mockLogger).publisher(factoryPublisherService);
184
-
185
- // Create endpoint that overrides factory publisher
186
- const endpoint = factory
187
- .post('/test')
188
- .publisher(endpointPublisherService) // Override factory publisher
189
- .output(z.object({ id: z.string() }))
190
- .event({
191
- type: 'test.updated',
192
- payload: (response) => ({ id: response.id, changes: ['name'] }),
193
- })
194
- .handle(async () => ({ id: '789' }));
195
-
196
- await publishConstructEvents(
197
- endpoint,
198
- { id: '789' },
199
- serviceDiscovery as ServiceDiscovery<any, any>,
200
- );
201
-
202
- // Factory publisher should NOT be called
203
- expect(factoryPublisher.publish).not.toHaveBeenCalled();
204
-
205
- // Endpoint publisher SHOULD be called
206
- expect(endpointPublisher.publish).toHaveBeenCalledWith([
207
- {
208
- type: 'test.updated',
209
- payload: { id: '789', changes: ['name'] },
210
- },
211
- ]);
212
- });
213
- });
214
-
215
- describe('publisher inheritance through endpoint builder chain', () => {
216
- it('should maintain publisher through builder method chain', async () => {
217
- const mockPublisher = createMockPublisher('chain');
218
- const mockPublisherService = createMockPublisherService('chain');
219
- mockPublisherService.register = vi.fn().mockResolvedValue(mockPublisher);
220
-
221
- const endpoint = e
222
- .logger(mockLogger)
223
- .post('/test')
224
- .publisher(mockPublisherService)
225
- .body(z.object({ name: z.string() }))
226
- .output(z.object({ id: z.string() }))
227
- .event({
228
- type: 'test.created',
229
- payload: (response) => ({ id: response.id }),
230
- })
231
- .handle(async (_body) => ({ id: '999' }));
232
-
233
- expect(endpoint.publisherService).toBeDefined();
234
-
235
- await publishConstructEvents(
236
- endpoint,
237
- { id: '999' },
238
- serviceDiscovery as ServiceDiscovery<any, any>,
239
- );
240
-
241
- expect(mockPublisher.publish).toHaveBeenCalledWith([
242
- {
243
- type: 'test.created',
244
- payload: { id: '999' },
245
- },
246
- ]);
247
- });
248
-
249
- it('should maintain factory publisher through builder chain', async () => {
250
- const mockPublisher = createMockPublisher('factory-chain');
251
- const mockPublisherService = createMockPublisherService('factory-chain');
252
- mockPublisherService.register = vi.fn().mockResolvedValue(mockPublisher);
253
-
254
- const factory = e.logger(mockLogger).publisher(mockPublisherService);
255
-
256
- const endpoint = factory
257
- .post('/test')
258
- .body(z.object({ name: z.string() }))
259
- .query(z.object({ filter: z.string().optional() }))
260
- .output(z.object({ id: z.string() }))
261
- .event({
262
- type: 'test.created',
263
- payload: (response) => ({ id: response.id }),
264
- })
265
- .handle(async () => ({ id: '111' }));
266
-
267
- expect(endpoint.publisherService).toBeDefined();
268
-
269
- await publishConstructEvents(
270
- endpoint,
271
- { id: '111' },
272
- serviceDiscovery as ServiceDiscovery<any, any>,
273
- );
274
-
275
- expect(mockPublisher.publish).toHaveBeenCalledWith([
276
- {
277
- type: 'test.created',
278
- payload: { id: '111' },
279
- },
280
- ]);
281
- });
282
- });
283
-
284
- describe('multiple endpoints with same/different publishers', () => {
285
- it('should handle multiple endpoints from same factory', async () => {
286
- const mockPublisher = createMockPublisher('shared-factory');
287
- const mockPublisherService = createMockPublisherService('shared-factory');
288
- mockPublisherService.register = vi.fn().mockResolvedValue(mockPublisher);
289
-
290
- const factory = e.logger(mockLogger).publisher(mockPublisherService);
291
-
292
- // Create multiple endpoints from same factory
293
- const endpoint1 = factory
294
- .post('/users')
295
- .output(z.object({ id: z.string() }))
296
- .event({
297
- type: 'test.created',
298
- payload: (response) => ({ id: response.id }),
299
- })
300
- .handle(async () => ({ id: 'user-1' }));
301
-
302
- const endpoint2 = factory
303
- .put('/users/:id')
304
- .output(z.object({ id: z.string() }))
305
- .event({
306
- type: 'test.updated',
307
- payload: (response) => ({ id: response.id, changes: ['status'] }),
308
- })
309
- .handle(async () => ({ id: 'user-2' }));
310
-
311
- // Both endpoints should have the same publisher service
312
- expect(endpoint1.publisherService?.serviceName).toBe(
313
- mockPublisherService.serviceName,
314
- );
315
- expect(endpoint2.publisherService?.serviceName).toBe(
316
- mockPublisherService.serviceName,
317
- );
318
-
319
- // Test both endpoints
320
- await publishConstructEvents(
321
- endpoint1,
322
- { id: 'user-1' },
323
- serviceDiscovery as ServiceDiscovery<any, any>,
324
- );
325
-
326
- await publishConstructEvents(
327
- endpoint2,
328
- { id: 'user-2' },
329
- serviceDiscovery as ServiceDiscovery<any, any>,
330
- );
331
-
332
- // Publisher should be called twice
333
- expect(mockPublisher.publish).toHaveBeenCalledTimes(2);
334
- expect(mockPublisher.publish).toHaveBeenNthCalledWith(1, [
335
- {
336
- type: 'test.created',
337
- payload: { id: 'user-1' },
338
- },
339
- ]);
340
- expect(mockPublisher.publish).toHaveBeenNthCalledWith(2, [
341
- {
342
- type: 'test.updated',
343
- payload: { id: 'user-2', changes: ['status'] },
344
- },
345
- ]);
346
- });
347
-
348
- it('should handle different publishers for different endpoints', async () => {
349
- const publisher1 = createMockPublisher('endpoint-1');
350
- const publisherService1 = createMockPublisherService('endpoint-1');
351
- publisherService1.register = vi.fn().mockResolvedValue(publisher1);
352
-
353
- const publisher2 = createMockPublisher('endpoint-2');
354
- const publisherService2 = createMockPublisherService('endpoint-2');
355
- publisherService2.register = vi.fn().mockResolvedValue(publisher2);
356
-
357
- const endpoint1 = e
358
- .logger(mockLogger)
359
- .post('/api/v1/resource')
360
- .publisher(publisherService1)
361
- .output(z.object({ id: z.string() }))
362
- .event({
363
- type: 'test.created',
364
- payload: (response) => ({ id: response.id }),
365
- })
366
- .handle(async () => ({ id: 'res-1' }));
367
-
368
- const endpoint2 = e
369
- .logger(mockLogger)
370
- .post('/api/v2/resource')
371
- .publisher(publisherService2)
372
- .output(z.object({ id: z.string() }))
373
- .event({
374
- type: 'test.created',
375
- payload: (response) => ({ id: response.id }),
376
- })
377
- .handle(async () => ({ id: 'res-2' }));
378
-
379
- // Test both endpoints
380
- await publishConstructEvents(
381
- endpoint1,
382
- { id: 'res-1' },
383
- serviceDiscovery as ServiceDiscovery<any, any>,
384
- );
385
-
386
- await publishConstructEvents(
387
- endpoint2,
388
- { id: 'res-2' },
389
- serviceDiscovery as ServiceDiscovery<any, any>,
390
- );
391
-
392
- // Each publisher should only be called once
393
- expect(publisher1.publish).toHaveBeenCalledTimes(1);
394
- expect(publisher1.publish).toHaveBeenCalledWith([
395
- {
396
- type: 'test.created',
397
- payload: { id: 'res-1' },
398
- },
399
- ]);
400
-
401
- expect(publisher2.publish).toHaveBeenCalledTimes(1);
402
- expect(publisher2.publish).toHaveBeenCalledWith([
403
- {
404
- type: 'test.created',
405
- payload: { id: 'res-2' },
406
- },
407
- ]);
408
- });
409
- });
410
-
411
- describe('edge cases and error scenarios', () => {
412
- it('should handle undefined publisher gracefully', async () => {
413
- const endpoint = e
414
- .logger(mockLogger)
415
- .post('/test')
416
- .output(z.object({ id: z.string() }))
417
-
418
- .event({
419
- // @ts-ignore
420
- type: 'test.created',
421
- // @ts-ignore
422
- payload: (response) => ({ id: response.id }),
423
- })
424
- .handle(async () => ({ id: '000' }));
425
-
426
- // Should not have publisher service
427
- expect(endpoint.publisherService).toBeUndefined();
428
-
429
- // Should not throw, but should warn
430
- await publishConstructEvents(
431
- endpoint,
432
- { id: '000' },
433
- serviceDiscovery as ServiceDiscovery<any, any>,
434
- );
435
-
436
- expect(mockLogger.warn).toHaveBeenCalledWith(
437
- 'No publisher service available',
438
- );
439
- });
440
-
441
- it('should handle publisher service registration failure', async () => {
442
- const registrationError = new Error('Service registration failed');
443
- const mockPublisherService = createMockPublisherService('failing');
444
- mockPublisherService.register = vi
445
- .fn()
446
- .mockRejectedValue(registrationError);
447
-
448
- const endpoint = e
449
- .logger(mockLogger)
450
- .post('/test')
451
- .publisher(mockPublisherService)
452
- .output(z.object({ id: z.string() }))
453
- .event({
454
- type: 'test.created',
455
- payload: (response) => ({ id: response.id }),
456
- })
457
- .handle(async () => ({ id: '404' }));
458
-
459
- // Should not throw but should log error
460
- await publishConstructEvents(
461
- endpoint,
462
- { id: '404' },
463
- serviceDiscovery as ServiceDiscovery<any, any>,
464
- );
465
-
466
- expect(mockLogger.error).toHaveBeenCalledWith(
467
- registrationError,
468
- 'Something went wrong publishing events',
469
- );
470
- });
471
- });
472
-
473
- describe('factory publisher with services', () => {
474
- it('should maintain publisher with services factory', async () => {
475
- const mockPublisher = createMockPublisher('services');
476
- const mockPublisherService = createMockPublisherService('services');
477
- mockPublisherService.register = vi.fn().mockResolvedValue(mockPublisher);
478
-
479
- // Test a typical factory setup with logger, services, and publisher
480
- const factory = e
481
- .logger(mockLogger)
482
- .services([])
483
- .publisher(mockPublisherService);
484
-
485
- const endpoint = factory
486
- .post('/api/v1/users')
487
- .output(z.object({ id: z.string() }))
488
- .event({
489
- type: 'test.created',
490
- payload: (response) => ({ id: response.id }),
491
- })
492
- .handle(async () => ({ id: 'services-123' }));
493
-
494
- expect(endpoint._path).toBe('/api/v1/users');
495
- expect(endpoint.publisherService).toBeDefined();
496
-
497
- await publishConstructEvents(
498
- endpoint,
499
- { id: 'services-123' },
500
- serviceDiscovery as ServiceDiscovery<any, any>,
501
- );
502
-
503
- expect(mockPublisher.publish).toHaveBeenCalledWith([
504
- {
505
- type: 'test.created',
506
- payload: { id: 'services-123' },
507
- },
508
- ]);
509
- });
510
- });
17
+ const mockLogger: Logger = {
18
+ debug: vi.fn(),
19
+ info: vi.fn(),
20
+ warn: vi.fn(),
21
+ error: vi.fn(),
22
+ fatal: vi.fn(),
23
+ trace: vi.fn(),
24
+ child: vi.fn(() => mockLogger),
25
+ };
26
+
27
+ const serviceDiscovery = ServiceDiscovery.getInstance(
28
+ new EnvironmentParser({}),
29
+ );
30
+
31
+ // Create mock publishers
32
+ const createMockPublisher = (_name: string): EventPublisher<TestEvent> => ({
33
+ publish: vi.fn().mockResolvedValue(undefined),
34
+ });
35
+
36
+ const createMockPublisherService = (
37
+ name: string,
38
+ ): Service<string, EventPublisher<TestEvent>> => {
39
+ const publisher = createMockPublisher(name);
40
+ return {
41
+ serviceName: `${name}-publisher-${Math.random()}`,
42
+ register: vi.fn().mockResolvedValue(publisher),
43
+ };
44
+ };
45
+
46
+ beforeEach(() => {
47
+ vi.clearAllMocks();
48
+ });
49
+
50
+ describe('setting publisher via endpoint.publisher()', () => {
51
+ it('should use publisher set directly on endpoint', async () => {
52
+ const mockPublisher = createMockPublisher('endpoint');
53
+ const mockPublisherService = createMockPublisherService('endpoint');
54
+ mockPublisherService.register = vi.fn().mockResolvedValue(mockPublisher);
55
+
56
+ const endpoint = e
57
+ .logger(mockLogger)
58
+ .post('/test')
59
+ .publisher(mockPublisherService)
60
+ .output(z.object({ id: z.string() }))
61
+ .event({
62
+ type: 'test.created',
63
+ payload: (response) => ({ id: response.id }),
64
+ })
65
+ .handle(async () => ({ id: '123' }));
66
+
67
+ await publishConstructEvents(
68
+ endpoint,
69
+ { id: '123' },
70
+ serviceDiscovery as ServiceDiscovery<any, any>,
71
+ );
72
+
73
+ expect(mockPublisher.publish).toHaveBeenCalledWith([
74
+ {
75
+ type: 'test.created',
76
+ payload: { id: '123' },
77
+ },
78
+ ]);
79
+ });
80
+ });
81
+
82
+ describe('setting publisher via factory.publisher()', () => {
83
+ it('should use publisher from factory when not overridden', async () => {
84
+ const mockPublisher = createMockPublisher('factory');
85
+ const mockPublisherService = createMockPublisherService('factory');
86
+ mockPublisherService.register = vi.fn().mockResolvedValue(mockPublisher);
87
+
88
+ // Create factory with publisher
89
+ const factory = e.logger(mockLogger).publisher(mockPublisherService);
90
+
91
+ // Create endpoint using factory
92
+ const endpoint = factory
93
+ .post('/test')
94
+ .output(z.object({ id: z.string() }))
95
+ .event({
96
+ type: 'test.created',
97
+ payload: (response) => ({ id: response.id }),
98
+ })
99
+ .handle(async () => ({ id: '123' }));
100
+
101
+ // Verify the publisher service is set on the endpoint
102
+ expect(endpoint.publisherService).toBeDefined();
103
+ expect(endpoint.publisherService?.serviceName).toBe(
104
+ mockPublisherService.serviceName,
105
+ );
106
+
107
+ await publishConstructEvents(
108
+ endpoint,
109
+ { id: '123' },
110
+ serviceDiscovery as ServiceDiscovery<any, any>,
111
+ );
112
+
113
+ expect(mockPublisher.publish).toHaveBeenCalledWith([
114
+ {
115
+ type: 'test.created',
116
+ payload: { id: '123' },
117
+ },
118
+ ]);
119
+ });
120
+
121
+ it('should work with factory that has logger and services', async () => {
122
+ const mockPublisher = createMockPublisher('factory-with-services');
123
+ const mockPublisherService = createMockPublisherService(
124
+ 'factory-with-services',
125
+ );
126
+ mockPublisherService.register = vi.fn().mockResolvedValue(mockPublisher);
127
+
128
+ // Create factory with logger, services, and publisher
129
+ const factory = e
130
+ .logger(mockLogger)
131
+ .services([])
132
+ .publisher(mockPublisherService);
133
+
134
+ const endpoint = factory
135
+ .post('/test')
136
+ .output(z.object({ id: z.string() }))
137
+ .event({
138
+ type: 'test.created',
139
+ payload: (response) => ({ id: response.id }),
140
+ })
141
+ .handle(async () => ({ id: '456' }));
142
+
143
+ // Verify the publisher service is set
144
+ expect(endpoint.publisherService).toBeDefined();
145
+ expect(endpoint.publisherService?.serviceName).toBe(
146
+ mockPublisherService.serviceName,
147
+ );
148
+
149
+ await publishConstructEvents(
150
+ endpoint,
151
+ { id: '456' },
152
+ serviceDiscovery as ServiceDiscovery<any, any>,
153
+ );
154
+
155
+ expect(mockPublisher.publish).toHaveBeenCalledWith([
156
+ {
157
+ type: 'test.created',
158
+ payload: { id: '456' },
159
+ },
160
+ ]);
161
+ });
162
+ });
163
+
164
+ describe('overriding factory publisher at endpoint level', () => {
165
+ it('should use endpoint publisher over factory publisher', async () => {
166
+ const factoryPublisher = createMockPublisher('factory');
167
+ const factoryPublisherService = createMockPublisherService('factory');
168
+ factoryPublisherService.register = vi
169
+ .fn()
170
+ .mockResolvedValue(factoryPublisher);
171
+
172
+ const endpointPublisher = createMockPublisher('endpoint-override');
173
+ const endpointPublisherService =
174
+ createMockPublisherService('endpoint-override');
175
+ endpointPublisherService.register = vi
176
+ .fn()
177
+ .mockResolvedValue(endpointPublisher);
178
+
179
+ // Create factory with publisher
180
+ const factory = e.logger(mockLogger).publisher(factoryPublisherService);
181
+
182
+ // Create endpoint that overrides factory publisher
183
+ const endpoint = factory
184
+ .post('/test')
185
+ .publisher(endpointPublisherService) // Override factory publisher
186
+ .output(z.object({ id: z.string() }))
187
+ .event({
188
+ type: 'test.updated',
189
+ payload: (response) => ({ id: response.id, changes: ['name'] }),
190
+ })
191
+ .handle(async () => ({ id: '789' }));
192
+
193
+ await publishConstructEvents(
194
+ endpoint,
195
+ { id: '789' },
196
+ serviceDiscovery as ServiceDiscovery<any, any>,
197
+ );
198
+
199
+ // Factory publisher should NOT be called
200
+ expect(factoryPublisher.publish).not.toHaveBeenCalled();
201
+
202
+ // Endpoint publisher SHOULD be called
203
+ expect(endpointPublisher.publish).toHaveBeenCalledWith([
204
+ {
205
+ type: 'test.updated',
206
+ payload: { id: '789', changes: ['name'] },
207
+ },
208
+ ]);
209
+ });
210
+ });
211
+
212
+ describe('publisher inheritance through endpoint builder chain', () => {
213
+ it('should maintain publisher through builder method chain', async () => {
214
+ const mockPublisher = createMockPublisher('chain');
215
+ const mockPublisherService = createMockPublisherService('chain');
216
+ mockPublisherService.register = vi.fn().mockResolvedValue(mockPublisher);
217
+
218
+ const endpoint = e
219
+ .logger(mockLogger)
220
+ .post('/test')
221
+ .publisher(mockPublisherService)
222
+ .body(z.object({ name: z.string() }))
223
+ .output(z.object({ id: z.string() }))
224
+ .event({
225
+ type: 'test.created',
226
+ payload: (response) => ({ id: response.id }),
227
+ })
228
+ .handle(async (_body) => ({ id: '999' }));
229
+
230
+ expect(endpoint.publisherService).toBeDefined();
231
+
232
+ await publishConstructEvents(
233
+ endpoint,
234
+ { id: '999' },
235
+ serviceDiscovery as ServiceDiscovery<any, any>,
236
+ );
237
+
238
+ expect(mockPublisher.publish).toHaveBeenCalledWith([
239
+ {
240
+ type: 'test.created',
241
+ payload: { id: '999' },
242
+ },
243
+ ]);
244
+ });
245
+
246
+ it('should maintain factory publisher through builder chain', async () => {
247
+ const mockPublisher = createMockPublisher('factory-chain');
248
+ const mockPublisherService = createMockPublisherService('factory-chain');
249
+ mockPublisherService.register = vi.fn().mockResolvedValue(mockPublisher);
250
+
251
+ const factory = e.logger(mockLogger).publisher(mockPublisherService);
252
+
253
+ const endpoint = factory
254
+ .post('/test')
255
+ .body(z.object({ name: z.string() }))
256
+ .query(z.object({ filter: z.string().optional() }))
257
+ .output(z.object({ id: z.string() }))
258
+ .event({
259
+ type: 'test.created',
260
+ payload: (response) => ({ id: response.id }),
261
+ })
262
+ .handle(async () => ({ id: '111' }));
263
+
264
+ expect(endpoint.publisherService).toBeDefined();
265
+
266
+ await publishConstructEvents(
267
+ endpoint,
268
+ { id: '111' },
269
+ serviceDiscovery as ServiceDiscovery<any, any>,
270
+ );
271
+
272
+ expect(mockPublisher.publish).toHaveBeenCalledWith([
273
+ {
274
+ type: 'test.created',
275
+ payload: { id: '111' },
276
+ },
277
+ ]);
278
+ });
279
+ });
280
+
281
+ describe('multiple endpoints with same/different publishers', () => {
282
+ it('should handle multiple endpoints from same factory', async () => {
283
+ const mockPublisher = createMockPublisher('shared-factory');
284
+ const mockPublisherService = createMockPublisherService('shared-factory');
285
+ mockPublisherService.register = vi.fn().mockResolvedValue(mockPublisher);
286
+
287
+ const factory = e.logger(mockLogger).publisher(mockPublisherService);
288
+
289
+ // Create multiple endpoints from same factory
290
+ const endpoint1 = factory
291
+ .post('/users')
292
+ .output(z.object({ id: z.string() }))
293
+ .event({
294
+ type: 'test.created',
295
+ payload: (response) => ({ id: response.id }),
296
+ })
297
+ .handle(async () => ({ id: 'user-1' }));
298
+
299
+ const endpoint2 = factory
300
+ .put('/users/:id')
301
+ .output(z.object({ id: z.string() }))
302
+ .event({
303
+ type: 'test.updated',
304
+ payload: (response) => ({ id: response.id, changes: ['status'] }),
305
+ })
306
+ .handle(async () => ({ id: 'user-2' }));
307
+
308
+ // Both endpoints should have the same publisher service
309
+ expect(endpoint1.publisherService?.serviceName).toBe(
310
+ mockPublisherService.serviceName,
311
+ );
312
+ expect(endpoint2.publisherService?.serviceName).toBe(
313
+ mockPublisherService.serviceName,
314
+ );
315
+
316
+ // Test both endpoints
317
+ await publishConstructEvents(
318
+ endpoint1,
319
+ { id: 'user-1' },
320
+ serviceDiscovery as ServiceDiscovery<any, any>,
321
+ );
322
+
323
+ await publishConstructEvents(
324
+ endpoint2,
325
+ { id: 'user-2' },
326
+ serviceDiscovery as ServiceDiscovery<any, any>,
327
+ );
328
+
329
+ // Publisher should be called twice
330
+ expect(mockPublisher.publish).toHaveBeenCalledTimes(2);
331
+ expect(mockPublisher.publish).toHaveBeenNthCalledWith(1, [
332
+ {
333
+ type: 'test.created',
334
+ payload: { id: 'user-1' },
335
+ },
336
+ ]);
337
+ expect(mockPublisher.publish).toHaveBeenNthCalledWith(2, [
338
+ {
339
+ type: 'test.updated',
340
+ payload: { id: 'user-2', changes: ['status'] },
341
+ },
342
+ ]);
343
+ });
344
+
345
+ it('should handle different publishers for different endpoints', async () => {
346
+ const publisher1 = createMockPublisher('endpoint-1');
347
+ const publisherService1 = createMockPublisherService('endpoint-1');
348
+ publisherService1.register = vi.fn().mockResolvedValue(publisher1);
349
+
350
+ const publisher2 = createMockPublisher('endpoint-2');
351
+ const publisherService2 = createMockPublisherService('endpoint-2');
352
+ publisherService2.register = vi.fn().mockResolvedValue(publisher2);
353
+
354
+ const endpoint1 = e
355
+ .logger(mockLogger)
356
+ .post('/api/v1/resource')
357
+ .publisher(publisherService1)
358
+ .output(z.object({ id: z.string() }))
359
+ .event({
360
+ type: 'test.created',
361
+ payload: (response) => ({ id: response.id }),
362
+ })
363
+ .handle(async () => ({ id: 'res-1' }));
364
+
365
+ const endpoint2 = e
366
+ .logger(mockLogger)
367
+ .post('/api/v2/resource')
368
+ .publisher(publisherService2)
369
+ .output(z.object({ id: z.string() }))
370
+ .event({
371
+ type: 'test.created',
372
+ payload: (response) => ({ id: response.id }),
373
+ })
374
+ .handle(async () => ({ id: 'res-2' }));
375
+
376
+ // Test both endpoints
377
+ await publishConstructEvents(
378
+ endpoint1,
379
+ { id: 'res-1' },
380
+ serviceDiscovery as ServiceDiscovery<any, any>,
381
+ );
382
+
383
+ await publishConstructEvents(
384
+ endpoint2,
385
+ { id: 'res-2' },
386
+ serviceDiscovery as ServiceDiscovery<any, any>,
387
+ );
388
+
389
+ // Each publisher should only be called once
390
+ expect(publisher1.publish).toHaveBeenCalledTimes(1);
391
+ expect(publisher1.publish).toHaveBeenCalledWith([
392
+ {
393
+ type: 'test.created',
394
+ payload: { id: 'res-1' },
395
+ },
396
+ ]);
397
+
398
+ expect(publisher2.publish).toHaveBeenCalledTimes(1);
399
+ expect(publisher2.publish).toHaveBeenCalledWith([
400
+ {
401
+ type: 'test.created',
402
+ payload: { id: 'res-2' },
403
+ },
404
+ ]);
405
+ });
406
+ });
407
+
408
+ describe('edge cases and error scenarios', () => {
409
+ it('should handle undefined publisher gracefully', async () => {
410
+ const endpoint = e
411
+ .logger(mockLogger)
412
+ .post('/test')
413
+ .output(z.object({ id: z.string() }))
414
+
415
+ .event({
416
+ // @ts-expect-error
417
+ type: 'test.created',
418
+ // @ts-expect-error
419
+ payload: (response) => ({ id: response.id }),
420
+ })
421
+ .handle(async () => ({ id: '000' }));
422
+
423
+ // Should not have publisher service
424
+ expect(endpoint.publisherService).toBeUndefined();
425
+
426
+ // Should not throw, but should warn
427
+ await publishConstructEvents(
428
+ endpoint,
429
+ { id: '000' },
430
+ serviceDiscovery as ServiceDiscovery<any, any>,
431
+ );
432
+
433
+ expect(mockLogger.warn).toHaveBeenCalledWith(
434
+ 'No publisher service available',
435
+ );
436
+ });
437
+
438
+ it('should handle publisher service registration failure', async () => {
439
+ const registrationError = new Error('Service registration failed');
440
+ const mockPublisherService = createMockPublisherService('failing');
441
+ mockPublisherService.register = vi
442
+ .fn()
443
+ .mockRejectedValue(registrationError);
444
+
445
+ const endpoint = e
446
+ .logger(mockLogger)
447
+ .post('/test')
448
+ .publisher(mockPublisherService)
449
+ .output(z.object({ id: z.string() }))
450
+ .event({
451
+ type: 'test.created',
452
+ payload: (response) => ({ id: response.id }),
453
+ })
454
+ .handle(async () => ({ id: '404' }));
455
+
456
+ // Should not throw but should log error
457
+ await publishConstructEvents(
458
+ endpoint,
459
+ { id: '404' },
460
+ serviceDiscovery as ServiceDiscovery<any, any>,
461
+ );
462
+
463
+ expect(mockLogger.error).toHaveBeenCalledWith(
464
+ registrationError,
465
+ 'Something went wrong publishing events',
466
+ );
467
+ });
468
+ });
469
+
470
+ describe('factory publisher with services', () => {
471
+ it('should maintain publisher with services factory', async () => {
472
+ const mockPublisher = createMockPublisher('services');
473
+ const mockPublisherService = createMockPublisherService('services');
474
+ mockPublisherService.register = vi.fn().mockResolvedValue(mockPublisher);
475
+
476
+ // Test a typical factory setup with logger, services, and publisher
477
+ const factory = e
478
+ .logger(mockLogger)
479
+ .services([])
480
+ .publisher(mockPublisherService);
481
+
482
+ const endpoint = factory
483
+ .post('/api/v1/users')
484
+ .output(z.object({ id: z.string() }))
485
+ .event({
486
+ type: 'test.created',
487
+ payload: (response) => ({ id: response.id }),
488
+ })
489
+ .handle(async () => ({ id: 'services-123' }));
490
+
491
+ expect(endpoint._path).toBe('/api/v1/users');
492
+ expect(endpoint.publisherService).toBeDefined();
493
+
494
+ await publishConstructEvents(
495
+ endpoint,
496
+ { id: 'services-123' },
497
+ serviceDiscovery as ServiceDiscovery<any, any>,
498
+ );
499
+
500
+ expect(mockPublisher.publish).toHaveBeenCalledWith([
501
+ {
502
+ type: 'test.created',
503
+ payload: { id: 'services-123' },
504
+ },
505
+ ]);
506
+ });
507
+ });
511
508
  });