@geekmidas/constructs 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (329) hide show
  1. package/README.md +614 -0
  2. package/dist/AWSLambdaFunction-CpHFE2m6.d.mts +27 -0
  3. package/dist/AWSLambdaFunction-CwagvPG3.d.cts +27 -0
  4. package/dist/AWSLambdaFunction-DWIZYsCy.mjs +79 -0
  5. package/dist/AWSLambdaFunction-DWIZYsCy.mjs.map +1 -0
  6. package/dist/AWSLambdaFunction-qA5LqPsv.cjs +85 -0
  7. package/dist/AWSLambdaFunction-qA5LqPsv.cjs.map +1 -0
  8. package/dist/AWSLambdaSubscriberAdaptor-C1wQuucQ.d.mts +32 -0
  9. package/dist/AWSLambdaSubscriberAdaptor-CmPZ10JF.cjs +138 -0
  10. package/dist/AWSLambdaSubscriberAdaptor-CmPZ10JF.cjs.map +1 -0
  11. package/dist/AWSLambdaSubscriberAdaptor-G8y3YkWj.mjs +132 -0
  12. package/dist/AWSLambdaSubscriberAdaptor-G8y3YkWj.mjs.map +1 -0
  13. package/dist/AWSLambdaSubscriberAdaptor-QKVxR6qh.d.cts +32 -0
  14. package/dist/AmazonApiGatewayEndpointAdaptor-BoBh7vvD.d.mts +61 -0
  15. package/dist/AmazonApiGatewayEndpointAdaptor-Cx1oqcqh.mjs +124 -0
  16. package/dist/AmazonApiGatewayEndpointAdaptor-Cx1oqcqh.mjs.map +1 -0
  17. package/dist/AmazonApiGatewayEndpointAdaptor-DtzgQ9Vb.d.cts +61 -0
  18. package/dist/AmazonApiGatewayEndpointAdaptor-i74DEUbc.cjs +130 -0
  19. package/dist/AmazonApiGatewayEndpointAdaptor-i74DEUbc.cjs.map +1 -0
  20. package/dist/AmazonApiGatewayV1EndpointAdaptor-CLmBDYsl.mjs +42 -0
  21. package/dist/AmazonApiGatewayV1EndpointAdaptor-CLmBDYsl.mjs.map +1 -0
  22. package/dist/AmazonApiGatewayV1EndpointAdaptor-EhMd1YqV.d.mts +21 -0
  23. package/dist/AmazonApiGatewayV1EndpointAdaptor-GkMAUPL5.cjs +47 -0
  24. package/dist/AmazonApiGatewayV1EndpointAdaptor-GkMAUPL5.cjs.map +1 -0
  25. package/dist/AmazonApiGatewayV1EndpointAdaptor-Gw-j61qM.d.cts +21 -0
  26. package/dist/AmazonApiGatewayV2EndpointAdaptor-3RqegmJC.mjs +41 -0
  27. package/dist/AmazonApiGatewayV2EndpointAdaptor-3RqegmJC.mjs.map +1 -0
  28. package/dist/AmazonApiGatewayV2EndpointAdaptor-LUlpwmUW.d.cts +21 -0
  29. package/dist/AmazonApiGatewayV2EndpointAdaptor-YlFoFSS9.cjs +46 -0
  30. package/dist/AmazonApiGatewayV2EndpointAdaptor-YlFoFSS9.cjs.map +1 -0
  31. package/dist/AmazonApiGatewayV2EndpointAdaptor-zfd1gqXA.d.mts +21 -0
  32. package/dist/BaseFunctionBuilder-5QCHkchp.d.cts +31 -0
  33. package/dist/BaseFunctionBuilder-BFPVGnKi.d.mts +31 -0
  34. package/dist/BaseFunctionBuilder-BPE9JBbT.mjs +56 -0
  35. package/dist/BaseFunctionBuilder-BPE9JBbT.mjs.map +1 -0
  36. package/dist/BaseFunctionBuilder-DtO4Nwxm.cjs +62 -0
  37. package/dist/BaseFunctionBuilder-DtO4Nwxm.cjs.map +1 -0
  38. package/dist/Construct-BSEs6uwW.cjs +75 -0
  39. package/dist/Construct-BSEs6uwW.cjs.map +1 -0
  40. package/dist/Construct-BbKCIPQm.mjs +63 -0
  41. package/dist/Construct-BbKCIPQm.mjs.map +1 -0
  42. package/dist/Construct-Bm-PSO2V.d.cts +42 -0
  43. package/dist/Construct-DIguIyw4.d.mts +42 -0
  44. package/dist/Construct.cjs +4 -0
  45. package/dist/Construct.d.cts +2 -0
  46. package/dist/Construct.d.mts +2 -0
  47. package/dist/Construct.mjs +3 -0
  48. package/dist/Cron-Bgs6EQOb.mjs +20 -0
  49. package/dist/Cron-Bgs6EQOb.mjs.map +1 -0
  50. package/dist/Cron-DQiCj3ef.cjs +25 -0
  51. package/dist/Cron-DQiCj3ef.cjs.map +1 -0
  52. package/dist/Cron-FpAw03k6.d.mts +25 -0
  53. package/dist/Cron-ztnK6zgU.d.cts +25 -0
  54. package/dist/CronBuilder-B2clNQSP.d.mts +24 -0
  55. package/dist/CronBuilder-Cje9K8lZ.d.cts +24 -0
  56. package/dist/CronBuilder-DIBqJkh_.cjs +60 -0
  57. package/dist/CronBuilder-DIBqJkh_.cjs.map +1 -0
  58. package/dist/CronBuilder-DecAvvcn.mjs +54 -0
  59. package/dist/CronBuilder-DecAvvcn.mjs.map +1 -0
  60. package/dist/Endpoint-BaHC9y4Z.cjs +291 -0
  61. package/dist/Endpoint-BaHC9y4Z.cjs.map +1 -0
  62. package/dist/Endpoint-C7z9YJHK.d.cts +405 -0
  63. package/dist/Endpoint-DCn53Vd8.d.mts +405 -0
  64. package/dist/Endpoint-ierdM62O.mjs +279 -0
  65. package/dist/Endpoint-ierdM62O.mjs.map +1 -0
  66. package/dist/EndpointBuilder-BHFSpbPR.cjs +107 -0
  67. package/dist/EndpointBuilder-BHFSpbPR.cjs.map +1 -0
  68. package/dist/EndpointBuilder-BLUsoK3l.mjs +101 -0
  69. package/dist/EndpointBuilder-BLUsoK3l.mjs.map +1 -0
  70. package/dist/EndpointBuilder-Bfnb2oJr.d.mts +49 -0
  71. package/dist/EndpointBuilder-CP9RGwZH.d.cts +49 -0
  72. package/dist/EndpointFactory-BYdDVCNj.mjs +127 -0
  73. package/dist/EndpointFactory-BYdDVCNj.mjs.map +1 -0
  74. package/dist/EndpointFactory-CNtMXgIh.d.mts +52 -0
  75. package/dist/EndpointFactory-CXX4E6Gx.cjs +139 -0
  76. package/dist/EndpointFactory-CXX4E6Gx.cjs.map +1 -0
  77. package/dist/EndpointFactory-D2zgWbXZ.d.cts +52 -0
  78. package/dist/Function-BP58p9Mp.d.cts +59 -0
  79. package/dist/Function-BsBxc2wA.d.mts +59 -0
  80. package/dist/Function-C5mW-38v.mjs +72 -0
  81. package/dist/Function-C5mW-38v.mjs.map +1 -0
  82. package/dist/Function-CbO2NZx-.cjs +84 -0
  83. package/dist/Function-CbO2NZx-.cjs.map +1 -0
  84. package/dist/FunctionBuilder-BS1KgxA_.d.cts +24 -0
  85. package/dist/FunctionBuilder-C-PfPN3r.d.mts +24 -0
  86. package/dist/FunctionBuilder-CosgPmMl.mjs +53 -0
  87. package/dist/FunctionBuilder-CosgPmMl.mjs.map +1 -0
  88. package/dist/FunctionBuilder-DuOeWCAl.cjs +59 -0
  89. package/dist/FunctionBuilder-DuOeWCAl.cjs.map +1 -0
  90. package/dist/FunctionExecutionWrapper-Bx-Dl-2a.d.cts +24 -0
  91. package/dist/FunctionExecutionWrapper-CElXEjPe.cjs +42 -0
  92. package/dist/FunctionExecutionWrapper-CElXEjPe.cjs.map +1 -0
  93. package/dist/FunctionExecutionWrapper-DvglBBjE.d.mts +24 -0
  94. package/dist/FunctionExecutionWrapper-XGrSAAPD.mjs +36 -0
  95. package/dist/FunctionExecutionWrapper-XGrSAAPD.mjs.map +1 -0
  96. package/dist/HonoEndpointAdaptor-B0IO1zj2.d.mts +41 -0
  97. package/dist/HonoEndpointAdaptor-B4snrp7v.cjs +154 -0
  98. package/dist/HonoEndpointAdaptor-B4snrp7v.cjs.map +1 -0
  99. package/dist/HonoEndpointAdaptor-B6lW9Q1k.d.cts +41 -0
  100. package/dist/HonoEndpointAdaptor-D-M4-6Tf.mjs +148 -0
  101. package/dist/HonoEndpointAdaptor-D-M4-6Tf.mjs.map +1 -0
  102. package/dist/Subscriber-BoFm12i_.d.cts +33 -0
  103. package/dist/Subscriber-BwuCaC9G.mjs +28 -0
  104. package/dist/Subscriber-BwuCaC9G.mjs.map +1 -0
  105. package/dist/Subscriber-THGsj7Iy.d.mts +33 -0
  106. package/dist/Subscriber-iMRFG7ba.cjs +34 -0
  107. package/dist/Subscriber-iMRFG7ba.cjs.map +1 -0
  108. package/dist/SubscriberBuilder-CiPxgnKT.d.mts +26 -0
  109. package/dist/SubscriberBuilder-Dhz0C_t-.mjs +54 -0
  110. package/dist/SubscriberBuilder-Dhz0C_t-.mjs.map +1 -0
  111. package/dist/SubscriberBuilder-DuIgxuzc.d.cts +26 -0
  112. package/dist/SubscriberBuilder-wthr-FL9.cjs +60 -0
  113. package/dist/SubscriberBuilder-wthr-FL9.cjs.map +1 -0
  114. package/dist/adaptors/aws.cjs +19 -0
  115. package/dist/adaptors/aws.d.cts +15 -0
  116. package/dist/adaptors/aws.d.mts +15 -0
  117. package/dist/adaptors/aws.mjs +16 -0
  118. package/dist/adaptors/hono.cjs +12 -0
  119. package/dist/adaptors/hono.d.cts +9 -0
  120. package/dist/adaptors/hono.d.mts +9 -0
  121. package/dist/adaptors/hono.mjs +12 -0
  122. package/dist/chunk-CUT6urMc.cjs +30 -0
  123. package/dist/crons/Cron.cjs +8 -0
  124. package/dist/crons/Cron.d.cts +7 -0
  125. package/dist/crons/Cron.d.mts +7 -0
  126. package/dist/crons/Cron.mjs +8 -0
  127. package/dist/crons/CronBuilder.cjs +9 -0
  128. package/dist/crons/CronBuilder.d.cts +8 -0
  129. package/dist/crons/CronBuilder.d.mts +8 -0
  130. package/dist/crons/CronBuilder.mjs +9 -0
  131. package/dist/crons/index.cjs +16 -0
  132. package/dist/crons/index.cjs.map +1 -0
  133. package/dist/crons/index.d.cts +16 -0
  134. package/dist/crons/index.d.mts +16 -0
  135. package/dist/crons/index.mjs +14 -0
  136. package/dist/crons/index.mjs.map +1 -0
  137. package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.cjs +10 -0
  138. package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.d.cts +9 -0
  139. package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.d.mts +9 -0
  140. package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.mjs +10 -0
  141. package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.cjs +12 -0
  142. package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.d.cts +10 -0
  143. package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.d.mts +10 -0
  144. package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.mjs +12 -0
  145. package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.cjs +12 -0
  146. package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.d.cts +10 -0
  147. package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.d.mts +10 -0
  148. package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.mjs +12 -0
  149. package/dist/endpoints/Endpoint.cjs +9 -0
  150. package/dist/endpoints/Endpoint.d.cts +8 -0
  151. package/dist/endpoints/Endpoint.d.mts +8 -0
  152. package/dist/endpoints/Endpoint.mjs +8 -0
  153. package/dist/endpoints/EndpointBuilder.cjs +9 -0
  154. package/dist/endpoints/EndpointBuilder.d.cts +9 -0
  155. package/dist/endpoints/EndpointBuilder.d.mts +9 -0
  156. package/dist/endpoints/EndpointBuilder.mjs +9 -0
  157. package/dist/endpoints/EndpointFactory.cjs +11 -0
  158. package/dist/endpoints/EndpointFactory.d.cts +10 -0
  159. package/dist/endpoints/EndpointFactory.d.mts +10 -0
  160. package/dist/endpoints/EndpointFactory.mjs +10 -0
  161. package/dist/endpoints/HonoEndpointAdaptor.cjs +12 -0
  162. package/dist/endpoints/HonoEndpointAdaptor.d.cts +9 -0
  163. package/dist/endpoints/HonoEndpointAdaptor.d.mts +9 -0
  164. package/dist/endpoints/HonoEndpointAdaptor.mjs +12 -0
  165. package/dist/endpoints/TestEndpointAdaptor.cjs +54 -0
  166. package/dist/endpoints/TestEndpointAdaptor.cjs.map +1 -0
  167. package/dist/endpoints/TestEndpointAdaptor.d.cts +29 -0
  168. package/dist/endpoints/TestEndpointAdaptor.d.mts +29 -0
  169. package/dist/endpoints/TestEndpointAdaptor.mjs +53 -0
  170. package/dist/endpoints/TestEndpointAdaptor.mjs.map +1 -0
  171. package/dist/endpoints/helpers.cjs +10 -0
  172. package/dist/endpoints/helpers.d.cts +58 -0
  173. package/dist/endpoints/helpers.d.mts +58 -0
  174. package/dist/endpoints/helpers.mjs +9 -0
  175. package/dist/endpoints/index.cjs +16 -0
  176. package/dist/endpoints/index.cjs.map +1 -0
  177. package/dist/endpoints/index.d.cts +16 -0
  178. package/dist/endpoints/index.d.mts +16 -0
  179. package/dist/endpoints/index.mjs +15 -0
  180. package/dist/endpoints/index.mjs.map +1 -0
  181. package/dist/endpoints/parseHonoQuery.cjs +3 -0
  182. package/dist/endpoints/parseHonoQuery.d.cts +12 -0
  183. package/dist/endpoints/parseHonoQuery.d.mts +12 -0
  184. package/dist/endpoints/parseHonoQuery.mjs +3 -0
  185. package/dist/endpoints/parseQueryParams.cjs +3 -0
  186. package/dist/endpoints/parseQueryParams.d.cts +13 -0
  187. package/dist/endpoints/parseQueryParams.d.mts +13 -0
  188. package/dist/endpoints/parseQueryParams.mjs +3 -0
  189. package/dist/functions/AWSLambdaFunction.cjs +9 -0
  190. package/dist/functions/AWSLambdaFunction.d.cts +5 -0
  191. package/dist/functions/AWSLambdaFunction.d.mts +5 -0
  192. package/dist/functions/AWSLambdaFunction.mjs +9 -0
  193. package/dist/functions/BaseFunctionBuilder.cjs +4 -0
  194. package/dist/functions/BaseFunctionBuilder.d.cts +3 -0
  195. package/dist/functions/BaseFunctionBuilder.d.mts +3 -0
  196. package/dist/functions/BaseFunctionBuilder.mjs +4 -0
  197. package/dist/functions/Function.cjs +5 -0
  198. package/dist/functions/Function.d.cts +3 -0
  199. package/dist/functions/Function.d.mts +3 -0
  200. package/dist/functions/Function.mjs +4 -0
  201. package/dist/functions/FunctionBuilder.cjs +6 -0
  202. package/dist/functions/FunctionBuilder.d.cts +5 -0
  203. package/dist/functions/FunctionBuilder.d.mts +5 -0
  204. package/dist/functions/FunctionBuilder.mjs +6 -0
  205. package/dist/functions/FunctionExecutionWrapper.cjs +8 -0
  206. package/dist/functions/FunctionExecutionWrapper.d.cts +4 -0
  207. package/dist/functions/FunctionExecutionWrapper.d.mts +4 -0
  208. package/dist/functions/FunctionExecutionWrapper.mjs +8 -0
  209. package/dist/functions/TestFunctionAdaptor.cjs +38 -0
  210. package/dist/functions/TestFunctionAdaptor.cjs.map +1 -0
  211. package/dist/functions/TestFunctionAdaptor.d.cts +26 -0
  212. package/dist/functions/TestFunctionAdaptor.d.mts +26 -0
  213. package/dist/functions/TestFunctionAdaptor.mjs +37 -0
  214. package/dist/functions/TestFunctionAdaptor.mjs.map +1 -0
  215. package/dist/functions/index.cjs +10 -0
  216. package/dist/functions/index.d.cts +6 -0
  217. package/dist/functions/index.d.mts +6 -0
  218. package/dist/functions/index.mjs +7 -0
  219. package/dist/functions-DVDb5wEA.cjs +13 -0
  220. package/dist/functions-DVDb5wEA.cjs.map +1 -0
  221. package/dist/functions-mM-jcphA.mjs +8 -0
  222. package/dist/functions-mM-jcphA.mjs.map +1 -0
  223. package/dist/helpers-BeGM4pP_.cjs +95 -0
  224. package/dist/helpers-BeGM4pP_.cjs.map +1 -0
  225. package/dist/helpers-DbpO95aE.mjs +83 -0
  226. package/dist/helpers-DbpO95aE.mjs.map +1 -0
  227. package/dist/index-CuGR4L7O.d.mts +9 -0
  228. package/dist/index-Fg3N3EKD.d.cts +9 -0
  229. package/dist/index.cjs +4 -0
  230. package/dist/index.d.cts +4 -0
  231. package/dist/index.d.mts +4 -0
  232. package/dist/index.mjs +3 -0
  233. package/dist/parseHonoQuery-DopC24vB.cjs +37 -0
  234. package/dist/parseHonoQuery-DopC24vB.cjs.map +1 -0
  235. package/dist/parseHonoQuery-znDKBhdE.mjs +31 -0
  236. package/dist/parseHonoQuery-znDKBhdE.mjs.map +1 -0
  237. package/dist/parseQueryParams-BJaRh3OB.mjs +32 -0
  238. package/dist/parseQueryParams-BJaRh3OB.mjs.map +1 -0
  239. package/dist/parseQueryParams-BzPop4I1.cjs +38 -0
  240. package/dist/parseQueryParams-BzPop4I1.cjs.map +1 -0
  241. package/dist/publisher-Bw4770Hi.mjs +41 -0
  242. package/dist/publisher-Bw4770Hi.mjs.map +1 -0
  243. package/dist/publisher-lFQleddL.cjs +53 -0
  244. package/dist/publisher-lFQleddL.cjs.map +1 -0
  245. package/dist/publisher.cjs +4 -0
  246. package/dist/publisher.d.cts +13 -0
  247. package/dist/publisher.d.mts +13 -0
  248. package/dist/publisher.mjs +3 -0
  249. package/dist/subscribers/AWSLambdaSubscriberAdaptor.cjs +3 -0
  250. package/dist/subscribers/AWSLambdaSubscriberAdaptor.d.cts +4 -0
  251. package/dist/subscribers/AWSLambdaSubscriberAdaptor.d.mts +4 -0
  252. package/dist/subscribers/AWSLambdaSubscriberAdaptor.mjs +3 -0
  253. package/dist/subscribers/Subscriber.cjs +4 -0
  254. package/dist/subscribers/Subscriber.d.cts +3 -0
  255. package/dist/subscribers/Subscriber.d.mts +3 -0
  256. package/dist/subscribers/Subscriber.mjs +4 -0
  257. package/dist/subscribers/SubscriberBuilder.cjs +5 -0
  258. package/dist/subscribers/SubscriberBuilder.d.cts +4 -0
  259. package/dist/subscribers/SubscriberBuilder.d.mts +4 -0
  260. package/dist/subscribers/SubscriberBuilder.mjs +5 -0
  261. package/dist/subscribers/index.cjs +12 -0
  262. package/dist/subscribers/index.cjs.map +1 -0
  263. package/dist/subscribers/index.d.cts +10 -0
  264. package/dist/subscribers/index.d.mts +10 -0
  265. package/dist/subscribers/index.mjs +10 -0
  266. package/dist/subscribers/index.mjs.map +1 -0
  267. package/dist/types-Bp9ysFXd.d.cts +7 -0
  268. package/dist/types-DBKNYvsW.d.mts +7 -0
  269. package/dist/types.cjs +0 -0
  270. package/dist/types.d.cts +2 -0
  271. package/dist/types.d.mts +2 -0
  272. package/dist/types.mjs +0 -0
  273. package/package.json +91 -0
  274. package/src/Construct.ts +98 -0
  275. package/src/__tests__/Construct.environment.spec.ts +360 -0
  276. package/src/__tests__/publisher.setting.spec.ts +511 -0
  277. package/src/__tests__/publisher.spec.ts +454 -0
  278. package/src/adaptors/aws.ts +4 -0
  279. package/src/adaptors/hono.ts +1 -0
  280. package/src/crons/Cron.ts +137 -0
  281. package/src/crons/CronBuilder.ts +192 -0
  282. package/src/crons/__tests__/Cron.spec.ts +464 -0
  283. package/src/crons/index.ts +11 -0
  284. package/src/endpoints/AmazonApiGatewayEndpointAdaptor.ts +315 -0
  285. package/src/endpoints/AmazonApiGatewayV1EndpointAdaptor.ts +101 -0
  286. package/src/endpoints/AmazonApiGatewayV2EndpointAdaptor.ts +95 -0
  287. package/src/endpoints/Endpoint.ts +771 -0
  288. package/src/endpoints/EndpointBuilder.ts +308 -0
  289. package/src/endpoints/EndpointFactory.ts +329 -0
  290. package/src/endpoints/HonoEndpointAdaptor.ts +365 -0
  291. package/src/endpoints/TestEndpointAdaptor.ts +130 -0
  292. package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.events.spec.ts +553 -0
  293. package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.spec.ts +927 -0
  294. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.events.spec.ts +721 -0
  295. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.factory-publisher.spec.ts +296 -0
  296. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.spec.ts +441 -0
  297. package/src/endpoints/__tests__/Endpoint.spec.ts +800 -0
  298. package/src/endpoints/__tests__/EndpointBuilder.spec.ts +488 -0
  299. package/src/endpoints/__tests__/EndpointFactory.spec.ts +479 -0
  300. package/src/endpoints/__tests__/HonoEndpointAdaptor.events.spec.ts +569 -0
  301. package/src/endpoints/__tests__/HonoEndpointAdaptor.openapi.spec.ts +313 -0
  302. package/src/endpoints/__tests__/HonoEndpointAdaptor.spec.ts +1078 -0
  303. package/src/endpoints/__tests__/TestEndpointAdaptor.spec.ts +236 -0
  304. package/src/endpoints/__tests__/__snapshots__/HonoEndpointAdaptor.spec.ts.snap +54 -0
  305. package/src/endpoints/__tests__/endpoint-types.test.ts +88 -0
  306. package/src/endpoints/helpers.ts +99 -0
  307. package/src/endpoints/index.ts +5 -0
  308. package/src/endpoints/parseHonoQuery.ts +51 -0
  309. package/src/endpoints/parseQueryParams.ts +51 -0
  310. package/src/functions/AWSLambdaFunction.ts +222 -0
  311. package/src/functions/BaseFunctionBuilder.ts +110 -0
  312. package/src/functions/Function.ts +160 -0
  313. package/src/functions/FunctionBuilder.ts +182 -0
  314. package/src/functions/FunctionExecutionWrapper.ts +86 -0
  315. package/src/functions/TestFunctionAdaptor.ts +125 -0
  316. package/src/functions/__tests__/AWSLambdaFunctionAdaptor.spec.ts +376 -0
  317. package/src/functions/__tests__/Function.spec.ts +402 -0
  318. package/src/functions/__tests__/TestFunctionAdaptor.spec.ts +398 -0
  319. package/src/functions/index.ts +10 -0
  320. package/src/index.ts +14 -0
  321. package/src/publisher.ts +83 -0
  322. package/src/subscribers/AWSLambdaSubscriberAdaptor.ts +269 -0
  323. package/src/subscribers/Subscriber.ts +112 -0
  324. package/src/subscribers/SubscriberBuilder.ts +150 -0
  325. package/src/subscribers/__tests__/AWSLambdaSubscriberAdaptor.spec.ts +623 -0
  326. package/src/subscribers/__tests__/Subscriber.spec.ts +432 -0
  327. package/src/subscribers/index.ts +5 -0
  328. package/src/types.ts +13 -0
  329. package/tsdown.config.ts +3 -0
