@geekmidas/constructs 0.3.2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (557) hide show
  1. package/dist/{AWSLambdaFunction-C54a1doJ.mjs → AWSLambdaFunction-BMTaCrG9.mjs} +6 -6
  2. package/dist/AWSLambdaFunction-BMTaCrG9.mjs.map +1 -0
  3. package/dist/{AWSLambdaFunction-BdebRMUh.d.mts → AWSLambdaFunction-BfLF5vNa.d.cts} +6 -6
  4. package/dist/AWSLambdaFunction-BfLF5vNa.d.cts.map +1 -0
  5. package/dist/{AWSLambdaFunction-EPGY4s7i.cjs → AWSLambdaFunction-C1gRqLO7.cjs} +6 -6
  6. package/dist/AWSLambdaFunction-C1gRqLO7.cjs.map +1 -0
  7. package/dist/{AWSLambdaFunction-D0tEOTXQ.d.cts → AWSLambdaFunction-K94K8JU2.d.mts} +6 -6
  8. package/dist/AWSLambdaFunction-K94K8JU2.d.mts.map +1 -0
  9. package/dist/{AWSLambdaSubscriberAdaptor-Dx-Ks1Jp.d.cts → AWSLambdaSubscriberAdaptor-B2Gk3fgx.d.cts} +2 -2
  10. package/dist/AWSLambdaSubscriberAdaptor-B2Gk3fgx.d.cts.map +1 -0
  11. package/dist/{AWSLambdaSubscriberAdaptor-BLfO612H.mjs → AWSLambdaSubscriberAdaptor-BD3FwGUb.mjs} +3 -3
  12. package/dist/AWSLambdaSubscriberAdaptor-BD3FwGUb.mjs.map +1 -0
  13. package/dist/{AWSLambdaSubscriberAdaptor-BNcYYZ-P.cjs → AWSLambdaSubscriberAdaptor-DQDnt1Xk.cjs} +3 -3
  14. package/dist/AWSLambdaSubscriberAdaptor-DQDnt1Xk.cjs.map +1 -0
  15. package/dist/{AWSLambdaSubscriberAdaptor-DrFAvHOp.d.mts → AWSLambdaSubscriberAdaptor-QuMFwltJ.d.mts} +2 -2
  16. package/dist/AWSLambdaSubscriberAdaptor-QuMFwltJ.d.mts.map +1 -0
  17. package/dist/{AmazonApiGatewayEndpointAdaptor-BT9JXihC.mjs → AmazonApiGatewayEndpointAdaptor-B4gLJ2dx.mjs} +56 -14
  18. package/dist/AmazonApiGatewayEndpointAdaptor-B4gLJ2dx.mjs.map +1 -0
  19. package/dist/{AmazonApiGatewayEndpointAdaptor-DLqnYQ4E.d.cts → AmazonApiGatewayEndpointAdaptor-C987ZCsM.d.cts} +51 -5
  20. package/dist/AmazonApiGatewayEndpointAdaptor-C987ZCsM.d.cts.map +1 -0
  21. package/dist/{AmazonApiGatewayEndpointAdaptor-DNFvvdmW.cjs → AmazonApiGatewayEndpointAdaptor-CwRKMRr_.cjs} +55 -13
  22. package/dist/AmazonApiGatewayEndpointAdaptor-CwRKMRr_.cjs.map +1 -0
  23. package/dist/{AmazonApiGatewayEndpointAdaptor-qlKXuZxy.d.mts → AmazonApiGatewayEndpointAdaptor-DpPfO6Vj.d.mts} +52 -6
  24. package/dist/AmazonApiGatewayEndpointAdaptor-DpPfO6Vj.d.mts.map +1 -0
  25. package/dist/{AmazonApiGatewayV1EndpointAdaptor-Ccl8B8kG.cjs → AmazonApiGatewayV1EndpointAdaptor-BeZMu5DZ.cjs} +4 -4
  26. package/dist/AmazonApiGatewayV1EndpointAdaptor-BeZMu5DZ.cjs.map +1 -0
  27. package/dist/{AmazonApiGatewayV1EndpointAdaptor-MRUxs3Xi.d.mts → AmazonApiGatewayV1EndpointAdaptor-DI_5kdqw.d.mts} +5 -5
  28. package/dist/AmazonApiGatewayV1EndpointAdaptor-DI_5kdqw.d.mts.map +1 -0
  29. package/dist/{AmazonApiGatewayV1EndpointAdaptor-DyUaJIhB.d.cts → AmazonApiGatewayV1EndpointAdaptor-DkGMOpoB.d.cts} +4 -4
  30. package/dist/AmazonApiGatewayV1EndpointAdaptor-DkGMOpoB.d.cts.map +1 -0
  31. package/dist/{AmazonApiGatewayV1EndpointAdaptor-CShQI8Gk.mjs → AmazonApiGatewayV1EndpointAdaptor-VccB6FKp.mjs} +4 -4
  32. package/dist/AmazonApiGatewayV1EndpointAdaptor-VccB6FKp.mjs.map +1 -0
  33. package/dist/{AmazonApiGatewayV2EndpointAdaptor-M1-w0U5R.d.cts → AmazonApiGatewayV2EndpointAdaptor-BtBnMJS_.d.cts} +4 -6
  34. package/dist/AmazonApiGatewayV2EndpointAdaptor-BtBnMJS_.d.cts.map +1 -0
  35. package/dist/{AmazonApiGatewayV2EndpointAdaptor-D8-0Aab4.cjs → AmazonApiGatewayV2EndpointAdaptor-BwsL9Gia.cjs} +4 -4
  36. package/dist/AmazonApiGatewayV2EndpointAdaptor-BwsL9Gia.cjs.map +1 -0
  37. package/dist/{AmazonApiGatewayV2EndpointAdaptor-lCRzGE4q.mjs → AmazonApiGatewayV2EndpointAdaptor-CljxmUfz.mjs} +4 -4
  38. package/dist/AmazonApiGatewayV2EndpointAdaptor-CljxmUfz.mjs.map +1 -0
  39. package/dist/{AmazonApiGatewayV2EndpointAdaptor-fuLM6M9k.d.mts → AmazonApiGatewayV2EndpointAdaptor-DnCoqlvw.d.mts} +5 -7
  40. package/dist/AmazonApiGatewayV2EndpointAdaptor-DnCoqlvw.d.mts.map +1 -0
  41. package/dist/{Authorizer-C0ge_tc8.cjs → Authorizer-BXxBee2P.cjs} +1 -1
  42. package/dist/Authorizer-BXxBee2P.cjs.map +1 -0
  43. package/dist/{Authorizer-r9U3y_ms.mjs → Authorizer-BgjU8-z6.mjs} +1 -1
  44. package/dist/Authorizer-BgjU8-z6.mjs.map +1 -0
  45. package/dist/{Authorizer-gWxYsGEp.d.mts → Authorizer-DCcYOx3h.d.mts} +1 -1
  46. package/dist/Authorizer-DCcYOx3h.d.mts.map +1 -0
  47. package/dist/{Authorizer-B-btowNd.d.cts → Authorizer-DWtwC8we.d.cts} +1 -1
  48. package/dist/Authorizer-DWtwC8we.d.cts.map +1 -0
  49. package/dist/{BaseFunctionBuilder-BAtutR6q.d.cts → BaseFunctionBuilder-BqZCqIeU.d.mts} +3 -3
  50. package/dist/BaseFunctionBuilder-BqZCqIeU.d.mts.map +1 -0
  51. package/dist/{BaseFunctionBuilder-DRY419e7.d.mts → BaseFunctionBuilder-CcK691ni.d.cts} +3 -3
  52. package/dist/BaseFunctionBuilder-CcK691ni.d.cts.map +1 -0
  53. package/dist/{BaseFunctionBuilder-Czi1Jwza.mjs → BaseFunctionBuilder-Dsqe6pnn.mjs} +2 -2
  54. package/dist/BaseFunctionBuilder-Dsqe6pnn.mjs.map +1 -0
  55. package/dist/{BaseFunctionBuilder-MYG3C9ug.cjs → BaseFunctionBuilder-Z0XwrKB5.cjs} +2 -2
  56. package/dist/BaseFunctionBuilder-Z0XwrKB5.cjs.map +1 -0
  57. package/dist/Construct-BNDLJJfD.mjs +150 -0
  58. package/dist/Construct-BNDLJJfD.mjs.map +1 -0
  59. package/dist/{Construct-Ba5cMxib.cjs → Construct-CPrCF8NK.cjs} +93 -9
  60. package/dist/Construct-CPrCF8NK.cjs.map +1 -0
  61. package/dist/{Construct-C4rPE67v.d.cts → Construct-Dl0l2d8d.d.cts} +30 -4
  62. package/dist/Construct-Dl0l2d8d.d.cts.map +1 -0
  63. package/dist/{Construct-XrijZFFh.d.mts → Construct-E8QPyHh4.d.mts} +30 -4
  64. package/dist/Construct-E8QPyHh4.d.mts.map +1 -0
  65. package/dist/Construct.cjs +4 -2
  66. package/dist/Construct.d.cts +2 -2
  67. package/dist/Construct.d.mts +2 -2
  68. package/dist/Construct.mjs +2 -2
  69. package/dist/{Cron-CGF4YAfM.cjs → Cron-BmPNTLla.cjs} +3 -3
  70. package/dist/Cron-BmPNTLla.cjs.map +1 -0
  71. package/dist/{Cron-BxhGs5up.mjs → Cron-BpJONaFv.mjs} +3 -3
  72. package/dist/Cron-BpJONaFv.mjs.map +1 -0
  73. package/dist/{Cron-bDLcTvV5.d.cts → Cron-CnmLLh3E.d.mts} +3 -3
  74. package/dist/Cron-CnmLLh3E.d.mts.map +1 -0
  75. package/dist/{Cron-cdjlSKNp.d.mts → Cron-DufAeHry.d.cts} +3 -3
  76. package/dist/Cron-DufAeHry.d.cts.map +1 -0
  77. package/dist/{CronBuilder-d2jh-IB2.mjs → CronBuilder-02HSIHJr.mjs} +4 -4
  78. package/dist/CronBuilder-02HSIHJr.mjs.map +1 -0
  79. package/dist/{CronBuilder-CcxKRtVP.cjs → CronBuilder-DC2zUS8a.cjs} +4 -4
  80. package/dist/CronBuilder-DC2zUS8a.cjs.map +1 -0
  81. package/dist/{CronBuilder-BC4m5-p1.d.mts → CronBuilder-anUSbMxb.d.mts} +4 -4
  82. package/dist/CronBuilder-anUSbMxb.d.mts.map +1 -0
  83. package/dist/{CronBuilder-DKVXyE0Q.d.cts → CronBuilder-fyqf_X8n.d.cts} +4 -4
  84. package/dist/CronBuilder-fyqf_X8n.d.cts.map +1 -0
  85. package/dist/{Endpoint-BVGZXFyV.cjs → Endpoint-BCWVbi8l.cjs} +6 -6
  86. package/dist/Endpoint-BCWVbi8l.cjs.map +1 -0
  87. package/dist/{Endpoint-BPv9_-m_.d.cts → Endpoint-BlcHiGNx.d.cts} +3 -3
  88. package/dist/Endpoint-BlcHiGNx.d.cts.map +1 -0
  89. package/dist/{Endpoint-BdwG75G_.d.mts → Endpoint-DEHuy46S.d.mts} +4 -4
  90. package/dist/Endpoint-DEHuy46S.d.mts.map +1 -0
  91. package/dist/{Endpoint-CuOEswxJ.mjs → Endpoint-ygxv2Ia6.mjs} +6 -6
  92. package/dist/Endpoint-ygxv2Ia6.mjs.map +1 -0
  93. package/dist/{EndpointBuilder-DIy_m1bu.d.cts → EndpointBuilder-DPLAUHqg.d.cts} +4 -4
  94. package/dist/EndpointBuilder-DPLAUHqg.d.cts.map +1 -0
  95. package/dist/{EndpointBuilder-B3az942t.d.mts → EndpointBuilder-DaeCeneF.d.mts} +5 -5
  96. package/dist/EndpointBuilder-DaeCeneF.d.mts.map +1 -0
  97. package/dist/{EndpointBuilder-Cgj1P_ra.cjs → EndpointBuilder-J5D67Y6a.cjs} +6 -6
  98. package/dist/EndpointBuilder-J5D67Y6a.cjs.map +1 -0
  99. package/dist/{EndpointBuilder-DnCB1h1j.mjs → EndpointBuilder-tn4zqoyw.mjs} +6 -6
  100. package/dist/EndpointBuilder-tn4zqoyw.mjs.map +1 -0
  101. package/dist/{EndpointFactory-CbdxPCIH.mjs → EndpointFactory-CIUZTTAF.mjs} +7 -7
  102. package/dist/EndpointFactory-CIUZTTAF.mjs.map +1 -0
  103. package/dist/{EndpointFactory-CyPbm3AD.d.cts → EndpointFactory-CiKcb5PX.d.cts} +4 -4
  104. package/dist/EndpointFactory-CiKcb5PX.d.cts.map +1 -0
  105. package/dist/{EndpointFactory-C-0nE6Jg.d.mts → EndpointFactory-DufM0t2z.d.mts} +4 -4
  106. package/dist/EndpointFactory-DufM0t2z.d.mts.map +1 -0
  107. package/dist/{EndpointFactory-CYj6BYok.cjs → EndpointFactory-d5uwWFkK.cjs} +7 -7
  108. package/dist/EndpointFactory-d5uwWFkK.cjs.map +1 -0
  109. package/dist/{Function-DDZb1525.cjs → Function-2qWSZqYB.cjs} +3 -3
  110. package/dist/Function-2qWSZqYB.cjs.map +1 -0
  111. package/dist/{Function-Cf7f_kCz.d.cts → Function-CbEohg13.d.cts} +3 -3
  112. package/dist/Function-CbEohg13.d.cts.map +1 -0
  113. package/dist/{Function-BVHqIDp9.mjs → Function-CdF1HmFu.mjs} +3 -3
  114. package/dist/Function-CdF1HmFu.mjs.map +1 -0
  115. package/dist/{Function-DN2G6OT5.d.mts → Function-EjIOLxlh.d.mts} +3 -3
  116. package/dist/Function-EjIOLxlh.d.mts.map +1 -0
  117. package/dist/{FunctionBuilder-DswJ-9sD.cjs → FunctionBuilder-B-pbgm09.cjs} +4 -4
  118. package/dist/FunctionBuilder-B-pbgm09.cjs.map +1 -0
  119. package/dist/{FunctionBuilder-CJBzzXL3.d.cts → FunctionBuilder-CX3ooNdq.d.cts} +4 -4
  120. package/dist/FunctionBuilder-CX3ooNdq.d.cts.map +1 -0
  121. package/dist/{FunctionBuilder-Cxx8D2na.d.mts → FunctionBuilder-D11ytDyy.d.mts} +4 -4
  122. package/dist/FunctionBuilder-D11ytDyy.d.mts.map +1 -0
  123. package/dist/{FunctionBuilder-CrDYgfiI.mjs → FunctionBuilder-DaWVthAJ.mjs} +4 -4
  124. package/dist/FunctionBuilder-DaWVthAJ.mjs.map +1 -0
  125. package/dist/{FunctionExecutionWrapper-DF260Aaj.d.mts → FunctionExecutionWrapper-BJcRjH9Z.d.cts} +5 -5
  126. package/dist/FunctionExecutionWrapper-BJcRjH9Z.d.cts.map +1 -0
  127. package/dist/{FunctionExecutionWrapper-BYI2bGTL.cjs → FunctionExecutionWrapper-C6ChBNHs.cjs} +3 -3
  128. package/dist/FunctionExecutionWrapper-C6ChBNHs.cjs.map +1 -0
  129. package/dist/{FunctionExecutionWrapper-Qy8bmgFR.d.cts → FunctionExecutionWrapper-D3RNjGIR.d.mts} +5 -5
  130. package/dist/FunctionExecutionWrapper-D3RNjGIR.d.mts.map +1 -0
  131. package/dist/{FunctionExecutionWrapper-CLDh7Z2_.mjs → FunctionExecutionWrapper-Dj3pmXaN.mjs} +3 -3
  132. package/dist/FunctionExecutionWrapper-Dj3pmXaN.mjs.map +1 -0
  133. package/dist/{HonoEndpointAdaptor-BaPlUhz0.d.mts → HonoEndpointAdaptor-CKP6nrG2.d.mts} +11 -6
  134. package/dist/HonoEndpointAdaptor-CKP6nrG2.d.mts.map +1 -0
  135. package/dist/HonoEndpointAdaptor-Cc8Rnp9G.mjs +251 -0
  136. package/dist/HonoEndpointAdaptor-Cc8Rnp9G.mjs.map +1 -0
  137. package/dist/{HonoEndpointAdaptor-YcRHYALH.d.cts → HonoEndpointAdaptor-hrrvyfw9.d.cts} +10 -5
  138. package/dist/HonoEndpointAdaptor-hrrvyfw9.d.cts.map +1 -0
  139. package/dist/HonoEndpointAdaptor-xGnDZa3a.cjs +257 -0
  140. package/dist/HonoEndpointAdaptor-xGnDZa3a.cjs.map +1 -0
  141. package/dist/{Subscriber-COYMSevD.d.cts → Subscriber-BBcIOkhW.d.cts} +2 -2
  142. package/dist/Subscriber-BBcIOkhW.d.cts.map +1 -0
  143. package/dist/{Subscriber-ikctpU3I.d.mts → Subscriber-BpTAXvbM.d.mts} +2 -2
  144. package/dist/Subscriber-BpTAXvbM.d.mts.map +1 -0
  145. package/dist/{Subscriber-BiHjVXtM.cjs → Subscriber-CL4iYm01.cjs} +2 -2
  146. package/dist/Subscriber-CL4iYm01.cjs.map +1 -0
  147. package/dist/{Subscriber-BmPf9GFb.mjs → Subscriber-CZ8Smwd2.mjs} +2 -2
  148. package/dist/Subscriber-CZ8Smwd2.mjs.map +1 -0
  149. package/dist/{SubscriberBuilder-DJPEeYDJ.mjs → SubscriberBuilder-CxQg3TTm.mjs} +2 -2
  150. package/dist/SubscriberBuilder-CxQg3TTm.mjs.map +1 -0
  151. package/dist/{SubscriberBuilder-Cp1C-xtT.cjs → SubscriberBuilder-D0OS3hd7.cjs} +2 -2
  152. package/dist/SubscriberBuilder-D0OS3hd7.cjs.map +1 -0
  153. package/dist/{SubscriberBuilder-D_9zzllj.d.mts → SubscriberBuilder-D7IgufwB.d.cts} +3 -3
  154. package/dist/SubscriberBuilder-D7IgufwB.d.cts.map +1 -0
  155. package/dist/{SubscriberBuilder-ivHAGIVi.d.cts → SubscriberBuilder-DOFBbWLt.d.mts} +3 -3
  156. package/dist/SubscriberBuilder-DOFBbWLt.d.mts.map +1 -0
  157. package/dist/{TestEndpointAdaptor-DB7bREhS.d.mts → TestEndpointAdaptor-BnJusjf7.d.mts} +4 -4
  158. package/dist/TestEndpointAdaptor-BnJusjf7.d.mts.map +1 -0
  159. package/dist/TestEndpointAdaptor-CPL8ru6q.mjs +170 -0
  160. package/dist/TestEndpointAdaptor-CPL8ru6q.mjs.map +1 -0
  161. package/dist/TestEndpointAdaptor-Ca4K26_d.cjs +176 -0
  162. package/dist/TestEndpointAdaptor-Ca4K26_d.cjs.map +1 -0
  163. package/dist/{TestEndpointAdaptor-C10xBI--.d.cts → TestEndpointAdaptor-EPPTjntv.d.cts} +3 -3
  164. package/dist/TestEndpointAdaptor-EPPTjntv.d.cts.map +1 -0
  165. package/dist/adaptors/aws.cjs +12 -12
  166. package/dist/adaptors/aws.d.cts +15 -14
  167. package/dist/adaptors/aws.d.mts +16 -15
  168. package/dist/adaptors/aws.mjs +12 -12
  169. package/dist/adaptors/hono.cjs +10 -9
  170. package/dist/adaptors/hono.d.cts +8 -8
  171. package/dist/adaptors/hono.d.mts +9 -9
  172. package/dist/adaptors/hono.mjs +10 -9
  173. package/dist/adaptors/testing.cjs +8 -7
  174. package/dist/adaptors/testing.d.cts +8 -8
  175. package/dist/adaptors/testing.d.mts +9 -9
  176. package/dist/adaptors/testing.mjs +8 -7
  177. package/dist/crons/Cron.cjs +6 -6
  178. package/dist/crons/Cron.d.cts +6 -6
  179. package/dist/crons/Cron.d.mts +6 -6
  180. package/dist/crons/Cron.mjs +6 -6
  181. package/dist/crons/CronBuilder.cjs +7 -7
  182. package/dist/crons/CronBuilder.d.cts +7 -7
  183. package/dist/crons/CronBuilder.d.mts +7 -7
  184. package/dist/crons/CronBuilder.mjs +7 -7
  185. package/dist/crons/index.cjs +7 -7
  186. package/dist/crons/index.cjs.map +1 -1
  187. package/dist/crons/index.d.cts +11 -11
  188. package/dist/crons/index.d.mts +7 -7
  189. package/dist/crons/index.mjs +7 -7
  190. package/dist/crons/index.mjs.map +1 -1
  191. package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.cjs +7 -7
  192. package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.d.cts +10 -9
  193. package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.d.mts +11 -10
  194. package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.mjs +7 -7
  195. package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.cjs +8 -8
  196. package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.d.cts +10 -9
  197. package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.d.mts +11 -10
  198. package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.mjs +8 -8
  199. package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.cjs +8 -8
  200. package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.d.cts +11 -10
  201. package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.d.mts +12 -11
  202. package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.mjs +8 -8
  203. package/dist/endpoints/Authorizer.cjs +1 -1
  204. package/dist/endpoints/Authorizer.d.cts +1 -1
  205. package/dist/endpoints/Authorizer.d.mts +1 -1
  206. package/dist/endpoints/Authorizer.mjs +1 -1
  207. package/dist/endpoints/Endpoint.cjs +6 -6
  208. package/dist/endpoints/Endpoint.d.cts +7 -7
  209. package/dist/endpoints/Endpoint.d.mts +8 -8
  210. package/dist/endpoints/Endpoint.mjs +6 -6
  211. package/dist/endpoints/EndpointBuilder.cjs +9 -9
  212. package/dist/endpoints/EndpointBuilder.d.cts +8 -8
  213. package/dist/endpoints/EndpointBuilder.d.mts +9 -9
  214. package/dist/endpoints/EndpointBuilder.mjs +9 -9
  215. package/dist/endpoints/EndpointFactory.cjs +10 -10
  216. package/dist/endpoints/EndpointFactory.d.cts +9 -9
  217. package/dist/endpoints/EndpointFactory.d.mts +10 -10
  218. package/dist/endpoints/EndpointFactory.mjs +10 -10
  219. package/dist/endpoints/HonoEndpointAdaptor.cjs +10 -9
  220. package/dist/endpoints/HonoEndpointAdaptor.d.cts +8 -8
  221. package/dist/endpoints/HonoEndpointAdaptor.d.mts +9 -9
  222. package/dist/endpoints/HonoEndpointAdaptor.mjs +10 -9
  223. package/dist/endpoints/TestEndpointAdaptor.cjs +8 -7
  224. package/dist/endpoints/TestEndpointAdaptor.d.cts +8 -8
  225. package/dist/endpoints/TestEndpointAdaptor.d.mts +9 -9
  226. package/dist/endpoints/TestEndpointAdaptor.mjs +8 -7
  227. package/dist/endpoints/audit.d.cts +7 -7
  228. package/dist/endpoints/audit.d.mts +8 -8
  229. package/dist/endpoints/helpers.cjs +7 -7
  230. package/dist/endpoints/helpers.d.cts +7 -7
  231. package/dist/endpoints/helpers.d.cts.map +1 -1
  232. package/dist/endpoints/helpers.d.mts +8 -8
  233. package/dist/endpoints/helpers.d.mts.map +1 -1
  234. package/dist/endpoints/helpers.mjs +7 -7
  235. package/dist/endpoints/index.cjs +20 -10
  236. package/dist/endpoints/index.cjs.map +1 -1
  237. package/dist/endpoints/index.d.cts +14 -12
  238. package/dist/endpoints/index.d.cts.map +1 -1
  239. package/dist/endpoints/index.d.mts +15 -13
  240. package/dist/endpoints/index.d.mts.map +1 -1
  241. package/dist/endpoints/index.mjs +13 -11
  242. package/dist/endpoints/index.mjs.map +1 -1
  243. package/dist/endpoints/lazyAccessors.cjs +10 -0
  244. package/dist/endpoints/lazyAccessors.d.cts +10 -0
  245. package/dist/endpoints/lazyAccessors.d.mts +10 -0
  246. package/dist/endpoints/lazyAccessors.mjs +3 -0
  247. package/dist/endpoints/parseHonoQuery.cjs +1 -1
  248. package/dist/endpoints/parseHonoQuery.mjs +1 -1
  249. package/dist/endpoints/parseQueryParams.d.cts.map +1 -1
  250. package/dist/endpoints/parseQueryParams.d.mts.map +1 -1
  251. package/dist/endpoints/processAudits.d.cts +7 -7
  252. package/dist/endpoints/processAudits.d.cts.map +1 -1
  253. package/dist/endpoints/processAudits.d.mts +8 -8
  254. package/dist/endpoints/processAudits.d.mts.map +1 -1
  255. package/dist/endpoints/rls.cjs +1 -1
  256. package/dist/endpoints/rls.d.cts +7 -7
  257. package/dist/endpoints/rls.d.mts +8 -8
  258. package/dist/endpoints/rls.mjs +1 -1
  259. package/dist/functions/AWSLambdaFunction.cjs +6 -6
  260. package/dist/functions/AWSLambdaFunction.d.cts +4 -4
  261. package/dist/functions/AWSLambdaFunction.d.mts +4 -4
  262. package/dist/functions/AWSLambdaFunction.mjs +6 -6
  263. package/dist/functions/BaseFunctionBuilder.cjs +2 -2
  264. package/dist/functions/BaseFunctionBuilder.d.cts +2 -2
  265. package/dist/functions/BaseFunctionBuilder.d.mts +2 -2
  266. package/dist/functions/BaseFunctionBuilder.mjs +2 -2
  267. package/dist/functions/Function.cjs +2 -2
  268. package/dist/functions/Function.d.cts +2 -2
  269. package/dist/functions/Function.d.mts +2 -2
  270. package/dist/functions/Function.mjs +2 -2
  271. package/dist/functions/FunctionBuilder.cjs +4 -4
  272. package/dist/functions/FunctionBuilder.d.cts +4 -4
  273. package/dist/functions/FunctionBuilder.d.mts +4 -4
  274. package/dist/functions/FunctionBuilder.mjs +4 -4
  275. package/dist/functions/FunctionExecutionWrapper.cjs +5 -5
  276. package/dist/functions/FunctionExecutionWrapper.d.cts +3 -3
  277. package/dist/functions/FunctionExecutionWrapper.d.mts +3 -3
  278. package/dist/functions/FunctionExecutionWrapper.mjs +5 -5
  279. package/dist/functions/TestFunctionAdaptor.cjs +7 -7
  280. package/dist/functions/TestFunctionAdaptor.cjs.map +1 -1
  281. package/dist/functions/TestFunctionAdaptor.d.cts +3 -3
  282. package/dist/functions/TestFunctionAdaptor.d.cts.map +1 -1
  283. package/dist/functions/TestFunctionAdaptor.d.mts +3 -3
  284. package/dist/functions/TestFunctionAdaptor.d.mts.map +1 -1
  285. package/dist/functions/TestFunctionAdaptor.mjs +7 -7
  286. package/dist/functions/TestFunctionAdaptor.mjs.map +1 -1
  287. package/dist/functions/index.cjs +5 -5
  288. package/dist/functions/index.d.cts +5 -5
  289. package/dist/functions/index.d.mts +5 -5
  290. package/dist/functions/index.mjs +5 -5
  291. package/dist/{functions-fTid0RMK.cjs → functions-CUEv5NC3.cjs} +2 -2
  292. package/dist/functions-CUEv5NC3.cjs.map +1 -0
  293. package/dist/functions-DOYBrb7n.mjs +8 -0
  294. package/dist/functions-DOYBrb7n.mjs.map +1 -0
  295. package/dist/{helpers-ByRTDO_m.mjs → helpers-Dl1eszfi.mjs} +2 -2
  296. package/dist/helpers-Dl1eszfi.mjs.map +1 -0
  297. package/dist/{helpers-BcP1tXAi.cjs → helpers-QMdfdnvU.cjs} +2 -2
  298. package/dist/helpers-QMdfdnvU.cjs.map +1 -0
  299. package/dist/{index-BWzGIj06.d.mts → index-BrGtMlpJ.d.cts} +2 -2
  300. package/dist/index-BrGtMlpJ.d.cts.map +1 -0
  301. package/dist/index-Dn4py3Db.d.mts +12 -0
  302. package/dist/index-Dn4py3Db.d.mts.map +1 -0
  303. package/dist/index.cjs +4 -2
  304. package/dist/index.d.cts +3 -2
  305. package/dist/index.d.mts +4 -3
  306. package/dist/index.mjs +2 -2
  307. package/dist/lazyAccessors-B-Jgkg2o.mjs +175 -0
  308. package/dist/lazyAccessors-B-Jgkg2o.mjs.map +1 -0
  309. package/dist/lazyAccessors-B8Hhras9.cjs +223 -0
  310. package/dist/lazyAccessors-B8Hhras9.cjs.map +1 -0
  311. package/dist/lazyAccessors-BFAj2-S4.d.mts +49 -0
  312. package/dist/lazyAccessors-BFAj2-S4.d.mts.map +1 -0
  313. package/dist/lazyAccessors-knaNZuTN.d.cts +49 -0
  314. package/dist/lazyAccessors-knaNZuTN.d.cts.map +1 -0
  315. package/dist/{parseHonoQuery-CZC5_97v.cjs → parseHonoQuery-D4MhxTRc.cjs} +1 -1
  316. package/dist/parseHonoQuery-D4MhxTRc.cjs.map +1 -0
  317. package/dist/{parseHonoQuery-DDgIkTO4.mjs → parseHonoQuery-DpK3sGPc.mjs} +1 -1
  318. package/dist/parseHonoQuery-DpK3sGPc.mjs.map +1 -0
  319. package/dist/parseQueryParams-BSNkjmZ9.cjs.map +1 -1
  320. package/dist/parseQueryParams-UMTRnRrW.mjs.map +1 -1
  321. package/dist/processAudits-CzHkPokQ.cjs.map +1 -1
  322. package/dist/processAudits-Dj8UGqcW.mjs.map +1 -1
  323. package/dist/publisher-BXG9YiRi.d.mts +16 -0
  324. package/dist/publisher-BXG9YiRi.d.mts.map +1 -0
  325. package/dist/publisher-Bw4770Hi.mjs.map +1 -1
  326. package/dist/publisher-D9ngDXg3.d.cts +16 -0
  327. package/dist/publisher-D9ngDXg3.d.cts.map +1 -0
  328. package/dist/publisher-lFQleddL.cjs.map +1 -1
  329. package/dist/publisher.d.cts +3 -16
  330. package/dist/publisher.d.mts +3 -16
  331. package/dist/{rls-CmJ7bRsz.cjs → rls-BrywnrQb.cjs} +1 -1
  332. package/dist/{rls-CmJ7bRsz.cjs.map → rls-BrywnrQb.cjs.map} +1 -1
  333. package/dist/{rls-Bf3FRwto.mjs → rls-C0cWOnk4.mjs} +1 -1
  334. package/dist/{rls-Bf3FRwto.mjs.map → rls-C0cWOnk4.mjs.map} +1 -1
  335. package/dist/subscribers/AWSLambdaSubscriberAdaptor.cjs +1 -1
  336. package/dist/subscribers/AWSLambdaSubscriberAdaptor.d.cts +3 -3
  337. package/dist/subscribers/AWSLambdaSubscriberAdaptor.d.mts +3 -3
  338. package/dist/subscribers/AWSLambdaSubscriberAdaptor.mjs +1 -1
  339. package/dist/subscribers/Subscriber.cjs +2 -2
  340. package/dist/subscribers/Subscriber.d.cts +2 -2
  341. package/dist/subscribers/Subscriber.d.mts +2 -2
  342. package/dist/subscribers/Subscriber.mjs +2 -2
  343. package/dist/subscribers/SubscriberBuilder.cjs +3 -3
  344. package/dist/subscribers/SubscriberBuilder.d.cts +3 -3
  345. package/dist/subscribers/SubscriberBuilder.d.mts +3 -3
  346. package/dist/subscribers/SubscriberBuilder.mjs +3 -3
  347. package/dist/subscribers/index.cjs +3 -3
  348. package/dist/subscribers/index.cjs.map +1 -1
  349. package/dist/subscribers/index.d.cts +5 -5
  350. package/dist/subscribers/index.d.cts.map +1 -1
  351. package/dist/subscribers/index.d.mts +5 -5
  352. package/dist/subscribers/index.d.mts.map +1 -1
  353. package/dist/subscribers/index.mjs +3 -3
  354. package/dist/subscribers/index.mjs.map +1 -1
  355. package/dist/telemetry-BTaiRqPo.d.cts +95 -0
  356. package/dist/telemetry-BTaiRqPo.d.cts.map +1 -0
  357. package/dist/telemetry-yAHf5yDs.d.mts +95 -0
  358. package/dist/telemetry-yAHf5yDs.d.mts.map +1 -0
  359. package/dist/telemetry.cjs +0 -0
  360. package/dist/telemetry.d.cts +2 -0
  361. package/dist/telemetry.d.mts +2 -0
  362. package/dist/telemetry.mjs +0 -0
  363. package/dist/types-B5H3piDg.d.cts.map +1 -1
  364. package/dist/{types-DdIlpxAd.d.mts → types-Dw-iLd3Y.d.mts} +1 -1
  365. package/dist/types-Dw-iLd3Y.d.mts.map +1 -0
  366. package/dist/types.d.mts +1 -1
  367. package/package.json +19 -18
  368. package/src/Construct.ts +189 -94
  369. package/src/__benchmarks__/build-time-optimization.bench.ts +274 -0
  370. package/src/__benchmarks__/endpoint.bench.ts +375 -375
  371. package/src/__benchmarks__/fixtures.ts +241 -0
  372. package/src/__benchmarks__/hono-adaptor.bench.ts +533 -0
  373. package/src/__benchmarks__/hono-server.bench.ts +206 -206
  374. package/src/__benchmarks__/response-builder.bench.ts +428 -0
  375. package/src/__benchmarks__/strategies/strategy-a-lazy-services.ts +319 -0
  376. package/src/__benchmarks__/strategies/strategy-c-middleware.ts +530 -0
  377. package/src/__benchmarks__/strategies/strategy-d-opt-in-events.ts +567 -0
  378. package/src/__tests__/Construct.environment.spec.ts +572 -351
  379. package/src/__tests__/publisher.setting.spec.ts +496 -499
  380. package/src/__tests__/publisher.spec.ts +440 -442
  381. package/src/crons/Cron.ts +117 -117
  382. package/src/crons/CronBuilder.ts +237 -238
  383. package/src/crons/__tests__/Cron.spec.ts +448 -448
  384. package/src/crons/__tests__/CronBuilder.state-isolation.spec.ts +214 -214
  385. package/src/crons/index.ts +4 -4
  386. package/src/endpoints/AmazonApiGatewayEndpointAdaptor.ts +571 -463
  387. package/src/endpoints/AmazonApiGatewayV1EndpointAdaptor.ts +86 -86
  388. package/src/endpoints/AmazonApiGatewayV2EndpointAdaptor.ts +85 -81
  389. package/src/endpoints/Authorizer.ts +100 -100
  390. package/src/endpoints/Endpoint.ts +921 -937
  391. package/src/endpoints/EndpointBuilder.ts +703 -703
  392. package/src/endpoints/EndpointFactory.ts +1054 -1056
  393. package/src/endpoints/HonoEndpointAdaptor.ts +621 -548
  394. package/src/endpoints/TestEndpointAdaptor.ts +372 -353
  395. package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.audits.spec.ts +499 -0
  396. package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.events.spec.ts +541 -542
  397. package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.spec.ts +1172 -1174
  398. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.audits.spec.ts +599 -599
  399. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.events.spec.ts +710 -710
  400. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.factory-publisher.spec.ts +280 -280
  401. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.kysely-audit.integration.spec.ts +924 -730
  402. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.rls.spec.ts +307 -0
  403. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.spec.ts +408 -408
  404. package/src/endpoints/__tests__/Authorizer.spec.ts +286 -0
  405. package/src/endpoints/__tests__/Endpoint.cookies.spec.ts +162 -162
  406. package/src/endpoints/__tests__/Endpoint.headers.spec.ts +182 -182
  407. package/src/endpoints/__tests__/Endpoint.manifest.spec.ts +158 -159
  408. package/src/endpoints/__tests__/Endpoint.spec.ts +819 -822
  409. package/src/endpoints/__tests__/EndpointBuilder.audit.spec.ts +427 -427
  410. package/src/endpoints/__tests__/EndpointBuilder.spec.ts +478 -478
  411. package/src/endpoints/__tests__/EndpointFactory.authorizers.spec.ts +426 -426
  412. package/src/endpoints/__tests__/EndpointFactory.database-auditor.spec.ts +501 -501
  413. package/src/endpoints/__tests__/EndpointFactory.reference-audit.spec.ts +177 -177
  414. package/src/endpoints/__tests__/EndpointFactory.spec.ts +471 -471
  415. package/src/endpoints/__tests__/EndpointFactory.state-isolation.spec.ts +143 -143
  416. package/src/endpoints/__tests__/HonoEndpointAdaptor.audit-transactions.spec.ts +663 -663
  417. package/src/endpoints/__tests__/HonoEndpointAdaptor.audits.spec.ts +608 -608
  418. package/src/endpoints/__tests__/HonoEndpointAdaptor.events.spec.ts +561 -561
  419. package/src/endpoints/__tests__/HonoEndpointAdaptor.kysely-audit.integration.spec.ts +1036 -1036
  420. package/src/endpoints/__tests__/HonoEndpointAdaptor.openapi.spec.ts +278 -278
  421. package/src/endpoints/__tests__/HonoEndpointAdaptor.spec.ts +1093 -1093
  422. package/src/endpoints/__tests__/ResponseBuilder.spec.ts +230 -230
  423. package/src/endpoints/__tests__/TestEndpointAdaptor.audits.spec.ts +569 -569
  424. package/src/endpoints/__tests__/TestEndpointAdaptor.spec.ts +841 -841
  425. package/src/endpoints/__tests__/endpoint-types.test.ts +68 -68
  426. package/src/endpoints/__tests__/helpers.spec.ts +37 -0
  427. package/src/endpoints/__tests__/lazyAccessors.spec.ts +330 -0
  428. package/src/endpoints/__tests__/processAudits.spec.ts +631 -0
  429. package/src/endpoints/audit.ts +51 -51
  430. package/src/endpoints/helpers.ts +34 -35
  431. package/src/endpoints/index.ts +33 -23
  432. package/src/endpoints/lazyAccessors.ts +241 -0
  433. package/src/endpoints/parseHonoQuery.ts +41 -41
  434. package/src/endpoints/parseQueryParams.ts +36 -36
  435. package/src/endpoints/processAudits.ts +269 -269
  436. package/src/endpoints/rls.ts +16 -16
  437. package/src/functions/AWSLambdaFunction.ts +294 -295
  438. package/src/functions/BaseFunctionBuilder.ts +185 -185
  439. package/src/functions/Function.ts +190 -190
  440. package/src/functions/FunctionBuilder.ts +353 -353
  441. package/src/functions/FunctionExecutionWrapper.ts +199 -200
  442. package/src/functions/TestFunctionAdaptor.ts +191 -191
  443. package/src/functions/__tests__/AWSLambdaFunctionAdaptor.spec.ts +424 -424
  444. package/src/functions/__tests__/Function.audits.spec.ts +364 -364
  445. package/src/functions/__tests__/Function.spec.ts +453 -454
  446. package/src/functions/__tests__/FunctionBuilder.state-isolation.spec.ts +179 -179
  447. package/src/functions/__tests__/TestFunctionAdaptor.spec.ts +369 -369
  448. package/src/functions/index.ts +6 -4
  449. package/src/index.ts +18 -9
  450. package/src/publisher.ts +71 -72
  451. package/src/subscribers/AWSLambdaSubscriberAdaptor.ts +244 -248
  452. package/src/subscribers/Subscriber.ts +82 -84
  453. package/src/subscribers/SubscriberBuilder.ts +129 -129
  454. package/src/subscribers/__tests__/AWSLambdaSubscriberAdaptor.spec.ts +589 -589
  455. package/src/subscribers/__tests__/Subscriber.spec.ts +402 -404
  456. package/src/subscribers/index.ts +1 -0
  457. package/src/telemetry.ts +103 -0
  458. package/src/types.ts +7 -7
  459. package/test.ts +58 -59
  460. package/dist/AWSLambdaFunction-BdebRMUh.d.mts.map +0 -1
  461. package/dist/AWSLambdaFunction-C54a1doJ.mjs.map +0 -1
  462. package/dist/AWSLambdaFunction-D0tEOTXQ.d.cts.map +0 -1
  463. package/dist/AWSLambdaFunction-EPGY4s7i.cjs.map +0 -1
  464. package/dist/AWSLambdaSubscriberAdaptor-BLfO612H.mjs.map +0 -1
  465. package/dist/AWSLambdaSubscriberAdaptor-BNcYYZ-P.cjs.map +0 -1
  466. package/dist/AWSLambdaSubscriberAdaptor-DrFAvHOp.d.mts.map +0 -1
  467. package/dist/AWSLambdaSubscriberAdaptor-Dx-Ks1Jp.d.cts.map +0 -1
  468. package/dist/AmazonApiGatewayEndpointAdaptor-BT9JXihC.mjs.map +0 -1
  469. package/dist/AmazonApiGatewayEndpointAdaptor-DLqnYQ4E.d.cts.map +0 -1
  470. package/dist/AmazonApiGatewayEndpointAdaptor-DNFvvdmW.cjs.map +0 -1
  471. package/dist/AmazonApiGatewayEndpointAdaptor-qlKXuZxy.d.mts.map +0 -1
  472. package/dist/AmazonApiGatewayV1EndpointAdaptor-CShQI8Gk.mjs.map +0 -1
  473. package/dist/AmazonApiGatewayV1EndpointAdaptor-Ccl8B8kG.cjs.map +0 -1
  474. package/dist/AmazonApiGatewayV1EndpointAdaptor-DyUaJIhB.d.cts.map +0 -1
  475. package/dist/AmazonApiGatewayV1EndpointAdaptor-MRUxs3Xi.d.mts.map +0 -1
  476. package/dist/AmazonApiGatewayV2EndpointAdaptor-D8-0Aab4.cjs.map +0 -1
  477. package/dist/AmazonApiGatewayV2EndpointAdaptor-M1-w0U5R.d.cts.map +0 -1
  478. package/dist/AmazonApiGatewayV2EndpointAdaptor-fuLM6M9k.d.mts.map +0 -1
  479. package/dist/AmazonApiGatewayV2EndpointAdaptor-lCRzGE4q.mjs.map +0 -1
  480. package/dist/Authorizer-B-btowNd.d.cts.map +0 -1
  481. package/dist/Authorizer-C0ge_tc8.cjs.map +0 -1
  482. package/dist/Authorizer-gWxYsGEp.d.mts.map +0 -1
  483. package/dist/Authorizer-r9U3y_ms.mjs.map +0 -1
  484. package/dist/BaseFunctionBuilder-BAtutR6q.d.cts.map +0 -1
  485. package/dist/BaseFunctionBuilder-Czi1Jwza.mjs.map +0 -1
  486. package/dist/BaseFunctionBuilder-DRY419e7.d.mts.map +0 -1
  487. package/dist/BaseFunctionBuilder-MYG3C9ug.cjs.map +0 -1
  488. package/dist/Construct-Ba5cMxib.cjs.map +0 -1
  489. package/dist/Construct-C4rPE67v.d.cts.map +0 -1
  490. package/dist/Construct-DdyGHuag.mjs +0 -78
  491. package/dist/Construct-DdyGHuag.mjs.map +0 -1
  492. package/dist/Construct-XrijZFFh.d.mts.map +0 -1
  493. package/dist/Cron-BxhGs5up.mjs.map +0 -1
  494. package/dist/Cron-CGF4YAfM.cjs.map +0 -1
  495. package/dist/Cron-bDLcTvV5.d.cts.map +0 -1
  496. package/dist/Cron-cdjlSKNp.d.mts.map +0 -1
  497. package/dist/CronBuilder-BC4m5-p1.d.mts.map +0 -1
  498. package/dist/CronBuilder-CcxKRtVP.cjs.map +0 -1
  499. package/dist/CronBuilder-DKVXyE0Q.d.cts.map +0 -1
  500. package/dist/CronBuilder-d2jh-IB2.mjs.map +0 -1
  501. package/dist/Endpoint-BPv9_-m_.d.cts.map +0 -1
  502. package/dist/Endpoint-BVGZXFyV.cjs.map +0 -1
  503. package/dist/Endpoint-BdwG75G_.d.mts.map +0 -1
  504. package/dist/Endpoint-CuOEswxJ.mjs.map +0 -1
  505. package/dist/EndpointBuilder-B3az942t.d.mts.map +0 -1
  506. package/dist/EndpointBuilder-Cgj1P_ra.cjs.map +0 -1
  507. package/dist/EndpointBuilder-DIy_m1bu.d.cts.map +0 -1
  508. package/dist/EndpointBuilder-DnCB1h1j.mjs.map +0 -1
  509. package/dist/EndpointFactory-C-0nE6Jg.d.mts.map +0 -1
  510. package/dist/EndpointFactory-CYj6BYok.cjs.map +0 -1
  511. package/dist/EndpointFactory-CbdxPCIH.mjs.map +0 -1
  512. package/dist/EndpointFactory-CyPbm3AD.d.cts.map +0 -1
  513. package/dist/Function-BVHqIDp9.mjs.map +0 -1
  514. package/dist/Function-Cf7f_kCz.d.cts.map +0 -1
  515. package/dist/Function-DDZb1525.cjs.map +0 -1
  516. package/dist/Function-DN2G6OT5.d.mts.map +0 -1
  517. package/dist/FunctionBuilder-CJBzzXL3.d.cts.map +0 -1
  518. package/dist/FunctionBuilder-CrDYgfiI.mjs.map +0 -1
  519. package/dist/FunctionBuilder-Cxx8D2na.d.mts.map +0 -1
  520. package/dist/FunctionBuilder-DswJ-9sD.cjs.map +0 -1
  521. package/dist/FunctionExecutionWrapper-BYI2bGTL.cjs.map +0 -1
  522. package/dist/FunctionExecutionWrapper-CLDh7Z2_.mjs.map +0 -1
  523. package/dist/FunctionExecutionWrapper-DF260Aaj.d.mts.map +0 -1
  524. package/dist/FunctionExecutionWrapper-Qy8bmgFR.d.cts.map +0 -1
  525. package/dist/HonoEndpointAdaptor-BaPlUhz0.d.mts.map +0 -1
  526. package/dist/HonoEndpointAdaptor-CQe2FqMR.cjs +0 -234
  527. package/dist/HonoEndpointAdaptor-CQe2FqMR.cjs.map +0 -1
  528. package/dist/HonoEndpointAdaptor-Ce-2HBxn.mjs +0 -228
  529. package/dist/HonoEndpointAdaptor-Ce-2HBxn.mjs.map +0 -1
  530. package/dist/HonoEndpointAdaptor-YcRHYALH.d.cts.map +0 -1
  531. package/dist/Subscriber-BiHjVXtM.cjs.map +0 -1
  532. package/dist/Subscriber-BmPf9GFb.mjs.map +0 -1
  533. package/dist/Subscriber-COYMSevD.d.cts.map +0 -1
  534. package/dist/Subscriber-ikctpU3I.d.mts.map +0 -1
  535. package/dist/SubscriberBuilder-Cp1C-xtT.cjs.map +0 -1
  536. package/dist/SubscriberBuilder-DJPEeYDJ.mjs.map +0 -1
  537. package/dist/SubscriberBuilder-D_9zzllj.d.mts.map +0 -1
  538. package/dist/SubscriberBuilder-ivHAGIVi.d.cts.map +0 -1
  539. package/dist/TestEndpointAdaptor-C10xBI--.d.cts.map +0 -1
  540. package/dist/TestEndpointAdaptor-DB7bREhS.d.mts.map +0 -1
  541. package/dist/TestEndpointAdaptor-DJgik2Wj.mjs +0 -160
  542. package/dist/TestEndpointAdaptor-DJgik2Wj.mjs.map +0 -1
  543. package/dist/TestEndpointAdaptor-ZbtQiuHE.cjs +0 -166
  544. package/dist/TestEndpointAdaptor-ZbtQiuHE.cjs.map +0 -1
  545. package/dist/functions-C6EK1xL6.mjs +0 -8
  546. package/dist/functions-C6EK1xL6.mjs.map +0 -1
  547. package/dist/functions-fTid0RMK.cjs.map +0 -1
  548. package/dist/helpers-BcP1tXAi.cjs.map +0 -1
  549. package/dist/helpers-ByRTDO_m.mjs.map +0 -1
  550. package/dist/index-BWzGIj06.d.mts.map +0 -1
  551. package/dist/index-DmFozqLd.d.cts +0 -12
  552. package/dist/index-DmFozqLd.d.cts.map +0 -1
  553. package/dist/parseHonoQuery-CZC5_97v.cjs.map +0 -1
  554. package/dist/parseHonoQuery-DDgIkTO4.mjs.map +0 -1
  555. package/dist/publisher.d.cts.map +0 -1
  556. package/dist/publisher.d.mts.map +0 -1
  557. package/dist/types-DdIlpxAd.d.mts.map +0 -1
