@geekmidas/constructs 10.0.0-alpha.11 → 10.0.0-alpha.110

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 (438) hide show
  1. package/README.md +222 -158
  2. package/dist/Construct-BQALFCh2.d.cts +230 -0
  3. package/dist/Construct-BQALFCh2.d.cts.map +1 -0
  4. package/dist/{Construct-BD5neF7w.mjs → Construct-CKUA-CTA.mjs} +35 -35
  5. package/dist/Construct-CKUA-CTA.mjs.map +1 -0
  6. package/dist/{Construct-CyS3RpTL.cjs → Construct-DEOVauyA.cjs} +55 -49
  7. package/dist/Construct-DEOVauyA.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-CQJqqkhY.d.mts} +17 -11
  11. package/dist/Cron-CQJqqkhY.d.mts.map +1 -0
  12. package/dist/{Cron-dh4rUgib.d.mts → Cron-DI3nKoic.d.cts} +17 -11
  13. package/dist/Cron-DI3nKoic.d.cts.map +1 -0
  14. package/dist/{CronBuilder-Da0C0edR.cjs → CronBuilder-BXTG10u5.cjs} +47 -31
  15. package/dist/CronBuilder-BXTG10u5.cjs.map +1 -0
  16. package/dist/{CronBuilder-CYKT5RiO.mjs → CronBuilder-D3sF9tS_.mjs} +37 -21
  17. package/dist/CronBuilder-D3sF9tS_.mjs.map +1 -0
  18. package/dist/CronBuilder-Xx_zakuc.d.mts +47 -0
  19. package/dist/CronBuilder-Xx_zakuc.d.mts.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-BjWKinFA.d.mts → Endpoint-BWyKCa2x.d.cts} +130 -100
  23. package/dist/Endpoint-BWyKCa2x.d.cts.map +1 -0
  24. package/dist/{Endpoint-dav89W6-.d.cts → Endpoint-CrE9Ppdk.d.mts} +130 -100
  25. package/dist/Endpoint-CrE9Ppdk.d.mts.map +1 -0
  26. package/dist/{Endpoint-DCQPMdUX.mjs → Endpoint-gPXhHKhJ.mjs} +208 -100
  27. package/dist/Endpoint-gPXhHKhJ.mjs.map +1 -0
  28. package/dist/{Endpoint-DcWXE-SZ.cjs → Endpoint-yhR2T2Wt.cjs} +248 -122
  29. package/dist/Endpoint-yhR2T2Wt.cjs.map +1 -0
  30. package/dist/{index-lAO9egTb.d.mts → EndpointFactory-BV-nfnaP.d.mts} +85 -136
  31. package/dist/EndpointFactory-BV-nfnaP.d.mts.map +1 -0
  32. package/dist/{EndpointFactory-CdWB7wPw.cjs → EndpointFactory-BVv6EIDu.cjs} +98 -112
  33. package/dist/EndpointFactory-BVv6EIDu.cjs.map +1 -0
  34. package/dist/{index-Bd5FqCoe.d.cts → EndpointFactory-C1-IBwm4.d.cts} +84 -135
  35. package/dist/EndpointFactory-C1-IBwm4.d.cts.map +1 -0
  36. package/dist/{EndpointFactory-CjV8F_lJ.mjs → EndpointFactory-Cs8IHvwF.mjs} +62 -76
  37. package/dist/EndpointFactory-Cs8IHvwF.mjs.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-DtL9j19R.cjs → HonoEndpointAdaptor-CN1jjUBJ.cjs} +115 -71
  43. package/dist/HonoEndpointAdaptor-CN1jjUBJ.cjs.map +1 -0
  44. package/dist/{HonoEndpointAdaptor-P1ahhZHu.mjs → HonoEndpointAdaptor-euH1oSdY.mjs} +105 -64
  45. package/dist/HonoEndpointAdaptor-euH1oSdY.mjs.map +1 -0
  46. package/dist/Queue-BhuofM3k.cjs +109 -0
  47. package/dist/Queue-BhuofM3k.cjs.map +1 -0
  48. package/dist/{Queue-D7ZuwBhy.d.cts → Queue-DlsHRzUp.d.mts} +48 -48
  49. package/dist/Queue-DlsHRzUp.d.mts.map +1 -0
  50. package/dist/{Queue-gVGfi2Yk.d.mts → Queue-HPyi0e1i.d.cts} +49 -49
  51. package/dist/Queue-HPyi0e1i.d.cts.map +1 -0
  52. package/dist/Queue-cmhqEBOB.mjs +104 -0
  53. package/dist/Queue-cmhqEBOB.mjs.map +1 -0
  54. package/dist/QueueBuilder-Cx9lKC5d.d.mts +75 -0
  55. package/dist/QueueBuilder-Cx9lKC5d.d.mts.map +1 -0
  56. package/dist/QueueBuilder-DXu1qxT1.mjs +118 -0
  57. package/dist/QueueBuilder-DXu1qxT1.mjs.map +1 -0
  58. package/dist/QueueBuilder-DdU2klPu.cjs +135 -0
  59. package/dist/QueueBuilder-DdU2klPu.cjs.map +1 -0
  60. package/dist/QueueBuilder-OSi6LkV9.d.cts +75 -0
  61. package/dist/QueueBuilder-OSi6LkV9.d.cts.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-4DWe9feX.d.mts +67 -0
  67. package/dist/SubscriberBuilder-4DWe9feX.d.mts.map +1 -0
  68. package/dist/{SubscriberBuilder-BjkbeT9l.mjs → SubscriberBuilder-DRXfxWn_.mjs} +50 -24
  69. package/dist/SubscriberBuilder-DRXfxWn_.mjs.map +1 -0
  70. package/dist/{SubscriberBuilder-4OPehf2R.cjs → SubscriberBuilder-M2EAgQhC.cjs} +61 -36
  71. package/dist/SubscriberBuilder-M2EAgQhC.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-D2R0r24C.mjs +99 -0
  75. package/dist/Topic-D2R0r24C.mjs.map +1 -0
  76. package/dist/Topic-DwS3QO0m.cjs +104 -0
  77. package/dist/Topic-DwS3QO0m.cjs.map +1 -0
  78. package/dist/adaptors/aws.cjs +200 -246
  79. package/dist/adaptors/aws.cjs.map +1 -1
  80. package/dist/adaptors/aws.d.cts +58 -62
  81. package/dist/adaptors/aws.d.cts.map +1 -1
  82. package/dist/adaptors/aws.d.mts +59 -63
  83. package/dist/adaptors/aws.d.mts.map +1 -1
  84. package/dist/adaptors/aws.mjs +171 -219
  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 +9 -18
  90. package/dist/adaptors/hono.d.mts.map +1 -1
  91. package/dist/adaptors/hono.mjs +2 -10
  92. package/dist/adaptors/testing.cjs +765 -99
  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 +726 -78
  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-D_0788uW.d.mts +268 -0
  103. package/dist/auth-D_0788uW.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-5QZzh5Er.d.mts} +3 -6
  111. package/dist/cache-5QZzh5Er.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-ZvYQbivO.d.mts} +42 -11
  131. package/dist/construct-interface-ZvYQbivO.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-DYymbp_7.cjs +257 -0
  139. package/dist/credential-DYymbp_7.cjs.map +1 -0
  140. package/dist/credential-DfSAOOdY.mjs +222 -0
  141. package/dist/credential-DfSAOOdY.mjs.map +1 -0
  142. package/dist/credential.cjs +8 -96
  143. package/dist/credential.d.cts +2 -61
  144. package/dist/credential.d.mts +2 -61
  145. package/dist/credential.mjs +2 -94
  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 +4 -8
  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 +20 -16
  175. package/dist/endpoints/index.d.cts +105 -7
  176. package/dist/endpoints/index.d.cts.map +1 -0
  177. package/dist/endpoints/index.d.mts +105 -7
  178. package/dist/endpoints/index.d.mts.map +1 -0
  179. package/dist/endpoints/index.mjs +6 -10
  180. package/dist/external-api.cjs +106 -0
  181. package/dist/external-api.cjs.map +1 -0
  182. package/dist/external-api.d.cts +2 -0
  183. package/dist/external-api.d.mts +2 -0
  184. package/dist/external-api.mjs +103 -0
  185. package/dist/external-api.mjs.map +1 -0
  186. package/dist/fake-DqKo8INJ.d.mts +201 -0
  187. package/dist/fake-DqKo8INJ.d.mts.map +1 -0
  188. package/dist/fake-Dvion_Fh.d.cts +201 -0
  189. package/dist/fake-Dvion_Fh.d.cts.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-CTI-hDem.mjs} +376 -238
  203. package/dist/{functions-14lpEFL4.mjs.map → functions-CTI-hDem.mjs.map} +1 -1
  204. package/dist/{functions-i_la-N5r.cjs → functions-D7O5SGVc.cjs} +414 -264
  205. package/dist/functions-D7O5SGVc.cjs.map +1 -0
  206. package/dist/index-B13kQB_U.d.mts +115 -0
  207. package/dist/index-B13kQB_U.d.mts.map +1 -0
  208. package/dist/index-BuzRvKOQ.d.cts +115 -0
  209. package/dist/index-BuzRvKOQ.d.cts.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-B3zfg9ti.cjs +383 -0
  225. package/dist/kysely-B3zfg9ti.cjs.map +1 -0
  226. package/dist/kysely-B_0BAr0T.mjs +370 -0
  227. package/dist/kysely-B_0BAr0T.mjs.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-DKwnl0nf.d.mts +175 -0
  231. package/dist/kysely-DKwnl0nf.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/mobile-app.cjs +73 -0
  237. package/dist/mobile-app.cjs.map +1 -0
  238. package/dist/mobile-app.d.cts +61 -0
  239. package/dist/mobile-app.d.cts.map +1 -0
  240. package/dist/mobile-app.d.mts +61 -0
  241. package/dist/mobile-app.d.mts.map +1 -0
  242. package/dist/mobile-app.mjs +72 -0
  243. package/dist/mobile-app.mjs.map +1 -0
  244. package/dist/object-storage.cjs +18 -10
  245. package/dist/object-storage.cjs.map +1 -1
  246. package/dist/object-storage.d.cts +3 -7
  247. package/dist/object-storage.d.cts.map +1 -1
  248. package/dist/object-storage.d.mts +3 -7
  249. package/dist/object-storage.d.mts.map +1 -1
  250. package/dist/object-storage.mjs +11 -3
  251. package/dist/object-storage.mjs.map +1 -1
  252. package/dist/queue/index.cjs +6 -189
  253. package/dist/queue/index.d.cts +3 -60
  254. package/dist/queue/index.d.mts +3 -60
  255. package/dist/queue/index.mjs +3 -186
  256. package/dist/random-password.cjs +86 -0
  257. package/dist/random-password.cjs.map +1 -0
  258. package/dist/random-password.d.cts +30 -0
  259. package/dist/random-password.d.cts.map +1 -0
  260. package/dist/random-password.d.mts +30 -0
  261. package/dist/random-password.d.mts.map +1 -0
  262. package/dist/random-password.mjs +84 -0
  263. package/dist/random-password.mjs.map +1 -0
  264. package/dist/{lazyAccessors-BoJN3SMd.mjs → readRequestBody-BTIl3k-D.mjs} +117 -60
  265. package/dist/readRequestBody-BTIl3k-D.mjs.map +1 -0
  266. package/dist/readRequestBody-Dej_L3c4.cjs +342 -0
  267. package/dist/readRequestBody-Dej_L3c4.cjs.map +1 -0
  268. package/dist/requestLogger-BZcXwdBs.cjs +207 -0
  269. package/dist/requestLogger-BZcXwdBs.cjs.map +1 -0
  270. package/dist/requestLogger-pA4gi3E1.mjs +178 -0
  271. package/dist/requestLogger-pA4gi3E1.mjs.map +1 -0
  272. package/dist/rest-api.cjs +90 -59
  273. package/dist/rest-api.cjs.map +1 -1
  274. package/dist/rest-api.d.cts +70 -42
  275. package/dist/rest-api.d.cts.map +1 -1
  276. package/dist/rest-api.d.mts +70 -42
  277. package/dist/rest-api.d.mts.map +1 -1
  278. package/dist/rest-api.mjs +82 -51
  279. package/dist/rest-api.mjs.map +1 -1
  280. package/dist/{chunk-DWy1uDak.cjs → rolldown-runtime-y5ARvAq5.cjs} +14 -18
  281. package/dist/runSubscriber-BHvJ8POr.mjs +109 -0
  282. package/dist/runSubscriber-BHvJ8POr.mjs.map +1 -0
  283. package/dist/runSubscriber-D8nLXIv1.cjs +126 -0
  284. package/dist/runSubscriber-D8nLXIv1.cjs.map +1 -0
  285. package/dist/shutdown-BMJmAhSt.cjs +38 -0
  286. package/dist/shutdown-BMJmAhSt.cjs.map +1 -0
  287. package/dist/shutdown-C7xa8x9S.mjs +27 -0
  288. package/dist/shutdown-C7xa8x9S.mjs.map +1 -0
  289. package/dist/site.cjs +33 -7
  290. package/dist/site.cjs.map +1 -1
  291. package/dist/site.d.cts +17 -7
  292. package/dist/site.d.cts.map +1 -1
  293. package/dist/site.d.mts +17 -7
  294. package/dist/site.d.mts.map +1 -1
  295. package/dist/site.mjs +29 -3
  296. package/dist/site.mjs.map +1 -1
  297. package/dist/stages-BSCF19o2.d.cts +56 -0
  298. package/dist/stages-BSCF19o2.d.cts.map +1 -0
  299. package/dist/stages-BSCF19o2.d.mts +56 -0
  300. package/dist/stages-BSCF19o2.d.mts.map +1 -0
  301. package/dist/subscribers/index.cjs +118 -6
  302. package/dist/subscribers/index.cjs.map +1 -0
  303. package/dist/subscribers/index.d.cts +51 -6
  304. package/dist/subscribers/index.d.cts.map +1 -0
  305. package/dist/subscribers/index.d.mts +51 -6
  306. package/dist/subscribers/index.d.mts.map +1 -0
  307. package/dist/subscribers/index.mjs +115 -5
  308. package/dist/subscribers/index.mjs.map +1 -0
  309. package/dist/surfaceEnv-CNimK76p.cjs +56 -0
  310. package/dist/surfaceEnv-CNimK76p.cjs.map +1 -0
  311. package/dist/surfaceEnv-wMT5QzgZ.mjs +45 -0
  312. package/dist/surfaceEnv-wMT5QzgZ.mjs.map +1 -0
  313. package/dist/telemetry-B48RLjyk.d.cts +40 -0
  314. package/dist/telemetry-B48RLjyk.d.cts.map +1 -0
  315. package/dist/telemetry-BEoBn6GO.d.mts +40 -0
  316. package/dist/telemetry-BEoBn6GO.d.mts.map +1 -0
  317. package/dist/telemetry.cjs +56 -0
  318. package/dist/telemetry.cjs.map +1 -0
  319. package/dist/telemetry.d.cts +2 -0
  320. package/dist/telemetry.d.mts +2 -0
  321. package/dist/telemetry.mjs +55 -0
  322. package/dist/telemetry.mjs.map +1 -0
  323. package/dist/topic/index.cjs +3 -137
  324. package/dist/topic/index.d.cts +2 -4
  325. package/dist/topic/index.d.mts +2 -4
  326. package/dist/topic/index.mjs +2 -134
  327. package/dist/tracing-Bbj1uoFJ.mjs +127 -0
  328. package/dist/tracing-Bbj1uoFJ.mjs.map +1 -0
  329. package/dist/tracing-C0ooU0V2.cjs +150 -0
  330. package/dist/tracing-C0ooU0V2.cjs.map +1 -0
  331. package/dist/{types-BlAkSuGI.d.cts → types-DMuSQeLL.d.cts} +3 -5
  332. package/dist/types-DMuSQeLL.d.cts.map +1 -0
  333. package/dist/{types-aKksMEWL.d.mts → types-DMuSQeLL.d.mts} +3 -5
  334. package/dist/types-DMuSQeLL.d.mts.map +1 -0
  335. package/dist/types.d.cts +1 -1
  336. package/dist/types.d.mts +1 -1
  337. package/dist/types.mjs +1 -0
  338. package/dist/worker.cjs +59 -34
  339. package/dist/worker.cjs.map +1 -1
  340. package/dist/worker.d.cts +70 -45
  341. package/dist/worker.d.cts.map +1 -1
  342. package/dist/worker.d.mts +71 -46
  343. package/dist/worker.d.mts.map +1 -1
  344. package/dist/worker.mjs +54 -29
  345. package/dist/worker.mjs.map +1 -1
  346. package/package.json +106 -42
  347. package/dist/Construct-BD5neF7w.mjs.map +0 -1
  348. package/dist/Construct-C0ijr2qp.d.cts +0 -117
  349. package/dist/Construct-C0ijr2qp.d.cts.map +0 -1
  350. package/dist/Construct-Ct8nalEi.d.mts +0 -117
  351. package/dist/Construct-Ct8nalEi.d.mts.map +0 -1
  352. package/dist/Construct-CyS3RpTL.cjs.map +0 -1
  353. package/dist/Cron-DmQ8vQ4b.d.cts.map +0 -1
  354. package/dist/Cron-dh4rUgib.d.mts.map +0 -1
  355. package/dist/CronBuilder-BquXDbDI.d.cts +0 -44
  356. package/dist/CronBuilder-BquXDbDI.d.cts.map +0 -1
  357. package/dist/CronBuilder-CGgY2080.d.mts +0 -44
  358. package/dist/CronBuilder-CGgY2080.d.mts.map +0 -1
  359. package/dist/CronBuilder-CYKT5RiO.mjs.map +0 -1
  360. package/dist/CronBuilder-Da0C0edR.cjs.map +0 -1
  361. package/dist/Endpoint-BjWKinFA.d.mts.map +0 -1
  362. package/dist/Endpoint-DCQPMdUX.mjs.map +0 -1
  363. package/dist/Endpoint-DcWXE-SZ.cjs.map +0 -1
  364. package/dist/Endpoint-dav89W6-.d.cts.map +0 -1
  365. package/dist/EndpointFactory-CdWB7wPw.cjs.map +0 -1
  366. package/dist/EndpointFactory-CjV8F_lJ.mjs.map +0 -1
  367. package/dist/HonoEndpointAdaptor-DtL9j19R.cjs.map +0 -1
  368. package/dist/HonoEndpointAdaptor-P1ahhZHu.mjs.map +0 -1
  369. package/dist/Queue-D7ZuwBhy.d.cts.map +0 -1
  370. package/dist/Queue-gVGfi2Yk.d.mts.map +0 -1
  371. package/dist/Subscriber-2mEi0ImH.d.cts.map +0 -1
  372. package/dist/Subscriber-xTJ9ayPN.d.mts.map +0 -1
  373. package/dist/SubscriberBuilder-4OPehf2R.cjs.map +0 -1
  374. package/dist/SubscriberBuilder-BjkbeT9l.mjs.map +0 -1
  375. package/dist/SubscriberBuilder-Dptmo-1A.d.mts +0 -62
  376. package/dist/SubscriberBuilder-Dptmo-1A.d.mts.map +0 -1
  377. package/dist/SubscriberBuilder-waNhzjSM.d.cts +0 -62
  378. package/dist/SubscriberBuilder-waNhzjSM.d.cts.map +0 -1
  379. package/dist/Topic-19QeHBIR.d.cts +0 -91
  380. package/dist/Topic-19QeHBIR.d.cts.map +0 -1
  381. package/dist/Topic-DuFeqkBh.d.mts +0 -91
  382. package/dist/Topic-DuFeqkBh.d.mts.map +0 -1
  383. package/dist/auth.d.cts.map +0 -1
  384. package/dist/auth.d.mts.map +0 -1
  385. package/dist/cache-0ANvRQnD.mjs +0 -51
  386. package/dist/cache-0ANvRQnD.mjs.map +0 -1
  387. package/dist/cache-3WSvAulx.cjs +0 -57
  388. package/dist/cache-3WSvAulx.cjs.map +0 -1
  389. package/dist/cache-BrRz3fEB.d.mts.map +0 -1
  390. package/dist/cache-BtZY_tHe.d.cts.map +0 -1
  391. package/dist/clone-DblgEZZa.mjs.map +0 -1
  392. package/dist/clone-Dy0cR2SZ.cjs.map +0 -1
  393. package/dist/construct-interface-BfjcOD_E.cjs +0 -117
  394. package/dist/construct-interface-BfjcOD_E.cjs.map +0 -1
  395. package/dist/construct-interface-D9d4Gm4p.d.cts.map +0 -1
  396. package/dist/construct-interface-Z4CpS8tK.mjs +0 -81
  397. package/dist/construct-interface-Z4CpS8tK.mjs.map +0 -1
  398. package/dist/construct-interface-g5GM5pwR.d.mts.map +0 -1
  399. package/dist/credential.cjs.map +0 -1
  400. package/dist/credential.d.cts.map +0 -1
  401. package/dist/credential.d.mts.map +0 -1
  402. package/dist/credential.mjs.map +0 -1
  403. package/dist/database/kysely.cjs.map +0 -1
  404. package/dist/database/kysely.d.cts.map +0 -1
  405. package/dist/database/kysely.d.mts.map +0 -1
  406. package/dist/database/kysely.mjs.map +0 -1
  407. package/dist/functions-i_la-N5r.cjs.map +0 -1
  408. package/dist/index-Bd5FqCoe.d.cts.map +0 -1
  409. package/dist/index-BknhM6Ux.d.mts +0 -31
  410. package/dist/index-BknhM6Ux.d.mts.map +0 -1
  411. package/dist/index-CBSfrowv.d.cts +0 -31
  412. package/dist/index-CBSfrowv.d.cts.map +0 -1
  413. package/dist/index-D24Xm79M.d.cts +0 -171
  414. package/dist/index-D24Xm79M.d.cts.map +0 -1
  415. package/dist/index-_ajboYxK.d.mts +0 -171
  416. package/dist/index-_ajboYxK.d.mts.map +0 -1
  417. package/dist/index-lAO9egTb.d.mts.map +0 -1
  418. package/dist/lazyAccessors-BoJN3SMd.mjs.map +0 -1
  419. package/dist/lazyAccessors-e3j2oE2m.cjs +0 -274
  420. package/dist/lazyAccessors-e3j2oE2m.cjs.map +0 -1
  421. package/dist/processAudits-CGqttuXm.cjs +0 -92
  422. package/dist/processAudits-CGqttuXm.cjs.map +0 -1
  423. package/dist/processAudits-Dmts9H_b.mjs +0 -80
  424. package/dist/processAudits-Dmts9H_b.mjs.map +0 -1
  425. package/dist/queue/index.cjs.map +0 -1
  426. package/dist/queue/index.d.cts.map +0 -1
  427. package/dist/queue/index.d.mts.map +0 -1
  428. package/dist/queue/index.mjs.map +0 -1
  429. package/dist/surfaceEnv-BFXEms2f.cjs +0 -39
  430. package/dist/surfaceEnv-BFXEms2f.cjs.map +0 -1
  431. package/dist/surfaceEnv-C3Ktahea.mjs +0 -27
  432. package/dist/surfaceEnv-C3Ktahea.mjs.map +0 -1
  433. package/dist/telemetry-C3L0iS28.d.cts.map +0 -1
  434. package/dist/telemetry-D7bVFLGi.d.mts.map +0 -1
  435. package/dist/topic/index.cjs.map +0 -1
  436. package/dist/topic/index.mjs.map +0 -1
  437. package/dist/types-BlAkSuGI.d.cts.map +0 -1
  438. package/dist/types-aKksMEWL.d.mts.map +0 -1
