@geekmidas/constructs 10.0.0-alpha.14 → 10.0.0-alpha.140

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 (454) hide show
  1. package/README.md +222 -158
  2. package/dist/Construct-127M7yrl.d.cts +231 -0
  3. package/dist/Construct-127M7yrl.d.cts.map +1 -0
  4. package/dist/{Construct-BeYVu_QF.mjs → Construct-CGuc_Ijk.mjs} +8 -9
  5. package/dist/Construct-CGuc_Ijk.mjs.map +1 -0
  6. package/dist/{Construct-DqdlARxq.cjs → Construct-DorKS0Ua.cjs} +8 -9
  7. package/dist/Construct-DorKS0Ua.cjs.map +1 -0
  8. package/dist/Construct-DySlwh8o.d.mts +231 -0
  9. package/dist/Construct-DySlwh8o.d.mts.map +1 -0
  10. package/dist/{Cron-DKqnnTdH.d.cts → Cron-CFkpEys6.d.cts} +14 -7
  11. package/dist/Cron-CFkpEys6.d.cts.map +1 -0
  12. package/dist/{Cron-SyqS5oWJ.d.mts → Cron-CQoDSu-n.d.mts} +14 -7
  13. package/dist/Cron-CQoDSu-n.d.mts.map +1 -0
  14. package/dist/CronBuilder-1W-G_i15.d.mts +47 -0
  15. package/dist/CronBuilder-1W-G_i15.d.mts.map +1 -0
  16. package/dist/{CronBuilder-D_0HNBTr.mjs → CronBuilder-BJ5LoadF.mjs} +28 -11
  17. package/dist/CronBuilder-BJ5LoadF.mjs.map +1 -0
  18. package/dist/{CronBuilder-BdnI6lxF.cjs → CronBuilder-B_NSP-Y5.cjs} +27 -10
  19. package/dist/CronBuilder-B_NSP-Y5.cjs.map +1 -0
  20. package/dist/CronBuilder-OaCRRFVk.d.cts +47 -0
  21. package/dist/CronBuilder-OaCRRFVk.d.cts.map +1 -0
  22. package/dist/{Endpoint-C6yyHpRS.d.cts → Endpoint-BEh-jW-f.d.cts} +122 -41
  23. package/dist/Endpoint-BEh-jW-f.d.cts.map +1 -0
  24. package/dist/Endpoint-BcUorcBa.cjs +576 -0
  25. package/dist/Endpoint-BcUorcBa.cjs.map +1 -0
  26. package/dist/Endpoint-BgvG36NO.mjs +547 -0
  27. package/dist/Endpoint-BgvG36NO.mjs.map +1 -0
  28. package/dist/{Endpoint-DuT4TEEq.d.mts → Endpoint-DTXDggNl.d.mts} +124 -43
  29. package/dist/Endpoint-DTXDggNl.d.mts.map +1 -0
  30. package/dist/{index-BPSZ_Lp_.d.cts → EndpointFactory-B2dCS9dy.d.cts} +187 -104
  31. package/dist/EndpointFactory-B2dCS9dy.d.cts.map +1 -0
  32. package/dist/{EndpointFactory-Bm3aKRdV.mjs → EndpointFactory-C1NlpCAS.mjs} +269 -53
  33. package/dist/EndpointFactory-C1NlpCAS.mjs.map +1 -0
  34. package/dist/{index-BoZ-iisU.d.mts → EndpointFactory-D2HXcUrJ.d.mts} +188 -105
  35. package/dist/EndpointFactory-D2HXcUrJ.d.mts.map +1 -0
  36. package/dist/{EndpointFactory-CLvWuHyt.cjs → EndpointFactory-gqmIRVWg.cjs} +309 -51
  37. package/dist/EndpointFactory-gqmIRVWg.cjs.map +1 -0
  38. package/dist/Function-BIEsY0Hm.d.cts +76 -0
  39. package/dist/Function-BIEsY0Hm.d.cts.map +1 -0
  40. package/dist/Function-DfMzTGS4.d.mts +76 -0
  41. package/dist/Function-DfMzTGS4.d.mts.map +1 -0
  42. package/dist/{HonoEndpointAdaptor-92zavCsV.cjs → HonoEndpointAdaptor-BJlj20fQ.cjs} +79 -31
  43. package/dist/HonoEndpointAdaptor-BJlj20fQ.cjs.map +1 -0
  44. package/dist/{HonoEndpointAdaptor-yYaU7jVJ.mjs → HonoEndpointAdaptor-BlbkUDNo.mjs} +76 -28
  45. package/dist/HonoEndpointAdaptor-BlbkUDNo.mjs.map +1 -0
  46. package/dist/ObjectSubscriberBuilder-BuuaYcrm.d.cts +129 -0
  47. package/dist/ObjectSubscriberBuilder-BuuaYcrm.d.cts.map +1 -0
  48. package/dist/ObjectSubscriberBuilder-CzgYmOUH.d.mts +129 -0
  49. package/dist/ObjectSubscriberBuilder-CzgYmOUH.d.mts.map +1 -0
  50. package/dist/ProcessorBuilder-B2_stA8f.d.mts +216 -0
  51. package/dist/ProcessorBuilder-B2_stA8f.d.mts.map +1 -0
  52. package/dist/ProcessorBuilder-C62bIOwj.d.cts +216 -0
  53. package/dist/ProcessorBuilder-C62bIOwj.d.cts.map +1 -0
  54. package/dist/{Queue-D9X6OoON.d.mts → Queue-BnK3UH8r.d.mts} +42 -41
  55. package/dist/Queue-BnK3UH8r.d.mts.map +1 -0
  56. package/dist/{Queue-DYPB2KWL.d.cts → Queue-C4rijiM7.d.cts} +43 -42
  57. package/dist/Queue-C4rijiM7.d.cts.map +1 -0
  58. package/dist/Queue-D4Iaidrs.cjs +109 -0
  59. package/dist/Queue-D4Iaidrs.cjs.map +1 -0
  60. package/dist/Queue-u8w8_HpE.mjs +104 -0
  61. package/dist/Queue-u8w8_HpE.mjs.map +1 -0
  62. package/dist/QueueBuilder-2wP5lEC8.mjs +118 -0
  63. package/dist/QueueBuilder-2wP5lEC8.mjs.map +1 -0
  64. package/dist/QueueBuilder-B3vL1ED2.d.mts +75 -0
  65. package/dist/QueueBuilder-B3vL1ED2.d.mts.map +1 -0
  66. package/dist/QueueBuilder-BcPBQSSX.d.cts +75 -0
  67. package/dist/QueueBuilder-BcPBQSSX.d.cts.map +1 -0
  68. package/dist/QueueBuilder-BxsZ9o5z.cjs +135 -0
  69. package/dist/QueueBuilder-BxsZ9o5z.cjs.map +1 -0
  70. package/dist/Subscriber-5rCX1Nph.d.cts +83 -0
  71. package/dist/Subscriber-5rCX1Nph.d.cts.map +1 -0
  72. package/dist/Subscriber-CW_Dl-YR.d.mts +83 -0
  73. package/dist/Subscriber-CW_Dl-YR.d.mts.map +1 -0
  74. package/dist/SubscriberBuilder-BL_GTcwh.mjs +237 -0
  75. package/dist/SubscriberBuilder-BL_GTcwh.mjs.map +1 -0
  76. package/dist/SubscriberBuilder-CWzKwX1p.cjs +260 -0
  77. package/dist/SubscriberBuilder-CWzKwX1p.cjs.map +1 -0
  78. package/dist/Topic-DN2gYJ-p.mjs +99 -0
  79. package/dist/Topic-DN2gYJ-p.mjs.map +1 -0
  80. package/dist/Topic-Dp9Q7Lj2.cjs +104 -0
  81. package/dist/Topic-Dp9Q7Lj2.cjs.map +1 -0
  82. package/dist/adaptors/aws.cjs +134 -160
  83. package/dist/adaptors/aws.cjs.map +1 -1
  84. package/dist/adaptors/aws.d.cts +57 -48
  85. package/dist/adaptors/aws.d.cts.map +1 -1
  86. package/dist/adaptors/aws.d.mts +58 -49
  87. package/dist/adaptors/aws.d.mts.map +1 -1
  88. package/dist/adaptors/aws.mjs +130 -157
  89. package/dist/adaptors/aws.mjs.map +1 -1
  90. package/dist/adaptors/hono.cjs +1 -1
  91. package/dist/adaptors/hono.d.cts +5 -6
  92. package/dist/adaptors/hono.d.cts.map +1 -1
  93. package/dist/adaptors/hono.d.mts +6 -7
  94. package/dist/adaptors/hono.d.mts.map +1 -1
  95. package/dist/adaptors/hono.mjs +1 -1
  96. package/dist/adaptors/testing.cjs +955 -38
  97. package/dist/adaptors/testing.cjs.map +1 -1
  98. package/dist/adaptors/testing.d.cts +437 -39
  99. package/dist/adaptors/testing.d.cts.map +1 -1
  100. package/dist/adaptors/testing.d.mts +436 -38
  101. package/dist/adaptors/testing.d.mts.map +1 -1
  102. package/dist/adaptors/testing.mjs +929 -34
  103. package/dist/adaptors/testing.mjs.map +1 -1
  104. package/dist/auth-BMCJN30Y.d.cts +268 -0
  105. package/dist/auth-BMCJN30Y.d.cts.map +1 -0
  106. package/dist/auth-D_0788uW.d.mts +268 -0
  107. package/dist/auth-D_0788uW.d.mts.map +1 -0
  108. package/dist/auth.cjs +290 -46
  109. package/dist/auth.cjs.map +1 -1
  110. package/dist/auth.d.cts +2 -104
  111. package/dist/auth.d.mts +2 -104
  112. package/dist/auth.mjs +286 -48
  113. package/dist/auth.mjs.map +1 -1
  114. package/dist/cache-5QZzh5Er.d.mts +44 -0
  115. package/dist/cache-5QZzh5Er.d.mts.map +1 -0
  116. package/dist/cache-DnGDGly3.d.cts +44 -0
  117. package/dist/cache-DnGDGly3.d.cts.map +1 -0
  118. package/dist/cache.d.cts +2 -43
  119. package/dist/cache.d.mts +2 -43
  120. package/dist/cipher-C1lEFX63.mjs +225 -0
  121. package/dist/cipher-C1lEFX63.mjs.map +1 -0
  122. package/dist/cipher-CVxfwLjk.cjs +332 -0
  123. package/dist/cipher-CVxfwLjk.cjs.map +1 -0
  124. package/dist/cipher-DSDxPRIp.d.cts +106 -0
  125. package/dist/cipher-DSDxPRIp.d.cts.map +1 -0
  126. package/dist/cipher-DSDxPRIp.d.mts +106 -0
  127. package/dist/cipher-DSDxPRIp.d.mts.map +1 -0
  128. package/dist/{construct-interface-DPlxfpoS.d.mts → construct-interface-B1AfqRl4.d.cts} +42 -8
  129. package/dist/construct-interface-B1AfqRl4.d.cts.map +1 -0
  130. package/dist/{construct-interface-DgXTJcOD.d.cts → construct-interface-ZvYQbivO.d.mts} +42 -8
  131. package/dist/construct-interface-ZvYQbivO.d.mts.map +1 -0
  132. package/dist/construct-interface.cjs +30 -4
  133. package/dist/construct-interface.cjs.map +1 -1
  134. package/dist/construct-interface.d.cts +2 -2
  135. package/dist/construct-interface.d.mts +2 -2
  136. package/dist/construct-interface.mjs +30 -5
  137. package/dist/construct-interface.mjs.map +1 -1
  138. package/dist/credential-DYymbp_7.cjs +257 -0
  139. package/dist/credential-DYymbp_7.cjs.map +1 -0
  140. package/dist/credential-DfSAOOdY.mjs +222 -0
  141. package/dist/credential-DfSAOOdY.mjs.map +1 -0
  142. package/dist/credential.cjs +7 -129
  143. package/dist/credential.d.cts +2 -58
  144. package/dist/credential.d.mts +2 -58
  145. package/dist/credential.mjs +2 -128
  146. package/dist/crons/index.cjs +126 -1
  147. package/dist/crons/index.cjs.map +1 -1
  148. package/dist/crons/index.d.cts +43 -3
  149. package/dist/crons/index.d.cts.map +1 -1
  150. package/dist/crons/index.d.mts +43 -3
  151. package/dist/crons/index.d.mts.map +1 -1
  152. package/dist/crons/index.mjs +125 -2
  153. package/dist/crons/index.mjs.map +1 -1
  154. package/dist/database/kysely.cjs +3 -194
  155. package/dist/database/kysely.d.cts +2 -149
  156. package/dist/database/kysely.d.mts +2 -149
  157. package/dist/database/kysely.mjs +2 -192
  158. package/dist/email.d.cts +1 -1
  159. package/dist/email.d.cts.map +1 -1
  160. package/dist/email.d.mts +2 -2
  161. package/dist/email.d.mts.map +1 -1
  162. package/dist/encryption/kms.cjs +95 -0
  163. package/dist/encryption/kms.cjs.map +1 -0
  164. package/dist/encryption/kms.d.cts +7 -0
  165. package/dist/encryption/kms.d.cts.map +1 -0
  166. package/dist/encryption/kms.d.mts +7 -0
  167. package/dist/encryption/kms.d.mts.map +1 -0
  168. package/dist/encryption/kms.mjs +93 -0
  169. package/dist/encryption/kms.mjs.map +1 -0
  170. package/dist/encryption.cjs +116 -0
  171. package/dist/encryption.cjs.map +1 -0
  172. package/dist/encryption.d.cts +37 -0
  173. package/dist/encryption.d.cts.map +1 -0
  174. package/dist/encryption.d.mts +37 -0
  175. package/dist/encryption.d.mts.map +1 -0
  176. package/dist/encryption.mjs +101 -0
  177. package/dist/encryption.mjs.map +1 -0
  178. package/dist/endpoints/index.cjs +32 -10
  179. package/dist/endpoints/index.d.cts +106 -3
  180. package/dist/endpoints/index.d.cts.map +1 -0
  181. package/dist/endpoints/index.d.mts +106 -3
  182. package/dist/endpoints/index.d.mts.map +1 -0
  183. package/dist/endpoints/index.mjs +6 -4
  184. package/dist/expire-C586zznE.d.cts +38 -0
  185. package/dist/expire-C586zznE.d.cts.map +1 -0
  186. package/dist/expire-C586zznE.d.mts +38 -0
  187. package/dist/expire-C586zznE.d.mts.map +1 -0
  188. package/dist/expire-CieftS01.cjs +67 -0
  189. package/dist/expire-CieftS01.cjs.map +1 -0
  190. package/dist/expire-CpzUAfr9.mjs +50 -0
  191. package/dist/expire-CpzUAfr9.mjs.map +1 -0
  192. package/dist/external-api.cjs +106 -0
  193. package/dist/external-api.cjs.map +1 -0
  194. package/dist/external-api.d.cts +2 -0
  195. package/dist/external-api.d.mts +2 -0
  196. package/dist/external-api.mjs +103 -0
  197. package/dist/external-api.mjs.map +1 -0
  198. package/dist/fake-BUgcX2Dk.d.cts +201 -0
  199. package/dist/fake-BUgcX2Dk.d.cts.map +1 -0
  200. package/dist/fake-D472nkKb.d.mts +201 -0
  201. package/dist/fake-D472nkKb.d.mts.map +1 -0
  202. package/dist/file-server.cjs +123 -30
  203. package/dist/file-server.cjs.map +1 -1
  204. package/dist/file-server.d.cts +115 -1
  205. package/dist/file-server.d.cts.map +1 -1
  206. package/dist/file-server.d.mts +115 -1
  207. package/dist/file-server.d.mts.map +1 -1
  208. package/dist/file-server.mjs +122 -32
  209. package/dist/file-server.mjs.map +1 -1
  210. package/dist/functions/index.cjs +1 -1
  211. package/dist/functions/index.d.cts +2 -1
  212. package/dist/functions/index.d.mts +2 -1
  213. package/dist/functions/index.mjs +1 -1
  214. package/dist/{functions-C53GW2eQ.mjs → functions-BvIDQKAA.mjs} +117 -22
  215. package/dist/functions-BvIDQKAA.mjs.map +1 -0
  216. package/dist/{functions-B6qCvfmy.cjs → functions-DLF6-IK8.cjs} +122 -18
  217. package/dist/functions-DLF6-IK8.cjs.map +1 -0
  218. package/dist/inbox-DZdICa8F.d.mts +195 -0
  219. package/dist/inbox-DZdICa8F.d.mts.map +1 -0
  220. package/dist/inbox-DqaxrpEk.d.cts +195 -0
  221. package/dist/inbox-DqaxrpEk.d.cts.map +1 -0
  222. package/dist/inbox.cjs +291 -0
  223. package/dist/inbox.cjs.map +1 -0
  224. package/dist/inbox.d.cts +2 -0
  225. package/dist/inbox.d.mts +2 -0
  226. package/dist/inbox.mjs +283 -0
  227. package/dist/inbox.mjs.map +1 -0
  228. package/dist/index-BtzMzhMA.d.cts +115 -0
  229. package/dist/index-BtzMzhMA.d.cts.map +1 -0
  230. package/dist/{index-CeEtxDmK.d.cts → index-DdRjYhiJ.d.cts} +42 -2
  231. package/dist/{index-CeEtxDmK.d.cts.map → index-DdRjYhiJ.d.cts.map} +1 -1
  232. package/dist/{index-CeEtxDmK.d.mts → index-DdRjYhiJ.d.mts} +42 -2
  233. package/dist/{index-CeEtxDmK.d.mts.map → index-DdRjYhiJ.d.mts.map} +1 -1
  234. package/dist/index-DuriFjYD.d.mts +115 -0
  235. package/dist/index-DuriFjYD.d.mts.map +1 -0
  236. package/dist/index.cjs +4 -1
  237. package/dist/index.d.cts +26 -3
  238. package/dist/index.d.cts.map +1 -0
  239. package/dist/index.d.mts +26 -3
  240. package/dist/index.d.mts.map +1 -0
  241. package/dist/index.mjs +3 -2
  242. package/dist/kysely-BHYV-WC-.d.cts +216 -0
  243. package/dist/kysely-BHYV-WC-.d.cts.map +1 -0
  244. package/dist/kysely-CAW3QSqp.d.mts +216 -0
  245. package/dist/kysely-CAW3QSqp.d.mts.map +1 -0
  246. package/dist/kysely-Cs4uPO8k.mjs +371 -0
  247. package/dist/kysely-Cs4uPO8k.mjs.map +1 -0
  248. package/dist/kysely-CukArHJ0.cjs +384 -0
  249. package/dist/kysely-CukArHJ0.cjs.map +1 -0
  250. package/dist/{telemetry-DGcFlVpB.d.cts → lambdaTelemetry-8vnmVZQ5.d.cts} +2 -2
  251. package/dist/lambdaTelemetry-8vnmVZQ5.d.cts.map +1 -0
  252. package/dist/{telemetry-DGcFlVpB.d.mts → lambdaTelemetry-8vnmVZQ5.d.mts} +2 -2
  253. package/dist/lambdaTelemetry-8vnmVZQ5.d.mts.map +1 -0
  254. package/dist/mobile-app.cjs +74 -0
  255. package/dist/mobile-app.cjs.map +1 -0
  256. package/dist/mobile-app.d.cts +73 -0
  257. package/dist/mobile-app.d.cts.map +1 -0
  258. package/dist/mobile-app.d.mts +73 -0
  259. package/dist/mobile-app.d.mts.map +1 -0
  260. package/dist/mobile-app.mjs +73 -0
  261. package/dist/mobile-app.mjs.map +1 -0
  262. package/dist/object-storage.cjs +8 -1
  263. package/dist/object-storage.cjs.map +1 -1
  264. package/dist/object-storage.d.cts +10 -1
  265. package/dist/object-storage.d.cts.map +1 -1
  266. package/dist/object-storage.d.mts +10 -1
  267. package/dist/object-storage.d.mts.map +1 -1
  268. package/dist/object-storage.mjs +7 -2
  269. package/dist/object-storage.mjs.map +1 -1
  270. package/dist/pattern-C1CEcglD.mjs +241 -0
  271. package/dist/pattern-C1CEcglD.mjs.map +1 -0
  272. package/dist/pattern-QFaUIr77.cjs +288 -0
  273. package/dist/pattern-QFaUIr77.cjs.map +1 -0
  274. package/dist/processors/index.cjs +214 -0
  275. package/dist/processors/index.cjs.map +1 -0
  276. package/dist/processors/index.d.cts +78 -0
  277. package/dist/processors/index.d.cts.map +1 -0
  278. package/dist/processors/index.d.mts +78 -0
  279. package/dist/processors/index.d.mts.map +1 -0
  280. package/dist/processors/index.mjs +193 -0
  281. package/dist/processors/index.mjs.map +1 -0
  282. package/dist/queue/index.cjs +5 -192
  283. package/dist/queue/index.d.cts +3 -53
  284. package/dist/queue/index.d.mts +3 -53
  285. package/dist/queue/index.mjs +3 -190
  286. package/dist/random-password.cjs +86 -0
  287. package/dist/random-password.cjs.map +1 -0
  288. package/dist/random-password.d.cts +30 -0
  289. package/dist/random-password.d.cts.map +1 -0
  290. package/dist/random-password.d.mts +30 -0
  291. package/dist/random-password.d.mts.map +1 -0
  292. package/dist/random-password.mjs +84 -0
  293. package/dist/random-password.mjs.map +1 -0
  294. package/dist/{lazyAccessors-BHtcqgz2.mjs → readRequestBody-BTIl3k-D.mjs} +99 -39
  295. package/dist/readRequestBody-BTIl3k-D.mjs.map +1 -0
  296. package/dist/{lazyAccessors-Dx9NLwJZ.cjs → readRequestBody-Dej_L3c4.cjs} +118 -46
  297. package/dist/readRequestBody-Dej_L3c4.cjs.map +1 -0
  298. package/dist/requestLogger-BZcXwdBs.cjs +207 -0
  299. package/dist/requestLogger-BZcXwdBs.cjs.map +1 -0
  300. package/dist/requestLogger-pA4gi3E1.mjs +178 -0
  301. package/dist/requestLogger-pA4gi3E1.mjs.map +1 -0
  302. package/dist/rest-api.cjs +74 -70
  303. package/dist/rest-api.cjs.map +1 -1
  304. package/dist/rest-api.d.cts +69 -58
  305. package/dist/rest-api.d.cts.map +1 -1
  306. package/dist/rest-api.d.mts +69 -58
  307. package/dist/rest-api.d.mts.map +1 -1
  308. package/dist/rest-api.mjs +74 -70
  309. package/dist/rest-api.mjs.map +1 -1
  310. package/dist/runSubscriber-CC_2C9F2.cjs +133 -0
  311. package/dist/runSubscriber-CC_2C9F2.cjs.map +1 -0
  312. package/dist/runSubscriber-DyHWp_Lf.mjs +116 -0
  313. package/dist/runSubscriber-DyHWp_Lf.mjs.map +1 -0
  314. package/dist/shutdown-BMJmAhSt.cjs +38 -0
  315. package/dist/shutdown-BMJmAhSt.cjs.map +1 -0
  316. package/dist/shutdown-C7xa8x9S.mjs +27 -0
  317. package/dist/shutdown-C7xa8x9S.mjs.map +1 -0
  318. package/dist/site.cjs +64 -4
  319. package/dist/site.cjs.map +1 -1
  320. package/dist/site.d.cts +90 -1
  321. package/dist/site.d.cts.map +1 -1
  322. package/dist/site.d.mts +90 -1
  323. package/dist/site.d.mts.map +1 -1
  324. package/dist/site.mjs +62 -6
  325. package/dist/site.mjs.map +1 -1
  326. package/dist/stages-DaTaoQei.d.cts +73 -0
  327. package/dist/stages-DaTaoQei.d.cts.map +1 -0
  328. package/dist/stages-DaTaoQei.d.mts +73 -0
  329. package/dist/stages-DaTaoQei.d.mts.map +1 -0
  330. package/dist/subscribers/index.cjs +134 -1
  331. package/dist/subscribers/index.cjs.map +1 -0
  332. package/dist/subscribers/index.d.cts +74 -3
  333. package/dist/subscribers/index.d.cts.map +1 -0
  334. package/dist/subscribers/index.d.mts +74 -3
  335. package/dist/subscribers/index.d.mts.map +1 -0
  336. package/dist/subscribers/index.mjs +132 -2
  337. package/dist/subscribers/index.mjs.map +1 -0
  338. package/dist/telemetry-B48RLjyk.d.cts +40 -0
  339. package/dist/telemetry-B48RLjyk.d.cts.map +1 -0
  340. package/dist/telemetry-BEoBn6GO.d.mts +40 -0
  341. package/dist/telemetry-BEoBn6GO.d.mts.map +1 -0
  342. package/dist/telemetry.cjs +56 -0
  343. package/dist/telemetry.cjs.map +1 -0
  344. package/dist/telemetry.d.cts +2 -0
  345. package/dist/telemetry.d.mts +2 -0
  346. package/dist/telemetry.mjs +55 -0
  347. package/dist/telemetry.mjs.map +1 -0
  348. package/dist/topic/index.cjs +2 -134
  349. package/dist/topic/index.d.cts +2 -3
  350. package/dist/topic/index.d.mts +2 -3
  351. package/dist/topic/index.mjs +2 -132
  352. package/dist/tracing-Bbj1uoFJ.mjs +127 -0
  353. package/dist/tracing-Bbj1uoFJ.mjs.map +1 -0
  354. package/dist/tracing-C0ooU0V2.cjs +150 -0
  355. package/dist/tracing-C0ooU0V2.cjs.map +1 -0
  356. package/dist/websocket-api.cjs +762 -0
  357. package/dist/websocket-api.cjs.map +1 -0
  358. package/dist/websocket-api.d.cts +443 -0
  359. package/dist/websocket-api.d.cts.map +1 -0
  360. package/dist/websocket-api.d.mts +443 -0
  361. package/dist/websocket-api.d.mts.map +1 -0
  362. package/dist/websocket-api.mjs +748 -0
  363. package/dist/websocket-api.mjs.map +1 -0
  364. package/dist/worker.cjs +140 -32
  365. package/dist/worker.cjs.map +1 -1
  366. package/dist/worker.d.cts +139 -47
  367. package/dist/worker.d.cts.map +1 -1
  368. package/dist/worker.d.mts +139 -47
  369. package/dist/worker.d.mts.map +1 -1
  370. package/dist/worker.mjs +141 -33
  371. package/dist/worker.mjs.map +1 -1
  372. package/package.json +155 -44
  373. package/dist/Construct-BeYVu_QF.mjs.map +0 -1
  374. package/dist/Construct-DfbwIntp.d.cts +0 -115
  375. package/dist/Construct-DfbwIntp.d.cts.map +0 -1
  376. package/dist/Construct-DqdlARxq.cjs.map +0 -1
  377. package/dist/Construct-l5aOn_jv.d.mts +0 -115
  378. package/dist/Construct-l5aOn_jv.d.mts.map +0 -1
  379. package/dist/Cron-DKqnnTdH.d.cts.map +0 -1
  380. package/dist/Cron-SyqS5oWJ.d.mts.map +0 -1
  381. package/dist/CronBuilder-BdnI6lxF.cjs.map +0 -1
  382. package/dist/CronBuilder-CRGnDfTq.d.mts +0 -41
  383. package/dist/CronBuilder-CRGnDfTq.d.mts.map +0 -1
  384. package/dist/CronBuilder-D_0HNBTr.mjs.map +0 -1
  385. package/dist/CronBuilder-Df1q9PNy.d.cts +0 -41
  386. package/dist/CronBuilder-Df1q9PNy.d.cts.map +0 -1
  387. package/dist/Endpoint-BpZHtJ2W.cjs +0 -1689
  388. package/dist/Endpoint-BpZHtJ2W.cjs.map +0 -1
  389. package/dist/Endpoint-C6yyHpRS.d.cts.map +0 -1
  390. package/dist/Endpoint-DuT4TEEq.d.mts.map +0 -1
  391. package/dist/Endpoint-ONsly_dq.mjs +0 -1671
  392. package/dist/Endpoint-ONsly_dq.mjs.map +0 -1
  393. package/dist/EndpointFactory-Bm3aKRdV.mjs.map +0 -1
  394. package/dist/EndpointFactory-CLvWuHyt.cjs.map +0 -1
  395. package/dist/HonoEndpointAdaptor-92zavCsV.cjs.map +0 -1
  396. package/dist/HonoEndpointAdaptor-yYaU7jVJ.mjs.map +0 -1
  397. package/dist/Queue-D9X6OoON.d.mts.map +0 -1
  398. package/dist/Queue-DYPB2KWL.d.cts.map +0 -1
  399. package/dist/Subscriber-C4heaAyO.d.mts +0 -51
  400. package/dist/Subscriber-C4heaAyO.d.mts.map +0 -1
  401. package/dist/Subscriber-CotDUELC.d.cts +0 -51
  402. package/dist/Subscriber-CotDUELC.d.cts.map +0 -1
  403. package/dist/SubscriberBuilder-BEv0eoHy.d.cts +0 -59
  404. package/dist/SubscriberBuilder-BEv0eoHy.d.cts.map +0 -1
  405. package/dist/SubscriberBuilder-C0ZEtGDI.cjs +0 -125
  406. package/dist/SubscriberBuilder-C0ZEtGDI.cjs.map +0 -1
  407. package/dist/SubscriberBuilder-h7B_cHMr.mjs +0 -114
  408. package/dist/SubscriberBuilder-h7B_cHMr.mjs.map +0 -1
  409. package/dist/SubscriberBuilder-tyH5yTk5.d.mts +0 -59
  410. package/dist/SubscriberBuilder-tyH5yTk5.d.mts.map +0 -1
  411. package/dist/Topic-DEVGo0Dm.d.cts +0 -89
  412. package/dist/Topic-DEVGo0Dm.d.cts.map +0 -1
  413. package/dist/Topic-zk_6Gthr.d.mts +0 -89
  414. package/dist/Topic-zk_6Gthr.d.mts.map +0 -1
  415. package/dist/auth.d.cts.map +0 -1
  416. package/dist/auth.d.mts.map +0 -1
  417. package/dist/cache.d.cts.map +0 -1
  418. package/dist/cache.d.mts.map +0 -1
  419. package/dist/construct-interface-DPlxfpoS.d.mts.map +0 -1
  420. package/dist/construct-interface-DgXTJcOD.d.cts.map +0 -1
  421. package/dist/credential.cjs.map +0 -1
  422. package/dist/credential.d.cts.map +0 -1
  423. package/dist/credential.d.mts.map +0 -1
  424. package/dist/credential.mjs.map +0 -1
  425. package/dist/database/kysely.cjs.map +0 -1
  426. package/dist/database/kysely.d.cts.map +0 -1
  427. package/dist/database/kysely.d.mts.map +0 -1
  428. package/dist/database/kysely.mjs.map +0 -1
  429. package/dist/functions-B6qCvfmy.cjs.map +0 -1
  430. package/dist/functions-C53GW2eQ.mjs.map +0 -1
  431. package/dist/index-B2urf3YI.d.cts +0 -26
  432. package/dist/index-B2urf3YI.d.cts.map +0 -1
  433. package/dist/index-BPSZ_Lp_.d.cts.map +0 -1
  434. package/dist/index-BoZ-iisU.d.mts.map +0 -1
  435. package/dist/index-CdaU--_B.d.cts +0 -165
  436. package/dist/index-CdaU--_B.d.cts.map +0 -1
  437. package/dist/index-DMCDvnsM.d.mts +0 -26
  438. package/dist/index-DMCDvnsM.d.mts.map +0 -1
  439. package/dist/index-PQRWOQj4.d.mts +0 -165
  440. package/dist/index-PQRWOQj4.d.mts.map +0 -1
  441. package/dist/lazyAccessors-BHtcqgz2.mjs.map +0 -1
  442. package/dist/lazyAccessors-Dx9NLwJZ.cjs.map +0 -1
  443. package/dist/processAudits-BpRlPQMW.mjs +0 -77
  444. package/dist/processAudits-BpRlPQMW.mjs.map +0 -1
  445. package/dist/processAudits-D_2W5x8k.cjs +0 -88
  446. package/dist/processAudits-D_2W5x8k.cjs.map +0 -1
  447. package/dist/queue/index.cjs.map +0 -1
  448. package/dist/queue/index.d.cts.map +0 -1
  449. package/dist/queue/index.d.mts.map +0 -1
  450. package/dist/queue/index.mjs.map +0 -1
  451. package/dist/telemetry-DGcFlVpB.d.cts.map +0 -1
  452. package/dist/telemetry-DGcFlVpB.d.mts.map +0 -1
  453. package/dist/topic/index.cjs.map +0 -1
  454. package/dist/topic/index.mjs.map +0 -1
