@geekmidas/constructs 10.0.0-alpha.17 → 10.0.0-alpha.170

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 (485) hide show
  1. package/README.md +246 -158
  2. package/dist/Construct-127M7yrl.d.cts +231 -0
  3. package/dist/Construct-127M7yrl.d.cts.map +1 -0
  4. package/dist/Construct-BMk_CRSD.d.mts +231 -0
  5. package/dist/Construct-BMk_CRSD.d.mts.map +1 -0
  6. package/dist/{Construct-BeYVu_QF.mjs → Construct-CGuc_Ijk.mjs} +8 -9
  7. package/dist/Construct-CGuc_Ijk.mjs.map +1 -0
  8. package/dist/{Construct-DqdlARxq.cjs → Construct-DorKS0Ua.cjs} +8 -9
  9. package/dist/Construct-DorKS0Ua.cjs.map +1 -0
  10. package/dist/{Cron-l4Wlz6G9.d.mts → Cron-Ca_qHQu2.d.cts} +16 -9
  11. package/dist/Cron-Ca_qHQu2.d.cts.map +1 -0
  12. package/dist/{Cron-zsoSAwZo.d.cts → Cron-DPJiR7Lt.d.mts} +15 -8
  13. package/dist/Cron-DPJiR7Lt.d.mts.map +1 -0
  14. package/dist/CronBuilder-BC4za5Bx.d.mts +47 -0
  15. package/dist/CronBuilder-BC4za5Bx.d.mts.map +1 -0
  16. package/dist/{CronBuilder-D_0HNBTr.mjs → CronBuilder-BJ5LoadF.mjs} +28 -11
  17. package/dist/CronBuilder-BJ5LoadF.mjs.map +1 -0
  18. package/dist/{CronBuilder-BdnI6lxF.cjs → CronBuilder-B_NSP-Y5.cjs} +27 -10
  19. package/dist/CronBuilder-B_NSP-Y5.cjs.map +1 -0
  20. package/dist/CronBuilder-C3RrAF1-.d.cts +47 -0
  21. package/dist/CronBuilder-C3RrAF1-.d.cts.map +1 -0
  22. package/dist/Endpoint-52z1P0Ue.cjs +581 -0
  23. package/dist/Endpoint-52z1P0Ue.cjs.map +1 -0
  24. package/dist/{Endpoint-DBflWAe4.d.cts → Endpoint-BlIZLsBQ.d.cts} +101 -20
  25. package/dist/Endpoint-BlIZLsBQ.d.cts.map +1 -0
  26. package/dist/{Endpoint-oS-Fe3d_.d.mts → Endpoint-DC7mreOr.d.mts} +104 -23
  27. package/dist/Endpoint-DC7mreOr.d.mts.map +1 -0
  28. package/dist/Endpoint-sUOU7uLx.mjs +552 -0
  29. package/dist/Endpoint-sUOU7uLx.mjs.map +1 -0
  30. package/dist/{EndpointFactory-Bm3aKRdV.mjs → EndpointFactory-Bzi9Sl7r.mjs} +269 -53
  31. package/dist/EndpointFactory-Bzi9Sl7r.mjs.map +1 -0
  32. package/dist/{EndpointFactory-CLvWuHyt.cjs → EndpointFactory-Cf_Cs1ym.cjs} +309 -51
  33. package/dist/EndpointFactory-Cf_Cs1ym.cjs.map +1 -0
  34. package/dist/{index-Cc4kKPag.d.mts → EndpointFactory-DCmnCmkX.d.mts} +189 -106
  35. package/dist/EndpointFactory-DCmnCmkX.d.mts.map +1 -0
  36. package/dist/{index-C1ZwNOOk.d.cts → EndpointFactory-cVTb8kCc.d.cts} +187 -104
  37. package/dist/EndpointFactory-cVTb8kCc.d.cts.map +1 -0
  38. package/dist/Function-BIEsY0Hm.d.cts +76 -0
  39. package/dist/Function-BIEsY0Hm.d.cts.map +1 -0
  40. package/dist/Function-BKReud5p.d.mts +76 -0
  41. package/dist/Function-BKReud5p.d.mts.map +1 -0
  42. package/dist/{HonoEndpointAdaptor-92zavCsV.cjs → HonoEndpointAdaptor-BTbqfSaa.cjs} +115 -41
  43. package/dist/HonoEndpointAdaptor-BTbqfSaa.cjs.map +1 -0
  44. package/dist/{HonoEndpointAdaptor-yYaU7jVJ.mjs → HonoEndpointAdaptor-CBVey2cY.mjs} +112 -38
  45. package/dist/HonoEndpointAdaptor-CBVey2cY.mjs.map +1 -0
  46. package/dist/ObjectSubscriberBuilder-AwGKoUKy.d.mts +129 -0
  47. package/dist/ObjectSubscriberBuilder-AwGKoUKy.d.mts.map +1 -0
  48. package/dist/ObjectSubscriberBuilder-CB6imsX4.d.cts +129 -0
  49. package/dist/ObjectSubscriberBuilder-CB6imsX4.d.cts.map +1 -0
  50. package/dist/ProcessorBuilder-CeEZ2vCx.d.cts +216 -0
  51. package/dist/ProcessorBuilder-CeEZ2vCx.d.cts.map +1 -0
  52. package/dist/ProcessorBuilder-CwIlm75W.d.mts +216 -0
  53. package/dist/ProcessorBuilder-CwIlm75W.d.mts.map +1 -0
  54. package/dist/Queue-9Hh20ZCk.mjs +104 -0
  55. package/dist/Queue-9Hh20ZCk.mjs.map +1 -0
  56. package/dist/{Queue-D9X6OoON.d.mts → Queue-B8HGg439.d.mts} +42 -41
  57. package/dist/Queue-B8HGg439.d.mts.map +1 -0
  58. package/dist/{Queue-DYPB2KWL.d.cts → Queue-C4rijiM7.d.cts} +43 -42
  59. package/dist/Queue-C4rijiM7.d.cts.map +1 -0
  60. package/dist/Queue-W1wueijP.cjs +109 -0
  61. package/dist/Queue-W1wueijP.cjs.map +1 -0
  62. package/dist/QueueBuilder-BDcv9B71.cjs +135 -0
  63. package/dist/QueueBuilder-BDcv9B71.cjs.map +1 -0
  64. package/dist/QueueBuilder-CUERv8jt.d.mts +75 -0
  65. package/dist/QueueBuilder-CUERv8jt.d.mts.map +1 -0
  66. package/dist/QueueBuilder-CmB1vOgn.d.cts +75 -0
  67. package/dist/QueueBuilder-CmB1vOgn.d.cts.map +1 -0
  68. package/dist/QueueBuilder-CrZL8HHs.mjs +118 -0
  69. package/dist/QueueBuilder-CrZL8HHs.mjs.map +1 -0
  70. package/dist/Subscriber-5rCX1Nph.d.cts +83 -0
  71. package/dist/Subscriber-5rCX1Nph.d.cts.map +1 -0
  72. package/dist/Subscriber-CtQXhcL7.d.mts +83 -0
  73. package/dist/Subscriber-CtQXhcL7.d.mts.map +1 -0
  74. package/dist/SubscriberBuilder-CpFhShTJ.mjs +238 -0
  75. package/dist/SubscriberBuilder-CpFhShTJ.mjs.map +1 -0
  76. package/dist/SubscriberBuilder-DJEvNRdD.cjs +261 -0
  77. package/dist/SubscriberBuilder-DJEvNRdD.cjs.map +1 -0
  78. package/dist/Topic-BGoOeCT6.mjs +99 -0
  79. package/dist/Topic-BGoOeCT6.mjs.map +1 -0
  80. package/dist/Topic-DLCZBNwK.cjs +104 -0
  81. package/dist/Topic-DLCZBNwK.cjs.map +1 -0
  82. package/dist/adaptors/aws.cjs +147 -168
  83. package/dist/adaptors/aws.cjs.map +1 -1
  84. package/dist/adaptors/aws.d.cts +57 -48
  85. package/dist/adaptors/aws.d.cts.map +1 -1
  86. package/dist/adaptors/aws.d.mts +58 -49
  87. package/dist/adaptors/aws.d.mts.map +1 -1
  88. package/dist/adaptors/aws.mjs +142 -164
  89. package/dist/adaptors/aws.mjs.map +1 -1
  90. package/dist/adaptors/awsWebsocket.cjs +354 -0
  91. package/dist/adaptors/awsWebsocket.cjs.map +1 -0
  92. package/dist/adaptors/awsWebsocket.d.cts +156 -0
  93. package/dist/adaptors/awsWebsocket.d.cts.map +1 -0
  94. package/dist/adaptors/awsWebsocket.d.mts +156 -0
  95. package/dist/adaptors/awsWebsocket.d.mts.map +1 -0
  96. package/dist/adaptors/awsWebsocket.mjs +347 -0
  97. package/dist/adaptors/awsWebsocket.mjs.map +1 -0
  98. package/dist/adaptors/hono.cjs +1 -1
  99. package/dist/adaptors/hono.d.cts +8 -7
  100. package/dist/adaptors/hono.d.cts.map +1 -1
  101. package/dist/adaptors/hono.d.mts +10 -9
  102. package/dist/adaptors/hono.d.mts.map +1 -1
  103. package/dist/adaptors/hono.mjs +1 -1
  104. package/dist/adaptors/testing.cjs +1174 -41
  105. package/dist/adaptors/testing.cjs.map +1 -1
  106. package/dist/adaptors/testing.d.cts +517 -40
  107. package/dist/adaptors/testing.d.cts.map +1 -1
  108. package/dist/adaptors/testing.d.mts +517 -40
  109. package/dist/adaptors/testing.d.mts.map +1 -1
  110. package/dist/adaptors/testing.mjs +1140 -36
  111. package/dist/adaptors/testing.mjs.map +1 -1
  112. package/dist/auth-1yI2wR-4.d.cts +274 -0
  113. package/dist/auth-1yI2wR-4.d.cts.map +1 -0
  114. package/dist/auth-D4NMXgLt.d.mts +274 -0
  115. package/dist/auth-D4NMXgLt.d.mts.map +1 -0
  116. package/dist/auth.cjs +311 -26
  117. package/dist/auth.cjs.map +1 -1
  118. package/dist/auth.d.cts +2 -104
  119. package/dist/auth.d.mts +2 -104
  120. package/dist/auth.mjs +307 -28
  121. package/dist/auth.mjs.map +1 -1
  122. package/dist/cache-0VoeOTF9.d.mts +44 -0
  123. package/dist/cache-0VoeOTF9.d.mts.map +1 -0
  124. package/dist/cache-CW-sArzS.d.cts +44 -0
  125. package/dist/cache-CW-sArzS.d.cts.map +1 -0
  126. package/dist/cache.cjs +4 -20
  127. package/dist/cache.cjs.map +1 -1
  128. package/dist/cache.d.cts +2 -43
  129. package/dist/cache.d.mts +2 -43
  130. package/dist/cache.mjs +4 -20
  131. package/dist/cache.mjs.map +1 -1
  132. package/dist/cipher-C1lEFX63.mjs +225 -0
  133. package/dist/cipher-C1lEFX63.mjs.map +1 -0
  134. package/dist/cipher-CVxfwLjk.cjs +332 -0
  135. package/dist/cipher-CVxfwLjk.cjs.map +1 -0
  136. package/dist/cipher-DSDxPRIp.d.cts +106 -0
  137. package/dist/cipher-DSDxPRIp.d.cts.map +1 -0
  138. package/dist/cipher-DSDxPRIp.d.mts +106 -0
  139. package/dist/cipher-DSDxPRIp.d.mts.map +1 -0
  140. package/dist/{construct-interface-DPlxfpoS.d.mts → construct-interface-DhbaONW2.d.cts} +63 -8
  141. package/dist/construct-interface-DhbaONW2.d.cts.map +1 -0
  142. package/dist/{construct-interface-DgXTJcOD.d.cts → construct-interface-DxfkFxkl.d.mts} +63 -8
  143. package/dist/construct-interface-DxfkFxkl.d.mts.map +1 -0
  144. package/dist/construct-interface.cjs +47 -4
  145. package/dist/construct-interface.cjs.map +1 -1
  146. package/dist/construct-interface.d.cts +2 -2
  147. package/dist/construct-interface.d.mts +2 -2
  148. package/dist/construct-interface.mjs +45 -5
  149. package/dist/construct-interface.mjs.map +1 -1
  150. package/dist/credential-B80mOxwT.mjs +222 -0
  151. package/dist/credential-B80mOxwT.mjs.map +1 -0
  152. package/dist/credential-RlgbzZAc.cjs +257 -0
  153. package/dist/credential-RlgbzZAc.cjs.map +1 -0
  154. package/dist/credential.cjs +7 -129
  155. package/dist/credential.d.cts +2 -58
  156. package/dist/credential.d.mts +2 -58
  157. package/dist/credential.mjs +2 -128
  158. package/dist/crons/index.cjs +127 -1
  159. package/dist/crons/index.cjs.map +1 -1
  160. package/dist/crons/index.d.cts +43 -3
  161. package/dist/crons/index.d.cts.map +1 -1
  162. package/dist/crons/index.d.mts +43 -3
  163. package/dist/crons/index.d.mts.map +1 -1
  164. package/dist/crons/index.mjs +126 -2
  165. package/dist/crons/index.mjs.map +1 -1
  166. package/dist/database/kysely.cjs +3 -194
  167. package/dist/database/kysely.d.cts +2 -149
  168. package/dist/database/kysely.d.mts +2 -149
  169. package/dist/database/kysely.mjs +2 -192
  170. package/dist/email.cjs +24 -17
  171. package/dist/email.cjs.map +1 -1
  172. package/dist/email.d.cts +15 -5
  173. package/dist/email.d.cts.map +1 -1
  174. package/dist/email.d.mts +16 -6
  175. package/dist/email.d.mts.map +1 -1
  176. package/dist/email.mjs +23 -17
  177. package/dist/email.mjs.map +1 -1
  178. package/dist/encryption/kms.cjs +95 -0
  179. package/dist/encryption/kms.cjs.map +1 -0
  180. package/dist/encryption/kms.d.cts +7 -0
  181. package/dist/encryption/kms.d.cts.map +1 -0
  182. package/dist/encryption/kms.d.mts +7 -0
  183. package/dist/encryption/kms.d.mts.map +1 -0
  184. package/dist/encryption/kms.mjs +93 -0
  185. package/dist/encryption/kms.mjs.map +1 -0
  186. package/dist/encryption.cjs +116 -0
  187. package/dist/encryption.cjs.map +1 -0
  188. package/dist/encryption.d.cts +37 -0
  189. package/dist/encryption.d.cts.map +1 -0
  190. package/dist/encryption.d.mts +37 -0
  191. package/dist/encryption.d.mts.map +1 -0
  192. package/dist/encryption.mjs +101 -0
  193. package/dist/encryption.mjs.map +1 -0
  194. package/dist/endpoints/index.cjs +32 -10
  195. package/dist/endpoints/index.d.cts +106 -3
  196. package/dist/endpoints/index.d.cts.map +1 -0
  197. package/dist/endpoints/index.d.mts +106 -3
  198. package/dist/endpoints/index.d.mts.map +1 -0
  199. package/dist/endpoints/index.mjs +6 -4
  200. package/dist/expire-C586zznE.d.cts +38 -0
  201. package/dist/expire-C586zznE.d.cts.map +1 -0
  202. package/dist/expire-C586zznE.d.mts +38 -0
  203. package/dist/expire-C586zznE.d.mts.map +1 -0
  204. package/dist/expire-CieftS01.cjs +67 -0
  205. package/dist/expire-CieftS01.cjs.map +1 -0
  206. package/dist/expire-CpzUAfr9.mjs +50 -0
  207. package/dist/expire-CpzUAfr9.mjs.map +1 -0
  208. package/dist/external-api.cjs +106 -0
  209. package/dist/external-api.cjs.map +1 -0
  210. package/dist/external-api.d.cts +2 -0
  211. package/dist/external-api.d.mts +2 -0
  212. package/dist/external-api.mjs +103 -0
  213. package/dist/external-api.mjs.map +1 -0
  214. package/dist/fake-BvOXkZmj.d.mts +201 -0
  215. package/dist/fake-BvOXkZmj.d.mts.map +1 -0
  216. package/dist/fake-Djx8E0o1.d.cts +201 -0
  217. package/dist/fake-Djx8E0o1.d.cts.map +1 -0
  218. package/dist/file-server.cjs +200 -48
  219. package/dist/file-server.cjs.map +1 -1
  220. package/dist/file-server.d.cts +147 -15
  221. package/dist/file-server.d.cts.map +1 -1
  222. package/dist/file-server.d.mts +147 -15
  223. package/dist/file-server.d.mts.map +1 -1
  224. package/dist/file-server.mjs +198 -50
  225. package/dist/file-server.mjs.map +1 -1
  226. package/dist/functions/index.cjs +1 -1
  227. package/dist/functions/index.d.cts +2 -1
  228. package/dist/functions/index.d.mts +2 -1
  229. package/dist/functions/index.mjs +1 -1
  230. package/dist/{functions-C53GW2eQ.mjs → functions-BvIDQKAA.mjs} +117 -22
  231. package/dist/functions-BvIDQKAA.mjs.map +1 -0
  232. package/dist/{functions-B6qCvfmy.cjs → functions-DLF6-IK8.cjs} +122 -18
  233. package/dist/functions-DLF6-IK8.cjs.map +1 -0
  234. package/dist/inbox-BjvMs7EJ.d.cts +195 -0
  235. package/dist/inbox-BjvMs7EJ.d.cts.map +1 -0
  236. package/dist/inbox-C8bOR9UL.d.mts +195 -0
  237. package/dist/inbox-C8bOR9UL.d.mts.map +1 -0
  238. package/dist/inbox.cjs +291 -0
  239. package/dist/inbox.cjs.map +1 -0
  240. package/dist/inbox.d.cts +2 -0
  241. package/dist/inbox.d.mts +2 -0
  242. package/dist/inbox.mjs +283 -0
  243. package/dist/inbox.mjs.map +1 -0
  244. package/dist/index-DaK-C7N3.d.cts +115 -0
  245. package/dist/index-DaK-C7N3.d.cts.map +1 -0
  246. package/dist/{index-CeEtxDmK.d.cts → index-DdRjYhiJ.d.cts} +42 -2
  247. package/dist/{index-CeEtxDmK.d.cts.map → index-DdRjYhiJ.d.cts.map} +1 -1
  248. package/dist/{index-CeEtxDmK.d.mts → index-DdRjYhiJ.d.mts} +42 -2
  249. package/dist/{index-CeEtxDmK.d.mts.map → index-DdRjYhiJ.d.mts.map} +1 -1
  250. package/dist/index-vCS4HBEG.d.mts +115 -0
  251. package/dist/index-vCS4HBEG.d.mts.map +1 -0
  252. package/dist/index.cjs +4 -1
  253. package/dist/index.d.cts +26 -3
  254. package/dist/index.d.cts.map +1 -0
  255. package/dist/index.d.mts +26 -3
  256. package/dist/index.d.mts.map +1 -0
  257. package/dist/index.mjs +3 -2
  258. package/dist/kysely-2HqIQ2fC.d.cts +216 -0
  259. package/dist/kysely-2HqIQ2fC.d.cts.map +1 -0
  260. package/dist/kysely-BGvpd_ZH.d.mts +216 -0
  261. package/dist/kysely-BGvpd_ZH.d.mts.map +1 -0
  262. package/dist/kysely-Bc9xzaik.mjs +371 -0
  263. package/dist/kysely-Bc9xzaik.mjs.map +1 -0
  264. package/dist/kysely-D7f6J2lh.cjs +384 -0
  265. package/dist/kysely-D7f6J2lh.cjs.map +1 -0
  266. package/dist/{telemetry-DGcFlVpB.d.cts → lambdaTelemetry-8vnmVZQ5.d.cts} +2 -2
  267. package/dist/lambdaTelemetry-8vnmVZQ5.d.cts.map +1 -0
  268. package/dist/{telemetry-DGcFlVpB.d.mts → lambdaTelemetry-8vnmVZQ5.d.mts} +2 -2
  269. package/dist/lambdaTelemetry-8vnmVZQ5.d.mts.map +1 -0
  270. package/dist/mobile-app.cjs +78 -0
  271. package/dist/mobile-app.cjs.map +1 -0
  272. package/dist/mobile-app.d.cts +77 -0
  273. package/dist/mobile-app.d.cts.map +1 -0
  274. package/dist/mobile-app.d.mts +77 -0
  275. package/dist/mobile-app.d.mts.map +1 -0
  276. package/dist/mobile-app.mjs +77 -0
  277. package/dist/mobile-app.mjs.map +1 -0
  278. package/dist/object-storage.cjs +14 -7
  279. package/dist/object-storage.cjs.map +1 -1
  280. package/dist/object-storage.d.cts +12 -3
  281. package/dist/object-storage.d.cts.map +1 -1
  282. package/dist/object-storage.d.mts +12 -3
  283. package/dist/object-storage.d.mts.map +1 -1
  284. package/dist/object-storage.mjs +14 -9
  285. package/dist/object-storage.mjs.map +1 -1
  286. package/dist/optionalPeers-D7Wt6dnF.mjs +140 -0
  287. package/dist/optionalPeers-D7Wt6dnF.mjs.map +1 -0
  288. package/dist/optionalPeers-DuNQXXe1.cjs +223 -0
  289. package/dist/optionalPeers-DuNQXXe1.cjs.map +1 -0
  290. package/dist/origins-BjxYht13.cjs +96 -0
  291. package/dist/origins-BjxYht13.cjs.map +1 -0
  292. package/dist/origins-Boc9qbo-.mjs +73 -0
  293. package/dist/origins-Boc9qbo-.mjs.map +1 -0
  294. package/dist/pattern-C1CEcglD.mjs +241 -0
  295. package/dist/pattern-C1CEcglD.mjs.map +1 -0
  296. package/dist/pattern-QFaUIr77.cjs +288 -0
  297. package/dist/pattern-QFaUIr77.cjs.map +1 -0
  298. package/dist/privateAddress-Bg5fUsbp.mjs +21 -0
  299. package/dist/privateAddress-Bg5fUsbp.mjs.map +1 -0
  300. package/dist/privateAddress-CqGyuFHn.cjs +26 -0
  301. package/dist/privateAddress-CqGyuFHn.cjs.map +1 -0
  302. package/dist/processors/index.cjs +214 -0
  303. package/dist/processors/index.cjs.map +1 -0
  304. package/dist/processors/index.d.cts +78 -0
  305. package/dist/processors/index.d.cts.map +1 -0
  306. package/dist/processors/index.d.mts +78 -0
  307. package/dist/processors/index.d.mts.map +1 -0
  308. package/dist/processors/index.mjs +193 -0
  309. package/dist/processors/index.mjs.map +1 -0
  310. package/dist/queue/index.cjs +5 -192
  311. package/dist/queue/index.d.cts +3 -53
  312. package/dist/queue/index.d.mts +3 -53
  313. package/dist/queue/index.mjs +3 -190
  314. package/dist/random-password.cjs +86 -0
  315. package/dist/random-password.cjs.map +1 -0
  316. package/dist/random-password.d.cts +30 -0
  317. package/dist/random-password.d.cts.map +1 -0
  318. package/dist/random-password.d.mts +30 -0
  319. package/dist/random-password.d.mts.map +1 -0
  320. package/dist/random-password.mjs +84 -0
  321. package/dist/random-password.mjs.map +1 -0
  322. package/dist/readRequestBody-BmKnPl0a.mjs +293 -0
  323. package/dist/readRequestBody-BmKnPl0a.mjs.map +1 -0
  324. package/dist/{lazyAccessors-Dx9NLwJZ.cjs → readRequestBody-CN9GVdeE.cjs} +141 -47
  325. package/dist/readRequestBody-CN9GVdeE.cjs.map +1 -0
  326. package/dist/{processAudits-D_2W5x8k.cjs → requestLogger-CnoYd-Ah.cjs} +63 -3
  327. package/dist/requestLogger-CnoYd-Ah.cjs.map +1 -0
  328. package/dist/{processAudits-BpRlPQMW.mjs → requestLogger-D2JS7pPM.mjs} +51 -3
  329. package/dist/requestLogger-D2JS7pPM.mjs.map +1 -0
  330. package/dist/rest-api.cjs +100 -73
  331. package/dist/rest-api.cjs.map +1 -1
  332. package/dist/rest-api.d.cts +83 -59
  333. package/dist/rest-api.d.cts.map +1 -1
  334. package/dist/rest-api.d.mts +83 -59
  335. package/dist/rest-api.d.mts.map +1 -1
  336. package/dist/rest-api.mjs +97 -76
  337. package/dist/rest-api.mjs.map +1 -1
  338. package/dist/runSubscriber-HEqXkin1.mjs +117 -0
  339. package/dist/runSubscriber-HEqXkin1.mjs.map +1 -0
  340. package/dist/runSubscriber-sVJfLA0-.cjs +134 -0
  341. package/dist/runSubscriber-sVJfLA0-.cjs.map +1 -0
  342. package/dist/shutdown-BMJmAhSt.cjs +38 -0
  343. package/dist/shutdown-BMJmAhSt.cjs.map +1 -0
  344. package/dist/shutdown-C7xa8x9S.mjs +27 -0
  345. package/dist/shutdown-C7xa8x9S.mjs.map +1 -0
  346. package/dist/site.cjs +137 -10
  347. package/dist/site.cjs.map +1 -1
  348. package/dist/site.d.cts +153 -3
  349. package/dist/site.d.cts.map +1 -1
  350. package/dist/site.d.mts +153 -3
  351. package/dist/site.d.mts.map +1 -1
  352. package/dist/site.mjs +117 -13
  353. package/dist/site.mjs.map +1 -1
  354. package/dist/stages-DaTaoQei.d.cts +73 -0
  355. package/dist/stages-DaTaoQei.d.cts.map +1 -0
  356. package/dist/stages-DaTaoQei.d.mts +73 -0
  357. package/dist/stages-DaTaoQei.d.mts.map +1 -0
  358. package/dist/subscribers/index.cjs +134 -1
  359. package/dist/subscribers/index.cjs.map +1 -0
  360. package/dist/subscribers/index.d.cts +74 -3
  361. package/dist/subscribers/index.d.cts.map +1 -0
  362. package/dist/subscribers/index.d.mts +74 -3
  363. package/dist/subscribers/index.d.mts.map +1 -0
  364. package/dist/subscribers/index.mjs +132 -2
  365. package/dist/subscribers/index.mjs.map +1 -0
  366. package/dist/telemetry-BirKau0X.d.mts +40 -0
  367. package/dist/telemetry-BirKau0X.d.mts.map +1 -0
  368. package/dist/telemetry-DjJgtQ_N.d.cts +40 -0
  369. package/dist/telemetry-DjJgtQ_N.d.cts.map +1 -0
  370. package/dist/telemetry.cjs +56 -0
  371. package/dist/telemetry.cjs.map +1 -0
  372. package/dist/telemetry.d.cts +2 -0
  373. package/dist/telemetry.d.mts +2 -0
  374. package/dist/telemetry.mjs +55 -0
  375. package/dist/telemetry.mjs.map +1 -0
  376. package/dist/topic/index.cjs +2 -134
  377. package/dist/topic/index.d.cts +2 -3
  378. package/dist/topic/index.d.mts +2 -3
  379. package/dist/topic/index.mjs +2 -132
  380. package/dist/tracing-Bbj1uoFJ.mjs +127 -0
  381. package/dist/tracing-Bbj1uoFJ.mjs.map +1 -0
  382. package/dist/tracing-C0ooU0V2.cjs +150 -0
  383. package/dist/tracing-C0ooU0V2.cjs.map +1 -0
  384. package/dist/websocket-api-C6LGg9-D.mjs +1716 -0
  385. package/dist/websocket-api-C6LGg9-D.mjs.map +1 -0
  386. package/dist/websocket-api-CD-E5Ogr.d.cts +1207 -0
  387. package/dist/websocket-api-CD-E5Ogr.d.cts.map +1 -0
  388. package/dist/websocket-api-CoKPJJRl.cjs +1895 -0
  389. package/dist/websocket-api-CoKPJJRl.cjs.map +1 -0
  390. package/dist/websocket-api-pJJfeTcm.d.mts +1207 -0
  391. package/dist/websocket-api-pJJfeTcm.d.mts.map +1 -0
  392. package/dist/websocket-api.cjs +42 -0
  393. package/dist/websocket-api.d.cts +2 -0
  394. package/dist/websocket-api.d.mts +2 -0
  395. package/dist/websocket-api.mjs +3 -0
  396. package/dist/worker.cjs +174 -32
  397. package/dist/worker.cjs.map +1 -1
  398. package/dist/worker.d.cts +147 -47
  399. package/dist/worker.d.cts.map +1 -1
  400. package/dist/worker.d.mts +147 -47
  401. package/dist/worker.d.mts.map +1 -1
  402. package/dist/worker.mjs +175 -33
  403. package/dist/worker.mjs.map +1 -1
  404. package/package.json +180 -43
  405. package/dist/Construct-BeYVu_QF.mjs.map +0 -1
  406. package/dist/Construct-DfbwIntp.d.cts +0 -115
  407. package/dist/Construct-DfbwIntp.d.cts.map +0 -1
  408. package/dist/Construct-DqdlARxq.cjs.map +0 -1
  409. package/dist/Construct-l5aOn_jv.d.mts +0 -115
  410. package/dist/Construct-l5aOn_jv.d.mts.map +0 -1
  411. package/dist/Cron-l4Wlz6G9.d.mts.map +0 -1
  412. package/dist/Cron-zsoSAwZo.d.cts.map +0 -1
  413. package/dist/CronBuilder-BdnI6lxF.cjs.map +0 -1
  414. package/dist/CronBuilder-CyT71Nzg.d.cts +0 -41
  415. package/dist/CronBuilder-CyT71Nzg.d.cts.map +0 -1
  416. package/dist/CronBuilder-D_0HNBTr.mjs.map +0 -1
  417. package/dist/CronBuilder-UoNgFe8S.d.mts +0 -41
  418. package/dist/CronBuilder-UoNgFe8S.d.mts.map +0 -1
  419. package/dist/Endpoint-BpZHtJ2W.cjs +0 -1689
  420. package/dist/Endpoint-BpZHtJ2W.cjs.map +0 -1
  421. package/dist/Endpoint-DBflWAe4.d.cts.map +0 -1
  422. package/dist/Endpoint-ONsly_dq.mjs +0 -1671
  423. package/dist/Endpoint-ONsly_dq.mjs.map +0 -1
  424. package/dist/Endpoint-oS-Fe3d_.d.mts.map +0 -1
  425. package/dist/EndpointFactory-Bm3aKRdV.mjs.map +0 -1
  426. package/dist/EndpointFactory-CLvWuHyt.cjs.map +0 -1
  427. package/dist/HonoEndpointAdaptor-92zavCsV.cjs.map +0 -1
  428. package/dist/HonoEndpointAdaptor-yYaU7jVJ.mjs.map +0 -1
  429. package/dist/Queue-D9X6OoON.d.mts.map +0 -1
  430. package/dist/Queue-DYPB2KWL.d.cts.map +0 -1
  431. package/dist/Subscriber-C4heaAyO.d.mts +0 -51
  432. package/dist/Subscriber-C4heaAyO.d.mts.map +0 -1
  433. package/dist/Subscriber-CotDUELC.d.cts +0 -51
  434. package/dist/Subscriber-CotDUELC.d.cts.map +0 -1
  435. package/dist/SubscriberBuilder-BEv0eoHy.d.cts +0 -59
  436. package/dist/SubscriberBuilder-BEv0eoHy.d.cts.map +0 -1
  437. package/dist/SubscriberBuilder-C0ZEtGDI.cjs +0 -125
  438. package/dist/SubscriberBuilder-C0ZEtGDI.cjs.map +0 -1
  439. package/dist/SubscriberBuilder-h7B_cHMr.mjs +0 -114
  440. package/dist/SubscriberBuilder-h7B_cHMr.mjs.map +0 -1
  441. package/dist/SubscriberBuilder-tyH5yTk5.d.mts +0 -59
  442. package/dist/SubscriberBuilder-tyH5yTk5.d.mts.map +0 -1
  443. package/dist/Topic-DEVGo0Dm.d.cts +0 -89
  444. package/dist/Topic-DEVGo0Dm.d.cts.map +0 -1
  445. package/dist/Topic-zk_6Gthr.d.mts +0 -89
  446. package/dist/Topic-zk_6Gthr.d.mts.map +0 -1
  447. package/dist/auth.d.cts.map +0 -1
  448. package/dist/auth.d.mts.map +0 -1
  449. package/dist/cache.d.cts.map +0 -1
  450. package/dist/cache.d.mts.map +0 -1
  451. package/dist/construct-interface-DPlxfpoS.d.mts.map +0 -1
  452. package/dist/construct-interface-DgXTJcOD.d.cts.map +0 -1
  453. package/dist/credential.cjs.map +0 -1
  454. package/dist/credential.d.cts.map +0 -1
  455. package/dist/credential.d.mts.map +0 -1
  456. package/dist/credential.mjs.map +0 -1
  457. package/dist/database/kysely.cjs.map +0 -1
  458. package/dist/database/kysely.d.cts.map +0 -1
  459. package/dist/database/kysely.d.mts.map +0 -1
  460. package/dist/database/kysely.mjs.map +0 -1
  461. package/dist/functions-B6qCvfmy.cjs.map +0 -1
  462. package/dist/functions-C53GW2eQ.mjs.map +0 -1
  463. package/dist/index-B2urf3YI.d.cts +0 -26
  464. package/dist/index-B2urf3YI.d.cts.map +0 -1
  465. package/dist/index-C1ZwNOOk.d.cts.map +0 -1
  466. package/dist/index-Cc4kKPag.d.mts.map +0 -1
  467. package/dist/index-DMCDvnsM.d.mts +0 -26
  468. package/dist/index-DMCDvnsM.d.mts.map +0 -1
  469. package/dist/index-D_frT6MP.d.cts +0 -165
  470. package/dist/index-D_frT6MP.d.cts.map +0 -1
  471. package/dist/index-DcyIYbDS.d.mts +0 -165
  472. package/dist/index-DcyIYbDS.d.mts.map +0 -1
  473. package/dist/lazyAccessors-BHtcqgz2.mjs +0 -211
  474. package/dist/lazyAccessors-BHtcqgz2.mjs.map +0 -1
  475. package/dist/lazyAccessors-Dx9NLwJZ.cjs.map +0 -1
  476. package/dist/processAudits-BpRlPQMW.mjs.map +0 -1
  477. package/dist/processAudits-D_2W5x8k.cjs.map +0 -1
  478. package/dist/queue/index.cjs.map +0 -1
  479. package/dist/queue/index.d.cts.map +0 -1
  480. package/dist/queue/index.d.mts.map +0 -1
  481. package/dist/queue/index.mjs.map +0 -1
  482. package/dist/telemetry-DGcFlVpB.d.cts.map +0 -1
  483. package/dist/telemetry-DGcFlVpB.d.mts.map +0 -1
  484. package/dist/topic/index.cjs.map +0 -1
  485. package/dist/topic/index.mjs.map +0 -1
