@geekmidas/constructs 9.0.2 → 10.0.0-alpha.1

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 (385) hide show
  1. package/README.md +71 -44
  2. package/dist/{AWSScheduledFunction-Bn99MceY.d.cts → AWSScheduledFunction-9bJS4WdJ.d.cts} +8 -3
  3. package/dist/{AWSScheduledFunction-ysaCsdWx.d.mts.map → AWSScheduledFunction-9bJS4WdJ.d.cts.map} +1 -1
  4. package/dist/{AWSScheduledFunction-CufMMhGB.mjs → AWSScheduledFunction-BJjj8B5V.mjs} +3 -3
  5. package/dist/{AWSScheduledFunction-CufMMhGB.mjs.map → AWSScheduledFunction-BJjj8B5V.mjs.map} +1 -1
  6. package/dist/{AWSScheduledFunction-ysaCsdWx.d.mts → AWSScheduledFunction-BO5iEMSh.d.mts} +9 -4
  7. package/dist/{AWSScheduledFunction-Bn99MceY.d.cts.map → AWSScheduledFunction-BO5iEMSh.d.mts.map} +1 -1
  8. package/dist/{AWSScheduledFunction-DbkDr8CA.cjs → AWSScheduledFunction-qu4ieRZR.cjs} +9 -9
  9. package/dist/{AWSScheduledFunction-DbkDr8CA.cjs.map → AWSScheduledFunction-qu4ieRZR.cjs.map} +1 -1
  10. package/dist/{Construct-_1wX7p_Y.d.cts → Construct-B-xc0SE9.d.mts} +27 -5
  11. package/dist/Construct-B-xc0SE9.d.mts.map +1 -0
  12. package/dist/{Construct-r0U2zBwW.mjs → Construct-CdhThxDI.mjs} +3 -2
  13. package/dist/Construct-CdhThxDI.mjs.map +1 -0
  14. package/dist/{Construct-DCMuYOox.d.mts → Construct-WhCXIOPV.d.cts} +29 -7
  15. package/dist/Construct-WhCXIOPV.d.cts.map +1 -0
  16. package/dist/{Construct-vXMZJgRp.cjs → Construct-roId57cU.cjs} +7 -43
  17. package/dist/Construct-roId57cU.cjs.map +1 -0
  18. package/dist/{lazyAccessors-DmTG8sQH.cjs → Endpoint-BBkV6l0k.cjs} +869 -1079
  19. package/dist/Endpoint-BBkV6l0k.cjs.map +1 -0
  20. package/dist/{Endpoint-DgfRslct.d.cts → Endpoint-BKR5QH6O.d.mts} +57 -8
  21. package/dist/Endpoint-BKR5QH6O.d.mts.map +1 -0
  22. package/dist/{Endpoint-CLPSIl6S.d.mts → Endpoint-BQ9O0P1w.d.cts} +58 -9
  23. package/dist/Endpoint-BQ9O0P1w.d.cts.map +1 -0
  24. package/dist/{lazyAccessors-DfqZR6C4.mjs → Endpoint-BTj58Gob.mjs} +840 -1003
  25. package/dist/Endpoint-BTj58Gob.mjs.map +1 -0
  26. package/dist/EndpointFactory-BejSTzbB.mjs +808 -0
  27. package/dist/EndpointFactory-BejSTzbB.mjs.map +1 -0
  28. package/dist/EndpointFactory-DYoGLaIT.cjs +850 -0
  29. package/dist/EndpointFactory-DYoGLaIT.cjs.map +1 -0
  30. package/dist/{HonoEndpointAdaptor-DJDT3PMx.mjs → HonoEndpointAdaptor-7aYNdqJq.mjs} +5 -4
  31. package/dist/HonoEndpointAdaptor-7aYNdqJq.mjs.map +1 -0
  32. package/dist/{HonoEndpointAdaptor-CkJENANP.cjs → HonoEndpointAdaptor-wMsCyMgt.cjs} +24 -23
  33. package/dist/HonoEndpointAdaptor-wMsCyMgt.cjs.map +1 -0
  34. package/dist/{Queue-DaxjwmOQ.d.cts → Queue-D6WeziRD.d.cts} +43 -4
  35. package/dist/Queue-D6WeziRD.d.cts.map +1 -0
  36. package/dist/{Queue-HBDf0fqz.d.mts → Queue-DpUeqdC8.d.mts} +43 -4
  37. package/dist/Queue-DpUeqdC8.d.mts.map +1 -0
  38. package/dist/{Subscriber-B69ngPwl.d.cts → Subscriber-4rBJgDKI.d.mts} +9 -4
  39. package/dist/{Subscriber-B69ngPwl.d.cts.map → Subscriber-4rBJgDKI.d.mts.map} +1 -1
  40. package/dist/{Subscriber-D8Xm-86W.d.mts → Subscriber-DVQowdyj.d.cts} +11 -6
  41. package/dist/Subscriber-DVQowdyj.d.cts.map +1 -0
  42. package/dist/{Topic-C5ZMfveW.d.cts → Topic-Ohx9dvWr.d.cts} +33 -2
  43. package/dist/Topic-Ohx9dvWr.d.cts.map +1 -0
  44. package/dist/{Topic-DT10AqHk.d.mts → Topic-cmy2jOUy.d.mts} +33 -2
  45. package/dist/Topic-cmy2jOUy.d.mts.map +1 -0
  46. package/dist/adaptors/aws.cjs +39 -26
  47. package/dist/adaptors/aws.cjs.map +1 -1
  48. package/dist/adaptors/aws.d.cts +24 -16
  49. package/dist/adaptors/aws.d.cts.map +1 -1
  50. package/dist/adaptors/aws.d.mts +25 -17
  51. package/dist/adaptors/aws.d.mts.map +1 -1
  52. package/dist/adaptors/aws.mjs +26 -14
  53. package/dist/adaptors/aws.mjs.map +1 -1
  54. package/dist/adaptors/hono.cjs +9 -6
  55. package/dist/adaptors/hono.d.cts +7 -6
  56. package/dist/adaptors/hono.d.cts.map +1 -1
  57. package/dist/adaptors/hono.d.mts +8 -7
  58. package/dist/adaptors/hono.d.mts.map +1 -1
  59. package/dist/adaptors/hono.mjs +9 -6
  60. package/dist/adaptors/testing.cjs +18 -14
  61. package/dist/adaptors/testing.cjs.map +1 -1
  62. package/dist/adaptors/testing.d.cts +7 -6
  63. package/dist/adaptors/testing.d.cts.map +1 -1
  64. package/dist/adaptors/testing.d.mts +11 -10
  65. package/dist/adaptors/testing.d.mts.map +1 -1
  66. package/dist/adaptors/testing.mjs +10 -7
  67. package/dist/adaptors/testing.mjs.map +1 -1
  68. package/dist/auth.cjs +165 -0
  69. package/dist/auth.cjs.map +1 -0
  70. package/dist/auth.d.cts +108 -0
  71. package/dist/auth.d.cts.map +1 -0
  72. package/dist/auth.d.mts +108 -0
  73. package/dist/auth.d.mts.map +1 -0
  74. package/dist/auth.mjs +164 -0
  75. package/dist/auth.mjs.map +1 -0
  76. package/dist/cache-0ANvRQnD.mjs +51 -0
  77. package/dist/cache-0ANvRQnD.mjs.map +1 -0
  78. package/dist/cache-3WSvAulx.cjs +57 -0
  79. package/dist/cache-3WSvAulx.cjs.map +1 -0
  80. package/dist/cache-CdQ7OLpR.d.cts +47 -0
  81. package/dist/cache-CdQ7OLpR.d.cts.map +1 -0
  82. package/dist/cache-DYoJFcfd.d.mts +47 -0
  83. package/dist/cache-DYoJFcfd.d.mts.map +1 -0
  84. package/dist/cache.cjs +3 -0
  85. package/dist/cache.d.cts +3 -0
  86. package/dist/cache.d.mts +3 -0
  87. package/dist/cache.mjs +3 -0
  88. package/dist/chunk-DWy1uDak.cjs +39 -0
  89. package/dist/clone-DblgEZZa.mjs +39 -0
  90. package/dist/clone-DblgEZZa.mjs.map +1 -0
  91. package/dist/clone-Dy0cR2SZ.cjs +45 -0
  92. package/dist/clone-Dy0cR2SZ.cjs.map +1 -0
  93. package/dist/construct-interface-BfjcOD_E.cjs +117 -0
  94. package/dist/construct-interface-BfjcOD_E.cjs.map +1 -0
  95. package/dist/construct-interface-BqwRNYA2.d.mts +131 -0
  96. package/dist/construct-interface-BqwRNYA2.d.mts.map +1 -0
  97. package/dist/construct-interface-D2nNkHUN.d.cts +131 -0
  98. package/dist/construct-interface-D2nNkHUN.d.cts.map +1 -0
  99. package/dist/construct-interface-Z4CpS8tK.mjs +81 -0
  100. package/dist/construct-interface-Z4CpS8tK.mjs.map +1 -0
  101. package/dist/construct-interface.cjs +8 -0
  102. package/dist/construct-interface.d.cts +2 -0
  103. package/dist/construct-interface.d.mts +2 -0
  104. package/dist/construct-interface.mjs +3 -0
  105. package/dist/credential.cjs +96 -0
  106. package/dist/credential.cjs.map +1 -0
  107. package/dist/credential.d.cts +61 -0
  108. package/dist/credential.d.cts.map +1 -0
  109. package/dist/credential.d.mts +61 -0
  110. package/dist/credential.d.mts.map +1 -0
  111. package/dist/credential.mjs +94 -0
  112. package/dist/credential.mjs.map +1 -0
  113. package/dist/crons/index.cjs +39 -37
  114. package/dist/crons/index.cjs.map +1 -1
  115. package/dist/crons/index.d.cts +21 -8
  116. package/dist/crons/index.d.cts.map +1 -1
  117. package/dist/crons/index.d.mts +29 -13
  118. package/dist/crons/index.d.mts.map +1 -1
  119. package/dist/crons/index.mjs +37 -36
  120. package/dist/crons/index.mjs.map +1 -1
  121. package/dist/database/kysely.cjs +181 -0
  122. package/dist/database/kysely.cjs.map +1 -0
  123. package/dist/database/kysely.d.cts +152 -0
  124. package/dist/database/kysely.d.cts.map +1 -0
  125. package/dist/database/kysely.d.mts +152 -0
  126. package/dist/database/kysely.d.mts.map +1 -0
  127. package/dist/database/kysely.mjs +180 -0
  128. package/dist/database/kysely.mjs.map +1 -0
  129. package/dist/email.cjs +59 -0
  130. package/dist/email.cjs.map +1 -0
  131. package/dist/email.d.cts +50 -0
  132. package/dist/email.d.cts.map +1 -0
  133. package/dist/email.d.mts +50 -0
  134. package/dist/email.d.mts.map +1 -0
  135. package/dist/email.mjs +58 -0
  136. package/dist/email.mjs.map +1 -0
  137. package/dist/endpoints/index.cjs +21 -747
  138. package/dist/endpoints/index.d.cts +7 -343
  139. package/dist/endpoints/index.d.mts +7 -342
  140. package/dist/endpoints/index.mjs +11 -738
  141. package/dist/file-server.cjs +154 -0
  142. package/dist/file-server.cjs.map +1 -0
  143. package/dist/file-server.d.cts +156 -0
  144. package/dist/file-server.d.cts.map +1 -0
  145. package/dist/file-server.d.mts +156 -0
  146. package/dist/file-server.d.mts.map +1 -0
  147. package/dist/file-server.mjs +152 -0
  148. package/dist/file-server.mjs.map +1 -0
  149. package/dist/functions/index.cjs +4 -2
  150. package/dist/functions/index.d.cts +3 -2
  151. package/dist/functions/index.d.mts +3 -2
  152. package/dist/functions/index.mjs +4 -2
  153. package/dist/{functions-B-qt91O7.mjs → functions-Cpff1uZH.mjs} +55 -51
  154. package/dist/functions-Cpff1uZH.mjs.map +1 -0
  155. package/dist/{functions-C8i1kCMM.cjs → functions-DukjG8ov.cjs} +62 -57
  156. package/dist/functions-DukjG8ov.cjs.map +1 -0
  157. package/dist/{index-BVs9DvIj.d.cts → index-BTvozlUD.d.cts} +36 -9
  158. package/dist/index-BTvozlUD.d.cts.map +1 -0
  159. package/dist/index-Cvz551AO.d.mts +419 -0
  160. package/dist/index-Cvz551AO.d.mts.map +1 -0
  161. package/dist/index-D5zqAJ2e.d.cts +419 -0
  162. package/dist/index-D5zqAJ2e.d.cts.map +1 -0
  163. package/dist/{index-DP6fqv0I.d.mts → index-L7pz0R0T.d.mts} +48 -19
  164. package/dist/index-L7pz0R0T.d.mts.map +1 -0
  165. package/dist/index.cjs +1 -1
  166. package/dist/index.d.cts +3 -3
  167. package/dist/index.d.mts +3 -3
  168. package/dist/index.mjs +1 -1
  169. package/dist/lazyAccessors-DM6HcXQk.mjs +175 -0
  170. package/dist/lazyAccessors-DM6HcXQk.mjs.map +1 -0
  171. package/dist/lazyAccessors-DrJj8NpA.cjs +223 -0
  172. package/dist/lazyAccessors-DrJj8NpA.cjs.map +1 -0
  173. package/dist/object-storage.cjs +48 -0
  174. package/dist/object-storage.cjs.map +1 -0
  175. package/dist/object-storage.d.cts +36 -0
  176. package/dist/object-storage.d.cts.map +1 -0
  177. package/dist/object-storage.d.mts +36 -0
  178. package/dist/object-storage.d.mts.map +1 -0
  179. package/dist/object-storage.mjs +47 -0
  180. package/dist/object-storage.mjs.map +1 -0
  181. package/dist/{processAudits-CKjjivyz.cjs → processAudits-Bc8rz6Ev.cjs} +3 -3
  182. package/dist/{processAudits-CKjjivyz.cjs.map → processAudits-Bc8rz6Ev.cjs.map} +1 -1
  183. package/dist/{processAudits-ySnizdMG.mjs → processAudits-D89tICM4.mjs} +1 -1
  184. package/dist/{processAudits-ySnizdMG.mjs.map → processAudits-D89tICM4.mjs.map} +1 -1
  185. package/dist/{publisher-BrFOF847.mjs → publisher-CGEo8UKD.mjs} +1 -1
  186. package/dist/{publisher-BrFOF847.mjs.map → publisher-CGEo8UKD.mjs.map} +1 -1
  187. package/dist/{publisher-lFQleddL.cjs → publisher-CqGsXB2X.cjs} +1 -1
  188. package/dist/{publisher-lFQleddL.cjs.map → publisher-CqGsXB2X.cjs.map} +1 -1
  189. package/dist/queue/index.cjs +92 -30
  190. package/dist/queue/index.cjs.map +1 -1
  191. package/dist/queue/index.d.cts +19 -4
  192. package/dist/queue/index.d.cts.map +1 -1
  193. package/dist/queue/index.d.mts +22 -6
  194. package/dist/queue/index.d.mts.map +1 -1
  195. package/dist/queue/index.mjs +90 -29
  196. package/dist/queue/index.mjs.map +1 -1
  197. package/dist/rest-api.cjs +187 -0
  198. package/dist/rest-api.cjs.map +1 -0
  199. package/dist/rest-api.d.cts +221 -0
  200. package/dist/rest-api.d.cts.map +1 -0
  201. package/dist/rest-api.d.mts +221 -0
  202. package/dist/rest-api.d.mts.map +1 -0
  203. package/dist/rest-api.mjs +186 -0
  204. package/dist/rest-api.mjs.map +1 -0
  205. package/dist/site.cjs +48 -0
  206. package/dist/site.cjs.map +1 -0
  207. package/dist/site.d.cts +101 -0
  208. package/dist/site.d.cts.map +1 -0
  209. package/dist/site.d.mts +101 -0
  210. package/dist/site.d.mts.map +1 -0
  211. package/dist/site.mjs +47 -0
  212. package/dist/site.mjs.map +1 -0
  213. package/dist/subscribers/index.cjs +35 -27
  214. package/dist/subscribers/index.cjs.map +1 -1
  215. package/dist/subscribers/index.d.cts +20 -5
  216. package/dist/subscribers/index.d.cts.map +1 -1
  217. package/dist/subscribers/index.d.mts +23 -7
  218. package/dist/subscribers/index.d.mts.map +1 -1
  219. package/dist/subscribers/index.mjs +34 -27
  220. package/dist/subscribers/index.mjs.map +1 -1
  221. package/dist/surfaceEnv-BFXEms2f.cjs +39 -0
  222. package/dist/surfaceEnv-BFXEms2f.cjs.map +1 -0
  223. package/dist/surfaceEnv-C3Ktahea.mjs +27 -0
  224. package/dist/surfaceEnv-C3Ktahea.mjs.map +1 -0
  225. package/dist/{telemetry-3vdxGn4q.d.mts → telemetry-C3L0iS28.d.cts} +2 -2
  226. package/dist/{telemetry-3vdxGn4q.d.mts.map → telemetry-C3L0iS28.d.cts.map} +1 -1
  227. package/dist/{telemetry-Dqx-D3F7.d.cts → telemetry-D7bVFLGi.d.mts} +2 -2
  228. package/dist/{telemetry-Dqx-D3F7.d.cts.map → telemetry-D7bVFLGi.d.mts.map} +1 -1
  229. package/dist/topic/index.cjs +56 -13
  230. package/dist/topic/index.cjs.map +1 -1
  231. package/dist/topic/index.d.cts +2 -2
  232. package/dist/topic/index.d.cts.map +1 -1
  233. package/dist/topic/index.d.mts +2 -2
  234. package/dist/topic/index.d.mts.map +1 -1
  235. package/dist/topic/index.mjs +54 -12
  236. package/dist/topic/index.mjs.map +1 -1
  237. package/dist/{types-BDNGr7pv.d.mts → types-BlAkSuGI.d.cts} +1 -1
  238. package/dist/{types-BDNGr7pv.d.mts.map → types-BlAkSuGI.d.cts.map} +1 -1
  239. package/dist/{types-BdAaYDvd.d.cts → types-aKksMEWL.d.mts} +1 -1
  240. package/dist/{types-BdAaYDvd.d.cts.map → types-aKksMEWL.d.mts.map} +1 -1
  241. package/dist/types.d.cts +1 -1
  242. package/dist/types.d.mts +1 -1
  243. package/package.json +155 -23
  244. package/CHANGELOG.md +0 -396
  245. package/dist/Construct-DCMuYOox.d.mts.map +0 -1
  246. package/dist/Construct-_1wX7p_Y.d.cts.map +0 -1
  247. package/dist/Construct-r0U2zBwW.mjs.map +0 -1
  248. package/dist/Construct-vXMZJgRp.cjs.map +0 -1
  249. package/dist/Endpoint-CLPSIl6S.d.mts.map +0 -1
  250. package/dist/Endpoint-DgfRslct.d.cts.map +0 -1
  251. package/dist/HonoEndpointAdaptor-CkJENANP.cjs.map +0 -1
  252. package/dist/HonoEndpointAdaptor-DJDT3PMx.mjs.map +0 -1
  253. package/dist/Queue-DaxjwmOQ.d.cts.map +0 -1
  254. package/dist/Queue-HBDf0fqz.d.mts.map +0 -1
  255. package/dist/Subscriber-D8Xm-86W.d.mts.map +0 -1
  256. package/dist/Topic-C5ZMfveW.d.cts.map +0 -1
  257. package/dist/Topic-DT10AqHk.d.mts.map +0 -1
  258. package/dist/endpoints/index.cjs.map +0 -1
  259. package/dist/endpoints/index.d.cts.map +0 -1
  260. package/dist/endpoints/index.d.mts.map +0 -1
  261. package/dist/endpoints/index.mjs.map +0 -1
  262. package/dist/functions-B-qt91O7.mjs.map +0 -1
  263. package/dist/functions-C8i1kCMM.cjs.map +0 -1
  264. package/dist/index-BVs9DvIj.d.cts.map +0 -1
  265. package/dist/index-DP6fqv0I.d.mts.map +0 -1
  266. package/dist/lazyAccessors-DfqZR6C4.mjs.map +0 -1
  267. package/dist/lazyAccessors-DmTG8sQH.cjs.map +0 -1
  268. package/src/Construct.ts +0 -204
  269. package/src/__benchmarks__/build-time-optimization.bench.ts +0 -274
  270. package/src/__benchmarks__/endpoint.bench.ts +0 -494
  271. package/src/__benchmarks__/fixtures.ts +0 -241
  272. package/src/__benchmarks__/hono-adaptor.bench.ts +0 -533
  273. package/src/__benchmarks__/hono-server.bench.ts +0 -249
  274. package/src/__benchmarks__/response-builder.bench.ts +0 -428
  275. package/src/__benchmarks__/strategies/strategy-a-lazy-services.ts +0 -319
  276. package/src/__benchmarks__/strategies/strategy-c-middleware.ts +0 -530
  277. package/src/__benchmarks__/strategies/strategy-d-opt-in-events.ts +0 -567
  278. package/src/__tests__/Construct.environment.spec.ts +0 -704
  279. package/src/__tests__/publisher.setting.spec.ts +0 -508
  280. package/src/__tests__/publisher.spec.ts +0 -452
  281. package/src/adaptors/aws.ts +0 -6
  282. package/src/adaptors/hono.ts +0 -1
  283. package/src/adaptors/testing.ts +0 -11
  284. package/src/crons/AWSScheduledFunction.ts +0 -73
  285. package/src/crons/Cron.ts +0 -149
  286. package/src/crons/CronBuilder.ts +0 -271
  287. package/src/crons/__tests__/AWSScheduledFunction.spec.ts +0 -152
  288. package/src/crons/__tests__/Cron.spec.ts +0 -464
  289. package/src/crons/__tests__/CronBuilder.state-isolation.spec.ts +0 -227
  290. package/src/crons/index.ts +0 -12
  291. package/src/endpoints/AmazonApiGatewayEndpointAdaptor.ts +0 -677
  292. package/src/endpoints/AmazonApiGatewayV1EndpointAdaptor.ts +0 -105
  293. package/src/endpoints/AmazonApiGatewayV2EndpointAdaptor.ts +0 -97
  294. package/src/endpoints/Authorizer.ts +0 -152
  295. package/src/endpoints/Endpoint.ts +0 -1287
  296. package/src/endpoints/EndpointBuilder.ts +0 -758
  297. package/src/endpoints/EndpointFactory.ts +0 -1148
  298. package/src/endpoints/HonoEndpointAdaptor.ts +0 -677
  299. package/src/endpoints/MswEndpointAdaptor.ts +0 -226
  300. package/src/endpoints/TestEndpointAdaptor.ts +0 -422
  301. package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.audits.spec.ts +0 -499
  302. package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.events.spec.ts +0 -560
  303. package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.spec.ts +0 -1304
  304. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.audits.spec.ts +0 -626
  305. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.events.spec.ts +0 -732
  306. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.factory-publisher.spec.ts +0 -296
  307. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.kysely-audit.integration.spec.ts +0 -951
  308. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.responseType.spec.ts +0 -111
  309. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.rls.spec.ts +0 -307
  310. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.spec.ts +0 -629
  311. package/src/endpoints/__tests__/Authorizer.spec.ts +0 -286
  312. package/src/endpoints/__tests__/Endpoint.cookies.spec.ts +0 -207
  313. package/src/endpoints/__tests__/Endpoint.headers.spec.ts +0 -187
  314. package/src/endpoints/__tests__/Endpoint.manifest.spec.ts +0 -175
  315. package/src/endpoints/__tests__/Endpoint.spec.ts +0 -857
  316. package/src/endpoints/__tests__/EndpointBuilder.audit.spec.ts +0 -448
  317. package/src/endpoints/__tests__/EndpointBuilder.responseType.spec.ts +0 -47
  318. package/src/endpoints/__tests__/EndpointBuilder.spec.ts +0 -523
  319. package/src/endpoints/__tests__/EndpointFactory.authorizers.spec.ts +0 -492
  320. package/src/endpoints/__tests__/EndpointFactory.database-auditor.spec.ts +0 -509
  321. package/src/endpoints/__tests__/EndpointFactory.reference-audit.spec.ts +0 -190
  322. package/src/endpoints/__tests__/EndpointFactory.spec.ts +0 -479
  323. package/src/endpoints/__tests__/EndpointFactory.state-isolation.spec.ts +0 -155
  324. package/src/endpoints/__tests__/HonoEndpointAdaptor.audit-transactions.spec.ts +0 -703
  325. package/src/endpoints/__tests__/HonoEndpointAdaptor.audits.spec.ts +0 -632
  326. package/src/endpoints/__tests__/HonoEndpointAdaptor.events.spec.ts +0 -577
  327. package/src/endpoints/__tests__/HonoEndpointAdaptor.kysely-audit.integration.spec.ts +0 -1067
  328. package/src/endpoints/__tests__/HonoEndpointAdaptor.openapi.spec.ts +0 -317
  329. package/src/endpoints/__tests__/HonoEndpointAdaptor.pgboss-publisher.spec.ts +0 -289
  330. package/src/endpoints/__tests__/HonoEndpointAdaptor.responseType.spec.ts +0 -128
  331. package/src/endpoints/__tests__/HonoEndpointAdaptor.spec.ts +0 -1207
  332. package/src/endpoints/__tests__/MswEndpointAdaptor.spec.ts +0 -211
  333. package/src/endpoints/__tests__/ResponseBuilder.spec.ts +0 -235
  334. package/src/endpoints/__tests__/TestEndpointAdaptor.audits.spec.ts +0 -602
  335. package/src/endpoints/__tests__/TestEndpointAdaptor.spec.ts +0 -1044
  336. package/src/endpoints/__tests__/__snapshots__/HonoEndpointAdaptor.spec.ts.snap +0 -54
  337. package/src/endpoints/__tests__/endpoint-types.test.ts +0 -88
  338. package/src/endpoints/__tests__/helpers.spec.ts +0 -37
  339. package/src/endpoints/__tests__/lazyAccessors.spec.ts +0 -330
  340. package/src/endpoints/__tests__/processAudits.spec.ts +0 -631
  341. package/src/endpoints/audit.ts +0 -87
  342. package/src/endpoints/helpers.ts +0 -98
  343. package/src/endpoints/index.ts +0 -42
  344. package/src/endpoints/lazyAccessors.ts +0 -241
  345. package/src/endpoints/parseHonoQuery.ts +0 -16
  346. package/src/endpoints/parseQueryParams.ts +0 -32
  347. package/src/endpoints/processAudits.ts +0 -371
  348. package/src/endpoints/rls.ts +0 -67
  349. package/src/functions/AWSLambdaFunction.ts +0 -348
  350. package/src/functions/BaseFunctionBuilder.ts +0 -201
  351. package/src/functions/Function.ts +0 -238
  352. package/src/functions/FunctionBuilder.ts +0 -391
  353. package/src/functions/FunctionExecutionWrapper.ts +0 -216
  354. package/src/functions/TestFunctionAdaptor.ts +0 -217
  355. package/src/functions/__tests__/AWSLambdaFunctionAdaptor.spec.ts +0 -513
  356. package/src/functions/__tests__/Function.audits.spec.ts +0 -393
  357. package/src/functions/__tests__/Function.spec.ts +0 -477
  358. package/src/functions/__tests__/FunctionBuilder.state-isolation.spec.ts +0 -207
  359. package/src/functions/__tests__/TestFunctionAdaptor.spec.ts +0 -480
  360. package/src/functions/index.ts +0 -12
  361. package/src/index.ts +0 -23
  362. package/src/publisher.ts +0 -93
  363. package/src/queue/AWSLambdaQueueAdaptor.ts +0 -162
  364. package/src/queue/Queue.ts +0 -128
  365. package/src/queue/QueueBuilder.ts +0 -115
  366. package/src/queue/TestQueueAdaptor.ts +0 -63
  367. package/src/queue/__tests__/QueueBuilder.spec.ts +0 -137
  368. package/src/queue/index.ts +0 -12
  369. package/src/subscribers/AWSLambdaSubscriberAdaptor.ts +0 -342
  370. package/src/subscribers/Subscriber.ts +0 -117
  371. package/src/subscribers/SubscriberBuilder.ts +0 -186
  372. package/src/subscribers/TestSubscriberAdaptor.ts +0 -133
  373. package/src/subscribers/__tests__/AWSLambdaSubscriberAdaptor.spec.ts +0 -1018
  374. package/src/subscribers/__tests__/Subscriber.spec.ts +0 -430
  375. package/src/subscribers/__tests__/TestSubscriberAdaptor.spec.ts +0 -652
  376. package/src/subscribers/index.ts +0 -6
  377. package/src/telemetry.ts +0 -103
  378. package/src/topic/Topic.ts +0 -103
  379. package/src/topic/TopicBuilder.ts +0 -51
  380. package/src/topic/__tests__/TopicBuilder.spec.ts +0 -82
  381. package/src/topic/index.ts +0 -11
  382. package/src/types.ts +0 -13
  383. package/test.ts +0 -91
  384. package/tsconfig.json +0 -9
  385. package/tsdown.config.ts +0 -34