@@ -0,0 +1,576 @@
1
+ require("./Construct-DorKS0Ua.cjs");
2
+ const require_tracing = require("./tracing-C0ooU0V2.cjs");
3
+ const require_functions = require("./functions-DLF6-IK8.cjs");
4
+ let _geekmidas_schema_conversion = require("@geekmidas/schema/conversion");
5
+ let _geekmidas_schema_openapi = require("@geekmidas/schema/openapi");
6
+ //#region src/endpoints/sessionAuth.ts
7
+ /**
8
+ * What is forwarded to the auth server: the headers a session travels in, and
9
+ * whose request it is — nothing else.
10
+ *
11
+ * The client's address goes with the session because the auth server
12
+ * rate-limits by it, `/get-session` included. Without it every user's session
13
+ * check arrived from the surface itself — one shared bucket, so enough
14
+ * traffic from anyone turned every session check into a 429 — and in tests,
15
+ * concurrent tests queued on the same rate-limit row.
16
+ */
17
+ const SESSION_HEADERS = [
18
+ "cookie",
19
+ "authorization",
20
+ "x-forwarded-for"
21
+ ];
22
+ /** `auth` for one request on one surface. */
23
+ function sessionAuth(surface, header) {
24
+ return { async getSession() {
25
+ const authenticator = surface?.auth;
26
+ if (!surface || !authenticator) throw new NoAuthenticator(surface?.id);
27
+ const headers = new Headers();
28
+ for (const name of SESSION_HEADERS) {
29
+ const value = header(name);
30
+ if (value) headers.set(name, value);
31
+ }
32
+ const session = await authenticator.verify(headers, surface.envParser);
33
+ const identity = session;
34
+ if (typeof identity?.user?.id === "string") require_tracing.identifyUser({
35
+ id: identity.user.id,
36
+ ...typeof identity.session?.id === "string" ? { sessionId: identity.session.id } : {}
37
+ });
38
+ return session;
39
+ } };
40
+ }
41
+ /** `auth.getSession()` was called on a surface that names no authenticator. */
42
+ var NoAuthenticator = class extends Error {
43
+ surface;
44
+ constructor(surface) {
45
+ super(`auth.getSession() needs an authenticator, and ${surface ? `the surface '${surface}'` : "this endpoint"} declares none: declare one on the surface with .auth(construct).`);
46
+ this.surface = surface;
47
+ this.name = "NoAuthenticator";
48
+ }
49
+ };
50
+ //#endregion
51
+ //#region src/endpoints/Endpoint.ts
52
+ /**
53
+ * Represents an HTTP endpoint that can handle requests with type-safe input/output validation,
54
+ * dependency injection, session management, and authorization.
55
+ *
56
+ * @template TRoute - The route path string with parameter placeholders (e.g., '/users/:id')
57
+ * @template TMethod - The HTTP method (GET, POST, PUT, DELETE, PATCH)
58
+ * @template TInput - The input schema definition for body, query, and path parameters
59
+ * @template OutSchema - The output schema for response validation
60
+ * @template TServices - Array of service dependencies to inject
61
+ * @template TLogger - The logger instance type
62
+ * @template TSession - The session data type
63
+ *
64
+ * @extends Function - Base function construct for handler execution
65
+ *
66
+ * @example
67
+ * ```typescript
68
+ * const endpoint = new Endpoint({
69
+ * route: '/users/:id',
70
+ * method: 'GET',
71
+ * input: { params: userIdSchema },
72
+ * output: userSchema,
73
+ * fn: async ({ params }) => getUserById(params.id)
74
+ * });
75
+ * ```
76
+ */
77
+ var Endpoint = class Endpoint extends require_functions.Function {
78
+ operationId;
79
+ /** The route path pattern with parameter placeholders */
80
+ route;
81
+ /** The HTTP method for this endpoint */
82
+ method;
83
+ /**
84
+ * The surface that serves it, when it was built from one.
85
+ *
86
+ * Carries the env parser the adaptors need, so a generated handler needs no
87
+ * import written for it — and the surface's id, so the build attributes the
88
+ * route to the API that serves it rather than inferring it by exclusion.
89
+ */
90
+ surface;
91
+ /** Optional description for OpenAPI documentation */
92
+ description;
93
+ /** Optional tags for OpenAPI documentation */
94
+ tags;
95
+ /** The HTTP status code to return (default: 200) */
96
+ status;
97
+ /**
98
+ * Response content type for this endpoint. Defaults to `'application/json'`.
99
+ * Non-JSON types cause adaptors to emit the body as-is with the declared
100
+ * Content-Type header instead of JSON-serializing.
101
+ */
102
+ responseType;
103
+ /**
104
+ * This route's telemetry — `.telemetry({ ignore, attributes })` — read by
105
+ * the build, which hands it to the request middleware.
106
+ */
107
+ telemetry;
108
+ /** Default headers to apply to all responses */
109
+ defaultHeaders = {};
110
+ /** Function to extract session data from the request context */
111
+ getSession = () => ({});
112
+ /**
113
+ * Whether a session callback was given — `.session()` on the factory it was
114
+ * built from. A generated handler reads the session only when it is, so
115
+ * an endpoint with a session and no authorizer must say so: it used to be
116
+ * handed `undefined` in a production build and its session in `gkm dev`.
117
+ */
118
+ hasSession = false;
119
+ /** Function to determine if the request is authorized */
120
+ authorize = () => true;
121
+ /** Optional rate limiting configuration */
122
+ rateLimit;
123
+ /** Optional authorizer for this endpoint */
124
+ authorizer;
125
+ /** Optional actor extractor for audit records */
126
+ actorExtractor;
127
+ /** Declarative audit definitions */
128
+ audits = [];
129
+ /** RLS configuration for this endpoint */
130
+ rlsConfig;
131
+ /** Whether to bypass RLS for this endpoint */
132
+ rlsBypass;
133
+ /** The endpoint handler function */
134
+ endpointFn;
135
+ /**
136
+ * Builds a complete OpenAPI 3.1 schema from an array of endpoints.
137
+ *
138
+ * @param endpoints - Array of endpoint instances to document
139
+ * @param options - Optional configuration for OpenAPI generation
140
+ * @returns OpenAPI 3.1 specification object
141
+ *
142
+ * @example
143
+ * ```typescript
144
+ * const schema = await Endpoint.buildOpenApiSchema([
145
+ * getUserEndpoint,
146
+ * createUserEndpoint
147
+ * ], {
148
+ * title: 'User API',
149
+ * version: '1.0.0'
150
+ * });
151
+ * ```
152
+ */
153
+ static async buildOpenApiSchema(endpoints, options) {
154
+ return (0, _geekmidas_schema_openapi.buildOpenApiSchema)(endpoints, options);
155
+ }
156
+ /**
157
+ * Gets the full path including HTTP method and route.
158
+ * @returns Formatted string like 'GET /users/{id}'
159
+ */
160
+ get fullPath() {
161
+ return `${this.method} ${this._path}`;
162
+ }
163
+ /**
164
+ * Parses and validates input data for a specific input type (body, query, params).
165
+ *
166
+ * @param input - The raw input data to validate
167
+ * @param key - The input type key ('body', 'query', or 'params')
168
+ * @returns The validated input data for the specified key
169
+ * @throws {UnprocessableEntityError} When validation fails
170
+ */
171
+ async parseInput(input, key) {
172
+ const schema = this.input?.[key];
173
+ return Endpoint.parseSchema(schema, input);
174
+ }
175
+ /**
176
+ * Parses and validates the request body against the body schema.
177
+ *
178
+ * @param body - The raw request body to validate
179
+ * @returns The validated body data
180
+ * @throws {UnprocessableEntityError} When body validation fails
181
+ */
182
+ async parseBody(body) {
183
+ return this.parseInput(body, "body");
184
+ }
185
+ static isSuccessStatus(status) {
186
+ return status >= 200 && status < 300;
187
+ }
188
+ /**
189
+ * Whether `status` sends the client elsewhere. A redirect has no body, so
190
+ * its response is not checked against the output schema, and what is
191
+ * derived from the output — declared events and audits — is not sent.
192
+ */
193
+ static isRedirectStatus(status) {
194
+ return status !== void 0 && status >= 300 && status < 400;
195
+ }
196
+ /**
197
+ * Creates a case-insensitive header lookup function from a headers object.
198
+ *
199
+ * @param headers - Object containing header key-value pairs
200
+ * @returns Function to retrieve header values by case-insensitive key, or all headers
201
+ *
202
+ * @example
203
+ * ```typescript
204
+ * const headerFn = Endpoint.createHeaders({ 'Content-Type': 'application/json' });
205
+ * headerFn('content-type'); // Returns 'application/json'
206
+ * headerFn(); // Returns { 'content-type': 'application/json' }
207
+ * ```
208
+ */
209
+ static createHeaders(headers) {
210
+ const headerMap = /* @__PURE__ */ new Map();
211
+ for (const [k, v] of Object.entries(headers)) {
212
+ const key = k.toLowerCase();
213
+ headerMap.set(key, v);
214
+ }
215
+ function get(key) {
216
+ if (key === void 0) return Object.fromEntries(headerMap.entries());
217
+ return headerMap.get(key.toLowerCase());
218
+ }
219
+ return get;
220
+ }
221
+ /**
222
+ * Parses cookie string and creates a cookie lookup function.
223
+ *
224
+ * @param cookieHeader - The Cookie header value
225
+ * @returns Function to retrieve cookie values by name, or all cookies
226
+ *
227
+ * @example
228
+ * ```typescript
229
+ * const cookieFn = Endpoint.createCookies('session=abc123; theme=dark');
230
+ * cookieFn('session'); // Returns 'abc123'
231
+ * cookieFn(); // Returns { session: 'abc123', theme: 'dark' }
232
+ * ```
233
+ */
234
+ static createCookies(cookieHeader) {
235
+ const cookieMap = /* @__PURE__ */ new Map();
236
+ if (cookieHeader) {
237
+ const cookies = cookieHeader.split(";");
238
+ for (const cookie of cookies) {
239
+ const [name, ...valueParts] = cookie.trim().split("=");
240
+ if (name) {
241
+ const value = valueParts.join("=");
242
+ cookieMap.set(name, decodeURIComponent(value));
243
+ }
244
+ }
245
+ }
246
+ function get(name) {
247
+ if (name === void 0) return Object.fromEntries(cookieMap.entries());
248
+ return cookieMap.get(name);
249
+ }
250
+ return get;
251
+ }
252
+ /**
253
+ * Formats a cookie as a Set-Cookie header string.
254
+ *
255
+ * @param name - Cookie name
256
+ * @param value - Cookie value
257
+ * @param options - Cookie options (httpOnly, secure, sameSite, etc.)
258
+ * @returns Formatted Set-Cookie header string
259
+ *
260
+ * @example
261
+ * ```typescript
262
+ * const header = Endpoint.formatCookieHeader('session', 'abc123', {
263
+ * httpOnly: true,
264
+ * secure: true,
265
+ * sameSite: 'strict',
266
+ * maxAge: 3600
267
+ * });
268
+ * // Returns: "session=abc123; Max-Age=3600; HttpOnly; Secure; SameSite=Strict"
269
+ * ```
270
+ */
271
+ static formatCookieHeader(name, value, options) {
272
+ let cookie = `${name}=${value}`;
273
+ if (options) {
274
+ if (options.domain) cookie += `; Domain=${options.domain}`;
275
+ if (options.path) cookie += `; Path=${options.path}`;
276
+ if (options.expires) cookie += `; Expires=${options.expires.toUTCString()}`;
277
+ if (options.maxAge !== void 0) cookie += `; Max-Age=${options.maxAge}`;
278
+ if (options.httpOnly) cookie += "; HttpOnly";
279
+ if (options.secure) cookie += "; Secure";
280
+ if (options.sameSite) cookie += `; SameSite=${options.sameSite.charAt(0).toUpperCase() + options.sameSite.slice(1)}`;
281
+ }
282
+ return cookie;
283
+ }
284
+ /**
285
+ * Extracts and refines input data from the endpoint context.
286
+ *
287
+ * @param ctx - The endpoint execution context
288
+ * @returns Object containing only the input data (body, query, params)
289
+ * @internal
290
+ */
291
+ refineInput(ctx) {
292
+ const input = {};
293
+ for (const key of [
294
+ "body",
295
+ "query",
296
+ "params"
297
+ ]) if (key in ctx) input[key] = ctx[key];
298
+ return input;
299
+ }
300
+ handler = (ctx, response) => {
301
+ for (const [key, value] of Object.entries(this.defaultHeaders)) response.header(key, value);
302
+ const handlerCtx = {
303
+ ...this.refineInput(ctx),
304
+ services: ctx.services,
305
+ logger: ctx.logger,
306
+ header: ctx.header,
307
+ cookie: ctx.cookie,
308
+ session: ctx.session,
309
+ ..."auditor" in ctx && { auditor: ctx.auditor },
310
+ ..."db" in ctx && { db: ctx.db }
311
+ };
312
+ return this.endpointFn(handlerCtx, response);
313
+ };
314
+ /**
315
+ * Type guard to check if an object is an Endpoint instance.
316
+ *
317
+ * @param obj - The object to check
318
+ * @returns True if the object is an Endpoint
319
+ */
320
+ static isEndpoint(obj) {
321
+ return Boolean(obj && obj.__IS_FUNCTION__ === true && obj.type === "dev.geekmidas.function.endpoint");
322
+ }
323
+ /**
324
+ * Helper to check if response has metadata
325
+ */
326
+ static hasMetadata(response) {
327
+ return response !== null && typeof response === "object" && "data" in response && "metadata" in response;
328
+ }
329
+ /**
330
+ * Converts Express-style route params to OpenAPI format.
331
+ * @returns Route with ':param' converted to '{param}'
332
+ * @internal
333
+ */
334
+ get _path() {
335
+ return this.route.replace(/:(\w+)/g, "{$1}");
336
+ }
337
+ /**
338
+ * Generates OpenAPI 3.1 schema for this endpoint.
339
+ *
340
+ * @returns OpenAPI route definition with operation details
341
+ */
342
+ async toOpenApi3Route(componentCollector) {
343
+ const status = String(this.status);
344
+ const operation = {
345
+ operationId: this.operationId,
346
+ ...this.description && { description: this.description },
347
+ ...this.tags && this.tags.length > 0 && { tags: this.tags },
348
+ responses: { [status]: { description: "Successful response" } }
349
+ };
350
+ const scheme = this.authorizer?.securityScheme;
351
+ if (this.authorizer && scheme && componentCollector) {
352
+ componentCollector.addSecurityScheme(this.authorizer.name, scheme);
353
+ operation.security = [{ [this.authorizer.name]: [] }];
354
+ }
355
+ if (this.outputSchema) {
356
+ const responseSchema = await (0, _geekmidas_schema_conversion.convertSchemaWithComponents)(this.outputSchema, componentCollector);
357
+ if (responseSchema) operation.responses[status].content = { [this.responseType]: { schema: responseSchema } };
358
+ }
359
+ const pathParameters = [];
360
+ const queryParameters = [];
361
+ if (this.input && typeof this.input === "object") {
362
+ if ([
363
+ "POST",
364
+ "PUT",
365
+ "PATCH"
366
+ ].includes(this.method) && "body" in this.input && this.input.body) {
367
+ const bodySchema = await (0, _geekmidas_schema_conversion.convertSchemaWithComponents)(this.input.body, componentCollector);
368
+ if (bodySchema) operation.requestBody = {
369
+ required: true,
370
+ content: { "application/json": { schema: bodySchema } }
371
+ };
372
+ }
373
+ if ("params" in this.input && this.input.params) {
374
+ const paramsSchema = await (0, _geekmidas_schema_conversion.convertStandardSchemaToJsonSchema)(this.input.params);
375
+ if (paramsSchema && paramsSchema.type === "object" && paramsSchema.properties) for (const [name, schema] of Object.entries(paramsSchema.properties)) pathParameters.push({
376
+ name,
377
+ in: "path",
378
+ required: paramsSchema.required?.includes(name) ?? true,
379
+ schema
380
+ });
381
+ }
382
+ if ("query" in this.input && this.input.query) {
383
+ const querySchema = await (0, _geekmidas_schema_conversion.convertStandardSchemaToJsonSchema)(this.input.query);
384
+ if (querySchema && querySchema.type === "object" && querySchema.properties) for (const [name, schema] of Object.entries(querySchema.properties)) queryParameters.push({
385
+ name,
386
+ in: "query",
387
+ required: querySchema.required?.includes(name) ?? false,
388
+ schema
389
+ });
390
+ }
391
+ }
392
+ if (queryParameters.length > 0) operation.parameters = queryParameters;
393
+ const routeObject = {};
394
+ if (pathParameters.length > 0) routeObject.parameters = pathParameters;
395
+ routeObject[this.method.toLowerCase()] = operation;
396
+ return { [this._path]: routeObject };
397
+ }
398
+ /**
399
+ * Creates a new Endpoint instance.
400
+ *
401
+ * @param options - Configuration options for the endpoint
402
+ * @param options.fn - The handler function to execute
403
+ * @param options.method - HTTP method
404
+ * @param options.route - Route path with parameter placeholders
405
+ * @param options.description - Optional description for documentation
406
+ * @param options.input - Input schemas for validation
407
+ * @param options.logger - Logger instance
408
+ * @param options.output - Output schema for response validation
409
+ * @param options.services - Service dependencies
410
+ * @param options.timeout - Execution timeout in milliseconds
411
+ * @param options.getSession - Session extraction function
412
+ * @param options.authorize - Authorization check function
413
+ * @param options.status - Success HTTP status code (default: 200)
414
+ * @param options.authorizer - Optional authorizer configuration
415
+ */
416
+ constructor({ fn, method, route, description, tags, input, logger, output: outputSchema, services, constructs, timeout, memorySize, getSession, authorize, rateLimit, status = 200, events, authorizer, surface, auditorStorageService, actorExtractor, audits, databaseService, rlsConfig, rlsBypass, responseType, telemetry }) {
417
+ super(fn, timeout, "dev.geekmidas.function.endpoint", input, outputSchema, services, logger, events, memorySize, auditorStorageService, void 0, constructs);
418
+ this.route = route;
419
+ this.method = method;
420
+ this.description = description;
421
+ this.tags = tags;
422
+ this.status = status;
423
+ this.responseType = responseType ?? "application/json";
424
+ this.endpointFn = fn;
425
+ if (telemetry) this.telemetry = telemetry;
426
+ if (getSession) {
427
+ this.hasSession = true;
428
+ this.getSession = (ctx) => getSession({
429
+ ...ctx,
430
+ auth: sessionAuth(surface, ctx.header)
431
+ });
432
+ }
433
+ if (authorize) this.authorize = authorize;
434
+ if (rateLimit) this.rateLimit = rateLimit;
435
+ if (authorizer) this.authorizer = authorizer;
436
+ this.surface = surface;
437
+ if (actorExtractor) this.actorExtractor = actorExtractor;
438
+ if (audits) this.audits = audits;
439
+ if (databaseService) this.databaseService = databaseService;
440
+ if (rlsConfig) this.rlsConfig = rlsConfig;
441
+ if (rlsBypass) this.rlsBypass = rlsBypass;
442
+ }
443
+ };
444
+ /**
445
+ * Response builder for fluent API in handlers
446
+ */
447
+ var ResponseBuilder = class {
448
+ metadata = {
449
+ headers: {},
450
+ cookies: /* @__PURE__ */ new Map()
451
+ };
452
+ header(key, value) {
453
+ this.metadata.headers[key] = value;
454
+ return this;
455
+ }
456
+ cookie(name, value, options) {
457
+ this.metadata.cookies?.set(name, {
458
+ value,
459
+ options
460
+ });
461
+ return this;
462
+ }
463
+ deleteCookie(name, options) {
464
+ this.metadata.cookies?.set(name, {
465
+ value: "",
466
+ options: {
467
+ ...options,
468
+ maxAge: 0,
469
+ expires: /* @__PURE__ */ new Date(0)
470
+ }
471
+ });
472
+ return this;
473
+ }
474
+ status(code) {
475
+ this.metadata.status = code;
476
+ return this;
477
+ }
478
+ /**
479
+ * Send the client to `url` — `Location` and a 3xx, with no body. 303 by
480
+ * default: after a form post, the browser follows it with a GET, so a
481
+ * reload does not post the form again.
482
+ *
483
+ * A redirect is not checked against the endpoint's `.output()` schema, so
484
+ * an endpoint that renders a page can redirect instead.
485
+ *
486
+ * @example
487
+ * ```typescript
488
+ * return response.cookie('session', token).redirect('/dashboard');
489
+ * ```
490
+ */
491
+ redirect(url, status = 303) {
492
+ this.metadata.headers.location = url;
493
+ this.metadata.status = status;
494
+ return {
495
+ data: void 0,
496
+ metadata: this.metadata
497
+ };
498
+ }
499
+ send(data) {
500
+ return {
501
+ data,
502
+ metadata: this.metadata
503
+ };
504
+ }
505
+ getMetadata() {
506
+ return this.metadata;
507
+ }
508
+ };
509
+ /**
510
+ * HTTP success status codes that can be returned by endpoints.
511
+ */
512
+ let SuccessStatus = /* @__PURE__ */ function(SuccessStatus) {
513
+ /** Standard response for successful HTTP requests */
514
+ SuccessStatus[SuccessStatus["OK"] = 200] = "OK";
515
+ /** Request has been fulfilled and resulted in a new resource being created */
516
+ SuccessStatus[SuccessStatus["Created"] = 201] = "Created";
517
+ /** Request has been accepted for processing, but processing is not complete */
518
+ SuccessStatus[SuccessStatus["Accepted"] = 202] = "Accepted";
519
+ /** Server successfully processed the request but is not returning any content */
520
+ SuccessStatus[SuccessStatus["NoContent"] = 204] = "NoContent";
521
+ /** Server successfully processed the request and is not returning any content, client should reset the document view */
522
+ SuccessStatus[SuccessStatus["ResetContent"] = 205] = "ResetContent";
523
+ /** Server is delivering only part of the resource due to a range header */
524
+ SuccessStatus[SuccessStatus["PartialContent"] = 206] = "PartialContent";
525
+ return SuccessStatus;
526
+ }({});
527
+ /**
528
+ * HTTP redirect status codes an endpoint can answer with —
529
+ * `response.redirect(url, status)`, or `.status()` with a `Location` header.
530
+ */
531
+ let RedirectStatus = /* @__PURE__ */ function(RedirectStatus) {
532
+ /** The resource has moved for good; a POST may become a GET */
533
+ RedirectStatus[RedirectStatus["MovedPermanently"] = 301] = "MovedPermanently";
534
+ /** The resource is elsewhere for now; a POST may become a GET */
535
+ RedirectStatus[RedirectStatus["Found"] = 302] = "Found";
536
+ /** See the resource elsewhere, with a GET — the answer to a form post */
537
+ RedirectStatus[RedirectStatus["SeeOther"] = 303] = "SeeOther";
538
+ /** The resource is elsewhere for now; the method and body are kept */
539
+ RedirectStatus[RedirectStatus["TemporaryRedirect"] = 307] = "TemporaryRedirect";
540
+ /** The resource has moved for good; the method and body are kept */
541
+ RedirectStatus[RedirectStatus["PermanentRedirect"] = 308] = "PermanentRedirect";
542
+ return RedirectStatus;
543
+ }({});
544
+ //#endregion
545
+ Object.defineProperty(exports, "Endpoint", {
546
+ enumerable: true,
547
+ get: function() {
548
+ return Endpoint;
549
+ }
550
+ });
551
+ Object.defineProperty(exports, "NoAuthenticator", {
552
+ enumerable: true,
553
+ get: function() {
554
+ return NoAuthenticator;
555
+ }
556
+ });
557
+ Object.defineProperty(exports, "RedirectStatus", {
558
+ enumerable: true,
559
+ get: function() {
560
+ return RedirectStatus;
561
+ }
562
+ });
563
+ Object.defineProperty(exports, "ResponseBuilder", {
564
+ enumerable: true,
565
+ get: function() {
566
+ return ResponseBuilder;
567
+ }
568
+ });
569
+ Object.defineProperty(exports, "SuccessStatus", {
570
+ enumerable: true,
571
+ get: function() {
572
+ return SuccessStatus;
573
+ }
574
+ });
575
+
576
+ //# sourceMappingURL=Endpoint-BcUorcBa.cjs.map