@@ -0,0 +1,721 @@
1
+ import { EnvironmentParser } from '@geekmidas/envkit';
2
+ import type {
3
+ EventPublisher,
4
+ MappedEvent,
5
+ PublishableMessage,
6
+ } from '@geekmidas/events';
7
+ import type { Logger } from '@geekmidas/logger';
8
+ import type { Service } from '@geekmidas/services';
9
+ import { createMockContext, createMockV2Event } from '@geekmidas/testkit/aws';
10
+ import { beforeEach, describe, expect, it, vi } from 'vitest';
11
+ import { z } from 'zod';
12
+ import { AmazonApiGatewayV2Endpoint } from '../AmazonApiGatewayV2EndpointAdaptor';
13
+ import { Endpoint } from '../Endpoint';
14
+
15
+ // Test event types
16
+ type TestEvent =
17
+ | PublishableMessage<'user.created', { userId: string; email: string }>
18
+ | PublishableMessage<'user.updated', { userId: string; changes: string[] }>
19
+ | PublishableMessage<'notification.sent', { userId: string; type: string }>;
20
+
21
+ // Mock logger
22
+ const createMockLogger = (): Logger => {
23
+ const logger: Logger = {
24
+ debug: vi.fn(),
25
+ info: vi.fn(),
26
+ warn: vi.fn(),
27
+ error: vi.fn(),
28
+ fatal: vi.fn(),
29
+ trace: vi.fn(),
30
+ child: vi.fn(() => logger),
31
+ };
32
+ return logger;
33
+ };
34
+
35
+ describe('AmazonApiGatewayV2Endpoint Events', () => {
36
+ let mockLogger: Logger;
37
+ let envParser: EnvironmentParser<{}>;
38
+
39
+ beforeEach(() => {
40
+ vi.clearAllMocks();
41
+ mockLogger = createMockLogger();
42
+ envParser = new EnvironmentParser({});
43
+ });
44
+
45
+ it('should publish events after successful endpoint execution', async () => {
46
+ const mockPublisher: EventPublisher<TestEvent> = {
47
+ publish: vi.fn().mockResolvedValue(undefined),
48
+ };
49
+
50
+ const mockPublisherService: Service<
51
+ 'publisher',
52
+ EventPublisher<TestEvent>
53
+ > = {
54
+ serviceName: 'publisher' as const,
55
+ register: vi.fn().mockResolvedValue(mockPublisher),
56
+ };
57
+
58
+ const outputSchema = z.object({ id: z.string(), email: z.string() });
59
+
60
+ const events: MappedEvent<
61
+ EventPublisher<TestEvent>,
62
+ typeof outputSchema
63
+ >[] = [
64
+ {
65
+ type: 'user.created',
66
+ payload: (response) => ({ userId: response.id, email: response.email }),
67
+ },
68
+ ];
69
+
70
+ const endpoint = new Endpoint({
71
+ route: '/users',
72
+ method: 'POST',
73
+ fn: async () => ({ id: '123', email: 'test@example.com' }),
74
+ input: undefined,
75
+ output: outputSchema,
76
+ services: [],
77
+ logger: mockLogger,
78
+ timeout: undefined,
79
+ status: 200,
80
+ getSession: undefined,
81
+ authorize: undefined,
82
+ description: undefined,
83
+ events,
84
+ publisherService: mockPublisherService,
85
+ });
86
+
87
+ const adapter = new AmazonApiGatewayV2Endpoint(envParser, endpoint as any);
88
+ const handler = adapter.handler;
89
+
90
+ const event = createMockV2Event({
91
+ requestContext: {
92
+ ...createMockV2Event().requestContext,
93
+ http: {
94
+ method: 'POST',
95
+ path: '/users',
96
+ protocol: 'HTTP/1.1',
97
+ sourceIp: '192.168.1.1',
98
+ userAgent: 'test-agent',
99
+ },
100
+ },
101
+ body: JSON.stringify({}),
102
+ });
103
+ const context = createMockContext();
104
+ const response = await handler(event, context);
105
+
106
+ expect(response.statusCode).toBe(200);
107
+ expect(response.body).toBe(
108
+ JSON.stringify({ id: '123', email: 'test@example.com' }),
109
+ );
110
+
111
+ expect(mockPublisher.publish).toHaveBeenCalledWith([
112
+ {
113
+ type: 'user.created',
114
+ payload: { userId: '123', email: 'test@example.com' },
115
+ },
116
+ ]);
117
+ });
118
+
119
+ it('should publish multiple events after successful endpoint execution', async () => {
120
+ const mockPublisher: EventPublisher<TestEvent> = {
121
+ publish: vi.fn().mockResolvedValue(undefined),
122
+ };
123
+
124
+ const mockPublisherService: Service<string, EventPublisher<TestEvent>> = {
125
+ serviceName: Math.random().toString(),
126
+ register: vi.fn().mockResolvedValue(mockPublisher),
127
+ };
128
+
129
+ const outputSchema = z.object({ id: z.string(), email: z.string() });
130
+
131
+ const events: MappedEvent<
132
+ EventPublisher<TestEvent>,
133
+ typeof outputSchema
134
+ >[] = [
135
+ {
136
+ type: 'user.created',
137
+ payload: (response) => ({ userId: response.id, email: response.email }),
138
+ },
139
+ {
140
+ type: 'notification.sent',
141
+ payload: (response) => ({ userId: response.id, type: 'welcome' }),
142
+ },
143
+ ];
144
+
145
+ const endpoint = new Endpoint({
146
+ route: '/users',
147
+ method: 'POST',
148
+ fn: async () => ({ id: '456', email: 'user@example.com' }),
149
+ input: undefined,
150
+ output: outputSchema,
151
+ services: [],
152
+ logger: mockLogger,
153
+ timeout: undefined,
154
+ status: 201,
155
+ getSession: undefined,
156
+ authorize: undefined,
157
+ description: undefined,
158
+ events,
159
+ publisherService: mockPublisherService,
160
+ });
161
+
162
+ const adapter = new AmazonApiGatewayV2Endpoint(envParser, endpoint as any);
163
+ const handler = adapter.handler;
164
+
165
+ const event = createMockV2Event({
166
+ requestContext: {
167
+ ...createMockV2Event().requestContext,
168
+ http: {
169
+ method: 'POST',
170
+ path: '/users',
171
+ protocol: 'HTTP/1.1',
172
+ sourceIp: '192.168.1.1',
173
+ userAgent: 'test-agent',
174
+ },
175
+ },
176
+ body: JSON.stringify({}),
177
+ });
178
+ const context = createMockContext();
179
+ const response = await handler(event, context);
180
+
181
+ expect(response.statusCode).toBe(201);
182
+ expect(response.body).toBe(
183
+ JSON.stringify({ id: '456', email: 'user@example.com' }),
184
+ );
185
+
186
+ expect(mockPublisher.publish).toHaveBeenCalledWith([
187
+ {
188
+ type: 'user.created',
189
+ payload: { userId: '456', email: 'user@example.com' },
190
+ },
191
+ {
192
+ type: 'notification.sent',
193
+ payload: { userId: '456', type: 'welcome' },
194
+ },
195
+ ]);
196
+ });
197
+
198
+ it('should respect when conditions for events', async () => {
199
+ const mockPublisher: EventPublisher<TestEvent> = {
200
+ publish: vi.fn().mockResolvedValue(undefined),
201
+ };
202
+
203
+ const mockPublisherService: Service<string, EventPublisher<TestEvent>> = {
204
+ serviceName: Math.random().toString(),
205
+ register: vi.fn().mockResolvedValue(mockPublisher),
206
+ };
207
+
208
+ const outputSchema = z.object({
209
+ id: z.string(),
210
+ email: z.string(),
211
+ isNew: z.boolean(),
212
+ });
213
+
214
+ const events: MappedEvent<
215
+ EventPublisher<TestEvent>,
216
+ typeof outputSchema
217
+ >[] = [
218
+ {
219
+ type: 'user.created',
220
+ payload: (response) => ({ userId: response.id, email: response.email }),
221
+ when: (response) => response.isNew === true,
222
+ },
223
+ {
224
+ type: 'user.updated',
225
+ payload: (response) => ({ userId: response.id, changes: ['email'] }),
226
+ when: (response) => response.isNew === false,
227
+ },
228
+ ];
229
+
230
+ const endpoint = new Endpoint({
231
+ route: '/users/:id',
232
+ method: 'PUT',
233
+ fn: async () => ({
234
+ id: '789',
235
+ email: 'updated@example.com',
236
+ isNew: false,
237
+ }),
238
+ input: undefined,
239
+ output: outputSchema,
240
+ services: [],
241
+ logger: mockLogger,
242
+ timeout: undefined,
243
+ status: 200,
244
+ getSession: undefined,
245
+ authorize: undefined,
246
+ description: undefined,
247
+ events,
248
+ publisherService: mockPublisherService,
249
+ });
250
+
251
+ const adapter = new AmazonApiGatewayV2Endpoint(envParser, endpoint as any);
252
+ const handler = adapter.handler;
253
+
254
+ const event = createMockV2Event({
255
+ requestContext: {
256
+ ...createMockV2Event().requestContext,
257
+ http: {
258
+ method: 'PUT',
259
+ path: '/users/789',
260
+ protocol: 'HTTP/1.1',
261
+ sourceIp: '192.168.1.1',
262
+ userAgent: 'test-agent',
263
+ },
264
+ },
265
+ pathParameters: { id: '789' },
266
+ body: JSON.stringify({}),
267
+ });
268
+ const context = createMockContext();
269
+ const response = await handler(event, context);
270
+
271
+ expect(response.statusCode).toBe(200);
272
+ expect(response.body).toBe(
273
+ JSON.stringify({
274
+ id: '789',
275
+ email: 'updated@example.com',
276
+ isNew: false,
277
+ }),
278
+ );
279
+
280
+ // Only user.updated event should be published due to when condition
281
+ expect(mockPublisher.publish).toHaveBeenCalledWith([
282
+ {
283
+ type: 'user.updated',
284
+ payload: { userId: '789', changes: ['email'] },
285
+ },
286
+ ]);
287
+ });
288
+
289
+ it('should not publish events when no publisher is configured', async () => {
290
+ const outputSchema = z.object({ id: z.string(), email: z.string() });
291
+
292
+ const events: MappedEvent<
293
+ EventPublisher<TestEvent>,
294
+ typeof outputSchema
295
+ >[] = [
296
+ {
297
+ type: 'user.created',
298
+ payload: (response) => ({ userId: response.id, email: response.email }),
299
+ },
300
+ ];
301
+
302
+ const endpoint = new Endpoint({
303
+ route: '/users',
304
+ method: 'POST',
305
+ fn: async () => ({ id: '999', email: 'test@example.com' }),
306
+ input: undefined,
307
+ output: outputSchema,
308
+ services: [],
309
+ logger: mockLogger,
310
+ timeout: undefined,
311
+ status: 200,
312
+ getSession: undefined,
313
+ authorize: undefined,
314
+ description: undefined,
315
+ events,
316
+ publisherService: undefined, // No publisher service
317
+ });
318
+
319
+ const adapter = new AmazonApiGatewayV2Endpoint(envParser, endpoint as any);
320
+ const handler = adapter.handler;
321
+
322
+ const event = createMockV2Event({
323
+ requestContext: {
324
+ ...createMockV2Event().requestContext,
325
+ http: {
326
+ method: 'POST',
327
+ path: '/users',
328
+ protocol: 'HTTP/1.1',
329
+ sourceIp: '192.168.1.1',
330
+ userAgent: 'test-agent',
331
+ },
332
+ },
333
+ body: JSON.stringify({}),
334
+ });
335
+ const context = createMockContext();
336
+ const response = await handler(event, context);
337
+
338
+ expect(response.statusCode).toBe(200);
339
+ expect(response.body).toBe(
340
+ JSON.stringify({ id: '999', email: 'test@example.com' }),
341
+ );
342
+
343
+ // No publisher calls should be made
344
+ expect(mockLogger.warn).toHaveBeenCalledWith(
345
+ 'No publisher service available',
346
+ );
347
+ });
348
+
349
+ it('should not publish events when no events are configured', async () => {
350
+ const mockPublisher: EventPublisher<TestEvent> = {
351
+ publish: vi.fn().mockResolvedValue(undefined),
352
+ };
353
+
354
+ const mockPublisherService: Service<string, EventPublisher<TestEvent>> = {
355
+ serviceName: Math.random().toString(),
356
+ register: vi.fn().mockResolvedValue(mockPublisher),
357
+ };
358
+
359
+ const outputSchema = z.object({ id: z.string(), email: z.string() });
360
+
361
+ const endpoint = new Endpoint({
362
+ route: '/users',
363
+ method: 'POST',
364
+ fn: async () => ({ id: '111', email: 'test@example.com' }),
365
+ input: undefined,
366
+ output: outputSchema,
367
+ services: [],
368
+ logger: mockLogger,
369
+ timeout: undefined,
370
+ status: 200,
371
+ getSession: undefined,
372
+ authorize: undefined,
373
+ description: undefined,
374
+ events: undefined, // No events
375
+ publisherService: mockPublisherService,
376
+ });
377
+
378
+ const adapter = new AmazonApiGatewayV2Endpoint(envParser, endpoint as any);
379
+ const handler = adapter.handler;
380
+
381
+ const event = createMockV2Event({
382
+ requestContext: {
383
+ ...createMockV2Event().requestContext,
384
+ http: {
385
+ method: 'POST',
386
+ path: '/users',
387
+ protocol: 'HTTP/1.1',
388
+ sourceIp: '192.168.1.1',
389
+ userAgent: 'test-agent',
390
+ },
391
+ },
392
+ body: JSON.stringify({}),
393
+ });
394
+ const context = createMockContext();
395
+ const response = await handler(event, context);
396
+
397
+ expect(response.statusCode).toBe(200);
398
+ expect(response.body).toBe(
399
+ JSON.stringify({ id: '111', email: 'test@example.com' }),
400
+ );
401
+
402
+ // No events should be published
403
+ expect(mockPublisher.publish).not.toHaveBeenCalled();
404
+ expect(mockLogger.debug).toHaveBeenCalledWith('No events to publish');
405
+ });
406
+
407
+ it('should continue processing even when event publishing fails', async () => {
408
+ const publishError = new Error('Event bus connection failed');
409
+ const mockPublisher: EventPublisher<TestEvent> = {
410
+ publish: vi.fn().mockRejectedValue(publishError),
411
+ };
412
+
413
+ const mockPublisherService: Service<string, EventPublisher<TestEvent>> = {
414
+ serviceName: Math.random().toString(),
415
+ register: vi.fn().mockResolvedValue(mockPublisher),
416
+ };
417
+
418
+ const outputSchema = z.object({ id: z.string(), email: z.string() });
419
+
420
+ const events: MappedEvent<
421
+ EventPublisher<TestEvent>,
422
+ typeof outputSchema
423
+ >[] = [
424
+ {
425
+ type: 'user.created',
426
+ payload: (response) => ({ userId: response.id, email: response.email }),
427
+ },
428
+ ];
429
+
430
+ const endpoint = new Endpoint({
431
+ route: '/users',
432
+ method: 'POST',
433
+ fn: async () => ({ id: '888', email: 'error@example.com' }),
434
+ input: undefined,
435
+ output: outputSchema,
436
+ services: [],
437
+ logger: mockLogger,
438
+ timeout: undefined,
439
+ status: 200,
440
+ getSession: undefined,
441
+ authorize: undefined,
442
+ description: undefined,
443
+ events,
444
+ publisherService: mockPublisherService,
445
+ });
446
+
447
+ const adapter = new AmazonApiGatewayV2Endpoint(envParser, endpoint as any);
448
+ const handler = adapter.handler;
449
+
450
+ const event = createMockV2Event({
451
+ requestContext: {
452
+ ...createMockV2Event().requestContext,
453
+ http: {
454
+ method: 'POST',
455
+ path: '/users',
456
+ protocol: 'HTTP/1.1',
457
+ sourceIp: '192.168.1.1',
458
+ userAgent: 'test-agent',
459
+ },
460
+ },
461
+ body: JSON.stringify({}),
462
+ });
463
+ const context = createMockContext();
464
+ const response = await handler(event, context);
465
+
466
+ // The endpoint should still succeed despite event publishing failure
467
+ expect(response.statusCode).toBe(200);
468
+ expect(response.body).toBe(
469
+ JSON.stringify({ id: '888', email: 'error@example.com' }),
470
+ );
471
+
472
+ expect(mockPublisher.publish).toHaveBeenCalled();
473
+ expect(mockLogger.error).toHaveBeenCalledWith(
474
+ publishError,
475
+ 'Failed to publish events',
476
+ );
477
+ });
478
+
479
+ it('should publish events with input data context', async () => {
480
+ const mockPublisher: EventPublisher<TestEvent> = {
481
+ publish: vi.fn().mockResolvedValue(undefined),
482
+ };
483
+
484
+ const mockPublisherService: Service<string, EventPublisher<TestEvent>> = {
485
+ serviceName: Math.random().toString(),
486
+ register: vi.fn().mockResolvedValue(mockPublisher),
487
+ };
488
+
489
+ const bodySchema = z.object({ name: z.string(), email: z.string() });
490
+ const outputSchema = z.object({
491
+ id: z.string(),
492
+ name: z.string(),
493
+ email: z.string(),
494
+ });
495
+
496
+ const events: MappedEvent<
497
+ EventPublisher<TestEvent>,
498
+ typeof outputSchema
499
+ >[] = [
500
+ {
501
+ type: 'user.created',
502
+ payload: (response) => ({ userId: response.id, email: response.email }),
503
+ },
504
+ ];
505
+
506
+ const endpoint = new Endpoint({
507
+ route: '/users',
508
+ method: 'POST',
509
+ fn: async ({ body }) => ({
510
+ id: '777',
511
+ name: body.name,
512
+ email: body.email,
513
+ }),
514
+ input: { body: bodySchema },
515
+ output: outputSchema,
516
+ services: [],
517
+ logger: mockLogger,
518
+ timeout: undefined,
519
+ status: 201,
520
+ getSession: undefined,
521
+ authorize: undefined,
522
+ description: undefined,
523
+ events,
524
+ publisherService: mockPublisherService,
525
+ });
526
+
527
+ const adapter = new AmazonApiGatewayV2Endpoint(envParser, endpoint as any);
528
+ const handler = adapter.handler;
529
+
530
+ const event = createMockV2Event({
531
+ requestContext: {
532
+ ...createMockV2Event().requestContext,
533
+ http: {
534
+ method: 'POST',
535
+ path: '/users',
536
+ protocol: 'HTTP/1.1',
537
+ sourceIp: '192.168.1.1',
538
+ userAgent: 'test-agent',
539
+ },
540
+ },
541
+ body: JSON.stringify({ name: 'John Doe', email: 'john@example.com' }),
542
+ });
543
+ const context = createMockContext();
544
+ const response = await handler(event, context);
545
+
546
+ expect(response.statusCode).toBe(201);
547
+ expect(response.body).toBe(
548
+ JSON.stringify({
549
+ id: '777',
550
+ name: 'John Doe',
551
+ email: 'john@example.com',
552
+ }),
553
+ );
554
+
555
+ expect(mockPublisher.publish).toHaveBeenCalledWith([
556
+ {
557
+ type: 'user.created',
558
+ payload: { userId: '777', email: 'john@example.com' },
559
+ },
560
+ ]);
561
+ });
562
+
563
+ it('should not publish events when handler throws an error', async () => {
564
+ const mockPublisher: EventPublisher<TestEvent> = {
565
+ publish: vi.fn().mockResolvedValue(undefined),
566
+ };
567
+
568
+ const mockPublisherService: Service<string, EventPublisher<TestEvent>> = {
569
+ serviceName: Math.random().toString(),
570
+ register: vi.fn().mockResolvedValue(mockPublisher),
571
+ };
572
+
573
+ const outputSchema = z.object({ id: z.string(), email: z.string() });
574
+
575
+ const events: MappedEvent<
576
+ EventPublisher<TestEvent>,
577
+ typeof outputSchema
578
+ >[] = [
579
+ {
580
+ type: 'user.created',
581
+ payload: (response) => ({ userId: response.id, email: response.email }),
582
+ },
583
+ ];
584
+
585
+ const endpoint = new Endpoint({
586
+ route: '/users',
587
+ method: 'POST',
588
+ fn: async () => {
589
+ throw new Error('Database connection failed');
590
+ },
591
+ input: undefined,
592
+ output: outputSchema,
593
+ services: [],
594
+ logger: mockLogger,
595
+ timeout: undefined,
596
+ status: 200,
597
+ getSession: undefined,
598
+ authorize: undefined,
599
+ description: undefined,
600
+ events,
601
+ publisherService: mockPublisherService,
602
+ });
603
+
604
+ const adapter = new AmazonApiGatewayV2Endpoint(envParser, endpoint as any);
605
+ const handler = adapter.handler;
606
+
607
+ const event = createMockV2Event({
608
+ requestContext: {
609
+ ...createMockV2Event().requestContext,
610
+ http: {
611
+ method: 'POST',
612
+ path: '/users',
613
+ protocol: 'HTTP/1.1',
614
+ sourceIp: '192.168.1.1',
615
+ userAgent: 'test-agent',
616
+ },
617
+ },
618
+ body: JSON.stringify({}),
619
+ });
620
+ const context = createMockContext();
621
+ const response = await handler(event, context);
622
+
623
+ // The endpoint should return an error response
624
+ expect(response.statusCode).toBe(500);
625
+
626
+ // Events should not be published when handler fails
627
+ expect(mockPublisher.publish).not.toHaveBeenCalled();
628
+ });
629
+
630
+ it('should handle comma-separated array query parameters', async () => {
631
+ const mockPublisher: EventPublisher<TestEvent> = {
632
+ publish: vi.fn().mockResolvedValue(undefined),
633
+ };
634
+
635
+ const mockPublisherService: Service<string, EventPublisher<TestEvent>> = {
636
+ serviceName: Math.random().toString(),
637
+ register: vi.fn().mockResolvedValue(mockPublisher),
638
+ };
639
+
640
+ const querySchema = z.object({
641
+ tags: z.array(z.string()),
642
+ });
643
+ const outputSchema = z.object({
644
+ id: z.string(),
645
+ tags: z.array(z.string()),
646
+ });
647
+
648
+ const events: MappedEvent<
649
+ EventPublisher<TestEvent>,
650
+ typeof outputSchema
651
+ >[] = [
652
+ {
653
+ type: 'user.updated',
654
+ payload: (response) => ({
655
+ userId: response.id,
656
+ changes: response.tags.map((tag) => `tag:${tag}`),
657
+ }),
658
+ },
659
+ ];
660
+
661
+ const endpoint = new Endpoint({
662
+ route: '/users/:id/tags',
663
+ method: 'PUT',
664
+ fn: async ({ query }) => ({
665
+ id: '123',
666
+ tags: query.tags,
667
+ }),
668
+ input: { query: querySchema },
669
+ output: outputSchema,
670
+ services: [],
671
+ logger: mockLogger,
672
+ timeout: undefined,
673
+ status: 200,
674
+ getSession: undefined,
675
+ authorize: undefined,
676
+ description: undefined,
677
+ events,
678
+ publisherService: mockPublisherService,
679
+ });
680
+
681
+ const adapter = new AmazonApiGatewayV2Endpoint(envParser, endpoint as any);
682
+ const handler = adapter.handler;
683
+
684
+ const event = createMockV2Event({
685
+ requestContext: {
686
+ ...createMockV2Event().requestContext,
687
+ http: {
688
+ method: 'PUT',
689
+ path: '/users/123/tags',
690
+ protocol: 'HTTP/1.1',
691
+ sourceIp: '192.168.1.1',
692
+ userAgent: 'test-agent',
693
+ },
694
+ },
695
+ pathParameters: { id: '123' },
696
+ queryStringParameters: {
697
+ tags: 'javascript, typescript, nodejs', // V2 handles arrays as comma-separated
698
+ },
699
+ });
700
+ const context = createMockContext();
701
+ const response = await handler(event, context);
702
+
703
+ expect(response.statusCode).toBe(200);
704
+ expect(response.body).toBe(
705
+ JSON.stringify({
706
+ id: '123',
707
+ tags: ['javascript', 'typescript', 'nodejs'],
708
+ }),
709
+ );
710
+
711
+ expect(mockPublisher.publish).toHaveBeenCalledWith([
712
+ {
713
+ type: 'user.updated',
714
+ payload: {
715
+ userId: '123',
716
+ changes: ['tag:javascript', 'tag:typescript', 'tag:nodejs'],
717
+ },
718
+ },
719
+ ]);
720
+ });
721
+ });