@geekmidas/constructs 0.0.7 → 0.0.10

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 (284) hide show
  1. package/dist/{AWSLambdaFunction-CANc3Qo2.d.mts → AWSLambdaFunction-D5V3YVqv.d.cts} +5 -5
  2. package/dist/{AWSLambdaFunction-DWIZYsCy.mjs → AWSLambdaFunction-D_V-ZQmS.mjs} +3 -3
  3. package/dist/{AWSLambdaFunction-DWIZYsCy.mjs.map → AWSLambdaFunction-D_V-ZQmS.mjs.map} +1 -1
  4. package/dist/{AWSLambdaFunction-qA5LqPsv.cjs → AWSLambdaFunction-DhUb-Vs6.cjs} +3 -3
  5. package/dist/{AWSLambdaFunction-qA5LqPsv.cjs.map → AWSLambdaFunction-DhUb-Vs6.cjs.map} +1 -1
  6. package/dist/{AWSLambdaFunction-CwagvPG3.d.cts → AWSLambdaFunction-DvZcnL8a.d.mts} +5 -5
  7. package/dist/{AWSLambdaSubscriberAdaptor-QKVxR6qh.d.cts → AWSLambdaSubscriberAdaptor-D6kjKjSf.d.mts} +4 -4
  8. package/dist/{AWSLambdaSubscriberAdaptor-C6JYIZxn.d.mts → AWSLambdaSubscriberAdaptor-J_pSz6pu.d.cts} +4 -4
  9. package/dist/{AmazonApiGatewayEndpointAdaptor-BrB3RfbI.d.mts → AmazonApiGatewayEndpointAdaptor-B7MKo8h3.d.mts} +3 -3
  10. package/dist/{AmazonApiGatewayEndpointAdaptor-BFhJ2Rpz.d.cts → AmazonApiGatewayEndpointAdaptor-BnNd8tCz.d.cts} +2 -2
  11. package/dist/{AmazonApiGatewayEndpointAdaptor-B8mozTcG.cjs → AmazonApiGatewayEndpointAdaptor-DHBF_5jn.cjs} +2 -2
  12. package/dist/{AmazonApiGatewayEndpointAdaptor-B8mozTcG.cjs.map → AmazonApiGatewayEndpointAdaptor-DHBF_5jn.cjs.map} +1 -1
  13. package/dist/{AmazonApiGatewayEndpointAdaptor-Bmz6Cy1e.mjs → AmazonApiGatewayEndpointAdaptor-DHcUetbw.mjs} +2 -2
  14. package/dist/{AmazonApiGatewayEndpointAdaptor-Bmz6Cy1e.mjs.map → AmazonApiGatewayEndpointAdaptor-DHcUetbw.mjs.map} +1 -1
  15. package/dist/{AmazonApiGatewayV1EndpointAdaptor-Bd-o8ese.d.cts → AmazonApiGatewayV1EndpointAdaptor-BC-a2tt3.d.cts} +3 -3
  16. package/dist/{AmazonApiGatewayV1EndpointAdaptor-D4eZ-fx5.cjs → AmazonApiGatewayV1EndpointAdaptor-CmUxFoPx.cjs} +2 -2
  17. package/dist/{AmazonApiGatewayV1EndpointAdaptor-D4eZ-fx5.cjs.map → AmazonApiGatewayV1EndpointAdaptor-CmUxFoPx.cjs.map} +1 -1
  18. package/dist/{AmazonApiGatewayV1EndpointAdaptor-24g3dLn5.mjs → AmazonApiGatewayV1EndpointAdaptor-CsV6zyvn.mjs} +2 -2
  19. package/dist/{AmazonApiGatewayV1EndpointAdaptor-24g3dLn5.mjs.map → AmazonApiGatewayV1EndpointAdaptor-CsV6zyvn.mjs.map} +1 -1
  20. package/dist/{AmazonApiGatewayV1EndpointAdaptor-BtNXt0-4.d.mts → AmazonApiGatewayV1EndpointAdaptor-gO9OxdZl.d.mts} +4 -4
  21. package/dist/{AmazonApiGatewayV2EndpointAdaptor-DAJdtgek.d.mts → AmazonApiGatewayV2EndpointAdaptor-D1uz4wNg.d.mts} +4 -4
  22. package/dist/{AmazonApiGatewayV2EndpointAdaptor-Cc40RThv.mjs → AmazonApiGatewayV2EndpointAdaptor-_bFcbEa-.mjs} +2 -2
  23. package/dist/{AmazonApiGatewayV2EndpointAdaptor-Cc40RThv.mjs.map → AmazonApiGatewayV2EndpointAdaptor-_bFcbEa-.mjs.map} +1 -1
  24. package/dist/{AmazonApiGatewayV2EndpointAdaptor-J6tACl-N.cjs → AmazonApiGatewayV2EndpointAdaptor-cZbaqiUi.cjs} +2 -2
  25. package/dist/{AmazonApiGatewayV2EndpointAdaptor-J6tACl-N.cjs.map → AmazonApiGatewayV2EndpointAdaptor-cZbaqiUi.cjs.map} +1 -1
  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-BmsbV0BU.cjs} +2 -2
  30. package/dist/{BaseFunctionBuilder-DtO4Nwxm.cjs.map → BaseFunctionBuilder-BmsbV0BU.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-DCUtCdVL.mjs} +2 -2
  34. package/dist/{BaseFunctionBuilder-BPE9JBbT.mjs.map → BaseFunctionBuilder-DCUtCdVL.mjs.map} +1 -1
  35. package/dist/{Construct-BbKCIPQm.mjs → Construct-C3hsQBy4.mjs} +10 -13
  36. package/dist/Construct-C3hsQBy4.mjs.map +1 -0
  37. package/dist/{Construct-BSEs6uwW.cjs → Construct-VEI7M3fs.cjs} +10 -13
  38. package/dist/Construct-VEI7M3fs.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-CmZ6esMM.cjs → Cron-Dfgr8F9d.cjs} +5 -5
  47. package/dist/Cron-Dfgr8F9d.cjs.map +1 -0
  48. package/dist/{Cron-NDBlJhb3.d.mts → Cron-DkPL-Fms.d.cts} +4 -4
  49. package/dist/{Cron-D6hnZLk7.mjs → Cron-wP6Ob48_.mjs} +5 -5
  50. package/dist/Cron-wP6Ob48_.mjs.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-Dfv5JguE.mjs → CronBuilder-C27c5oqh.mjs} +10 -5
  54. package/dist/CronBuilder-C27c5oqh.mjs.map +1 -0
  55. package/dist/{CronBuilder-Di7QK8Rt.cjs → CronBuilder-W1ZqCJ7m.cjs} +10 -5
  56. package/dist/CronBuilder-W1ZqCJ7m.cjs.map +1 -0
  57. package/dist/{Endpoint-COGAflGh.cjs → Endpoint-BjpQmTek.cjs} +21 -12
  58. package/dist/Endpoint-BjpQmTek.cjs.map +1 -0
  59. package/dist/{Endpoint-C7jPJzAH.d.mts → Endpoint-C16whGI-.d.mts} +45 -13
  60. package/dist/{Endpoint-DLLZvqoh.mjs → Endpoint-C98BwZjA.mjs} +21 -12
  61. package/dist/Endpoint-C98BwZjA.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-CFtWQhcv.d.mts → EndpointBuilder-BzqR0xvt.d.mts} +18 -12
  65. package/dist/{EndpointBuilder-oXO_ka1-.mjs → EndpointBuilder-CCUx4vep.mjs} +28 -5
  66. package/dist/EndpointBuilder-CCUx4vep.mjs.map +1 -0
  67. package/dist/{EndpointBuilder-FJktpPOu.cjs → EndpointBuilder-D2Zu8i9b.cjs} +28 -5
  68. package/dist/EndpointBuilder-D2Zu8i9b.cjs.map +1 -0
  69. package/dist/{EndpointFactory-Kk1tpifs.cjs → EndpointFactory-C4YhgXOc.cjs} +41 -10
  70. package/dist/EndpointFactory-C4YhgXOc.cjs.map +1 -0
  71. package/dist/{EndpointFactory-DBRGrXAy.d.mts → EndpointFactory-KkyIOE62.d.cts} +29 -21
  72. package/dist/{EndpointFactory-eG8bDhOh.mjs → EndpointFactory-RAb2zcw0.mjs} +41 -10
  73. package/dist/EndpointFactory-RAb2zcw0.mjs.map +1 -0
  74. package/dist/{EndpointFactory-DInjHvFR.d.cts → EndpointFactory-VnSAdwdv.d.mts} +29 -21
  75. package/dist/{Function-CbO2NZx-.cjs → Function-1Fh6Tdkg.cjs} +4 -5
  76. package/dist/Function-1Fh6Tdkg.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-D-QEfH7k.mjs} +4 -5
  79. package/dist/Function-D-QEfH7k.mjs.map +1 -0
  80. package/dist/{Function-C98H68DW.d.mts → Function-DFRZZCC-.d.mts} +3 -4
  81. package/dist/{FunctionBuilder-CosgPmMl.mjs → FunctionBuilder-Bxyr1Pf9.mjs} +11 -5
  82. package/dist/FunctionBuilder-Bxyr1Pf9.mjs.map +1 -0
  83. package/dist/{FunctionBuilder-DuOeWCAl.cjs → FunctionBuilder-DcEFYgbn.cjs} +11 -5
  84. package/dist/FunctionBuilder-DcEFYgbn.cjs.map +1 -0
  85. package/dist/{FunctionBuilder-BS1KgxA_.d.cts → FunctionBuilder-DdGjpiFT.d.cts} +6 -4
  86. package/dist/{FunctionBuilder-DBwR7jg7.d.mts → FunctionBuilder-DuktGyZc.d.mts} +6 -4
  87. package/dist/{FunctionExecutionWrapper-XGrSAAPD.mjs → FunctionExecutionWrapper-BL6PE6Dv.mjs} +2 -2
  88. package/dist/{FunctionExecutionWrapper-XGrSAAPD.mjs.map → FunctionExecutionWrapper-BL6PE6Dv.mjs.map} +1 -1
  89. package/dist/{FunctionExecutionWrapper-B0V7V8YS.d.mts → FunctionExecutionWrapper-CRYi047B.d.cts} +4 -4
  90. package/dist/{FunctionExecutionWrapper-Bx-Dl-2a.d.cts → FunctionExecutionWrapper-DaR-dSLw.d.mts} +4 -4
  91. package/dist/{FunctionExecutionWrapper-CElXEjPe.cjs → FunctionExecutionWrapper-Ee-CE8Fz.cjs} +2 -2
  92. package/dist/{FunctionExecutionWrapper-CElXEjPe.cjs.map → FunctionExecutionWrapper-Ee-CE8Fz.cjs.map} +1 -1
  93. package/dist/{HonoEndpointAdaptor-BrbM9vxd.d.cts → HonoEndpointAdaptor-CY1mXTe6.d.mts} +7 -6
  94. package/dist/{HonoEndpointAdaptor-CxcYKdzT.d.mts → HonoEndpointAdaptor-CYvrXBe-.d.cts} +9 -8
  95. package/dist/{HonoEndpointAdaptor-BlT1rWHV.mjs → HonoEndpointAdaptor-CyVPl4w2.mjs} +33 -16
  96. package/dist/HonoEndpointAdaptor-CyVPl4w2.mjs.map +1 -0
  97. package/dist/{HonoEndpointAdaptor-Ds433Q8w.cjs → HonoEndpointAdaptor-DcvZdYzx.cjs} +20 -3
  98. package/dist/HonoEndpointAdaptor-DcvZdYzx.cjs.map +1 -0
  99. package/dist/{Subscriber-CSt7EOlT.cjs → Subscriber-BL30GpWp.cjs} +2 -2
  100. package/dist/{Subscriber-CSt7EOlT.cjs.map → Subscriber-BL30GpWp.cjs.map} +1 -1
  101. package/dist/{Subscriber-DkCDcTUL.mjs → Subscriber-CTczVFsF.mjs} +2 -2
  102. package/dist/{Subscriber-DkCDcTUL.mjs.map → Subscriber-CTczVFsF.mjs.map} +1 -1
  103. package/dist/{Subscriber-BoFm12i_.d.cts → Subscriber-Cy28j8MS.d.cts} +2 -2
  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-Bn9Hyi28.mjs → SubscriberBuilder-CekL3BoP.mjs} +2 -2
  107. package/dist/{SubscriberBuilder-Bn9Hyi28.mjs.map → SubscriberBuilder-CekL3BoP.mjs.map} +1 -1
  108. package/dist/{SubscriberBuilder-RsiOmnwq.cjs → SubscriberBuilder-D1hojYLa.cjs} +2 -2
  109. package/dist/{SubscriberBuilder-RsiOmnwq.cjs.map → SubscriberBuilder-D1hojYLa.cjs.map} +1 -1
  110. package/dist/{SubscriberBuilder-DgljKtYu.d.cts → SubscriberBuilder-YjQ7qIpQ.d.mts} +3 -3
  111. package/dist/{TestEndpointAdaptor-Ct4I-gDo.mjs → TestEndpointAdaptor-B4z9G5Ap.mjs} +3 -3
  112. package/dist/{TestEndpointAdaptor-Ct4I-gDo.mjs.map → TestEndpointAdaptor-B4z9G5Ap.mjs.map} +1 -1
  113. package/dist/{TestEndpointAdaptor-FJUob2W_.cjs → TestEndpointAdaptor-C-ahwGW6.cjs} +3 -3
  114. package/dist/{TestEndpointAdaptor-FJUob2W_.cjs.map → TestEndpointAdaptor-C-ahwGW6.cjs.map} +1 -1
  115. package/dist/{TestEndpointAdaptor-vboVyJ0w.d.mts → TestEndpointAdaptor-DGWuai69.d.mts} +2 -2
  116. package/dist/{TestEndpointAdaptor-wwEaVHAt.d.cts → TestEndpointAdaptor-uXliWYjS.d.cts} +2 -2
  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 +11 -11
  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 +8 -7
  177. package/dist/endpoints/TestEndpointAdaptor.d.mts +8 -7
  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 +5 -5
  208. package/dist/functions/TestFunctionAdaptor.d.cts +2 -2
  209. package/dist/functions/TestFunctionAdaptor.d.mts +2 -2
  210. package/dist/functions/TestFunctionAdaptor.mjs +5 -5
  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-BtgBiuC_.cjs} +2 -2
  216. package/dist/{functions-DVDb5wEA.cjs.map → functions-BtgBiuC_.cjs.map} +1 -1
  217. package/dist/functions-DD-00sWF.mjs +8 -0
  218. package/dist/{functions-mM-jcphA.mjs.map → functions-DD-00sWF.mjs.map} +1 -1
  219. package/dist/{helpers-CM0U-4Vk.mjs → helpers-DtPeOhUV.mjs} +2 -2
  220. package/dist/{helpers-CM0U-4Vk.mjs.map → helpers-DtPeOhUV.mjs.map} +1 -1
  221. package/dist/{helpers-go4jiRvV.cjs → helpers-QM_FSjPY.cjs} +2 -2
  222. package/dist/{helpers-go4jiRvV.cjs.map → helpers-QM_FSjPY.cjs.map} +1 -1
  223. package/dist/index-CcmV3PKF.d.cts +9 -0
  224. package/dist/index-DQt3pQtF.d.mts +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 +6 -6
  246. package/src/Construct.ts +11 -24
  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/__tests__/Endpoint.cookies.spec.ts +85 -0
  256. package/src/endpoints/__tests__/Endpoint.headers.spec.ts +187 -0
  257. package/src/endpoints/__tests__/Endpoint.manifest.spec.ts +176 -0
  258. package/src/endpoints/__tests__/EndpointFactory.authorizers.spec.ts +259 -0
  259. package/src/endpoints/__tests__/EndpointFactory.reference-audit.spec.ts +190 -0
  260. package/src/endpoints/__tests__/EndpointFactory.state-isolation.spec.ts +155 -0
  261. package/src/functions/Function.ts +12 -2
  262. package/src/functions/FunctionBuilder.ts +9 -0
  263. package/src/functions/__tests__/FunctionBuilder.state-isolation.spec.ts +160 -0
  264. package/dist/Construct-BSEs6uwW.cjs.map +0 -1
  265. package/dist/Construct-BbKCIPQm.mjs.map +0 -1
  266. package/dist/Cron-CmZ6esMM.cjs.map +0 -1
  267. package/dist/Cron-D6hnZLk7.mjs.map +0 -1
  268. package/dist/CronBuilder-Dfv5JguE.mjs.map +0 -1
  269. package/dist/CronBuilder-Di7QK8Rt.cjs.map +0 -1
  270. package/dist/Endpoint-COGAflGh.cjs.map +0 -1
  271. package/dist/Endpoint-DLLZvqoh.mjs.map +0 -1
  272. package/dist/EndpointBuilder-FJktpPOu.cjs.map +0 -1
  273. package/dist/EndpointBuilder-oXO_ka1-.mjs.map +0 -1
  274. package/dist/EndpointFactory-Kk1tpifs.cjs.map +0 -1
  275. package/dist/EndpointFactory-eG8bDhOh.mjs.map +0 -1
  276. package/dist/Function-C5mW-38v.mjs.map +0 -1
  277. package/dist/Function-CbO2NZx-.cjs.map +0 -1
  278. package/dist/FunctionBuilder-CosgPmMl.mjs.map +0 -1
  279. package/dist/FunctionBuilder-DuOeWCAl.cjs.map +0 -1
  280. package/dist/HonoEndpointAdaptor-BlT1rWHV.mjs.map +0 -1
  281. package/dist/HonoEndpointAdaptor-Ds433Q8w.cjs.map +0 -1
  282. package/dist/functions-mM-jcphA.mjs +0 -8
  283. package/dist/index-BGr5gFrX.d.cts +0 -9
  284. package/dist/index-YM4W9XUq.d.mts +0 -9
