@geekmidas/constructs 3.0.7 → 3.0.8

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 (459) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/{Construct-BXG8cFSm.cjs → Construct-B14miJ6P.cjs} +95 -10
  3. package/dist/Construct-B14miJ6P.cjs.map +1 -0
  4. package/dist/{Construct-BjpXFNxy.d.mts → Construct-CXqvzglu.d.cts} +11 -6
  5. package/dist/{Construct-BjpXFNxy.d.mts.map → Construct-CXqvzglu.d.cts.map} +1 -1
  6. package/dist/{Construct-CQ9zV58W.mjs → Construct-CdJY2DJS.mjs} +83 -9
  7. package/dist/Construct-CdJY2DJS.mjs.map +1 -0
  8. package/dist/{Construct-CX7HyFfT.d.cts → Construct-D0n7QTaI.d.mts} +13 -8
  9. package/dist/Construct-D0n7QTaI.d.mts.map +1 -0
  10. package/dist/{Endpoint-CGdCGJkC.d.cts → Endpoint-C991gK3T.d.cts} +130 -27
  11. package/dist/Endpoint-C991gK3T.d.cts.map +1 -0
  12. package/dist/{Endpoint-BET0JSZK.d.mts → Endpoint-CRHpLPV3.d.mts} +130 -27
  13. package/dist/Endpoint-CRHpLPV3.d.mts.map +1 -0
  14. package/dist/{HonoEndpointAdaptor-B5fKdLi7.cjs → HonoEndpointAdaptor-BDz1qM4z.cjs} +81 -24
  15. package/dist/HonoEndpointAdaptor-BDz1qM4z.cjs.map +1 -0
  16. package/dist/{HonoEndpointAdaptor-DOUODM7n.mjs → HonoEndpointAdaptor-DPBfEPZj.mjs} +64 -7
  17. package/dist/HonoEndpointAdaptor-DPBfEPZj.mjs.map +1 -0
  18. package/dist/{Subscriber-1rDE7HuM.d.cts → Subscriber-D8WkA8np.d.cts} +3 -3
  19. package/dist/{Subscriber-1rDE7HuM.d.cts.map → Subscriber-D8WkA8np.d.cts.map} +1 -1
  20. package/dist/{Subscriber-9ObcUdcC.d.mts → Subscriber-Tft61-YG.d.mts} +5 -5
  21. package/dist/Subscriber-Tft61-YG.d.mts.map +1 -0
  22. package/dist/adaptors/aws.cjs +737 -21
  23. package/dist/adaptors/aws.cjs.map +1 -0
  24. package/dist/adaptors/aws.d.cts +221 -17
  25. package/dist/adaptors/aws.d.cts.map +1 -0
  26. package/dist/adaptors/aws.d.mts +221 -17
  27. package/dist/adaptors/aws.d.mts.map +1 -0
  28. package/dist/adaptors/aws.mjs +734 -18
  29. package/dist/adaptors/aws.mjs.map +1 -0
  30. package/dist/adaptors/hono.cjs +5 -12
  31. package/dist/adaptors/hono.d.cts +52 -10
  32. package/dist/adaptors/hono.d.cts.map +1 -0
  33. package/dist/adaptors/hono.d.mts +52 -10
  34. package/dist/adaptors/hono.d.mts.map +1 -0
  35. package/dist/adaptors/hono.mjs +5 -12
  36. package/dist/adaptors/testing.cjs +392 -21
  37. package/dist/adaptors/testing.cjs.map +1 -0
  38. package/dist/adaptors/testing.d.cts +177 -14
  39. package/dist/adaptors/testing.d.cts.map +1 -0
  40. package/dist/adaptors/testing.d.mts +177 -14
  41. package/dist/adaptors/testing.d.mts.map +1 -0
  42. package/dist/adaptors/testing.mjs +388 -17
  43. package/dist/adaptors/testing.mjs.map +1 -0
  44. package/dist/crons/index.cjs +82 -10
  45. package/dist/crons/index.cjs.map +1 -1
  46. package/dist/crons/index.d.cts +48 -11
  47. package/dist/crons/index.d.cts.map +1 -1
  48. package/dist/crons/index.d.mts +45 -11
  49. package/dist/crons/index.d.mts.map +1 -1
  50. package/dist/crons/index.mjs +79 -7
  51. package/dist/crons/index.mjs.map +1 -1
  52. package/dist/endpoints/index.cjs +717 -23
  53. package/dist/endpoints/index.cjs.map +1 -1
  54. package/dist/endpoints/index.d.cts +316 -14
  55. package/dist/endpoints/index.d.cts.map +1 -1
  56. package/dist/endpoints/index.d.mts +315 -14
  57. package/dist/endpoints/index.d.mts.map +1 -1
  58. package/dist/endpoints/index.mjs +706 -12
  59. package/dist/endpoints/index.mjs.map +1 -1
  60. package/dist/functions/index.cjs +5 -8
  61. package/dist/functions/index.d.cts +2 -5
  62. package/dist/functions/index.d.mts +2 -5
  63. package/dist/functions/index.mjs +2 -5
  64. package/dist/functions-DiaRAdfp.cjs +2893 -0
  65. package/dist/functions-DiaRAdfp.cjs.map +1 -0
  66. package/dist/functions-GmSHFbpr.mjs +2864 -0
  67. package/dist/functions-GmSHFbpr.mjs.map +1 -0
  68. package/dist/index-Cq4fz8uM.d.mts +132 -0
  69. package/dist/index-Cq4fz8uM.d.mts.map +1 -0
  70. package/dist/index-CzIMpK-e.d.cts +135 -0
  71. package/dist/index-CzIMpK-e.d.cts.map +1 -0
  72. package/dist/index.cjs +1 -1
  73. package/dist/index.d.cts +3 -3
  74. package/dist/index.d.mts +3 -3
  75. package/dist/index.mjs +1 -1
  76. package/dist/lazyAccessors-CJZYs9uM.mjs +1887 -0
  77. package/dist/lazyAccessors-CJZYs9uM.mjs.map +1 -0
  78. package/dist/lazyAccessors-DHvDeww0.cjs +1964 -0
  79. package/dist/lazyAccessors-DHvDeww0.cjs.map +1 -0
  80. package/dist/processAudits-B0PbJf1Z.mjs +80 -0
  81. package/dist/processAudits-B0PbJf1Z.mjs.map +1 -0
  82. package/dist/processAudits-CUko08pi.cjs +92 -0
  83. package/dist/processAudits-CUko08pi.cjs.map +1 -0
  84. package/dist/subscribers/index.cjs +77 -6
  85. package/dist/subscribers/index.cjs.map +1 -1
  86. package/dist/subscribers/index.d.cts +27 -5
  87. package/dist/subscribers/index.d.cts.map +1 -1
  88. package/dist/subscribers/index.d.mts +26 -5
  89. package/dist/subscribers/index.d.mts.map +1 -1
  90. package/dist/subscribers/index.mjs +74 -3
  91. package/dist/subscribers/index.mjs.map +1 -1
  92. package/dist/{telemetry-BTaiRqPo.d.cts → telemetry-Bt0vK4ma.d.cts} +1 -1
  93. package/dist/{telemetry-BJo1gcV1.d.mts.map → telemetry-Bt0vK4ma.d.cts.map} +1 -1
  94. package/dist/{telemetry-BJo1gcV1.d.mts → telemetry-COvVBKBM.d.mts} +1 -1
  95. package/dist/{telemetry-BTaiRqPo.d.cts.map → telemetry-COvVBKBM.d.mts.map} +1 -1
  96. package/dist/{types-B5H3piDg.d.cts → types-B8YlI4cx.d.cts} +1 -1
  97. package/dist/{types-B5H3piDg.d.cts.map → types-B8YlI4cx.d.cts.map} +1 -1
  98. package/dist/{types-BqPOdHEm.d.mts → types-BA3eK4xj.d.mts} +1 -1
  99. package/dist/{types-BqPOdHEm.d.mts.map → types-BA3eK4xj.d.mts.map} +1 -1
  100. package/dist/types.d.cts +1 -1
  101. package/dist/types.d.mts +1 -1
  102. package/package.json +9 -9
  103. package/src/Construct.ts +26 -8
  104. package/src/__tests__/Construct.environment.spec.ts +123 -0
  105. package/src/endpoints/__tests__/MswEndpointAdaptor.spec.ts +1 -9
  106. package/tsdown.config.ts +30 -1
  107. package/dist/AWSLambdaFunction-CC8gMZhz.d.mts +0 -32
  108. package/dist/AWSLambdaFunction-CC8gMZhz.d.mts.map +0 -1
  109. package/dist/AWSLambdaFunction-CPEAl5nZ.cjs +0 -120
  110. package/dist/AWSLambdaFunction-CPEAl5nZ.cjs.map +0 -1
  111. package/dist/AWSLambdaFunction-DJiCAPAf.mjs +0 -114
  112. package/dist/AWSLambdaFunction-DJiCAPAf.mjs.map +0 -1
  113. package/dist/AWSLambdaFunction-tzqv5XU6.d.cts +0 -32
  114. package/dist/AWSLambdaFunction-tzqv5XU6.d.cts.map +0 -1
  115. package/dist/AWSLambdaSubscriberAdaptor-Cj1wjkUP.d.cts +0 -36
  116. package/dist/AWSLambdaSubscriberAdaptor-Cj1wjkUP.d.cts.map +0 -1
  117. package/dist/AWSLambdaSubscriberAdaptor-Cmx9OQGG.d.mts +0 -36
  118. package/dist/AWSLambdaSubscriberAdaptor-Cmx9OQGG.d.mts.map +0 -1
  119. package/dist/AWSLambdaSubscriberAdaptor-RKwKYLl1.mjs +0 -172
  120. package/dist/AWSLambdaSubscriberAdaptor-RKwKYLl1.mjs.map +0 -1
  121. package/dist/AWSLambdaSubscriberAdaptor-eZ3qoKvK.cjs +0 -178
  122. package/dist/AWSLambdaSubscriberAdaptor-eZ3qoKvK.cjs.map +0 -1
  123. package/dist/AmazonApiGatewayEndpointAdaptor-BIltcbAc.cjs +0 -277
  124. package/dist/AmazonApiGatewayEndpointAdaptor-BIltcbAc.cjs.map +0 -1
  125. package/dist/AmazonApiGatewayEndpointAdaptor-BpYtYCeW.mjs +0 -271
  126. package/dist/AmazonApiGatewayEndpointAdaptor-BpYtYCeW.mjs.map +0 -1
  127. package/dist/AmazonApiGatewayEndpointAdaptor-DA0rS_1Y.d.mts +0 -124
  128. package/dist/AmazonApiGatewayEndpointAdaptor-DA0rS_1Y.d.mts.map +0 -1
  129. package/dist/AmazonApiGatewayEndpointAdaptor-DqNcQGMf.d.cts +0 -124
  130. package/dist/AmazonApiGatewayEndpointAdaptor-DqNcQGMf.d.cts.map +0 -1
  131. package/dist/AmazonApiGatewayV1EndpointAdaptor-C7rJzNvG.d.mts +0 -23
  132. package/dist/AmazonApiGatewayV1EndpointAdaptor-C7rJzNvG.d.mts.map +0 -1
  133. package/dist/AmazonApiGatewayV1EndpointAdaptor-CRwyWT6t.mjs +0 -42
  134. package/dist/AmazonApiGatewayV1EndpointAdaptor-CRwyWT6t.mjs.map +0 -1
  135. package/dist/AmazonApiGatewayV1EndpointAdaptor-DEETT6Wj.cjs +0 -47
  136. package/dist/AmazonApiGatewayV1EndpointAdaptor-DEETT6Wj.cjs.map +0 -1
  137. package/dist/AmazonApiGatewayV1EndpointAdaptor-DcN2fYsv.d.cts +0 -23
  138. package/dist/AmazonApiGatewayV1EndpointAdaptor-DcN2fYsv.d.cts.map +0 -1
  139. package/dist/AmazonApiGatewayV2EndpointAdaptor-C2qO8FN6.cjs +0 -48
  140. package/dist/AmazonApiGatewayV2EndpointAdaptor-C2qO8FN6.cjs.map +0 -1
  141. package/dist/AmazonApiGatewayV2EndpointAdaptor-Cn9UoRgB.d.cts +0 -22
  142. package/dist/AmazonApiGatewayV2EndpointAdaptor-Cn9UoRgB.d.cts.map +0 -1
  143. package/dist/AmazonApiGatewayV2EndpointAdaptor-d7NP-bZX.d.mts +0 -22
  144. package/dist/AmazonApiGatewayV2EndpointAdaptor-d7NP-bZX.d.mts.map +0 -1
  145. package/dist/AmazonApiGatewayV2EndpointAdaptor-m9YKI294.mjs +0 -42
  146. package/dist/AmazonApiGatewayV2EndpointAdaptor-m9YKI294.mjs.map +0 -1
  147. package/dist/Authorizer-BZ1LcZFt.cjs +0 -92
  148. package/dist/Authorizer-BZ1LcZFt.cjs.map +0 -1
  149. package/dist/Authorizer-C5_FC_Rq.d.mts +0 -126
  150. package/dist/Authorizer-C5_FC_Rq.d.mts.map +0 -1
  151. package/dist/Authorizer-CZpg1Jqk.mjs +0 -68
  152. package/dist/Authorizer-CZpg1Jqk.mjs.map +0 -1
  153. package/dist/Authorizer-DWtwC8we.d.cts +0 -126
  154. package/dist/Authorizer-DWtwC8we.d.cts.map +0 -1
  155. package/dist/BaseFunctionBuilder-C-4hYTfj.d.cts +0 -42
  156. package/dist/BaseFunctionBuilder-C-4hYTfj.d.cts.map +0 -1
  157. package/dist/BaseFunctionBuilder-C3rQMoWb.mjs +0 -70
  158. package/dist/BaseFunctionBuilder-C3rQMoWb.mjs.map +0 -1
  159. package/dist/BaseFunctionBuilder-DXf6HK-N.cjs +0 -76
  160. package/dist/BaseFunctionBuilder-DXf6HK-N.cjs.map +0 -1
  161. package/dist/BaseFunctionBuilder-Q5qIlF-F.d.mts +0 -42
  162. package/dist/BaseFunctionBuilder-Q5qIlF-F.d.mts.map +0 -1
  163. package/dist/Construct-BXG8cFSm.cjs.map +0 -1
  164. package/dist/Construct-CQ9zV58W.mjs.map +0 -1
  165. package/dist/Construct-CX7HyFfT.d.cts.map +0 -1
  166. package/dist/Construct.cjs +0 -6
  167. package/dist/Construct.d.cts +0 -2
  168. package/dist/Construct.d.mts +0 -2
  169. package/dist/Construct.mjs +0 -3
  170. package/dist/Cron-BljK1gsV.d.mts +0 -26
  171. package/dist/Cron-BljK1gsV.d.mts.map +0 -1
  172. package/dist/Cron-C1vyfJ8B.cjs +0 -25
  173. package/dist/Cron-C1vyfJ8B.cjs.map +0 -1
  174. package/dist/Cron-CjWQEad0.mjs +0 -20
  175. package/dist/Cron-CjWQEad0.mjs.map +0 -1
  176. package/dist/Cron-CllHkk3z.d.cts +0 -26
  177. package/dist/Cron-CllHkk3z.d.cts.map +0 -1
  178. package/dist/CronBuilder-CAJFtnmZ.mjs +0 -68
  179. package/dist/CronBuilder-CAJFtnmZ.mjs.map +0 -1
  180. package/dist/CronBuilder-CG54f9LM.d.mts +0 -32
  181. package/dist/CronBuilder-CG54f9LM.d.mts.map +0 -1
  182. package/dist/CronBuilder-CSMd02lu.cjs +0 -74
  183. package/dist/CronBuilder-CSMd02lu.cjs.map +0 -1
  184. package/dist/CronBuilder-i23l40xs.d.cts +0 -32
  185. package/dist/CronBuilder-i23l40xs.d.cts.map +0 -1
  186. package/dist/Endpoint-BET0JSZK.d.mts.map +0 -1
  187. package/dist/Endpoint-BcxvF4F3.cjs +0 -440
  188. package/dist/Endpoint-BcxvF4F3.cjs.map +0 -1
  189. package/dist/Endpoint-CGdCGJkC.d.cts.map +0 -1
  190. package/dist/Endpoint-DvY3aqAy.mjs +0 -422
  191. package/dist/Endpoint-DvY3aqAy.mjs.map +0 -1
  192. package/dist/EndpointBuilder-6kdrQyIh.d.mts +0 -146
  193. package/dist/EndpointBuilder-6kdrQyIh.d.mts.map +0 -1
  194. package/dist/EndpointBuilder-CSwIguiR.d.cts +0 -146
  195. package/dist/EndpointBuilder-CSwIguiR.d.cts.map +0 -1
  196. package/dist/EndpointBuilder-EptJojG9.cjs +0 -268
  197. package/dist/EndpointBuilder-EptJojG9.cjs.map +0 -1
  198. package/dist/EndpointBuilder-iDpnACRb.mjs +0 -262
  199. package/dist/EndpointBuilder-iDpnACRb.mjs.map +0 -1
  200. package/dist/EndpointFactory-CBagQW5j.d.mts +0 -142
  201. package/dist/EndpointFactory-CBagQW5j.d.mts.map +0 -1
  202. package/dist/EndpointFactory-D2QxeaAh.cjs +0 -393
  203. package/dist/EndpointFactory-D2QxeaAh.cjs.map +0 -1
  204. package/dist/EndpointFactory-DQYSH8XK.d.cts +0 -142
  205. package/dist/EndpointFactory-DQYSH8XK.d.cts.map +0 -1
  206. package/dist/EndpointFactory-wgcqWod-.mjs +0 -381
  207. package/dist/EndpointFactory-wgcqWod-.mjs.map +0 -1
  208. package/dist/Function-CwlB89lS.d.cts +0 -76
  209. package/dist/Function-CwlB89lS.d.cts.map +0 -1
  210. package/dist/Function-D74HrBnX.d.mts +0 -76
  211. package/dist/Function-D74HrBnX.d.mts.map +0 -1
  212. package/dist/Function-DgQ_no6B.cjs +0 -84
  213. package/dist/Function-DgQ_no6B.cjs.map +0 -1
  214. package/dist/Function-xfQbftdE.mjs +0 -72
  215. package/dist/Function-xfQbftdE.mjs.map +0 -1
  216. package/dist/FunctionBuilder-CBeqX18X.mjs +0 -80
  217. package/dist/FunctionBuilder-CBeqX18X.mjs.map +0 -1
  218. package/dist/FunctionBuilder-C_qPxC8g.d.mts +0 -40
  219. package/dist/FunctionBuilder-C_qPxC8g.d.mts.map +0 -1
  220. package/dist/FunctionBuilder-C_xG9As7.cjs +0 -86
  221. package/dist/FunctionBuilder-C_xG9As7.cjs.map +0 -1
  222. package/dist/FunctionBuilder-D_7f5MfS.d.cts +0 -40
  223. package/dist/FunctionBuilder-D_7f5MfS.d.cts.map +0 -1
  224. package/dist/FunctionExecutionWrapper-B0ZAssiy.mjs +0 -101
  225. package/dist/FunctionExecutionWrapper-B0ZAssiy.mjs.map +0 -1
  226. package/dist/FunctionExecutionWrapper-Cg8HjuHL.d.cts +0 -50
  227. package/dist/FunctionExecutionWrapper-Cg8HjuHL.d.cts.map +0 -1
  228. package/dist/FunctionExecutionWrapper-KKHP6fDY.cjs +0 -107
  229. package/dist/FunctionExecutionWrapper-KKHP6fDY.cjs.map +0 -1
  230. package/dist/FunctionExecutionWrapper-xbTmBARx.d.mts +0 -50
  231. package/dist/FunctionExecutionWrapper-xbTmBARx.d.mts.map +0 -1
  232. package/dist/HonoEndpointAdaptor-B5fKdLi7.cjs.map +0 -1
  233. package/dist/HonoEndpointAdaptor-C2deTEwW.d.mts +0 -50
  234. package/dist/HonoEndpointAdaptor-C2deTEwW.d.mts.map +0 -1
  235. package/dist/HonoEndpointAdaptor-D3IgM-0B.d.cts +0 -50
  236. package/dist/HonoEndpointAdaptor-D3IgM-0B.d.cts.map +0 -1
  237. package/dist/HonoEndpointAdaptor-DOUODM7n.mjs.map +0 -1
  238. package/dist/MswEndpointAdaptor-B41INCc7.mjs +0 -108
  239. package/dist/MswEndpointAdaptor-B41INCc7.mjs.map +0 -1
  240. package/dist/MswEndpointAdaptor-CA_fu6Wx.cjs +0 -120
  241. package/dist/MswEndpointAdaptor-CA_fu6Wx.cjs.map +0 -1
  242. package/dist/MswEndpointAdaptor-CXgYbOxw.d.mts +0 -101
  243. package/dist/MswEndpointAdaptor-CXgYbOxw.d.mts.map +0 -1
  244. package/dist/MswEndpointAdaptor-CsYvrQeB.d.cts +0 -101
  245. package/dist/MswEndpointAdaptor-CsYvrQeB.d.cts.map +0 -1
  246. package/dist/Subscriber-9ObcUdcC.d.mts.map +0 -1
  247. package/dist/Subscriber-BH76wgkL.mjs +0 -28
  248. package/dist/Subscriber-BH76wgkL.mjs.map +0 -1
  249. package/dist/Subscriber-BgspJeS4.cjs +0 -34
  250. package/dist/Subscriber-BgspJeS4.cjs.map +0 -1
  251. package/dist/SubscriberBuilder-B4md5wzs.mjs +0 -54
  252. package/dist/SubscriberBuilder-B4md5wzs.mjs.map +0 -1
  253. package/dist/SubscriberBuilder-Be7WBbCL.d.cts +0 -28
  254. package/dist/SubscriberBuilder-Be7WBbCL.d.cts.map +0 -1
  255. package/dist/SubscriberBuilder-BtL22ZJ9.cjs +0 -60
  256. package/dist/SubscriberBuilder-BtL22ZJ9.cjs.map +0 -1
  257. package/dist/SubscriberBuilder-DsfIkgTF.d.mts +0 -28
  258. package/dist/SubscriberBuilder-DsfIkgTF.d.mts.map +0 -1
  259. package/dist/TestEndpointAdaptor-BFmgf7Fn.mjs +0 -174
  260. package/dist/TestEndpointAdaptor-BFmgf7Fn.mjs.map +0 -1
  261. package/dist/TestEndpointAdaptor-C79Z-QS4.d.mts +0 -45
  262. package/dist/TestEndpointAdaptor-C79Z-QS4.d.mts.map +0 -1
  263. package/dist/TestEndpointAdaptor-DYLDyAAC.cjs +0 -180
  264. package/dist/TestEndpointAdaptor-DYLDyAAC.cjs.map +0 -1
  265. package/dist/TestEndpointAdaptor-pM8yskbb.d.cts +0 -45
  266. package/dist/TestEndpointAdaptor-pM8yskbb.d.cts.map +0 -1
  267. package/dist/TestFunctionAdaptor-B859kIeb.cjs +0 -81
  268. package/dist/TestFunctionAdaptor-B859kIeb.cjs.map +0 -1
  269. package/dist/TestFunctionAdaptor-C0A-VqnM.d.mts +0 -30
  270. package/dist/TestFunctionAdaptor-C0A-VqnM.d.mts.map +0 -1
  271. package/dist/TestFunctionAdaptor-CqdSlhx1.mjs +0 -75
  272. package/dist/TestFunctionAdaptor-CqdSlhx1.mjs.map +0 -1
  273. package/dist/TestFunctionAdaptor-Dbq55dKP.d.cts +0 -30
  274. package/dist/TestFunctionAdaptor-Dbq55dKP.d.cts.map +0 -1
  275. package/dist/TestSubscriberAdaptor-BEyCFP9G.d.mts +0 -26
  276. package/dist/TestSubscriberAdaptor-BEyCFP9G.d.mts.map +0 -1
  277. package/dist/TestSubscriberAdaptor-BknOLRQw.d.cts +0 -26
  278. package/dist/TestSubscriberAdaptor-BknOLRQw.d.cts.map +0 -1
  279. package/dist/TestSubscriberAdaptor-CCcviuKa.mjs +0 -51
  280. package/dist/TestSubscriberAdaptor-CCcviuKa.mjs.map +0 -1
  281. package/dist/TestSubscriberAdaptor-_69o1d0f.cjs +0 -57
  282. package/dist/TestSubscriberAdaptor-_69o1d0f.cjs.map +0 -1
  283. package/dist/chunk-CUT6urMc.cjs +0 -30
  284. package/dist/crons/Cron.cjs +0 -8
  285. package/dist/crons/Cron.d.cts +0 -7
  286. package/dist/crons/Cron.d.mts +0 -7
  287. package/dist/crons/Cron.mjs +0 -8
  288. package/dist/crons/CronBuilder.cjs +0 -9
  289. package/dist/crons/CronBuilder.d.cts +0 -8
  290. package/dist/crons/CronBuilder.d.mts +0 -8
  291. package/dist/crons/CronBuilder.mjs +0 -9
  292. package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.cjs +0 -11
  293. package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.d.cts +0 -11
  294. package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.d.mts +0 -11
  295. package/dist/endpoints/AmazonApiGatewayEndpointAdaptor.mjs +0 -11
  296. package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.cjs +0 -13
  297. package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.d.cts +0 -12
  298. package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.d.mts +0 -12
  299. package/dist/endpoints/AmazonApiGatewayV1EndpointAdaptor.mjs +0 -13
  300. package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.cjs +0 -13
  301. package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.d.cts +0 -12
  302. package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.d.mts +0 -12
  303. package/dist/endpoints/AmazonApiGatewayV2EndpointAdaptor.mjs +0 -13
  304. package/dist/endpoints/Authorizer.cjs +0 -6
  305. package/dist/endpoints/Authorizer.d.cts +0 -2
  306. package/dist/endpoints/Authorizer.d.mts +0 -2
  307. package/dist/endpoints/Authorizer.mjs +0 -3
  308. package/dist/endpoints/Endpoint.cjs +0 -10
  309. package/dist/endpoints/Endpoint.d.cts +0 -9
  310. package/dist/endpoints/Endpoint.d.mts +0 -9
  311. package/dist/endpoints/Endpoint.mjs +0 -8
  312. package/dist/endpoints/EndpointBuilder.cjs +0 -11
  313. package/dist/endpoints/EndpointBuilder.d.cts +0 -10
  314. package/dist/endpoints/EndpointBuilder.d.mts +0 -10
  315. package/dist/endpoints/EndpointBuilder.mjs +0 -11
  316. package/dist/endpoints/EndpointFactory.cjs +0 -13
  317. package/dist/endpoints/EndpointFactory.d.cts +0 -11
  318. package/dist/endpoints/EndpointFactory.d.mts +0 -11
  319. package/dist/endpoints/EndpointFactory.mjs +0 -12
  320. package/dist/endpoints/HonoEndpointAdaptor.cjs +0 -14
  321. package/dist/endpoints/HonoEndpointAdaptor.d.cts +0 -10
  322. package/dist/endpoints/HonoEndpointAdaptor.d.mts +0 -10
  323. package/dist/endpoints/HonoEndpointAdaptor.mjs +0 -14
  324. package/dist/endpoints/MswEndpointAdaptor.cjs +0 -16
  325. package/dist/endpoints/MswEndpointAdaptor.d.cts +0 -10
  326. package/dist/endpoints/MswEndpointAdaptor.d.mts +0 -10
  327. package/dist/endpoints/MswEndpointAdaptor.mjs +0 -15
  328. package/dist/endpoints/TestEndpointAdaptor.cjs +0 -12
  329. package/dist/endpoints/TestEndpointAdaptor.d.cts +0 -10
  330. package/dist/endpoints/TestEndpointAdaptor.d.mts +0 -10
  331. package/dist/endpoints/TestEndpointAdaptor.mjs +0 -12
  332. package/dist/endpoints/audit.cjs +0 -0
  333. package/dist/endpoints/audit.d.cts +0 -9
  334. package/dist/endpoints/audit.d.mts +0 -9
  335. package/dist/endpoints/audit.mjs +0 -0
  336. package/dist/endpoints/helpers.cjs +0 -10
  337. package/dist/endpoints/helpers.d.cts +0 -60
  338. package/dist/endpoints/helpers.d.cts.map +0 -1
  339. package/dist/endpoints/helpers.d.mts +0 -60
  340. package/dist/endpoints/helpers.d.mts.map +0 -1
  341. package/dist/endpoints/helpers.mjs +0 -9
  342. package/dist/endpoints/lazyAccessors.cjs +0 -10
  343. package/dist/endpoints/lazyAccessors.d.cts +0 -10
  344. package/dist/endpoints/lazyAccessors.d.mts +0 -10
  345. package/dist/endpoints/lazyAccessors.mjs +0 -3
  346. package/dist/endpoints/parseHonoQuery.cjs +0 -3
  347. package/dist/endpoints/parseHonoQuery.d.cts +0 -14
  348. package/dist/endpoints/parseHonoQuery.d.cts.map +0 -1
  349. package/dist/endpoints/parseHonoQuery.d.mts +0 -14
  350. package/dist/endpoints/parseHonoQuery.d.mts.map +0 -1
  351. package/dist/endpoints/parseHonoQuery.mjs +0 -3
  352. package/dist/endpoints/parseQueryParams.cjs +0 -3
  353. package/dist/endpoints/parseQueryParams.d.cts +0 -14
  354. package/dist/endpoints/parseQueryParams.d.cts.map +0 -1
  355. package/dist/endpoints/parseQueryParams.d.mts +0 -14
  356. package/dist/endpoints/parseQueryParams.d.mts.map +0 -1
  357. package/dist/endpoints/parseQueryParams.mjs +0 -3
  358. package/dist/endpoints/processAudits.cjs +0 -5
  359. package/dist/endpoints/processAudits.d.cts +0 -95
  360. package/dist/endpoints/processAudits.d.cts.map +0 -1
  361. package/dist/endpoints/processAudits.d.mts +0 -95
  362. package/dist/endpoints/processAudits.d.mts.map +0 -1
  363. package/dist/endpoints/processAudits.mjs +0 -3
  364. package/dist/endpoints/rls.cjs +0 -3
  365. package/dist/endpoints/rls.d.cts +0 -9
  366. package/dist/endpoints/rls.d.mts +0 -9
  367. package/dist/endpoints/rls.mjs +0 -3
  368. package/dist/functions/AWSLambdaFunction.cjs +0 -9
  369. package/dist/functions/AWSLambdaFunction.d.cts +0 -5
  370. package/dist/functions/AWSLambdaFunction.d.mts +0 -5
  371. package/dist/functions/AWSLambdaFunction.mjs +0 -9
  372. package/dist/functions/BaseFunctionBuilder.cjs +0 -4
  373. package/dist/functions/BaseFunctionBuilder.d.cts +0 -3
  374. package/dist/functions/BaseFunctionBuilder.d.mts +0 -3
  375. package/dist/functions/BaseFunctionBuilder.mjs +0 -4
  376. package/dist/functions/Function.cjs +0 -5
  377. package/dist/functions/Function.d.cts +0 -3
  378. package/dist/functions/Function.d.mts +0 -3
  379. package/dist/functions/Function.mjs +0 -4
  380. package/dist/functions/FunctionBuilder.cjs +0 -6
  381. package/dist/functions/FunctionBuilder.d.cts +0 -5
  382. package/dist/functions/FunctionBuilder.d.mts +0 -5
  383. package/dist/functions/FunctionBuilder.mjs +0 -6
  384. package/dist/functions/FunctionExecutionWrapper.cjs +0 -8
  385. package/dist/functions/FunctionExecutionWrapper.d.cts +0 -4
  386. package/dist/functions/FunctionExecutionWrapper.d.mts +0 -4
  387. package/dist/functions/FunctionExecutionWrapper.mjs +0 -8
  388. package/dist/functions/TestFunctionAdaptor.cjs +0 -8
  389. package/dist/functions/TestFunctionAdaptor.d.cts +0 -4
  390. package/dist/functions/TestFunctionAdaptor.d.mts +0 -4
  391. package/dist/functions/TestFunctionAdaptor.mjs +0 -8
  392. package/dist/functions-B1mrMoUH.mjs +0 -8
  393. package/dist/functions-B1mrMoUH.mjs.map +0 -1
  394. package/dist/functions-rOD3pXQd.cjs +0 -13
  395. package/dist/functions-rOD3pXQd.cjs.map +0 -1
  396. package/dist/helpers-BYyX0qTA.cjs +0 -95
  397. package/dist/helpers-BYyX0qTA.cjs.map +0 -1
  398. package/dist/helpers-BtwC2IW8.mjs +0 -83
  399. package/dist/helpers-BtwC2IW8.mjs.map +0 -1
  400. package/dist/index-BfeupgMl.d.cts +0 -12
  401. package/dist/index-BfeupgMl.d.cts.map +0 -1
  402. package/dist/index-Cg2UDz1r.d.mts +0 -12
  403. package/dist/index-Cg2UDz1r.d.mts.map +0 -1
  404. package/dist/lazyAccessors-BVEtB9lU.cjs +0 -223
  405. package/dist/lazyAccessors-BVEtB9lU.cjs.map +0 -1
  406. package/dist/lazyAccessors-Bxy5DBp4.d.cts +0 -49
  407. package/dist/lazyAccessors-Bxy5DBp4.d.cts.map +0 -1
  408. package/dist/lazyAccessors-CWFdtzSR.d.mts +0 -49
  409. package/dist/lazyAccessors-CWFdtzSR.d.mts.map +0 -1
  410. package/dist/lazyAccessors-DM6HcXQk.mjs +0 -175
  411. package/dist/lazyAccessors-DM6HcXQk.mjs.map +0 -1
  412. package/dist/parseHonoQuery-BBs8CX-H.cjs +0 -24
  413. package/dist/parseHonoQuery-BBs8CX-H.cjs.map +0 -1
  414. package/dist/parseHonoQuery-Cp8CII0P.mjs +0 -18
  415. package/dist/parseHonoQuery-Cp8CII0P.mjs.map +0 -1
  416. package/dist/parseQueryParams-B4RK1za3.cjs +0 -31
  417. package/dist/parseQueryParams-B4RK1za3.cjs.map +0 -1
  418. package/dist/parseQueryParams-DS3Qmrbd.mjs +0 -25
  419. package/dist/parseQueryParams-DS3Qmrbd.mjs.map +0 -1
  420. package/dist/processAudits-CzHkPokQ.cjs +0 -180
  421. package/dist/processAudits-CzHkPokQ.cjs.map +0 -1
  422. package/dist/processAudits-Dj8UGqcW.mjs +0 -162
  423. package/dist/processAudits-Dj8UGqcW.mjs.map +0 -1
  424. package/dist/publisher-BUDHcaz3.d.cts +0 -16
  425. package/dist/publisher-BUDHcaz3.d.cts.map +0 -1
  426. package/dist/publisher-Bw4770Hi.mjs +0 -41
  427. package/dist/publisher-Bw4770Hi.mjs.map +0 -1
  428. package/dist/publisher-DXglijK_.d.mts +0 -16
  429. package/dist/publisher-DXglijK_.d.mts.map +0 -1
  430. package/dist/publisher-lFQleddL.cjs +0 -53
  431. package/dist/publisher-lFQleddL.cjs.map +0 -1
  432. package/dist/publisher.cjs +0 -4
  433. package/dist/publisher.d.cts +0 -3
  434. package/dist/publisher.d.mts +0 -3
  435. package/dist/publisher.mjs +0 -3
  436. package/dist/rls-C0r4UKVm.mjs +0 -9
  437. package/dist/rls-C0r4UKVm.mjs.map +0 -1
  438. package/dist/rls-Cfb6w-tQ.cjs +0 -15
  439. package/dist/rls-Cfb6w-tQ.cjs.map +0 -1
  440. package/dist/subscribers/AWSLambdaSubscriberAdaptor.cjs +0 -3
  441. package/dist/subscribers/AWSLambdaSubscriberAdaptor.d.cts +0 -4
  442. package/dist/subscribers/AWSLambdaSubscriberAdaptor.d.mts +0 -4
  443. package/dist/subscribers/AWSLambdaSubscriberAdaptor.mjs +0 -3
  444. package/dist/subscribers/Subscriber.cjs +0 -4
  445. package/dist/subscribers/Subscriber.d.cts +0 -3
  446. package/dist/subscribers/Subscriber.d.mts +0 -3
  447. package/dist/subscribers/Subscriber.mjs +0 -4
  448. package/dist/subscribers/SubscriberBuilder.cjs +0 -5
  449. package/dist/subscribers/SubscriberBuilder.d.cts +0 -4
  450. package/dist/subscribers/SubscriberBuilder.d.mts +0 -4
  451. package/dist/subscribers/SubscriberBuilder.mjs +0 -5
  452. package/dist/subscribers/TestSubscriberAdaptor.cjs +0 -4
  453. package/dist/subscribers/TestSubscriberAdaptor.d.cts +0 -4
  454. package/dist/subscribers/TestSubscriberAdaptor.d.mts +0 -4
  455. package/dist/subscribers/TestSubscriberAdaptor.mjs +0 -4
  456. package/dist/telemetry.cjs +0 -0
  457. package/dist/telemetry.d.cts +0 -2
  458. package/dist/telemetry.d.mts +0 -2
  459. package/dist/telemetry.mjs +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lazyAccessors-DHvDeww0.cjs","names":["INFINITY","MAX_SAFE_INTEGER","funcTag","genTag","symbolTag","freeGlobal","freeSelf","root","objectProto","hasOwnProperty","objectToString","Symbol","Map","string","toKey","isArray","isFunction","isObject","isObjectLike","isSymbol","set","pick","Function","endpoints: Endpoint<any, any, any, any, any, any>[]","options?: OpenApiSchemaOptions","input: unknown","key: K","body: unknown","status: number","headers: Record<string, string>","key?: string","cookieHeader: string | undefined","name?: string","name: string","value: string","options?: CookieOptions","ctx: EndpointContext<TInput, TServices, TLogger, TSession>","ctx: EndpointContext<\n\t\t\tTInput,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTAuditAction,\n\t\t\tTDatabase,\n\t\t\tTAuditStorage\n\t\t>","response: ResponseBuilder","obj: any","ConstructType","response: T | ResponseWithMetadata<T>","componentCollector?: ComponentCollector","operation: OpenAPIV3_1.OperationObject","pathParameters: OpenAPIV3_1.ParameterObject[]","queryParameters: OpenAPIV3_1.ParameterObject[]","routeObject: any","key: string","options?: Pick<CookieOptions, 'domain' | 'path'>","code: SuccessStatus","data: T","logger: Logger","serviceDiscovery: ServiceDiscovery<any>","ev: MappedEvent<T, OutSchema>[]","response: InferStandardSchema<OutSchema>","publisherService: TPublisherService","events: MappedEvent<T, OutSchema>[]","construct: Construct<\n\t\tLogger,\n\t\tTServiceName,\n\t\tT,\n\t\tOutSchema,\n\t\tTServices,\n\t\tTAuditStorageServiceName,\n\t\tTAuditStorage\n\t>","c: Context","allHeaders: Record<string, string> | null","key?: string","allCookies: Record<string, string> | null","name?: string","headers: Record<string, string | undefined> | null | undefined","normalizedHeaders: Record<string, string> | null","cookies: string[] | undefined","cookieHeader: string | undefined","parsed: Record<string, string> | null","headers: Record<string, string> | undefined","normalized: Record<string, string> | null"],"sources":["../../../node_modules/.pnpm/lodash.set@4.3.2/node_modules/lodash.set/index.js","../../../node_modules/.pnpm/lodash.pick@4.4.0/node_modules/lodash.pick/index.js","../src/endpoints/Endpoint.ts","../src/publisher.ts","../src/endpoints/lazyAccessors.ts"],"sourcesContent":["/**\n * lodash (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors <https://jquery.org/>\n * Released under MIT license <https://lodash.com/license>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0,\n MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n symbolTag = '[object Symbol]';\n\n/** Used to match property names within property paths. */\nvar reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\\\]|\\\\.)*?\\1)\\]/,\n reIsPlainProp = /^\\w*$/,\n reLeadingDot = /^\\./,\n rePropName = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))/g;\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to match backslashes in property paths. */\nvar reEscapeChar = /\\\\(\\\\)?/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\n/**\n * Checks if `value` is a host object in IE < 9.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a host object, else `false`.\n */\nfunction isHostObject(value) {\n // Many host objects are `Object` objects that can coerce to strings\n // despite having improperly defined `toString` methods.\n var result = false;\n if (value != null && typeof value.toString != 'function') {\n try {\n result = !!(value + '');\n } catch (e) {}\n }\n return result;\n}\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype,\n funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/** Built-in value references. */\nvar Symbol = root.Symbol,\n splice = arrayProto.splice;\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, 'Map'),\n nativeCreate = getNative(Object, 'create');\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolToString = symbolProto ? symbolProto.toString : undefined;\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries ? entries.length : 0;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n}\n\n/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n return this.has(key) && delete this.__data__[key];\n}\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);\n}\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries ? entries.length : 0;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n}\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n return true;\n}\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries ? entries.length : 0;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n return getMapData(this, key)['delete'](key);\n}\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n getMapData(this, key).set(key, value);\n return this;\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n object[key] = value;\n }\n}\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\n/**\n * The base implementation of `_.set`.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {*} value The value to set.\n * @param {Function} [customizer] The function to customize path creation.\n * @returns {Object} Returns `object`.\n */\nfunction baseSet(object, path, value, customizer) {\n if (!isObject(object)) {\n return object;\n }\n path = isKey(path, object) ? [path] : castPath(path);\n\n var index = -1,\n length = path.length,\n lastIndex = length - 1,\n nested = object;\n\n while (nested != null && ++index < length) {\n var key = toKey(path[index]),\n newValue = value;\n\n if (index != lastIndex) {\n var objValue = nested[key];\n newValue = customizer ? customizer(objValue, key, nested) : undefined;\n if (newValue === undefined) {\n newValue = isObject(objValue)\n ? objValue\n : (isIndex(path[index + 1]) ? [] : {});\n }\n }\n assignValue(nested, key, newValue);\n nested = nested[key];\n }\n return object;\n}\n\n/**\n * The base implementation of `_.toString` which doesn't convert nullish\n * values to empty strings.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\nfunction baseToString(value) {\n // Exit early for strings to avoid a performance hit in some environments.\n if (typeof value == 'string') {\n return value;\n }\n if (isSymbol(value)) {\n return symbolToString ? symbolToString.call(value) : '';\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\n/**\n * Casts `value` to a path array if it's not one.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {Array} Returns the cast property path array.\n */\nfunction castPath(value) {\n return isArray(value) ? value : stringToPath(value);\n}\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n length = length == null ? MAX_SAFE_INTEGER : length;\n return !!length &&\n (typeof value == 'number' || reIsUint.test(value)) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\n/**\n * Checks if `value` is a property name and not a property path.\n *\n * @private\n * @param {*} value The value to check.\n * @param {Object} [object] The object to query keys on.\n * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n */\nfunction isKey(value, object) {\n if (isArray(value)) {\n return false;\n }\n var type = typeof value;\n if (type == 'number' || type == 'symbol' || type == 'boolean' ||\n value == null || isSymbol(value)) {\n return true;\n }\n return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||\n (object != null && value in Object(object));\n}\n\n/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\n/**\n * Converts `string` to a property path array.\n *\n * @private\n * @param {string} string The string to convert.\n * @returns {Array} Returns the property path array.\n */\nvar stringToPath = memoize(function(string) {\n string = toString(string);\n\n var result = [];\n if (reLeadingDot.test(string)) {\n result.push('');\n }\n string.replace(rePropName, function(match, number, quote, string) {\n result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));\n });\n return result;\n});\n\n/**\n * Converts `value` to a string key if it's not a string or symbol.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {string|symbol} Returns the key.\n */\nfunction toKey(value) {\n if (typeof value == 'string' || isSymbol(value)) {\n return value;\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to process.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\n/**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is used as the map cache key. The `func`\n * is invoked with the `this` binding of the memoized function.\n *\n * **Note:** The cache is exposed as the `cache` property on the memoized\n * function. Its creation may be customized by replacing the `_.memoize.Cache`\n * constructor with one whose instances implement the\n * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)\n * method interface of `delete`, `get`, `has`, and `set`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoized function.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n * var other = { 'c': 3, 'd': 4 };\n *\n * var values = _.memoize(_.values);\n * values(object);\n * // => [1, 2]\n *\n * values(other);\n * // => [3, 4]\n *\n * object.a = 2;\n * values(object);\n * // => [1, 2]\n *\n * // Modify the result cache.\n * values.cache.set(object, ['a', 'b']);\n * values(object);\n * // => ['a', 'b']\n *\n * // Replace `_.memoize.Cache`.\n * _.memoize.Cache = WeakMap;\n */\nfunction memoize(func, resolver) {\n if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var memoized = function() {\n var args = arguments,\n key = resolver ? resolver.apply(this, args) : args[0],\n cache = memoized.cache;\n\n if (cache.has(key)) {\n return cache.get(key);\n }\n var result = func.apply(this, args);\n memoized.cache = cache.set(key, result);\n return result;\n };\n memoized.cache = new (memoize.Cache || MapCache);\n return memoized;\n}\n\n// Assign cache to `_.memoize`.\nmemoize.Cache = MapCache;\n\n/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8-9 which returns 'object' for typed array and other constructors.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Converts `value` to a string. An empty string is returned for `null`\n * and `undefined` values. The sign of `-0` is preserved.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n * @example\n *\n * _.toString(null);\n * // => ''\n *\n * _.toString(-0);\n * // => '-0'\n *\n * _.toString([1, 2, 3]);\n * // => '1,2,3'\n */\nfunction toString(value) {\n return value == null ? '' : baseToString(value);\n}\n\n/**\n * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,\n * it's created. Arrays are created for missing index properties while objects\n * are created for all other missing properties. Use `_.setWith` to customize\n * `path` creation.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 3.7.0\n * @category Object\n * @param {Object} object The object to modify.\n * @param {Array|string} path The path of the property to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.set(object, 'a[0].b.c', 4);\n * console.log(object.a[0].b.c);\n * // => 4\n *\n * _.set(object, ['x', '0', 'y', 'z'], 5);\n * console.log(object.x[0].y.z);\n * // => 5\n */\nfunction set(object, path, value) {\n return object == null ? object : baseSet(object, path, value);\n}\n\nmodule.exports = set;\n","/**\n * lodash (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors <https://jquery.org/>\n * Released under MIT license <https://lodash.com/license>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as references for various `Number` constants. */\nvar INFINITY = 1 / 0,\n MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n symbolTag = '[object Symbol]';\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\nfunction apply(func, thisArg, args) {\n switch (args.length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n}\n\n/**\n * A specialized version of `_.map` for arrays without support for iteratee\n * shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\nfunction arrayMap(array, iteratee) {\n var index = -1,\n length = array ? array.length : 0,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n}\n\n/**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\nfunction arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n}\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar Symbol = root.Symbol,\n propertyIsEnumerable = objectProto.propertyIsEnumerable,\n spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * The base implementation of `_.flatten` with support for restricting flattening.\n *\n * @private\n * @param {Array} array The array to flatten.\n * @param {number} depth The maximum recursion depth.\n * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.\n * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.\n * @param {Array} [result=[]] The initial result value.\n * @returns {Array} Returns the new flattened array.\n */\nfunction baseFlatten(array, depth, predicate, isStrict, result) {\n var index = -1,\n length = array.length;\n\n predicate || (predicate = isFlattenable);\n result || (result = []);\n\n while (++index < length) {\n var value = array[index];\n if (depth > 0 && predicate(value)) {\n if (depth > 1) {\n // Recursively flatten arrays (susceptible to call stack limits).\n baseFlatten(value, depth - 1, predicate, isStrict, result);\n } else {\n arrayPush(result, value);\n }\n } else if (!isStrict) {\n result[result.length] = value;\n }\n }\n return result;\n}\n\n/**\n * The base implementation of `_.pick` without support for individual\n * property identifiers.\n *\n * @private\n * @param {Object} object The source object.\n * @param {string[]} props The property identifiers to pick.\n * @returns {Object} Returns the new object.\n */\nfunction basePick(object, props) {\n object = Object(object);\n return basePickBy(object, props, function(value, key) {\n return key in object;\n });\n}\n\n/**\n * The base implementation of `_.pickBy` without support for iteratee shorthands.\n *\n * @private\n * @param {Object} object The source object.\n * @param {string[]} props The property identifiers to pick from.\n * @param {Function} predicate The function invoked per property.\n * @returns {Object} Returns the new object.\n */\nfunction basePickBy(object, props, predicate) {\n var index = -1,\n length = props.length,\n result = {};\n\n while (++index < length) {\n var key = props[index],\n value = object[key];\n\n if (predicate(value, key)) {\n result[key] = value;\n }\n }\n return result;\n}\n\n/**\n * The base implementation of `_.rest` which doesn't validate or coerce arguments.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n */\nfunction baseRest(func, start) {\n start = nativeMax(start === undefined ? (func.length - 1) : start, 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n index = -1;\n var otherArgs = Array(start + 1);\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = array;\n return apply(func, this, otherArgs);\n };\n}\n\n/**\n * Checks if `value` is a flattenable `arguments` object or array.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.\n */\nfunction isFlattenable(value) {\n return isArray(value) || isArguments(value) ||\n !!(spreadableSymbol && value && value[spreadableSymbol]);\n}\n\n/**\n * Converts `value` to a string key if it's not a string or symbol.\n *\n * @private\n * @param {*} value The value to inspect.\n * @returns {string|symbol} Returns the key.\n */\nfunction toKey(value) {\n if (typeof value == 'string' || isSymbol(value)) {\n return value;\n }\n var result = (value + '');\n return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;\n}\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nfunction isArguments(value) {\n // Safari 8.1 makes `arguments.callee` enumerable in strict mode.\n return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&\n (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);\n}\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8-9 which returns 'object' for typed array and other constructors.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Creates an object composed of the picked `object` properties.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The source object.\n * @param {...(string|string[])} [props] The property identifiers to pick.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'a': 1, 'b': '2', 'c': 3 };\n *\n * _.pick(object, ['a', 'c']);\n * // => { 'a': 1, 'c': 3 }\n */\nvar pick = baseRest(function(object, props) {\n return object == null ? {} : basePick(object, arrayMap(baseFlatten(props, 1), toKey));\n});\n\nmodule.exports = pick;\n","import type { AuditableAction, Auditor, AuditStorage } from '@geekmidas/audit';\nimport type {\n\tEventPublisher,\n\tExtractPublisherMessage,\n\tMappedEvent,\n} from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport type { RateLimitConfig } from '@geekmidas/rate-limit';\nimport type {\n\tInferComposableStandardSchema,\n\tInferStandardSchema,\n} from '@geekmidas/schema';\nimport {\n\tconvertSchemaWithComponents,\n\tconvertStandardSchemaToJsonSchema,\n} from '@geekmidas/schema/conversion';\nimport {\n\tbuildOpenApiSchema,\n\ttype ComponentCollector,\n\ttype OpenApiSchemaOptions,\n} from '@geekmidas/schema/openapi';\nimport type { Service, ServiceRecord } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport pick from 'lodash.pick';\nimport set from 'lodash.set';\nimport type { OpenAPIV3_1 } from 'openapi-types';\nimport { ConstructType } from '../Construct';\nimport { Function, type FunctionHandler } from '../functions';\nimport type { HttpMethod, LowerHttpMethod, RemoveUndefined } from '../types';\nimport type { Authorizer } from './Authorizer';\nimport type { ActorExtractor, MappedAudit } from './audit';\nimport type { RlsConfig } from './rls';\n\n/**\n * Represents an HTTP endpoint that can handle requests with type-safe input/output validation,\n * dependency injection, session management, and authorization.\n *\n * @template TRoute - The route path string with parameter placeholders (e.g., '/users/:id')\n * @template TMethod - The HTTP method (GET, POST, PUT, DELETE, PATCH)\n * @template TInput - The input schema definition for body, query, and path parameters\n * @template OutSchema - The output schema for response validation\n * @template TServices - Array of service dependencies to inject\n * @template TLogger - The logger instance type\n * @template TSession - The session data type\n *\n * @extends Function - Base function construct for handler execution\n *\n * @example\n * ```typescript\n * const endpoint = new Endpoint({\n * route: '/users/:id',\n * method: 'GET',\n * input: { params: userIdSchema },\n * output: userSchema,\n * fn: async ({ params }) => getUserById(params.id)\n * });\n * ```\n */\nexport class Endpoint<\n\tTRoute extends string,\n\tTMethod extends HttpMethod,\n\tTInput extends EndpointSchemas = {},\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n\tTEventPublisher extends EventPublisher<any> | undefined = undefined,\n\tTEventPublisherServiceName extends string = string,\n\tTAuditStorage extends AuditStorage | undefined = undefined,\n\tTAuditStorageServiceName extends string = string,\n\tTAuditAction extends AuditableAction<string, unknown> = AuditableAction<\n\t\tstring,\n\t\tunknown\n\t>,\n\tTDatabase = undefined,\n\tTDatabaseServiceName extends string = string,\n> extends Function<\n\tTInput,\n\tTServices,\n\tTLogger,\n\tOutSchema,\n\tTEventPublisher,\n\tTEventPublisherServiceName,\n\tTAuditStorage,\n\tTAuditStorageServiceName,\n\tTDatabase,\n\tTDatabaseServiceName,\n\tTAuditAction,\n\tFunctionHandler<\n\t\tTInput,\n\t\tTServices,\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTDatabase,\n\t\tTAuditStorage,\n\t\tTAuditAction\n\t>\n> {\n\toperationId?: string;\n\t/** The route path pattern with parameter placeholders */\n\troute: TRoute;\n\t/** The HTTP method for this endpoint */\n\tmethod: TMethod;\n\t/** Optional description for OpenAPI documentation */\n\tdescription?: string;\n\t/** Optional tags for OpenAPI documentation */\n\ttags?: string[];\n\t/** The HTTP success status code to return (default: 200) */\n\tpublic readonly status: SuccessStatus;\n\t/** Default headers to apply to all responses */\n\tpublic readonly defaultHeaders: Record<string, string> = {};\n\t/** Function to extract session data from the request context */\n\tpublic getSession: SessionFn<TServices, TLogger, TSession, TDatabase> = () =>\n\t\t({}) as TSession;\n\t/** Function to determine if the request is authorized */\n\tpublic authorize: AuthorizeFn<\n\t\tTServices,\n\t\tTLogger,\n\t\tTSession,\n\t\tTInput,\n\t\tTDatabase\n\t> = () => true;\n\t/** Optional rate limiting configuration */\n\tpublic rateLimit?: RateLimitConfig;\n\t/** Optional authorizer for this endpoint */\n\tpublic authorizer?: Authorizer;\n\t/** Optional actor extractor for audit records */\n\tpublic actorExtractor?: ActorExtractor<TServices, TSession, TLogger>;\n\t/** Declarative audit definitions */\n\tpublic audits: MappedAudit<TAuditAction, OutSchema>[] = [];\n\t/** Database service for this endpoint */\n\tpublic declare databaseService?: Service<TDatabaseServiceName, TDatabase>;\n\t/** RLS configuration for this endpoint */\n\tpublic rlsConfig?: RlsConfig<TServices, TSession, TLogger>;\n\t/** Whether to bypass RLS for this endpoint */\n\tpublic rlsBypass?: boolean;\n\t/** The endpoint handler function */\n\tprivate endpointFn!: EndpointHandler<\n\t\tTInput,\n\t\tTServices,\n\t\tTLogger,\n\t\tOutSchema,\n\t\tTSession,\n\t\tTDatabase,\n\t\tTAuditStorage,\n\t\tTAuditAction\n\t>;\n\n\t/**\n\t * Builds a complete OpenAPI 3.1 schema from an array of endpoints.\n\t *\n\t * @param endpoints - Array of endpoint instances to document\n\t * @param options - Optional configuration for OpenAPI generation\n\t * @returns OpenAPI 3.1 specification object\n\t *\n\t * @example\n\t * ```typescript\n\t * const schema = await Endpoint.buildOpenApiSchema([\n\t * getUserEndpoint,\n\t * createUserEndpoint\n\t * ], {\n\t * title: 'User API',\n\t * version: '1.0.0'\n\t * });\n\t * ```\n\t */\n\tstatic async buildOpenApiSchema(\n\t\tendpoints: Endpoint<any, any, any, any, any, any>[],\n\t\toptions?: OpenApiSchemaOptions,\n\t) {\n\t\treturn buildOpenApiSchema(endpoints, options);\n\t}\n\n\t/**\n\t * Gets the full path including HTTP method and route.\n\t * @returns Formatted string like 'GET /users/{id}'\n\t */\n\tget fullPath() {\n\t\treturn `${this.method} ${this._path}` as const;\n\t}\n\n\t/**\n\t * Parses and validates input data for a specific input type (body, query, params).\n\t *\n\t * @param input - The raw input data to validate\n\t * @param key - The input type key ('body', 'query', or 'params')\n\t * @returns The validated input data for the specified key\n\t * @throws {UnprocessableEntityError} When validation fails\n\t */\n\tasync parseInput<K extends keyof TInput>(\n\t\tinput: unknown,\n\t\tkey: K,\n\t): Promise<InferComposableStandardSchema<TInput[K]>> {\n\t\tconst schema = this.input?.[key];\n\t\treturn Endpoint.parseSchema(schema as StandardSchemaV1, input) as Promise<\n\t\t\tInferComposableStandardSchema<TInput[K]>\n\t\t>;\n\t}\n\n\t/**\n\t * Parses and validates the request body against the body schema.\n\t *\n\t * @param body - The raw request body to validate\n\t * @returns The validated body data\n\t * @throws {UnprocessableEntityError} When body validation fails\n\t */\n\tasync parseBody(body: unknown): Promise<InferStandardSchema<TInput['body']>> {\n\t\treturn this.parseInput(body, 'body') as Promise<\n\t\t\tInferStandardSchema<TInput['body']>\n\t\t>;\n\t}\n\n\tstatic isSuccessStatus(status: number): boolean {\n\t\treturn status >= 200 && status < 300;\n\t}\n\n\t/**\n\t * Creates a case-insensitive header lookup function from a headers object.\n\t *\n\t * @param headers - Object containing header key-value pairs\n\t * @returns Function to retrieve header values by case-insensitive key, or all headers\n\t *\n\t * @example\n\t * ```typescript\n\t * const headerFn = Endpoint.createHeaders({ 'Content-Type': 'application/json' });\n\t * headerFn('content-type'); // Returns 'application/json'\n\t * headerFn(); // Returns { 'content-type': 'application/json' }\n\t * ```\n\t */\n\tstatic createHeaders(headers: Record<string, string>): HeaderFn {\n\t\tconst headerMap = new Map<string, string>();\n\t\tfor (const [k, v] of Object.entries(headers)) {\n\t\t\tconst key = k.toLowerCase();\n\t\t\theaderMap.set(key, v);\n\t\t}\n\n\t\tfunction get(): Record<string, string>;\n\t\tfunction get(key: string): string | undefined;\n\t\tfunction get(key?: string): string | undefined | Record<string, string> {\n\t\t\tif (key === undefined) {\n\t\t\t\t// Return all headers as plain object\n\t\t\t\treturn Object.fromEntries(headerMap.entries());\n\t\t\t}\n\t\t\treturn headerMap.get(key.toLowerCase());\n\t\t}\n\n\t\treturn get;\n\t}\n\n\t/**\n\t * Parses cookie string and creates a cookie lookup function.\n\t *\n\t * @param cookieHeader - The Cookie header value\n\t * @returns Function to retrieve cookie values by name, or all cookies\n\t *\n\t * @example\n\t * ```typescript\n\t * const cookieFn = Endpoint.createCookies('session=abc123; theme=dark');\n\t * cookieFn('session'); // Returns 'abc123'\n\t * cookieFn(); // Returns { session: 'abc123', theme: 'dark' }\n\t * ```\n\t */\n\tstatic createCookies(cookieHeader: string | undefined): CookieFn {\n\t\tconst cookieMap = new Map<string, string>();\n\n\t\tif (cookieHeader) {\n\t\t\t// Parse cookie string: \"name1=value1; name2=value2\"\n\t\t\tconst cookies = cookieHeader.split(';');\n\t\t\tfor (const cookie of cookies) {\n\t\t\t\tconst [name, ...valueParts] = cookie.trim().split('=');\n\t\t\t\tif (name) {\n\t\t\t\t\tconst value = valueParts.join('='); // Handle values with = in them\n\t\t\t\t\tcookieMap.set(name, decodeURIComponent(value));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfunction get(): Record<string, string>;\n\t\tfunction get(name: string): string | undefined;\n\t\tfunction get(name?: string): string | undefined | Record<string, string> {\n\t\t\tif (name === undefined) {\n\t\t\t\t// Return all cookies as plain object\n\t\t\t\treturn Object.fromEntries(cookieMap.entries());\n\t\t\t}\n\t\t\treturn cookieMap.get(name);\n\t\t}\n\n\t\treturn get;\n\t}\n\n\t/**\n\t * Formats a cookie as a Set-Cookie header string.\n\t *\n\t * @param name - Cookie name\n\t * @param value - Cookie value\n\t * @param options - Cookie options (httpOnly, secure, sameSite, etc.)\n\t * @returns Formatted Set-Cookie header string\n\t *\n\t * @example\n\t * ```typescript\n\t * const header = Endpoint.formatCookieHeader('session', 'abc123', {\n\t * httpOnly: true,\n\t * secure: true,\n\t * sameSite: 'strict',\n\t * maxAge: 3600\n\t * });\n\t * // Returns: \"session=abc123; Max-Age=3600; HttpOnly; Secure; SameSite=Strict\"\n\t * ```\n\t */\n\tstatic formatCookieHeader(\n\t\tname: string,\n\t\tvalue: string,\n\t\toptions?: CookieOptions,\n\t): string {\n\t\tlet cookie = `${name}=${value}`;\n\n\t\tif (options) {\n\t\t\tif (options.domain) cookie += `; Domain=${options.domain}`;\n\t\t\tif (options.path) cookie += `; Path=${options.path}`;\n\t\t\tif (options.expires)\n\t\t\t\tcookie += `; Expires=${options.expires.toUTCString()}`;\n\t\t\tif (options.maxAge !== undefined) cookie += `; Max-Age=${options.maxAge}`;\n\t\t\tif (options.httpOnly) cookie += '; HttpOnly';\n\t\t\tif (options.secure) cookie += '; Secure';\n\t\t\tif (options.sameSite) {\n\t\t\t\tcookie += `; SameSite=${options.sameSite.charAt(0).toUpperCase() + options.sameSite.slice(1)}`;\n\t\t\t}\n\t\t}\n\n\t\treturn cookie;\n\t}\n\n\t/**\n\t * Extracts and refines input data from the endpoint context.\n\t *\n\t * @param ctx - The endpoint execution context\n\t * @returns Object containing only the input data (body, query, params)\n\t * @internal\n\t */\n\trefineInput(\n\t\tctx: EndpointContext<TInput, TServices, TLogger, TSession>,\n\t): InferComposableStandardSchema<TInput> {\n\t\tconst input = pick(ctx, [\n\t\t\t'body',\n\t\t\t'query',\n\t\t\t'params',\n\t\t]) as InferComposableStandardSchema<TInput>;\n\n\t\treturn input;\n\t}\n\n\thandler = (\n\t\tctx: EndpointContext<\n\t\t\tTInput,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTAuditAction,\n\t\t\tTDatabase,\n\t\t\tTAuditStorage\n\t\t>,\n\t\tresponse: ResponseBuilder,\n\t): OutSchema extends StandardSchemaV1\n\t\t?\n\t\t\t\t| InferStandardSchema<OutSchema>\n\t\t\t\t| ResponseWithMetadata<InferStandardSchema<OutSchema>>\n\t\t\t\t| Promise<InferStandardSchema<OutSchema>>\n\t\t\t\t| Promise<ResponseWithMetadata<InferStandardSchema<OutSchema>>>\n\t\t:\n\t\t\t\t| any\n\t\t\t\t| ResponseWithMetadata<any>\n\t\t\t\t| Promise<any>\n\t\t\t\t| Promise<ResponseWithMetadata<any>> => {\n\t\t// Apply default headers to response builder\n\t\tfor (const [key, value] of Object.entries(this.defaultHeaders)) {\n\t\t\tresponse.header(key, value);\n\t\t}\n\n\t\t// Build context object, conditionally including auditor and db\n\t\tconst handlerCtx = {\n\t\t\t...this.refineInput(ctx),\n\t\t\tservices: ctx.services,\n\t\t\tlogger: ctx.logger,\n\t\t\theader: ctx.header,\n\t\t\tcookie: ctx.cookie,\n\t\t\tsession: ctx.session,\n\t\t\t// These are conditionally present based on configuration\n\t\t\t...('auditor' in ctx && { auditor: ctx.auditor }),\n\t\t\t...('db' in ctx && { db: ctx.db }),\n\t\t} as EndpointContext<\n\t\t\tTInput,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTSession,\n\t\t\tTAuditAction,\n\t\t\tTDatabase,\n\t\t\tTAuditStorage\n\t\t>;\n\n\t\treturn this.endpointFn(handlerCtx, response);\n\t};\n\n\t/**\n\t * Type guard to check if an object is an Endpoint instance.\n\t *\n\t * @param obj - The object to check\n\t * @returns True if the object is an Endpoint\n\t */\n\tstatic isEndpoint(obj: any): obj is Endpoint<any, any, any, any> {\n\t\treturn Boolean(\n\t\t\tobj &&\n\t\t\t\t(obj as Function).__IS_FUNCTION__ === true &&\n\t\t\t\tobj.type === ConstructType.Endpoint,\n\t\t);\n\t}\n\n\t/**\n\t * Helper to check if response has metadata\n\t */\n\tstatic hasMetadata<T>(\n\t\tresponse: T | ResponseWithMetadata<T>,\n\t): response is ResponseWithMetadata<T> {\n\t\treturn (\n\t\t\tresponse !== null &&\n\t\t\ttypeof response === 'object' &&\n\t\t\t'data' in response &&\n\t\t\t'metadata' in response\n\t\t);\n\t}\n\n\t/**\n\t * Converts Express-style route params to OpenAPI format.\n\t * @returns Route with ':param' converted to '{param}'\n\t * @internal\n\t */\n\tget _path() {\n\t\treturn this.route.replace(/:(\\w+)/g, '{$1}') as ConvertRouteParams<TRoute>;\n\t}\n\n\t/**\n\t * Generates OpenAPI 3.1 schema for this endpoint.\n\t *\n\t * @returns OpenAPI route definition with operation details\n\t */\n\tasync toOpenApi3Route(\n\t\tcomponentCollector?: ComponentCollector,\n\t): Promise<EndpointOpenApiSchema<TRoute, TMethod>> {\n\t\tconst operation: OpenAPIV3_1.OperationObject = {\n\t\t\toperationId: this.operationId,\n\t\t\t...(this.description && { description: this.description }),\n\t\t\t...(this.tags && this.tags.length > 0 && { tags: this.tags }),\n\t\t\tresponses: {\n\t\t\t\t'200': {\n\t\t\t\t\tdescription: 'Successful response',\n\t\t\t\t} as OpenAPIV3_1.ResponseObject,\n\t\t\t},\n\t\t};\n\n\t\t// Add response schema\n\t\tif (this.outputSchema) {\n\t\t\tconst responseSchema = await convertSchemaWithComponents(\n\t\t\t\tthis.outputSchema,\n\t\t\t\tcomponentCollector,\n\t\t\t);\n\t\t\tif (responseSchema) {\n\t\t\t\tset(\n\t\t\t\t\toperation,\n\t\t\t\t\t['responses', '200', 'content', 'application/json', 'schema'],\n\t\t\t\t\tresponseSchema,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// Separate path and query parameters\n\t\tconst pathParameters: OpenAPIV3_1.ParameterObject[] = [];\n\t\tconst queryParameters: OpenAPIV3_1.ParameterObject[] = [];\n\n\t\t// Since the EndpointBuilder doesn't have body/search/params methods yet,\n\t\t// and the input is a composite type, we need to check if input exists\n\t\t// and has the expected shape\n\t\tif (this.input && typeof this.input === 'object') {\n\t\t\t// Add request body for methods that support it\n\t\t\tif (\n\t\t\t\t['POST', 'PUT', 'PATCH'].includes(this.method) &&\n\t\t\t\t'body' in this.input &&\n\t\t\t\tthis.input.body\n\t\t\t) {\n\t\t\t\tconst bodySchema = await convertSchemaWithComponents(\n\t\t\t\t\tthis.input.body as StandardSchemaV1,\n\t\t\t\t\tcomponentCollector,\n\t\t\t\t);\n\t\t\t\tif (bodySchema) {\n\t\t\t\t\tset(operation, ['requestBody'], {\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tcontent: {\n\t\t\t\t\t\t\t'application/json': {\n\t\t\t\t\t\t\t\tschema: bodySchema,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Add path parameters\n\t\t\tif ('params' in this.input && this.input.params) {\n\t\t\t\tconst paramsSchema = await convertStandardSchemaToJsonSchema(\n\t\t\t\t\tthis.input.params as StandardSchemaV1,\n\t\t\t\t);\n\t\t\t\tif (\n\t\t\t\t\tparamsSchema &&\n\t\t\t\t\tparamsSchema.type === 'object' &&\n\t\t\t\t\tparamsSchema.properties\n\t\t\t\t) {\n\t\t\t\t\tfor (const [name, schema] of Object.entries(\n\t\t\t\t\t\tparamsSchema.properties,\n\t\t\t\t\t)) {\n\t\t\t\t\t\tpathParameters.push({\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tin: 'path',\n\t\t\t\t\t\t\trequired: paramsSchema.required?.includes(name) ?? true,\n\t\t\t\t\t\t\tschema: schema as any,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Add query parameters\n\t\t\tif ('query' in this.input && this.input.query) {\n\t\t\t\tconst querySchema = await convertStandardSchemaToJsonSchema(\n\t\t\t\t\tthis.input.query,\n\t\t\t\t);\n\t\t\t\tif (\n\t\t\t\t\tquerySchema &&\n\t\t\t\t\tquerySchema.type === 'object' &&\n\t\t\t\t\tquerySchema.properties\n\t\t\t\t) {\n\t\t\t\t\tfor (const [name, schema] of Object.entries(querySchema.properties)) {\n\t\t\t\t\t\tqueryParameters.push({\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tin: 'query',\n\t\t\t\t\t\t\trequired: querySchema.required?.includes(name) ?? false,\n\t\t\t\t\t\t\tschema: schema as any,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Only add query parameters to the operation\n\t\tif (queryParameters.length > 0) {\n\t\t\toperation.parameters = queryParameters;\n\t\t}\n\n\t\t// Build the route object with path parameters at the route level\n\t\tconst routeObject: any = {};\n\t\tif (pathParameters.length > 0) {\n\t\t\trouteObject.parameters = pathParameters;\n\t\t}\n\t\trouteObject[this.method.toLowerCase()] = operation;\n\n\t\treturn {\n\t\t\t[this._path]: routeObject,\n\t\t} as EndpointOpenApiSchema<TRoute, TMethod>;\n\t}\n\n\t/**\n\t * Creates a new Endpoint instance.\n\t *\n\t * @param options - Configuration options for the endpoint\n\t * @param options.fn - The handler function to execute\n\t * @param options.method - HTTP method\n\t * @param options.route - Route path with parameter placeholders\n\t * @param options.description - Optional description for documentation\n\t * @param options.input - Input schemas for validation\n\t * @param options.logger - Logger instance\n\t * @param options.output - Output schema for response validation\n\t * @param options.services - Service dependencies\n\t * @param options.timeout - Execution timeout in milliseconds\n\t * @param options.getSession - Session extraction function\n\t * @param options.authorize - Authorization check function\n\t * @param options.status - Success HTTP status code (default: 200)\n\t * @param options.authorizer - Optional authorizer configuration\n\t */\n\tconstructor({\n\t\tfn,\n\t\tmethod,\n\t\troute,\n\t\tdescription,\n\t\ttags,\n\t\tinput,\n\t\tlogger,\n\t\toutput: outputSchema,\n\t\tservices,\n\t\ttimeout,\n\t\tmemorySize,\n\t\tgetSession,\n\t\tauthorize,\n\t\trateLimit,\n\t\tstatus = SuccessStatus.OK,\n\t\tpublisherService,\n\t\tevents,\n\t\tauthorizer,\n\t\tauditorStorageService,\n\t\tactorExtractor,\n\t\taudits,\n\t\tdatabaseService,\n\t\trlsConfig,\n\t\trlsBypass,\n\t}: EndpointOptions<\n\t\tTRoute,\n\t\tTMethod,\n\t\tTInput,\n\t\tOutSchema,\n\t\tTServices,\n\t\tTLogger,\n\t\tTSession,\n\t\tOutSchema,\n\t\tTEventPublisher,\n\t\tTEventPublisherServiceName,\n\t\tTAuditStorage,\n\t\tTAuditStorageServiceName,\n\t\tTAuditAction,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t>) {\n\t\tsuper(\n\t\t\tfn as unknown as FunctionHandler<TInput, TServices, TLogger, OutSchema>,\n\t\t\ttimeout,\n\t\t\tConstructType.Endpoint,\n\t\t\tinput,\n\t\t\toutputSchema,\n\t\t\tservices,\n\t\t\tlogger,\n\t\t\tpublisherService,\n\t\t\tevents,\n\t\t\tmemorySize,\n\t\t\tauditorStorageService,\n\t\t);\n\n\t\tthis.route = route;\n\t\tthis.method = method;\n\t\tthis.description = description;\n\t\tthis.tags = tags;\n\t\tthis.status = status;\n\t\tthis.endpointFn = fn;\n\n\t\tif (getSession) {\n\t\t\tthis.getSession = getSession;\n\t\t}\n\n\t\tif (authorize) {\n\t\t\tthis.authorize = authorize;\n\t\t}\n\n\t\tif (rateLimit) {\n\t\t\tthis.rateLimit = rateLimit;\n\t\t}\n\n\t\tif (authorizer) {\n\t\t\tthis.authorizer = authorizer;\n\t\t}\n\n\t\tif (actorExtractor) {\n\t\t\tthis.actorExtractor = actorExtractor;\n\t\t}\n\n\t\tif (audits) {\n\t\t\tthis.audits = audits;\n\t\t}\n\n\t\tif (databaseService) {\n\t\t\tthis.databaseService = databaseService;\n\t\t}\n\n\t\tif (rlsConfig) {\n\t\t\tthis.rlsConfig = rlsConfig;\n\t\t}\n\n\t\tif (rlsBypass) {\n\t\t\tthis.rlsBypass = rlsBypass;\n\t\t}\n\t}\n}\n\n/**\n * Defines the input schema structure for an endpoint.\n *\n * @template TBody - Schema for request body validation\n * @template TSearch - Schema for query string validation\n * @template TParams - Schema for URL path parameters validation\n *\n * @example\n * ```typescript\n * type UserInput = EndpointInput<\n * typeof createUserBodySchema,\n * typeof userQuerySchema,\n * typeof userParamsSchema\n * >;\n * ```\n */\nexport type EndpointInput<\n\tTBody extends StandardSchemaV1 | undefined = undefined,\n\tTSearch extends StandardSchemaV1 | undefined = undefined,\n\tTParams extends StandardSchemaV1 | undefined = undefined,\n> = RemoveUndefined<{\n\tbody: TBody;\n\tsearch: TSearch;\n\tparams: TParams;\n}>;\n\n/**\n * Configuration options for creating an Endpoint instance.\n *\n * @template TRoute - The route path string\n * @template TMethod - The HTTP method\n * @template TInput - Input schema definitions\n * @template TOutput - Output schema definition\n * @template TServices - Service dependencies array\n * @template TLogger - Logger type\n * @template TSession - Session data type\n */\nexport interface EndpointOptions<\n\tTRoute extends string,\n\tTMethod extends HttpMethod,\n\tTInput extends EndpointSchemas = {},\n\tTOutput extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTEventPublisher extends EventPublisher<any> | undefined = undefined,\n\tTEventPublisherServiceName extends string = string,\n\tTAuditStorage extends AuditStorage | undefined = undefined,\n\tTAuditStorageServiceName extends string = string,\n\tTAuditAction extends AuditableAction<string, unknown> = AuditableAction<\n\t\tstring,\n\t\tunknown\n\t>,\n\tTDatabase = undefined,\n\tTDatabaseServiceName extends string = string,\n> {\n\t/** The route path with parameter placeholders */\n\troute: TRoute;\n\t/** The HTTP method for this endpoint */\n\tmethod: TMethod;\n\t/** The handler function that implements the endpoint logic */\n\tfn: EndpointHandler<\n\t\tTInput,\n\t\tTServices,\n\t\tTLogger,\n\t\tTOutput,\n\t\tTSession,\n\t\tTDatabase,\n\t\tTAuditStorage,\n\t\tTAuditAction\n\t>;\n\t/** Optional authorization check function */\n\tauthorize:\n\t\t| AuthorizeFn<TServices, TLogger, TSession, TInput, TDatabase>\n\t\t| undefined;\n\t/** Optional description for documentation */\n\tdescription: string | undefined;\n\t/** Optional tags for OpenAPI documentation */\n\ttags?: string[];\n\t/** Optional execution timeout in milliseconds */\n\ttimeout: number | undefined;\n\t/** Optional memory size in MB for serverless deployments */\n\tmemorySize: number | undefined;\n\t/** Input validation schemas */\n\tinput: TInput | undefined;\n\t/** Output validation schema */\n\toutput: TOutput | undefined;\n\t/** Service dependencies to inject */\n\tservices: TServices;\n\t/** Logger instance */\n\tlogger: TLogger;\n\t/** Optional session extraction function */\n\tgetSession: SessionFn<TServices, TLogger, TSession, TDatabase> | undefined;\n\t/** Optional rate limiting configuration */\n\trateLimit?: RateLimitConfig;\n\t/** Success HTTP status code */\n\tstatus: SuccessStatus | undefined;\n\t/**\n\t * Event publisher service for publishing events from this endpoint\n\t */\n\tpublisherService?: Service<TEventPublisherServiceName, TEventPublisher>;\n\n\tevents?: MappedEvent<TEventPublisher, OutSchema>[];\n\t/** Optional authorizer configuration */\n\tauthorizer?: Authorizer;\n\t/**\n\t * Auditor storage service for persisting audit records from this endpoint\n\t */\n\tauditorStorageService?: Service<TAuditStorageServiceName, TAuditStorage>;\n\t/** Optional actor extractor function for audit records */\n\tactorExtractor?: ActorExtractor<TServices, TSession, TLogger>;\n\t/** Declarative audit definitions */\n\taudits?: MappedAudit<TAuditAction, OutSchema>[];\n\t/** Database service for this endpoint */\n\tdatabaseService?: Service<TDatabaseServiceName, TDatabase>;\n\t/** RLS configuration for this endpoint */\n\trlsConfig?: RlsConfig<TServices, TSession, TLogger>;\n\t/** Whether to bypass RLS for this endpoint */\n\trlsBypass?: boolean;\n}\n\n/**\n * Defines the possible input schema types for an endpoint.\n * Each property represents a different part of the HTTP request.\n */\nexport type EndpointSchemas = Partial<{\n\t/** Schema for URL path parameters (e.g., /users/:id) */\n\tparams: StandardSchemaV1;\n\t/** Schema for query string parameters */\n\tquery: StandardSchemaV1;\n\t/** Schema for request body (POST, PUT, PATCH) */\n\tbody: StandardSchemaV1;\n}>;\n\nexport type AuthorizeContext<\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n\tTInput extends EndpointSchemas | undefined = undefined,\n\tTDatabase = undefined,\n> = {\n\tservices: ServiceRecord<TServices>;\n\tlogger: TLogger;\n\theader: HeaderFn;\n\tcookie: CookieFn;\n\tsession: TSession;\n} & InferComposableStandardSchema<TInput> &\n\tSessionDatabaseContext<TDatabase>;\n/**\n * Function type for endpoint authorization checks.\n *\n * @template TServices - Available service dependencies\n * @template TLogger - Logger type\n * @template TSession - Session data type\n *\n * @param ctx - Context containing services, logger, headers, and session\n * @returns Boolean indicating if the request is authorized\n *\n * @example\n * ```typescript\n * const authorize: AuthorizeFn = ({ session }) => {\n * return session.userId !== undefined;\n * };\n * ```\n */\nexport type AuthorizeFn<\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n\tTInput extends EndpointSchemas | undefined = undefined,\n\tTDatabase = undefined,\n> = (\n\tctx: AuthorizeContext<TServices, TLogger, TSession, TInput, TDatabase>,\n) => Promise<boolean> | boolean;\n\n/**\n * Base session context without database\n */\ntype BaseSessionContext<\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n> = {\n\tservices: ServiceRecord<TServices>;\n\tlogger: TLogger;\n\theader: HeaderFn;\n\tcookie: CookieFn;\n};\n\n/**\n * Conditional database context for session - only present when database service is configured\n */\ntype SessionDatabaseContext<TDatabase = undefined> = TDatabase extends undefined\n\t? {}\n\t: {\n\t\t\t/**\n\t\t\t * Database instance for session extraction.\n\t\t\t * Available when a database service is configured via `.database()`.\n\t\t\t * Useful for looking up user data from the database based on auth tokens.\n\t\t\t */\n\t\t\tdb: TDatabase;\n\t\t};\n\nexport type SessionContext<\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTDatabase = undefined,\n> = BaseSessionContext<TServices, TLogger> & SessionDatabaseContext<TDatabase>;\n/**\n * Function type for extracting session data from a request.\n *\n * @template TServices - Available service dependencies\n * @template TLogger - Logger type\n * @template TSession - Session data type to extract\n * @template TDatabase - Database type (when database service is configured)\n *\n * @param ctx - Context containing services, logger, headers, and optionally database\n * @returns The extracted session data\n *\n * @example\n * ```typescript\n * // Without database\n * const getSession: SessionFn<Services, Logger, UserSession> = async ({ header, services }) => {\n * const token = header('authorization');\n * return await services.auth.verifyToken(token);\n * };\n *\n * // With database\n * const getSession: SessionFn<Services, Logger, UserSession, Database> = async ({ header, db }) => {\n * const token = header('authorization');\n * const user = await db.selectFrom('users').where('token', '=', token).executeTakeFirst();\n * return { userId: user?.id };\n * };\n * ```\n */\nexport type SessionFn<\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n\tTDatabase = undefined,\n> = (\n\tctx: SessionContext<TServices, TLogger, TDatabase>,\n) => Promise<TSession> | TSession;\n\n/**\n * Utility type that converts Express-style route parameters to OpenAPI format.\n * Transforms ':param' syntax to '{param}' syntax.\n *\n * @template T - The route string to convert\n *\n * @example\n * ```typescript\n * type Route1 = ConvertRouteParams<'/users/:id'>; // '/users/{id}'\n * type Route2 = ConvertRouteParams<'/users/:userId/posts/:postId'>; // '/users/{userId}/posts/{postId}'\n * ```\n */\nexport type ConvertRouteParams<T extends string> =\n\tT extends `${infer Start}:${infer Param}/${infer Rest}`\n\t\t? `${Start}{${Param}}/${ConvertRouteParams<Rest>}`\n\t\t: T extends `${infer Start}:${infer Param}`\n\t\t\t? `${Start}{${Param}}`\n\t\t\t: T;\n\n/**\n * Type representing the OpenAPI schema structure for an endpoint.\n *\n * @template TRoute - The route path\n * @template TMethod - The HTTP method\n *\n * @example\n * ```typescript\n * type Schema = EndpointOpenApiSchema<'/users/:id', 'GET'>;\n * // Results in: { '/users/{id}': { get: OperationObject, parameters?: ParameterObject[] } }\n * ```\n */\nexport type EndpointOpenApiSchema<\n\tTRoute extends string,\n\tTMethod extends HttpMethod,\n> = {\n\t[key in ConvertRouteParams<TRoute>]: {\n\t\t[key in LowerHttpMethod<TMethod>]: OpenAPIV3_1.OperationObject<{}>;\n\t} & {\n\t\tparameters?: OpenAPIV3_1.ParameterObject[];\n\t};\n};\n\nexport type SingleHeaderFn = (key: string) => string | undefined;\nexport type MultiHeaderFn = () => EndpointHeaders;\n/**\n * Type representing HTTP headers as a Map.\n */\nexport type EndpointHeaders = Map<string, string>;\n\n/**\n * Function type for retrieving HTTP header values.\n * Supports two calling patterns:\n * - `header(key)` - Get a single header value (case-insensitive)\n * - `header()` - Get all headers as a plain object\n *\n * @example\n * ```typescript\n * // Get single header\n * const contentType = header('content-type');\n *\n * // Get all headers\n * const allHeaders = header();\n * // { 'content-type': 'application/json', 'host': 'example.com', ... }\n * ```\n */\nexport interface HeaderFn {\n\t(): Record<string, string>;\n\t(key: string): string | undefined;\n}\n\n/**\n * Function type for retrieving cookie values.\n * Supports two calling patterns:\n * - `cookie(name)` - Get a single cookie value\n * - `cookie()` - Get all cookies as a plain object\n *\n * @example\n * ```typescript\n * // Get single cookie\n * const sessionId = cookie('session');\n *\n * // Get all cookies\n * const allCookies = cookie();\n * // { session: 'abc123', theme: 'dark', ... }\n * ```\n */\nexport interface CookieFn {\n\t(): Record<string, string>;\n\t(name: string): string | undefined;\n}\n\n/**\n * Cookie options matching standard Set-Cookie attributes\n */\nexport interface CookieOptions {\n\tdomain?: string;\n\tpath?: string;\n\texpires?: Date;\n\tmaxAge?: number;\n\thttpOnly?: boolean;\n\tsecure?: boolean;\n\tsameSite?: 'strict' | 'lax' | 'none';\n}\n\n/**\n * Response metadata that handlers can set\n */\nexport interface ResponseMetadata {\n\theaders?: Record<string, string>;\n\tcookies?: Map<string, { value: string; options?: CookieOptions }>;\n\tstatus?: SuccessStatus;\n}\n\n/**\n * Return type for handlers that want to set response metadata\n */\nexport interface ResponseWithMetadata<T> {\n\tdata: T;\n\tmetadata: ResponseMetadata;\n}\n\n/**\n * Response builder for fluent API in handlers\n */\nexport class ResponseBuilder {\n\tprivate metadata: ResponseMetadata = {\n\t\theaders: {},\n\t\tcookies: new Map(),\n\t};\n\n\theader(key: string, value: string): this {\n\t\tthis.metadata.headers![key] = value;\n\t\treturn this;\n\t}\n\n\tcookie(name: string, value: string, options?: CookieOptions): this {\n\t\tthis.metadata.cookies?.set(name, { value, options });\n\t\treturn this;\n\t}\n\n\tdeleteCookie(\n\t\tname: string,\n\t\toptions?: Pick<CookieOptions, 'domain' | 'path'>,\n\t): this {\n\t\tthis.metadata.cookies?.set(name, {\n\t\t\tvalue: '',\n\t\t\toptions: { ...options, maxAge: 0, expires: new Date(0) },\n\t\t});\n\t\treturn this;\n\t}\n\n\tstatus(code: SuccessStatus): this {\n\t\tthis.metadata.status = code;\n\t\treturn this;\n\t}\n\n\tsend<T>(data: T): ResponseWithMetadata<T> {\n\t\treturn { data, metadata: this.metadata };\n\t}\n\n\tgetMetadata(): ResponseMetadata {\n\t\treturn this.metadata;\n\t}\n}\n\n/**\n * Base context properties that are always available\n */\ntype BaseEndpointContext<\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n> = {\n\t/** Injected service instances */\n\tservices: ServiceRecord<TServices>;\n\t/** Logger instance for this request */\n\tlogger: TLogger;\n\t/** Function to retrieve request headers */\n\theader: HeaderFn;\n\t/** Function to retrieve request cookies */\n\tcookie: CookieFn;\n\t/** Session data extracted by getSession */\n\tsession: TSession;\n};\n\n/**\n * Conditional auditor context - only present when audit storage is configured\n */\ntype AuditorContext<\n\tTAuditAction extends AuditableAction<string, unknown> = AuditableAction<\n\t\tstring,\n\t\tunknown\n\t>,\n\tTAuditStorage = undefined,\n> = TAuditStorage extends undefined\n\t? {}\n\t: {\n\t\t\t/**\n\t\t\t * Auditor instance for recording audit events.\n\t\t\t * Only present when audit storage is configured on the endpoint.\n\t\t\t * When a transactional database is used for audit storage,\n\t\t\t * the auditor is pre-configured with the transaction context.\n\t\t\t */\n\t\t\tauditor: Auditor<TAuditAction>;\n\t\t};\n\n/**\n * Conditional database context - only present when database service is configured\n */\ntype DatabaseContext<TDatabase = undefined> = TDatabase extends undefined\n\t? {}\n\t: {\n\t\t\t/**\n\t\t\t * Database instance for this request.\n\t\t\t * When audit storage is configured and uses the same database,\n\t\t\t * this will be the transaction for ACID compliance.\n\t\t\t * Otherwise, it's the raw database connection.\n\t\t\t */\n\t\t\tdb: TDatabase;\n\t\t};\n\n/**\n * The execution context provided to endpoint handlers.\n * Contains all parsed input data, services, logger, headers, cookies, and session.\n *\n * @template Input - The input schemas (body, query, params)\n * @template TServices - Available service dependencies\n * @template TLogger - Logger type\n * @template TSession - Session data type\n * @template TAuditAction - Audit action types (when auditor is configured)\n * @template TDatabase - Database type (when database service is configured)\n * @template TAuditStorage - Audit storage type (determines if auditor is present)\n */\nexport type EndpointContext<\n\tInput extends EndpointSchemas | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTSession = unknown,\n\tTAuditAction extends AuditableAction<string, unknown> = AuditableAction<\n\t\tstring,\n\t\tunknown\n\t>,\n\tTDatabase = undefined,\n\tTAuditStorage = undefined,\n> = BaseEndpointContext<TServices, TLogger, TSession> &\n\tInferComposableStandardSchema<Input> &\n\tAuditorContext<TAuditAction, TAuditStorage> &\n\tDatabaseContext<TDatabase>;\n\n/**\n * Handler function type for endpoint implementations.\n *\n * @template TInput - Input schemas for validation\n * @template TServices - Available service dependencies\n * @template TLogger - Logger type\n * @template OutSchema - Output schema for response validation\n * @template TSession - Session data type\n *\n * @param ctx - The endpoint execution context\n * @param response - Response builder for setting cookies, headers, and status\n * @returns The response data (validated if OutSchema is provided) or ResponseWithMetadata\n *\n * @example\n * ```typescript\n * // Simple response\n * const handler: EndpointHandler<Input, [UserService], Logger, UserSchema> =\n * async ({ params, services }) => {\n * return await services.users.findById(params.id);\n * };\n *\n * // With response builder\n * const handler: EndpointHandler<Input, [UserService], Logger, UserSchema> =\n * async ({ params, services }, response) => {\n * const user = await services.users.findById(params.id);\n * return response.header('X-User-Id', user.id).send(user);\n * };\n * ```\n */\nexport type EndpointHandler<\n\tTInput extends EndpointSchemas | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTSession = unknown,\n\tTDatabase = undefined,\n\tTAuditStorage = undefined,\n\tTAuditAction extends AuditableAction<string, unknown> = AuditableAction<\n\t\tstring,\n\t\tunknown\n\t>,\n> = (\n\tctx: EndpointContext<\n\t\tTInput,\n\t\tTServices,\n\t\tTLogger,\n\t\tTSession,\n\t\tTAuditAction,\n\t\tTDatabase,\n\t\tTAuditStorage\n\t>,\n\tresponse: ResponseBuilder,\n) => OutSchema extends StandardSchemaV1\n\t?\n\t\t\t| InferStandardSchema<OutSchema>\n\t\t\t| ResponseWithMetadata<InferStandardSchema<OutSchema>>\n\t\t\t| Promise<InferStandardSchema<OutSchema>>\n\t\t\t| Promise<ResponseWithMetadata<InferStandardSchema<OutSchema>>>\n\t:\n\t\t\t| unknown\n\t\t\t| ResponseWithMetadata<unknown>\n\t\t\t| Promise<unknown>\n\t\t\t| Promise<ResponseWithMetadata<unknown>>;\n\n/**\n * HTTP success status codes that can be returned by endpoints.\n */\nexport enum SuccessStatus {\n\t/** Standard response for successful HTTP requests */\n\tOK = 200,\n\t/** Request has been fulfilled and resulted in a new resource being created */\n\tCreated = 201,\n\t/** Request has been accepted for processing, but processing is not complete */\n\tAccepted = 202,\n\t/** Server successfully processed the request but is not returning any content */\n\tNoContent = 204,\n\t/** Server successfully processed the request and is not returning any content, client should reset the document view */\n\tResetContent = 205,\n\t/** Server is delivering only part of the resource due to a range header */\n\tPartialContent = 206,\n}\n\nexport type EndpointOutput<T> =\n\tT extends Endpoint<any, any, any, infer OutSchema, any, any, any, any>\n\t\t? InferStandardSchema<OutSchema>\n\t\t: never;\n\nexport type EndpointEvent<T> =\n\tT extends Endpoint<any, any, any, any, any, any, any, infer TEventPublisher>\n\t\t? ExtractPublisherMessage<TEventPublisher>\n\t\t: never;\n","import type { AuditStorage } from '@geekmidas/audit';\nimport type { EventPublisher, MappedEvent } from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport type { InferStandardSchema } from '@geekmidas/schema';\nimport type { Service, ServiceDiscovery } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { Construct } from './Construct';\n\nexport async function publishEvents<\n\tT extends EventPublisher<any> | undefined,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServiceName extends string = string,\n\tTPublisherService extends Service<TServiceName, T> | undefined = undefined,\n>(\n\tlogger: Logger,\n\tserviceDiscovery: ServiceDiscovery<any>,\n\tev: MappedEvent<T, OutSchema>[] = [],\n\tresponse: InferStandardSchema<OutSchema>,\n\tpublisherService: TPublisherService,\n) {\n\ttry {\n\t\tif (!ev?.length) {\n\t\t\tlogger.debug('No events to publish');\n\t\t\treturn;\n\t\t}\n\t\tif (!publisherService) {\n\t\t\tlogger.warn('No publisher service available');\n\t\t\treturn;\n\t\t}\n\n\t\tconst services = await serviceDiscovery.register([publisherService]);\n\n\t\tconst publisher = services[\n\t\t\tpublisherService.serviceName\n\t\t] as EventPublisher<any>;\n\n\t\tconst events: MappedEvent<T, OutSchema>[] = [];\n\n\t\tfor (const { when, payload, type, ...e } of ev) {\n\t\t\tlogger.debug({ event: type }, 'Processing event');\n\t\t\tconst resolvedPayload = await payload(response);\n\t\t\tconst event = {\n\t\t\t\t...e,\n\t\t\t\ttype,\n\t\t\t\tpayload: resolvedPayload,\n\t\t\t};\n\n\t\t\tif (!when || when(response as any)) {\n\t\t\t\tevents.push(event);\n\t\t\t}\n\t\t}\n\n\t\tif (events.length) {\n\t\t\tlogger.debug({ eventCount: ev.length }, 'Publishing events');\n\n\t\t\tawait publisher.publish(events).catch((err) => {\n\t\t\t\tlogger.error(err, 'Failed to publish events');\n\t\t\t});\n\t\t}\n\t} catch (error) {\n\t\tlogger.error(error as any, 'Something went wrong publishing events');\n\t}\n}\n\nexport async function publishConstructEvents<\n\tT extends EventPublisher<any> | undefined,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServiceName extends string = string,\n\tTServices extends Service[] = [],\n\tTAuditStorageServiceName extends string = string,\n\tTAuditStorage extends AuditStorage | undefined = undefined,\n>(\n\tconstruct: Construct<\n\t\tLogger,\n\t\tTServiceName,\n\t\tT,\n\t\tOutSchema,\n\t\tTServices,\n\t\tTAuditStorageServiceName,\n\t\tTAuditStorage\n\t>,\n\tresponse: InferStandardSchema<OutSchema>,\n\tserviceDiscovery: ServiceDiscovery<any>,\n\tlogger: Logger = construct.logger,\n) {\n\treturn publishEvents(\n\t\tlogger,\n\t\tserviceDiscovery,\n\t\tconstruct.events,\n\t\tresponse,\n\t\tconstruct.publisherService,\n\t);\n}\n","/**\n * Lazy header and cookie accessors for different adaptors.\n *\n * Instead of parsing all headers/cookies upfront, these accessors\n * use native adaptor methods for single lookups and only parse\n * everything when `header()` or `cookie()` is called without arguments.\n */\nimport type { Context } from 'hono';\nimport { getCookie } from 'hono/cookie';\nimport type { CookieFn, HeaderFn } from './Endpoint';\n\n/**\n * Create a lazy header accessor for Hono.\n * Uses `c.req.header(name)` for single lookups (native, case-insensitive).\n * Only calls `c.req.header()` to get all headers when needed.\n */\nexport function createHonoHeaders(c: Context): HeaderFn {\n\tlet allHeaders: Record<string, string> | null = null;\n\n\treturn ((key?: string) => {\n\t\tif (key !== undefined) {\n\t\t\t// Single header lookup - use native Hono method (case-insensitive)\n\t\t\treturn c.req.header(key);\n\t\t}\n\t\t// Get all headers - cache the result\n\t\tif (!allHeaders) {\n\t\t\tallHeaders = c.req.header();\n\t\t}\n\t\treturn allHeaders;\n\t}) as HeaderFn;\n}\n\n/**\n * Create a lazy cookie accessor for Hono.\n * Uses `getCookie(c, name)` for single lookups (native).\n * Only parses the cookie header when all cookies are requested.\n */\nexport function createHonoCookies(c: Context): CookieFn {\n\tlet allCookies: Record<string, string> | null = null;\n\n\treturn ((name?: string) => {\n\t\tif (name !== undefined) {\n\t\t\t// Single cookie lookup - use native Hono method\n\t\t\treturn getCookie(c, name);\n\t\t}\n\t\t// Get all cookies - parse and cache\n\t\tif (!allCookies) {\n\t\t\tallCookies = {};\n\t\t\tconst cookieHeader = c.req.header('cookie');\n\t\t\tif (cookieHeader) {\n\t\t\t\tfor (const part of cookieHeader.split(';')) {\n\t\t\t\t\tconst trimmed = part.trim();\n\t\t\t\t\tconst eqIndex = trimmed.indexOf('=');\n\t\t\t\t\tif (eqIndex > 0) {\n\t\t\t\t\t\tconst key = trimmed.slice(0, eqIndex);\n\t\t\t\t\t\tconst value = trimmed.slice(eqIndex + 1);\n\t\t\t\t\t\tallCookies[key] = value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn allCookies;\n\t}) as CookieFn;\n}\n\n/**\n * Create a lazy header accessor for API Gateway events.\n * Handles case-insensitive lookups.\n */\nexport function createApiGatewayHeaders(\n\theaders: Record<string, string | undefined> | null | undefined,\n): HeaderFn {\n\tlet normalizedHeaders: Record<string, string> | null = null;\n\n\tconst normalize = () => {\n\t\tif (!normalizedHeaders) {\n\t\t\tnormalizedHeaders = {};\n\t\t\tif (headers) {\n\t\t\t\tfor (const [k, v] of Object.entries(headers)) {\n\t\t\t\t\tif (v !== undefined) {\n\t\t\t\t\t\tnormalizedHeaders[k.toLowerCase()] = v;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn normalizedHeaders;\n\t};\n\n\treturn ((key?: string) => {\n\t\tif (key !== undefined) {\n\t\t\t// Try direct lookup first (common case: headers already lowercase)\n\t\t\tif (headers) {\n\t\t\t\tconst direct = headers[key] ?? headers[key.toLowerCase()];\n\t\t\t\tif (direct !== undefined) return direct;\n\t\t\t\t// Fall back to normalized lookup\n\t\t\t\treturn normalize()[key.toLowerCase()];\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\t\treturn normalize();\n\t}) as HeaderFn;\n}\n\n/**\n * Create a lazy cookie accessor for API Gateway events.\n * Decodes URL-encoded values to match browser behavior.\n */\nexport function createApiGatewayCookies(\n\tcookies: string[] | undefined,\n\tcookieHeader: string | undefined,\n): CookieFn {\n\tlet parsed: Record<string, string> | null = null;\n\n\tconst parse = () => {\n\t\tif (!parsed) {\n\t\t\tparsed = {};\n\t\t\t// API Gateway v2 provides cookies as array\n\t\t\tif (cookies) {\n\t\t\t\tfor (const cookie of cookies) {\n\t\t\t\t\tconst eqIndex = cookie.indexOf('=');\n\t\t\t\t\tif (eqIndex > 0) {\n\t\t\t\t\t\tconst key = cookie.slice(0, eqIndex);\n\t\t\t\t\t\tconst value = cookie.slice(eqIndex + 1);\n\t\t\t\t\t\tparsed[key] = decodeURIComponent(value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (cookieHeader) {\n\t\t\t\t// Fall back to parsing cookie header\n\t\t\t\tfor (const part of cookieHeader.split(';')) {\n\t\t\t\t\tconst trimmed = part.trim();\n\t\t\t\t\tconst eqIndex = trimmed.indexOf('=');\n\t\t\t\t\tif (eqIndex > 0) {\n\t\t\t\t\t\tconst key = trimmed.slice(0, eqIndex);\n\t\t\t\t\t\tconst value = trimmed.slice(eqIndex + 1);\n\t\t\t\t\t\tparsed[key] = decodeURIComponent(value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn parsed;\n\t};\n\n\treturn ((name?: string) => {\n\t\tif (name !== undefined) {\n\t\t\treturn parse()[name];\n\t\t}\n\t\treturn parse();\n\t}) as CookieFn;\n}\n\n/**\n * Create a lazy header accessor for plain object headers (test adaptor, etc).\n * Headers are already available as an object, just provide lazy access.\n */\nexport function createObjectHeaders(\n\theaders: Record<string, string> | undefined,\n): HeaderFn {\n\tlet normalized: Record<string, string> | null = null;\n\n\treturn ((key?: string) => {\n\t\tif (key !== undefined) {\n\t\t\t// Try direct lookup first (common case)\n\t\t\tif (headers) {\n\t\t\t\tconst direct = headers[key] ?? headers[key.toLowerCase()];\n\t\t\t\tif (direct !== undefined) return direct;\n\t\t\t}\n\t\t\t// Fall back to normalized lookup for case-insensitivity\n\t\t\tif (!normalized && headers) {\n\t\t\t\tnormalized = {};\n\t\t\t\tfor (const [k, v] of Object.entries(headers)) {\n\t\t\t\t\tnormalized[k.toLowerCase()] = v;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn normalized?.[key.toLowerCase()];\n\t\t}\n\t\t// Return all headers\n\t\tif (!normalized && headers) {\n\t\t\tnormalized = {};\n\t\t\tfor (const [k, v] of Object.entries(headers)) {\n\t\t\t\tnormalized[k.toLowerCase()] = v;\n\t\t\t}\n\t\t}\n\t\treturn normalized ?? {};\n\t}) as HeaderFn;\n}\n\n/**\n * Create a lazy cookie accessor from a cookie header string.\n * Decodes URL-encoded values to match browser behavior.\n */\nexport function createCookieHeaderAccessor(\n\tcookieHeader: string | undefined,\n): CookieFn {\n\tlet parsed: Record<string, string> | null = null;\n\n\tconst parse = () => {\n\t\tif (!parsed) {\n\t\t\tparsed = {};\n\t\t\tif (cookieHeader) {\n\t\t\t\tfor (const part of cookieHeader.split(';')) {\n\t\t\t\t\tconst trimmed = part.trim();\n\t\t\t\t\tconst eqIndex = trimmed.indexOf('=');\n\t\t\t\t\tif (eqIndex > 0) {\n\t\t\t\t\t\tconst key = trimmed.slice(0, eqIndex);\n\t\t\t\t\t\tconst value = trimmed.slice(eqIndex + 1);\n\t\t\t\t\t\t// Decode URL-encoded values to match Endpoint.createCookies behavior\n\t\t\t\t\t\tparsed[key] = decodeURIComponent(value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn parsed;\n\t};\n\n\treturn ((name?: string) => {\n\t\tif (name !== undefined) {\n\t\t\treturn parse()[name];\n\t\t}\n\t\treturn parse();\n\t}) as CookieFn;\n}\n\n/**\n * Create a no-op header accessor (for minimal endpoints that don't use headers).\n */\nexport function createNoopHeaders(): HeaderFn {\n\treturn ((key?: string) => {\n\t\tif (key !== undefined) return undefined;\n\t\treturn {};\n\t}) as HeaderFn;\n}\n\n/**\n * Create a no-op cookie accessor (for minimal endpoints that don't use cookies).\n */\nexport function createNoopCookies(): CookieFn {\n\treturn ((name?: string) => {\n\t\tif (name !== undefined) return undefined;\n\t\treturn {};\n\t}) as CookieFn;\n}\n"],"x_google_ignoreList":[0,1],"mappings":";;;;;;;;;;;;;;;;;CAUA,IAAI,kBAAkB;;CAGtB,IAAI,iBAAiB;;CAGrB,IAAIA,aAAW,UACXC,qBAAmB;;CAGvB,IAAIC,YAAU,qBACVC,WAAS,8BACTC,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;AAC1B,MAAI,gBACH,QAAO,OAAO,CAAC;AAEhB,SAAO,OAAO;CACd;AACD;;;;AAKD,SAAgB,oBAA8B;AAC7C,QAAQ,CAACF,QAAiB;AACzB,MAAI,eAAmB;AACvB,SAAO,CAAE;CACT;AACD;;;;AAKD,SAAgB,oBAA8B;AAC7C,QAAQ,CAACE,SAAkB;AAC1B,MAAI,gBAAoB;AACxB,SAAO,CAAE;CACT;AACD"}
@@ -0,0 +1,80 @@
1
+ import { DefaultAuditor } from "@geekmidas/audit";
2
+
3
+ //#region src/endpoints/processAudits.ts
4
+ /**
5
+ * Create audit context for handler execution.
6
+ * Returns the auditor and storage for use in the handler.
7
+ *
8
+ * @param endpoint - The endpoint with audit configuration
9
+ * @param serviceDiscovery - Service discovery for getting audit storage
10
+ * @param logger - Logger for debug/error messages
11
+ * @param ctx - Request context for actor extraction
12
+ * @returns Audit context with auditor and storage, or undefined if not configured
13
+ */
14
+ async function createAuditContext(endpoint, serviceDiscovery, logger, ctx) {
15
+ if (!endpoint.auditorStorageService) return void 0;
16
+ const services = await serviceDiscovery.register([endpoint.auditorStorageService]);
17
+ const storage = services[endpoint.auditorStorageService.serviceName];
18
+ let actor = {
19
+ id: "system",
20
+ type: "system"
21
+ };
22
+ if (endpoint.actorExtractor) try {
23
+ actor = await endpoint.actorExtractor({
24
+ services: ctx.services,
25
+ session: ctx.session,
26
+ header: ctx.header,
27
+ cookie: ctx.cookie,
28
+ logger
29
+ });
30
+ } catch (error) {
31
+ logger.error(error, "Failed to extract actor for audits");
32
+ }
33
+ const auditor = new DefaultAuditor({
34
+ actor,
35
+ storage,
36
+ metadata: {
37
+ endpoint: endpoint.route,
38
+ method: endpoint.method
39
+ }
40
+ });
41
+ return {
42
+ auditor,
43
+ storage
44
+ };
45
+ }
46
+ /**
47
+ * Execute a handler with automatic audit transaction support.
48
+ * If the audit storage provides a withTransaction method, wraps execution
49
+ * in a transaction so audits are atomic with handler's database operations.
50
+ *
51
+ * This is database-agnostic - each storage implementation provides its own
52
+ * transaction handling based on the underlying database (Kysely, Drizzle, etc.).
53
+ *
54
+ * If the db parameter is provided and is already a transaction, the storage
55
+ * will reuse it instead of creating a nested transaction (similar to
56
+ * packages/db/src/kysely.ts#withTransaction).
57
+ *
58
+ * @param auditContext - The audit context from createAuditContext
59
+ * @param handler - The handler function to execute (receives auditor)
60
+ * @param onComplete - Called after handler with response, to process declarative audits
61
+ * @param options - Optional configuration including database connection
62
+ * @returns The handler result
63
+ */
64
+ async function executeWithAuditTransaction(auditContext, handler, onComplete, options) {
65
+ if (!auditContext) return handler(void 0);
66
+ const { auditor, storage } = auditContext;
67
+ if (storage.withTransaction) return storage.withTransaction(auditor, async () => {
68
+ const response$1 = await handler(auditor);
69
+ if (onComplete) await onComplete(response$1, auditor);
70
+ return response$1;
71
+ }, options?.db);
72
+ const response = await handler(auditor);
73
+ if (onComplete) await onComplete(response, auditor);
74
+ await auditor.flush();
75
+ return response;
76
+ }
77
+
78
+ //#endregion
79
+ export { createAuditContext, executeWithAuditTransaction };
80
+ //# sourceMappingURL=processAudits-B0PbJf1Z.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processAudits-B0PbJf1Z.mjs","names":["endpoint: Endpoint<\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tTServices,\n\t\tTLogger,\n\t\tTSession,\n\t\tany,\n\t\tany,\n\t\tTAuditStorage,\n\t\tTAuditStorageServiceName,\n\t\tTAuditAction,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t>","serviceDiscovery: ServiceDiscovery<any>","logger: TLogger","ctx: {\n\t\tsession: TSession;\n\t\theader: HeaderFn;\n\t\tcookie: CookieFn;\n\t\tservices: Record<string, unknown>;\n\t}","actor: AuditActor","auditContext: AuditExecutionContext<TAuditAction> | undefined","handler: (auditor?: Auditor<TAuditAction>) => Promise<T>","onComplete?: (response: T, auditor: Auditor<TAuditAction>) => Promise<void>","options?: ExecuteWithAuditTransactionOptions","response"],"sources":["../src/endpoints/processAudits.ts"],"sourcesContent":["import type {\n\tAuditActor,\n\tAuditableAction,\n\tAuditor,\n\tAuditStorage,\n} from '@geekmidas/audit';\nimport { DefaultAuditor } from '@geekmidas/audit';\nimport type { Logger } from '@geekmidas/logger';\nimport type { InferStandardSchema } from '@geekmidas/schema';\nimport type { Service, ServiceDiscovery } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { ActorExtractor, MappedAudit } from './audit';\nimport type { CookieFn, Endpoint, HeaderFn } from './Endpoint';\n\n/**\n * Process declarative audit definitions after successful endpoint execution.\n * Similar to publishConstructEvents for events.\n *\n * @param endpoint - The endpoint with audit configuration\n * @param response - The handler response to generate audit payloads from\n * @param serviceDiscovery - Service discovery for registering audit storage\n * @param logger - Logger for debug/error messages\n * @param ctx - Request context (session, headers, cookies, services)\n * @param existingAuditor - Optional existing auditor instance (e.g., from handler context).\n * If provided, uses this auditor (with its stored transaction).\n * If not provided, creates a new auditor.\n */\nexport async function processEndpointAudits<\n\tTServices extends Service[] = [],\n\tTSession = unknown,\n\tTLogger extends Logger = Logger,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTAuditStorage extends AuditStorage | undefined = undefined,\n\tTAuditStorageServiceName extends string = string,\n\tTAuditAction extends AuditableAction<string, unknown> = AuditableAction<\n\t\tstring,\n\t\tunknown\n\t>,\n>(\n\tendpoint: Endpoint<\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tOutSchema,\n\t\tTServices,\n\t\tTLogger,\n\t\tTSession,\n\t\tany,\n\t\tany,\n\t\tTAuditStorage,\n\t\tTAuditStorageServiceName,\n\t\tTAuditAction\n\t>,\n\tresponse: InferStandardSchema<OutSchema>,\n\tserviceDiscovery: ServiceDiscovery<any>,\n\tlogger: TLogger,\n\tctx: {\n\t\tsession: TSession;\n\t\theader: HeaderFn;\n\t\tcookie: CookieFn;\n\t\tservices: Record<string, unknown>;\n\t},\n\texistingAuditor?: Auditor<TAuditAction>,\n): Promise<void> {\n\ttry {\n\t\tconst audits = endpoint.audits as MappedAudit<TAuditAction, OutSchema>[];\n\n\t\t// If we have an existing auditor (from handler context), we need to flush\n\t\t// any manual audits it collected, even if there are no declarative audits\n\t\tconst hasExistingRecords =\n\t\t\texistingAuditor && existingAuditor.getRecords().length > 0;\n\n\t\t// Skip if no declarative audits and no existing records to flush\n\t\tif (!audits?.length && !hasExistingRecords) {\n\t\t\tlogger.debug('No audits to process');\n\t\t\treturn;\n\t\t}\n\n\t\t// If no auditor storage service and we have things to process, warn\n\t\tif (!endpoint.auditorStorageService) {\n\t\t\tif (hasExistingRecords || audits?.length) {\n\t\t\t\tlogger.warn('No auditor storage service available');\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// Get or create auditor\n\t\tlet auditor: Auditor<TAuditAction>;\n\n\t\tif (existingAuditor) {\n\t\t\t// Use existing auditor (preserves stored transaction and manual audits)\n\t\t\tauditor = existingAuditor;\n\t\t\tlogger.debug('Using existing auditor from handler context');\n\t\t} else {\n\t\t\t// Create new auditor (backward compatibility)\n\t\t\tconst services = await serviceDiscovery.register([\n\t\t\t\tendpoint.auditorStorageService,\n\t\t\t]);\n\t\t\tconst storage = services[\n\t\t\t\tendpoint.auditorStorageService.serviceName\n\t\t\t] as AuditStorage;\n\n\t\t\t// Extract actor if configured\n\t\t\tlet actor: AuditActor = { id: 'system', type: 'system' };\n\t\t\tif (endpoint.actorExtractor) {\n\t\t\t\ttry {\n\t\t\t\t\tactor = await (\n\t\t\t\t\t\tendpoint.actorExtractor as ActorExtractor<\n\t\t\t\t\t\t\tTServices,\n\t\t\t\t\t\t\tTSession,\n\t\t\t\t\t\t\tTLogger\n\t\t\t\t\t\t>\n\t\t\t\t\t)({\n\t\t\t\t\t\tservices: ctx.services as any,\n\t\t\t\t\t\tsession: ctx.session,\n\t\t\t\t\t\theader: ctx.header,\n\t\t\t\t\t\tcookie: ctx.cookie,\n\t\t\t\t\t\tlogger,\n\t\t\t\t\t});\n\t\t\t\t} catch (error) {\n\t\t\t\t\tlogger.error(error as Error, 'Failed to extract actor for audits');\n\t\t\t\t\t// Continue with system actor\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tauditor = new DefaultAuditor<TAuditAction>({\n\t\t\t\tactor,\n\t\t\t\tstorage,\n\t\t\t\tmetadata: {\n\t\t\t\t\tendpoint: endpoint.route,\n\t\t\t\t\tmethod: endpoint.method,\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\t// Process each declarative audit\n\t\tif (audits?.length) {\n\t\t\tfor (const audit of audits) {\n\t\t\t\tlogger.debug({ audit: audit.type }, 'Processing declarative audit');\n\n\t\t\t\t// Check when condition\n\t\t\t\tif (audit.when && !audit.when(response as any)) {\n\t\t\t\t\tlogger.debug(\n\t\t\t\t\t\t{ audit: audit.type },\n\t\t\t\t\t\t'Audit skipped due to when condition',\n\t\t\t\t\t);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Extract payload\n\t\t\t\tconst payload = audit.payload(response as any);\n\n\t\t\t\t// Extract entityId if configured\n\t\t\t\tconst entityId = audit.entityId?.(response as any);\n\n\t\t\t\t// Record the audit\n\t\t\t\tauditor.audit(audit.type as any, payload as any, {\n\t\t\t\t\ttable: audit.table,\n\t\t\t\t\tentityId,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t// Flush audits to storage\n\t\t// Note: If existingAuditor has a stored transaction (via setTransaction),\n\t\t// flush() will use it automatically\n\t\tconst recordCount = auditor.getRecords().length;\n\t\tif (recordCount > 0) {\n\t\t\t// Check if auditor has a stored transaction (for logging purposes)\n\t\t\tconst trx =\n\t\t\t\t'getTransaction' in auditor\n\t\t\t\t\t? (auditor as { getTransaction(): unknown }).getTransaction()\n\t\t\t\t\t: undefined;\n\t\t\tlogger.debug(\n\t\t\t\t{ auditCount: recordCount, hasTransaction: !!trx },\n\t\t\t\t'Flushing audits',\n\t\t\t);\n\t\t\tawait auditor.flush();\n\t\t}\n\t} catch (error) {\n\t\tlogger.error(error as Error, 'Failed to process audits');\n\t\t// Don't rethrow - audit failures shouldn't fail the request\n\t}\n}\n\n/**\n * Context for audit-aware handler execution.\n */\nexport interface AuditExecutionContext<\n\tTAuditAction extends AuditableAction<string, unknown> = AuditableAction<\n\t\tstring,\n\t\tunknown\n\t>,\n> {\n\t/** The auditor instance for recording audits */\n\tauditor: Auditor<TAuditAction>;\n\t/** The audit storage instance */\n\tstorage: AuditStorage;\n}\n\n/**\n * Create audit context for handler execution.\n * Returns the auditor and storage for use in the handler.\n *\n * @param endpoint - The endpoint with audit configuration\n * @param serviceDiscovery - Service discovery for getting audit storage\n * @param logger - Logger for debug/error messages\n * @param ctx - Request context for actor extraction\n * @returns Audit context with auditor and storage, or undefined if not configured\n */\nexport async function createAuditContext<\n\tTServices extends Service[] = [],\n\tTSession = unknown,\n\tTLogger extends Logger = Logger,\n\tTAuditStorage extends AuditStorage | undefined = undefined,\n\tTAuditStorageServiceName extends string = string,\n\tTAuditAction extends AuditableAction<string, unknown> = AuditableAction<\n\t\tstring,\n\t\tunknown\n\t>,\n\tTDatabase = undefined,\n\tTDatabaseServiceName extends string = string,\n>(\n\tendpoint: Endpoint<\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tTServices,\n\t\tTLogger,\n\t\tTSession,\n\t\tany,\n\t\tany,\n\t\tTAuditStorage,\n\t\tTAuditStorageServiceName,\n\t\tTAuditAction,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t>,\n\tserviceDiscovery: ServiceDiscovery<any>,\n\tlogger: TLogger,\n\tctx: {\n\t\tsession: TSession;\n\t\theader: HeaderFn;\n\t\tcookie: CookieFn;\n\t\tservices: Record<string, unknown>;\n\t},\n): Promise<AuditExecutionContext<TAuditAction> | undefined> {\n\tif (!endpoint.auditorStorageService) {\n\t\treturn undefined;\n\t}\n\n\tconst services = await serviceDiscovery.register([\n\t\tendpoint.auditorStorageService,\n\t]);\n\tconst storage = services[\n\t\tendpoint.auditorStorageService.serviceName\n\t] as AuditStorage;\n\n\t// Extract actor if configured\n\tlet actor: AuditActor = { id: 'system', type: 'system' };\n\tif (endpoint.actorExtractor) {\n\t\ttry {\n\t\t\tactor = await (\n\t\t\t\tendpoint.actorExtractor as ActorExtractor<TServices, TSession, TLogger>\n\t\t\t)({\n\t\t\t\tservices: ctx.services as any,\n\t\t\t\tsession: ctx.session,\n\t\t\t\theader: ctx.header,\n\t\t\t\tcookie: ctx.cookie,\n\t\t\t\tlogger,\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tlogger.error(error as Error, 'Failed to extract actor for audits');\n\t\t}\n\t}\n\n\tconst auditor = new DefaultAuditor<TAuditAction>({\n\t\tactor,\n\t\tstorage,\n\t\tmetadata: {\n\t\t\tendpoint: endpoint.route,\n\t\t\tmethod: endpoint.method,\n\t\t},\n\t});\n\n\treturn { auditor, storage };\n}\n\n/**\n * Options for executeWithAuditTransaction.\n */\nexport interface ExecuteWithAuditTransactionOptions {\n\t/**\n\t * Database connection to use for the transaction.\n\t * If this is already a transaction, it will be reused instead of creating a nested one.\n\t * If not provided, the storage's internal database is used.\n\t */\n\tdb?: unknown;\n}\n\n/**\n * Execute a handler with automatic audit transaction support.\n * If the audit storage provides a withTransaction method, wraps execution\n * in a transaction so audits are atomic with handler's database operations.\n *\n * This is database-agnostic - each storage implementation provides its own\n * transaction handling based on the underlying database (Kysely, Drizzle, etc.).\n *\n * If the db parameter is provided and is already a transaction, the storage\n * will reuse it instead of creating a nested transaction (similar to\n * packages/db/src/kysely.ts#withTransaction).\n *\n * @param auditContext - The audit context from createAuditContext\n * @param handler - The handler function to execute (receives auditor)\n * @param onComplete - Called after handler with response, to process declarative audits\n * @param options - Optional configuration including database connection\n * @returns The handler result\n */\nexport async function executeWithAuditTransaction<\n\tT,\n\tTAuditAction extends AuditableAction<string, unknown> = AuditableAction<\n\t\tstring,\n\t\tunknown\n\t>,\n>(\n\tauditContext: AuditExecutionContext<TAuditAction> | undefined,\n\thandler: (auditor?: Auditor<TAuditAction>) => Promise<T>,\n\tonComplete?: (response: T, auditor: Auditor<TAuditAction>) => Promise<void>,\n\toptions?: ExecuteWithAuditTransactionOptions,\n): Promise<T> {\n\t// No audit context - just run handler\n\tif (!auditContext) {\n\t\treturn handler(undefined);\n\t}\n\n\tconst { auditor, storage } = auditContext;\n\n\t// Check if storage provides a transaction wrapper\n\tif (storage.withTransaction) {\n\t\t// Wrap in transaction - audits are atomic with handler operations\n\t\t// The storage's withTransaction handles setTransaction and flush\n\t\t// Pass db so existing transactions are reused\n\t\treturn storage.withTransaction(\n\t\t\tauditor,\n\t\t\tasync () => {\n\t\t\t\tconst response = await handler(auditor);\n\n\t\t\t\t// Process declarative audits within the transaction\n\t\t\t\tif (onComplete) {\n\t\t\t\t\tawait onComplete(response, auditor);\n\t\t\t\t}\n\n\t\t\t\treturn response;\n\t\t\t},\n\t\t\toptions?.db,\n\t\t);\n\t}\n\n\t// No transaction support - run handler and flush audits after\n\tconst response = await handler(auditor);\n\n\tif (onComplete) {\n\t\tawait onComplete(response, auditor);\n\t}\n\n\t// Flush audits (no transaction)\n\tawait auditor.flush();\n\n\treturn response;\n}\n"],"mappings":";;;;;;;;;;;;;AAkNA,eAAsB,mBAarBA,UAgBAC,kBACAC,QACAC,KAM2D;AAC3D,MAAK,SAAS,sBACb;CAGD,MAAM,WAAW,MAAM,iBAAiB,SAAS,CAChD,SAAS,qBACT,EAAC;CACF,MAAM,UAAU,SACf,SAAS,sBAAsB;CAIhC,IAAIC,QAAoB;EAAE,IAAI;EAAU,MAAM;CAAU;AACxD,KAAI,SAAS,eACZ,KAAI;AACH,UAAQ,MAAM,AACb,SAAS,eACR;GACD,UAAU,IAAI;GACd,SAAS,IAAI;GACb,QAAQ,IAAI;GACZ,QAAQ,IAAI;GACZ;EACA,EAAC;CACF,SAAQ,OAAO;AACf,SAAO,MAAM,OAAgB,qCAAqC;CAClE;CAGF,MAAM,UAAU,IAAI,eAA6B;EAChD;EACA;EACA,UAAU;GACT,UAAU,SAAS;GACnB,QAAQ,SAAS;EACjB;CACD;AAED,QAAO;EAAE;EAAS;CAAS;AAC3B;;;;;;;;;;;;;;;;;;;AAgCD,eAAsB,4BAOrBC,cACAC,SACAC,YACAC,SACa;AAEb,MAAK,aACJ,QAAO,eAAkB;CAG1B,MAAM,EAAE,SAAS,SAAS,GAAG;AAG7B,KAAI,QAAQ,gBAIX,QAAO,QAAQ,gBACd,SACA,YAAY;EACX,MAAMC,aAAW,MAAM,QAAQ,QAAQ;AAGvC,MAAI,WACH,OAAM,WAAWA,YAAU,QAAQ;AAGpC,SAAOA;CACP,GACD,SAAS,GACT;CAIF,MAAM,WAAW,MAAM,QAAQ,QAAQ;AAEvC,KAAI,WACH,OAAM,WAAW,UAAU,QAAQ;AAIpC,OAAM,QAAQ,OAAO;AAErB,QAAO;AACP"}
@@ -0,0 +1,92 @@
1
+ const require_Construct = require('./Construct-B14miJ6P.cjs');
2
+ const __geekmidas_audit = require_Construct.__toESM(require("@geekmidas/audit"));
3
+
4
+ //#region src/endpoints/processAudits.ts
5
+ /**
6
+ * Create audit context for handler execution.
7
+ * Returns the auditor and storage for use in the handler.
8
+ *
9
+ * @param endpoint - The endpoint with audit configuration
10
+ * @param serviceDiscovery - Service discovery for getting audit storage
11
+ * @param logger - Logger for debug/error messages
12
+ * @param ctx - Request context for actor extraction
13
+ * @returns Audit context with auditor and storage, or undefined if not configured
14
+ */
15
+ async function createAuditContext(endpoint, serviceDiscovery, logger, ctx) {
16
+ if (!endpoint.auditorStorageService) return void 0;
17
+ const services = await serviceDiscovery.register([endpoint.auditorStorageService]);
18
+ const storage = services[endpoint.auditorStorageService.serviceName];
19
+ let actor = {
20
+ id: "system",
21
+ type: "system"
22
+ };
23
+ if (endpoint.actorExtractor) try {
24
+ actor = await endpoint.actorExtractor({
25
+ services: ctx.services,
26
+ session: ctx.session,
27
+ header: ctx.header,
28
+ cookie: ctx.cookie,
29
+ logger
30
+ });
31
+ } catch (error) {
32
+ logger.error(error, "Failed to extract actor for audits");
33
+ }
34
+ const auditor = new __geekmidas_audit.DefaultAuditor({
35
+ actor,
36
+ storage,
37
+ metadata: {
38
+ endpoint: endpoint.route,
39
+ method: endpoint.method
40
+ }
41
+ });
42
+ return {
43
+ auditor,
44
+ storage
45
+ };
46
+ }
47
+ /**
48
+ * Execute a handler with automatic audit transaction support.
49
+ * If the audit storage provides a withTransaction method, wraps execution
50
+ * in a transaction so audits are atomic with handler's database operations.
51
+ *
52
+ * This is database-agnostic - each storage implementation provides its own
53
+ * transaction handling based on the underlying database (Kysely, Drizzle, etc.).
54
+ *
55
+ * If the db parameter is provided and is already a transaction, the storage
56
+ * will reuse it instead of creating a nested transaction (similar to
57
+ * packages/db/src/kysely.ts#withTransaction).
58
+ *
59
+ * @param auditContext - The audit context from createAuditContext
60
+ * @param handler - The handler function to execute (receives auditor)
61
+ * @param onComplete - Called after handler with response, to process declarative audits
62
+ * @param options - Optional configuration including database connection
63
+ * @returns The handler result
64
+ */
65
+ async function executeWithAuditTransaction(auditContext, handler, onComplete, options) {
66
+ if (!auditContext) return handler(void 0);
67
+ const { auditor, storage } = auditContext;
68
+ if (storage.withTransaction) return storage.withTransaction(auditor, async () => {
69
+ const response$1 = await handler(auditor);
70
+ if (onComplete) await onComplete(response$1, auditor);
71
+ return response$1;
72
+ }, options?.db);
73
+ const response = await handler(auditor);
74
+ if (onComplete) await onComplete(response, auditor);
75
+ await auditor.flush();
76
+ return response;
77
+ }
78
+
79
+ //#endregion
80
+ Object.defineProperty(exports, 'createAuditContext', {
81
+ enumerable: true,
82
+ get: function () {
83
+ return createAuditContext;
84
+ }
85
+ });
86
+ Object.defineProperty(exports, 'executeWithAuditTransaction', {
87
+ enumerable: true,
88
+ get: function () {
89
+ return executeWithAuditTransaction;
90
+ }
91
+ });
92
+ //# sourceMappingURL=processAudits-CUko08pi.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processAudits-CUko08pi.cjs","names":["endpoint: Endpoint<\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tTServices,\n\t\tTLogger,\n\t\tTSession,\n\t\tany,\n\t\tany,\n\t\tTAuditStorage,\n\t\tTAuditStorageServiceName,\n\t\tTAuditAction,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t>","serviceDiscovery: ServiceDiscovery<any>","logger: TLogger","ctx: {\n\t\tsession: TSession;\n\t\theader: HeaderFn;\n\t\tcookie: CookieFn;\n\t\tservices: Record<string, unknown>;\n\t}","actor: AuditActor","DefaultAuditor","auditContext: AuditExecutionContext<TAuditAction> | undefined","handler: (auditor?: Auditor<TAuditAction>) => Promise<T>","onComplete?: (response: T, auditor: Auditor<TAuditAction>) => Promise<void>","options?: ExecuteWithAuditTransactionOptions","response"],"sources":["../src/endpoints/processAudits.ts"],"sourcesContent":["import type {\n\tAuditActor,\n\tAuditableAction,\n\tAuditor,\n\tAuditStorage,\n} from '@geekmidas/audit';\nimport { DefaultAuditor } from '@geekmidas/audit';\nimport type { Logger } from '@geekmidas/logger';\nimport type { InferStandardSchema } from '@geekmidas/schema';\nimport type { Service, ServiceDiscovery } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { ActorExtractor, MappedAudit } from './audit';\nimport type { CookieFn, Endpoint, HeaderFn } from './Endpoint';\n\n/**\n * Process declarative audit definitions after successful endpoint execution.\n * Similar to publishConstructEvents for events.\n *\n * @param endpoint - The endpoint with audit configuration\n * @param response - The handler response to generate audit payloads from\n * @param serviceDiscovery - Service discovery for registering audit storage\n * @param logger - Logger for debug/error messages\n * @param ctx - Request context (session, headers, cookies, services)\n * @param existingAuditor - Optional existing auditor instance (e.g., from handler context).\n * If provided, uses this auditor (with its stored transaction).\n * If not provided, creates a new auditor.\n */\nexport async function processEndpointAudits<\n\tTServices extends Service[] = [],\n\tTSession = unknown,\n\tTLogger extends Logger = Logger,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTAuditStorage extends AuditStorage | undefined = undefined,\n\tTAuditStorageServiceName extends string = string,\n\tTAuditAction extends AuditableAction<string, unknown> = AuditableAction<\n\t\tstring,\n\t\tunknown\n\t>,\n>(\n\tendpoint: Endpoint<\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tOutSchema,\n\t\tTServices,\n\t\tTLogger,\n\t\tTSession,\n\t\tany,\n\t\tany,\n\t\tTAuditStorage,\n\t\tTAuditStorageServiceName,\n\t\tTAuditAction\n\t>,\n\tresponse: InferStandardSchema<OutSchema>,\n\tserviceDiscovery: ServiceDiscovery<any>,\n\tlogger: TLogger,\n\tctx: {\n\t\tsession: TSession;\n\t\theader: HeaderFn;\n\t\tcookie: CookieFn;\n\t\tservices: Record<string, unknown>;\n\t},\n\texistingAuditor?: Auditor<TAuditAction>,\n): Promise<void> {\n\ttry {\n\t\tconst audits = endpoint.audits as MappedAudit<TAuditAction, OutSchema>[];\n\n\t\t// If we have an existing auditor (from handler context), we need to flush\n\t\t// any manual audits it collected, even if there are no declarative audits\n\t\tconst hasExistingRecords =\n\t\t\texistingAuditor && existingAuditor.getRecords().length > 0;\n\n\t\t// Skip if no declarative audits and no existing records to flush\n\t\tif (!audits?.length && !hasExistingRecords) {\n\t\t\tlogger.debug('No audits to process');\n\t\t\treturn;\n\t\t}\n\n\t\t// If no auditor storage service and we have things to process, warn\n\t\tif (!endpoint.auditorStorageService) {\n\t\t\tif (hasExistingRecords || audits?.length) {\n\t\t\t\tlogger.warn('No auditor storage service available');\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// Get or create auditor\n\t\tlet auditor: Auditor<TAuditAction>;\n\n\t\tif (existingAuditor) {\n\t\t\t// Use existing auditor (preserves stored transaction and manual audits)\n\t\t\tauditor = existingAuditor;\n\t\t\tlogger.debug('Using existing auditor from handler context');\n\t\t} else {\n\t\t\t// Create new auditor (backward compatibility)\n\t\t\tconst services = await serviceDiscovery.register([\n\t\t\t\tendpoint.auditorStorageService,\n\t\t\t]);\n\t\t\tconst storage = services[\n\t\t\t\tendpoint.auditorStorageService.serviceName\n\t\t\t] as AuditStorage;\n\n\t\t\t// Extract actor if configured\n\t\t\tlet actor: AuditActor = { id: 'system', type: 'system' };\n\t\t\tif (endpoint.actorExtractor) {\n\t\t\t\ttry {\n\t\t\t\t\tactor = await (\n\t\t\t\t\t\tendpoint.actorExtractor as ActorExtractor<\n\t\t\t\t\t\t\tTServices,\n\t\t\t\t\t\t\tTSession,\n\t\t\t\t\t\t\tTLogger\n\t\t\t\t\t\t>\n\t\t\t\t\t)({\n\t\t\t\t\t\tservices: ctx.services as any,\n\t\t\t\t\t\tsession: ctx.session,\n\t\t\t\t\t\theader: ctx.header,\n\t\t\t\t\t\tcookie: ctx.cookie,\n\t\t\t\t\t\tlogger,\n\t\t\t\t\t});\n\t\t\t\t} catch (error) {\n\t\t\t\t\tlogger.error(error as Error, 'Failed to extract actor for audits');\n\t\t\t\t\t// Continue with system actor\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tauditor = new DefaultAuditor<TAuditAction>({\n\t\t\t\tactor,\n\t\t\t\tstorage,\n\t\t\t\tmetadata: {\n\t\t\t\t\tendpoint: endpoint.route,\n\t\t\t\t\tmethod: endpoint.method,\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\t// Process each declarative audit\n\t\tif (audits?.length) {\n\t\t\tfor (const audit of audits) {\n\t\t\t\tlogger.debug({ audit: audit.type }, 'Processing declarative audit');\n\n\t\t\t\t// Check when condition\n\t\t\t\tif (audit.when && !audit.when(response as any)) {\n\t\t\t\t\tlogger.debug(\n\t\t\t\t\t\t{ audit: audit.type },\n\t\t\t\t\t\t'Audit skipped due to when condition',\n\t\t\t\t\t);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Extract payload\n\t\t\t\tconst payload = audit.payload(response as any);\n\n\t\t\t\t// Extract entityId if configured\n\t\t\t\tconst entityId = audit.entityId?.(response as any);\n\n\t\t\t\t// Record the audit\n\t\t\t\tauditor.audit(audit.type as any, payload as any, {\n\t\t\t\t\ttable: audit.table,\n\t\t\t\t\tentityId,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t// Flush audits to storage\n\t\t// Note: If existingAuditor has a stored transaction (via setTransaction),\n\t\t// flush() will use it automatically\n\t\tconst recordCount = auditor.getRecords().length;\n\t\tif (recordCount > 0) {\n\t\t\t// Check if auditor has a stored transaction (for logging purposes)\n\t\t\tconst trx =\n\t\t\t\t'getTransaction' in auditor\n\t\t\t\t\t? (auditor as { getTransaction(): unknown }).getTransaction()\n\t\t\t\t\t: undefined;\n\t\t\tlogger.debug(\n\t\t\t\t{ auditCount: recordCount, hasTransaction: !!trx },\n\t\t\t\t'Flushing audits',\n\t\t\t);\n\t\t\tawait auditor.flush();\n\t\t}\n\t} catch (error) {\n\t\tlogger.error(error as Error, 'Failed to process audits');\n\t\t// Don't rethrow - audit failures shouldn't fail the request\n\t}\n}\n\n/**\n * Context for audit-aware handler execution.\n */\nexport interface AuditExecutionContext<\n\tTAuditAction extends AuditableAction<string, unknown> = AuditableAction<\n\t\tstring,\n\t\tunknown\n\t>,\n> {\n\t/** The auditor instance for recording audits */\n\tauditor: Auditor<TAuditAction>;\n\t/** The audit storage instance */\n\tstorage: AuditStorage;\n}\n\n/**\n * Create audit context for handler execution.\n * Returns the auditor and storage for use in the handler.\n *\n * @param endpoint - The endpoint with audit configuration\n * @param serviceDiscovery - Service discovery for getting audit storage\n * @param logger - Logger for debug/error messages\n * @param ctx - Request context for actor extraction\n * @returns Audit context with auditor and storage, or undefined if not configured\n */\nexport async function createAuditContext<\n\tTServices extends Service[] = [],\n\tTSession = unknown,\n\tTLogger extends Logger = Logger,\n\tTAuditStorage extends AuditStorage | undefined = undefined,\n\tTAuditStorageServiceName extends string = string,\n\tTAuditAction extends AuditableAction<string, unknown> = AuditableAction<\n\t\tstring,\n\t\tunknown\n\t>,\n\tTDatabase = undefined,\n\tTDatabaseServiceName extends string = string,\n>(\n\tendpoint: Endpoint<\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tany,\n\t\tTServices,\n\t\tTLogger,\n\t\tTSession,\n\t\tany,\n\t\tany,\n\t\tTAuditStorage,\n\t\tTAuditStorageServiceName,\n\t\tTAuditAction,\n\t\tTDatabase,\n\t\tTDatabaseServiceName\n\t>,\n\tserviceDiscovery: ServiceDiscovery<any>,\n\tlogger: TLogger,\n\tctx: {\n\t\tsession: TSession;\n\t\theader: HeaderFn;\n\t\tcookie: CookieFn;\n\t\tservices: Record<string, unknown>;\n\t},\n): Promise<AuditExecutionContext<TAuditAction> | undefined> {\n\tif (!endpoint.auditorStorageService) {\n\t\treturn undefined;\n\t}\n\n\tconst services = await serviceDiscovery.register([\n\t\tendpoint.auditorStorageService,\n\t]);\n\tconst storage = services[\n\t\tendpoint.auditorStorageService.serviceName\n\t] as AuditStorage;\n\n\t// Extract actor if configured\n\tlet actor: AuditActor = { id: 'system', type: 'system' };\n\tif (endpoint.actorExtractor) {\n\t\ttry {\n\t\t\tactor = await (\n\t\t\t\tendpoint.actorExtractor as ActorExtractor<TServices, TSession, TLogger>\n\t\t\t)({\n\t\t\t\tservices: ctx.services as any,\n\t\t\t\tsession: ctx.session,\n\t\t\t\theader: ctx.header,\n\t\t\t\tcookie: ctx.cookie,\n\t\t\t\tlogger,\n\t\t\t});\n\t\t} catch (error) {\n\t\t\tlogger.error(error as Error, 'Failed to extract actor for audits');\n\t\t}\n\t}\n\n\tconst auditor = new DefaultAuditor<TAuditAction>({\n\t\tactor,\n\t\tstorage,\n\t\tmetadata: {\n\t\t\tendpoint: endpoint.route,\n\t\t\tmethod: endpoint.method,\n\t\t},\n\t});\n\n\treturn { auditor, storage };\n}\n\n/**\n * Options for executeWithAuditTransaction.\n */\nexport interface ExecuteWithAuditTransactionOptions {\n\t/**\n\t * Database connection to use for the transaction.\n\t * If this is already a transaction, it will be reused instead of creating a nested one.\n\t * If not provided, the storage's internal database is used.\n\t */\n\tdb?: unknown;\n}\n\n/**\n * Execute a handler with automatic audit transaction support.\n * If the audit storage provides a withTransaction method, wraps execution\n * in a transaction so audits are atomic with handler's database operations.\n *\n * This is database-agnostic - each storage implementation provides its own\n * transaction handling based on the underlying database (Kysely, Drizzle, etc.).\n *\n * If the db parameter is provided and is already a transaction, the storage\n * will reuse it instead of creating a nested transaction (similar to\n * packages/db/src/kysely.ts#withTransaction).\n *\n * @param auditContext - The audit context from createAuditContext\n * @param handler - The handler function to execute (receives auditor)\n * @param onComplete - Called after handler with response, to process declarative audits\n * @param options - Optional configuration including database connection\n * @returns The handler result\n */\nexport async function executeWithAuditTransaction<\n\tT,\n\tTAuditAction extends AuditableAction<string, unknown> = AuditableAction<\n\t\tstring,\n\t\tunknown\n\t>,\n>(\n\tauditContext: AuditExecutionContext<TAuditAction> | undefined,\n\thandler: (auditor?: Auditor<TAuditAction>) => Promise<T>,\n\tonComplete?: (response: T, auditor: Auditor<TAuditAction>) => Promise<void>,\n\toptions?: ExecuteWithAuditTransactionOptions,\n): Promise<T> {\n\t// No audit context - just run handler\n\tif (!auditContext) {\n\t\treturn handler(undefined);\n\t}\n\n\tconst { auditor, storage } = auditContext;\n\n\t// Check if storage provides a transaction wrapper\n\tif (storage.withTransaction) {\n\t\t// Wrap in transaction - audits are atomic with handler operations\n\t\t// The storage's withTransaction handles setTransaction and flush\n\t\t// Pass db so existing transactions are reused\n\t\treturn storage.withTransaction(\n\t\t\tauditor,\n\t\t\tasync () => {\n\t\t\t\tconst response = await handler(auditor);\n\n\t\t\t\t// Process declarative audits within the transaction\n\t\t\t\tif (onComplete) {\n\t\t\t\t\tawait onComplete(response, auditor);\n\t\t\t\t}\n\n\t\t\t\treturn response;\n\t\t\t},\n\t\t\toptions?.db,\n\t\t);\n\t}\n\n\t// No transaction support - run handler and flush audits after\n\tconst response = await handler(auditor);\n\n\tif (onComplete) {\n\t\tawait onComplete(response, auditor);\n\t}\n\n\t// Flush audits (no transaction)\n\tawait auditor.flush();\n\n\treturn response;\n}\n"],"mappings":";;;;;;;;;;;;;;AAkNA,eAAsB,mBAarBA,UAgBAC,kBACAC,QACAC,KAM2D;AAC3D,MAAK,SAAS,sBACb;CAGD,MAAM,WAAW,MAAM,iBAAiB,SAAS,CAChD,SAAS,qBACT,EAAC;CACF,MAAM,UAAU,SACf,SAAS,sBAAsB;CAIhC,IAAIC,QAAoB;EAAE,IAAI;EAAU,MAAM;CAAU;AACxD,KAAI,SAAS,eACZ,KAAI;AACH,UAAQ,MAAM,AACb,SAAS,eACR;GACD,UAAU,IAAI;GACd,SAAS,IAAI;GACb,QAAQ,IAAI;GACZ,QAAQ,IAAI;GACZ;EACA,EAAC;CACF,SAAQ,OAAO;AACf,SAAO,MAAM,OAAgB,qCAAqC;CAClE;CAGF,MAAM,UAAU,IAAIC,iCAA6B;EAChD;EACA;EACA,UAAU;GACT,UAAU,SAAS;GACnB,QAAQ,SAAS;EACjB;CACD;AAED,QAAO;EAAE;EAAS;CAAS;AAC3B;;;;;;;;;;;;;;;;;;;AAgCD,eAAsB,4BAOrBC,cACAC,SACAC,YACAC,SACa;AAEb,MAAK,aACJ,QAAO,eAAkB;CAG1B,MAAM,EAAE,SAAS,SAAS,GAAG;AAG7B,KAAI,QAAQ,gBAIX,QAAO,QAAQ,gBACd,SACA,YAAY;EACX,MAAMC,aAAW,MAAM,QAAQ,QAAQ;AAGvC,MAAI,WACH,OAAM,WAAWA,YAAU,QAAQ;AAGpC,SAAOA;CACP,GACD,SAAS,GACT;CAIF,MAAM,WAAW,MAAM,QAAQ,QAAQ;AAEvC,KAAI,WACH,OAAM,WAAW,UAAU,QAAQ;AAIpC,OAAM,QAAQ,OAAO;AAErB,QAAO;AACP"}
@@ -1,12 +1,83 @@
1
- require('../Construct-BXG8cFSm.cjs');
2
- const require_Subscriber = require('../Subscriber-BgspJeS4.cjs');
3
- const require_SubscriberBuilder = require('../SubscriberBuilder-BtL22ZJ9.cjs');
1
+ const require_Construct = require('../Construct-B14miJ6P.cjs');
2
+ const __geekmidas_logger_console = require_Construct.__toESM(require("@geekmidas/logger/console"));
4
3
 
4
+ //#region src/subscribers/Subscriber.ts
5
+ const DEFAULT_LOGGER$1 = new __geekmidas_logger_console.ConsoleLogger();
6
+ var Subscriber = class extends require_Construct.Construct {
7
+ __IS_SUBSCRIBER__ = true;
8
+ static isSubscriber(obj) {
9
+ return Boolean(obj && obj.__IS_SUBSCRIBER__ === true && obj.type === require_Construct.ConstructType.Subscriber);
10
+ }
11
+ constructor(handler, timeout = 3e4, _subscribedEvents, outputSchema, services = [], logger = DEFAULT_LOGGER$1, publisherService) {
12
+ super(require_Construct.ConstructType.Subscriber, logger, services, [], publisherService, outputSchema);
13
+ this.handler = handler;
14
+ this.timeout = timeout;
15
+ this._subscribedEvents = _subscribedEvents;
16
+ this.outputSchema = outputSchema;
17
+ this.services = services;
18
+ this.logger = logger;
19
+ this.publisherService = publisherService;
20
+ }
21
+ get subscribedEvents() {
22
+ return this._subscribedEvents;
23
+ }
24
+ };
25
+
26
+ //#endregion
27
+ //#region src/subscribers/SubscriberBuilder.ts
28
+ var SubscriberBuilder = class {
29
+ _subscribedEvents = [];
30
+ _timeout;
31
+ outputSchema;
32
+ _services = [];
33
+ _logger = __geekmidas_logger_console.DEFAULT_LOGGER;
34
+ _publisher;
35
+ constructor() {
36
+ this._timeout = 3e4;
37
+ }
38
+ timeout(timeout) {
39
+ this._timeout = timeout;
40
+ return this;
41
+ }
42
+ output(schema) {
43
+ this.outputSchema = schema;
44
+ return this;
45
+ }
46
+ services(services) {
47
+ this._services = [...this._services, ...services];
48
+ return this;
49
+ }
50
+ logger(logger) {
51
+ this._logger = logger;
52
+ return this;
53
+ }
54
+ publisher(publisher) {
55
+ this._publisher = publisher;
56
+ return this;
57
+ }
58
+ subscribe(event) {
59
+ const eventsToAdd = Array.isArray(event) ? event : [event];
60
+ this._subscribedEvents = [...this._subscribedEvents, ...eventsToAdd];
61
+ return this;
62
+ }
63
+ handle(fn) {
64
+ const subscriber = new Subscriber(fn, this._timeout, this._subscribedEvents, this.outputSchema, this._services, this._logger, this._publisher);
65
+ this._services = [];
66
+ this._logger = __geekmidas_logger_console.DEFAULT_LOGGER;
67
+ this._publisher = void 0;
68
+ this._subscribedEvents = [];
69
+ this._timeout = 3e4;
70
+ this.outputSchema = void 0;
71
+ return subscriber;
72
+ }
73
+ };
74
+
75
+ //#endregion
5
76
  //#region src/subscribers/index.ts
6
- const s = new require_SubscriberBuilder.SubscriberBuilder();
77
+ const s = new SubscriberBuilder();
7
78
 
8
79
  //#endregion
9
- exports.Subscriber = require_Subscriber.Subscriber;
10
- exports.SubscriberBuilder = require_SubscriberBuilder.SubscriberBuilder;
80
+ exports.Subscriber = Subscriber;
81
+ exports.SubscriberBuilder = SubscriberBuilder;
11
82
  exports.s = s;
12
83
  //# sourceMappingURL=index.cjs.map