@geekmidas/constructs 10.0.0-alpha.9 → 10.0.0-alpha.91

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 (425) hide show
  1. package/README.md +222 -158
  2. package/dist/{Construct-BD5neF7w.mjs → Construct-B1vGBPme.mjs} +33 -34
  3. package/dist/Construct-B1vGBPme.mjs.map +1 -0
  4. package/dist/Construct-BQALFCh2.d.cts +230 -0
  5. package/dist/Construct-BQALFCh2.d.cts.map +1 -0
  6. package/dist/{Construct-CyS3RpTL.cjs → Construct-DUSXuTHP.cjs} +53 -48
  7. package/dist/Construct-DUSXuTHP.cjs.map +1 -0
  8. package/dist/Construct-QXnl3VqT.d.mts +230 -0
  9. package/dist/Construct-QXnl3VqT.d.mts.map +1 -0
  10. package/dist/{Cron-DmQ8vQ4b.d.cts → Cron-DI3nKoic.d.cts} +15 -9
  11. package/dist/Cron-DI3nKoic.d.cts.map +1 -0
  12. package/dist/{Cron-dh4rUgib.d.mts → Cron-uYAHPnp7.d.mts} +15 -9
  13. package/dist/Cron-uYAHPnp7.d.mts.map +1 -0
  14. package/dist/{CronBuilder-Da0C0edR.cjs → CronBuilder-C0Ek1-RA.cjs} +47 -31
  15. package/dist/CronBuilder-C0Ek1-RA.cjs.map +1 -0
  16. package/dist/CronBuilder-DaSUm2Na.d.mts +47 -0
  17. package/dist/CronBuilder-DaSUm2Na.d.mts.map +1 -0
  18. package/dist/{CronBuilder-CYKT5RiO.mjs → CronBuilder-Dmix_Pen.mjs} +37 -21
  19. package/dist/CronBuilder-Dmix_Pen.mjs.map +1 -0
  20. package/dist/CronBuilder-g1lZLWyG.d.cts +47 -0
  21. package/dist/CronBuilder-g1lZLWyG.d.cts.map +1 -0
  22. package/dist/{Endpoint-DCQPMdUX.mjs → Endpoint-BG4UJ9oA.mjs} +146 -109
  23. package/dist/Endpoint-BG4UJ9oA.mjs.map +1 -0
  24. package/dist/{Endpoint-DcWXE-SZ.cjs → Endpoint-BoUg8ocM.cjs} +174 -131
  25. package/dist/Endpoint-BoUg8ocM.cjs.map +1 -0
  26. package/dist/{Endpoint-BjWKinFA.d.mts → Endpoint-Du-NwPX2.d.mts} +83 -91
  27. package/dist/Endpoint-Du-NwPX2.d.mts.map +1 -0
  28. package/dist/{Endpoint-dav89W6-.d.cts → Endpoint-aCvBMPoH.d.cts} +82 -90
  29. package/dist/Endpoint-aCvBMPoH.d.cts.map +1 -0
  30. package/dist/{EndpointFactory-CjV8F_lJ.mjs → EndpointFactory-BDtsrEvJ.mjs} +57 -76
  31. package/dist/EndpointFactory-BDtsrEvJ.mjs.map +1 -0
  32. package/dist/{EndpointFactory-CdWB7wPw.cjs → EndpointFactory-DJ7gXLpR.cjs} +93 -112
  33. package/dist/EndpointFactory-DJ7gXLpR.cjs.map +1 -0
  34. package/dist/{index-Bd5FqCoe.d.cts → EndpointFactory-DMYdJCOj.d.mts} +78 -134
  35. package/dist/EndpointFactory-DMYdJCOj.d.mts.map +1 -0
  36. package/dist/{index-lAO9egTb.d.mts → EndpointFactory-I7s1co3Y.d.cts} +79 -135
  37. package/dist/EndpointFactory-I7s1co3Y.d.cts.map +1 -0
  38. package/dist/Function-DuqGcbOI.d.mts +76 -0
  39. package/dist/Function-DuqGcbOI.d.mts.map +1 -0
  40. package/dist/Function-Pu-1kKZz.d.cts +76 -0
  41. package/dist/Function-Pu-1kKZz.d.cts.map +1 -0
  42. package/dist/{HonoEndpointAdaptor-P1ahhZHu.mjs → HonoEndpointAdaptor-PtPlbeKY.mjs} +75 -56
  43. package/dist/HonoEndpointAdaptor-PtPlbeKY.mjs.map +1 -0
  44. package/dist/{HonoEndpointAdaptor-DtL9j19R.cjs → HonoEndpointAdaptor-zVzVLJEO.cjs} +83 -61
  45. package/dist/HonoEndpointAdaptor-zVzVLJEO.cjs.map +1 -0
  46. package/dist/Queue-A3wfD0it.cjs +109 -0
  47. package/dist/Queue-A3wfD0it.cjs.map +1 -0
  48. package/dist/Queue-D6USGS4q.mjs +104 -0
  49. package/dist/Queue-D6USGS4q.mjs.map +1 -0
  50. package/dist/{Queue-D7ZuwBhy.d.cts → Queue-DlsHRzUp.d.mts} +48 -48
  51. package/dist/Queue-DlsHRzUp.d.mts.map +1 -0
  52. package/dist/{Queue-gVGfi2Yk.d.mts → Queue-HPyi0e1i.d.cts} +49 -49
  53. package/dist/Queue-HPyi0e1i.d.cts.map +1 -0
  54. package/dist/QueueBuilder-BjuF0UBl.cjs +135 -0
  55. package/dist/QueueBuilder-BjuF0UBl.cjs.map +1 -0
  56. package/dist/QueueBuilder-Cue73M4t.mjs +118 -0
  57. package/dist/QueueBuilder-Cue73M4t.mjs.map +1 -0
  58. package/dist/QueueBuilder-OSi6LkV9.d.cts +75 -0
  59. package/dist/QueueBuilder-OSi6LkV9.d.cts.map +1 -0
  60. package/dist/QueueBuilder-QHsnVt1P.d.mts +75 -0
  61. package/dist/QueueBuilder-QHsnVt1P.d.mts.map +1 -0
  62. package/dist/{Subscriber-2mEi0ImH.d.cts → Subscriber-Bpp02cGr.d.cts} +29 -20
  63. package/dist/Subscriber-Bpp02cGr.d.cts.map +1 -0
  64. package/dist/{Subscriber-xTJ9ayPN.d.mts → Subscriber-CtN9R48-.d.mts} +29 -20
  65. package/dist/Subscriber-CtN9R48-.d.mts.map +1 -0
  66. package/dist/{SubscriberBuilder-BjkbeT9l.mjs → SubscriberBuilder-CDy4nHCz.mjs} +50 -24
  67. package/dist/SubscriberBuilder-CDy4nHCz.mjs.map +1 -0
  68. package/dist/SubscriberBuilder-CuCMFpYW.d.mts +67 -0
  69. package/dist/SubscriberBuilder-CuCMFpYW.d.mts.map +1 -0
  70. package/dist/{SubscriberBuilder-4OPehf2R.cjs → SubscriberBuilder-D_owVoHo.cjs} +61 -36
  71. package/dist/SubscriberBuilder-D_owVoHo.cjs.map +1 -0
  72. package/dist/SubscriberBuilder-g3fAVWgs.d.cts +67 -0
  73. package/dist/SubscriberBuilder-g3fAVWgs.d.cts.map +1 -0
  74. package/dist/Topic-D74b5cgs.mjs +99 -0
  75. package/dist/Topic-D74b5cgs.mjs.map +1 -0
  76. package/dist/Topic-GHxcU8AG.cjs +104 -0
  77. package/dist/Topic-GHxcU8AG.cjs.map +1 -0
  78. package/dist/adaptors/aws.cjs +131 -220
  79. package/dist/adaptors/aws.cjs.map +1 -1
  80. package/dist/adaptors/aws.d.cts +34 -53
  81. package/dist/adaptors/aws.d.cts.map +1 -1
  82. package/dist/adaptors/aws.d.mts +34 -53
  83. package/dist/adaptors/aws.d.mts.map +1 -1
  84. package/dist/adaptors/aws.mjs +102 -193
  85. package/dist/adaptors/aws.mjs.map +1 -1
  86. package/dist/adaptors/hono.cjs +3 -10
  87. package/dist/adaptors/hono.d.cts +7 -16
  88. package/dist/adaptors/hono.d.cts.map +1 -1
  89. package/dist/adaptors/hono.d.mts +8 -17
  90. package/dist/adaptors/hono.d.mts.map +1 -1
  91. package/dist/adaptors/hono.mjs +2 -10
  92. package/dist/adaptors/testing.cjs +743 -89
  93. package/dist/adaptors/testing.cjs.map +1 -1
  94. package/dist/adaptors/testing.d.cts +351 -54
  95. package/dist/adaptors/testing.d.cts.map +1 -1
  96. package/dist/adaptors/testing.d.mts +351 -54
  97. package/dist/adaptors/testing.d.mts.map +1 -1
  98. package/dist/adaptors/testing.mjs +706 -70
  99. package/dist/adaptors/testing.mjs.map +1 -1
  100. package/dist/auth-BMCJN30Y.d.cts +268 -0
  101. package/dist/auth-BMCJN30Y.d.cts.map +1 -0
  102. package/dist/auth-CcuceLYo.d.mts +268 -0
  103. package/dist/auth-CcuceLYo.d.mts.map +1 -0
  104. package/dist/auth.cjs +301 -33
  105. package/dist/auth.cjs.map +1 -1
  106. package/dist/auth.d.cts +2 -108
  107. package/dist/auth.d.mts +2 -108
  108. package/dist/auth.mjs +289 -27
  109. package/dist/auth.mjs.map +1 -1
  110. package/dist/{cache-BrRz3fEB.d.mts → cache-CXh6GIgb.d.mts} +3 -6
  111. package/dist/cache-CXh6GIgb.d.mts.map +1 -0
  112. package/dist/{cache-BtZY_tHe.d.cts → cache-DnGDGly3.d.cts} +3 -6
  113. package/dist/cache-DnGDGly3.d.cts.map +1 -0
  114. package/dist/cache.cjs +68 -2
  115. package/dist/cache.cjs.map +1 -0
  116. package/dist/cache.d.cts +1 -2
  117. package/dist/cache.d.mts +1 -2
  118. package/dist/cache.mjs +67 -2
  119. package/dist/cache.mjs.map +1 -0
  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/{clone-DblgEZZa.mjs → clone-EKNovYHu.mjs} +3 -3
  125. package/dist/clone-EKNovYHu.mjs.map +1 -0
  126. package/dist/{clone-Dy0cR2SZ.cjs → clone-UGJpvQnL.cjs} +7 -8
  127. package/dist/clone-UGJpvQnL.cjs.map +1 -0
  128. package/dist/{construct-interface-D9d4Gm4p.d.cts → construct-interface-B1AfqRl4.d.cts} +42 -11
  129. package/dist/construct-interface-B1AfqRl4.d.cts.map +1 -0
  130. package/dist/{construct-interface-g5GM5pwR.d.mts → construct-interface-DluK3_da.d.mts} +42 -11
  131. package/dist/construct-interface-DluK3_da.d.mts.map +1 -0
  132. package/dist/construct-interface.cjs +113 -7
  133. package/dist/construct-interface.cjs.map +1 -0
  134. package/dist/construct-interface.d.cts +2 -2
  135. package/dist/construct-interface.d.mts +2 -2
  136. package/dist/construct-interface.mjs +106 -2
  137. package/dist/construct-interface.mjs.map +1 -0
  138. package/dist/credential.cjs +77 -17
  139. package/dist/credential.cjs.map +1 -1
  140. package/dist/credential.d.cts +34 -9
  141. package/dist/credential.d.cts.map +1 -1
  142. package/dist/credential.d.mts +34 -9
  143. package/dist/credential.d.mts.map +1 -1
  144. package/dist/credential.mjs +71 -13
  145. package/dist/credential.mjs.map +1 -1
  146. package/dist/crons/index.cjs +129 -7
  147. package/dist/crons/index.cjs.map +1 -1
  148. package/dist/crons/index.d.cts +45 -11
  149. package/dist/crons/index.d.cts.map +1 -1
  150. package/dist/crons/index.d.mts +45 -11
  151. package/dist/crons/index.d.mts.map +1 -1
  152. package/dist/crons/index.mjs +127 -8
  153. package/dist/crons/index.mjs.map +1 -1
  154. package/dist/database/kysely.cjs +4 -181
  155. package/dist/database/kysely.d.cts +2 -152
  156. package/dist/database/kysely.d.mts +2 -152
  157. package/dist/database/kysely.mjs +2 -180
  158. package/dist/email.cjs +25 -12
  159. package/dist/email.cjs.map +1 -1
  160. package/dist/email.d.cts +3 -7
  161. package/dist/email.d.cts.map +1 -1
  162. package/dist/email.d.mts +3 -7
  163. package/dist/email.d.mts.map +1 -1
  164. package/dist/email.mjs +16 -3
  165. package/dist/email.mjs.map +1 -1
  166. package/dist/encryption.cjs +96 -0
  167. package/dist/encryption.cjs.map +1 -0
  168. package/dist/encryption.d.cts +117 -0
  169. package/dist/encryption.d.cts.map +1 -0
  170. package/dist/encryption.d.mts +117 -0
  171. package/dist/encryption.d.mts.map +1 -0
  172. package/dist/encryption.mjs +83 -0
  173. package/dist/encryption.mjs.map +1 -0
  174. package/dist/endpoints/index.cjs +8 -10
  175. package/dist/endpoints/index.d.cts +51 -7
  176. package/dist/endpoints/index.d.cts.map +1 -0
  177. package/dist/endpoints/index.d.mts +51 -7
  178. package/dist/endpoints/index.d.mts.map +1 -0
  179. package/dist/endpoints/index.mjs +6 -10
  180. package/dist/external-api-MJ8id87V.d.mts +105 -0
  181. package/dist/external-api-MJ8id87V.d.mts.map +1 -0
  182. package/dist/external-api-O107yzZJ.d.cts +105 -0
  183. package/dist/external-api-O107yzZJ.d.cts.map +1 -0
  184. package/dist/external-api.cjs +142 -0
  185. package/dist/external-api.cjs.map +1 -0
  186. package/dist/external-api.d.cts +2 -0
  187. package/dist/external-api.d.mts +2 -0
  188. package/dist/external-api.mjs +139 -0
  189. package/dist/external-api.mjs.map +1 -0
  190. package/dist/file-server.cjs +42 -10
  191. package/dist/file-server.cjs.map +1 -1
  192. package/dist/file-server.d.cts +6 -10
  193. package/dist/file-server.d.cts.map +1 -1
  194. package/dist/file-server.d.mts +6 -10
  195. package/dist/file-server.d.mts.map +1 -1
  196. package/dist/file-server.mjs +34 -2
  197. package/dist/file-server.mjs.map +1 -1
  198. package/dist/functions/index.cjs +3 -6
  199. package/dist/functions/index.d.cts +3 -4
  200. package/dist/functions/index.d.mts +3 -4
  201. package/dist/functions/index.mjs +2 -6
  202. package/dist/{functions-14lpEFL4.mjs → functions-BFizikJU.mjs} +376 -238
  203. package/dist/{functions-14lpEFL4.mjs.map → functions-BFizikJU.mjs.map} +1 -1
  204. package/dist/{functions-i_la-N5r.cjs → functions-CfzJG9hK.cjs} +414 -264
  205. package/dist/functions-CfzJG9hK.cjs.map +1 -0
  206. package/dist/index-BuzRvKOQ.d.cts +115 -0
  207. package/dist/index-BuzRvKOQ.d.cts.map +1 -0
  208. package/dist/index-CTkKOer4.d.mts +115 -0
  209. package/dist/index-CTkKOer4.d.mts.map +1 -0
  210. package/dist/index-CeEtxDmK.d.cts +79 -0
  211. package/dist/index-CeEtxDmK.d.cts.map +1 -0
  212. package/dist/index-CeEtxDmK.d.mts +79 -0
  213. package/dist/index-CeEtxDmK.d.mts.map +1 -0
  214. package/dist/index.cjs +6 -3
  215. package/dist/index.d.cts +27 -4
  216. package/dist/index.d.cts.map +1 -0
  217. package/dist/index.d.mts +27 -4
  218. package/dist/index.d.mts.map +1 -0
  219. package/dist/index.mjs +3 -3
  220. package/dist/kms-B-Hm3d5r.cjs +85 -0
  221. package/dist/kms-B-Hm3d5r.cjs.map +1 -0
  222. package/dist/kms-BdUlMJEZ.mjs +85 -0
  223. package/dist/kms-BdUlMJEZ.mjs.map +1 -0
  224. package/dist/kysely-Bii4l6eP.mjs +370 -0
  225. package/dist/kysely-Bii4l6eP.mjs.map +1 -0
  226. package/dist/kysely-CO_Dk43W.cjs +383 -0
  227. package/dist/kysely-CO_Dk43W.cjs.map +1 -0
  228. package/dist/kysely-D0bpzgPs.d.cts +175 -0
  229. package/dist/kysely-D0bpzgPs.d.cts.map +1 -0
  230. package/dist/kysely-DUqC3Ie0.d.mts +175 -0
  231. package/dist/kysely-DUqC3Ie0.d.mts.map +1 -0
  232. package/dist/{telemetry-C3L0iS28.d.cts → lambdaTelemetry-8vnmVZQ5.d.cts} +3 -6
  233. package/dist/lambdaTelemetry-8vnmVZQ5.d.cts.map +1 -0
  234. package/dist/{telemetry-D7bVFLGi.d.mts → lambdaTelemetry-8vnmVZQ5.d.mts} +3 -6
  235. package/dist/lambdaTelemetry-8vnmVZQ5.d.mts.map +1 -0
  236. package/dist/{lazyAccessors-BoJN3SMd.mjs → lazyAccessors-CFanua0O.mjs} +20 -60
  237. package/dist/lazyAccessors-CFanua0O.mjs.map +1 -0
  238. package/dist/{lazyAccessors-e3j2oE2m.cjs → lazyAccessors-hJKGv8Ay.cjs} +60 -113
  239. package/dist/lazyAccessors-hJKGv8Ay.cjs.map +1 -0
  240. package/dist/mobile-app.cjs +73 -0
  241. package/dist/mobile-app.cjs.map +1 -0
  242. package/dist/mobile-app.d.cts +61 -0
  243. package/dist/mobile-app.d.cts.map +1 -0
  244. package/dist/mobile-app.d.mts +61 -0
  245. package/dist/mobile-app.d.mts.map +1 -0
  246. package/dist/mobile-app.mjs +72 -0
  247. package/dist/mobile-app.mjs.map +1 -0
  248. package/dist/object-storage.cjs +18 -10
  249. package/dist/object-storage.cjs.map +1 -1
  250. package/dist/object-storage.d.cts +3 -7
  251. package/dist/object-storage.d.cts.map +1 -1
  252. package/dist/object-storage.d.mts +3 -7
  253. package/dist/object-storage.d.mts.map +1 -1
  254. package/dist/object-storage.mjs +11 -3
  255. package/dist/object-storage.mjs.map +1 -1
  256. package/dist/processAudits-BRRVVHUB.mjs +131 -0
  257. package/dist/processAudits-BRRVVHUB.mjs.map +1 -0
  258. package/dist/processAudits-DasOZjPl.cjs +154 -0
  259. package/dist/processAudits-DasOZjPl.cjs.map +1 -0
  260. package/dist/queue/index.cjs +6 -189
  261. package/dist/queue/index.d.cts +3 -60
  262. package/dist/queue/index.d.mts +3 -60
  263. package/dist/queue/index.mjs +3 -186
  264. package/dist/rest-api.cjs +90 -59
  265. package/dist/rest-api.cjs.map +1 -1
  266. package/dist/rest-api.d.cts +70 -42
  267. package/dist/rest-api.d.cts.map +1 -1
  268. package/dist/rest-api.d.mts +70 -42
  269. package/dist/rest-api.d.mts.map +1 -1
  270. package/dist/rest-api.mjs +82 -51
  271. package/dist/rest-api.mjs.map +1 -1
  272. package/dist/{chunk-DWy1uDak.cjs → rolldown-runtime-y5ARvAq5.cjs} +14 -18
  273. package/dist/runSubscriber-BHvJ8POr.mjs +109 -0
  274. package/dist/runSubscriber-BHvJ8POr.mjs.map +1 -0
  275. package/dist/runSubscriber-D8nLXIv1.cjs +126 -0
  276. package/dist/runSubscriber-D8nLXIv1.cjs.map +1 -0
  277. package/dist/shutdown-BMJmAhSt.cjs +38 -0
  278. package/dist/shutdown-BMJmAhSt.cjs.map +1 -0
  279. package/dist/shutdown-C7xa8x9S.mjs +27 -0
  280. package/dist/shutdown-C7xa8x9S.mjs.map +1 -0
  281. package/dist/site.cjs +33 -7
  282. package/dist/site.cjs.map +1 -1
  283. package/dist/site.d.cts +17 -7
  284. package/dist/site.d.cts.map +1 -1
  285. package/dist/site.d.mts +17 -7
  286. package/dist/site.d.mts.map +1 -1
  287. package/dist/site.mjs +29 -3
  288. package/dist/site.mjs.map +1 -1
  289. package/dist/stages-BSCF19o2.d.cts +56 -0
  290. package/dist/stages-BSCF19o2.d.cts.map +1 -0
  291. package/dist/stages-BSCF19o2.d.mts +56 -0
  292. package/dist/stages-BSCF19o2.d.mts.map +1 -0
  293. package/dist/subscribers/index.cjs +118 -6
  294. package/dist/subscribers/index.cjs.map +1 -0
  295. package/dist/subscribers/index.d.cts +51 -6
  296. package/dist/subscribers/index.d.cts.map +1 -0
  297. package/dist/subscribers/index.d.mts +51 -6
  298. package/dist/subscribers/index.d.mts.map +1 -0
  299. package/dist/subscribers/index.mjs +115 -5
  300. package/dist/subscribers/index.mjs.map +1 -0
  301. package/dist/surfaceEnv-CNimK76p.cjs +56 -0
  302. package/dist/surfaceEnv-CNimK76p.cjs.map +1 -0
  303. package/dist/surfaceEnv-wMT5QzgZ.mjs +45 -0
  304. package/dist/surfaceEnv-wMT5QzgZ.mjs.map +1 -0
  305. package/dist/telemetry-B48RLjyk.d.cts +40 -0
  306. package/dist/telemetry-B48RLjyk.d.cts.map +1 -0
  307. package/dist/telemetry-DRtT1_0A.d.mts +40 -0
  308. package/dist/telemetry-DRtT1_0A.d.mts.map +1 -0
  309. package/dist/telemetry.cjs +56 -0
  310. package/dist/telemetry.cjs.map +1 -0
  311. package/dist/telemetry.d.cts +2 -0
  312. package/dist/telemetry.d.mts +2 -0
  313. package/dist/telemetry.mjs +55 -0
  314. package/dist/telemetry.mjs.map +1 -0
  315. package/dist/topic/index.cjs +3 -137
  316. package/dist/topic/index.d.cts +2 -4
  317. package/dist/topic/index.d.mts +2 -4
  318. package/dist/topic/index.mjs +2 -134
  319. package/dist/tracing-CxaZ98IB.mjs +110 -0
  320. package/dist/tracing-CxaZ98IB.mjs.map +1 -0
  321. package/dist/tracing-DPMidF_r.cjs +127 -0
  322. package/dist/tracing-DPMidF_r.cjs.map +1 -0
  323. package/dist/{types-BlAkSuGI.d.cts → types-DMuSQeLL.d.cts} +3 -5
  324. package/dist/types-DMuSQeLL.d.cts.map +1 -0
  325. package/dist/{types-aKksMEWL.d.mts → types-DMuSQeLL.d.mts} +3 -5
  326. package/dist/types-DMuSQeLL.d.mts.map +1 -0
  327. package/dist/types.d.cts +1 -1
  328. package/dist/types.d.mts +1 -1
  329. package/dist/types.mjs +1 -0
  330. package/dist/worker.cjs +59 -34
  331. package/dist/worker.cjs.map +1 -1
  332. package/dist/worker.d.cts +70 -45
  333. package/dist/worker.d.cts.map +1 -1
  334. package/dist/worker.d.mts +70 -44
  335. package/dist/worker.d.mts.map +1 -1
  336. package/dist/worker.mjs +54 -29
  337. package/dist/worker.mjs.map +1 -1
  338. package/package.json +96 -42
  339. package/dist/Construct-BD5neF7w.mjs.map +0 -1
  340. package/dist/Construct-C0ijr2qp.d.cts +0 -117
  341. package/dist/Construct-C0ijr2qp.d.cts.map +0 -1
  342. package/dist/Construct-Ct8nalEi.d.mts +0 -117
  343. package/dist/Construct-Ct8nalEi.d.mts.map +0 -1
  344. package/dist/Construct-CyS3RpTL.cjs.map +0 -1
  345. package/dist/Cron-DmQ8vQ4b.d.cts.map +0 -1
  346. package/dist/Cron-dh4rUgib.d.mts.map +0 -1
  347. package/dist/CronBuilder-BquXDbDI.d.cts +0 -44
  348. package/dist/CronBuilder-BquXDbDI.d.cts.map +0 -1
  349. package/dist/CronBuilder-CGgY2080.d.mts +0 -44
  350. package/dist/CronBuilder-CGgY2080.d.mts.map +0 -1
  351. package/dist/CronBuilder-CYKT5RiO.mjs.map +0 -1
  352. package/dist/CronBuilder-Da0C0edR.cjs.map +0 -1
  353. package/dist/Endpoint-BjWKinFA.d.mts.map +0 -1
  354. package/dist/Endpoint-DCQPMdUX.mjs.map +0 -1
  355. package/dist/Endpoint-DcWXE-SZ.cjs.map +0 -1
  356. package/dist/Endpoint-dav89W6-.d.cts.map +0 -1
  357. package/dist/EndpointFactory-CdWB7wPw.cjs.map +0 -1
  358. package/dist/EndpointFactory-CjV8F_lJ.mjs.map +0 -1
  359. package/dist/HonoEndpointAdaptor-DtL9j19R.cjs.map +0 -1
  360. package/dist/HonoEndpointAdaptor-P1ahhZHu.mjs.map +0 -1
  361. package/dist/Queue-D7ZuwBhy.d.cts.map +0 -1
  362. package/dist/Queue-gVGfi2Yk.d.mts.map +0 -1
  363. package/dist/Subscriber-2mEi0ImH.d.cts.map +0 -1
  364. package/dist/Subscriber-xTJ9ayPN.d.mts.map +0 -1
  365. package/dist/SubscriberBuilder-4OPehf2R.cjs.map +0 -1
  366. package/dist/SubscriberBuilder-BjkbeT9l.mjs.map +0 -1
  367. package/dist/SubscriberBuilder-Dptmo-1A.d.mts +0 -62
  368. package/dist/SubscriberBuilder-Dptmo-1A.d.mts.map +0 -1
  369. package/dist/SubscriberBuilder-waNhzjSM.d.cts +0 -62
  370. package/dist/SubscriberBuilder-waNhzjSM.d.cts.map +0 -1
  371. package/dist/Topic-19QeHBIR.d.cts +0 -91
  372. package/dist/Topic-19QeHBIR.d.cts.map +0 -1
  373. package/dist/Topic-DuFeqkBh.d.mts +0 -91
  374. package/dist/Topic-DuFeqkBh.d.mts.map +0 -1
  375. package/dist/auth.d.cts.map +0 -1
  376. package/dist/auth.d.mts.map +0 -1
  377. package/dist/cache-0ANvRQnD.mjs +0 -51
  378. package/dist/cache-0ANvRQnD.mjs.map +0 -1
  379. package/dist/cache-3WSvAulx.cjs +0 -57
  380. package/dist/cache-3WSvAulx.cjs.map +0 -1
  381. package/dist/cache-BrRz3fEB.d.mts.map +0 -1
  382. package/dist/cache-BtZY_tHe.d.cts.map +0 -1
  383. package/dist/clone-DblgEZZa.mjs.map +0 -1
  384. package/dist/clone-Dy0cR2SZ.cjs.map +0 -1
  385. package/dist/construct-interface-BfjcOD_E.cjs +0 -117
  386. package/dist/construct-interface-BfjcOD_E.cjs.map +0 -1
  387. package/dist/construct-interface-D9d4Gm4p.d.cts.map +0 -1
  388. package/dist/construct-interface-Z4CpS8tK.mjs +0 -81
  389. package/dist/construct-interface-Z4CpS8tK.mjs.map +0 -1
  390. package/dist/construct-interface-g5GM5pwR.d.mts.map +0 -1
  391. package/dist/database/kysely.cjs.map +0 -1
  392. package/dist/database/kysely.d.cts.map +0 -1
  393. package/dist/database/kysely.d.mts.map +0 -1
  394. package/dist/database/kysely.mjs.map +0 -1
  395. package/dist/functions-i_la-N5r.cjs.map +0 -1
  396. package/dist/index-Bd5FqCoe.d.cts.map +0 -1
  397. package/dist/index-BknhM6Ux.d.mts +0 -31
  398. package/dist/index-BknhM6Ux.d.mts.map +0 -1
  399. package/dist/index-CBSfrowv.d.cts +0 -31
  400. package/dist/index-CBSfrowv.d.cts.map +0 -1
  401. package/dist/index-D24Xm79M.d.cts +0 -171
  402. package/dist/index-D24Xm79M.d.cts.map +0 -1
  403. package/dist/index-_ajboYxK.d.mts +0 -171
  404. package/dist/index-_ajboYxK.d.mts.map +0 -1
  405. package/dist/index-lAO9egTb.d.mts.map +0 -1
  406. package/dist/lazyAccessors-BoJN3SMd.mjs.map +0 -1
  407. package/dist/lazyAccessors-e3j2oE2m.cjs.map +0 -1
  408. package/dist/processAudits-CGqttuXm.cjs +0 -92
  409. package/dist/processAudits-CGqttuXm.cjs.map +0 -1
  410. package/dist/processAudits-Dmts9H_b.mjs +0 -80
  411. package/dist/processAudits-Dmts9H_b.mjs.map +0 -1
  412. package/dist/queue/index.cjs.map +0 -1
  413. package/dist/queue/index.d.cts.map +0 -1
  414. package/dist/queue/index.d.mts.map +0 -1
  415. package/dist/queue/index.mjs.map +0 -1
  416. package/dist/surfaceEnv-BFXEms2f.cjs +0 -39
  417. package/dist/surfaceEnv-BFXEms2f.cjs.map +0 -1
  418. package/dist/surfaceEnv-C3Ktahea.mjs +0 -27
  419. package/dist/surfaceEnv-C3Ktahea.mjs.map +0 -1
  420. package/dist/telemetry-C3L0iS28.d.cts.map +0 -1
  421. package/dist/telemetry-D7bVFLGi.d.mts.map +0 -1
  422. package/dist/topic/index.cjs.map +0 -1
  423. package/dist/topic/index.mjs.map +0 -1
  424. package/dist/types-BlAkSuGI.d.cts.map +0 -1
  425. package/dist/types-aKksMEWL.d.mts.map +0 -1