@@ -7,845 +7,845 @@ import { e } from '../EndpointFactory';
7
7
  import { TestEndpointAdaptor } from '../TestEndpointAdaptor';
8
8
 
9
9
  describe('TestEndpointAdaptor', () => {
10
- const mockServices = {};
11
- const logger = new ConsoleLogger();
12
-
13
- describe('request', () => {
14
- it('should handle simple endpoint without schemas', async () => {
15
- const endpoint = e
16
- .get('/test')
17
- .output(z.object({ message: z.string() }))
18
- .handle(() => ({ message: 'Hello World' }));
19
-
20
- const adapter = new TestEndpointAdaptor(endpoint);
21
-
22
- const result = await adapter.request({
23
- services: mockServices,
24
- headers: { host: 'example.com' },
25
- });
26
-
27
- expect(result).toEqual({ message: 'Hello World' });
28
- });
29
-
30
- it('should handle endpoint with body schema', async () => {
31
- const endpoint = e
32
- .post('/users')
33
- .body(z.object({ name: z.string(), email: z.string().email() }))
34
- .output(z.object({ id: z.string(), name: z.string() }))
35
- .handle(async ({ body }) => ({
36
- id: 'user-123',
37
- name: body.name,
38
- }));
39
-
40
- const adapter = new TestEndpointAdaptor(endpoint);
41
-
42
- const result = await adapter.request({
43
- body: { name: 'John Doe', email: 'john@example.com' },
44
- services: mockServices,
45
- headers: { host: 'example.com', 'content-type': 'application/json' },
46
- });
47
-
48
- expect(result).toEqual({ id: 'user-123', name: 'John Doe' });
49
- });
50
-
51
- it('should handle endpoint with params schema', async () => {
52
- const endpoint = e
53
- .get('/users/:id')
54
- .params(z.object({ id: z.string() }))
55
- .output(z.object({ id: z.string(), found: z.boolean() }))
56
- .handle(async ({ params }) => ({
57
- id: params.id,
58
- found: true,
59
- }));
60
-
61
- const adapter = new TestEndpointAdaptor(endpoint);
62
-
63
- const result = await adapter.request({
64
- params: { id: 'user-456' },
65
- services: mockServices,
66
- headers: { host: 'example.com' },
67
- });
68
-
69
- expect(result).toEqual({ id: 'user-456', found: true });
70
- });
71
-
72
- it('should handle endpoint with query schema', async () => {
73
- const endpoint = e
74
- .get('/search')
75
- .query(z.object({ q: z.string(), page: z.coerce.number().default(1) }))
76
- .output(z.object({ query: z.string(), page: z.number() }))
77
- .handle(async ({ query }) => ({
78
- query: query.q,
79
- page: query.page,
80
- }));
81
-
82
- const adapter = new TestEndpointAdaptor(endpoint);
83
-
84
- const result = await adapter.request({
85
- query: { q: 'test search', page: 2 },
86
- services: mockServices,
87
- headers: { host: 'example.com' },
88
- });
89
-
90
- expect(result).toEqual({ query: 'test search', page: 2 });
91
- });
92
-
93
- it('should handle endpoint with all schemas', async () => {
94
- const endpoint = e
95
- .put('/users/:id')
96
- .params(z.object({ id: z.string() }))
97
- .body(z.object({ name: z.string(), email: z.string().email() }))
98
- .query(z.object({ notify: z.coerce.boolean().default(false) }))
99
- .output(
100
- z.object({
101
- id: z.string(),
102
- updated: z.boolean(),
103
- notified: z.boolean(),
104
- }),
105
- )
106
- .handle(async ({ params, body, query }) => ({
107
- id: params.id,
108
- updated: true,
109
- notified: query.notify,
110
- }));
111
-
112
- const adapter = new TestEndpointAdaptor(endpoint);
113
-
114
- const result = await adapter.request({
115
- body: { name: 'Jane Doe', email: 'jane@example.com' },
116
- query: { notify: true },
117
- params: { id: 'user-789' },
118
- services: mockServices,
119
- headers: { host: 'example.com' },
120
- });
121
-
122
- expect(result).toEqual({
123
- id: 'user-789',
124
- updated: true,
125
- notified: true,
126
- });
127
- });
128
-
129
- it('should throw validation error for invalid body', async () => {
130
- const endpoint = e
131
- .post('/users')
132
- .body(z.object({ name: z.string(), age: z.number().min(18) }))
133
- .handle(async ({ body }) => ({ id: '123' }));
134
-
135
- const adapter = new TestEndpointAdaptor(endpoint);
136
-
137
- await expect(
138
- adapter.request({
139
- body: { name: 'John', age: 15 },
140
- services: mockServices,
141
- headers: { host: 'example.com' },
142
- }),
143
- ).rejects.toThrow(UnprocessableEntityError);
144
- });
145
-
146
- it('should handle headers correctly', async () => {
147
- const endpoint = e
148
- .get('/headers')
149
- .output(z.object({ auth: z.string().optional(), host: z.string() }))
150
- .handle(async ({ header }) => ({
151
- auth: header('authorization'),
152
- host: header('host') || 'unknown',
153
- }));
154
-
155
- const adapter = new TestEndpointAdaptor(endpoint);
156
-
157
- const result = await adapter.request({
158
- services: mockServices,
159
- headers: {
160
- host: 'api.example.com',
161
- authorization: 'Bearer token123',
162
- 'Content-Type': 'application/json',
163
- },
164
- });
165
-
166
- expect(result).toEqual({
167
- auth: 'Bearer token123',
168
- host: 'api.example.com',
169
- });
170
- });
171
-
172
- it('should handle session correctly', async () => {
173
- const endpoint = e
174
- .get('/profile')
175
- .output(z.object({ userId: z.string() }))
176
- .handle(async ({ session }) => ({
177
- userId: (session as any).userId,
178
- }));
179
-
180
- // Mock getSession
181
- endpoint.getSession = vi.fn().mockResolvedValue({ userId: 'user-123' });
182
-
183
- const adapter = new TestEndpointAdaptor(endpoint);
184
-
185
- const result = await adapter.request({
186
- services: mockServices,
187
- headers: { host: 'example.com' },
188
- });
189
-
190
- expect(result).toEqual({ userId: 'user-123' });
191
- expect(endpoint.getSession).toHaveBeenCalledWith({
192
- logger: expect.any(ConsoleLogger),
193
- services: mockServices,
194
- header: expect.any(Function),
195
- cookie: expect.any(Function),
196
- });
197
- });
198
-
199
- it('should validate output schema', async () => {
200
- const endpoint = e
201
- .get('/invalid')
202
- .output(z.object({ id: z.string(), count: z.number() }))
203
- .handle(() => ({ id: '123', count: 'not-a-number' as any }));
204
-
205
- const adapter = new TestEndpointAdaptor(endpoint);
206
-
207
- await expect(
208
- adapter.request({
209
- services: mockServices,
210
- headers: { host: 'example.com' },
211
- }),
212
- ).rejects.toThrow(UnprocessableEntityError);
213
- });
214
-
215
- it('should handle case-insensitive headers', async () => {
216
- const endpoint = e
217
- .get('/headers-case')
218
- .output(z.object({ contentType: z.string().optional() }))
219
- .handle(async ({ header }) => ({
220
- contentType: header('CONTENT-TYPE'),
221
- }));
222
-
223
- const adapter = new TestEndpointAdaptor(endpoint);
224
-
225
- const result = await adapter.request({
226
- services: mockServices,
227
- headers: {
228
- host: 'example.com',
229
- 'content-type': 'application/json',
230
- },
231
- });
232
-
233
- expect(result).toEqual({
234
- contentType: 'application/json',
235
- });
236
- });
237
-
238
- it('should read cookies from request', async () => {
239
- const endpoint = e
240
- .get('/cookies')
241
- .output(
242
- z.object({
243
- session: z.string().optional(),
244
- theme: z.string().optional(),
245
- }),
246
- )
247
- .handle(async ({ cookie }) => ({
248
- session: cookie('session'),
249
- theme: cookie('theme'),
250
- }));
251
-
252
- const adapter = new TestEndpointAdaptor(endpoint);
253
-
254
- const result = await adapter.request({
255
- services: mockServices,
256
- headers: {
257
- host: 'example.com',
258
- cookie: 'session=abc123; theme=dark',
259
- },
260
- });
261
-
262
- expect(result).toEqual({
263
- session: 'abc123',
264
- theme: 'dark',
265
- });
266
- });
267
-
268
- it('should handle missing cookies gracefully', async () => {
269
- const endpoint = e
270
- .get('/cookies-optional')
271
- .output(
272
- z.object({
273
- session: z.string().optional(),
274
- }),
275
- )
276
- .handle(async ({ cookie }) => ({
277
- session: cookie('session') || 'default',
278
- }));
279
-
280
- const adapter = new TestEndpointAdaptor(endpoint);
281
-
282
- const result = await adapter.request({
283
- services: mockServices,
284
- headers: {
285
- host: 'example.com',
286
- },
287
- });
288
-
289
- expect(result).toEqual({
290
- session: 'default',
291
- });
292
- });
293
-
294
- it('should handle URL encoded cookie values', async () => {
295
- const endpoint = e
296
- .get('/cookies-encoded')
297
- .output(z.object({ user: z.string() }))
298
- .handle(async ({ cookie }) => ({
299
- user: cookie('user') || 'unknown',
300
- }));
301
-
302
- const adapter = new TestEndpointAdaptor(endpoint);
303
-
304
- const result = await adapter.request({
305
- services: mockServices,
306
- headers: {
307
- host: 'example.com',
308
- cookie: 'user=John%20Doe',
309
- },
310
- });
311
-
312
- expect(result).toEqual({
313
- user: 'John Doe',
314
- });
315
- });
316
-
317
- it('should use cookies in session extraction', async () => {
318
- const endpoint = e
319
- .get('/profile')
320
- .output(z.object({ userId: z.string() }))
321
- .handle(async ({ session }) => ({
322
- userId: (session as any).userId,
323
- }));
324
-
325
- // Mock getSession that uses cookies
326
- endpoint.getSession = vi.fn().mockImplementation(({ cookie }) => {
327
- const sessionId = cookie('session');
328
- if (sessionId === 'valid-session') {
329
- return { userId: 'user-123' };
330
- }
331
- return null;
332
- });
333
-
334
- const adapter = new TestEndpointAdaptor(endpoint);
335
-
336
- const result = await adapter.request({
337
- services: mockServices,
338
- headers: {
339
- host: 'example.com',
340
- cookie: 'session=valid-session',
341
- },
342
- });
343
-
344
- expect(result).toEqual({ userId: 'user-123' });
345
- expect(endpoint.getSession).toHaveBeenCalledWith({
346
- logger: expect.any(ConsoleLogger),
347
- services: mockServices,
348
- header: expect.any(Function),
349
- cookie: expect.any(Function),
350
- });
351
- });
352
-
353
- it('should handle multiple cookies with same name (uses last)', async () => {
354
- const endpoint = e
355
- .get('/duplicate-cookies')
356
- .output(z.object({ value: z.string() }))
357
- .handle(async ({ cookie }) => ({
358
- value: cookie('test') || 'none',
359
- }));
360
-
361
- const adapter = new TestEndpointAdaptor(endpoint);
362
-
363
- const result = await adapter.request({
364
- services: mockServices,
365
- headers: {
366
- host: 'example.com',
367
- cookie: 'test=first; test=second',
368
- },
369
- });
370
-
371
- // When duplicates exist, Map uses the last occurrence
372
- expect(result).toEqual({
373
- value: 'second',
374
- });
375
- });
376
- });
377
-
378
- describe('response handling', () => {
379
- it('should set response cookies', async () => {
380
- const endpoint = e
381
- .post('/auth/login')
382
- .body(z.object({ email: z.string(), password: z.string() }))
383
- .output(z.object({ id: z.string(), email: z.string() }))
384
- .handle(async ({ body }, response) => {
385
- return response
386
- .cookie('session', 'abc123', {
387
- httpOnly: true,
388
- secure: true,
389
- sameSite: 'strict',
390
- maxAge: 3600,
391
- })
392
- .send({ id: 'user-1', email: body.email });
393
- });
394
-
395
- const adapter = new TestEndpointAdaptor(endpoint);
396
- const result = await adapter.fullRequest({
397
- body: { email: 'test@example.com', password: 'pass123' },
398
- services: mockServices,
399
- headers: { host: 'example.com' },
400
- });
401
-
402
- expect(result.body).toEqual({
403
- id: 'user-1',
404
- email: 'test@example.com',
405
- });
406
- expect(result.headers['set-cookie']).toEqual([
407
- 'session=abc123; Max-Age=3600; HttpOnly; Secure; SameSite=strict',
408
- ]);
409
- });
410
-
411
- it('should set custom response headers', async () => {
412
- const endpoint = e
413
- .post('/users')
414
- .body(z.object({ name: z.string() }))
415
- .output(z.object({ id: z.string(), name: z.string() }))
416
- .handle(async ({ body }, response) => {
417
- const user = { id: 'user-123', name: body.name };
418
- return response
419
- .header('Location', `/users/${user.id}`)
420
- .header('X-User-Id', user.id)
421
- .send(user);
422
- });
423
-
424
- const adapter = new TestEndpointAdaptor(endpoint);
425
- const result = await adapter.fullRequest({
426
- body: { name: 'John Doe' },
427
- services: mockServices,
428
- headers: { host: 'example.com' },
429
- });
430
-
431
- expect(result.body).toEqual({
432
- id: 'user-123',
433
- name: 'John Doe',
434
- });
435
- expect(result.headers).toEqual({
436
- Location: '/users/user-123',
437
- 'X-User-Id': 'user-123',
438
- });
439
- });
440
-
441
- it('should set custom status code', async () => {
442
- const endpoint = e
443
- .post('/resources')
444
- .body(z.object({ name: z.string() }))
445
- .output(z.object({ id: z.string() }))
446
- .handle(async (ctx, response) => {
447
- return response.status(SuccessStatus.Created).send({ id: '123' });
448
- });
449
-
450
- const adapter = new TestEndpointAdaptor(endpoint);
451
- const result = await adapter.fullRequest({
452
- body: { name: 'Resource' },
453
- services: mockServices,
454
- headers: { host: 'example.com' },
455
- });
456
-
457
- expect(result.status).toBe(201);
458
- });
459
-
460
- it('should delete cookies', async () => {
461
- const endpoint = e
462
- .post('/auth/logout')
463
- .output(z.object({ success: z.boolean() }))
464
- .handle(async (ctx, response) => {
465
- return response
466
- .deleteCookie('session', { path: '/' })
467
- .send({ success: true });
468
- });
469
-
470
- const adapter = new TestEndpointAdaptor(endpoint);
471
- const result = await adapter.fullRequest({
472
- services: mockServices,
473
- headers: { host: 'example.com' },
474
- });
475
-
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=/');
482
- });
483
-
484
- it('should combine cookies, headers, and status', async () => {
485
- const endpoint = e
486
- .post('/complete')
487
- .body(z.object({ data: z.string() }))
488
- .output(z.object({ id: z.string(), result: z.string() }))
489
- .handle(async ({ body }, response) => {
490
- return response
491
- .status(SuccessStatus.Created)
492
- .header('Location', '/complete/123')
493
- .header('X-Request-Id', 'req-456')
494
- .cookie('tracking', 'track-789')
495
- .cookie('preference', 'dark', { maxAge: 86400 })
496
- .send({ id: '123', result: body.data });
497
- });
498
-
499
- const adapter = new TestEndpointAdaptor(endpoint);
500
- const result = await adapter.fullRequest({
501
- body: { data: 'test' },
502
- services: mockServices,
503
- headers: { host: 'example.com' },
504
- });
505
-
506
- expect(result.body).toEqual({
507
- id: '123',
508
- result: 'test',
509
- });
510
- expect(result.status).toBe(201);
511
- expect(result.headers).toEqual({
512
- Location: '/complete/123',
513
- 'X-Request-Id': 'req-456',
514
- 'set-cookie': ['tracking=track-789', 'preference=dark; Max-Age=86400'],
515
- });
516
- });
517
-
518
- it('should return simple response without metadata when not using response builder', async () => {
519
- const endpoint = e
520
- .get('/simple')
521
- .output(z.object({ message: z.string() }))
522
- .handle(async () => {
523
- // Not using response builder, just returning data
524
- return { message: 'Hello' };
525
- });
526
-
527
- const adapter = new TestEndpointAdaptor(endpoint);
528
- const result = await adapter.request({
529
- services: mockServices,
530
- headers: { host: 'example.com' },
531
- });
532
-
533
- // Should return just the data, not wrapped in metadata
534
- expect(result).toEqual({ message: 'Hello' });
535
- expect(result).not.toHaveProperty('metadata');
536
- });
537
-
538
- it('should combine request cookies and response cookies', async () => {
539
- const endpoint = e
540
- .get('/preferences')
541
- .output(z.object({ theme: z.string(), updated: z.boolean() }))
542
- .handle(async ({ cookie }, response) => {
543
- const currentTheme = cookie('theme') || 'light';
544
- const newTheme = currentTheme === 'light' ? 'dark' : 'light';
545
-
546
- return response
547
- .cookie('theme', newTheme, { maxAge: 86400 })
548
- .send({ theme: newTheme, updated: true });
549
- });
550
-
551
- const adapter = new TestEndpointAdaptor(endpoint);
552
- const result = await adapter.fullRequest({
553
- services: mockServices,
554
- headers: {
555
- host: 'example.com',
556
- cookie: 'theme=light',
557
- },
558
- });
559
-
560
- expect(result.body).toEqual({
561
- theme: 'dark',
562
- updated: true,
563
- });
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');
849
- });
850
- });
10
+ const mockServices = {};
11
+ const _logger = new ConsoleLogger();
12
+
13
+ describe('request', () => {
14
+ it('should handle simple endpoint without schemas', async () => {
15
+ const endpoint = e
16
+ .get('/test')
17
+ .output(z.object({ message: z.string() }))
18
+ .handle(() => ({ message: 'Hello World' }));
19
+
20
+ const adapter = new TestEndpointAdaptor(endpoint);
21
+
22
+ const result = await adapter.request({
23
+ services: mockServices,
24
+ headers: { host: 'example.com' },
25
+ });
26
+
27
+ expect(result).toEqual({ message: 'Hello World' });
28
+ });
29
+
30
+ it('should handle endpoint with body schema', async () => {
31
+ const endpoint = e
32
+ .post('/users')
33
+ .body(z.object({ name: z.string(), email: z.string().email() }))
34
+ .output(z.object({ id: z.string(), name: z.string() }))
35
+ .handle(async ({ body }) => ({
36
+ id: 'user-123',
37
+ name: body.name,
38
+ }));
39
+
40
+ const adapter = new TestEndpointAdaptor(endpoint);
41
+
42
+ const result = await adapter.request({
43
+ body: { name: 'John Doe', email: 'john@example.com' },
44
+ services: mockServices,
45
+ headers: { host: 'example.com', 'content-type': 'application/json' },
46
+ });
47
+
48
+ expect(result).toEqual({ id: 'user-123', name: 'John Doe' });
49
+ });
50
+
51
+ it('should handle endpoint with params schema', async () => {
52
+ const endpoint = e
53
+ .get('/users/:id')
54
+ .params(z.object({ id: z.string() }))
55
+ .output(z.object({ id: z.string(), found: z.boolean() }))
56
+ .handle(async ({ params }) => ({
57
+ id: params.id,
58
+ found: true,
59
+ }));
60
+
61
+ const adapter = new TestEndpointAdaptor(endpoint);
62
+
63
+ const result = await adapter.request({
64
+ params: { id: 'user-456' },
65
+ services: mockServices,
66
+ headers: { host: 'example.com' },
67
+ });
68
+
69
+ expect(result).toEqual({ id: 'user-456', found: true });
70
+ });
71
+
72
+ it('should handle endpoint with query schema', async () => {
73
+ const endpoint = e
74
+ .get('/search')
75
+ .query(z.object({ q: z.string(), page: z.coerce.number().default(1) }))
76
+ .output(z.object({ query: z.string(), page: z.number() }))
77
+ .handle(async ({ query }) => ({
78
+ query: query.q,
79
+ page: query.page,
80
+ }));
81
+
82
+ const adapter = new TestEndpointAdaptor(endpoint);
83
+
84
+ const result = await adapter.request({
85
+ query: { q: 'test search', page: 2 },
86
+ services: mockServices,
87
+ headers: { host: 'example.com' },
88
+ });
89
+
90
+ expect(result).toEqual({ query: 'test search', page: 2 });
91
+ });
92
+
93
+ it('should handle endpoint with all schemas', async () => {
94
+ const endpoint = e
95
+ .put('/users/:id')
96
+ .params(z.object({ id: z.string() }))
97
+ .body(z.object({ name: z.string(), email: z.string().email() }))
98
+ .query(z.object({ notify: z.coerce.boolean().default(false) }))
99
+ .output(
100
+ z.object({
101
+ id: z.string(),
102
+ updated: z.boolean(),
103
+ notified: z.boolean(),
104
+ }),
105
+ )
106
+ .handle(async ({ params, body, query }) => ({
107
+ id: params.id,
108
+ updated: true,
109
+ notified: query.notify,
110
+ }));
111
+
112
+ const adapter = new TestEndpointAdaptor(endpoint);
113
+
114
+ const result = await adapter.request({
115
+ body: { name: 'Jane Doe', email: 'jane@example.com' },
116
+ query: { notify: true },
117
+ params: { id: 'user-789' },
118
+ services: mockServices,
119
+ headers: { host: 'example.com' },
120
+ });
121
+
122
+ expect(result).toEqual({
123
+ id: 'user-789',
124
+ updated: true,
125
+ notified: true,
126
+ });
127
+ });
128
+
129
+ it('should throw validation error for invalid body', async () => {
130
+ const endpoint = e
131
+ .post('/users')
132
+ .body(z.object({ name: z.string(), age: z.number().min(18) }))
133
+ .handle(async ({ body }) => ({ id: '123' }));
134
+
135
+ const adapter = new TestEndpointAdaptor(endpoint);
136
+
137
+ await expect(
138
+ adapter.request({
139
+ body: { name: 'John', age: 15 },
140
+ services: mockServices,
141
+ headers: { host: 'example.com' },
142
+ }),
143
+ ).rejects.toThrow(UnprocessableEntityError);
144
+ });
145
+
146
+ it('should handle headers correctly', async () => {
147
+ const endpoint = e
148
+ .get('/headers')
149
+ .output(z.object({ auth: z.string().optional(), host: z.string() }))
150
+ .handle(async ({ header }) => ({
151
+ auth: header('authorization'),
152
+ host: header('host') || 'unknown',
153
+ }));
154
+
155
+ const adapter = new TestEndpointAdaptor(endpoint);
156
+
157
+ const result = await adapter.request({
158
+ services: mockServices,
159
+ headers: {
160
+ host: 'api.example.com',
161
+ authorization: 'Bearer token123',
162
+ 'Content-Type': 'application/json',
163
+ },
164
+ });
165
+
166
+ expect(result).toEqual({
167
+ auth: 'Bearer token123',
168
+ host: 'api.example.com',
169
+ });
170
+ });
171
+
172
+ it('should handle session correctly', async () => {
173
+ const endpoint = e
174
+ .get('/profile')
175
+ .output(z.object({ userId: z.string() }))
176
+ .handle(async ({ session }) => ({
177
+ userId: (session as any).userId,
178
+ }));
179
+
180
+ // Mock getSession
181
+ endpoint.getSession = vi.fn().mockResolvedValue({ userId: 'user-123' });
182
+
183
+ const adapter = new TestEndpointAdaptor(endpoint);
184
+
185
+ const result = await adapter.request({
186
+ services: mockServices,
187
+ headers: { host: 'example.com' },
188
+ });
189
+
190
+ expect(result).toEqual({ userId: 'user-123' });
191
+ expect(endpoint.getSession).toHaveBeenCalledWith({
192
+ logger: expect.any(ConsoleLogger),
193
+ services: mockServices,
194
+ header: expect.any(Function),
195
+ cookie: expect.any(Function),
196
+ });
197
+ });
198
+
199
+ it('should validate output schema', async () => {
200
+ const endpoint = e
201
+ .get('/invalid')
202
+ .output(z.object({ id: z.string(), count: z.number() }))
203
+ .handle(() => ({ id: '123', count: 'not-a-number' as any }));
204
+
205
+ const adapter = new TestEndpointAdaptor(endpoint);
206
+
207
+ await expect(
208
+ adapter.request({
209
+ services: mockServices,
210
+ headers: { host: 'example.com' },
211
+ }),
212
+ ).rejects.toThrow(UnprocessableEntityError);
213
+ });
214
+
215
+ it('should handle case-insensitive headers', async () => {
216
+ const endpoint = e
217
+ .get('/headers-case')
218
+ .output(z.object({ contentType: z.string().optional() }))
219
+ .handle(async ({ header }) => ({
220
+ contentType: header('CONTENT-TYPE'),
221
+ }));
222
+
223
+ const adapter = new TestEndpointAdaptor(endpoint);
224
+
225
+ const result = await adapter.request({
226
+ services: mockServices,
227
+ headers: {
228
+ host: 'example.com',
229
+ 'content-type': 'application/json',
230
+ },
231
+ });
232
+
233
+ expect(result).toEqual({
234
+ contentType: 'application/json',
235
+ });
236
+ });
237
+
238
+ it('should read cookies from request', async () => {
239
+ const endpoint = e
240
+ .get('/cookies')
241
+ .output(
242
+ z.object({
243
+ session: z.string().optional(),
244
+ theme: z.string().optional(),
245
+ }),
246
+ )
247
+ .handle(async ({ cookie }) => ({
248
+ session: cookie('session'),
249
+ theme: cookie('theme'),
250
+ }));
251
+
252
+ const adapter = new TestEndpointAdaptor(endpoint);
253
+
254
+ const result = await adapter.request({
255
+ services: mockServices,
256
+ headers: {
257
+ host: 'example.com',
258
+ cookie: 'session=abc123; theme=dark',
259
+ },
260
+ });
261
+
262
+ expect(result).toEqual({
263
+ session: 'abc123',
264
+ theme: 'dark',
265
+ });
266
+ });
267
+
268
+ it('should handle missing cookies gracefully', async () => {
269
+ const endpoint = e
270
+ .get('/cookies-optional')
271
+ .output(
272
+ z.object({
273
+ session: z.string().optional(),
274
+ }),
275
+ )
276
+ .handle(async ({ cookie }) => ({
277
+ session: cookie('session') || 'default',
278
+ }));
279
+
280
+ const adapter = new TestEndpointAdaptor(endpoint);
281
+
282
+ const result = await adapter.request({
283
+ services: mockServices,
284
+ headers: {
285
+ host: 'example.com',
286
+ },
287
+ });
288
+
289
+ expect(result).toEqual({
290
+ session: 'default',
291
+ });
292
+ });
293
+
294
+ it('should handle URL encoded cookie values', async () => {
295
+ const endpoint = e
296
+ .get('/cookies-encoded')
297
+ .output(z.object({ user: z.string() }))
298
+ .handle(async ({ cookie }) => ({
299
+ user: cookie('user') || 'unknown',
300
+ }));
301
+
302
+ const adapter = new TestEndpointAdaptor(endpoint);
303
+
304
+ const result = await adapter.request({
305
+ services: mockServices,
306
+ headers: {
307
+ host: 'example.com',
308
+ cookie: 'user=John%20Doe',
309
+ },
310
+ });
311
+
312
+ expect(result).toEqual({
313
+ user: 'John Doe',
314
+ });
315
+ });
316
+
317
+ it('should use cookies in session extraction', async () => {
318
+ const endpoint = e
319
+ .get('/profile')
320
+ .output(z.object({ userId: z.string() }))
321
+ .handle(async ({ session }) => ({
322
+ userId: (session as any).userId,
323
+ }));
324
+
325
+ // Mock getSession that uses cookies
326
+ endpoint.getSession = vi.fn().mockImplementation(({ cookie }) => {
327
+ const sessionId = cookie('session');
328
+ if (sessionId === 'valid-session') {
329
+ return { userId: 'user-123' };
330
+ }
331
+ return null;
332
+ });
333
+
334
+ const adapter = new TestEndpointAdaptor(endpoint);
335
+
336
+ const result = await adapter.request({
337
+ services: mockServices,
338
+ headers: {
339
+ host: 'example.com',
340
+ cookie: 'session=valid-session',
341
+ },
342
+ });
343
+
344
+ expect(result).toEqual({ userId: 'user-123' });
345
+ expect(endpoint.getSession).toHaveBeenCalledWith({
346
+ logger: expect.any(ConsoleLogger),
347
+ services: mockServices,
348
+ header: expect.any(Function),
349
+ cookie: expect.any(Function),
350
+ });
351
+ });
352
+
353
+ it('should handle multiple cookies with same name (uses last)', async () => {
354
+ const endpoint = e
355
+ .get('/duplicate-cookies')
356
+ .output(z.object({ value: z.string() }))
357
+ .handle(async ({ cookie }) => ({
358
+ value: cookie('test') || 'none',
359
+ }));
360
+
361
+ const adapter = new TestEndpointAdaptor(endpoint);
362
+
363
+ const result = await adapter.request({
364
+ services: mockServices,
365
+ headers: {
366
+ host: 'example.com',
367
+ cookie: 'test=first; test=second',
368
+ },
369
+ });
370
+
371
+ // When duplicates exist, Map uses the last occurrence
372
+ expect(result).toEqual({
373
+ value: 'second',
374
+ });
375
+ });
376
+ });
377
+
378
+ describe('response handling', () => {
379
+ it('should set response cookies', async () => {
380
+ const endpoint = e
381
+ .post('/auth/login')
382
+ .body(z.object({ email: z.string(), password: z.string() }))
383
+ .output(z.object({ id: z.string(), email: z.string() }))
384
+ .handle(async ({ body }, response) => {
385
+ return response
386
+ .cookie('session', 'abc123', {
387
+ httpOnly: true,
388
+ secure: true,
389
+ sameSite: 'strict',
390
+ maxAge: 3600,
391
+ })
392
+ .send({ id: 'user-1', email: body.email });
393
+ });
394
+
395
+ const adapter = new TestEndpointAdaptor(endpoint);
396
+ const result = await adapter.fullRequest({
397
+ body: { email: 'test@example.com', password: 'pass123' },
398
+ services: mockServices,
399
+ headers: { host: 'example.com' },
400
+ });
401
+
402
+ expect(result.body).toEqual({
403
+ id: 'user-1',
404
+ email: 'test@example.com',
405
+ });
406
+ expect(result.headers['set-cookie']).toEqual([
407
+ 'session=abc123; Max-Age=3600; HttpOnly; Secure; SameSite=strict',
408
+ ]);
409
+ });
410
+
411
+ it('should set custom response headers', async () => {
412
+ const endpoint = e
413
+ .post('/users')
414
+ .body(z.object({ name: z.string() }))
415
+ .output(z.object({ id: z.string(), name: z.string() }))
416
+ .handle(async ({ body }, response) => {
417
+ const user = { id: 'user-123', name: body.name };
418
+ return response
419
+ .header('Location', `/users/${user.id}`)
420
+ .header('X-User-Id', user.id)
421
+ .send(user);
422
+ });
423
+
424
+ const adapter = new TestEndpointAdaptor(endpoint);
425
+ const result = await adapter.fullRequest({
426
+ body: { name: 'John Doe' },
427
+ services: mockServices,
428
+ headers: { host: 'example.com' },
429
+ });
430
+
431
+ expect(result.body).toEqual({
432
+ id: 'user-123',
433
+ name: 'John Doe',
434
+ });
435
+ expect(result.headers).toEqual({
436
+ Location: '/users/user-123',
437
+ 'X-User-Id': 'user-123',
438
+ });
439
+ });
440
+
441
+ it('should set custom status code', async () => {
442
+ const endpoint = e
443
+ .post('/resources')
444
+ .body(z.object({ name: z.string() }))
445
+ .output(z.object({ id: z.string() }))
446
+ .handle(async (_ctx, response) => {
447
+ return response.status(SuccessStatus.Created).send({ id: '123' });
448
+ });
449
+
450
+ const adapter = new TestEndpointAdaptor(endpoint);
451
+ const result = await adapter.fullRequest({
452
+ body: { name: 'Resource' },
453
+ services: mockServices,
454
+ headers: { host: 'example.com' },
455
+ });
456
+
457
+ expect(result.status).toBe(201);
458
+ });
459
+
460
+ it('should delete cookies', async () => {
461
+ const endpoint = e
462
+ .post('/auth/logout')
463
+ .output(z.object({ success: z.boolean() }))
464
+ .handle(async (_ctx, response) => {
465
+ return response
466
+ .deleteCookie('session', { path: '/' })
467
+ .send({ success: true });
468
+ });
469
+
470
+ const adapter = new TestEndpointAdaptor(endpoint);
471
+ const result = await adapter.fullRequest({
472
+ services: mockServices,
473
+ headers: { host: 'example.com' },
474
+ });
475
+
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=/');
482
+ });
483
+
484
+ it('should combine cookies, headers, and status', async () => {
485
+ const endpoint = e
486
+ .post('/complete')
487
+ .body(z.object({ data: z.string() }))
488
+ .output(z.object({ id: z.string(), result: z.string() }))
489
+ .handle(async ({ body }, response) => {
490
+ return response
491
+ .status(SuccessStatus.Created)
492
+ .header('Location', '/complete/123')
493
+ .header('X-Request-Id', 'req-456')
494
+ .cookie('tracking', 'track-789')
495
+ .cookie('preference', 'dark', { maxAge: 86400 })
496
+ .send({ id: '123', result: body.data });
497
+ });
498
+
499
+ const adapter = new TestEndpointAdaptor(endpoint);
500
+ const result = await adapter.fullRequest({
501
+ body: { data: 'test' },
502
+ services: mockServices,
503
+ headers: { host: 'example.com' },
504
+ });
505
+
506
+ expect(result.body).toEqual({
507
+ id: '123',
508
+ result: 'test',
509
+ });
510
+ expect(result.status).toBe(201);
511
+ expect(result.headers).toEqual({
512
+ Location: '/complete/123',
513
+ 'X-Request-Id': 'req-456',
514
+ 'set-cookie': ['tracking=track-789', 'preference=dark; Max-Age=86400'],
515
+ });
516
+ });
517
+
518
+ it('should return simple response without metadata when not using response builder', async () => {
519
+ const endpoint = e
520
+ .get('/simple')
521
+ .output(z.object({ message: z.string() }))
522
+ .handle(async () => {
523
+ // Not using response builder, just returning data
524
+ return { message: 'Hello' };
525
+ });
526
+
527
+ const adapter = new TestEndpointAdaptor(endpoint);
528
+ const result = await adapter.request({
529
+ services: mockServices,
530
+ headers: { host: 'example.com' },
531
+ });
532
+
533
+ // Should return just the data, not wrapped in metadata
534
+ expect(result).toEqual({ message: 'Hello' });
535
+ expect(result).not.toHaveProperty('metadata');
536
+ });
537
+
538
+ it('should combine request cookies and response cookies', async () => {
539
+ const endpoint = e
540
+ .get('/preferences')
541
+ .output(z.object({ theme: z.string(), updated: z.boolean() }))
542
+ .handle(async ({ cookie }, response) => {
543
+ const currentTheme = cookie('theme') || 'light';
544
+ const newTheme = currentTheme === 'light' ? 'dark' : 'light';
545
+
546
+ return response
547
+ .cookie('theme', newTheme, { maxAge: 86400 })
548
+ .send({ theme: newTheme, updated: true });
549
+ });
550
+
551
+ const adapter = new TestEndpointAdaptor(endpoint);
552
+ const result = await adapter.fullRequest({
553
+ services: mockServices,
554
+ headers: {
555
+ host: 'example.com',
556
+ cookie: 'theme=light',
557
+ },
558
+ });
559
+
560
+ expect(result.body).toEqual({
561
+ theme: 'dark',
562
+ updated: true,
563
+ });
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');
849
+ });
850
+ });
851
851
  });