@@ -1,149 +1,2 @@
1
- import { t as Construct } from "../construct-interface-DPlxfpoS.mjs";
2
- import { Cache } from "../cache.mjs";
3
- import { ConstructName, Declaration, PostgresVersion } from "@geekmidas/manifest";
4
- import { Kysely, KyselyConfig } from "kysely";
5
- import { Service } from "@geekmidas/services";
6
- //#region src/database/kysely.d.ts
7
- /**
8
- * Everything Kysely takes, plus what this construct declares.
9
- *
10
- * `dialect` is omitted because the construct owns it — it is built from the one
11
- * URL the adapter supplied, which is the whole point of the construct. The rest
12
- * of `KyselyConfig` (`plugins`, `log`) is the app's business and passes
13
- * straight through, so anything Kysely adds later arrives without being
14
- * tracked here.
15
- */
16
- export interface KyselyDatabaseOptions extends Omit<KyselyConfig, 'dialect'> {
17
- /**
18
- * The schema, pinned on both roles' `search_path`.
19
- *
20
- * Defaults to `app` — the role the schema plays, rather than a restatement
21
- * of the database's own name, which reads correctly beside `auth` and
22
- * `pgboss` and keeps the application off `public`.
23
- */
24
- schema?: string;
25
- /**
26
- * Provision the owner/runtime role split. Defaults to on.
27
- *
28
- * Off falls back to the cluster's master credential in both URLs, giving up
29
- * the DDL/DML split and putting credentials that can drop a table into the
30
- * function's environment. A deliberate downgrade, not a default.
31
- */
32
- roles?: boolean;
33
- /**
34
- * The Postgres major version to provision.
35
- *
36
- * Declared here so one statement reaches both targets. It was previously
37
- * set in two unrelated places — a container tag locally, nothing at all on
38
- * AWS (so Aurora chose) — which is how local came to run 18 while deployed
39
- * ran 17.7 with nothing recording the difference.
40
- *
41
- * Defaults to {@link DEFAULT_POSTGRES_VERSION}.
42
- */
43
- version?: PostgresVersion;
44
- }
45
- /** What makes a construct derived rather than a database in its own right. */
46
- interface DerivedFrom {
47
- kind: 'database-reader' | 'database-schema';
48
- of: string;
49
- schema?: string;
50
- }
51
- /**
52
- * @typeParam DB - the database's schema.
53
- * @typeParam TName - the canonical id. TypeScript has no partial
54
- * type-argument inference, so `new KyselyDatabase<OrdersDB>('orders')` leaves
55
- * this at its default and the service key widens to `string`. `db` still types
56
- * through `.database()`, which infers from the service.
57
- */
58
- export declare class KyselyDatabase<DB = unknown, TName extends string = string> implements Construct<TName, Kysely<DB>> {
59
- private readonly options;
60
- readonly id: TName;
61
- readonly service: Service<Uncapitalize<TName>, Kysely<DB>>;
62
- /**
63
- * Declared once and read by both `declare()` and `connect()`, so the key the
64
- * build publishes and the key the client reads cannot drift.
65
- */
66
- private readonly config;
67
- private readonly schemaName;
68
- private readonly roles;
69
- private readonly version;
70
- private readonly derivedFrom?;
71
- constructor(id: ConstructName<TName>, options?: KyselyDatabaseOptions, derivedFrom?: DerivedFrom);
72
- declare(): Declaration[];
73
- /**
74
- * A read-only endpoint on this database.
75
- *
76
- * Read-only is enforced by the reader role's grants rather than by which
77
- * endpoint it resolves to, so falling back to the writer where no replica
78
- * exists is safe rather than a silently writable connection behind a name
79
- * that says reader. There is no `writer()`: the database *is* the writer, so
80
- * a replica can never be reached by accident.
81
- *
82
- * The return type is narrower than this class on purpose — see
83
- * {@link ReadOnlyDatabase}.
84
- */
85
- reader(): ReadOnlyDatabase<DB, `${TName}Reader`>;
86
- /**
87
- * A cache that lives in this database.
88
- *
89
- * The same strengthening `schema()` is over a second database: `new
90
- * Cache('Sessions')` says the app caches and leaves where to the deployment,
91
- * while this says it caches *here* — which is a fact about the application
92
- * and so belongs in its code.
93
- *
94
- * What it buys beyond being explicit: the table's schema and the role that
95
- * reaches it come from this database rather than from a second convention,
96
- * and the backend no longer has to guess which database "the database" meant
97
- * when an app declares two.
98
- *
99
- * A cache is not a `KyselyDatabase`, so this returns a `Cache` — the client
100
- * is a key/value store, not a query builder, and typing it as the parent
101
- * would be a convenience that lies.
102
- */
103
- cache<TCache extends string = `${TName}Cache`>(id?: ConstructName<TCache>, options?: {
104
- table?: string;
105
- }): Cache<TCache>;
106
- /**
107
- * A second schema in this database, with its own role(s) and its own URL —
108
- * so this database's role holds no grant on those tables at all.
109
- *
110
- * Typed separately because a tenant has its own tables: the point is that
111
- * `auth.selectFrom('sessions')` type-checks and
112
- * `orders.selectFrom('sessions')` does not.
113
- */
114
- schema<TenantDB, TTenant extends string>(id: ConstructName<TTenant>, options?: KyselyDatabaseOptions): KyselyDatabase<TenantDB, TTenant>;
115
- /**
116
- * A connection as the *owner* role — the one that may create, alter and drop.
117
- *
118
- * A `Service` rather than part of the construct, and deliberately so: a
119
- * construct is what `.dependsOn()` accepts, and nothing should be able to
120
- * depend on this. A migrator asks for it by name; a handler cannot ask at
121
- * all, which is the security property the role split exists for.
122
- *
123
- * Falls back to the runtime URL where no owner URL was published — the
124
- * `roles: false` downgrade, where there is only one credential and it is the
125
- * cluster master's.
126
- */
127
- get owner(): Service<`${Uncapitalize<TName>}Owner`, Kysely<DB>>;
128
- private connect;
129
- }
130
- /**
131
- * A database you may read through, and derive nothing from.
132
- *
133
- * A reader is terminal in the graph, and this is that fact in the type system.
134
- * `DERIVES_FROM` gives `cache` and `database-schema` no `database-reader`
135
- * parent, and there is no reader of a reader — so `orders.reader().cache(…)`
136
- * has always been illegal, but it type-checked and failed later at
137
- * `assertDerivations`. That is a long way round to learn that a read-only
138
- * endpoint cannot own a table something writes to.
139
- *
140
- * Omitting the three deriving methods rather than making them throw keeps the
141
- * failure where it costs least: the editor, on the line that wrote it.
142
- *
143
- * The result is deliberately not assignable back to `KyselyDatabase` — a
144
- * reader is not one, and anything that genuinely needs the writer should say
145
- * so.
146
- */
147
- export type ReadOnlyDatabase<DB, TName extends string> = Omit<KyselyDatabase<DB, TName>, 'reader' | 'cache' | 'schema'>;
148
- //#endregion
149
- //# sourceMappingURL=kysely.d.mts.map
1
+ import { a as closeDatabasePools, i as ReadOnlyDatabase, n as KyselyDatabaseOptions, r as PostgresRuntime, t as KyselyDatabase } from "../kysely-BGvpd_ZH.mjs";
2
+ export { KyselyDatabase, KyselyDatabaseOptions, PostgresRuntime, ReadOnlyDatabase, closeDatabasePools };
@@ -1,192 +1,2 @@
1
- import { Cache } from "../cache.mjs";
2
- import { DEFAULT_POSTGRES_VERSION, canonicalId, provideKey, serviceKey } from "@geekmidas/manifest";
3
- import { Kysely, PostgresDialect } from "kysely";
4
- import pg from "pg";
5
- //#region src/database/kysely.ts
6
- /**
7
- * `KyselyDatabase` — a declared Postgres database, typed by its schema.
8
- *
9
- * It declares a logical database, a schema, and the roles that reach it, and
10
- * hands back a Kysely client built from the one URL the adapter supplied. It
11
- * names no cloud: `--target=aws` fills that URL from RDS, local dev from the
12
- * Postgres container.
13
- *
14
- * Transactions and RLS context are the execution wrapper's job — it opens the
15
- * transaction and puts it in `ctx.db`. This construct does not resolve
16
- * connections per request.
17
- */
18
- /** The schema a database uses when it does not say otherwise. */
19
- const DEFAULT_SCHEMA = "app";
20
- /**
21
- * @typeParam DB - the database's schema.
22
- * @typeParam TName - the canonical id. TypeScript has no partial
23
- * type-argument inference, so `new KyselyDatabase<OrdersDB>('orders')` leaves
24
- * this at its default and the service key widens to `string`. `db` still types
25
- * through `.database()`, which infers from the service.
26
- */
27
- var KyselyDatabase = class KyselyDatabase {
28
- options;
29
- id;
30
- service;
31
- /**
32
- * Declared once and read by both `declare()` and `connect()`, so the key the
33
- * build publishes and the key the client reads cannot drift.
34
- */
35
- config;
36
- schemaName;
37
- roles;
38
- version;
39
- derivedFrom;
40
- constructor(id, options = {}, derivedFrom) {
41
- this.options = options;
42
- const canonical = canonicalId(id);
43
- this.id = canonical;
44
- this.config = {
45
- url: provideKey(canonical, "url"),
46
- ownerUrl: provideKey(canonical, "ownerUrl")
47
- };
48
- this.schemaName = options.schema ?? DEFAULT_SCHEMA;
49
- this.roles = options.roles ?? true;
50
- this.version = options.version ?? DEFAULT_POSTGRES_VERSION;
51
- this.derivedFrom = derivedFrom;
52
- this.service = {
53
- serviceName: serviceKey(canonical),
54
- register: (registerOptions) => this.connect(registerOptions)
55
- };
56
- }
57
- declare() {
58
- if (this.derivedFrom) {
59
- const { kind, of, schema } = this.derivedFrom;
60
- return [kind === "database-schema" ? {
61
- kind,
62
- id: this.id,
63
- of,
64
- schema: schema ?? this.schemaName,
65
- provides: [this.config.url]
66
- } : {
67
- kind,
68
- id: this.id,
69
- of,
70
- provides: [this.config.url]
71
- }];
72
- }
73
- return [{
74
- kind: "database",
75
- id: this.id,
76
- engine: "postgres",
77
- schema: this.schemaName,
78
- version: this.version,
79
- provides: [this.config.url],
80
- ...this.roles ? {} : { roles: false }
81
- }];
82
- }
83
- /**
84
- * A read-only endpoint on this database.
85
- *
86
- * Read-only is enforced by the reader role's grants rather than by which
87
- * endpoint it resolves to, so falling back to the writer where no replica
88
- * exists is safe rather than a silently writable connection behind a name
89
- * that says reader. There is no `writer()`: the database *is* the writer, so
90
- * a replica can never be reached by accident.
91
- *
92
- * The return type is narrower than this class on purpose — see
93
- * {@link ReadOnlyDatabase}.
94
- */
95
- reader() {
96
- return new KyselyDatabase(`${this.id}Reader`, this.options, {
97
- kind: "database-reader",
98
- of: this.id
99
- });
100
- }
101
- /**
102
- * A cache that lives in this database.
103
- *
104
- * The same strengthening `schema()` is over a second database: `new
105
- * Cache('Sessions')` says the app caches and leaves where to the deployment,
106
- * while this says it caches *here* — which is a fact about the application
107
- * and so belongs in its code.
108
- *
109
- * What it buys beyond being explicit: the table's schema and the role that
110
- * reaches it come from this database rather than from a second convention,
111
- * and the backend no longer has to guess which database "the database" meant
112
- * when an app declares two.
113
- *
114
- * A cache is not a `KyselyDatabase`, so this returns a `Cache` — the client
115
- * is a key/value store, not a query builder, and typing it as the parent
116
- * would be a convenience that lies.
117
- */
118
- cache(id = `${this.id}Cache`, options = {}) {
119
- return new Cache(id, {
120
- of: this.id,
121
- ...options.table ? { table: options.table } : {}
122
- });
123
- }
124
- /**
125
- * A second schema in this database, with its own role(s) and its own URL —
126
- * so this database's role holds no grant on those tables at all.
127
- *
128
- * Typed separately because a tenant has its own tables: the point is that
129
- * `auth.selectFrom('sessions')` type-checks and
130
- * `orders.selectFrom('sessions')` does not.
131
- */
132
- schema(id, options = {}) {
133
- return new KyselyDatabase(id, options, {
134
- kind: "database-schema",
135
- of: this.id,
136
- schema: options.schema ?? id.toLowerCase()
137
- });
138
- }
139
- /**
140
- * A connection as the *owner* role — the one that may create, alter and drop.
141
- *
142
- * A `Service` rather than part of the construct, and deliberately so: a
143
- * construct is what `.dependsOn()` accepts, and nothing should be able to
144
- * depend on this. A migrator asks for it by name; a handler cannot ask at
145
- * all, which is the security property the role split exists for.
146
- *
147
- * Falls back to the runtime URL where no owner URL was published — the
148
- * `roles: false` downgrade, where there is only one credential and it is the
149
- * cluster master's.
150
- */
151
- get owner() {
152
- return {
153
- serviceName: `${serviceKey(this.id)}Owner`,
154
- register: (options) => this.connect(options, { owner: true })
155
- };
156
- }
157
- async connect(options, as = {}) {
158
- const { url, ownerUrl } = options.envParser.create((get) => ({
159
- url: get(this.config.url).string(),
160
- ownerUrl: get(this.config.ownerUrl).string().optional()
161
- })).parse();
162
- const { schema: _schema, roles: _roles, ...kysely } = this.options;
163
- return new Kysely({
164
- ...kysely,
165
- dialect: new PostgresDialect({ pool: pool(as.owner ? ownerUrl ?? url : url) })
166
- });
167
- }
168
- };
169
- /**
170
- * A pool for one URL, with its schema actually on the search path.
171
- *
172
- * `?search_path=` is not a libpq parameter — a URL carrying it connects
173
- * happily and then resolves every unqualified name against `public`, which is
174
- * how a schema tenant silently writes its tables into the database it was
175
- * separated from. Postgres takes it as a startup option instead, so the URL
176
- * keeps the readable form the target derives and this turns it into the thing
177
- * the server understands.
178
- */
179
- function pool(url) {
180
- const parsed = new URL(url);
181
- const searchPath = parsed.searchParams.get("search_path");
182
- if (!searchPath) return new pg.Pool({ connectionString: url });
183
- parsed.searchParams.delete("search_path");
184
- return new pg.Pool({
185
- connectionString: parsed.toString(),
186
- options: `-c search_path=${searchPath}`
187
- });
188
- }
189
- //#endregion
190
- export { KyselyDatabase };
191
-
192
- //# sourceMappingURL=kysely.mjs.map
1
+ import { n as closeDatabasePools, t as KyselyDatabase } from "../kysely-Bc9xzaik.mjs";
2
+ export { KyselyDatabase, closeDatabasePools };
package/dist/email.cjs CHANGED
@@ -1,20 +1,23 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_optionalPeers = require("./optionalPeers-DuNQXXe1.cjs");
2
3
  let _geekmidas_manifest = require("@geekmidas/manifest");