@@ -1,1287 +0,0 @@
1
- import type { AuditableAction, Auditor, AuditStorage } from '@geekmidas/audit';
2
- import type {
3
- EventPublisher,
4
- ExtractPublisherMessage,
5
- MappedEvent,
6
- } from '@geekmidas/events';
7
- import type { Logger } from '@geekmidas/logger';
8
- import type { RateLimitConfig } from '@geekmidas/rate-limit';
9
- import type {
10
- InferComposableStandardSchema,
11
- InferStandardSchema,
12
- InferStandardSchemaInput,
13
- } from '@geekmidas/schema';
14
- import {
15
- convertSchemaWithComponents,
16
- convertStandardSchemaToJsonSchema,
17
- } from '@geekmidas/schema/conversion';
18
- import {
19
- buildOpenApiSchema,
20
- type ComponentCollector,
21
- type OpenApiSchemaOptions,
22
- } from '@geekmidas/schema/openapi';
23
- import type { Service, ServiceRecord } from '@geekmidas/services';
24
- import type { StandardSchemaV1 } from '@standard-schema/spec';
25
- import pick from 'lodash.pick';
26
- import set from 'lodash.set';
27
- import type { OpenAPIV3_1 } from 'openapi-types';
28
- import { ConstructType } from '../Construct';
29
- import { Function, type FunctionHandler } from '../functions';
30
- import type { HttpMethod, LowerHttpMethod, RemoveUndefined } from '../types';
31
- import type { Authorizer } from './Authorizer';
32
- import type { ActorExtractor, MappedAudit } from './audit';
33
- import type { RlsConfig } from './rls';
34
-
35
- /**
36
- * Represents an HTTP endpoint that can handle requests with type-safe input/output validation,
37
- * dependency injection, session management, and authorization.
38
- *
39
- * @template TRoute - The route path string with parameter placeholders (e.g., '/users/:id')
40
- * @template TMethod - The HTTP method (GET, POST, PUT, DELETE, PATCH)
41
- * @template TInput - The input schema definition for body, query, and path parameters
42
- * @template OutSchema - The output schema for response validation
43
- * @template TServices - Array of service dependencies to inject
44
- * @template TLogger - The logger instance type
45
- * @template TSession - The session data type
46
- *
47
- * @extends Function - Base function construct for handler execution
48
- *
49
- * @example
50
- * ```typescript
51
- * const endpoint = new Endpoint({
52
- * route: '/users/:id',
53
- * method: 'GET',
54
- * input: { params: userIdSchema },
55
- * output: userSchema,
56
- * fn: async ({ params }) => getUserById(params.id)
57
- * });
58
- * ```
59
- */
60
- export class Endpoint<
61
- TRoute extends string,
62
- TMethod extends HttpMethod,
63
- TInput extends EndpointSchemas = {},
64
- OutSchema extends StandardSchemaV1 | undefined = undefined,
65
- TServices extends Service[] = [],
66
- TLogger extends Logger = Logger,
67
- TSession = unknown,
68
- TEventPublisher extends EventPublisher<any> | undefined = undefined,
69
- TEventPublisherServiceName extends string = string,
70
- TAuditStorage extends AuditStorage | undefined = undefined,
71
- TAuditStorageServiceName extends string = string,
72
- TAuditAction extends AuditableAction<string, unknown> = AuditableAction<
73
- string,
74
- unknown
75
- >,
76
- TDatabase = undefined,
77
- TDatabaseServiceName extends string = string,
78
- > extends Function<
79
- TInput,
80
- TServices,
81
- TLogger,
82
- OutSchema,
83
- TEventPublisher,
84
- TEventPublisherServiceName,
85
- TAuditStorage,
86
- TAuditStorageServiceName,
87
- TDatabase,
88
- TDatabaseServiceName,
89
- TAuditAction,
90
- FunctionHandler<
91
- TInput,
92
- TServices,
93
- TLogger,
94
- OutSchema,
95
- TDatabase,
96
- TAuditStorage,
97
- TAuditAction
98
- >
99
- > {
100
- operationId?: string;
101
- /** The route path pattern with parameter placeholders */
102
- route: TRoute;
103
- /** The HTTP method for this endpoint */
104
- method: TMethod;
105
- /** Optional description for OpenAPI documentation */
106
- description?: string;
107
- /** Optional tags for OpenAPI documentation */
108
- tags?: string[];
109
- /** The HTTP success status code to return (default: 200) */
110
- public readonly status: SuccessStatus;
111
- /**
112
- * Response content type for this endpoint. Defaults to `'application/json'`.
113
- * Non-JSON types cause adaptors to emit the body as-is with the declared
114
- * Content-Type header instead of JSON-serializing.
115
- */
116
- public readonly responseType: string;
117
- /** Default headers to apply to all responses */
118
- public readonly defaultHeaders: Record<string, string> = {};
119
- /** Function to extract session data from the request context */
120
- public getSession: SessionFn<TServices, TLogger, TSession, TDatabase> = () =>
121
- ({}) as TSession;
122
- /** Function to determine if the request is authorized */
123
- public authorize: AuthorizeFn<
124
- TServices,
125
- TLogger,
126
- TSession,
127
- TInput,
128
- TDatabase
129
- > = () => true;
130
- /** Optional rate limiting configuration */
131
- public rateLimit?: RateLimitConfig;
132
- /** Optional authorizer for this endpoint */
133
- public authorizer?: Authorizer;
134
- /** Optional actor extractor for audit records */
135
- public actorExtractor?: ActorExtractor<TServices, TSession, TLogger>;
136
- /** Declarative audit definitions */
137
- public audits: MappedAudit<TAuditAction, OutSchema>[] = [];
138
- /** Database service for this endpoint */
139
- public declare databaseService?: Service<TDatabaseServiceName, TDatabase>;
140
- /** RLS configuration for this endpoint */
141
- public rlsConfig?: RlsConfig<TServices, TSession, TLogger>;
142
- /** Whether to bypass RLS for this endpoint */
143
- public rlsBypass?: boolean;
144
- /** The endpoint handler function */
145
- private endpointFn!: EndpointHandler<
146
- TInput,
147
- TServices,
148
- TLogger,
149
- OutSchema,
150
- TSession,
151
- TDatabase,
152
- TAuditStorage,
153
- TAuditAction
154
- >;
155
-
156
- /**
157
- * Builds a complete OpenAPI 3.1 schema from an array of endpoints.
158
- *
159
- * @param endpoints - Array of endpoint instances to document
160
- * @param options - Optional configuration for OpenAPI generation
161
- * @returns OpenAPI 3.1 specification object
162
- *
163
- * @example
164
- * ```typescript
165
- * const schema = await Endpoint.buildOpenApiSchema([
166
- * getUserEndpoint,
167
- * createUserEndpoint
168
- * ], {
169
- * title: 'User API',
170
- * version: '1.0.0'
171
- * });
172
- * ```
173
- */
174
- static async buildOpenApiSchema(
175
- endpoints: Endpoint<any, any, any, any, any, any>[],
176
- options?: OpenApiSchemaOptions,
177
- ) {
178
- return buildOpenApiSchema(endpoints, options);
179
- }
180
-
181
- /**
182
- * Gets the full path including HTTP method and route.
183
- * @returns Formatted string like 'GET /users/{id}'
184
- */
185
- get fullPath() {
186
- return `${this.method} ${this._path}` as const;
187
- }
188
-
189
- /**
190
- * Parses and validates input data for a specific input type (body, query, params).
191
- *
192
- * @param input - The raw input data to validate
193
- * @param key - The input type key ('body', 'query', or 'params')
194
- * @returns The validated input data for the specified key
195
- * @throws {UnprocessableEntityError} When validation fails
196
- */
197
- async parseInput<K extends keyof TInput>(
198
- input: unknown,
199
- key: K,
200
- ): Promise<InferComposableStandardSchema<TInput[K]>> {
201
- const schema = this.input?.[key];
202
- return Endpoint.parseSchema(schema as StandardSchemaV1, input) as Promise<
203
- InferComposableStandardSchema<TInput[K]>
204
- >;
205
- }
206
-
207
- /**
208
- * Parses and validates the request body against the body schema.
209
- *
210
- * @param body - The raw request body to validate
211
- * @returns The validated body data
212
- * @throws {UnprocessableEntityError} When body validation fails
213
- */
214
- async parseBody(body: unknown): Promise<InferStandardSchema<TInput['body']>> {
215
- return this.parseInput(body, 'body') as Promise<
216
- InferStandardSchema<TInput['body']>
217
- >;
218
- }
219
-
220
- static isSuccessStatus(status: number): boolean {
221
- return status >= 200 && status < 300;
222
- }
223
-
224
- /**
225
- * Creates a case-insensitive header lookup function from a headers object.
226
- *
227
- * @param headers - Object containing header key-value pairs
228
- * @returns Function to retrieve header values by case-insensitive key, or all headers
229
- *
230
- * @example
231
- * ```typescript
232
- * const headerFn = Endpoint.createHeaders({ 'Content-Type': 'application/json' });
233
- * headerFn('content-type'); // Returns 'application/json'
234
- * headerFn(); // Returns { 'content-type': 'application/json' }
235
- * ```
236
- */
237
- static createHeaders(headers: Record<string, string>): HeaderFn {
238
- const headerMap = new Map<string, string>();
239
- for (const [k, v] of Object.entries(headers)) {
240
- const key = k.toLowerCase();
241
- headerMap.set(key, v);
242
- }
243
-
244
- function get(): Record<string, string>;
245
- function get(key: string): string | undefined;
246
- function get(key?: string): string | undefined | Record<string, string> {
247
- if (key === undefined) {
248
- // Return all headers as plain object
249
- return Object.fromEntries(headerMap.entries());
250
- }
251
- return headerMap.get(key.toLowerCase());
252
- }
253
-
254
- return get;
255
- }
256
-
257
- /**
258
- * Parses cookie string and creates a cookie lookup function.
259
- *
260
- * @param cookieHeader - The Cookie header value
261
- * @returns Function to retrieve cookie values by name, or all cookies
262
- *
263
- * @example
264
- * ```typescript
265
- * const cookieFn = Endpoint.createCookies('session=abc123; theme=dark');
266
- * cookieFn('session'); // Returns 'abc123'
267
- * cookieFn(); // Returns { session: 'abc123', theme: 'dark' }
268
- * ```
269
- */
270
- static createCookies(cookieHeader: string | undefined): CookieFn {
271
- const cookieMap = new Map<string, string>();
272
-
273
- if (cookieHeader) {
274
- // Parse cookie string: "name1=value1; name2=value2"
275
- const cookies = cookieHeader.split(';');
276
- for (const cookie of cookies) {
277
- const [name, ...valueParts] = cookie.trim().split('=');
278
- if (name) {
279
- const value = valueParts.join('='); // Handle values with = in them
280
- cookieMap.set(name, decodeURIComponent(value));
281
- }
282
- }
283
- }
284
-
285
- function get(): Record<string, string>;
286
- function get(name: string): string | undefined;
287
- function get(name?: string): string | undefined | Record<string, string> {
288
- if (name === undefined) {
289
- // Return all cookies as plain object
290
- return Object.fromEntries(cookieMap.entries());
291
- }
292
- return cookieMap.get(name);
293
- }
294
-
295
- return get;
296
- }
297
-
298
- /**
299
- * Formats a cookie as a Set-Cookie header string.
300
- *
301
- * @param name - Cookie name
302
- * @param value - Cookie value
303
- * @param options - Cookie options (httpOnly, secure, sameSite, etc.)
304
- * @returns Formatted Set-Cookie header string
305
- *
306
- * @example
307
- * ```typescript
308
- * const header = Endpoint.formatCookieHeader('session', 'abc123', {
309
- * httpOnly: true,
310
- * secure: true,
311
- * sameSite: 'strict',
312
- * maxAge: 3600
313
- * });
314
- * // Returns: "session=abc123; Max-Age=3600; HttpOnly; Secure; SameSite=Strict"
315
- * ```
316
- */
317
- static formatCookieHeader(
318
- name: string,
319
- value: string,
320
- options?: CookieOptions,
321
- ): string {
322
- let cookie = `${name}=${value}`;
323
-
324
- if (options) {
325
- if (options.domain) cookie += `; Domain=${options.domain}`;
326
- if (options.path) cookie += `; Path=${options.path}`;
327
- if (options.expires)
328
- cookie += `; Expires=${options.expires.toUTCString()}`;
329
- if (options.maxAge !== undefined) cookie += `; Max-Age=${options.maxAge}`;
330
- if (options.httpOnly) cookie += '; HttpOnly';
331
- if (options.secure) cookie += '; Secure';
332
- if (options.sameSite) {
333
- cookie += `; SameSite=${options.sameSite.charAt(0).toUpperCase() + options.sameSite.slice(1)}`;
334
- }
335
- }
336
-
337
- return cookie;
338
- }
339
-
340
- /**
341
- * Extracts and refines input data from the endpoint context.
342
- *
343
- * @param ctx - The endpoint execution context
344
- * @returns Object containing only the input data (body, query, params)
345
- * @internal
346
- */
347
- refineInput(
348
- ctx: EndpointContext<TInput, TServices, TLogger, TSession>,
349
- ): InferComposableStandardSchema<TInput> {
350
- const input = pick(ctx, [
351
- 'body',
352
- 'query',
353
- 'params',
354
- ]) as InferComposableStandardSchema<TInput>;
355
-
356
- return input;
357
- }
358
-
359
- handler = (
360
- ctx: EndpointContext<
361
- TInput,
362
- TServices,
363
- TLogger,
364
- TSession,
365
- TAuditAction,
366
- TDatabase,
367
- TAuditStorage
368
- >,
369
- response: ResponseBuilder,
370
- ): OutSchema extends StandardSchemaV1
371
- ? // Handler produces the output schema's INPUT type (the schema
372
- // may coerce it on the way out — see EndpointHandler).
373
- | InferStandardSchemaInput<OutSchema>
374
- | ResponseWithMetadata<InferStandardSchemaInput<OutSchema>>
375
- | Promise<InferStandardSchemaInput<OutSchema>>
376
- | Promise<ResponseWithMetadata<InferStandardSchemaInput<OutSchema>>>
377
- :
378
- | any
379
- | ResponseWithMetadata<any>
380
- | Promise<any>
381
- | Promise<ResponseWithMetadata<any>> => {
382
- // Apply default headers to response builder
383
- for (const [key, value] of Object.entries(this.defaultHeaders)) {
384
- response.header(key, value);
385
- }
386
-
387
- // Build context object, conditionally including auditor and db
388
- const handlerCtx = {
389
- ...this.refineInput(ctx),
390
- services: ctx.services,
391
- logger: ctx.logger,
392
- header: ctx.header,
393
- cookie: ctx.cookie,
394
- session: ctx.session,
395
- // These are conditionally present based on configuration
396
- ...('auditor' in ctx && { auditor: ctx.auditor }),
397
- ...('db' in ctx && { db: ctx.db }),
398
- } as EndpointContext<
399
- TInput,
400
- TServices,
401
- TLogger,
402
- TSession,
403
- TAuditAction,
404
- TDatabase,
405
- TAuditStorage
406
- >;
407
-
408
- return this.endpointFn(handlerCtx, response);
409
- };
410
-
411
- /**
412
- * Type guard to check if an object is an Endpoint instance.
413
- *
414
- * @param obj - The object to check
415
- * @returns True if the object is an Endpoint
416
- */
417
- static isEndpoint(obj: any): obj is Endpoint<any, any, any, any> {
418
- return Boolean(
419
- obj &&
420
- (obj as Function).__IS_FUNCTION__ === true &&
421
- obj.type === ConstructType.Endpoint,
422
- );
423
- }
424
-
425
- /**
426
- * Helper to check if response has metadata
427
- */
428
- static hasMetadata<T>(
429
- response: T | ResponseWithMetadata<T>,
430
- ): response is ResponseWithMetadata<T> {
431
- return (
432
- response !== null &&
433
- typeof response === 'object' &&
434
- 'data' in response &&
435
- 'metadata' in response
436
- );
437
- }
438
-
439
- /**
440
- * Converts Express-style route params to OpenAPI format.
441
- * @returns Route with ':param' converted to '{param}'
442
- * @internal
443
- */
444
- get _path() {
445
- return this.route.replace(/:(\w+)/g, '{$1}') as ConvertRouteParams<TRoute>;
446
- }
447
-
448
- /**
449
- * Generates OpenAPI 3.1 schema for this endpoint.
450
- *
451
- * @returns OpenAPI route definition with operation details
452
- */
453
- async toOpenApi3Route(
454
- componentCollector?: ComponentCollector,
455
- ): Promise<EndpointOpenApiSchema<TRoute, TMethod>> {
456
- const operation: OpenAPIV3_1.OperationObject = {
457
- operationId: this.operationId,
458
- ...(this.description && { description: this.description }),
459
- ...(this.tags && this.tags.length > 0 && { tags: this.tags }),
460
- responses: {
461
- '200': {
462
- description: 'Successful response',
463
- } as OpenAPIV3_1.ResponseObject,
464
- },
465
- };
466
-
467
- // Add response schema
468
- if (this.outputSchema) {
469
- const responseSchema = await convertSchemaWithComponents(
470
- this.outputSchema,
471
- componentCollector,
472
- );
473
- if (responseSchema) {
474
- set(
475
- operation,
476
- ['responses', '200', 'content', this.responseType, 'schema'],
477
- responseSchema,
478
- );
479
- }
480
- }
481
-
482
- // Separate path and query parameters
483
- const pathParameters: OpenAPIV3_1.ParameterObject[] = [];
484
- const queryParameters: OpenAPIV3_1.ParameterObject[] = [];
485
-
486
- // Since the EndpointBuilder doesn't have body/search/params methods yet,
487
- // and the input is a composite type, we need to check if input exists
488
- // and has the expected shape
489
- if (this.input && typeof this.input === 'object') {
490
- // Add request body for methods that support it
491
- if (
492
- ['POST', 'PUT', 'PATCH'].includes(this.method) &&
493
- 'body' in this.input &&
494
- this.input.body
495
- ) {
496
- const bodySchema = await convertSchemaWithComponents(
497
- this.input.body as StandardSchemaV1,
498
- componentCollector,
499
- );
500
- if (bodySchema) {
501
- set(operation, ['requestBody'], {
502
- required: true,
503
- content: {
504
- 'application/json': {
505
- schema: bodySchema,
506
- },
507
- },
508
- });
509
- }
510
- }
511
-
512
- // Add path parameters
513
- if ('params' in this.input && this.input.params) {
514
- const paramsSchema = await convertStandardSchemaToJsonSchema(
515
- this.input.params as StandardSchemaV1,
516
- );
517
- if (
518
- paramsSchema &&
519
- paramsSchema.type === 'object' &&
520
- paramsSchema.properties
521
- ) {
522
- for (const [name, schema] of Object.entries(
523
- paramsSchema.properties,
524
- )) {
525
- pathParameters.push({
526
- name,
527
- in: 'path',
528
- required: paramsSchema.required?.includes(name) ?? true,
529
- schema: schema as any,
530
- });
531
- }
532
- }
533
- }
534
-
535
- // Add query parameters
536
- if ('query' in this.input && this.input.query) {
537
- const querySchema = await convertStandardSchemaToJsonSchema(
538
- this.input.query,
539
- );
540
- if (
541
- querySchema &&
542
- querySchema.type === 'object' &&
543
- querySchema.properties
544
- ) {
545
- for (const [name, schema] of Object.entries(querySchema.properties)) {
546
- queryParameters.push({
547
- name,
548
- in: 'query',
549
- required: querySchema.required?.includes(name) ?? false,
550
- schema: schema as any,
551
- });
552
- }
553
- }
554
- }
555
- }
556
-
557
- // Only add query parameters to the operation
558
- if (queryParameters.length > 0) {
559
- operation.parameters = queryParameters;
560
- }
561
-
562
- // Build the route object with path parameters at the route level
563
- const routeObject: any = {};
564
- if (pathParameters.length > 0) {
565
- routeObject.parameters = pathParameters;
566
- }
567
- routeObject[this.method.toLowerCase()] = operation;
568
-
569
- return {
570
- [this._path]: routeObject,
571
- } as EndpointOpenApiSchema<TRoute, TMethod>;
572
- }
573
-
574
- /**
575
- * Creates a new Endpoint instance.
576
- *
577
- * @param options - Configuration options for the endpoint
578
- * @param options.fn - The handler function to execute
579
- * @param options.method - HTTP method
580
- * @param options.route - Route path with parameter placeholders
581
- * @param options.description - Optional description for documentation
582
- * @param options.input - Input schemas for validation
583
- * @param options.logger - Logger instance
584
- * @param options.output - Output schema for response validation
585
- * @param options.services - Service dependencies
586
- * @param options.timeout - Execution timeout in milliseconds
587
- * @param options.getSession - Session extraction function
588
- * @param options.authorize - Authorization check function
589
- * @param options.status - Success HTTP status code (default: 200)
590
- * @param options.authorizer - Optional authorizer configuration
591
- */
592
- constructor({
593
- fn,
594
- method,
595
- route,
596
- description,
597
- tags,
598
- input,
599
- logger,
600
- output: outputSchema,
601
- services,
602
- timeout,
603
- memorySize,
604
- getSession,
605
- authorize,
606
- rateLimit,
607
- status = SuccessStatus.OK,
608
- publisherService,
609
- events,
610
- authorizer,
611
- auditorStorageService,
612
- actorExtractor,
613
- audits,
614
- databaseService,
615
- rlsConfig,
616
- rlsBypass,
617
- responseType,
618
- }: EndpointOptions<
619
- TRoute,
620
- TMethod,
621
- TInput,
622
- OutSchema,
623
- TServices,
624
- TLogger,
625
- TSession,
626
- OutSchema,
627
- TEventPublisher,
628
- TEventPublisherServiceName,
629
- TAuditStorage,
630
- TAuditStorageServiceName,
631
- TAuditAction,
632
- TDatabase,
633
- TDatabaseServiceName
634
- >) {
635
- super(
636
- fn as unknown as FunctionHandler<TInput, TServices, TLogger, OutSchema>,
637
- timeout,
638
- ConstructType.Endpoint,
639
- input,
640
- outputSchema,
641
- services,
642
- logger,
643
- publisherService,
644
- events,
645
- memorySize,
646
- auditorStorageService,
647
- );
648
-
649
- this.route = route;
650
- this.method = method;
651
- this.description = description;
652
- this.tags = tags;
653
- this.status = status;
654
- this.responseType = responseType ?? 'application/json';
655
- this.endpointFn = fn;
656
-
657
- if (getSession) {
658
- this.getSession = getSession;
659
- }
660
-
661
- if (authorize) {
662
- this.authorize = authorize;
663
- }
664
-
665
- if (rateLimit) {
666
- this.rateLimit = rateLimit;
667
- }
668
-
669
- if (authorizer) {
670
- this.authorizer = authorizer;
671
- }
672
-
673
- if (actorExtractor) {
674
- this.actorExtractor = actorExtractor;
675
- }
676
-
677
- if (audits) {
678
- this.audits = audits;
679
- }
680
-
681
- if (databaseService) {
682
- this.databaseService = databaseService;
683
- }
684
-
685
- if (rlsConfig) {
686
- this.rlsConfig = rlsConfig;
687
- }
688
-
689
- if (rlsBypass) {
690
- this.rlsBypass = rlsBypass;
691
- }
692
- }
693
- }
694
-
695
- /**
696
- * Defines the input schema structure for an endpoint.
697
- *
698
- * @template TBody - Schema for request body validation
699
- * @template TSearch - Schema for query string validation
700
- * @template TParams - Schema for URL path parameters validation
701
- *
702
- * @example
703
- * ```typescript
704
- * type UserInput = EndpointInput<
705
- * typeof createUserBodySchema,
706
- * typeof userQuerySchema,
707
- * typeof userParamsSchema
708
- * >;
709
- * ```
710
- */
711
- export type EndpointInput<
712
- TBody extends StandardSchemaV1 | undefined = undefined,
713
- TSearch extends StandardSchemaV1 | undefined = undefined,
714
- TParams extends StandardSchemaV1 | undefined = undefined,
715
- > = RemoveUndefined<{
716
- body: TBody;
717
- search: TSearch;
718
- params: TParams;
719
- }>;
720
-
721
- /**
722
- * Configuration options for creating an Endpoint instance.
723
- *
724
- * @template TRoute - The route path string
725
- * @template TMethod - The HTTP method
726
- * @template TInput - Input schema definitions
727
- * @template TOutput - Output schema definition
728
- * @template TServices - Service dependencies array
729
- * @template TLogger - Logger type
730
- * @template TSession - Session data type
731
- */
732
- export interface EndpointOptions<
733
- TRoute extends string,
734
- TMethod extends HttpMethod,
735
- TInput extends EndpointSchemas = {},
736
- TOutput extends StandardSchemaV1 | undefined = undefined,
737
- TServices extends Service[] = [],
738
- TLogger extends Logger = Logger,
739
- TSession = unknown,
740
- OutSchema extends StandardSchemaV1 | undefined = undefined,
741
- TEventPublisher extends EventPublisher<any> | undefined = undefined,
742
- TEventPublisherServiceName extends string = string,
743
- TAuditStorage extends AuditStorage | undefined = undefined,
744
- TAuditStorageServiceName extends string = string,
745
- TAuditAction extends AuditableAction<string, unknown> = AuditableAction<
746
- string,
747
- unknown
748
- >,
749
- TDatabase = undefined,
750
- TDatabaseServiceName extends string = string,
751
- > {
752
- /** The route path with parameter placeholders */
753
- route: TRoute;
754
- /** The HTTP method for this endpoint */
755
- method: TMethod;
756
- /** The handler function that implements the endpoint logic */
757
- fn: EndpointHandler<
758
- TInput,
759
- TServices,
760
- TLogger,
761
- TOutput,
762
- TSession,
763
- TDatabase,
764
- TAuditStorage,
765
- TAuditAction
766
- >;
767
- /** Optional authorization check function */
768
- authorize:
769
- | AuthorizeFn<TServices, TLogger, TSession, TInput, TDatabase>
770
- | undefined;
771
- /** Optional description for documentation */
772
- description: string | undefined;
773
- /** Optional tags for OpenAPI documentation */
774
- tags?: string[];
775
- /** Optional execution timeout in milliseconds */
776
- timeout: number | undefined;
777
- /** Optional memory size in MB for serverless deployments */
778
- memorySize: number | undefined;
779
- /** Input validation schemas */
780
- input: TInput | undefined;
781
- /** Output validation schema */
782
- output: TOutput | undefined;
783
- /** Service dependencies to inject */
784
- services: TServices;
785
- /** Logger instance */
786
- logger: TLogger;
787
- /** Optional session extraction function */
788
- getSession: SessionFn<TServices, TLogger, TSession, TDatabase> | undefined;
789
- /** Optional rate limiting configuration */
790
- rateLimit?: RateLimitConfig;
791
- /** Success HTTP status code */
792
- status: SuccessStatus | undefined;
793
- /**
794
- * Event publisher service for publishing events from this endpoint
795
- */
796
- publisherService?: Service<TEventPublisherServiceName, TEventPublisher>;
797
-
798
- events?: MappedEvent<TEventPublisher, OutSchema>[];
799
- /** Optional authorizer configuration */
800
- authorizer?: Authorizer;
801
- /**
802
- * Auditor storage service for persisting audit records from this endpoint
803
- */
804
- auditorStorageService?: Service<TAuditStorageServiceName, TAuditStorage>;
805
- /** Optional actor extractor function for audit records */
806
- actorExtractor?: ActorExtractor<TServices, TSession, TLogger>;
807
- /** Declarative audit definitions */
808
- audits?: MappedAudit<TAuditAction, OutSchema>[];
809
- /** Database service for this endpoint */
810
- databaseService?: Service<TDatabaseServiceName, TDatabase>;
811
- /** RLS configuration for this endpoint */
812
- rlsConfig?: RlsConfig<TServices, TSession, TLogger>;
813
- /** Whether to bypass RLS for this endpoint */
814
- rlsBypass?: boolean;
815
- /**
816
- * Response content type (e.g. `'application/json'`, `'text/html'`).
817
- * Defaults to `'application/json'` when omitted.
818
- */
819
- responseType?: string;
820
- }
821
-
822
- /**
823
- * Defines the possible input schema types for an endpoint.
824
- * Each property represents a different part of the HTTP request.
825
- */
826
- export type EndpointSchemas = Partial<{
827
- /** Schema for URL path parameters (e.g., /users/:id) */
828
- params: StandardSchemaV1;
829
- /** Schema for query string parameters */
830
- query: StandardSchemaV1;
831
- /** Schema for request body (POST, PUT, PATCH) */
832
- body: StandardSchemaV1;
833
- }>;
834
-
835
- export type AuthorizeContext<
836
- TServices extends Service[] = [],
837
- TLogger extends Logger = Logger,
838
- TSession = unknown,
839
- TInput extends EndpointSchemas | undefined = undefined,
840
- TDatabase = undefined,
841
- > = {
842
- services: ServiceRecord<TServices>;
843
- logger: TLogger;
844
- header: HeaderFn;
845
- cookie: CookieFn;
846
- session: TSession;
847
- } & InferComposableStandardSchema<TInput> &
848
- SessionDatabaseContext<TDatabase>;
849
- /**
850
- * Function type for endpoint authorization checks.
851
- *
852
- * @template TServices - Available service dependencies
853
- * @template TLogger - Logger type
854
- * @template TSession - Session data type
855
- *
856
- * @param ctx - Context containing services, logger, headers, and session
857
- * @returns Boolean indicating if the request is authorized
858
- *
859
- * @example
860
- * ```typescript
861
- * const authorize: AuthorizeFn = ({ session }) => {
862
- * return session.userId !== undefined;
863
- * };
864
- * ```
865
- */
866
- export type AuthorizeFn<
867
- TServices extends Service[] = [],
868
- TLogger extends Logger = Logger,
869
- TSession = unknown,
870
- TInput extends EndpointSchemas | undefined = undefined,
871
- TDatabase = undefined,
872
- > = (
873
- ctx: AuthorizeContext<TServices, TLogger, TSession, TInput, TDatabase>,
874
- ) => Promise<boolean> | boolean;
875
-
876
- /**
877
- * Base session context without database
878
- */
879
- type BaseSessionContext<
880
- TServices extends Service[] = [],
881
- TLogger extends Logger = Logger,
882
- > = {
883
- services: ServiceRecord<TServices>;
884
- logger: TLogger;
885
- header: HeaderFn;
886
- cookie: CookieFn;
887
- };
888
-
889
- /**
890
- * Conditional database context for session - only present when database service is configured
891
- */
892
- type SessionDatabaseContext<TDatabase = undefined> = TDatabase extends undefined
893
- ? {}
894
- : {
895
- /**
896
- * Database instance for session extraction.
897
- * Available when a database service is configured via `.database()`.
898
- * Useful for looking up user data from the database based on auth tokens.
899
- */
900
- db: TDatabase;
901
- };
902
-
903
- export type SessionContext<
904
- TServices extends Service[] = [],
905
- TLogger extends Logger = Logger,
906
- TDatabase = undefined,
907
- > = BaseSessionContext<TServices, TLogger> & SessionDatabaseContext<TDatabase>;
908
- /**
909
- * Function type for extracting session data from a request.
910
- *
911
- * @template TServices - Available service dependencies
912
- * @template TLogger - Logger type
913
- * @template TSession - Session data type to extract
914
- * @template TDatabase - Database type (when database service is configured)
915
- *
916
- * @param ctx - Context containing services, logger, headers, and optionally database
917
- * @returns The extracted session data
918
- *
919
- * @example
920
- * ```typescript
921
- * // Without database
922
- * const getSession: SessionFn<Services, Logger, UserSession> = async ({ header, services }) => {
923
- * const token = header('authorization');
924
- * return await services.auth.verifyToken(token);
925
- * };
926
- *
927
- * // With database
928
- * const getSession: SessionFn<Services, Logger, UserSession, Database> = async ({ header, db }) => {
929
- * const token = header('authorization');
930
- * const user = await db.selectFrom('users').where('token', '=', token).executeTakeFirst();
931
- * return { userId: user?.id };
932
- * };
933
- * ```
934
- */
935
- export type SessionFn<
936
- TServices extends Service[] = [],
937
- TLogger extends Logger = Logger,
938
- TSession = unknown,
939
- TDatabase = undefined,
940
- > = (
941
- ctx: SessionContext<TServices, TLogger, TDatabase>,
942
- ) => Promise<TSession> | TSession;
943
-
944
- /**
945
- * Utility type that converts Express-style route parameters to OpenAPI format.
946
- * Transforms ':param' syntax to '{param}' syntax.
947
- *
948
- * @template T - The route string to convert
949
- *
950
- * @example
951
- * ```typescript
952
- * type Route1 = ConvertRouteParams<'/users/:id'>; // '/users/{id}'
953
- * type Route2 = ConvertRouteParams<'/users/:userId/posts/:postId'>; // '/users/{userId}/posts/{postId}'
954
- * ```
955
- */
956
- export type ConvertRouteParams<T extends string> =
957
- T extends `${infer Start}:${infer Param}/${infer Rest}`
958
- ? `${Start}{${Param}}/${ConvertRouteParams<Rest>}`
959
- : T extends `${infer Start}:${infer Param}`
960
- ? `${Start}{${Param}}`
961
- : T;
962
-
963
- /**
964
- * Type representing the OpenAPI schema structure for an endpoint.
965
- *
966
- * @template TRoute - The route path
967
- * @template TMethod - The HTTP method
968
- *
969
- * @example
970
- * ```typescript
971
- * type Schema = EndpointOpenApiSchema<'/users/:id', 'GET'>;
972
- * // Results in: { '/users/{id}': { get: OperationObject, parameters?: ParameterObject[] } }
973
- * ```
974
- */
975
- export type EndpointOpenApiSchema<
976
- TRoute extends string,
977
- TMethod extends HttpMethod,
978
- > = {
979
- [key in ConvertRouteParams<TRoute>]: {
980
- [key in LowerHttpMethod<TMethod>]: OpenAPIV3_1.OperationObject<{}>;
981
- } & {
982
- parameters?: OpenAPIV3_1.ParameterObject[];
983
- };
984
- };
985
-
986
- export type SingleHeaderFn = (key: string) => string | undefined;
987
- export type MultiHeaderFn = () => EndpointHeaders;
988
- /**
989
- * Type representing HTTP headers as a Map.
990
- */
991
- export type EndpointHeaders = Map<string, string>;
992
-
993
- /**
994
- * Function type for retrieving HTTP header values.
995
- * Supports two calling patterns:
996
- * - `header(key)` - Get a single header value (case-insensitive)
997
- * - `header()` - Get all headers as a plain object
998
- *
999
- * @example
1000
- * ```typescript
1001
- * // Get single header
1002
- * const contentType = header('content-type');
1003
- *
1004
- * // Get all headers
1005
- * const allHeaders = header();
1006
- * // { 'content-type': 'application/json', 'host': 'example.com', ... }
1007
- * ```
1008
- */
1009
- export interface HeaderFn {
1010
- (): Record<string, string>;
1011
- (key: string): string | undefined;
1012
- }
1013
-
1014
- /**
1015
- * Function type for retrieving cookie values.
1016
- * Supports two calling patterns:
1017
- * - `cookie(name)` - Get a single cookie value
1018
- * - `cookie()` - Get all cookies as a plain object
1019
- *
1020
- * @example
1021
- * ```typescript
1022
- * // Get single cookie
1023
- * const sessionId = cookie('session');
1024
- *
1025
- * // Get all cookies
1026
- * const allCookies = cookie();
1027
- * // { session: 'abc123', theme: 'dark', ... }
1028
- * ```
1029
- */
1030
- export interface CookieFn {
1031
- (): Record<string, string>;
1032
- (name: string): string | undefined;
1033
- }
1034
-
1035
- /**
1036
- * Cookie options matching standard Set-Cookie attributes
1037
- */
1038
- export interface CookieOptions {
1039
- domain?: string;
1040
- path?: string;
1041
- expires?: Date;
1042
- maxAge?: number;
1043
- httpOnly?: boolean;
1044
- secure?: boolean;
1045
- sameSite?: 'strict' | 'lax' | 'none';
1046
- }
1047
-
1048
- /**
1049
- * Response metadata that handlers can set
1050
- */
1051
- export interface ResponseMetadata {
1052
- headers?: Record<string, string>;
1053
- cookies?: Map<string, { value: string; options?: CookieOptions }>;
1054
- status?: SuccessStatus;
1055
- }
1056
-
1057
- /**
1058
- * Return type for handlers that want to set response metadata
1059
- */
1060
- export interface ResponseWithMetadata<T> {
1061
- data: T;
1062
- metadata: ResponseMetadata;
1063
- }
1064
-
1065
- /**
1066
- * Response builder for fluent API in handlers
1067
- */
1068
- export class ResponseBuilder {
1069
- private metadata: ResponseMetadata = {
1070
- headers: {},
1071
- cookies: new Map(),
1072
- };
1073
-
1074
- header(key: string, value: string): this {
1075
- this.metadata.headers![key] = value;
1076
- return this;
1077
- }
1078
-
1079
- cookie(name: string, value: string, options?: CookieOptions): this {
1080
- this.metadata.cookies?.set(name, { value, options });
1081
- return this;
1082
- }
1083
-
1084
- deleteCookie(
1085
- name: string,
1086
- options?: Pick<CookieOptions, 'domain' | 'path'>,
1087
- ): this {
1088
- this.metadata.cookies?.set(name, {
1089
- value: '',
1090
- options: { ...options, maxAge: 0, expires: new Date(0) },
1091
- });
1092
- return this;
1093
- }
1094
-
1095
- status(code: SuccessStatus): this {
1096
- this.metadata.status = code;
1097
- return this;
1098
- }
1099
-
1100
- send<T>(data: T): ResponseWithMetadata<T> {
1101
- return { data, metadata: this.metadata };
1102
- }
1103
-
1104
- getMetadata(): ResponseMetadata {
1105
- return this.metadata;
1106
- }
1107
- }
1108
-
1109
- /**
1110
- * Base context properties that are always available
1111
- */
1112
- type BaseEndpointContext<
1113
- TServices extends Service[] = [],
1114
- TLogger extends Logger = Logger,
1115
- TSession = unknown,
1116
- > = {
1117
- /** Injected service instances */
1118
- services: ServiceRecord<TServices>;
1119
- /** Logger instance for this request */
1120
- logger: TLogger;
1121
- /** Function to retrieve request headers */
1122
- header: HeaderFn;
1123
- /** Function to retrieve request cookies */
1124
- cookie: CookieFn;
1125
- /** Session data extracted by getSession */
1126
- session: TSession;
1127
- };
1128
-
1129
- /**
1130
- * Conditional auditor context - only present when audit storage is configured
1131
- */
1132
- type AuditorContext<
1133
- TAuditAction extends AuditableAction<string, unknown> = AuditableAction<
1134
- string,
1135
- unknown
1136
- >,
1137
- TAuditStorage = undefined,
1138
- > = TAuditStorage extends undefined
1139
- ? {}
1140
- : {
1141
- /**
1142
- * Auditor instance for recording audit events.
1143
- * Only present when audit storage is configured on the endpoint.
1144
- * When a transactional database is used for audit storage,
1145
- * the auditor is pre-configured with the transaction context.
1146
- */
1147
- auditor: Auditor<TAuditAction>;
1148
- };
1149
-
1150
- /**
1151
- * Conditional database context - only present when database service is configured
1152
- */
1153
- type DatabaseContext<TDatabase = undefined> = TDatabase extends undefined
1154
- ? {}
1155
- : {
1156
- /**
1157
- * Database instance for this request.
1158
- * When audit storage is configured and uses the same database,
1159
- * this will be the transaction for ACID compliance.
1160
- * Otherwise, it's the raw database connection.
1161
- */
1162
- db: TDatabase;
1163
- };
1164
-
1165
- /**
1166
- * The execution context provided to endpoint handlers.
1167
- * Contains all parsed input data, services, logger, headers, cookies, and session.
1168
- *
1169
- * @template Input - The input schemas (body, query, params)
1170
- * @template TServices - Available service dependencies
1171
- * @template TLogger - Logger type
1172
- * @template TSession - Session data type
1173
- * @template TAuditAction - Audit action types (when auditor is configured)
1174
- * @template TDatabase - Database type (when database service is configured)
1175
- * @template TAuditStorage - Audit storage type (determines if auditor is present)
1176
- */
1177
- export type EndpointContext<
1178
- Input extends EndpointSchemas | undefined = undefined,
1179
- TServices extends Service[] = [],
1180
- TLogger extends Logger = Logger,
1181
- TSession = unknown,
1182
- TAuditAction extends AuditableAction<string, unknown> = AuditableAction<
1183
- string,
1184
- unknown
1185
- >,
1186
- TDatabase = undefined,
1187
- TAuditStorage = undefined,
1188
- > = BaseEndpointContext<TServices, TLogger, TSession> &
1189
- InferComposableStandardSchema<Input> &
1190
- AuditorContext<TAuditAction, TAuditStorage> &
1191
- DatabaseContext<TDatabase>;
1192
-
1193
- /**
1194
- * Handler function type for endpoint implementations.
1195
- *
1196
- * @template TInput - Input schemas for validation
1197
- * @template TServices - Available service dependencies
1198
- * @template TLogger - Logger type
1199
- * @template OutSchema - Output schema for response validation
1200
- * @template TSession - Session data type
1201
- *
1202
- * @param ctx - The endpoint execution context
1203
- * @param response - Response builder for setting cookies, headers, and status
1204
- * @returns The response data (validated if OutSchema is provided) or ResponseWithMetadata
1205
- *
1206
- * @example
1207
- * ```typescript
1208
- * // Simple response
1209
- * const handler: EndpointHandler<Input, [UserService], Logger, UserSchema> =
1210
- * async ({ params, services }) => {
1211
- * return await services.users.findById(params.id);
1212
- * };
1213
- *
1214
- * // With response builder
1215
- * const handler: EndpointHandler<Input, [UserService], Logger, UserSchema> =
1216
- * async ({ params, services }, response) => {
1217
- * const user = await services.users.findById(params.id);
1218
- * return response.header('X-User-Id', user.id).send(user);
1219
- * };
1220
- * ```
1221
- */
1222
- export type EndpointHandler<
1223
- TInput extends EndpointSchemas | undefined = undefined,
1224
- TServices extends Service[] = [],
1225
- TLogger extends Logger = Logger,
1226
- OutSchema extends StandardSchemaV1 | undefined = undefined,
1227
- TSession = unknown,
1228
- TDatabase = undefined,
1229
- TAuditStorage = undefined,
1230
- TAuditAction extends AuditableAction<string, unknown> = AuditableAction<
1231
- string,
1232
- unknown
1233
- >,
1234
- > = (
1235
- ctx: EndpointContext<
1236
- TInput,
1237
- TServices,
1238
- TLogger,
1239
- TSession,
1240
- TAuditAction,
1241
- TDatabase,
1242
- TAuditStorage
1243
- >,
1244
- response: ResponseBuilder,
1245
- ) => OutSchema extends StandardSchemaV1
1246
- ? // The handler must produce the schema's INPUT type — the output
1247
- // schema is allowed to coerce it (e.g. a `Date` → ISO `string`),
1248
- // so the handler may return the looser input while consumers
1249
- // (EndpointOutput / the generated client) still see the parsed
1250
- // output type.
1251
- | InferStandardSchemaInput<OutSchema>
1252
- | ResponseWithMetadata<InferStandardSchemaInput<OutSchema>>
1253
- | Promise<InferStandardSchemaInput<OutSchema>>
1254
- | Promise<ResponseWithMetadata<InferStandardSchemaInput<OutSchema>>>
1255
- :
1256
- | unknown
1257
- | ResponseWithMetadata<unknown>
1258
- | Promise<unknown>
1259
- | Promise<ResponseWithMetadata<unknown>>;
1260
-
1261
- /**
1262
- * HTTP success status codes that can be returned by endpoints.
1263
- */
1264
- export enum SuccessStatus {
1265
- /** Standard response for successful HTTP requests */
1266
- OK = 200,
1267
- /** Request has been fulfilled and resulted in a new resource being created */
1268
- Created = 201,
1269
- /** Request has been accepted for processing, but processing is not complete */
1270
- Accepted = 202,
1271
- /** Server successfully processed the request but is not returning any content */
1272
- NoContent = 204,
1273
- /** Server successfully processed the request and is not returning any content, client should reset the document view */
1274
- ResetContent = 205,
1275
- /** Server is delivering only part of the resource due to a range header */
1276
- PartialContent = 206,
1277
- }
1278
-
1279
- export type EndpointOutput<T> =
1280
- T extends Endpoint<any, any, any, infer OutSchema, any, any, any, any>
1281
- ? InferStandardSchema<OutSchema>
1282
- : never;
1283
-
1284
- export type EndpointEvent<T> =
1285
- T extends Endpoint<any, any, any, any, any, any, any, infer TEventPublisher>
1286
- ? ExtractPublisherMessage<TEventPublisher>
1287
- : never;