@geekmidas/constructs 0.0.6 → 0.0.9

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 (288) hide show
  1. package/dist/{AWSLambdaFunction-qA5LqPsv.cjs → AWSLambdaFunction-CMLZ3GaC.cjs} +3 -3
  2. package/dist/{AWSLambdaFunction-qA5LqPsv.cjs.map → AWSLambdaFunction-CMLZ3GaC.cjs.map} +1 -1
  3. package/dist/{AWSLambdaFunction-CANc3Qo2.d.mts → AWSLambdaFunction-D5V3YVqv.d.cts} +5 -5
  4. package/dist/{AWSLambdaFunction-CwagvPG3.d.cts → AWSLambdaFunction-_J0MjixY.d.mts} +5 -5
  5. package/dist/{AWSLambdaFunction-DWIZYsCy.mjs → AWSLambdaFunction-egVcP17n.mjs} +3 -3
  6. package/dist/{AWSLambdaFunction-DWIZYsCy.mjs.map → AWSLambdaFunction-egVcP17n.mjs.map} +1 -1
  7. package/dist/{AWSLambdaSubscriberAdaptor-QKVxR6qh.d.cts → AWSLambdaSubscriberAdaptor-DjG1ME3P.d.mts} +4 -4
  8. package/dist/{AWSLambdaSubscriberAdaptor-C6JYIZxn.d.mts → AWSLambdaSubscriberAdaptor-J_pSz6pu.d.cts} +4 -4
  9. package/dist/{AmazonApiGatewayEndpointAdaptor-BFhJ2Rpz.d.cts → AmazonApiGatewayEndpointAdaptor-BnNd8tCz.d.cts} +2 -2
  10. package/dist/{AmazonApiGatewayEndpointAdaptor-BrB3RfbI.d.mts → AmazonApiGatewayEndpointAdaptor-C-17dUai.d.mts} +2 -2
  11. package/dist/{AmazonApiGatewayEndpointAdaptor-Bmz6Cy1e.mjs → AmazonApiGatewayEndpointAdaptor-CQLjGSJe.mjs} +2 -2
  12. package/dist/{AmazonApiGatewayEndpointAdaptor-Bmz6Cy1e.mjs.map → AmazonApiGatewayEndpointAdaptor-CQLjGSJe.mjs.map} +1 -1
  13. package/dist/{AmazonApiGatewayEndpointAdaptor-B8mozTcG.cjs → AmazonApiGatewayEndpointAdaptor-DPaV_5wG.cjs} +2 -2
  14. package/dist/{AmazonApiGatewayEndpointAdaptor-B8mozTcG.cjs.map → AmazonApiGatewayEndpointAdaptor-DPaV_5wG.cjs.map} +1 -1
  15. package/dist/{AmazonApiGatewayV1EndpointAdaptor-Bd-o8ese.d.cts → AmazonApiGatewayV1EndpointAdaptor-BC-a2tt3.d.cts} +3 -3
  16. package/dist/{AmazonApiGatewayV1EndpointAdaptor-BtNXt0-4.d.mts → AmazonApiGatewayV1EndpointAdaptor-Cjud-a6p.d.mts} +3 -3
  17. package/dist/{AmazonApiGatewayV1EndpointAdaptor-24g3dLn5.mjs → AmazonApiGatewayV1EndpointAdaptor-DEBcyZe0.mjs} +2 -2
  18. package/dist/{AmazonApiGatewayV1EndpointAdaptor-24g3dLn5.mjs.map → AmazonApiGatewayV1EndpointAdaptor-DEBcyZe0.mjs.map} +1 -1
  19. package/dist/{AmazonApiGatewayV1EndpointAdaptor-D4eZ-fx5.cjs → AmazonApiGatewayV1EndpointAdaptor-DkFcSRwT.cjs} +2 -2
  20. package/dist/{AmazonApiGatewayV1EndpointAdaptor-D4eZ-fx5.cjs.map → AmazonApiGatewayV1EndpointAdaptor-DkFcSRwT.cjs.map} +1 -1
  21. package/dist/{AmazonApiGatewayV2EndpointAdaptor-Cc40RThv.mjs → AmazonApiGatewayV2EndpointAdaptor-BB7t7LE2.mjs} +2 -2
  22. package/dist/{AmazonApiGatewayV2EndpointAdaptor-Cc40RThv.mjs.map → AmazonApiGatewayV2EndpointAdaptor-BB7t7LE2.mjs.map} +1 -1
  23. package/dist/{AmazonApiGatewayV2EndpointAdaptor-J6tACl-N.cjs → AmazonApiGatewayV2EndpointAdaptor-BQ21ry6s.cjs} +2 -2
  24. package/dist/{AmazonApiGatewayV2EndpointAdaptor-J6tACl-N.cjs.map → AmazonApiGatewayV2EndpointAdaptor-BQ21ry6s.cjs.map} +1 -1
  25. package/dist/{AmazonApiGatewayV2EndpointAdaptor-DAJdtgek.d.mts → AmazonApiGatewayV2EndpointAdaptor-C31Xcwmc.d.mts} +3 -3
  26. package/dist/{AmazonApiGatewayV2EndpointAdaptor-DX-Uci5w.d.cts → AmazonApiGatewayV2EndpointAdaptor-zNFUPxSY.d.cts} +3 -3
  27. package/dist/Authorizer-Bbk9ziuG.d.mts +29 -0
  28. package/dist/Authorizer-iXsSB600.d.cts +29 -0
  29. package/dist/{BaseFunctionBuilder-DtO4Nwxm.cjs → BaseFunctionBuilder-B-kdtkzI.cjs} +2 -2
  30. package/dist/{BaseFunctionBuilder-DtO4Nwxm.cjs.map → BaseFunctionBuilder-B-kdtkzI.cjs.map} +1 -1
  31. package/dist/{BaseFunctionBuilder-5QCHkchp.d.cts → BaseFunctionBuilder-C4ZJPkIZ.d.cts} +2 -2
  32. package/dist/{BaseFunctionBuilder-Dda7AiID.d.mts → BaseFunctionBuilder-CxBX0arJ.d.mts} +2 -2
  33. package/dist/{BaseFunctionBuilder-BPE9JBbT.mjs → BaseFunctionBuilder-DOhEn5Ce.mjs} +2 -2
  34. package/dist/{BaseFunctionBuilder-BPE9JBbT.mjs.map → BaseFunctionBuilder-DOhEn5Ce.mjs.map} +1 -1
  35. package/dist/{Construct-BbKCIPQm.mjs → Construct-B-O9OBS1.mjs} +4 -2
  36. package/dist/Construct-B-O9OBS1.mjs.map +1 -0
  37. package/dist/{Construct-BSEs6uwW.cjs → Construct-BtfN2fcm.cjs} +4 -2
  38. package/dist/Construct-BtfN2fcm.cjs.map +1 -0
  39. package/dist/{Construct-Bm-PSO2V.d.cts → Construct-ci5u8Xnu.d.cts} +4 -2
  40. package/dist/{Construct-DdyYENBD.d.mts → Construct-zhmcmIdY.d.mts} +4 -2
  41. package/dist/Construct.cjs +1 -1
  42. package/dist/Construct.d.cts +1 -1
  43. package/dist/Construct.d.mts +1 -1
  44. package/dist/Construct.mjs +1 -1
  45. package/dist/{Cron-BxMXmn4t.d.cts → Cron-ByNYsQDH.d.mts} +4 -4
  46. package/dist/{Cron-z0RiwSnT.mjs → Cron-D8DPUXBd.mjs} +5 -5
  47. package/dist/Cron-D8DPUXBd.mjs.map +1 -0
  48. package/dist/{Cron-NDBlJhb3.d.mts → Cron-DkPL-Fms.d.cts} +4 -4
  49. package/dist/{Cron-D6MyCqby.cjs → Cron-sOrsPuQj.cjs} +5 -5
  50. package/dist/Cron-sOrsPuQj.cjs.map +1 -0
  51. package/dist/{CronBuilder-C6K5AbIO.d.cts → CronBuilder-BknVTWLE.d.mts} +6 -5
  52. package/dist/{CronBuilder-s5x8V8hH.d.mts → CronBuilder-BqTTozUi.d.cts} +6 -5
  53. package/dist/{CronBuilder-BLTgwOWp.mjs → CronBuilder-ChyrDobL.mjs} +10 -5
  54. package/dist/CronBuilder-ChyrDobL.mjs.map +1 -0
  55. package/dist/{CronBuilder-BOsYnZIm.cjs → CronBuilder-Kvz1GiUp.cjs} +10 -5
  56. package/dist/CronBuilder-Kvz1GiUp.cjs.map +1 -0
  57. package/dist/{Endpoint-COGAflGh.cjs → Endpoint-Bghj0fiL.cjs} +21 -12
  58. package/dist/Endpoint-Bghj0fiL.cjs.map +1 -0
  59. package/dist/{Endpoint-C7jPJzAH.d.mts → Endpoint-C16whGI-.d.mts} +45 -13
  60. package/dist/{Endpoint-DLLZvqoh.mjs → Endpoint-DCJz2VQ_.mjs} +21 -12
  61. package/dist/Endpoint-DCJz2VQ_.mjs.map +1 -0
  62. package/dist/{Endpoint-XUMNAXYy.d.cts → Endpoint-zHPjZ35J.d.cts} +45 -13
  63. package/dist/{EndpointBuilder-t6fVEKBH.d.cts → EndpointBuilder-B5l7zQU1.d.cts} +18 -12
  64. package/dist/{EndpointBuilder-DpmUw--c.mjs → EndpointBuilder-B6xIAruu.mjs} +28 -5
  65. package/dist/EndpointBuilder-B6xIAruu.mjs.map +1 -0
  66. package/dist/{EndpointBuilder-CFtWQhcv.d.mts → EndpointBuilder-BzqR0xvt.d.mts} +18 -12
  67. package/dist/{EndpointBuilder-DUE8ETVR.cjs → EndpointBuilder-i7-4ieP_.cjs} +28 -5
  68. package/dist/EndpointBuilder-i7-4ieP_.cjs.map +1 -0
  69. package/dist/{EndpointFactory-YAR24M2i.cjs → EndpointFactory-CYTBPu_G.cjs} +41 -10
  70. package/dist/EndpointFactory-CYTBPu_G.cjs.map +1 -0
  71. package/dist/{EndpointFactory-CuJUCyvZ.mjs → EndpointFactory-CYuT-nt-.mjs} +41 -10
  72. package/dist/EndpointFactory-CYuT-nt-.mjs.map +1 -0
  73. package/dist/{EndpointFactory-DInjHvFR.d.cts → EndpointFactory-KkyIOE62.d.cts} +28 -20
  74. package/dist/{EndpointFactory-DBRGrXAy.d.mts → EndpointFactory-VnSAdwdv.d.mts} +28 -20
  75. package/dist/{Function-CbO2NZx-.cjs → Function-BCEAZFyL.cjs} +4 -5
  76. package/dist/Function-BCEAZFyL.cjs.map +1 -0
  77. package/dist/{Function-BP58p9Mp.d.cts → Function-BbLYIKLL.d.cts} +3 -4
  78. package/dist/{Function-C5mW-38v.mjs → Function-CmfMIDoS.mjs} +4 -5
  79. package/dist/Function-CmfMIDoS.mjs.map +1 -0
  80. package/dist/{Function-C98H68DW.d.mts → Function-DFRZZCC-.d.mts} +3 -4
  81. package/dist/{FunctionBuilder-DuOeWCAl.cjs → FunctionBuilder-BqivB_cc.cjs} +11 -5
  82. package/dist/FunctionBuilder-BqivB_cc.cjs.map +1 -0
  83. package/dist/{FunctionBuilder-BS1KgxA_.d.cts → FunctionBuilder-DdGjpiFT.d.cts} +6 -4
  84. package/dist/{FunctionBuilder-DBwR7jg7.d.mts → FunctionBuilder-DuktGyZc.d.mts} +6 -4
  85. package/dist/{FunctionBuilder-CosgPmMl.mjs → FunctionBuilder-QvqvEyFa.mjs} +11 -5
  86. package/dist/FunctionBuilder-QvqvEyFa.mjs.map +1 -0
  87. package/dist/{FunctionExecutionWrapper-B0V7V8YS.d.mts → FunctionExecutionWrapper-CAHR74yI.d.mts} +2 -2
  88. package/dist/{FunctionExecutionWrapper-Bx-Dl-2a.d.cts → FunctionExecutionWrapper-CRYi047B.d.cts} +2 -2
  89. package/dist/{FunctionExecutionWrapper-XGrSAAPD.mjs → FunctionExecutionWrapper-JsZIHhcl.mjs} +2 -2
  90. package/dist/{FunctionExecutionWrapper-XGrSAAPD.mjs.map → FunctionExecutionWrapper-JsZIHhcl.mjs.map} +1 -1
  91. package/dist/{FunctionExecutionWrapper-CElXEjPe.cjs → FunctionExecutionWrapper-TJxf9p4v.cjs} +2 -2
  92. package/dist/{FunctionExecutionWrapper-CElXEjPe.cjs.map → FunctionExecutionWrapper-TJxf9p4v.cjs.map} +1 -1
  93. package/dist/{HonoEndpointAdaptor-BlT1rWHV.mjs → HonoEndpointAdaptor-8eYrSFRn.mjs} +33 -16
  94. package/dist/HonoEndpointAdaptor-8eYrSFRn.mjs.map +1 -0
  95. package/dist/{HonoEndpointAdaptor-C9Xe2pRp.d.mts → HonoEndpointAdaptor-DAsZoX2a.d.mts} +5 -4
  96. package/dist/{HonoEndpointAdaptor-CGSqpnCD.d.cts → HonoEndpointAdaptor-lYw6EN1Q.d.cts} +5 -4
  97. package/dist/{HonoEndpointAdaptor-Ds433Q8w.cjs → HonoEndpointAdaptor-vWSpXdNp.cjs} +20 -3
  98. package/dist/HonoEndpointAdaptor-vWSpXdNp.cjs.map +1 -0
  99. package/dist/{Subscriber-G7EUI3yc.cjs → Subscriber-BdiqU7da.cjs} +2 -2
  100. package/dist/{Subscriber-G7EUI3yc.cjs.map → Subscriber-BdiqU7da.cjs.map} +1 -1
  101. package/dist/{Subscriber-BoFm12i_.d.cts → Subscriber-Cy28j8MS.d.cts} +2 -2
  102. package/dist/{Subscriber-BTwKnz3c.mjs → Subscriber-bJSqvjdK.mjs} +2 -2
  103. package/dist/{Subscriber-BTwKnz3c.mjs.map → Subscriber-bJSqvjdK.mjs.map} +1 -1
  104. package/dist/{Subscriber-BxH6n8zQ.d.mts → Subscriber-g3IWM1_d.d.mts} +2 -2
  105. package/dist/{SubscriberBuilder-BpSDPzBz.d.mts → SubscriberBuilder-BzK8kc2a.d.cts} +3 -3
  106. package/dist/{SubscriberBuilder-C1me_972.mjs → SubscriberBuilder-CyCyjT6L.mjs} +2 -2
  107. package/dist/{SubscriberBuilder-C1me_972.mjs.map → SubscriberBuilder-CyCyjT6L.mjs.map} +1 -1
  108. package/dist/{SubscriberBuilder-C6iZvuDe.cjs → SubscriberBuilder-JTJcIZYy.cjs} +2 -2
  109. package/dist/{SubscriberBuilder-C6iZvuDe.cjs.map → SubscriberBuilder-JTJcIZYy.cjs.map} +1 -1
  110. package/dist/{SubscriberBuilder-DgljKtYu.d.cts → SubscriberBuilder-YjQ7qIpQ.d.mts} +3 -3
  111. package/dist/{TestEndpointAdaptor-BG6fzAOx.mjs → TestEndpointAdaptor-BevV2LLd.mjs} +33 -7
  112. package/dist/TestEndpointAdaptor-BevV2LLd.mjs.map +1 -0
  113. package/dist/{TestEndpointAdaptor-Db0cm1fb.d.mts → TestEndpointAdaptor-DGWuai69.d.mts} +10 -4
  114. package/dist/{TestEndpointAdaptor-BaQaTy_1.cjs → TestEndpointAdaptor-DupnzEnS.cjs} +33 -7
  115. package/dist/TestEndpointAdaptor-DupnzEnS.cjs.map +1 -0
  116. package/dist/{TestEndpointAdaptor-v7A-7hTs.d.cts → TestEndpointAdaptor-uXliWYjS.d.cts} +10 -4
  117. package/dist/adaptors/aws.cjs +11 -11
  118. package/dist/adaptors/aws.d.cts +14 -13
  119. package/dist/adaptors/aws.d.mts +14 -13
  120. package/dist/adaptors/aws.mjs +11 -11
  121. package/dist/adaptors/hono.cjs +8 -8
  122. package/dist/adaptors/hono.d.cts +8 -7
  123. package/dist/adaptors/hono.d.mts +8 -7
  124. package/dist/adaptors/hono.mjs +8 -8
  125. package/dist/adaptors/testing.cjs +7 -7
  126. package/dist/adaptors/testing.d.cts +8 -7
  127. package/dist/adaptors/testing.d.mts +8 -7
  128. package/dist/adaptors/testing.mjs +7 -7
  129. package/dist/crons/Cron.cjs +6 -6
  130. package/dist/crons/Cron.d.cts +6 -6
  131. package/dist/crons/Cron.d.mts +6 -6
  132. package/dist/crons/Cron.mjs +6 -6
  133. package/dist/crons/CronBuilder.cjs +7 -7
  134. package/dist/crons/CronBuilder.d.cts +7 -7
  135. package/dist/crons/CronBuilder.d.mts +7 -7
  136. package/dist/crons/CronBuilder.mjs +7 -7
  137. package/dist/crons/index.cjs +7 -7
  138. package/dist/crons/index.d.cts +11 -11
  139. package/dist/crons/index.d.mts +7 -7
  140. package/dist/crons/index.mjs +7 -7
  141. package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.cjs +7 -7
  142. package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.d.cts +8 -7
  143. package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.d.mts +8 -7
  144. package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.mjs +7 -7
  145. package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.cjs +8 -8
  146. package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.d.cts +9 -8
  147. package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.d.mts +9 -8
  148. package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.mjs +8 -8
  149. package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.cjs +8 -8
  150. package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.d.cts +9 -8
  151. package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.d.mts +9 -8
  152. package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.mjs +8 -8
  153. package/dist/endpoints/Authorizer.cjs +15 -0
  154. package/dist/endpoints/Authorizer.cjs.map +1 -0
  155. package/dist/endpoints/Authorizer.d.cts +2 -0
  156. package/dist/endpoints/Authorizer.d.mts +2 -0
  157. package/dist/endpoints/Authorizer.mjs +14 -0
  158. package/dist/endpoints/Authorizer.mjs.map +1 -0
  159. package/dist/endpoints/Endpoint.cjs +6 -6
  160. package/dist/endpoints/Endpoint.d.cts +7 -6
  161. package/dist/endpoints/Endpoint.d.mts +7 -6
  162. package/dist/endpoints/Endpoint.mjs +6 -6
  163. package/dist/endpoints/EndpointBuilder.cjs +7 -7
  164. package/dist/endpoints/EndpointBuilder.d.cts +8 -7
  165. package/dist/endpoints/EndpointBuilder.d.mts +8 -7
  166. package/dist/endpoints/EndpointBuilder.mjs +7 -7
  167. package/dist/endpoints/EndpointFactory.cjs +8 -8
  168. package/dist/endpoints/EndpointFactory.d.cts +9 -8
  169. package/dist/endpoints/EndpointFactory.d.mts +9 -8
  170. package/dist/endpoints/EndpointFactory.mjs +8 -8
  171. package/dist/endpoints/HonoEndpointAdaptor.cjs +8 -8
  172. package/dist/endpoints/HonoEndpointAdaptor.d.cts +8 -7
  173. package/dist/endpoints/HonoEndpointAdaptor.d.mts +8 -7
  174. package/dist/endpoints/HonoEndpointAdaptor.mjs +8 -8
  175. package/dist/endpoints/TestEndpointAdaptor.cjs +7 -7
  176. package/dist/endpoints/TestEndpointAdaptor.d.cts +9 -8
  177. package/dist/endpoints/TestEndpointAdaptor.d.mts +9 -8
  178. package/dist/endpoints/TestEndpointAdaptor.mjs +7 -7
  179. package/dist/endpoints/helpers.cjs +7 -7
  180. package/dist/endpoints/helpers.d.cts +7 -6
  181. package/dist/endpoints/helpers.d.mts +7 -6
  182. package/dist/endpoints/helpers.mjs +7 -7
  183. package/dist/endpoints/index.cjs +8 -8
  184. package/dist/endpoints/index.d.cts +11 -10
  185. package/dist/endpoints/index.d.mts +11 -10
  186. package/dist/endpoints/index.mjs +8 -8
  187. package/dist/functions/AWSLambdaFunction.cjs +6 -6
  188. package/dist/functions/AWSLambdaFunction.d.cts +4 -4
  189. package/dist/functions/AWSLambdaFunction.d.mts +4 -4
  190. package/dist/functions/AWSLambdaFunction.mjs +6 -6
  191. package/dist/functions/BaseFunctionBuilder.cjs +2 -2
  192. package/dist/functions/BaseFunctionBuilder.d.cts +2 -2
  193. package/dist/functions/BaseFunctionBuilder.d.mts +2 -2
  194. package/dist/functions/BaseFunctionBuilder.mjs +2 -2
  195. package/dist/functions/Function.cjs +2 -2
  196. package/dist/functions/Function.d.cts +2 -2
  197. package/dist/functions/Function.d.mts +2 -2
  198. package/dist/functions/Function.mjs +2 -2
  199. package/dist/functions/FunctionBuilder.cjs +4 -4
  200. package/dist/functions/FunctionBuilder.d.cts +4 -4
  201. package/dist/functions/FunctionBuilder.d.mts +4 -4
  202. package/dist/functions/FunctionBuilder.mjs +4 -4
  203. package/dist/functions/FunctionExecutionWrapper.cjs +5 -5
  204. package/dist/functions/FunctionExecutionWrapper.d.cts +3 -3
  205. package/dist/functions/FunctionExecutionWrapper.d.mts +3 -3
  206. package/dist/functions/FunctionExecutionWrapper.mjs +5 -5
  207. package/dist/functions/TestFunctionAdaptor.cjs +4 -4
  208. package/dist/functions/TestFunctionAdaptor.d.cts +2 -2
  209. package/dist/functions/TestFunctionAdaptor.d.mts +2 -2
  210. package/dist/functions/TestFunctionAdaptor.mjs +4 -4
  211. package/dist/functions/index.cjs +5 -5
  212. package/dist/functions/index.d.cts +5 -5
  213. package/dist/functions/index.d.mts +5 -5
  214. package/dist/functions/index.mjs +5 -5
  215. package/dist/{functions-DVDb5wEA.cjs → functions-B9mEg9D9.cjs} +2 -2
  216. package/dist/{functions-DVDb5wEA.cjs.map → functions-B9mEg9D9.cjs.map} +1 -1
  217. package/dist/functions-DcQZSOHg.mjs +8 -0
  218. package/dist/{functions-mM-jcphA.mjs.map → functions-DcQZSOHg.mjs.map} +1 -1
  219. package/dist/{helpers-go4jiRvV.cjs → helpers-BJrzAmhb.cjs} +2 -2
  220. package/dist/{helpers-go4jiRvV.cjs.map → helpers-BJrzAmhb.cjs.map} +1 -1
  221. package/dist/{helpers-CM0U-4Vk.mjs → helpers-D_UKinz8.mjs} +2 -2
  222. package/dist/{helpers-CM0U-4Vk.mjs.map → helpers-D_UKinz8.mjs.map} +1 -1
  223. package/dist/index-DQt3pQtF.d.mts +9 -0
  224. package/dist/index-Dq-LQIwK.d.cts +9 -0
  225. package/dist/index.cjs +1 -1
  226. package/dist/index.d.cts +1 -1
  227. package/dist/index.d.mts +1 -1
  228. package/dist/index.mjs +1 -1
  229. package/dist/publisher.d.cts +1 -1
  230. package/dist/publisher.d.mts +1 -1
  231. package/dist/subscribers/AWSLambdaSubscriberAdaptor.d.cts +3 -3
  232. package/dist/subscribers/AWSLambdaSubscriberAdaptor.d.mts +3 -3
  233. package/dist/subscribers/Subscriber.cjs +2 -2
  234. package/dist/subscribers/Subscriber.d.cts +2 -2
  235. package/dist/subscribers/Subscriber.d.mts +2 -2
  236. package/dist/subscribers/Subscriber.mjs +2 -2
  237. package/dist/subscribers/SubscriberBuilder.cjs +3 -3
  238. package/dist/subscribers/SubscriberBuilder.d.cts +3 -3
  239. package/dist/subscribers/SubscriberBuilder.d.mts +3 -3
  240. package/dist/subscribers/SubscriberBuilder.mjs +3 -3
  241. package/dist/subscribers/index.cjs +3 -3
  242. package/dist/subscribers/index.d.cts +5 -5
  243. package/dist/subscribers/index.d.mts +5 -5
  244. package/dist/subscribers/index.mjs +3 -3
  245. package/package.json +5 -5
  246. package/src/Construct.ts +2 -0
  247. package/src/crons/Cron.ts +2 -0
  248. package/src/crons/CronBuilder.ts +8 -0
  249. package/src/crons/__tests__/CronBuilder.state-isolation.spec.ts +227 -0
  250. package/src/endpoints/Authorizer.ts +34 -0
  251. package/src/endpoints/Endpoint.ts +67 -14
  252. package/src/endpoints/EndpointBuilder.ts +79 -12
  253. package/src/endpoints/EndpointFactory.ts +106 -27
  254. package/src/endpoints/HonoEndpointAdaptor.ts +29 -0
  255. package/src/endpoints/TestEndpointAdaptor.ts +75 -14
  256. package/src/endpoints/__tests__/Endpoint.cookies.spec.ts +85 -0
  257. package/src/endpoints/__tests__/Endpoint.headers.spec.ts +187 -0
  258. package/src/endpoints/__tests__/Endpoint.manifest.spec.ts +176 -0
  259. package/src/endpoints/__tests__/EndpointFactory.authorizers.spec.ts +259 -0
  260. package/src/endpoints/__tests__/EndpointFactory.reference-audit.spec.ts +190 -0
  261. package/src/endpoints/__tests__/EndpointFactory.state-isolation.spec.ts +155 -0
  262. package/src/endpoints/__tests__/TestEndpointAdaptor.spec.ts +309 -42
  263. package/src/functions/Function.ts +12 -2
  264. package/src/functions/FunctionBuilder.ts +9 -0
  265. package/src/functions/__tests__/FunctionBuilder.state-isolation.spec.ts +160 -0
  266. package/dist/Construct-BSEs6uwW.cjs.map +0 -1
  267. package/dist/Construct-BbKCIPQm.mjs.map +0 -1
  268. package/dist/Cron-D6MyCqby.cjs.map +0 -1
  269. package/dist/Cron-z0RiwSnT.mjs.map +0 -1
  270. package/dist/CronBuilder-BLTgwOWp.mjs.map +0 -1
  271. package/dist/CronBuilder-BOsYnZIm.cjs.map +0 -1
  272. package/dist/Endpoint-COGAflGh.cjs.map +0 -1
  273. package/dist/Endpoint-DLLZvqoh.mjs.map +0 -1
  274. package/dist/EndpointBuilder-DUE8ETVR.cjs.map +0 -1
  275. package/dist/EndpointBuilder-DpmUw--c.mjs.map +0 -1
  276. package/dist/EndpointFactory-CuJUCyvZ.mjs.map +0 -1
  277. package/dist/EndpointFactory-YAR24M2i.cjs.map +0 -1
  278. package/dist/Function-C5mW-38v.mjs.map +0 -1
  279. package/dist/Function-CbO2NZx-.cjs.map +0 -1
  280. package/dist/FunctionBuilder-CosgPmMl.mjs.map +0 -1
  281. package/dist/FunctionBuilder-DuOeWCAl.cjs.map +0 -1
  282. package/dist/HonoEndpointAdaptor-BlT1rWHV.mjs.map +0 -1
  283. package/dist/HonoEndpointAdaptor-Ds433Q8w.cjs.map +0 -1
  284. package/dist/TestEndpointAdaptor-BG6fzAOx.mjs.map +0 -1
  285. package/dist/TestEndpointAdaptor-BaQaTy_1.cjs.map +0 -1
  286. package/dist/functions-mM-jcphA.mjs +0 -8
  287. package/dist/index-BXTN4mwI.d.mts +0 -9
  288. package/dist/index-BxApEwAF.d.cts +0 -9