@@ -0,0 +1,176 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { Endpoint } from '../Endpoint';
3
+ import { SuccessStatus } from '../Endpoint';
4
+ import { z } from 'zod';
5
+
6
+ describe('Endpoint manifest fields', () => {
7
+ it('should store timeout and memorySize', () => {
8
+ const endpoint = new Endpoint({
9
+ route: '/users/:id',
10
+ method: 'GET',
11
+ fn: async () => ({ id: '123' }),
12
+ authorize: undefined,
13
+ description: 'Get user by ID',
14
+ timeout: 30000,
15
+ memorySize: 512,
16
+ input: undefined,
17
+ output: undefined,
18
+ services: [],
19
+ logger: {} as any,
20
+ getSession: undefined,
21
+ rateLimit: undefined,
22
+ status: SuccessStatus.OK,
23
+ });
24
+
25
+ expect(endpoint.timeout).toBe(30000);
26
+ expect(endpoint.memorySize).toBe(512);
27
+ });
28
+
29
+ it('should store authorizer information', () => {
30
+ const endpoint = new Endpoint({
31
+ route: '/admin/users',
32
+ method: 'POST',
33
+ fn: async () => ({ success: true }),
34
+ authorize: undefined,
35
+ description: 'Create admin user',
36
+ timeout: undefined,
37
+ memorySize: undefined,
38
+ input: undefined,
39
+ output: undefined,
40
+ services: [],
41
+ logger: {} as any,
42
+ getSession: undefined,
43
+ rateLimit: undefined,
44
+ status: SuccessStatus.Created,
45
+ authorizer: {
46
+ name: 'iam',
47
+ type: 'AWS_IAM',
48
+ description: 'IAM-based authorizer',
49
+ },
50
+ });
51
+
52
+ expect(endpoint.authorizer).toEqual({
53
+ name: 'iam',
54
+ type: 'AWS_IAM',
55
+ description: 'IAM-based authorizer',
56
+ });
57
+ });
58
+
59
+ it('should have undefined authorizer when not provided', () => {
60
+ const endpoint = new Endpoint({
61
+ route: '/public',
62
+ method: 'GET',
63
+ fn: async () => ({ data: 'public' }),
64
+ authorize: undefined,
65
+ description: 'Public endpoint',
66
+ timeout: undefined,
67
+ memorySize: undefined,
68
+ input: undefined,
69
+ output: undefined,
70
+ services: [],
71
+ logger: {} as any,
72
+ getSession: undefined,
73
+ rateLimit: undefined,
74
+ status: SuccessStatus.OK,
75
+ });
76
+
77
+ expect(endpoint.authorizer).toBeUndefined();
78
+ });
79
+
80
+ it('should store all manifest fields together', () => {
81
+ const bodySchema = z.object({ name: z.string() });
82
+ const outputSchema = z.object({ id: z.string(), name: z.string() });
83
+
84
+ const endpoint = new Endpoint({
85
+ route: '/api/v1/users',
86
+ method: 'POST',
87
+ fn: async () => ({ id: '123', name: 'Test User' }),
88
+ authorize: undefined,
89
+ description: 'Create a new user',
90
+ tags: ['users', 'admin'],
91
+ timeout: 15000,
92
+ memorySize: 256,
93
+ input: { body: bodySchema },
94
+ output: outputSchema,
95
+ services: [],
96
+ logger: {} as any,
97
+ getSession: undefined,
98
+ rateLimit: undefined,
99
+ status: SuccessStatus.Created,
100
+ authorizer: {
101
+ name: 'jwt-auth0',
102
+ type: 'JWT',
103
+ description: 'Auth0 JWT authorizer',
104
+ metadata: {
105
+ audience: 'https://api.example.com',
106
+ issuer: 'https://example.auth0.com/',
107
+ },
108
+ },
109
+ });
110
+
111
+ expect(endpoint.route).toBe('/api/v1/users');
112
+ expect(endpoint.method).toBe('POST');
113
+ expect(endpoint.description).toBe('Create a new user');
114
+ expect(endpoint.tags).toEqual(['users', 'admin']);
115
+ expect(endpoint.timeout).toBe(15000);
116
+ expect(endpoint.memorySize).toBe(256);
117
+ expect(endpoint.status).toBe(SuccessStatus.Created);
118
+ expect(endpoint.authorizer).toEqual({
119
+ name: 'jwt-auth0',
120
+ type: 'JWT',
121
+ description: 'Auth0 JWT authorizer',
122
+ metadata: {
123
+ audience: 'https://api.example.com',
124
+ issuer: 'https://example.auth0.com/',
125
+ },
126
+ });
127
+ });
128
+
129
+ it('should preserve authorizer metadata with minimal fields', () => {
130
+ const endpoint = new Endpoint({
131
+ route: '/protected',
132
+ method: 'GET',
133
+ fn: async () => ({ data: 'secret' }),
134
+ authorize: undefined,
135
+ description: undefined,
136
+ timeout: undefined,
137
+ memorySize: undefined,
138
+ input: undefined,
139
+ output: undefined,
140
+ services: [],
141
+ logger: {} as any,
142
+ getSession: undefined,
143
+ rateLimit: undefined,
144
+ status: SuccessStatus.OK,
145
+ authorizer: {
146
+ name: 'custom',
147
+ },
148
+ });
149
+
150
+ expect(endpoint.authorizer).toEqual({ name: 'custom' });
151
+ });
152
+
153
+ it('should handle default timeout and memorySize values', () => {
154
+ const endpoint = new Endpoint({
155
+ route: '/default',
156
+ method: 'GET',
157
+ fn: async () => ({ data: 'default' }),
158
+ authorize: undefined,
159
+ description: undefined,
160
+ timeout: undefined,
161
+ memorySize: undefined,
162
+ input: undefined,
163
+ output: undefined,
164
+ services: [],
165
+ logger: {} as any,
166
+ getSession: undefined,
167
+ rateLimit: undefined,
168
+ status: SuccessStatus.OK,
169
+ });
170
+
171
+ // Default timeout is 30000ms (30 seconds)
172
+ expect(endpoint.timeout).toBe(30000);
173
+ // Default memorySize is undefined
174
+ expect(endpoint.memorySize).toBeUndefined();
175
+ });
176
+ });
@@ -0,0 +1,259 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { EndpointFactory } from '../EndpointFactory';
3
+ import { z } from 'zod';
4
+
5
+ describe('EndpointFactory.authorizers', () => {
6
+ it('should create factory with available authorizers', () => {
7
+ const factory = new EndpointFactory().authorizers([
8
+ 'iam',
9
+ 'jwt-auth0',
10
+ 'custom',
11
+ ] as const);
12
+
13
+ const endpoint = factory
14
+ .get('/users')
15
+ .authorizer('iam')
16
+ .handle(async () => ({ success: true }));
17
+
18
+ expect(endpoint.authorizer).toEqual({ name: 'iam' });
19
+ });
20
+
21
+ it('should allow setting authorizer on individual endpoints', () => {
22
+ const factory = new EndpointFactory().authorizers(['iam', 'jwt'] as const);
23
+
24
+ const endpoint1 = factory
25
+ .post('/admin/users')
26
+ .authorizer('iam')
27
+ .body(z.object({ name: z.string() }))
28
+ .handle(async () => ({ success: true }));
29
+
30
+ const endpoint2 = factory
31
+ .get('/api/users')
32
+ .authorizer('jwt')
33
+ .handle(async () => ({ users: [] }));
34
+
35
+ expect(endpoint1.authorizer).toEqual({ name: 'iam' });
36
+ expect(endpoint2.authorizer).toEqual({ name: 'jwt' });
37
+ });
38
+
39
+ it('should throw error when using non-existent authorizer', () => {
40
+ const factory = new EndpointFactory().authorizers(['iam', 'jwt'] as const);
41
+
42
+ expect(() => {
43
+ factory
44
+ .post('/users')
45
+ // @ts-expect-error - testing invalid authorizer
46
+ .authorizer('invalid')
47
+ .handle(async () => ({ success: true }));
48
+ }).toThrow('Authorizer "invalid" not found in available authorizers: iam, jwt');
49
+ });
50
+
51
+ it('should allow endpoints without authorizers', () => {
52
+ const factory = new EndpointFactory().authorizers(['iam', 'jwt'] as const);
53
+
54
+ const endpoint = factory.get('/public').handle(async () => ({ success: true }));
55
+
56
+ expect(endpoint.authorizer).toBeUndefined();
57
+ });
58
+
59
+ it('should preserve authorizers when chaining factory methods', () => {
60
+ const factory = new EndpointFactory()
61
+ .authorizers(['iam', 'jwt', 'api-key'] as const)
62
+ .route('/api/v1');
63
+
64
+ const endpoint = factory
65
+ .get('/protected')
66
+ .authorizer('jwt')
67
+ .handle(async () => ({ data: 'protected' }));
68
+
69
+ expect(endpoint.authorizer).toEqual({ name: 'jwt' });
70
+ expect(endpoint.route).toBe('/api/v1/protected');
71
+ });
72
+
73
+ it('should work with services and authorizers together', () => {
74
+ const dbService = {
75
+ serviceName: 'database' as const,
76
+ register: async () => ({ query: async () => [] }),
77
+ };
78
+
79
+ const factory = new EndpointFactory()
80
+ .services([dbService])
81
+ .authorizers(['iam'] as const);
82
+
83
+ const endpoint = factory
84
+ .post('/users')
85
+ .authorizer('iam')
86
+ .body(z.object({ name: z.string() }))
87
+ .handle(async ({ body, services }) => {
88
+ await services.database.query();
89
+ return { name: body.name };
90
+ });
91
+
92
+ expect(endpoint.authorizer).toEqual({ name: 'iam' });
93
+ });
94
+
95
+ it('should maintain type safety with authorizer names', () => {
96
+ const factory = new EndpointFactory().authorizers(['iam', 'jwt'] as const);
97
+
98
+ // This should compile with valid authorizer
99
+ factory.get('/test1').authorizer('iam').handle(async () => ({}));
100
+
101
+ // This should compile with valid authorizer
102
+ factory.get('/test2').authorizer('jwt').handle(async () => ({}));
103
+
104
+ // This should not compile with invalid authorizer (tested via TypeScript)
105
+ // factory.get('/test3').authorizer('invalid').handle(async () => ({}));
106
+ });
107
+
108
+ it('should allow creating endpoints without calling authorizer() method', () => {
109
+ const factory = new EndpointFactory().authorizers(['iam'] as const);
110
+
111
+ const endpoint1 = factory
112
+ .get('/public')
113
+ .handle(async () => ({ public: true }));
114
+
115
+ const endpoint2 = factory
116
+ .get('/protected')
117
+ .authorizer('iam')
118
+ .handle(async () => ({ protected: true }));
119
+
120
+ expect(endpoint1.authorizer).toBeUndefined();
121
+ expect(endpoint2.authorizer).toEqual({ name: 'iam' });
122
+ });
123
+
124
+ it('should work with nested routes', () => {
125
+ const apiFactory = new EndpointFactory()
126
+ .authorizers(['iam', 'jwt'] as const)
127
+ .route('/api');
128
+
129
+ const v1Factory = apiFactory.route('/v1');
130
+ const adminFactory = v1Factory.route('/admin');
131
+
132
+ const endpoint = adminFactory
133
+ .delete('/users/:id')
134
+ .authorizer('iam')
135
+ .params(z.object({ id: z.string() }))
136
+ .handle(async () => ({ deleted: true }));
137
+
138
+ expect(endpoint.route).toBe('/api/v1/admin/users/:id');
139
+ expect(endpoint.authorizer).toEqual({ name: 'iam' });
140
+ });
141
+
142
+ it('should work with all HTTP methods', () => {
143
+ const factory = new EndpointFactory().authorizers(['jwt'] as const);
144
+
145
+ const getEndpoint = factory.get('/users').authorizer('jwt').handle(async () => ({ users: [] }));
146
+ const postEndpoint = factory.post('/users').authorizer('jwt').handle(async () => ({ id: '1' }));
147
+ const putEndpoint = factory.put('/users/:id').authorizer('jwt').handle(async () => ({ updated: true }));
148
+ const patchEndpoint = factory.patch('/users/:id').authorizer('jwt').handle(async () => ({ patched: true }));
149
+ const deleteEndpoint = factory.delete('/users/:id').authorizer('jwt').handle(async () => ({ deleted: true }));
150
+ const optionsEndpoint = factory.options('/users').authorizer('jwt').handle(async () => ({}));
151
+
152
+ expect(getEndpoint.authorizer).toEqual({ name: 'jwt' });
153
+ expect(postEndpoint.authorizer).toEqual({ name: 'jwt' });
154
+ expect(putEndpoint.authorizer).toEqual({ name: 'jwt' });
155
+ expect(patchEndpoint.authorizer).toEqual({ name: 'jwt' });
156
+ expect(deleteEndpoint.authorizer).toEqual({ name: 'jwt' });
157
+ expect(optionsEndpoint.authorizer).toEqual({ name: 'jwt' });
158
+ });
159
+
160
+ it('should work with output schemas', () => {
161
+ const factory = new EndpointFactory().authorizers(['iam'] as const);
162
+
163
+ const outputSchema = z.object({
164
+ id: z.string(),
165
+ name: z.string(),
166
+ });
167
+
168
+ const endpoint = factory
169
+ .get('/user')
170
+ .authorizer('iam')
171
+ .output(outputSchema)
172
+ .handle(async () => ({
173
+ id: '123',
174
+ name: 'John Doe',
175
+ }));
176
+
177
+ expect(endpoint.authorizer).toEqual({ name: 'iam' });
178
+ expect(endpoint.outputSchema).toBe(outputSchema);
179
+ });
180
+
181
+ it('should not throw error when no authorizers are configured', () => {
182
+ const factory = new EndpointFactory();
183
+
184
+ const endpoint = factory
185
+ .get('/test')
186
+ .handle(async () => ({ success: true }));
187
+
188
+ expect(endpoint.authorizer).toBeUndefined();
189
+ });
190
+
191
+ it('should handle multiple authorizers with similar names', () => {
192
+ const factory = new EndpointFactory().authorizers([
193
+ 'jwt-user',
194
+ 'jwt-admin',
195
+ 'jwt',
196
+ ] as const);
197
+
198
+ const endpoint1 = factory.get('/user').authorizer('jwt-user').handle(async () => ({}));
199
+ const endpoint2 = factory.get('/admin').authorizer('jwt-admin').handle(async () => ({}));
200
+ const endpoint3 = factory.get('/api').authorizer('jwt').handle(async () => ({}));
201
+
202
+ expect(endpoint1.authorizer).toEqual({ name: 'jwt-user' });
203
+ expect(endpoint2.authorizer).toEqual({ name: 'jwt-admin' });
204
+ expect(endpoint3.authorizer).toEqual({ name: 'jwt' });
205
+ });
206
+
207
+ it('should support "none" to explicitly mark endpoint as having no authorizer', () => {
208
+ const factory = new EndpointFactory().authorizers(['iam', 'jwt'] as const);
209
+
210
+ const endpoint = factory
211
+ .get('/public')
212
+ .authorizer('none')
213
+ .handle(async () => ({ public: true }));
214
+
215
+ expect(endpoint.authorizer).toBeUndefined();
216
+ });
217
+
218
+ it('should allow "none" to override default authorizer from factory', () => {
219
+ const factory = new EndpointFactory().authorizers(['iam', 'jwt'] as const);
220
+
221
+ // In the future, if we add default authorizer support at factory level,
222
+ // 'none' should override it
223
+ const endpoint = factory
224
+ .post('/public/signup')
225
+ .authorizer('none')
226
+ .body(z.object({ email: z.string() }))
227
+ .handle(async () => ({ success: true }));
228
+
229
+ expect(endpoint.authorizer).toBeUndefined();
230
+ });
231
+
232
+ it('should allow "none" even when no authorizers are configured', () => {
233
+ const factory = new EndpointFactory();
234
+
235
+ const endpoint = factory
236
+ .get('/test')
237
+ .authorizer('none')
238
+ .handle(async () => ({ test: true }));
239
+
240
+ expect(endpoint.authorizer).toBeUndefined();
241
+ });
242
+
243
+ it('should work with "none" in combination with other endpoint methods', () => {
244
+ const factory = new EndpointFactory().authorizers(['iam'] as const);
245
+
246
+ const endpoint = factory
247
+ .post('/public/contact')
248
+ .authorizer('none')
249
+ .body(z.object({ message: z.string() }))
250
+ .output(z.object({ sent: z.boolean() }))
251
+ .description('Public contact form')
252
+ .tags(['public', 'contact'])
253
+ .handle(async () => ({ sent: true }));
254
+
255
+ expect(endpoint.authorizer).toBeUndefined();
256
+ expect(endpoint.description).toBe('Public contact form');
257
+ expect(endpoint.tags).toEqual(['public', 'contact']);
258
+ });
259
+ });
@@ -0,0 +1,190 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { ConsoleLogger } from '@geekmidas/logger/console';
3
+ import { EndpointFactory } from '../EndpointFactory';
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('EndpointFactory - Reference Sharing Audit', () => {
21
+ describe('services array', () => {
22
+ it('should not share services array references between builders', () => {
23
+ const factory = new EndpointFactory().services([ServiceA, ServiceB]);
24
+
25
+ const builder1 = factory.post('/a');
26
+ const builder2 = factory.post('/b');
27
+
28
+ // Should not be the same reference
29
+ expect((builder1 as any)._services === (builder2 as any)._services).toBe(
30
+ false,
31
+ );
32
+
33
+ // But should have same content
34
+ expect((builder1 as any)._services).toEqual([ServiceA, ServiceB]);
35
+ expect((builder2 as any)._services).toEqual([ServiceA, ServiceB]);
36
+ });
37
+
38
+ it('should not mutate factory services when builder adds services', () => {
39
+ const factory = new EndpointFactory().services([ServiceA]);
40
+
41
+ const builder = factory.post('/test');
42
+ const originalServices = (factory as any).defaultServices;
43
+
44
+ // Builder adds more services
45
+ builder.services([ServiceB]);
46
+
47
+ // Factory's defaultServices should be unchanged
48
+ expect((factory as any).defaultServices).toEqual(originalServices);
49
+ expect((factory as any).defaultServices.length).toBe(1);
50
+ });
51
+ });
52
+
53
+ describe('events array', () => {
54
+ it('should not share events array references between builders', () => {
55
+ const factory = new EndpointFactory();
56
+
57
+ const builder1 = factory.post('/a');
58
+ const builder2 = factory.post('/b');
59
+
60
+ // Each builder should have its own events array
61
+ expect((builder1 as any)._events === (builder2 as any)._events).toBe(
62
+ false,
63
+ );
64
+ expect((builder1 as any)._events).toEqual([]);
65
+ expect((builder2 as any)._events).toEqual([]);
66
+ });
67
+
68
+ it('should not share events between builders even after adding events', () => {
69
+ const factory = new EndpointFactory();
70
+
71
+ const builder1 = factory.post('/a');
72
+ const builder2 = factory.post('/b');
73
+
74
+ // Add event to builder1
75
+ const mockEvent: any = { type: 'test', map: () => ({}) };
76
+ (builder1 as any)._events.push(mockEvent);
77
+
78
+ // builder2 should not have the event
79
+ expect((builder1 as any)._events.length).toBe(1);
80
+ expect((builder2 as any)._events.length).toBe(0);
81
+ });
82
+ });
83
+
84
+ describe('schemas object', () => {
85
+ it('should not share schemas object references between builders', () => {
86
+ const factory = new EndpointFactory();
87
+
88
+ const builder1 = factory.post('/a');
89
+ const builder2 = factory.post('/b');
90
+
91
+ // Each builder should have its own schemas object
92
+ expect((builder1 as any).schemas === (builder2 as any).schemas).toBe(
93
+ false,
94
+ );
95
+ });
96
+
97
+ it('should not share schemas between builders after setting schemas', () => {
98
+ const factory = new EndpointFactory();
99
+ const bodySchema: any = { '~standard': { validate: () => ({}) } };
100
+
101
+ const builder1 = factory.post('/a').body(bodySchema);
102
+ const builder2 = factory.post('/b');
103
+
104
+ // builder1 should have body schema, builder2 should not
105
+ expect((builder1 as any).schemas.body).toBeDefined();
106
+ expect((builder2 as any).schemas.body).toBeUndefined();
107
+ });
108
+ });
109
+
110
+ describe('logger (intentionally shared)', () => {
111
+ it('should share logger references between builders (by design)', () => {
112
+ const logger = new ConsoleLogger({ app: 'test' });
113
+ const factory = new EndpointFactory().logger(logger);
114
+
115
+ const builder1 = factory.post('/a');
116
+ const builder2 = factory.post('/b');
117
+
118
+ // Logger should be the same reference (it's a singleton service)
119
+ expect((builder1 as any)._logger === (builder2 as any)._logger).toBe(
120
+ true,
121
+ );
122
+ expect((builder1 as any)._logger).toBe(logger);
123
+ });
124
+ });
125
+
126
+ describe('authorize and session functions', () => {
127
+ it('should share authorize function reference (by design)', () => {
128
+ const authFn = async () => true;
129
+ const factory = new EndpointFactory().authorize(authFn);
130
+
131
+ const builder1 = factory.post('/a');
132
+ const builder2 = factory.post('/b');
133
+
134
+ // Function should be the same reference
135
+ expect((builder1 as any)._authorize === (builder2 as any)._authorize).toBe(
136
+ true,
137
+ );
138
+ expect((builder1 as any)._authorize).toBe(authFn);
139
+ });
140
+
141
+ it('should share session extractor function reference (by design)', () => {
142
+ const sessionFn = async () => ({ userId: '123' });
143
+ const factory = new EndpointFactory().session(sessionFn);
144
+
145
+ const builder1 = factory.post('/a');
146
+ const builder2 = factory.post('/b');
147
+
148
+ // Function should be the same reference
149
+ expect((builder1 as any)._getSession === (builder2 as any)._getSession).toBe(
150
+ true,
151
+ );
152
+ expect((builder1 as any)._getSession).toBe(sessionFn);
153
+ });
154
+ });
155
+
156
+ describe('complex nested factory chains', () => {
157
+ it('should maintain proper isolation through multiple factory layers', () => {
158
+ // Create base router
159
+ const base = new EndpointFactory().services([ServiceA]);
160
+
161
+ // Create auth router from base
162
+ const authRouter = base.authorize(async () => true);
163
+
164
+ // Create API v1 router from auth router
165
+ const v1Router = authRouter.route('/v1').services([ServiceB]);
166
+
167
+ // Create endpoints from different routers
168
+ const ep1 = base.get('/test').handle(() => ({}));
169
+ const ep2 = authRouter.get('/test').handle(() => ({}));
170
+ const ep3 = v1Router.get('/test').handle(() => ({}));
171
+
172
+ // Verify service isolation
173
+ expect(ep1.services.map((s) => s.serviceName)).toEqual(['a']);
174
+ expect(ep2.services.map((s) => s.serviceName)).toEqual(['a']);
175
+ expect(ep3.services.map((s) => s.serviceName)).toEqual(['b', 'a']);
176
+
177
+ // Verify they don't share internal arrays
178
+ const builder1 = base.get('/x');
179
+ const builder2 = authRouter.get('/x');
180
+ const builder3 = v1Router.get('/x');
181
+
182
+ expect((builder1 as any)._services === (builder2 as any)._services).toBe(
183
+ false,
184
+ );
185
+ expect((builder2 as any)._services === (builder3 as any)._services).toBe(
186
+ false,
187
+ );
188
+ });
189
+ });
190
+ });