@@ -1,181 +1,4 @@
1
- const require_chunk = require('../chunk-DWy1uDak.cjs');
2
- const require_cache = require('../cache-3WSvAulx.cjs');
3
- const __geekmidas_manifest = require_chunk.__toESM(require("@geekmidas/manifest"));
4
- const kysely = require_chunk.__toESM(require("kysely"));
5
- const pg = require_chunk.__toESM(require("pg"));
6
-
7
- //#region src/database/kysely.ts
8
- /** The schema a database uses when it does not say otherwise. */
9
- const DEFAULT_SCHEMA = "app";
10
- /**
11
- * @typeParam DB - the database's schema.
12
- * @typeParam TName - the canonical id. TypeScript has no partial
13
- * type-argument inference, so `new KyselyDatabase<OrdersDB>('orders')` leaves
14
- * this at its default and the service key widens to `string`. `db` still types
15
- * through `.database()`, which infers from the service.
16
- */
17
- var KyselyDatabase = class KyselyDatabase {
18
- id;
19
- service;
20
- /**
21
- * Declared once and read by both `declare()` and `connect()`, so the key the
22
- * build publishes and the key the client reads cannot drift.
23
- */
24
- config;
25
- schemaName;
26
- roles;
27
- version;
28
- derivedFrom;
29
- constructor(id, options = {}, derivedFrom) {
30
- this.options = options;
31
- const canonical = (0, __geekmidas_manifest.canonicalId)(id);
32
- this.id = canonical;
33
- this.config = {
34
- url: (0, __geekmidas_manifest.provideKey)(canonical, "url"),
35
- ownerUrl: (0, __geekmidas_manifest.provideKey)(canonical, "ownerUrl")
36
- };
37
- this.schemaName = options.schema ?? DEFAULT_SCHEMA;
38
- this.roles = options.roles ?? true;
39
- this.version = options.version ?? __geekmidas_manifest.DEFAULT_POSTGRES_VERSION;
40
- this.derivedFrom = derivedFrom;
41
- this.service = {
42
- serviceName: (0, __geekmidas_manifest.serviceKey)(canonical),
43
- register: (registerOptions) => this.connect(registerOptions)
44
- };
45
- }
46
- declare() {
47
- if (this.derivedFrom) {
48
- const { kind, of, schema } = this.derivedFrom;
49
- return [kind === "database-schema" ? {
50
- kind,
51
- id: this.id,
52
- of,
53
- schema: schema ?? this.schemaName,
54
- provides: [this.config.url]
55
- } : {
56
- kind,
57
- id: this.id,
58
- of,
59
- provides: [this.config.url]
60
- }];
61
- }
62
- return [{
63
- kind: "database",
64
- id: this.id,
65
- engine: "postgres",
66
- schema: this.schemaName,
67
- version: this.version,
68
- provides: [this.config.url],
69
- ...this.roles ? {} : { roles: false }
70
- }];
71
- }
72
- /**
73
- * A read-only endpoint on this database.
74
- *
75
- * Read-only is enforced by the reader role's grants rather than by which
76
- * endpoint it resolves to, so falling back to the writer where no replica
77
- * exists is safe rather than a silently writable connection behind a name
78
- * that says reader. There is no `writer()`: the database *is* the writer, so
79
- * a replica can never be reached by accident.
80
- *
81
- * The return type is narrower than this class on purpose — see
82
- * {@link ReadOnlyDatabase}.
83
- */
84
- reader() {
85
- return new KyselyDatabase(`${this.id}Reader`, this.options, {
86
- kind: "database-reader",
87
- of: this.id
88
- });
89
- }
90
- /**
91
- * A cache that lives in this database.
92
- *
93
- * The same strengthening `schema()` is over a second database: `new
94
- * Cache('Sessions')` says the app caches and leaves where to the deployment,
95
- * while this says it caches *here* — which is a fact about the application
96
- * and so belongs in its code.
97
- *
98
- * What it buys beyond being explicit: the table's schema and the role that
99
- * reaches it come from this database rather than from a second convention,
100
- * and the backend no longer has to guess which database "the database" meant
101
- * when an app declares two.
102
- *
103
- * A cache is not a `KyselyDatabase`, so this returns a `Cache` — the client
104
- * is a key/value store, not a query builder, and typing it as the parent
105
- * would be a convenience that lies.
106
- */
107
- cache(id = `${this.id}Cache`, options = {}) {
108
- return new require_cache.Cache(id, {
109
- of: this.id,
110
- ...options.table ? { table: options.table } : {}
111
- });
112
- }
113
- /**
114
- * A second schema in this database, with its own role(s) and its own URL —
115
- * so this database's role holds no grant on those tables at all.
116
- *
117
- * Typed separately because a tenant has its own tables: the point is that
118
- * `auth.selectFrom('sessions')` type-checks and
119
- * `orders.selectFrom('sessions')` does not.
120
- */
121
- schema(id, options = {}) {
122
- return new KyselyDatabase(id, options, {
123
- kind: "database-schema",
124
- of: this.id,
125
- schema: options.schema ?? id.toLowerCase()
126
- });
127
- }
128
- /**
129
- * A connection as the *owner* role — the one that may create, alter and drop.
130
- *
131
- * A `Service` rather than part of the construct, and deliberately so: a
132
- * construct is what `.dependsOn()` accepts, and nothing should be able to
133
- * depend on this. A migrator asks for it by name; a handler cannot ask at
134
- * all, which is the security property the role split exists for.
135
- *
136
- * Falls back to the runtime URL where no owner URL was published — the
137
- * `roles: false` downgrade, where there is only one credential and it is the
138
- * cluster master's.
139
- */
140
- get owner() {
141
- return {
142
- serviceName: `${(0, __geekmidas_manifest.serviceKey)(this.id)}Owner`,
143
- register: (options) => this.connect(options, { owner: true })
144
- };
145
- }
146
- async connect(options, as = {}) {
147
- const { url, ownerUrl } = options.envParser.create((get) => ({
148
- url: get(this.config.url).string(),
149
- ownerUrl: get(this.config.ownerUrl).string().optional()
150
- })).parse();
151
- const { schema: _schema, roles: _roles,...kysely$1 } = this.options;
152
- return new kysely.Kysely({
153
- ...kysely$1,
154
- dialect: new kysely.PostgresDialect({ pool: pool(as.owner ? ownerUrl ?? url : url) })
155
- });
156
- }
157
- };
158
- /**
159
- * A pool for one URL, with its schema actually on the search path.
160
- *
161
- * `?search_path=` is not a libpq parameter — a URL carrying it connects
162
- * happily and then resolves every unqualified name against `public`, which is
163
- * how a schema tenant silently writes its tables into the database it was
164
- * separated from. Postgres takes it as a startup option instead, so the URL
165
- * keeps the readable form the target derives and this turns it into the thing
166
- * the server understands.
167
- */
168
- function pool(url) {
169
- const parsed = new URL(url);
170
- const searchPath = parsed.searchParams.get("search_path");
171
- if (!searchPath) return new pg.default.Pool({ connectionString: url });
172
- parsed.searchParams.delete("search_path");
173
- return new pg.default.Pool({
174
- connectionString: parsed.toString(),
175
- options: `-c search_path=${searchPath}`
176
- });
177
- }
178
-
179
- //#endregion
180
- exports.KyselyDatabase = KyselyDatabase;
181
- //# sourceMappingURL=kysely.cjs.map
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_kysely = require("../kysely-B3zfg9ti.cjs");
3
+ exports.KyselyDatabase = require_kysely.KyselyDatabase;
4
+ exports.closeDatabasePools = require_kysely.closeDatabasePools;
@@ -1,152 +1,2 @@
1
- import { Construct } from "../construct-interface-D9d4Gm4p.cjs";
2
- import { Cache } from "../cache-BtZY_tHe.cjs";
3
- import { Service } from "@geekmidas/services";
4
- import { ConstructName, Declaration, PostgresVersion } from "@geekmidas/manifest";
5
- import { Kysely, KyselyConfig } from "kysely";
6
-
7
- //#region src/database/kysely.d.ts
8
-
9
- /**
10
- * Everything Kysely takes, plus what this construct declares.
11
- *
12
- * `dialect` is omitted because the construct owns it — it is built from the one
13
- * URL the adapter supplied, which is the whole point of the construct. The rest
14
- * of `KyselyConfig` (`plugins`, `log`) is the app's business and passes
15
- * straight through, so anything Kysely adds later arrives without being
16
- * tracked here.
17
- */
18
- interface KyselyDatabaseOptions extends Omit<KyselyConfig, 'dialect'> {
19
- /**
20
- * The schema, pinned on both roles' `search_path`.
21
- *
22
- * Defaults to `app` — the role the schema plays, rather than a restatement
23
- * of the database's own name, which reads correctly beside `auth` and
24
- * `pgboss` and keeps the application off `public`.
25
- */
26
- schema?: string;
27
- /**
28
- * Provision the owner/runtime role split. Defaults to on.
29
- *
30
- * Off falls back to the cluster's master credential in both URLs, giving up
31
- * the DDL/DML split and putting credentials that can drop a table into the
32
- * function's environment. A deliberate downgrade, not a default.
33
- */
34
- roles?: boolean;
35
- /**
36
- * The Postgres major version to provision.
37
- *
38
- * Declared here so one statement reaches both targets. It was previously
39
- * set in two unrelated places — a container tag locally, nothing at all on
40
- * AWS (so Aurora chose) — which is how local came to run 18 while deployed
41
- * ran 17.7 with nothing recording the difference.
42
- *
43
- * Defaults to {@link DEFAULT_POSTGRES_VERSION}.
44
- */
45
- version?: PostgresVersion;
46
- }
47
- /** What makes a construct derived rather than a database in its own right. */
48
- interface DerivedFrom {
49
- kind: 'database-reader' | 'database-schema';
50
- of: string;
51
- schema?: string;
52
- }
53
- /**
54
- * @typeParam DB - the database's schema.
55
- * @typeParam TName - the canonical id. TypeScript has no partial
56
- * type-argument inference, so `new KyselyDatabase<OrdersDB>('orders')` leaves
57
- * this at its default and the service key widens to `string`. `db` still types
58
- * through `.database()`, which infers from the service.
59
- */
60
- declare class KyselyDatabase<DB = unknown, TName extends string = string> implements Construct<TName, Kysely<DB>> {
61
- private readonly options;
62
- readonly id: TName;
63
- readonly service: Service<Uncapitalize<TName>, Kysely<DB>>;
64
- /**
65
- * Declared once and read by both `declare()` and `connect()`, so the key the
66
- * build publishes and the key the client reads cannot drift.
67
- */
68
- private readonly config;
69
- private readonly schemaName;
70
- private readonly roles;
71
- private readonly version;
72
- private readonly derivedFrom?;
73
- constructor(id: ConstructName<TName>, options?: KyselyDatabaseOptions, derivedFrom?: DerivedFrom);
74
- declare(): Declaration[];
75
- /**
76
- * A read-only endpoint on this database.
77
- *
78
- * Read-only is enforced by the reader role's grants rather than by which
79
- * endpoint it resolves to, so falling back to the writer where no replica
80
- * exists is safe rather than a silently writable connection behind a name
81
- * that says reader. There is no `writer()`: the database *is* the writer, so
82
- * a replica can never be reached by accident.
83
- *
84
- * The return type is narrower than this class on purpose — see
85
- * {@link ReadOnlyDatabase}.
86
- */
87
- reader(): ReadOnlyDatabase<DB, `${TName}Reader`>;
88
- /**
89
- * A cache that lives in this database.
90
- *
91
- * The same strengthening `schema()` is over a second database: `new
92
- * Cache('Sessions')` says the app caches and leaves where to the deployment,
93
- * while this says it caches *here* — which is a fact about the application
94
- * and so belongs in its code.
95
- *
96
- * What it buys beyond being explicit: the table's schema and the role that
97
- * reaches it come from this database rather than from a second convention,
98
- * and the backend no longer has to guess which database "the database" meant
99
- * when an app declares two.
100
- *
101
- * A cache is not a `KyselyDatabase`, so this returns a `Cache` — the client
102
- * is a key/value store, not a query builder, and typing it as the parent
103
- * would be a convenience that lies.
104
- */
105
- cache<TCache extends string = `${TName}Cache`>(id?: ConstructName<TCache>, options?: {
106
- table?: string;
107
- }): Cache<TCache>;
108
- /**
109
- * A second schema in this database, with its own role(s) and its own URL —
110
- * so this database's role holds no grant on those tables at all.
111
- *
112
- * Typed separately because a tenant has its own tables: the point is that
113
- * `auth.selectFrom('sessions')` type-checks and
114
- * `orders.selectFrom('sessions')` does not.
115
- */
116
- schema<TenantDB, TTenant extends string>(id: ConstructName<TTenant>, options?: KyselyDatabaseOptions): KyselyDatabase<TenantDB, TTenant>;
117
- /**
118
- * A connection as the *owner* role — the one that may create, alter and drop.
119
- *
120
- * A `Service` rather than part of the construct, and deliberately so: a
121
- * construct is what `.dependsOn()` accepts, and nothing should be able to
122
- * depend on this. A migrator asks for it by name; a handler cannot ask at
123
- * all, which is the security property the role split exists for.
124
- *
125
- * Falls back to the runtime URL where no owner URL was published — the
126
- * `roles: false` downgrade, where there is only one credential and it is the
127
- * cluster master's.
128
- */
129
- get owner(): Service<`${Uncapitalize<TName>}Owner`, Kysely<DB>>;
130
- private connect;
131
- }
132
- /**
133
- * A database you may read through, and derive nothing from.
134
- *
135
- * A reader is terminal in the graph, and this is that fact in the type system.
136
- * `DERIVES_FROM` gives `cache` and `database-schema` no `database-reader`
137
- * parent, and there is no reader of a reader — so `orders.reader().cache(…)`
138
- * has always been illegal, but it type-checked and failed later at
139
- * `assertDerivations`. That is a long way round to learn that a read-only
140
- * endpoint cannot own a table something writes to.
141
- *
142
- * Omitting the three deriving methods rather than making them throw keeps the
143
- * failure where it costs least: the editor, on the line that wrote it.
144
- *
145
- * The result is deliberately not assignable back to `KyselyDatabase` — a
146
- * reader is not one, and anything that genuinely needs the writer should say
147
- * so.
148
- */
149
- type ReadOnlyDatabase<DB, TName extends string> = Omit<KyselyDatabase<DB, TName>, 'reader' | 'cache' | 'schema'>;
150
- //#endregion
151
- export { KyselyDatabase, KyselyDatabaseOptions, ReadOnlyDatabase };
152
- //# sourceMappingURL=kysely.d.cts.map
1
+ import { i as closeDatabasePools, n as KyselyDatabaseOptions, r as ReadOnlyDatabase, t as KyselyDatabase } from "../kysely-D0bpzgPs.cjs";
2
+ export { KyselyDatabase, KyselyDatabaseOptions, ReadOnlyDatabase, closeDatabasePools };
@@ -1,152 +1,2 @@
1
- import { Construct } from "../construct-interface-g5GM5pwR.mjs";
2
- import { Cache } from "../cache-BrRz3fEB.mjs";
3
- import { ConstructName, Declaration, PostgresVersion } from "@geekmidas/manifest";
4
- import { Service } from "@geekmidas/services";
5
- import { Kysely, KyselyConfig } from "kysely";
6
-
7
- //#region src/database/kysely.d.ts
8
-
9
- /**
10
- * Everything Kysely takes, plus what this construct declares.
11
- *
12
- * `dialect` is omitted because the construct owns it — it is built from the one
13
- * URL the adapter supplied, which is the whole point of the construct. The rest
14
- * of `KyselyConfig` (`plugins`, `log`) is the app's business and passes
15
- * straight through, so anything Kysely adds later arrives without being
16
- * tracked here.
17
- */
18
- interface KyselyDatabaseOptions extends Omit<KyselyConfig, 'dialect'> {
19
- /**
20
- * The schema, pinned on both roles' `search_path`.
21
- *
22
- * Defaults to `app` — the role the schema plays, rather than a restatement
23
- * of the database's own name, which reads correctly beside `auth` and
24
- * `pgboss` and keeps the application off `public`.
25
- */
26
- schema?: string;
27
- /**
28
- * Provision the owner/runtime role split. Defaults to on.
29
- *
30
- * Off falls back to the cluster's master credential in both URLs, giving up
31
- * the DDL/DML split and putting credentials that can drop a table into the
32
- * function's environment. A deliberate downgrade, not a default.
33
- */
34
- roles?: boolean;
35
- /**
36
- * The Postgres major version to provision.
37
- *
38
- * Declared here so one statement reaches both targets. It was previously
39
- * set in two unrelated places — a container tag locally, nothing at all on
40
- * AWS (so Aurora chose) — which is how local came to run 18 while deployed
41
- * ran 17.7 with nothing recording the difference.
42
- *
43
- * Defaults to {@link DEFAULT_POSTGRES_VERSION}.
44
- */
45
- version?: PostgresVersion;
46
- }
47
- /** What makes a construct derived rather than a database in its own right. */
48
- interface DerivedFrom {
49
- kind: 'database-reader' | 'database-schema';
50
- of: string;
51
- schema?: string;
52
- }
53
- /**
54
- * @typeParam DB - the database's schema.
55
- * @typeParam TName - the canonical id. TypeScript has no partial
56
- * type-argument inference, so `new KyselyDatabase<OrdersDB>('orders')` leaves
57
- * this at its default and the service key widens to `string`. `db` still types
58
- * through `.database()`, which infers from the service.
59
- */
60
- declare class KyselyDatabase<DB = unknown, TName extends string = string> implements Construct<TName, Kysely<DB>> {
61
- private readonly options;
62
- readonly id: TName;
63
- readonly service: Service<Uncapitalize<TName>, Kysely<DB>>;
64
- /**
65
- * Declared once and read by both `declare()` and `connect()`, so the key the
66
- * build publishes and the key the client reads cannot drift.
67
- */
68
- private readonly config;
69
- private readonly schemaName;
70
- private readonly roles;
71
- private readonly version;
72
- private readonly derivedFrom?;
73
- constructor(id: ConstructName<TName>, options?: KyselyDatabaseOptions, derivedFrom?: DerivedFrom);
74
- declare(): Declaration[];
75
- /**
76
- * A read-only endpoint on this database.
77
- *
78
- * Read-only is enforced by the reader role's grants rather than by which
79
- * endpoint it resolves to, so falling back to the writer where no replica
80
- * exists is safe rather than a silently writable connection behind a name
81
- * that says reader. There is no `writer()`: the database *is* the writer, so
82
- * a replica can never be reached by accident.
83
- *
84
- * The return type is narrower than this class on purpose — see
85
- * {@link ReadOnlyDatabase}.
86
- */
87
- reader(): ReadOnlyDatabase<DB, `${TName}Reader`>;
88
- /**
89
- * A cache that lives in this database.
90
- *
91
- * The same strengthening `schema()` is over a second database: `new
92
- * Cache('Sessions')` says the app caches and leaves where to the deployment,
93
- * while this says it caches *here* — which is a fact about the application
94
- * and so belongs in its code.
95
- *
96
- * What it buys beyond being explicit: the table's schema and the role that
97
- * reaches it come from this database rather than from a second convention,
98
- * and the backend no longer has to guess which database "the database" meant
99
- * when an app declares two.
100
- *
101
- * A cache is not a `KyselyDatabase`, so this returns a `Cache` — the client
102
- * is a key/value store, not a query builder, and typing it as the parent
103
- * would be a convenience that lies.
104
- */
105
- cache<TCache extends string = `${TName}Cache`>(id?: ConstructName<TCache>, options?: {
106
- table?: string;
107
- }): Cache<TCache>;
108
- /**
109
- * A second schema in this database, with its own role(s) and its own URL —
110
- * so this database's role holds no grant on those tables at all.
111
- *
112
- * Typed separately because a tenant has its own tables: the point is that
113
- * `auth.selectFrom('sessions')` type-checks and
114
- * `orders.selectFrom('sessions')` does not.
115
- */
116
- schema<TenantDB, TTenant extends string>(id: ConstructName<TTenant>, options?: KyselyDatabaseOptions): KyselyDatabase<TenantDB, TTenant>;
117
- /**
118
- * A connection as the *owner* role — the one that may create, alter and drop.
119
- *
120
- * A `Service` rather than part of the construct, and deliberately so: a
121
- * construct is what `.dependsOn()` accepts, and nothing should be able to
122
- * depend on this. A migrator asks for it by name; a handler cannot ask at
123
- * all, which is the security property the role split exists for.
124
- *
125
- * Falls back to the runtime URL where no owner URL was published — the
126
- * `roles: false` downgrade, where there is only one credential and it is the
127
- * cluster master's.
128
- */
129
- get owner(): Service<`${Uncapitalize<TName>}Owner`, Kysely<DB>>;
130
- private connect;
131
- }
132
- /**
133
- * A database you may read through, and derive nothing from.
134
- *
135
- * A reader is terminal in the graph, and this is that fact in the type system.
136
- * `DERIVES_FROM` gives `cache` and `database-schema` no `database-reader`
137
- * parent, and there is no reader of a reader — so `orders.reader().cache(…)`
138
- * has always been illegal, but it type-checked and failed later at
139
- * `assertDerivations`. That is a long way round to learn that a read-only
140
- * endpoint cannot own a table something writes to.
141
- *
142
- * Omitting the three deriving methods rather than making them throw keeps the
143
- * failure where it costs least: the editor, on the line that wrote it.
144
- *
145
- * The result is deliberately not assignable back to `KyselyDatabase` — a
146
- * reader is not one, and anything that genuinely needs the writer should say
147
- * so.
148
- */
149
- type ReadOnlyDatabase<DB, TName extends string> = Omit<KyselyDatabase<DB, TName>, 'reader' | 'cache' | 'schema'>;
150
- //#endregion
151
- export { KyselyDatabase, KyselyDatabaseOptions, ReadOnlyDatabase };
152
- //# sourceMappingURL=kysely.d.mts.map
1
+ import { i as closeDatabasePools, n as KyselyDatabaseOptions, r as ReadOnlyDatabase, t as KyselyDatabase } from "../kysely-DKwnl0nf.mjs";
2
+ export { KyselyDatabase, KyselyDatabaseOptions, ReadOnlyDatabase, closeDatabasePools };
@@ -1,180 +1,2 @@
1
- import { Cache } from "../cache-0ANvRQnD.mjs";
2
- import { DEFAULT_POSTGRES_VERSION, canonicalId, provideKey, serviceKey } from "@geekmidas/manifest";
3
- import { Kysely, PostgresDialect } from "kysely";
4
- import pg from "pg";
5
-
6
- //#region src/database/kysely.ts
7
- /** The schema a database uses when it does not say otherwise. */
8
- const DEFAULT_SCHEMA = "app";
9
- /**
10
- * @typeParam DB - the database's schema.
11
- * @typeParam TName - the canonical id. TypeScript has no partial
12
- * type-argument inference, so `new KyselyDatabase<OrdersDB>('orders')` leaves
13
- * this at its default and the service key widens to `string`. `db` still types
14
- * through `.database()`, which infers from the service.
15
- */
16
- var KyselyDatabase = class KyselyDatabase {
17
- id;
18
- service;
19
- /**
20
- * Declared once and read by both `declare()` and `connect()`, so the key the
21
- * build publishes and the key the client reads cannot drift.
22
- */
23
- config;
24
- schemaName;
25
- roles;
26
- version;
27
- derivedFrom;
28
- constructor(id, options = {}, derivedFrom) {
29
- this.options = options;
30
- const canonical = canonicalId(id);
31
- this.id = canonical;
32
- this.config = {
33
- url: provideKey(canonical, "url"),
34
- ownerUrl: provideKey(canonical, "ownerUrl")
35
- };
36
- this.schemaName = options.schema ?? DEFAULT_SCHEMA;
37
- this.roles = options.roles ?? true;
38
- this.version = options.version ?? DEFAULT_POSTGRES_VERSION;
39
- this.derivedFrom = derivedFrom;
40
- this.service = {
41
- serviceName: serviceKey(canonical),
42
- register: (registerOptions) => this.connect(registerOptions)
43
- };
44
- }
45
- declare() {
46
- if (this.derivedFrom) {
47
- const { kind, of, schema } = this.derivedFrom;
48
- return [kind === "database-schema" ? {
49
- kind,
50
- id: this.id,
51
- of,
52
- schema: schema ?? this.schemaName,
53
- provides: [this.config.url]
54
- } : {
55
- kind,
56
- id: this.id,
57
- of,
58
- provides: [this.config.url]
59
- }];
60
- }
61
- return [{
62
- kind: "database",
63
- id: this.id,
64
- engine: "postgres",
65
- schema: this.schemaName,
66
- version: this.version,
67
- provides: [this.config.url],
68
- ...this.roles ? {} : { roles: false }
69
- }];
70
- }
71
- /**
72
- * A read-only endpoint on this database.
73
- *
74
- * Read-only is enforced by the reader role's grants rather than by which
75
- * endpoint it resolves to, so falling back to the writer where no replica
76
- * exists is safe rather than a silently writable connection behind a name
77
- * that says reader. There is no `writer()`: the database *is* the writer, so
78
- * a replica can never be reached by accident.
79
- *
80
- * The return type is narrower than this class on purpose — see
81
- * {@link ReadOnlyDatabase}.
82
- */
83
- reader() {
84
- return new KyselyDatabase(`${this.id}Reader`, this.options, {
85
- kind: "database-reader",
86
- of: this.id
87
- });
88
- }
89
- /**
90
- * A cache that lives in this database.
91
- *
92
- * The same strengthening `schema()` is over a second database: `new
93
- * Cache('Sessions')` says the app caches and leaves where to the deployment,
94
- * while this says it caches *here* — which is a fact about the application
95
- * and so belongs in its code.
96
- *
97
- * What it buys beyond being explicit: the table's schema and the role that
98
- * reaches it come from this database rather than from a second convention,
99
- * and the backend no longer has to guess which database "the database" meant
100
- * when an app declares two.
101
- *
102
- * A cache is not a `KyselyDatabase`, so this returns a `Cache` — the client
103
- * is a key/value store, not a query builder, and typing it as the parent
104
- * would be a convenience that lies.
105
- */
106
- cache(id = `${this.id}Cache`, options = {}) {
107
- return new Cache(id, {
108
- of: this.id,
109
- ...options.table ? { table: options.table } : {}
110
- });
111
- }
112
- /**
113
- * A second schema in this database, with its own role(s) and its own URL —
114
- * so this database's role holds no grant on those tables at all.
115
- *
116
- * Typed separately because a tenant has its own tables: the point is that
117
- * `auth.selectFrom('sessions')` type-checks and
118
- * `orders.selectFrom('sessions')` does not.
119
- */
120
- schema(id, options = {}) {
121
- return new KyselyDatabase(id, options, {
122
- kind: "database-schema",
123
- of: this.id,
124
- schema: options.schema ?? id.toLowerCase()
125
- });
126
- }
127
- /**
128
- * A connection as the *owner* role — the one that may create, alter and drop.
129
- *
130
- * A `Service` rather than part of the construct, and deliberately so: a
131
- * construct is what `.dependsOn()` accepts, and nothing should be able to
132
- * depend on this. A migrator asks for it by name; a handler cannot ask at
133
- * all, which is the security property the role split exists for.
134
- *
135
- * Falls back to the runtime URL where no owner URL was published — the
136
- * `roles: false` downgrade, where there is only one credential and it is the
137
- * cluster master's.
138
- */
139
- get owner() {
140
- return {
141
- serviceName: `${serviceKey(this.id)}Owner`,
142
- register: (options) => this.connect(options, { owner: true })
143
- };
144
- }
145
- async connect(options, as = {}) {
146
- const { url, ownerUrl } = options.envParser.create((get) => ({
147
- url: get(this.config.url).string(),
148
- ownerUrl: get(this.config.ownerUrl).string().optional()
149
- })).parse();
150
- const { schema: _schema, roles: _roles,...kysely } = this.options;
151
- return new Kysely({
152
- ...kysely,
153
- dialect: new PostgresDialect({ pool: pool(as.owner ? ownerUrl ?? url : url) })
154
- });
155
- }
156
- };
157
- /**
158
- * A pool for one URL, with its schema actually on the search path.
159
- *
160
- * `?search_path=` is not a libpq parameter — a URL carrying it connects
161
- * happily and then resolves every unqualified name against `public`, which is
162
- * how a schema tenant silently writes its tables into the database it was
163
- * separated from. Postgres takes it as a startup option instead, so the URL
164
- * keeps the readable form the target derives and this turns it into the thing
165
- * the server understands.
166
- */
167
- function pool(url) {
168
- const parsed = new URL(url);
169
- const searchPath = parsed.searchParams.get("search_path");
170
- if (!searchPath) return new pg.Pool({ connectionString: url });
171
- parsed.searchParams.delete("search_path");
172
- return new pg.Pool({
173
- connectionString: parsed.toString(),
174
- options: `-c search_path=${searchPath}`
175
- });
176
- }
177
-
178
- //#endregion
179
- export { KyselyDatabase };
180
- //# sourceMappingURL=kysely.mjs.map
1
+ import { n as closeDatabasePools, t as KyselyDatabase } from "../kysely-B_0BAr0T.mjs";
2
+ export { KyselyDatabase, closeDatabasePools };