3
- let _geekmidas_emailkit = require("@geekmidas/emailkit");
4
4
  //#region src/email.ts
5
5
  /**
6
- * `Email` — declared outbound mail.
7
- *
8
- * The same three-package meeting point as `ObjectStorage`: it implements the
9
- * construct contract, derives its env key through `@geekmidas/manifest`, and
10
- * hands back an `@geekmidas/emailkit` client. It names no provider — locally the
11
- * injected URL points at Mailpit, deployed it points at SES or whichever service
12
- * config selected.
13
- *
14
- * Where object storage needs a driver per provider, this needs none: mail is
15
- * delivered over SMTP whoever delivers it, so there is one client and one URL
16
- * shape, and the provider survives only as a host and a credential.
6
+ * The address-shaped characters a local part may hold: the dot-atom of RFC
7
+ * 5322, which is every sender anyone sends from.
17
8
  */
9
+ const LOCAL_PART = /^[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*$/;
10
+ /** An `Email`'s `from` that is not a bare local part. */
11
+ var EmailFromNotALocalPart = class extends Error {
12
+ id;
13
+ from;
14
+ constructor(id, from) {
15
+ super(from.includes("@") ? `Email '${id}' has from: '${from}', a whole address. 'from' is the local part only — from: '${from.slice(0, from.lastIndexOf("@"))}' sends as that @ the stage's domain. A whole address for one stage is deploy.email.<stage>.from.` : `Email '${id}' has from: '${from}', which is not a mail local part. Set it to what goes before the @, like 'info' or 'noreply'.`);
16
+ this.id = id;
17
+ this.from = from;
18
+ this.name = "EmailFromNotALocalPart";
19
+ }
20
+ };
18
21
  var Email = class {
19
22
  options;
20
23
  id;
@@ -27,10 +30,11 @@ var Email = class {
27
30
  constructor(id, options) {
28
31
  this.options = options;
29
32
  const canonical = (0, _geekmidas_manifest.canonicalId)(id);
33
+ if (options.from !== void 0 && !LOCAL_PART.test(options.from)) throw new EmailFromNotALocalPart(canonical, options.from);
30
34
  this.id = canonical;
31
35
  this.keys = {
32
- url: (0, _geekmidas_manifest.provideKey)(canonical, "url"),
33
- from: (0, _geekmidas_manifest.provideKey)(canonical, "from")
36
+ url: (0, _geekmidas_manifest.providedKeyFor)(canonical, "email", "url"),
37
+ from: (0, _geekmidas_manifest.providedKeyFor)(canonical, "email", "from")
34
38
  };
35
39
  this.service = {
36
40
  serviceName: (0, _geekmidas_manifest.serviceKey)(canonical),
@@ -41,7 +45,8 @@ var Email = class {
41
45
  return [{
42
46
  kind: "email",
43
47
  id: this.id,
44
- provides: [this.keys.url, this.keys.from]
48
+ provides: [this.keys.url, this.keys.from],
49
+ ...this.options.from ? { from: this.options.from } : {}
45
50
  }];
46
51
  }
47
52
  /**
@@ -56,8 +61,9 @@ var Email = class {
56
61
  url: get(this.keys.url).string(),
57
62
  from: get(this.keys.from).string()
58
63
  })).parse();
59
- return (0, _geekmidas_emailkit.createEmailClient)({
60
- smtp: (0, _geekmidas_emailkit.parseEmailUrl)(url),
64
+ const { createEmailClient, parseEmailUrl } = await require_optionalPeers.loadEmailkit();
65
+ return createEmailClient({
66
+ smtp: parseEmailUrl(url),
61
67
  templates: this.options.templates,
62
68
  defaults: {
63
69
  from,
@@ -68,5 +74,6 @@ var Email = class {
68
74
  };
69
75
  //#endregion
70
76
  exports.Email = Email;
77
+ exports.EmailFromNotALocalPart = EmailFromNotALocalPart;
71
78
 
72
79
  //# sourceMappingURL=email.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"email.cjs","names":["canonicalId","provideKey","serviceKey","createEmailClient","parseEmailUrl"],"sources":["../src/email.ts"],"sourcesContent":["/**\n * `Email` — declared outbound mail.\n *\n * The same three-package meeting point as `ObjectStorage`: it implements the\n * construct contract, derives its env key through `@geekmidas/manifest`, and\n * hands back an `@geekmidas/emailkit` client. It names no provider — locally the\n * injected URL points at Mailpit, deployed it points at SES or whichever service\n * config selected.\n *\n * Where object storage needs a driver per provider, this needs none: mail is\n * delivered over SMTP whoever delivers it, so there is one client and one URL\n * shape, and the provider survives only as a host and a credential.\n */\n\nimport {\n\tcreateEmailClient,\n\ttype EmailClient,\n\tparseEmailUrl,\n\ttype TemplateRecord,\n} from '@geekmidas/emailkit';\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\tprovideKey,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport type { Service, ServiceRegisterOptions } from '@geekmidas/services';\nimport type { Construct } from './construct-interface';\n\nexport interface EmailOptions<TTemplates extends TemplateRecord> {\n\t/**\n\t * The React templates this app can send.\n\t *\n\t * Structural — they are code, they ship with the handler, and which ones\n\t * exist cannot differ between stages. They are also what types\n\t * `sendTemplate`, so passing them here is what makes the client's call sites\n\t * checkable.\n\t */\n\ttemplates: TTemplates;\n\t/**\n\t * A reply-to address for every send.\n\t *\n\t * `from` is deliberately absent: it belongs to the verified sending domain,\n\t * which is `myapp.test` locally and the real domain deployed, so it arrives\n\t * as stage config rather than being written here.\n\t */\n\treplyTo?: string;\n}\n\nexport class Email<\n\tTName extends string = string,\n\tTTemplates extends TemplateRecord = TemplateRecord,\n> implements Construct<TName, EmailClient<TTemplates>>\n{\n\treadonly id: TName;\n\treadonly service: Service<Uncapitalize<TName>, EmailClient<TTemplates>>;\n\n\t/**\n\t * Declared once and read by both `declare()` and `connect()`, so the key the\n\t * build publishes and the key the client reads cannot drift.\n\t */\n\tprivate readonly keys: { url: string; from: string };\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly options: EmailOptions<TTemplates>,\n\t) {\n\t\tconst canonical = canonicalId(id as string);\n\n\t\tthis.id = canonical as TName;\n\t\tthis.keys = {\n\t\t\turl: provideKey(canonical, 'url'),\n\t\t\t// The sending identity travels with the URL rather than being a second\n\t\t\t// construct option, for the same reason the URL does: it is the one\n\t\t\t// thing about mail that differs per stage.\n\t\t\tfrom: provideKey(canonical, 'from'),\n\t\t};\n\n\t\t// A field, not a getter: consumers cache services by object identity.\n\t\tthis.service = {\n\t\t\tserviceName: serviceKey(canonical) as Uncapitalize<TName>,\n\t\t\tregister: (options) => this.connect(options),\n\t\t};\n\t}\n\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'email',\n\t\t\t\tid: this.id,\n\t\t\t\tprovides: [this.keys.url, this.keys.from],\n\t\t\t},\n\t\t];\n\t}\n\n\t/**\n\t * Builds the client from the URL the adapter supplied.\n\t *\n\t * No provider branch and no driver lookup — `parseEmailUrl` turns any of\n\t * Mailpit, SES, or Resend into the same transport config, which is the whole\n\t * reason the scheme is always `smtp://`.\n\t */\n\tprivate async connect({\n\t\tenvParser,\n\t}: ServiceRegisterOptions): Promise<EmailClient<TTemplates>> {\n\t\tconst { url, from } = envParser\n\t\t\t.create((get) => ({\n\t\t\t\turl: get(this.keys.url).string(),\n\t\t\t\tfrom: get(this.keys.from).string(),\n\t\t\t}))\n\t\t\t.parse();\n\n\t\treturn createEmailClient({\n\t\t\tsmtp: parseEmailUrl(url),\n\t\t\ttemplates: this.options.templates,\n\t\t\tdefaults: {\n\t\t\t\tfrom,\n\t\t\t\t...(this.options.replyTo ? { replyTo: this.options.replyTo } : {}),\n\t\t\t},\n\t\t});\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAkDA,IAAa,QAAb,MAIA;CAYmB;CAXlB;CACA;;;;;CAMA;CAEA,YACC,IACA,SACC;EADgB,KAAA,UAAA;EAEjB,MAAM,aAAA,GAAYA,oBAAAA,YAAAA,CAAY,EAAY;EAE1C,KAAK,KAAK;EACV,KAAK,OAAO;GACX,MAAA,GAAKC,oBAAAA,WAAAA,CAAW,WAAW,KAAK;GAIhC,OAAA,GAAMA,oBAAAA,WAAAA,CAAW,WAAW,MAAM;EACnC;EAGA,KAAK,UAAU;GACd,cAAA,GAAaC,oBAAAA,WAAAA,CAAW,SAAS;GACjC,WAAW,YAAY,KAAK,QAAQ,OAAO;EAC5C;CACD;CAEA,UAAyB;EACxB,OAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,UAAU,CAAC,KAAK,KAAK,KAAK,KAAK,KAAK,IAAI;EACzC,CACD;CACD;;;;;;;;CASA,MAAc,QAAQ,EACrB,aAC4D;EAC5D,MAAM,EAAE,KAAK,SAAS,UACpB,QAAQ,SAAS;GACjB,KAAK,IAAI,KAAK,KAAK,GAAG,CAAC,CAAC,OAAO;GAC/B,MAAM,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,OAAO;EAClC,EAAE,CAAC,CACF,MAAM;EAER,QAAA,GAAOC,oBAAAA,kBAAAA,CAAkB;GACxB,OAAA,GAAMC,oBAAAA,cAAAA,CAAc,GAAG;GACvB,WAAW,KAAK,QAAQ;GACxB,UAAU;IACT;IACA,GAAI,KAAK,QAAQ,UAAU,EAAE,SAAS,KAAK,QAAQ,QAAQ,IAAI,CAAC;GACjE;EACD,CAAC;CACF;AACD"}
1
+ {"version":3,"file":"email.cjs","names":["canonicalId","providedKeyFor","serviceKey","loadEmailkit"],"sources":["../src/email.ts"],"sourcesContent":["/**\n * `Email` — declared outbound mail.\n *\n * The same three-package meeting point as `ObjectStorage`: it implements the\n * construct contract, derives its env key through `@geekmidas/manifest`, and\n * hands back an `@geekmidas/emailkit` client. It names no provider — locally the\n * injected URL points at Mailpit, deployed it points at SES or whichever service\n * config selected.\n *\n * Where object storage needs a driver per provider, this needs none: mail is\n * delivered over SMTP whoever delivers it, so there is one client and one URL\n * shape, and the provider survives only as a host and a credential.\n */\n\nimport type { EmailClient, TemplateRecord } from '@geekmidas/emailkit';\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\tprovidedKeyFor,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport type { Service, ServiceRegisterOptions } from '@geekmidas/services';\nimport type { Construct } from './construct-interface';\nimport { loadEmailkit } from './optionalPeers';\n\nexport interface EmailOptions<TTemplates extends TemplateRecord> {\n\t/**\n\t * The React templates this app can send.\n\t *\n\t * Structural — they are code, they ship with the handler, and which ones\n\t * exist cannot differ between stages. They are also what types\n\t * `sendTemplate`, so passing them here is what makes the client's call sites\n\t * checkable.\n\t */\n\ttemplates: TTemplates;\n\t/**\n\t * The local part mail is sent from — `'info'` sends as `info@` the stage's\n\t * domain (`info@localhost` under `gkm dev`). Defaults to `noreply`.\n\t *\n\t * Only the local part: it is structural, the same on every stage, and the\n\t * templates' copy is written for it. The domain is the stage's, so a stage\n\t * whose domain changes sends from the new one. A whole address for one\n\t * stage is `deploy.email.<stage>.from`, which wins over this.\n\t */\n\tfrom?: string;\n\t/** A reply-to address for every send. */\n\treplyTo?: string;\n}\n\n/**\n * The address-shaped characters a local part may hold: the dot-atom of RFC\n * 5322, which is every sender anyone sends from.\n */\nconst LOCAL_PART =\n\t/^[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(\\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*$/;\n\n/** An `Email`'s `from` that is not a bare local part. */\nexport class EmailFromNotALocalPart extends Error {\n\tconstructor(\n\t\treadonly id: string,\n\t\treadonly from: string,\n\t) {\n\t\tsuper(\n\t\t\tfrom.includes('@')\n\t\t\t\t? `Email '${id}' has from: '${from}', a whole address. 'from' is the local part only — from: '${from.slice(0, from.lastIndexOf('@'))}' sends as that @ the stage's domain. A whole address for one stage is deploy.email.<stage>.from.`\n\t\t\t\t: `Email '${id}' has from: '${from}', which is not a mail local part. Set it to what goes before the @, like 'info' or 'noreply'.`,\n\t\t);\n\t\tthis.name = 'EmailFromNotALocalPart';\n\t}\n}\n\nexport class Email<\n\tTName extends string = string,\n\tTTemplates extends TemplateRecord = TemplateRecord,\n> implements Construct<TName, EmailClient<TTemplates>>\n{\n\treadonly id: TName;\n\treadonly service: Service<Uncapitalize<TName>, EmailClient<TTemplates>>;\n\n\t/**\n\t * Declared once and read by both `declare()` and `connect()`, so the key the\n\t * build publishes and the key the client reads cannot drift.\n\t */\n\tprivate readonly keys: { url: string; from: string };\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly options: EmailOptions<TTemplates>,\n\t) {\n\t\tconst canonical = canonicalId(id as string);\n\t\tif (options.from !== undefined && !LOCAL_PART.test(options.from)) {\n\t\t\tthrow new EmailFromNotALocalPart(canonical, options.from);\n\t\t}\n\n\t\tthis.id = canonical as TName;\n\t\tthis.keys = {\n\t\t\turl: providedKeyFor(canonical, 'email', 'url'),\n\t\t\t// The whole address arrives with the URL: its domain is the stage's,\n\t\t\t// so only the local part (`options.from`) is written here.\n\t\t\tfrom: providedKeyFor(canonical, 'email', 'from'),\n\t\t};\n\n\t\t// A field, not a getter: consumers cache services by object identity.\n\t\tthis.service = {\n\t\t\tserviceName: serviceKey(canonical) as Uncapitalize<TName>,\n\t\t\tregister: (options) => this.connect(options),\n\t\t};\n\t}\n\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'email',\n\t\t\t\tid: this.id,\n\t\t\t\tprovides: [this.keys.url, this.keys.from],\n\t\t\t\t...(this.options.from ? { from: this.options.from } : {}),\n\t\t\t},\n\t\t];\n\t}\n\n\t/**\n\t * Builds the client from the URL the adapter supplied.\n\t *\n\t * No provider branch and no driver lookup — `parseEmailUrl` turns any of\n\t * Mailpit, SES, or Resend into the same transport config, which is the whole\n\t * reason the scheme is always `smtp://`.\n\t */\n\tprivate async connect({\n\t\tenvParser,\n\t}: ServiceRegisterOptions): Promise<EmailClient<TTemplates>> {\n\t\tconst { url, from } = envParser\n\t\t\t.create((get) => ({\n\t\t\t\turl: get(this.keys.url).string(),\n\t\t\t\tfrom: get(this.keys.from).string(),\n\t\t\t}))\n\t\t\t.parse();\n\n\t\t// Loaded here, not at the top: the test harness names this construct in\n\t\t// every app, and an app that sends no mail does not install emailkit.\n\t\tconst { createEmailClient, parseEmailUrl } = await loadEmailkit();\n\t\treturn createEmailClient({\n\t\t\tsmtp: parseEmailUrl(url),\n\t\t\ttemplates: this.options.templates,\n\t\t\tdefaults: {\n\t\t\t\tfrom,\n\t\t\t\t...(this.options.replyTo ? { replyTo: this.options.replyTo } : {}),\n\t\t\t},\n\t\t});\n\t}\n}\n"],"mappings":";;;;;;;;AAsDA,MAAM,aACL;;AAGD,IAAa,yBAAb,cAA4C,MAAM;CAEvC;CACA;CAFV,YACC,IACA,MACC;EACD,MACC,KAAK,SAAS,GAAG,IACd,UAAU,GAAG,eAAe,KAAK,6DAA6D,KAAK,MAAM,GAAG,KAAK,YAAY,GAAG,CAAC,EAAE,qGACnI,UAAU,GAAG,eAAe,KAAK,+FACrC;EAPS,KAAA,KAAA;EACA,KAAA,OAAA;EAOT,KAAK,OAAO;CACb;AACD;AAEA,IAAa,QAAb,MAIA;CAYmB;CAXlB;CACA;;;;;CAMA;CAEA,YACC,IACA,SACC;EADgB,KAAA,UAAA;EAEjB,MAAM,aAAA,GAAYA,oBAAAA,YAAAA,CAAY,EAAY;EAC1C,IAAI,QAAQ,SAAS,KAAA,KAAa,CAAC,WAAW,KAAK,QAAQ,IAAI,GAC9D,MAAM,IAAI,uBAAuB,WAAW,QAAQ,IAAI;EAGzD,KAAK,KAAK;EACV,KAAK,OAAO;GACX,MAAA,GAAKC,oBAAAA,eAAAA,CAAe,WAAW,SAAS,KAAK;GAG7C,OAAA,GAAMA,oBAAAA,eAAAA,CAAe,WAAW,SAAS,MAAM;EAChD;EAGA,KAAK,UAAU;GACd,cAAA,GAAaC,oBAAAA,WAAAA,CAAW,SAAS;GACjC,WAAW,YAAY,KAAK,QAAQ,OAAO;EAC5C;CACD;CAEA,UAAyB;EACxB,OAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,UAAU,CAAC,KAAK,KAAK,KAAK,KAAK,KAAK,IAAI;GACxC,GAAI,KAAK,QAAQ,OAAO,EAAE,MAAM,KAAK,QAAQ,KAAK,IAAI,CAAC;EACxD,CACD;CACD;;;;;;;;CASA,MAAc,QAAQ,EACrB,aAC4D;EAC5D,MAAM,EAAE,KAAK,SAAS,UACpB,QAAQ,SAAS;GACjB,KAAK,IAAI,KAAK,KAAK,GAAG,CAAC,CAAC,OAAO;GAC/B,MAAM,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,OAAO;EAClC,EAAE,CAAC,CACF,MAAM;EAIR,MAAM,EAAE,mBAAmB,kBAAkB,MAAMC,sBAAAA,aAAa;EAChE,OAAO,kBAAkB;GACxB,MAAM,cAAc,GAAG;GACvB,WAAW,KAAK,QAAQ;GACxB,UAAU;IACT;IACA,GAAI,KAAK,QAAQ,UAAU,EAAE,SAAS,KAAK,QAAQ,QAAQ,IAAI,CAAC;GACjE;EACD,CAAC;CACF;AACD"}
package/dist/email.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { t as Construct } from "./construct-interface-DgXTJcOD.cjs";
1
+ import { n as Construct } from "./construct-interface-DhbaONW2.cjs";
2
2
  import { Service } from "@geekmidas/services";
3
3
  import { ConstructName, Declaration } from "@geekmidas/manifest";
4
4
  import { EmailClient, TemplateRecord } from "@geekmidas/emailkit";
@@ -14,14 +14,24 @@ export interface EmailOptions<TTemplates extends TemplateRecord> {
14
14
  */
15
15
  templates: TTemplates;
16
16
  /**
17
- * A reply-to address for every send.
17
+ * The local part mail is sent from — `'info'` sends as `info@` the stage's
18
+ * domain (`info@localhost` under `gkm dev`). Defaults to `noreply`.
18
19
  *
19
- * `from` is deliberately absent: it belongs to the verified sending domain,
20
- * which is `myapp.test` locally and the real domain deployed, so it arrives
21
- * as stage config rather than being written here.
20
+ * Only the local part: it is structural, the same on every stage, and the
21
+ * templates' copy is written for it. The domain is the stage's, so a stage
22
+ * whose domain changes sends from the new one. A whole address for one
23
+ * stage is `deploy.email.<stage>.from`, which wins over this.
22
24
  */
25
+ from?: string;
26
+ /** A reply-to address for every send. */
23
27
  replyTo?: string;
24
28
  }
29
+ /** An `Email`'s `from` that is not a bare local part. */
30
+ export declare class EmailFromNotALocalPart extends Error {
31
+ readonly id: string;
32
+ readonly from: string;
33
+ constructor(id: string, from: string);
34
+ }
25
35
  export declare class Email<TName extends string = string, TTemplates extends TemplateRecord = TemplateRecord> implements Construct<TName, EmailClient<TTemplates>> {
26
36
  private readonly options;
27
37
  readonly id: TName;
@@ -1 +1 @@
1
- {"version":3,"file":"email.d.cts","names":[],"sources":["../src/email.ts"],"mappings":";;;;;iBA8BiB,aAAa,mBAAmB;;;;;;;;;EAShD,WAAW;;;;;;;;EAQX;;qBAGY,MACZ,+BACA,mBAAmB,iBAAiB,2BACxB,UAAU,OAAO,YAAY;mBAavB;WAXT,IAAI;WACJ,SAAS,QAAQ,aAAa,QAAQ,YAAY;;;;;mBAM1C;EAEjB,YACC,IAAI,cAAc,QACD,SAAS,aAAa;EAoBxC,WAAW;;;;;;;;UAiBG"}
1
+ {"version":3,"file":"email.d.cts","names":[],"sources":["../src/email.ts"],"mappings":";;;;;iBA0BiB,aAAa,mBAAmB;;;;;;;;;EAShD,WAAW;;;;;;;;;;EAUX;;EAEA;;;qBAWY,+BAA+B;WAEjC;WACA;EAFV,YACU,YACA;;qBAWE,MACZ,+BACA,mBAAmB,iBAAiB,2BACxB,UAAU,OAAO,YAAY;mBAavB;WAXT,IAAI;WACJ,SAAS,QAAQ,aAAa,QAAQ,YAAY;;;;;mBAM1C;EAEjB,YACC,IAAI,cAAc,QACD,SAAS,aAAa;EAsBxC,WAAW;;;;;;;;UAkBG"}
package/dist/email.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import { t as Construct } from "./construct-interface-DPlxfpoS.mjs";
1
+ import { n as Construct } from "./construct-interface-DxfkFxkl.mjs";
2
2
  import { ConstructName, Declaration } from "@geekmidas/manifest";
3
- import { EmailClient, TemplateRecord } from "@geekmidas/emailkit";
4
3
  import { Service } from "@geekmidas/services";
4
+ import { EmailClient, TemplateRecord } from "@geekmidas/emailkit";
5
5
  //#region src/email.d.ts
6
6
  export interface EmailOptions<TTemplates extends TemplateRecord> {
7
7
  /**
@@ -14,14 +14,24 @@ export interface EmailOptions<TTemplates extends TemplateRecord> {
14
14
  */
15
15
  templates: TTemplates;
16
16
  /**
17
- * A reply-to address for every send.
17
+ * The local part mail is sent from — `'info'` sends as `info@` the stage's
18
+ * domain (`info@localhost` under `gkm dev`). Defaults to `noreply`.
18
19
  *
19
- * `from` is deliberately absent: it belongs to the verified sending domain,
20
- * which is `myapp.test` locally and the real domain deployed, so it arrives
21
- * as stage config rather than being written here.
20
+ * Only the local part: it is structural, the same on every stage, and the
21
+ * templates' copy is written for it. The domain is the stage's, so a stage
22
+ * whose domain changes sends from the new one. A whole address for one
23
+ * stage is `deploy.email.<stage>.from`, which wins over this.
22
24
  */
25
+ from?: string;
26
+ /** A reply-to address for every send. */
23
27
  replyTo?: string;
24
28
  }
29
+ /** An `Email`'s `from` that is not a bare local part. */
30
+ export declare class EmailFromNotALocalPart extends Error {
31
+ readonly id: string;
32
+ readonly from: string;
33
+ constructor(id: string, from: string);
34
+ }
25
35
  export declare class Email<TName extends string = string, TTemplates extends TemplateRecord = TemplateRecord> implements Construct<TName, EmailClient<TTemplates>> {
26
36
  private readonly options;
27
37
  readonly id: TName;
@@ -1 +1 @@
1
- {"version":3,"file":"email.d.mts","names":[],"sources":["../src/email.ts"],"mappings":";;;;;iBA8BiB,aAAa,mBAAmB;;;;;;;;;EAShD,WAAW;;;;;;;;EAQX;;qBAGY,MACZ,+BACA,mBAAmB,iBAAiB,2BACxB,UAAU,OAAO,YAAY;mBAavB;WAXT,IAAI;WACJ,SAAS,QAAQ,aAAa,QAAQ,YAAY;;;;;mBAM1C;EAEjB,YACC,IAAI,cAAc,QACD,SAAS,aAAa;EAoBxC,WAAW;;;;;;;;UAiBG"}
1
+ {"version":3,"file":"email.d.mts","names":[],"sources":["../src/email.ts"],"mappings":";;;;;iBA0BiB,aAAa,mBAAmB;;;;;;;;;EAShD,WAAW;;;;;;;;;;EAUX;;EAEA;;;qBAWY,+BAA+B;WAEjC;WACA;EAFV,YACU,YACA;;qBAWE,MACZ,+BACA,mBAAmB,iBAAiB,2BACxB,UAAU,OAAO,YAAY;mBAavB;WAXT,IAAI;WACJ,SAAS,QAAQ,aAAa,QAAQ,YAAY;;;;;mBAM1C;EAEjB,YACC,IAAI,cAAc,QACD,SAAS,aAAa;EAsBxC,WAAW;;;;;;;;UAkBG"}
package/dist/email.mjs CHANGED
@@ -1,19 +1,22 @@
1
- import { canonicalId, provideKey, serviceKey } from "@geekmidas/manifest";
2
- import { createEmailClient, parseEmailUrl } from "@geekmidas/emailkit";
1
+ import { s as loadEmailkit } from "./optionalPeers-D7Wt6dnF.mjs";
2
+ import { canonicalId, providedKeyFor, serviceKey } from "@geekmidas/manifest";
3
3
  //#region src/email.ts
4
4
  /**
5
- * `Email` — declared outbound mail.
6
- *
7
- * The same three-package meeting point as `ObjectStorage`: it implements the
8
- * construct contract, derives its env key through `@geekmidas/manifest`, and
9
- * hands back an `@geekmidas/emailkit` client. It names no provider — locally the
10
- * injected URL points at Mailpit, deployed it points at SES or whichever service
11
- * config selected.
12
- *
13
- * Where object storage needs a driver per provider, this needs none: mail is
14
- * delivered over SMTP whoever delivers it, so there is one client and one URL
15
- * shape, and the provider survives only as a host and a credential.
5
+ * The address-shaped characters a local part may hold: the dot-atom of RFC
6
+ * 5322, which is every sender anyone sends from.
16
7
  */
8
+ const LOCAL_PART = /^[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*$/;
9
+ /** An `Email`'s `from` that is not a bare local part. */
10
+ var EmailFromNotALocalPart = class extends Error {
11
+ id;
12
+ from;
13
+ constructor(id, from) {
14
+ super(from.includes("@") ? `Email '${id}' has from: '${from}', a whole address. 'from' is the local part only — from: '${from.slice(0, from.lastIndexOf("@"))}' sends as that @ the stage's domain. A whole address for one stage is deploy.email.<stage>.from.` : `Email '${id}' has from: '${from}', which is not a mail local part. Set it to what goes before the @, like 'info' or 'noreply'.`);
15
+ this.id = id;
16
+ this.from = from;
17
+ this.name = "EmailFromNotALocalPart";
18
+ }
19
+ };
17
20
  var Email = class {
18
21
  options;
19
22
  id;
@@ -26,10 +29,11 @@ var Email = class {
26
29
  constructor(id, options) {
27
30
  this.options = options;
28
31
  const canonical = canonicalId(id);
32
+ if (options.from !== void 0 && !LOCAL_PART.test(options.from)) throw new EmailFromNotALocalPart(canonical, options.from);
29
33
  this.id = canonical;
30
34
  this.keys = {
31
- url: provideKey(canonical, "url"),
32
- from: provideKey(canonical, "from")
35
+ url: providedKeyFor(canonical, "email", "url"),
36
+ from: providedKeyFor(canonical, "email", "from")
33
37
  };
34
38
  this.service = {
35
39
  serviceName: serviceKey(canonical),
@@ -40,7 +44,8 @@ var Email = class {
40
44
  return [{
41
45
  kind: "email",
42
46
  id: this.id,
43
- provides: [this.keys.url, this.keys.from]
47
+ provides: [this.keys.url, this.keys.from],
48
+ ...this.options.from ? { from: this.options.from } : {}
44
49
  }];
45
50
  }
46
51
  /**
@@ -55,6 +60,7 @@ var Email = class {
55
60
  url: get(this.keys.url).string(),
56
61
  from: get(this.keys.from).string()
57
62
  })).parse();
63
+ const { createEmailClient, parseEmailUrl } = await loadEmailkit();
58
64
  return createEmailClient({
59
65
  smtp: parseEmailUrl(url),
60
66
  templates: this.options.templates,
@@ -66,6 +72,6 @@ var Email = class {
66
72
  }
67
73
  };
68
74
  //#endregion
69
- export { Email };
75
+ export { Email, EmailFromNotALocalPart };
70
76
 
71
77
  //# sourceMappingURL=email.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"email.mjs","names":[],"sources":["../src/email.ts"],"sourcesContent":["/**\n * `Email` — declared outbound mail.\n *\n * The same three-package meeting point as `ObjectStorage`: it implements the\n * construct contract, derives its env key through `@geekmidas/manifest`, and\n * hands back an `@geekmidas/emailkit` client. It names no provider — locally the\n * injected URL points at Mailpit, deployed it points at SES or whichever service\n * config selected.\n *\n * Where object storage needs a driver per provider, this needs none: mail is\n * delivered over SMTP whoever delivers it, so there is one client and one URL\n * shape, and the provider survives only as a host and a credential.\n */\n\nimport {\n\tcreateEmailClient,\n\ttype EmailClient,\n\tparseEmailUrl,\n\ttype TemplateRecord,\n} from '@geekmidas/emailkit';\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\tprovideKey,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport type { Service, ServiceRegisterOptions } from '@geekmidas/services';\nimport type { Construct } from './construct-interface';\n\nexport interface EmailOptions<TTemplates extends TemplateRecord> {\n\t/**\n\t * The React templates this app can send.\n\t *\n\t * Structural — they are code, they ship with the handler, and which ones\n\t * exist cannot differ between stages. They are also what types\n\t * `sendTemplate`, so passing them here is what makes the client's call sites\n\t * checkable.\n\t */\n\ttemplates: TTemplates;\n\t/**\n\t * A reply-to address for every send.\n\t *\n\t * `from` is deliberately absent: it belongs to the verified sending domain,\n\t * which is `myapp.test` locally and the real domain deployed, so it arrives\n\t * as stage config rather than being written here.\n\t */\n\treplyTo?: string;\n}\n\nexport class Email<\n\tTName extends string = string,\n\tTTemplates extends TemplateRecord = TemplateRecord,\n> implements Construct<TName, EmailClient<TTemplates>>\n{\n\treadonly id: TName;\n\treadonly service: Service<Uncapitalize<TName>, EmailClient<TTemplates>>;\n\n\t/**\n\t * Declared once and read by both `declare()` and `connect()`, so the key the\n\t * build publishes and the key the client reads cannot drift.\n\t */\n\tprivate readonly keys: { url: string; from: string };\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly options: EmailOptions<TTemplates>,\n\t) {\n\t\tconst canonical = canonicalId(id as string);\n\n\t\tthis.id = canonical as TName;\n\t\tthis.keys = {\n\t\t\turl: provideKey(canonical, 'url'),\n\t\t\t// The sending identity travels with the URL rather than being a second\n\t\t\t// construct option, for the same reason the URL does: it is the one\n\t\t\t// thing about mail that differs per stage.\n\t\t\tfrom: provideKey(canonical, 'from'),\n\t\t};\n\n\t\t// A field, not a getter: consumers cache services by object identity.\n\t\tthis.service = {\n\t\t\tserviceName: serviceKey(canonical) as Uncapitalize<TName>,\n\t\t\tregister: (options) => this.connect(options),\n\t\t};\n\t}\n\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'email',\n\t\t\t\tid: this.id,\n\t\t\t\tprovides: [this.keys.url, this.keys.from],\n\t\t\t},\n\t\t];\n\t}\n\n\t/**\n\t * Builds the client from the URL the adapter supplied.\n\t *\n\t * No provider branch and no driver lookup — `parseEmailUrl` turns any of\n\t * Mailpit, SES, or Resend into the same transport config, which is the whole\n\t * reason the scheme is always `smtp://`.\n\t */\n\tprivate async connect({\n\t\tenvParser,\n\t}: ServiceRegisterOptions): Promise<EmailClient<TTemplates>> {\n\t\tconst { url, from } = envParser\n\t\t\t.create((get) => ({\n\t\t\t\turl: get(this.keys.url).string(),\n\t\t\t\tfrom: get(this.keys.from).string(),\n\t\t\t}))\n\t\t\t.parse();\n\n\t\treturn createEmailClient({\n\t\t\tsmtp: parseEmailUrl(url),\n\t\t\ttemplates: this.options.templates,\n\t\t\tdefaults: {\n\t\t\t\tfrom,\n\t\t\t\t...(this.options.replyTo ? { replyTo: this.options.replyTo } : {}),\n\t\t\t},\n\t\t});\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAkDA,IAAa,QAAb,MAIA;CAYmB;CAXlB;CACA;;;;;CAMA;CAEA,YACC,IACA,SACC;EADgB,KAAA,UAAA;EAEjB,MAAM,YAAY,YAAY,EAAY;EAE1C,KAAK,KAAK;EACV,KAAK,OAAO;GACX,KAAK,WAAW,WAAW,KAAK;GAIhC,MAAM,WAAW,WAAW,MAAM;EACnC;EAGA,KAAK,UAAU;GACd,aAAa,WAAW,SAAS;GACjC,WAAW,YAAY,KAAK,QAAQ,OAAO;EAC5C;CACD;CAEA,UAAyB;EACxB,OAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,UAAU,CAAC,KAAK,KAAK,KAAK,KAAK,KAAK,IAAI;EACzC,CACD;CACD;;;;;;;;CASA,MAAc,QAAQ,EACrB,aAC4D;EAC5D,MAAM,EAAE,KAAK,SAAS,UACpB,QAAQ,SAAS;GACjB,KAAK,IAAI,KAAK,KAAK,GAAG,CAAC,CAAC,OAAO;GAC/B,MAAM,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,OAAO;EAClC,EAAE,CAAC,CACF,MAAM;EAER,OAAO,kBAAkB;GACxB,MAAM,cAAc,GAAG;GACvB,WAAW,KAAK,QAAQ;GACxB,UAAU;IACT;IACA,GAAI,KAAK,QAAQ,UAAU,EAAE,SAAS,KAAK,QAAQ,QAAQ,IAAI,CAAC;GACjE;EACD,CAAC;CACF;AACD"}
1
+ {"version":3,"file":"email.mjs","names":[],"sources":["../src/email.ts"],"sourcesContent":["/**\n * `Email` — declared outbound mail.\n *\n * The same three-package meeting point as `ObjectStorage`: it implements the\n * construct contract, derives its env key through `@geekmidas/manifest`, and\n * hands back an `@geekmidas/emailkit` client. It names no provider — locally the\n * injected URL points at Mailpit, deployed it points at SES or whichever service\n * config selected.\n *\n * Where object storage needs a driver per provider, this needs none: mail is\n * delivered over SMTP whoever delivers it, so there is one client and one URL\n * shape, and the provider survives only as a host and a credential.\n */\n\nimport type { EmailClient, TemplateRecord } from '@geekmidas/emailkit';\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\tprovidedKeyFor,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport type { Service, ServiceRegisterOptions } from '@geekmidas/services';\nimport type { Construct } from './construct-interface';\nimport { loadEmailkit } from './optionalPeers';\n\nexport interface EmailOptions<TTemplates extends TemplateRecord> {\n\t/**\n\t * The React templates this app can send.\n\t *\n\t * Structural — they are code, they ship with the handler, and which ones\n\t * exist cannot differ between stages. They are also what types\n\t * `sendTemplate`, so passing them here is what makes the client's call sites\n\t * checkable.\n\t */\n\ttemplates: TTemplates;\n\t/**\n\t * The local part mail is sent from — `'info'` sends as `info@` the stage's\n\t * domain (`info@localhost` under `gkm dev`). Defaults to `noreply`.\n\t *\n\t * Only the local part: it is structural, the same on every stage, and the\n\t * templates' copy is written for it. The domain is the stage's, so a stage\n\t * whose domain changes sends from the new one. A whole address for one\n\t * stage is `deploy.email.<stage>.from`, which wins over this.\n\t */\n\tfrom?: string;\n\t/** A reply-to address for every send. */\n\treplyTo?: string;\n}\n\n/**\n * The address-shaped characters a local part may hold: the dot-atom of RFC\n * 5322, which is every sender anyone sends from.\n */\nconst LOCAL_PART =\n\t/^[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(\\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*$/;\n\n/** An `Email`'s `from` that is not a bare local part. */\nexport class EmailFromNotALocalPart extends Error {\n\tconstructor(\n\t\treadonly id: string,\n\t\treadonly from: string,\n\t) {\n\t\tsuper(\n\t\t\tfrom.includes('@')\n\t\t\t\t? `Email '${id}' has from: '${from}', a whole address. 'from' is the local part only — from: '${from.slice(0, from.lastIndexOf('@'))}' sends as that @ the stage's domain. A whole address for one stage is deploy.email.<stage>.from.`\n\t\t\t\t: `Email '${id}' has from: '${from}', which is not a mail local part. Set it to what goes before the @, like 'info' or 'noreply'.`,\n\t\t);\n\t\tthis.name = 'EmailFromNotALocalPart';\n\t}\n}\n\nexport class Email<\n\tTName extends string = string,\n\tTTemplates extends TemplateRecord = TemplateRecord,\n> implements Construct<TName, EmailClient<TTemplates>>\n{\n\treadonly id: TName;\n\treadonly service: Service<Uncapitalize<TName>, EmailClient<TTemplates>>;\n\n\t/**\n\t * Declared once and read by both `declare()` and `connect()`, so the key the\n\t * build publishes and the key the client reads cannot drift.\n\t */\n\tprivate readonly keys: { url: string; from: string };\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly options: EmailOptions<TTemplates>,\n\t) {\n\t\tconst canonical = canonicalId(id as string);\n\t\tif (options.from !== undefined && !LOCAL_PART.test(options.from)) {\n\t\t\tthrow new EmailFromNotALocalPart(canonical, options.from);\n\t\t}\n\n\t\tthis.id = canonical as TName;\n\t\tthis.keys = {\n\t\t\turl: providedKeyFor(canonical, 'email', 'url'),\n\t\t\t// The whole address arrives with the URL: its domain is the stage's,\n\t\t\t// so only the local part (`options.from`) is written here.\n\t\t\tfrom: providedKeyFor(canonical, 'email', 'from'),\n\t\t};\n\n\t\t// A field, not a getter: consumers cache services by object identity.\n\t\tthis.service = {\n\t\t\tserviceName: serviceKey(canonical) as Uncapitalize<TName>,\n\t\t\tregister: (options) => this.connect(options),\n\t\t};\n\t}\n\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'email',\n\t\t\t\tid: this.id,\n\t\t\t\tprovides: [this.keys.url, this.keys.from],\n\t\t\t\t...(this.options.from ? { from: this.options.from } : {}),\n\t\t\t},\n\t\t];\n\t}\n\n\t/**\n\t * Builds the client from the URL the adapter supplied.\n\t *\n\t * No provider branch and no driver lookup — `parseEmailUrl` turns any of\n\t * Mailpit, SES, or Resend into the same transport config, which is the whole\n\t * reason the scheme is always `smtp://`.\n\t */\n\tprivate async connect({\n\t\tenvParser,\n\t}: ServiceRegisterOptions): Promise<EmailClient<TTemplates>> {\n\t\tconst { url, from } = envParser\n\t\t\t.create((get) => ({\n\t\t\t\turl: get(this.keys.url).string(),\n\t\t\t\tfrom: get(this.keys.from).string(),\n\t\t\t}))\n\t\t\t.parse();\n\n\t\t// Loaded here, not at the top: the test harness names this construct in\n\t\t// every app, and an app that sends no mail does not install emailkit.\n\t\tconst { createEmailClient, parseEmailUrl } = await loadEmailkit();\n\t\treturn createEmailClient({\n\t\t\tsmtp: parseEmailUrl(url),\n\t\t\ttemplates: this.options.templates,\n\t\t\tdefaults: {\n\t\t\t\tfrom,\n\t\t\t\t...(this.options.replyTo ? { replyTo: this.options.replyTo } : {}),\n\t\t\t},\n\t\t});\n\t}\n}\n"],"mappings":";;;;;;;AAsDA,MAAM,aACL;;AAGD,IAAa,yBAAb,cAA4C,MAAM;CAEvC;CACA;CAFV,YACC,IACA,MACC;EACD,MACC,KAAK,SAAS,GAAG,IACd,UAAU,GAAG,eAAe,KAAK,6DAA6D,KAAK,MAAM,GAAG,KAAK,YAAY,GAAG,CAAC,EAAE,qGACnI,UAAU,GAAG,eAAe,KAAK,+FACrC;EAPS,KAAA,KAAA;EACA,KAAA,OAAA;EAOT,KAAK,OAAO;CACb;AACD;AAEA,IAAa,QAAb,MAIA;CAYmB;CAXlB;CACA;;;;;CAMA;CAEA,YACC,IACA,SACC;EADgB,KAAA,UAAA;EAEjB,MAAM,YAAY,YAAY,EAAY;EAC1C,IAAI,QAAQ,SAAS,KAAA,KAAa,CAAC,WAAW,KAAK,QAAQ,IAAI,GAC9D,MAAM,IAAI,uBAAuB,WAAW,QAAQ,IAAI;EAGzD,KAAK,KAAK;EACV,KAAK,OAAO;GACX,KAAK,eAAe,WAAW,SAAS,KAAK;GAG7C,MAAM,eAAe,WAAW,SAAS,MAAM;EAChD;EAGA,KAAK,UAAU;GACd,aAAa,WAAW,SAAS;GACjC,WAAW,YAAY,KAAK,QAAQ,OAAO;EAC5C;CACD;CAEA,UAAyB;EACxB,OAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,UAAU,CAAC,KAAK,KAAK,KAAK,KAAK,KAAK,IAAI;GACxC,GAAI,KAAK,QAAQ,OAAO,EAAE,MAAM,KAAK,QAAQ,KAAK,IAAI,CAAC;EACxD,CACD;CACD;;;;;;;;CASA,MAAc,QAAQ,EACrB,aAC4D;EAC5D,MAAM,EAAE,KAAK,SAAS,UACpB,QAAQ,SAAS;GACjB,KAAK,IAAI,KAAK,KAAK,GAAG,CAAC,CAAC,OAAO;GAC/B,MAAM,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,OAAO;EAClC,EAAE,CAAC,CACF,MAAM;EAIR,MAAM,EAAE,mBAAmB,kBAAkB,MAAM,aAAa;EAChE,OAAO,kBAAkB;GACxB,MAAM,cAAc,GAAG;GACvB,WAAW,KAAK,QAAQ;GACxB,UAAU;IACT;IACA,GAAI,KAAK,QAAQ,UAAU,EAAE,SAAS,KAAK,QAAQ,QAAQ,IAAI,CAAC;GACjE;EACD,CAAC;CACF;AACD"}