@@ -393,28 +393,19 @@ describe('TestEndpointAdaptor', () => {
393
393
  });
394
394
 
395
395
  const adapter = new TestEndpointAdaptor(endpoint);
396
- const result = await adapter.request({
396
+ const result = await adapter.fullRequest({
397
397
  body: { email: 'test@example.com', password: 'pass123' },
398
398
  services: mockServices,
399
399
  headers: { host: 'example.com' },
400
400
  });
401
401
 
402
- expect(result).toHaveProperty('data');
403
- expect(result).toHaveProperty('metadata');
404
- expect((result as any).data).toEqual({
402
+ expect(result.body).toEqual({
405
403
  id: 'user-1',
406
404
  email: 'test@example.com',
407
405
  });
408
- expect((result as any).metadata.cookies?.has('session')).toBe(true);
409
- expect((result as any).metadata.cookies?.get('session')).toEqual({
410
- value: 'abc123',
411
- options: {
412
- httpOnly: true,
413
- secure: true,
414
- sameSite: 'strict',
415
- maxAge: 3600,
416
- },
417
- });
406
+ expect(result.headers['set-cookie']).toEqual([
407
+ 'session=abc123; Max-Age=3600; HttpOnly; Secure; SameSite=strict',
408
+ ]);
418
409
  });
419
410
 
420
411
  it('should set custom response headers', async () => {
@@ -431,17 +422,17 @@ describe('TestEndpointAdaptor', () => {
431
422
  });
432
423
 
433
424
  const adapter = new TestEndpointAdaptor(endpoint);
434
- const result = await adapter.request({
425
+ const result = await adapter.fullRequest({
435
426
  body: { name: 'John Doe' },
436
427
  services: mockServices,
437
428
  headers: { host: 'example.com' },
438
429
  });
439
430
 
440
- expect((result as any).data).toEqual({
431
+ expect(result.body).toEqual({
441
432
  id: 'user-123',
442
433
  name: 'John Doe',
443
434
  });
444
- expect((result as any).metadata.headers).toEqual({
435
+ expect(result.headers).toEqual({
445
436
  Location: '/users/user-123',
446
437
  'X-User-Id': 'user-123',
447
438
  });
@@ -457,13 +448,13 @@ describe('TestEndpointAdaptor', () => {
457
448
  });
458
449
 
459
450
  const adapter = new TestEndpointAdaptor(endpoint);
460
- const result = await adapter.request({
451
+ const result = await adapter.fullRequest({
461
452
  body: { name: 'Resource' },
462
453
  services: mockServices,
463
454
  headers: { host: 'example.com' },
464
455
  });
465
456
 
466
- expect((result as any).metadata.status).toBe(201);
457
+ expect(result.status).toBe(201);
467
458
  });
468
459
 
469
460
  it('should delete cookies', async () => {
@@ -477,16 +468,17 @@ describe('TestEndpointAdaptor', () => {
477
468
  });
478
469
 
479
470
  const adapter = new TestEndpointAdaptor(endpoint);
480
- const result = await adapter.request({
471
+ const result = await adapter.fullRequest({
481
472
  services: mockServices,
482
473
  headers: { host: 'example.com' },
483
474
  });
484
475
 
485
- expect((result as any).data.success).toBe(true);
486
- const sessionCookie = (result as any).metadata.cookies?.get('session');
487
- expect(sessionCookie?.value).toBe('');
488
- expect(sessionCookie?.options?.maxAge).toBe(0);
489
- expect(sessionCookie?.options?.path).toBe('/');
476
+ expect(result.body.success).toBe(true);
477
+ const setCookieHeader = result.headers['set-cookie'] as string[];
478
+ expect(setCookieHeader).toHaveLength(1);
479
+ expect(setCookieHeader[0]).toContain('session=');
480
+ expect(setCookieHeader[0]).toContain('Max-Age=0');
481
+ expect(setCookieHeader[0]).toContain('Path=/');
490
482
  });
491
483
 
492
484
  it('should combine cookies, headers, and status', async () => {
@@ -505,28 +497,21 @@ describe('TestEndpointAdaptor', () => {
505
497
  });
506
498
 
507
499
  const adapter = new TestEndpointAdaptor(endpoint);
508
- const result = await adapter.request({
500
+ const result = await adapter.fullRequest({
509
501
  body: { data: 'test' },
510
502
  services: mockServices,
511
503
  headers: { host: 'example.com' },
512
504
  });
513
505
 
514
- expect((result as any).data).toEqual({
506
+ expect(result.body).toEqual({
515
507
  id: '123',
516
508
  result: 'test',
517
509
  });
518
- expect((result as any).metadata.status).toBe(201);
519
- expect((result as any).metadata.headers).toEqual({
510
+ expect(result.status).toBe(201);
511
+ expect(result.headers).toEqual({
520
512
  Location: '/complete/123',
521
513
  'X-Request-Id': 'req-456',
522
- });
523
- expect((result as any).metadata.cookies?.size).toBe(2);
524
- expect((result as any).metadata.cookies?.get('tracking')?.value).toBe(
525
- 'track-789',
526
- );
527
- expect((result as any).metadata.cookies?.get('preference')).toEqual({
528
- value: 'dark',
529
- options: { maxAge: 86400 },
514
+ 'set-cookie': ['tracking=track-789', 'preference=dark; Max-Age=86400'],
530
515
  });
531
516
  });
532
517
 
@@ -564,7 +549,7 @@ describe('TestEndpointAdaptor', () => {
564
549
  });
565
550
 
566
551
  const adapter = new TestEndpointAdaptor(endpoint);
567
- const result = await adapter.request({
552
+ const result = await adapter.fullRequest({
568
553
  services: mockServices,
569
554
  headers: {
570
555
  host: 'example.com',
@@ -572,13 +557,295 @@ describe('TestEndpointAdaptor', () => {
572
557
  },
573
558
  });
574
559
 
575
- expect((result as any).data).toEqual({
560
+ expect(result.body).toEqual({
576
561
  theme: 'dark',
577
562
  updated: true,
578
563
  });
579
- expect((result as any).metadata.cookies?.get('theme')?.value).toBe(
580
- 'dark',
581
- );
564
+ expect(result.headers['set-cookie']).toEqual([
565
+ 'theme=dark; Max-Age=86400',
566
+ ]);
567
+ });
568
+ });
569
+
570
+ describe('fullRequest', () => {
571
+ it('should return full HTTP response with body, status, and headers', async () => {
572
+ const endpoint = e
573
+ .get('/test')
574
+ .output(z.object({ message: z.string() }))
575
+ .handle(() => ({ message: 'Hello World' }));
576
+
577
+ const adapter = new TestEndpointAdaptor(endpoint);
578
+
579
+ const result = await adapter.fullRequest({
580
+ services: mockServices,
581
+ headers: { host: 'example.com' },
582
+ });
583
+
584
+ expect(result).toEqual({
585
+ body: { message: 'Hello World' },
586
+ status: 200,
587
+ headers: {},
588
+ });
589
+ });
590
+
591
+ it('should return custom status code in HTTP response', async () => {
592
+ const endpoint = e
593
+ .post('/resources')
594
+ .body(z.object({ name: z.string() }))
595
+ .output(z.object({ id: z.string() }))
596
+ .handle(async (ctx, response) => {
597
+ return response.status(SuccessStatus.Created).send({ id: '123' });
598
+ });
599
+
600
+ const adapter = new TestEndpointAdaptor(endpoint);
601
+ const result = await adapter.fullRequest({
602
+ body: { name: 'Resource' },
603
+ services: mockServices,
604
+ headers: { host: 'example.com' },
605
+ });
606
+
607
+ expect(result.status).toBe(201);
608
+ expect(result.body).toEqual({ id: '123' });
609
+ });
610
+
611
+ it('should include custom headers in HTTP response', async () => {
612
+ const endpoint = e
613
+ .post('/users')
614
+ .body(z.object({ name: z.string() }))
615
+ .output(z.object({ id: z.string(), name: z.string() }))
616
+ .handle(async ({ body }, response) => {
617
+ const user = { id: 'user-123', name: body.name };
618
+ return response
619
+ .header('Location', `/users/${user.id}`)
620
+ .header('X-User-Id', user.id)
621
+ .send(user);
622
+ });
623
+
624
+ const adapter = new TestEndpointAdaptor(endpoint);
625
+ const result = await adapter.fullRequest({
626
+ body: { name: 'John Doe' },
627
+ services: mockServices,
628
+ headers: { host: 'example.com' },
629
+ });
630
+
631
+ expect(result.body).toEqual({
632
+ id: 'user-123',
633
+ name: 'John Doe',
634
+ });
635
+ expect(result.headers).toEqual({
636
+ Location: '/users/user-123',
637
+ 'X-User-Id': 'user-123',
638
+ });
639
+ });
640
+
641
+ it('should convert cookies to Set-Cookie headers', async () => {
642
+ const endpoint = e
643
+ .post('/auth/login')
644
+ .body(z.object({ email: z.string(), password: z.string() }))
645
+ .output(z.object({ id: z.string(), email: z.string() }))
646
+ .handle(async ({ body }, response) => {
647
+ return response
648
+ .cookie('session', 'abc123', {
649
+ httpOnly: true,
650
+ secure: true,
651
+ sameSite: 'strict',
652
+ maxAge: 3600,
653
+ })
654
+ .send({ id: 'user-1', email: body.email });
655
+ });
656
+
657
+ const adapter = new TestEndpointAdaptor(endpoint);
658
+ const result = await adapter.fullRequest({
659
+ body: { email: 'test@example.com', password: 'pass123' },
660
+ services: mockServices,
661
+ headers: { host: 'example.com' },
662
+ });
663
+
664
+ expect(result.body).toEqual({
665
+ id: 'user-1',
666
+ email: 'test@example.com',
667
+ });
668
+ expect(result.headers['set-cookie']).toEqual([
669
+ 'session=abc123; Max-Age=3600; HttpOnly; Secure; SameSite=strict',
670
+ ]);
671
+ });
672
+
673
+ it('should handle multiple cookies as array of Set-Cookie headers', async () => {
674
+ const endpoint = e
675
+ .post('/complete')
676
+ .body(z.object({ data: z.string() }))
677
+ .output(z.object({ id: z.string(), result: z.string() }))
678
+ .handle(async ({ body }, response) => {
679
+ return response
680
+ .cookie('tracking', 'track-789')
681
+ .cookie('preference', 'dark', { maxAge: 86400, path: '/' })
682
+ .send({ id: '123', result: body.data });
683
+ });
684
+
685
+ const adapter = new TestEndpointAdaptor(endpoint);
686
+ const result = await adapter.fullRequest({
687
+ body: { data: 'test' },
688
+ services: mockServices,
689
+ headers: { host: 'example.com' },
690
+ });
691
+
692
+ expect(result.headers['set-cookie']).toEqual([
693
+ 'tracking=track-789',
694
+ 'preference=dark; Max-Age=86400; Path=/',
695
+ ]);
696
+ });
697
+
698
+ it('should serialize all cookie options correctly', async () => {
699
+ const expires = new Date('2025-12-31T23:59:59Z');
700
+ const endpoint = e
701
+ .get('/cookies-full')
702
+ .output(z.object({ success: z.boolean() }))
703
+ .handle(async (ctx, response) => {
704
+ return response
705
+ .cookie('full-cookie', 'value123', {
706
+ domain: 'example.com',
707
+ path: '/api',
708
+ expires: expires,
709
+ maxAge: 7200,
710
+ httpOnly: true,
711
+ secure: true,
712
+ sameSite: 'lax',
713
+ })
714
+ .send({ success: true });
715
+ });
716
+
717
+ const adapter = new TestEndpointAdaptor(endpoint);
718
+ const result = await adapter.fullRequest({
719
+ services: mockServices,
720
+ headers: { host: 'example.com' },
721
+ });
722
+
723
+ expect(result.headers['set-cookie']).toEqual([
724
+ `full-cookie=value123; Max-Age=7200; Expires=${expires.toUTCString()}; Domain=example.com; Path=/api; HttpOnly; Secure; SameSite=lax`,
725
+ ]);
726
+ });
727
+
728
+ it('should handle cookie deletion in Set-Cookie header', async () => {
729
+ const endpoint = e
730
+ .post('/auth/logout')
731
+ .output(z.object({ success: z.boolean() }))
732
+ .handle(async (ctx, response) => {
733
+ return response
734
+ .deleteCookie('session', { path: '/' })
735
+ .send({ success: true });
736
+ });
737
+
738
+ const adapter = new TestEndpointAdaptor(endpoint);
739
+ const result = await adapter.fullRequest({
740
+ services: mockServices,
741
+ headers: { host: 'example.com' },
742
+ });
743
+
744
+ expect(result.body.success).toBe(true);
745
+ const setCookieHeader = result.headers['set-cookie'] as string[];
746
+ expect(setCookieHeader).toHaveLength(1);
747
+ expect(setCookieHeader[0]).toContain('session=');
748
+ expect(setCookieHeader[0]).toContain('Max-Age=0');
749
+ expect(setCookieHeader[0]).toContain('Path=/');
750
+ expect(setCookieHeader[0]).toContain('Expires=');
751
+ });
752
+
753
+ it('should combine headers and cookies in HTTP response', async () => {
754
+ const endpoint = e
755
+ .post('/complete')
756
+ .body(z.object({ data: z.string() }))
757
+ .output(z.object({ id: z.string(), result: z.string() }))
758
+ .handle(async ({ body }, response) => {
759
+ return response
760
+ .status(SuccessStatus.Created)
761
+ .header('Location', '/complete/123')
762
+ .header('X-Request-Id', 'req-456')
763
+ .cookie('tracking', 'track-789')
764
+ .cookie('preference', 'dark', { maxAge: 86400 })
765
+ .send({ id: '123', result: body.data });
766
+ });
767
+
768
+ const adapter = new TestEndpointAdaptor(endpoint);
769
+ const result = await adapter.fullRequest({
770
+ body: { data: 'test' },
771
+ services: mockServices,
772
+ headers: { host: 'example.com' },
773
+ });
774
+
775
+ expect(result).toEqual({
776
+ body: { id: '123', result: 'test' },
777
+ status: 201,
778
+ headers: {
779
+ Location: '/complete/123',
780
+ 'X-Request-Id': 'req-456',
781
+ 'set-cookie': [
782
+ 'tracking=track-789',
783
+ 'preference=dark; Max-Age=86400',
784
+ ],
785
+ },
786
+ });
787
+ });
788
+
789
+ it('should handle empty response metadata', async () => {
790
+ const endpoint = e
791
+ .get('/simple')
792
+ .output(z.object({ message: z.string() }))
793
+ .handle(async () => ({ message: 'Hello' }));
794
+
795
+ const adapter = new TestEndpointAdaptor(endpoint);
796
+ const result = await adapter.fullRequest({
797
+ services: mockServices,
798
+ headers: { host: 'example.com' },
799
+ });
800
+
801
+ expect(result).toEqual({
802
+ body: { message: 'Hello' },
803
+ status: 200,
804
+ headers: {},
805
+ });
806
+ });
807
+ });
808
+
809
+ describe('request method delegation', () => {
810
+ it('should return only body from fullRequest', async () => {
811
+ const endpoint = e
812
+ .post('/users')
813
+ .body(z.object({ name: z.string() }))
814
+ .output(z.object({ id: z.string(), name: z.string() }))
815
+ .handle(async ({ body }, response) => {
816
+ return response
817
+ .status(SuccessStatus.Created)
818
+ .header('Location', '/users/123')
819
+ .cookie('session', 'abc')
820
+ .send({ id: '123', name: body.name });
821
+ });
822
+
823
+ const adapter = new TestEndpointAdaptor(endpoint);
824
+
825
+ // Call request (should only return body)
826
+ const simpleResult = await adapter.request({
827
+ body: { name: 'John' },
828
+ services: mockServices,
829
+ headers: { host: 'example.com' },
830
+ });
831
+
832
+ // Call fullRequest (should return full HTTP response)
833
+ const fullResult = await adapter.fullRequest({
834
+ body: { name: 'John' },
835
+ services: mockServices,
836
+ headers: { host: 'example.com' },
837
+ });
838
+
839
+ // request should only return the body
840
+ expect(simpleResult).toEqual({ id: '123', name: 'John' });
841
+ expect(simpleResult).not.toHaveProperty('status');
842
+ expect(simpleResult).not.toHaveProperty('headers');
843
+
844
+ // fullRequest should return complete HTTP response
845
+ expect(fullResult.body).toEqual({ id: '123', name: 'John' });
846
+ expect(fullResult.status).toBe(201);
847
+ expect(fullResult.headers).toHaveProperty('Location');
848
+ expect(fullResult.headers).toHaveProperty('set-cookie');
582
849
  });
583
850
  });
584
851
  });
@@ -125,7 +125,7 @@ export class Function<
125
125
 
126
126
  constructor(
127
127
  protected readonly fn: Fn,
128
- readonly timeout = 30000, // Default timeout of 30 seconds
128
+ timeout = 30000, // Default timeout of 30 seconds
129
129
  type: ConstructType = ConstructType.Function,
130
130
  public input?: TInput,
131
131
  outputSchema?: OutSchema,
@@ -133,8 +133,18 @@ export class Function<
133
133
  logger: TLogger = DEFAULT_LOGGER,
134
134
  publisherService?: Service<TEventPublisherServiceName, TEventPublisher>,
135
135
  events: MappedEvent<TEventPublisher, OutSchema>[] = [],
136
+ memorySize?: number,
136
137
  ) {
137
- super(type, logger, services, events, publisherService, outputSchema);
138
+ super(
139
+ type,
140
+ logger,
141
+ services,
142
+ events,
143
+ publisherService,
144
+ outputSchema,
145
+ timeout,
146
+ memorySize,
147
+ );
138
148
  }
139
149
  }
140
150
 
@@ -27,6 +27,8 @@ export class FunctionBuilder<
27
27
  TEventPublisher,
28
28
  TEventPublisherServiceName
29
29
  > {
30
+ protected _memorySize?: number;
31
+
30
32
  constructor(public type = ConstructType.Function) {
31
33
  super(type);
32
34
  }
@@ -36,6 +38,11 @@ export class FunctionBuilder<
36
38
  return this;
37
39
  }
38
40
 
41
+ memorySize(memorySize: number): this {
42
+ this._memorySize = memorySize;
43
+ return this;
44
+ }
45
+
39
46
  output<T extends StandardSchemaV1>(
40
47
  schema: T,
41
48
  ): FunctionBuilder<
@@ -166,6 +173,7 @@ export class FunctionBuilder<
166
173
  this._logger,
167
174
  this._publisher,
168
175
  this._events,
176
+ this._memorySize,
169
177
  );
170
178
 
171
179
  // Reset builder state after creating the function to prevent pollution
@@ -176,6 +184,7 @@ export class FunctionBuilder<
176
184
  this.inputSchema = undefined;
177
185
  this.outputSchema = undefined;
178
186
  this._timeout = undefined;
187
+ this._memorySize = undefined;
179
188
 
180
189
  return func;
181
190
  }
@@ -0,0 +1,160 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { ConsoleLogger } from '@geekmidas/logger/console';
3
+ import { FunctionBuilder } from '../FunctionBuilder';
4
+ import type { Service } from '@geekmidas/services';
5
+
6
+ const ServiceA = {
7
+ serviceName: 'a' as const,
8
+ async register() {
9
+ return { test: () => 'a' };
10
+ },
11
+ } satisfies Service<'a', any>;
12
+
13
+ const ServiceB = {
14
+ serviceName: 'b' as const,
15
+ async register() {
16
+ return { test: () => 'b' };
17
+ },
18
+ } satisfies Service<'b', any>;
19
+
20
+ describe('FunctionBuilder - State Isolation', () => {
21
+ describe('singleton instance state reset', () => {
22
+ it('should reset services after handle() is called', () => {
23
+ const f = new FunctionBuilder();
24
+
25
+ // First function with ServiceA and ServiceB
26
+ const fn1 = f.services([ServiceA, ServiceB]).handle(async () => ({}));
27
+
28
+ // Second function should not have any services from first
29
+ const fn2 = f.handle(async () => ({}));
30
+
31
+ expect(fn1.services.map((s) => s.serviceName)).toEqual(['a', 'b']);
32
+ expect(fn2.services.map((s) => s.serviceName)).toEqual([]);
33
+ });
34
+
35
+ it('should reset logger after handle() is called', () => {
36
+ const f = new FunctionBuilder();
37
+ const customLogger = new ConsoleLogger({ app: 'custom' });
38
+
39
+ // First function with custom logger
40
+ const fn1 = f.logger(customLogger).handle(async () => ({}));
41
+
42
+ // Second function should have default logger (not the custom one)
43
+ const fn2 = f.handle(async () => ({}));
44
+
45
+ expect(fn1.logger).toBe(customLogger);
46
+ expect(fn2.logger).not.toBe(customLogger);
47
+ expect(fn2.logger).toBeInstanceOf(ConsoleLogger);
48
+ });
49
+
50
+ it('should reset events after handle() is called', () => {
51
+ const f = new FunctionBuilder();
52
+
53
+ // Create first function (events array should be empty initially)
54
+ const fn1 = f.handle(async () => ({}));
55
+
56
+ // Verify state was reset
57
+ expect((f as any)._events).toEqual([]);
58
+ expect((f as any)._services).toEqual([]);
59
+ });
60
+
61
+ it('should reset input/output schemas after handle() is called', () => {
62
+ const f = new FunctionBuilder();
63
+ const inputSchema: any = { '~standard': { validate: () => ({}) } };
64
+ const outputSchema: any = { '~standard': { validate: () => ({}) } };
65
+
66
+ // First function with schemas
67
+ const fn1 = f.input(inputSchema).output(outputSchema).handle(async () => ({}));
68
+
69
+ // Second function should not have schemas
70
+ const fn2 = f.handle(async () => ({}));
71
+
72
+ expect(fn1.input).toBe(inputSchema);
73
+ expect(fn1.outputSchema).toBe(outputSchema);
74
+ expect(fn2.input).toBeUndefined();
75
+ expect(fn2.outputSchema).toBeUndefined();
76
+ });
77
+
78
+ it('should reset timeout after handle() is called', () => {
79
+ const f = new FunctionBuilder();
80
+
81
+ // First function with custom timeout
82
+ const fn1 = f.timeout(5000).handle(async () => ({}));
83
+
84
+ // Second function should have default timeout (30000)
85
+ const fn2 = f.handle(async () => ({}));
86
+
87
+ expect(fn1.timeout).toBe(5000);
88
+ expect(fn2.timeout).toBe(30000); // Default timeout
89
+ });
90
+ });
91
+
92
+ describe('method chaining before handle()', () => {
93
+ it('should accumulate services when chaining', () => {
94
+ const f = new FunctionBuilder();
95
+
96
+ const fn = f
97
+ .services([ServiceA])
98
+ .services([ServiceB])
99
+ .handle(async () => ({}));
100
+
101
+ expect(fn.services.map((s) => s.serviceName)).toEqual(['a', 'b']);
102
+ });
103
+
104
+ it('should not share references between different builder chains', () => {
105
+ const f = new FunctionBuilder();
106
+
107
+ // Start two separate chains
108
+ const builder1 = f.services([ServiceA]);
109
+ const builder2 = f.services([ServiceB]);
110
+
111
+ // They should be the same instance (singleton)
112
+ expect(builder1).toBe(builder2);
113
+ expect(builder1).toBe(f);
114
+
115
+ // But after handle, state is reset
116
+ const fn1 = builder1.handle(async () => ({}));
117
+
118
+ // Now builder2 should have reset state
119
+ expect((builder2 as any)._services).toEqual([]);
120
+
121
+ // Add services again
122
+ const fn2 = builder2.services([ServiceB]).handle(async () => ({}));
123
+
124
+ expect(fn1.services.map((s) => s.serviceName)).toEqual(['a', 'b']);
125
+ expect(fn2.services.map((s) => s.serviceName)).toEqual(['b']);
126
+ });
127
+ });
128
+
129
+ describe('sequential function creation', () => {
130
+ it('should create independent functions sequentially', () => {
131
+ const f = new FunctionBuilder();
132
+
133
+ const fn1 = f.services([ServiceA, ServiceB]).handle(async () => ({ result: 1 }));
134
+ const fn2 = f.services([ServiceA]).handle(async () => ({ result: 2 }));
135
+ const fn3 = f.handle(async () => ({ result: 3 }));
136
+
137
+ expect(fn1.services.map((s) => s.serviceName)).toEqual(['a', 'b']);
138
+ expect(fn2.services.map((s) => s.serviceName)).toEqual(['a']);
139
+ expect(fn3.services.map((s) => s.serviceName)).toEqual([]);
140
+ });
141
+ });
142
+
143
+ describe('publisher isolation', () => {
144
+ it('should reset publisher after handle() is called', () => {
145
+ const f = new FunctionBuilder();
146
+ const mockPublisher: any = {
147
+ serviceName: 'publisher',
148
+ async register() {
149
+ return { publish: () => {} };
150
+ },
151
+ };
152
+
153
+ const fn1 = f.publisher(mockPublisher).handle(async () => ({}));
154
+ const fn2 = f.handle(async () => ({}));
155
+
156
+ expect((fn1 as any).publisherService).toBe(mockPublisher);
157
+ expect((fn2 as any).publisherService).toBeUndefined();
158
+ });
159
+ });
160
+ });
@@ -1 +0,0 @@
1
- {"version":3,"file":"Construct-BSEs6uwW.cjs","names":["type: ConstructType","logger: TLogger","services: TServices","events: MappedEvent<T, any>[]","publisherService?: Service<TServiceName, T>","outputSchema?: OutSchema","EnvironmentParser","services: Service[]","v: string"],"sources":["../src/Construct.ts"],"sourcesContent":["import { EnvironmentParser } from '@geekmidas/envkit';\nimport type { EventPublisher, MappedEvent } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport compact from 'lodash.compact';\n\nexport abstract class Construct<\n TLogger extends Logger = Logger,\n TServiceName extends string = string,\n T extends EventPublisher<any> | undefined = undefined,\n OutSchema extends StandardSchemaV1 | undefined = undefined,\n TServices extends Service[] = [],\n> {\n constructor(\n public readonly type: ConstructType,\n public readonly logger: TLogger,\n public readonly services: TServices,\n public readonly events: MappedEvent<T, any>[] = [],\n\n public readonly publisherService?: Service<TServiceName, T>,\n public outputSchema?: OutSchema,\n ) {}\n\n /**\n * Returns an array of environment variable names required by this construct's services.\n * This is determined by running a \"sniffer\" EnvironmentParser through each service's\n * register method to track which environment variables are accessed.\n *\n * @returns Promise that resolves to array of environment variable names, sorted alphabetically\n *\n * @example\n * ```typescript\n * const endpoint = e\n * .services([databaseService, authService])\n * .get('/users')\n * .handle(async () => []);\n *\n * const envVars = await endpoint.getEnvironment(); // ['AUTH_SECRET', 'DATABASE_URL']\n * ```\n */\n async getEnvironment(): Promise<string[]> {\n const envVars = new Set<string>();\n const sniffer = new EnvironmentParser({});\n const services: Service[] = compact([\n ...this.services,\n this.publisherService,\n ]);\n\n try {\n // Run each service's register method with the sniffer to track env var access\n for (const service of services) {\n try {\n const config = service.register(sniffer);\n\n // Await if it's a Promise (async services)\n const resolvedConfig =\n config && typeof config === 'object' && 'then' in config\n ? await Promise.resolve(config)\n : config;\n\n // If register returns a ConfigParser, collect its env vars\n if (\n resolvedConfig &&\n typeof resolvedConfig === 'object' &&\n 'getEnvironmentVariables' in resolvedConfig &&\n typeof resolvedConfig.getEnvironmentVariables === 'function'\n ) {\n const vars = resolvedConfig.getEnvironmentVariables();\n if (Array.isArray(vars)) {\n vars.forEach((v: string) => envVars.add(v));\n }\n }\n } catch (serviceError) {\n // Service registration failed (e.g., missing env vars during .parse())\n // But env vars were already tracked during .create(), so we continue\n continue;\n }\n }\n\n return Array.from(envVars).sort();\n } catch (error) {\n console.error(\n 'Error determining environment variables for construct:',\n error,\n );\n\n return [];\n }\n }\n}\n\nexport enum ConstructType {\n Cron = 'dev.geekmidas.function.cron',\n Endpoint = 'dev.geekmidas.function.endpoint',\n Function = 'dev.geekmidas.function.function',\n Subscriber = 'dev.geekmidas.function.subscriber',\n}\n"],"mappings":";;;;;AAOA,IAAsB,YAAtB,MAME;CACA,YACkBA,MACAC,QACAC,UACAC,SAAgC,CAAE,GAElCC,kBACTC,cACP;EAPgB;EACA;EACA;EACA;EAEA;EACT;CACL;;;;;;;;;;;;;;;;;;CAmBJ,MAAM,iBAAoC;EACxC,MAAM,0BAAU,IAAI;EACpB,MAAM,UAAU,IAAIC,qCAAkB,CAAE;EACxC,MAAMC,WAAsB,4BAAQ,CAClC,GAAG,KAAK,UACR,KAAK,gBACN,EAAC;AAEF,MAAI;AAEF,QAAK,MAAM,WAAW,SACpB,KAAI;IACF,MAAM,SAAS,QAAQ,SAAS,QAAQ;IAGxC,MAAM,iBACJ,iBAAiB,WAAW,YAAY,UAAU,SAC9C,MAAM,QAAQ,QAAQ,OAAO,GAC7B;AAGN,QACE,yBACO,mBAAmB,YAC1B,6BAA6B,yBACtB,eAAe,4BAA4B,YAClD;KACA,MAAM,OAAO,eAAe,yBAAyB;AACrD,SAAI,MAAM,QAAQ,KAAK,CACrB,MAAK,QAAQ,CAACC,MAAc,QAAQ,IAAI,EAAE,CAAC;IAE9C;GACF,SAAQ,cAAc;AAGrB;GACD;AAGH,UAAO,MAAM,KAAK,QAAQ,CAAC,MAAM;EAClC,SAAQ,OAAO;AACd,WAAQ,MACN,0DACA,MACD;AAED,UAAO,CAAE;EACV;CACF;AACF;AAED,IAAY,0DAAL;AACL;AACA;AACA;AACA;;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Construct-BbKCIPQm.mjs","names":["type: ConstructType","logger: TLogger","services: TServices","events: MappedEvent<T, any>[]","publisherService?: Service<TServiceName, T>","outputSchema?: OutSchema","services: Service[]","v: string"],"sources":["../src/Construct.ts"],"sourcesContent":["import { EnvironmentParser } from '@geekmidas/envkit';\nimport type { EventPublisher, MappedEvent } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport compact from 'lodash.compact';\n\nexport abstract class Construct<\n TLogger extends Logger = Logger,\n TServiceName extends string = string,\n T extends EventPublisher<any> | undefined = undefined,\n OutSchema extends StandardSchemaV1 | undefined = undefined,\n TServices extends Service[] = [],\n> {\n constructor(\n public readonly type: ConstructType,\n public readonly logger: TLogger,\n public readonly services: TServices,\n public readonly events: MappedEvent<T, any>[] = [],\n\n public readonly publisherService?: Service<TServiceName, T>,\n public outputSchema?: OutSchema,\n ) {}\n\n /**\n * Returns an array of environment variable names required by this construct's services.\n * This is determined by running a \"sniffer\" EnvironmentParser through each service's\n * register method to track which environment variables are accessed.\n *\n * @returns Promise that resolves to array of environment variable names, sorted alphabetically\n *\n * @example\n * ```typescript\n * const endpoint = e\n * .services([databaseService, authService])\n * .get('/users')\n * .handle(async () => []);\n *\n * const envVars = await endpoint.getEnvironment(); // ['AUTH_SECRET', 'DATABASE_URL']\n * ```\n */\n async getEnvironment(): Promise<string[]> {\n const envVars = new Set<string>();\n const sniffer = new EnvironmentParser({});\n const services: Service[] = compact([\n ...this.services,\n this.publisherService,\n ]);\n\n try {\n // Run each service's register method with the sniffer to track env var access\n for (const service of services) {\n try {\n const config = service.register(sniffer);\n\n // Await if it's a Promise (async services)\n const resolvedConfig =\n config && typeof config === 'object' && 'then' in config\n ? await Promise.resolve(config)\n : config;\n\n // If register returns a ConfigParser, collect its env vars\n if (\n resolvedConfig &&\n typeof resolvedConfig === 'object' &&\n 'getEnvironmentVariables' in resolvedConfig &&\n typeof resolvedConfig.getEnvironmentVariables === 'function'\n ) {\n const vars = resolvedConfig.getEnvironmentVariables();\n if (Array.isArray(vars)) {\n vars.forEach((v: string) => envVars.add(v));\n }\n }\n } catch (serviceError) {\n // Service registration failed (e.g., missing env vars during .parse())\n // But env vars were already tracked during .create(), so we continue\n continue;\n }\n }\n\n return Array.from(envVars).sort();\n } catch (error) {\n console.error(\n 'Error determining environment variables for construct:',\n error,\n );\n\n return [];\n }\n }\n}\n\nexport enum ConstructType {\n Cron = 'dev.geekmidas.function.cron',\n Endpoint = 'dev.geekmidas.function.endpoint',\n Function = 'dev.geekmidas.function.function',\n Subscriber = 'dev.geekmidas.function.subscriber',\n}\n"],"mappings":";;;;AAOA,IAAsB,YAAtB,MAME;CACA,YACkBA,MACAC,QACAC,UACAC,SAAgC,CAAE,GAElCC,kBACTC,cACP;EAPgB;EACA;EACA;EACA;EAEA;EACT;CACL;;;;;;;;;;;;;;;;;;CAmBJ,MAAM,iBAAoC;EACxC,MAAM,0BAAU,IAAI;EACpB,MAAM,UAAU,IAAI,kBAAkB,CAAE;EACxC,MAAMC,WAAsB,QAAQ,CAClC,GAAG,KAAK,UACR,KAAK,gBACN,EAAC;AAEF,MAAI;AAEF,QAAK,MAAM,WAAW,SACpB,KAAI;IACF,MAAM,SAAS,QAAQ,SAAS,QAAQ;IAGxC,MAAM,iBACJ,iBAAiB,WAAW,YAAY,UAAU,SAC9C,MAAM,QAAQ,QAAQ,OAAO,GAC7B;AAGN,QACE,yBACO,mBAAmB,YAC1B,6BAA6B,yBACtB,eAAe,4BAA4B,YAClD;KACA,MAAM,OAAO,eAAe,yBAAyB;AACrD,SAAI,MAAM,QAAQ,KAAK,CACrB,MAAK,QAAQ,CAACC,MAAc,QAAQ,IAAI,EAAE,CAAC;IAE9C;GACF,SAAQ,cAAc;AAGrB;GACD;AAGH,UAAO,MAAM,KAAK,QAAQ,CAAC,MAAM;EAClC,SAAQ,OAAO;AACd,WAAQ,MACN,0DACA,MACD;AAED,UAAO,CAAE;EACV;CACF;AACF;AAED,IAAY,0DAAL;AACL;AACA;AACA;AACA;;AACD"}