@@ -0,0 +1,268 @@
1
+ import { c as ServicesOf, n as Construct, r as Consumable, t as Authenticator } from "./construct-interface-B1AfqRl4.cjs";
2
+ import { n as Telemetry } from "./telemetry-B48RLjyk.cjs";
3
+ import { EnvironmentParser } from "@geekmidas/envkit";
4
+ import { Service, ServiceRecord, ServiceRegisterOptions } from "@geekmidas/services";
5
+ import { ConstructName, Declaration } from "@geekmidas/manifest";
6
+ import { betterAuth } from "better-auth";
7
+ import { Hono } from "hono";
8
+ //#region src/auth.d.ts
9
+ /** The server better-auth hands back. */
10
+ type AuthServer = ReturnType<typeof betterAuth>;
11
+ /** A signed-in session as better-auth hands it back: `{ user, session }`. */
12
+ type AuthSession = AuthServer['$Infer']['Session'];
13
+ /**
14
+ * What `.dependsOn([auth])` hands a handler: the auth server, over HTTP.
15
+ *
16
+ * The server itself — its secret, its tenant's connection, its mailer — lives
17
+ * in the auth app's own process and nowhere else. Every other process is a
18
+ * caller of it, so what it is given is an address and this, with the one
19
+ * call handlers make kept in Better Auth's shape: `api.getSession({ headers })`
20
+ * answers `{ user, session }` or `null`, as the server's own `api` does.
21
+ */
22
+ interface AuthClient {
23
+ readonly api: {
24
+ /**
25
+ * The session the request's cookie or bearer token belongs to, or `null`
26
+ * when there is none — asked of `<basePath>/get-session` at the auth
27
+ * server's URL. Only `cookie` and `authorization` are forwarded, with
28
+ * the client's address as `x-gkm-client-ip` (read from the request's
29
+ * `x-forwarded-for`) and the active trace context.
30
+ *
31
+ * @throws {AuthServerUnreachable} when the request does not get there.
32
+ * @throws {SessionCheckFailed} when the server answers with a failure.
33
+ */
34
+ getSession(input: {
35
+ headers: ConstructorParameters<typeof Headers>[0];
36
+ }): Promise<AuthSession | null>;
37
+ };
38
+ }
39
+ /** Everything better-auth takes, minus what the construct owns. */
40
+ type BetterAuthOptions = Omit<Parameters<typeof betterAuth>[0], 'database' | 'secret' | 'basePath' | 'baseURL'>;
41
+ /**
42
+ * What an `options` callback is handed: the options this construct was
43
+ * registered with, and a client for each construct its `dependsOn` names —
44
+ * keyed by service name, exactly as an endpoint's handler receives them.
45
+ */
46
+ type BetterAuthOptionsContext<TUses extends readonly Consumable[]> = ServiceRegisterOptions & {
47
+ services: ServiceRecord<[...ServicesOf<TUses>]>;
48
+ };
49
+ interface BetterAuthConfig<TDatabase extends Consumable, TUses extends readonly Consumable[] = readonly []> {
50
+ /**
51
+ * The schema tenant its tables live in.
52
+ *
53
+ * A construct rather than a URL: the tenant already declares its schema and
54
+ * its role, and taking the declaration is what puts the edge in the graph
55
+ * instead of a connection string in two places.
56
+ */
57
+ database: TDatabase;
58
+ /**
59
+ * The app that serves this auth server, relative to the workspace root —
60
+ * `'apps/auth'`.
61
+ *
62
+ * Required, for the reason `RestApi.path` is. Not to be confused with
63
+ * `basePath`, which is where its routes are mounted in a URL.
64
+ */
65
+ path: string;
66
+ /**
67
+ * The label it answers on under a stage's domain — `api` for
68
+ * `api.myapp.com`, from `domains` — and under the project locally,
69
+ * `api.myapp.localhost`. Absent, its id kebab-cased.
70
+ */
71
+ subdomain?: string;
72
+ /**
73
+ * Where the auth routes are mounted, e.g. `/api/auth`.
74
+ *
75
+ * Structural — it is part of the URL every client calls, so it cannot differ
76
+ * between stages the way the host can.
77
+ */
78
+ basePath?: string;
79
+ /**
80
+ * The constructs `options` uses — the mailer a magic link goes through,
81
+ * most often.
82
+ *
83
+ * One list, two jobs, the way an endpoint's `.dependsOn()` has: each is an
84
+ * edge on the server's handler, so whatever is composed from the edges (a
85
+ * container's environment, a deploy's grants) includes it; and each is
86
+ * handed to `options` as a client in `services`, so there is no other way
87
+ * for `options` to reach it — nothing to import and register by hand, and
88
+ * so nothing that can be used without being declared.
89
+ */
90
+ dependsOn?: TUses;
91
+ /**
92
+ * What the auth server's process emits — the `Telemetry` construct, passed
93
+ * like a `RestApi`'s. An edge to the node: the deploy hands the process the
94
+ * `OTEL_*` keys its stage resolves.
95
+ */
96
+ telemetry?: Telemetry;
97
+ /**
98
+ * The rest of better-auth's options: providers, plugins, email settings.
99
+ *
100
+ * A function when they need another construct — a magic-link plugin has to
101
+ * *send* the link. It is handed the options this construct was registered
102
+ * with, and `services`: a client for each construct in `dependsOn`.
103
+ */
104
+ options?: BetterAuthOptions | ((context: BetterAuthOptionsContext<TUses>) => BetterAuthOptions | Promise<BetterAuthOptions>);
105
+ }
106
+ declare class BetterAuth<TName extends string = string, TDatabase extends Consumable = Consumable, const TUses extends readonly Consumable[] = readonly []> implements Construct<TName, AuthClient>, Authenticator<AuthSession> {
107
+ private readonly config;
108
+ readonly id: TName;
109
+ /**
110
+ * What `.dependsOn([auth])` injects: an {@link AuthClient}, never the server.
111
+ *
112
+ * Which of the two a process holds is decided by how it reaches the
113
+ * construct, not by asking where it is running. The auth app's process is
114
+ * its generated entry, which calls {@link server} and nothing else — a
115
+ * self-serving surface has no endpoints of its own for a `dependsOn` to sit
116
+ * on. Every other process reaches it through this. So the API, a worker, a
117
+ * test's in-process endpoints all get the client, and none of them needs
118
+ * the signing secret, the auth tenant's URL or the mailer to start.
119
+ */
120
+ readonly service: Service<Uncapitalize<TName>, AuthClient>;
121
+ readonly basePath: string;
122
+ /**
123
+ * Declared once and read by both `declare()` and `connect()`, so the keys the
124
+ * target publishes and the keys the server reads cannot drift.
125
+ */
126
+ private readonly keys;
127
+ constructor(id: ConstructName<TName>, config: BetterAuthConfig<TDatabase, TUses>);
128
+ /**
129
+ * A signing secret and a surface.
130
+ *
131
+ * The database is *not* declared here — the tenant that was passed in
132
+ * declares it, and declaring it twice is the duplication the whole model
133
+ * removes. What is declared is what this construct owns: the key it signs
134
+ * with, and the routes it answers on.
135
+ *
136
+ * One endpoint, wildcarded. Better Auth routes internally and the set of
137
+ * paths depends on which capabilities are enabled, so enumerating them here
138
+ * would be a copy of its router that goes stale on its next release. The
139
+ * surface's job is to send everything under `basePath` to one handler, which
140
+ * is exactly what the declaration says.
141
+ */
142
+ declare(): Declaration[];
143
+ /**
144
+ * Whose request this is: the session for these headers, or `null`.
145
+ *
146
+ * Asked of the auth server over HTTP, at the URL the `.auth()` edge injects —
147
+ * so it is the same call whether the server runs in this process, beside
148
+ * it, or behind MSW in a test. The same call {@link AuthClient} makes.
149
+ */
150
+ verify(headers: Headers, envParser: EnvironmentParser<{}>): Promise<AuthSession | null>;
151
+ /**
152
+ * The client a caller of this server holds: its URL and nothing else.
153
+ *
154
+ * `<ID>_URL` is the one key a consumer is given for an edge to a surface —
155
+ * the compose network's address between containers, the public one where
156
+ * that is all there is — so this is everything it can know.
157
+ */
158
+ client(envParser: EnvironmentParser<{}>): AuthClient;
159
+ /**
160
+ * The tenant this server keeps its tables in — whose migrations folder,
161
+ * `db/<tenant>/`, Better Auth's schema is written into.
162
+ */
163
+ get databaseId(): string;
164
+ /**
165
+ * The SQL that brings the tenant up to Better Auth's schema, or `undefined`
166
+ * when it already matches.
167
+ *
168
+ * What `gkm migration` writes as the tenant's next migration, so Better
169
+ * Auth's tables are committed, reviewed and applied like any other — rather
170
+ * than diffed against the database at runtime, where a change nobody wrote
171
+ * down happens on whichever machine migrates first.
172
+ *
173
+ * Compared as the owner, against the tenant `gkm migrate` has already brought
174
+ * up to date: what comes back is only what the committed files are missing.
175
+ */
176
+ pendingMigration(options: ServiceRegisterOptions): Promise<string | undefined>;
177
+ /**
178
+ * The server this surface runs as, built from its own declaration.
179
+ *
180
+ * A surface is a deploy unit, so something has to serve it, and the thing
181
+ * that knows how is the construct — not a generator writing a mount into
182
+ * somebody else's entry point. That is how the auth server came to be
183
+ * mounted by a hook in the application it was supposed to be separate from,
184
+ * and then to be served by nothing at all when the hook was deleted.
185
+ *
186
+ * The routes come from {@link declare}: one wildcard under `basePath`, read
187
+ * off the same declaration the manifest carries, so the surface the graph
188
+ * describes and the surface that answers requests cannot disagree.
189
+ *
190
+ * ```ts
191
+ * // .gkm/server/app.ts — the whole generated entry
192
+ * import { auth } from '@acme/constructs/auth.js';
193
+ * export const { app } = await auth.server({ envParser });
194
+ * ```
195
+ *
196
+ * The only way to the server: it is what reads the signing secret, opens
197
+ * the tenant and builds the mailer, so it is built here, in the auth app's
198
+ * own process, and `.dependsOn([auth])` everywhere else gets
199
+ * {@link AuthClient}. `auth` is the better-auth instance behind the app.
200
+ */
201
+ server(options: ServiceRegisterOptions): Promise<{
202
+ app: Hono;
203
+ auth: AuthServer;
204
+ }>;
205
+ /**
206
+ * The ids of the better-auth plugins this server runs — what a client has
207
+ * to pair its own plugins with (`magic-link` with `magicLinkClient`).
208
+ * Resolved the way the server resolves them, options callback included.
209
+ */
210
+ pluginIds(options: ServiceRegisterOptions): Promise<string[]>;
211
+ /** Better-auth's options as given — a value, or a callback of the environment. */
212
+ private configured;
213
+ private connect;
214
+ /**
215
+ * Everything better-auth is given: the app's options, and what the construct
216
+ * owns — its secret, its URL, its tenant's connection, the origins and cookie
217
+ * domain its graph derives. One place, so the server and its migrations are
218
+ * built from the same options.
219
+ */
220
+ private optionsFor;
221
+ }
222
+ /** A magic link moved to the device address when an app is its destination. */
223
+ declare function deviceLink(url: string, deviceUrl: string): string;
224
+ /** A mobile app depends on this auth server, which has no Expo plugin. */
225
+ declare class ExpoPluginRequired extends Error {
226
+ readonly server: string;
227
+ /** The schemes the graph says call it — what made the plugin necessary. */
228
+ readonly origins: readonly string[];
229
+ constructor(server: string,
230
+ /** The schemes the graph says call it — what made the plugin necessary. */
231
+ origins: readonly string[]);
232
+ }
233
+ /** The auth server answered a session check with a failure. */
234
+ declare class SessionCheckFailed extends Error {
235
+ readonly authenticator: string;
236
+ readonly status: number;
237
+ constructor(authenticator: string, status: number);
238
+ }
239
+ /** A session check never reached the auth server. */
240
+ declare class AuthServerUnreachable extends Error {
241
+ readonly authenticator: string;
242
+ readonly url: string;
243
+ constructor(authenticator: string, url: string, cause: unknown);
244
+ }
245
+ /**
246
+ * Better Auth's DDL, safe to run where its tables already exist.
247
+ *
248
+ * Its SQL is Kysely's, so its shape is known: `create table "…"`, `create index
249
+ * "…"`, `alter table "…" add column "…"`. A database that has been running
250
+ * already has those — Better Auth used to create them at runtime — and the
251
+ * first committed migration would fail on them rather than recording that they
252
+ * are there.
253
+ */
254
+ declare function idempotent(statements: string): string;
255
+ /**
256
+ * `request`, without {@link CLIENT_IP_HEADER} unless an internal caller sent
257
+ * it — no `Origin`, no forwarding header, a loopback or private peer: the
258
+ * rule a request's span continues a trace by (`@geekmidas/telescope`'s
259
+ * `isInternalCaller`).
260
+ *
261
+ * The stack's own edges strip the header already. This holds wherever one
262
+ * does not — a platform's proxy, a port published straight to the internet —
263
+ * so a stranger cannot pick the address Better Auth rate-limits them by.
264
+ */
265
+ declare function withTrustedClientIp(request: Request, remoteAddress: string | undefined): Request;
266
+ //#endregion
267
+ export { BetterAuth as a, BetterAuthOptionsContext as c, deviceLink as d, idempotent as f, AuthSession as i, ExpoPluginRequired as l, AuthServer as n, BetterAuthConfig as o, withTrustedClientIp as p, AuthServerUnreachable as r, BetterAuthOptions as s, AuthClient as t, SessionCheckFailed as u };
268
+ //# sourceMappingURL=auth-BMCJN30Y.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-BMCJN30Y.d.cts","names":[],"sources":["../src/auth.ts"],"mappings":";;;;;;;;;KA2DY,aAAa,kBAAkB;;KAG/B,cAAc;;;;;;;;;;UAWT;WACP;;;;;;;;;;;IAWR,WAAW;MACV,SAAS,6BAA6B;QACnC,QAAQ;;;;KAKF,oBAAoB,KAC/B,kBAAkB;;;;;;KASP,yBAAyB,uBAAuB,gBAC3D;EACC,UAAU,kBAAkB,WAAW;;UAGxB,iBAChB,kBAAkB,YAClB,uBAAuB;;;;;;;;EASvB,UAAU;;;;;;;;EAQV;;;;;;EAMA;;;;;;;EAOA;;;;;;;;;;;;EAYA,YAAY;;;;;;EAMZ,YAAY;;;;;;;;EAQZ,UACG,sBAEA,SAAS,yBAAyB,WAC7B,oBAAoB,QAAQ;;cAKxB,WACZ,+BACA,kBAAkB,aAAa,kBACzB,uBAAuB,uCACjB,UAAU,OAAO,aAAa,cAAc;mBA+BtC;WA7BT,IAAI;;;;;;;;;;;;WAYJ,SAAS,QAAQ,aAAa,QAAQ;WACtC;;;;;mBAMQ;EAQjB,YACC,IAAI,cAAc,QACD,QAAQ,iBAAiB,WAAW;;;;;;;;;;;;;;;EAuCtD,WAAW;;;;;;;;EAgDL,OACL,SAAS,SACT,WAAW,wBACT,QAAQ;;;;;;;;EAWX,OAAO,WAAW,wBAAwB;;;;;MAkBtC;;;;;;;;;;;;;EAgBE,iBACL,SAAS,yBACP;;;;;;;;;;;;;;;;;;;;;;;;;EAsDG,OACL,SAAS,yBACP;IAAU,KAAK;IAAM,MAAM;;;;;;;EAsDxB,UAAU,SAAS,yBAAyB;;UAMpC;UAuBA;;;;;;;UAmBA;;;iBA8JC,WAAW,aAAa;;cAY3B,2BAA2B;WAE7B;;WAEA;EAHV,YACU,gBAEA;;EAAA;;;cAiEE,2BAA2B;WAE7B;WACA;EAFV,YACU,uBACA;;;cAYE,8BAA8B;WAEhC;WACA;EAFV,YACU,uBACA,aACT;;;;;;;;;;;iBAqBc,WAAW;;;;;;;;;;;iBAgCX,oBACf,SAAS,SACT,oCACE"}
@@ -0,0 +1,268 @@
1
+ import { c as ServicesOf, n as Construct, r as Consumable, t as Authenticator } from "./construct-interface-DluK3_da.mjs";
2
+ import { n as Telemetry } from "./telemetry-DRtT1_0A.mjs";
3
+ import { ConstructName, Declaration } from "@geekmidas/manifest";
4
+ import { EnvironmentParser } from "@geekmidas/envkit";
5
+ import { Service, ServiceRecord, ServiceRegisterOptions } from "@geekmidas/services";
6
+ import { Hono } from "hono";
7
+ import { betterAuth } from "better-auth";
8
+ //#region src/auth.d.ts
9
+ /** The server better-auth hands back. */
10
+ type AuthServer = ReturnType<typeof betterAuth>;
11
+ /** A signed-in session as better-auth hands it back: `{ user, session }`. */
12
+ type AuthSession = AuthServer['$Infer']['Session'];
13
+ /**
14
+ * What `.dependsOn([auth])` hands a handler: the auth server, over HTTP.
15
+ *
16
+ * The server itself — its secret, its tenant's connection, its mailer — lives
17
+ * in the auth app's own process and nowhere else. Every other process is a
18
+ * caller of it, so what it is given is an address and this, with the one
19
+ * call handlers make kept in Better Auth's shape: `api.getSession({ headers })`
20
+ * answers `{ user, session }` or `null`, as the server's own `api` does.
21
+ */
22
+ interface AuthClient {
23
+ readonly api: {
24
+ /**
25
+ * The session the request's cookie or bearer token belongs to, or `null`
26
+ * when there is none — asked of `<basePath>/get-session` at the auth
27
+ * server's URL. Only `cookie` and `authorization` are forwarded, with
28
+ * the client's address as `x-gkm-client-ip` (read from the request's
29
+ * `x-forwarded-for`) and the active trace context.
30
+ *
31
+ * @throws {AuthServerUnreachable} when the request does not get there.
32
+ * @throws {SessionCheckFailed} when the server answers with a failure.
33
+ */
34
+ getSession(input: {
35
+ headers: ConstructorParameters<typeof Headers>[0];
36
+ }): Promise<AuthSession | null>;
37
+ };
38
+ }
39
+ /** Everything better-auth takes, minus what the construct owns. */
40
+ type BetterAuthOptions = Omit<Parameters<typeof betterAuth>[0], 'database' | 'secret' | 'basePath' | 'baseURL'>;
41
+ /**
42
+ * What an `options` callback is handed: the options this construct was
43
+ * registered with, and a client for each construct its `dependsOn` names —
44
+ * keyed by service name, exactly as an endpoint's handler receives them.
45
+ */
46
+ type BetterAuthOptionsContext<TUses extends readonly Consumable[]> = ServiceRegisterOptions & {
47
+ services: ServiceRecord<[...ServicesOf<TUses>]>;
48
+ };
49
+ interface BetterAuthConfig<TDatabase extends Consumable, TUses extends readonly Consumable[] = readonly []> {
50
+ /**
51
+ * The schema tenant its tables live in.
52
+ *
53
+ * A construct rather than a URL: the tenant already declares its schema and
54
+ * its role, and taking the declaration is what puts the edge in the graph
55
+ * instead of a connection string in two places.
56
+ */
57
+ database: TDatabase;
58
+ /**
59
+ * The app that serves this auth server, relative to the workspace root —
60
+ * `'apps/auth'`.
61
+ *
62
+ * Required, for the reason `RestApi.path` is. Not to be confused with
63
+ * `basePath`, which is where its routes are mounted in a URL.
64
+ */
65
+ path: string;
66
+ /**
67
+ * The label it answers on under a stage's domain — `api` for
68
+ * `api.myapp.com`, from `domains` — and under the project locally,
69
+ * `api.myapp.localhost`. Absent, its id kebab-cased.
70
+ */
71
+ subdomain?: string;
72
+ /**
73
+ * Where the auth routes are mounted, e.g. `/api/auth`.
74
+ *
75
+ * Structural — it is part of the URL every client calls, so it cannot differ
76
+ * between stages the way the host can.
77
+ */
78
+ basePath?: string;
79
+ /**
80
+ * The constructs `options` uses — the mailer a magic link goes through,
81
+ * most often.
82
+ *
83
+ * One list, two jobs, the way an endpoint's `.dependsOn()` has: each is an
84
+ * edge on the server's handler, so whatever is composed from the edges (a
85
+ * container's environment, a deploy's grants) includes it; and each is
86
+ * handed to `options` as a client in `services`, so there is no other way
87
+ * for `options` to reach it — nothing to import and register by hand, and
88
+ * so nothing that can be used without being declared.
89
+ */
90
+ dependsOn?: TUses;
91
+ /**
92
+ * What the auth server's process emits — the `Telemetry` construct, passed
93
+ * like a `RestApi`'s. An edge to the node: the deploy hands the process the
94
+ * `OTEL_*` keys its stage resolves.
95
+ */
96
+ telemetry?: Telemetry;
97
+ /**
98
+ * The rest of better-auth's options: providers, plugins, email settings.
99
+ *
100
+ * A function when they need another construct — a magic-link plugin has to
101
+ * *send* the link. It is handed the options this construct was registered
102
+ * with, and `services`: a client for each construct in `dependsOn`.
103
+ */
104
+ options?: BetterAuthOptions | ((context: BetterAuthOptionsContext<TUses>) => BetterAuthOptions | Promise<BetterAuthOptions>);
105
+ }
106
+ declare class BetterAuth<TName extends string = string, TDatabase extends Consumable = Consumable, const TUses extends readonly Consumable[] = readonly []> implements Construct<TName, AuthClient>, Authenticator<AuthSession> {
107
+ private readonly config;
108
+ readonly id: TName;
109
+ /**
110
+ * What `.dependsOn([auth])` injects: an {@link AuthClient}, never the server.
111
+ *
112
+ * Which of the two a process holds is decided by how it reaches the
113
+ * construct, not by asking where it is running. The auth app's process is
114
+ * its generated entry, which calls {@link server} and nothing else — a
115
+ * self-serving surface has no endpoints of its own for a `dependsOn` to sit
116
+ * on. Every other process reaches it through this. So the API, a worker, a
117
+ * test's in-process endpoints all get the client, and none of them needs
118
+ * the signing secret, the auth tenant's URL or the mailer to start.
119
+ */
120
+ readonly service: Service<Uncapitalize<TName>, AuthClient>;
121
+ readonly basePath: string;
122
+ /**
123
+ * Declared once and read by both `declare()` and `connect()`, so the keys the
124
+ * target publishes and the keys the server reads cannot drift.
125
+ */
126
+ private readonly keys;
127
+ constructor(id: ConstructName<TName>, config: BetterAuthConfig<TDatabase, TUses>);
128
+ /**
129
+ * A signing secret and a surface.
130
+ *
131
+ * The database is *not* declared here — the tenant that was passed in
132
+ * declares it, and declaring it twice is the duplication the whole model
133
+ * removes. What is declared is what this construct owns: the key it signs
134
+ * with, and the routes it answers on.
135
+ *
136
+ * One endpoint, wildcarded. Better Auth routes internally and the set of
137
+ * paths depends on which capabilities are enabled, so enumerating them here
138
+ * would be a copy of its router that goes stale on its next release. The
139
+ * surface's job is to send everything under `basePath` to one handler, which
140
+ * is exactly what the declaration says.
141
+ */
142
+ declare(): Declaration[];
143
+ /**
144
+ * Whose request this is: the session for these headers, or `null`.
145
+ *
146
+ * Asked of the auth server over HTTP, at the URL the `.auth()` edge injects —
147
+ * so it is the same call whether the server runs in this process, beside
148
+ * it, or behind MSW in a test. The same call {@link AuthClient} makes.
149
+ */
150
+ verify(headers: Headers, envParser: EnvironmentParser<{}>): Promise<AuthSession | null>;
151
+ /**
152
+ * The client a caller of this server holds: its URL and nothing else.
153
+ *
154
+ * `<ID>_URL` is the one key a consumer is given for an edge to a surface —
155
+ * the compose network's address between containers, the public one where
156
+ * that is all there is — so this is everything it can know.
157
+ */
158
+ client(envParser: EnvironmentParser<{}>): AuthClient;
159
+ /**
160
+ * The tenant this server keeps its tables in — whose migrations folder,
161
+ * `db/<tenant>/`, Better Auth's schema is written into.
162
+ */
163
+ get databaseId(): string;
164
+ /**
165
+ * The SQL that brings the tenant up to Better Auth's schema, or `undefined`
166
+ * when it already matches.
167
+ *
168
+ * What `gkm migration` writes as the tenant's next migration, so Better
169
+ * Auth's tables are committed, reviewed and applied like any other — rather
170
+ * than diffed against the database at runtime, where a change nobody wrote
171
+ * down happens on whichever machine migrates first.
172
+ *
173
+ * Compared as the owner, against the tenant `gkm migrate` has already brought
174
+ * up to date: what comes back is only what the committed files are missing.
175
+ */
176
+ pendingMigration(options: ServiceRegisterOptions): Promise<string | undefined>;
177
+ /**
178
+ * The server this surface runs as, built from its own declaration.
179
+ *
180
+ * A surface is a deploy unit, so something has to serve it, and the thing
181
+ * that knows how is the construct — not a generator writing a mount into
182
+ * somebody else's entry point. That is how the auth server came to be
183
+ * mounted by a hook in the application it was supposed to be separate from,
184
+ * and then to be served by nothing at all when the hook was deleted.
185
+ *
186
+ * The routes come from {@link declare}: one wildcard under `basePath`, read
187
+ * off the same declaration the manifest carries, so the surface the graph
188
+ * describes and the surface that answers requests cannot disagree.
189
+ *
190
+ * ```ts
191
+ * // .gkm/server/app.ts — the whole generated entry
192
+ * import { auth } from '@acme/constructs/auth.js';
193
+ * export const { app } = await auth.server({ envParser });
194
+ * ```
195
+ *
196
+ * The only way to the server: it is what reads the signing secret, opens
197
+ * the tenant and builds the mailer, so it is built here, in the auth app's
198
+ * own process, and `.dependsOn([auth])` everywhere else gets
199
+ * {@link AuthClient}. `auth` is the better-auth instance behind the app.
200
+ */
201
+ server(options: ServiceRegisterOptions): Promise<{
202
+ app: Hono;
203
+ auth: AuthServer;
204
+ }>;
205
+ /**
206
+ * The ids of the better-auth plugins this server runs — what a client has
207
+ * to pair its own plugins with (`magic-link` with `magicLinkClient`).
208
+ * Resolved the way the server resolves them, options callback included.
209
+ */
210
+ pluginIds(options: ServiceRegisterOptions): Promise<string[]>;
211
+ /** Better-auth's options as given — a value, or a callback of the environment. */
212
+ private configured;
213
+ private connect;
214
+ /**
215
+ * Everything better-auth is given: the app's options, and what the construct
216
+ * owns — its secret, its URL, its tenant's connection, the origins and cookie
217
+ * domain its graph derives. One place, so the server and its migrations are
218
+ * built from the same options.
219
+ */
220
+ private optionsFor;
221
+ }
222
+ /** A magic link moved to the device address when an app is its destination. */
223
+ declare function deviceLink(url: string, deviceUrl: string): string;
224
+ /** A mobile app depends on this auth server, which has no Expo plugin. */
225
+ declare class ExpoPluginRequired extends Error {
226
+ readonly server: string;
227
+ /** The schemes the graph says call it — what made the plugin necessary. */
228
+ readonly origins: readonly string[];
229
+ constructor(server: string,
230
+ /** The schemes the graph says call it — what made the plugin necessary. */
231
+ origins: readonly string[]);
232
+ }
233
+ /** The auth server answered a session check with a failure. */
234
+ declare class SessionCheckFailed extends Error {
235
+ readonly authenticator: string;
236
+ readonly status: number;
237
+ constructor(authenticator: string, status: number);
238
+ }
239
+ /** A session check never reached the auth server. */
240
+ declare class AuthServerUnreachable extends Error {
241
+ readonly authenticator: string;
242
+ readonly url: string;
243
+ constructor(authenticator: string, url: string, cause: unknown);
244
+ }
245
+ /**
246
+ * Better Auth's DDL, safe to run where its tables already exist.
247
+ *
248
+ * Its SQL is Kysely's, so its shape is known: `create table "…"`, `create index
249
+ * "…"`, `alter table "…" add column "…"`. A database that has been running
250
+ * already has those — Better Auth used to create them at runtime — and the
251
+ * first committed migration would fail on them rather than recording that they
252
+ * are there.
253
+ */
254
+ declare function idempotent(statements: string): string;
255
+ /**
256
+ * `request`, without {@link CLIENT_IP_HEADER} unless an internal caller sent
257
+ * it — no `Origin`, no forwarding header, a loopback or private peer: the
258
+ * rule a request's span continues a trace by (`@geekmidas/telescope`'s
259
+ * `isInternalCaller`).
260
+ *
261
+ * The stack's own edges strip the header already. This holds wherever one
262
+ * does not — a platform's proxy, a port published straight to the internet —
263
+ * so a stranger cannot pick the address Better Auth rate-limits them by.
264
+ */
265
+ declare function withTrustedClientIp(request: Request, remoteAddress: string | undefined): Request;
266
+ //#endregion
267
+ export { BetterAuth as a, BetterAuthOptionsContext as c, deviceLink as d, idempotent as f, AuthSession as i, ExpoPluginRequired as l, AuthServer as n, BetterAuthConfig as o, withTrustedClientIp as p, AuthServerUnreachable as r, BetterAuthOptions as s, AuthClient as t, SessionCheckFailed as u };
268
+ //# sourceMappingURL=auth-CcuceLYo.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-CcuceLYo.d.mts","names":[],"sources":["../src/auth.ts"],"mappings":";;;;;;;;;KA2DY,aAAa,kBAAkB;;KAG/B,cAAc;;;;;;;;;;UAWT;WACP;;;;;;;;;;;IAWR,WAAW;MACV,SAAS,6BAA6B;QACnC,QAAQ;;;;KAKF,oBAAoB,KAC/B,kBAAkB;;;;;;KASP,yBAAyB,uBAAuB,gBAC3D;EACC,UAAU,kBAAkB,WAAW;;UAGxB,iBAChB,kBAAkB,YAClB,uBAAuB;;;;;;;;EASvB,UAAU;;;;;;;;EAQV;;;;;;EAMA;;;;;;;EAOA;;;;;;;;;;;;EAYA,YAAY;;;;;;EAMZ,YAAY;;;;;;;;EAQZ,UACG,sBAEA,SAAS,yBAAyB,WAC7B,oBAAoB,QAAQ;;cAKxB,WACZ,+BACA,kBAAkB,aAAa,kBACzB,uBAAuB,uCACjB,UAAU,OAAO,aAAa,cAAc;mBA+BtC;WA7BT,IAAI;;;;;;;;;;;;WAYJ,SAAS,QAAQ,aAAa,QAAQ;WACtC;;;;;mBAMQ;EAQjB,YACC,IAAI,cAAc,QACD,QAAQ,iBAAiB,WAAW;;;;;;;;;;;;;;;EAuCtD,WAAW;;;;;;;;EAgDL,OACL,SAAS,SACT,WAAW,wBACT,QAAQ;;;;;;;;EAWX,OAAO,WAAW,wBAAwB;;;;;MAkBtC;;;;;;;;;;;;;EAgBE,iBACL,SAAS,yBACP;;;;;;;;;;;;;;;;;;;;;;;;;EAsDG,OACL,SAAS,yBACP;IAAU,KAAK;IAAM,MAAM;;;;;;;EAsDxB,UAAU,SAAS,yBAAyB;;UAMpC;UAuBA;;;;;;;UAmBA;;;iBA8JC,WAAW,aAAa;;cAY3B,2BAA2B;WAE7B;;WAEA;EAHV,YACU,gBAEA;;EAAA;;;cAiEE,2BAA2B;WAE7B;WACA;EAFV,YACU,uBACA;;;cAYE,8BAA8B;WAEhC;WACA;EAFV,YACU,uBACA,aACT;;;;;;;;;;;iBAqBc,WAAW;;;;;;;;;;;iBAgCX,oBACf,SAAS,SACT,oCACE"}