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

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 +74 -0
  237. package/dist/mobile-app.cjs.map +1 -0
  238. package/dist/mobile-app.d.cts +73 -0
  239. package/dist/mobile-app.d.cts.map +1 -0
  240. package/dist/mobile-app.d.mts +73 -0
  241. package/dist/mobile-app.d.mts.map +1 -0
  242. package/dist/mobile-app.mjs +73 -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
package/dist/email.cjs CHANGED
@@ -1,9 +1,22 @@
1
- const require_chunk = require('./chunk-DWy1uDak.cjs');
2
- const __geekmidas_manifest = require_chunk.__toESM(require("@geekmidas/manifest"));
3
- const __geekmidas_emailkit = require_chunk.__toESM(require("@geekmidas/emailkit"));
4
-
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let _geekmidas_manifest = require("@geekmidas/manifest");
3
+ let _geekmidas_emailkit = require("@geekmidas/emailkit");
5
4
  //#region src/email.ts
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.
17
+ */
6
18
  var Email = class {
19
+ options;
7
20
  id;
8
21
  service;
9
22
  /**
@@ -13,15 +26,15 @@ var Email = class {
13
26
  keys;
14
27
  constructor(id, options) {
15
28
  this.options = options;
16
- const canonical = (0, __geekmidas_manifest.canonicalId)(id);
29
+ const canonical = (0, _geekmidas_manifest.canonicalId)(id);
17
30
  this.id = canonical;
18
31
  this.keys = {
19
- url: (0, __geekmidas_manifest.provideKey)(canonical, "url"),
20
- from: (0, __geekmidas_manifest.provideKey)(canonical, "from")
32
+ url: (0, _geekmidas_manifest.provideKey)(canonical, "url"),
33
+ from: (0, _geekmidas_manifest.provideKey)(canonical, "from")
21
34
  };
22
35
  this.service = {
23
- serviceName: (0, __geekmidas_manifest.serviceKey)(canonical),
24
- register: (options$1) => this.connect(options$1)
36
+ serviceName: (0, _geekmidas_manifest.serviceKey)(canonical),
37
+ register: (options) => this.connect(options)
25
38
  };
26
39
  }
27
40
  declare() {
@@ -43,8 +56,8 @@ var Email = class {
43
56
  url: get(this.keys.url).string(),
44
57
  from: get(this.keys.from).string()
45
58
  })).parse();
46
- return (0, __geekmidas_emailkit.createEmailClient)({
47
- smtp: (0, __geekmidas_emailkit.parseEmailUrl)(url),
59
+ return (0, _geekmidas_emailkit.createEmailClient)({
60
+ smtp: (0, _geekmidas_emailkit.parseEmailUrl)(url),
48
61
  templates: this.options.templates,
49
62
  defaults: {
50
63
  from,
@@ -53,7 +66,7 @@ var Email = class {
53
66
  });
54
67
  }
55
68
  };
56
-
57
69
  //#endregion
58
70
  exports.Email = Email;
71
+
59
72
  //# sourceMappingURL=email.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"email.cjs","names":["id: ConstructName<TName>","options: EmailOptions<TTemplates>","options"],"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;CACC,AAAS;CACT,AAAS;;;;;CAMT,AAAiB;CAEjB,YACCA,IACiBC,SAChB;EADgB;EAEjB,MAAM,YAAY,sCAAY,GAAa;AAE3C,OAAK,KAAK;AACV,OAAK,OAAO;GACX,KAAK,qCAAW,WAAW,MAAM;GAIjC,MAAM,qCAAW,WAAW,OAAO;EACnC;AAGD,OAAK,UAAU;GACd,aAAa,qCAAW,UAAU;GAClC,UAAU,CAACC,cAAY,KAAK,QAAQA,UAAQ;EAC5C;CACD;CAED,UAAyB;AACxB,SAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,UAAU,CAAC,KAAK,KAAK,KAAK,KAAK,KAAK,IAAK;EACzC,CACD;CACD;;;;;;;;CASD,MAAc,QAAQ,EACrB,WACwB,EAAoC;EAC5D,MAAM,EAAE,KAAK,MAAM,GAAG,UACpB,OAAO,CAAC,SAAS;GACjB,KAAK,IAAI,KAAK,KAAK,IAAI,CAAC,QAAQ;GAChC,MAAM,IAAI,KAAK,KAAK,KAAK,CAAC,QAAQ;EAClC,GAAE,CACF,OAAO;AAET,SAAO,4CAAkB;GACxB,MAAM,wCAAc,IAAI;GACxB,WAAW,KAAK,QAAQ;GACxB,UAAU;IACT;IACA,GAAI,KAAK,QAAQ,UAAU,EAAE,SAAS,KAAK,QAAQ,QAAS,IAAG,CAAE;GACjE;EACD,EAAC;CACF;AACD"}
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"}
package/dist/email.d.cts CHANGED
@@ -1,11 +1,9 @@
1
- import { Construct } from "./construct-interface-D9d4Gm4p.cjs";
1
+ import { n as Construct } from "./construct-interface-B1AfqRl4.cjs";
2
2
  import { Service } from "@geekmidas/services";
3
3
  import { ConstructName, Declaration } from "@geekmidas/manifest";
4
4
  import { EmailClient, TemplateRecord } from "@geekmidas/emailkit";
5
-
6
5
  //#region src/email.d.ts
7
-
8
- interface EmailOptions<TTemplates extends TemplateRecord> {
6
+ export interface EmailOptions<TTemplates extends TemplateRecord> {
9
7
  /**
10
8
  * The React templates this app can send.
11
9
  *
@@ -24,7 +22,7 @@ interface EmailOptions<TTemplates extends TemplateRecord> {
24
22
  */
25
23
  replyTo?: string;
26
24
  }
27
- declare class Email<TName extends string = string, TTemplates extends TemplateRecord = TemplateRecord> implements Construct<TName, EmailClient<TTemplates>> {
25
+ export declare class Email<TName extends string = string, TTemplates extends TemplateRecord = TemplateRecord> implements Construct<TName, EmailClient<TTemplates>> {
28
26
  private readonly options;
29
27
  readonly id: TName;
30
28
  readonly service: Service<Uncapitalize<TName>, EmailClient<TTemplates>>;
@@ -44,7 +42,5 @@ declare class Email<TName extends string = string, TTemplates extends TemplateRe
44
42
  */
45
43
  private connect;
46
44
  }
47
- //# sourceMappingURL=email.d.ts.map
48
45
  //#endregion
49
- export { Email, EmailOptions };
50
46
  //# sourceMappingURL=email.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"email.d.cts","names":[],"sources":["../src/email.ts"],"sourcesContent":[],"mappings":";;;;;;;AAqD8B,UAvBb,YAuBa,CAAA,mBAvBmB,cAuBnB,CAAA,CAAA;EAAW;;;;;;;;EAYtB,SACsB,EA3B7B,UA2B6B;EAAU;;;AAb7B;;;;;;cAHT,wDAEO,iBAAiB,2BACxB,UAAU,OAAO,YAAY;;eAE5B;oBACK,QAAQ,aAAa,QAAQ,YAAY;;;;;;kBAStD,cAAc,iBACQ,aAAa;aAoB7B"}
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"}
package/dist/email.d.mts CHANGED
@@ -1,11 +1,9 @@
1
- import { Construct } from "./construct-interface-g5GM5pwR.mjs";
1
+ import { n as Construct } from "./construct-interface-ZvYQbivO.mjs";
2
2
  import { ConstructName, Declaration } from "@geekmidas/manifest";
3
- import { EmailClient, TemplateRecord } from "@geekmidas/emailkit";
4
3
  import { Service } from "@geekmidas/services";
5
-
4
+ import { EmailClient, TemplateRecord } from "@geekmidas/emailkit";
6
5
  //#region src/email.d.ts
7
-
8
- interface EmailOptions<TTemplates extends TemplateRecord> {
6
+ export interface EmailOptions<TTemplates extends TemplateRecord> {
9
7
  /**
10
8
  * The React templates this app can send.
11
9
  *
@@ -24,7 +22,7 @@ interface EmailOptions<TTemplates extends TemplateRecord> {
24
22
  */
25
23
  replyTo?: string;
26
24
  }
27
- declare class Email<TName extends string = string, TTemplates extends TemplateRecord = TemplateRecord> implements Construct<TName, EmailClient<TTemplates>> {
25
+ export declare class Email<TName extends string = string, TTemplates extends TemplateRecord = TemplateRecord> implements Construct<TName, EmailClient<TTemplates>> {
28
26
  private readonly options;
29
27
  readonly id: TName;
30
28
  readonly service: Service<Uncapitalize<TName>, EmailClient<TTemplates>>;
@@ -44,7 +42,5 @@ declare class Email<TName extends string = string, TTemplates extends TemplateRe
44
42
  */
45
43
  private connect;
46
44
  }
47
- //# sourceMappingURL=email.d.ts.map
48
45
  //#endregion
49
- export { Email, EmailOptions };
50
46
  //# sourceMappingURL=email.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"email.d.mts","names":[],"sources":["../src/email.ts"],"sourcesContent":[],"mappings":";;;;;;;AAqD8B,UAvBb,YAuBa,CAAA,mBAvBmB,cAuBnB,CAAA,CAAA;EAAW;;;;;;;;EAYtB,SACsB,EA3B7B,UA2B6B;EAAU;;;AAb7B;;;;;;cAHT,wDAEO,iBAAiB,2BACxB,UAAU,OAAO,YAAY;;eAE5B;oBACK,QAAQ,aAAa,QAAQ,YAAY;;;;;;kBAStD,cAAc,iBACQ,aAAa;aAoB7B"}
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"}
package/dist/email.mjs CHANGED
@@ -1,8 +1,21 @@
1
1
  import { canonicalId, provideKey, serviceKey } from "@geekmidas/manifest";
2
2
  import { createEmailClient, parseEmailUrl } from "@geekmidas/emailkit";
3
-
4
3
  //#region src/email.ts
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.
16
+ */
5
17
  var Email = class {
18
+ options;
6
19
  id;
7
20
  service;
8
21
  /**
@@ -20,7 +33,7 @@ var Email = class {
20
33
  };
21
34
  this.service = {
22
35
  serviceName: serviceKey(canonical),
23
- register: (options$1) => this.connect(options$1)
36
+ register: (options) => this.connect(options)
24
37
  };
25
38
  }
26
39
  declare() {
@@ -52,7 +65,7 @@ var Email = class {
52
65
  });
53
66
  }
54
67
  };
55
-
56
68
  //#endregion
57
69
  export { Email };
70
+
58
71
  //# sourceMappingURL=email.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"email.mjs","names":["id: ConstructName<TName>","options: EmailOptions<TTemplates>","options"],"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;CACC,AAAS;CACT,AAAS;;;;;CAMT,AAAiB;CAEjB,YACCA,IACiBC,SAChB;EADgB;EAEjB,MAAM,YAAY,YAAY,GAAa;AAE3C,OAAK,KAAK;AACV,OAAK,OAAO;GACX,KAAK,WAAW,WAAW,MAAM;GAIjC,MAAM,WAAW,WAAW,OAAO;EACnC;AAGD,OAAK,UAAU;GACd,aAAa,WAAW,UAAU;GAClC,UAAU,CAACC,cAAY,KAAK,QAAQA,UAAQ;EAC5C;CACD;CAED,UAAyB;AACxB,SAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,UAAU,CAAC,KAAK,KAAK,KAAK,KAAK,KAAK,IAAK;EACzC,CACD;CACD;;;;;;;;CASD,MAAc,QAAQ,EACrB,WACwB,EAAoC;EAC5D,MAAM,EAAE,KAAK,MAAM,GAAG,UACpB,OAAO,CAAC,SAAS;GACjB,KAAK,IAAI,KAAK,KAAK,IAAI,CAAC,QAAQ;GAChC,MAAM,IAAI,KAAK,KAAK,KAAK,CAAC,QAAQ;EAClC,GAAE,CACF,OAAO;AAET,SAAO,kBAAkB;GACxB,MAAM,cAAc,IAAI;GACxB,WAAW,KAAK,QAAQ;GACxB,UAAU;IACT;IACA,GAAI,KAAK,QAAQ,UAAU,EAAE,SAAS,KAAK,QAAQ,QAAS,IAAG,CAAE;GACjE;EACD,EAAC;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 {\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"}
@@ -0,0 +1,96 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_cipher = require("./cipher-CVxfwLjk.cjs");
3
+ let _geekmidas_manifest = require("@geekmidas/manifest");
4
+ //#region src/encryption.ts
5
+ /**
6
+ * `Encryption` — a key that encrypts what the application stores.
7
+ *
8
+ * ```ts
9
+ * export const pii = new Encryption('Pii');
10
+ *
11
+ * // an endpoint that `.dependsOn([pii])`
12
+ * const email = await services.pii.encrypt(body.email);
13
+ * const emailIndex = await services.pii.index(body.email);
14
+ * await db.insertInto('users').values({ email, emailIndex }).execute();
15
+ *
16
+ * // and to find them again, without decrypting a column
17
+ * db.selectFrom('users').where('emailIndex', '=', await services.pii.index(q));
18
+ * ```
19
+ *
20
+ * The app names no cipher and holds no key. The construct provides one URL,
21
+ * `<ID>_URL`, and its scheme picks the backend the way a queue's connection
22
+ * string picks its broker:
23
+ *
24
+ * - **AWS** — `kms://`: envelope encryption under a KMS key that rotates
25
+ * yearly, and a KMS HMAC key for the index. Only a function that depends on
26
+ * the construct is granted either key.
27
+ * - **Server, local, tests** — `aes256gcm://`: a keyring the process holds.
28
+ * Derived locally, so `gkm dev` and `gkm test` need nothing set; generated
29
+ * into a server stage's secrets on its first deploy, and rotated there with
30
+ * `gkm encryption:rotate`.
31
+ *
32
+ * Every ciphertext names the key that wrote it, so a rotated key still opens
33
+ * what it wrote. Retiring one is explicit — `reencrypt` the column, then
34
+ * `gkm encryption:retire` — and a value still under an old key says so when it
35
+ * is decrypted, once per key per process.
36
+ */
37
+ var Encryption = class {
38
+ id;
39
+ service;
40
+ /**
41
+ * Declared once and read by both `declare()` and `connect()`, so the key the
42
+ * target publishes and the key the client reads cannot drift.
43
+ */
44
+ key;
45
+ /**
46
+ * One cipher per process, held as the promise: a keyring is parsed once and
47
+ * a KMS client is built once, however many handlers register it at once.
48
+ */
49
+ cipher;
50
+ constructor(id) {
51
+ const canonical = (0, _geekmidas_manifest.canonicalId)(id);
52
+ this.id = canonical;
53
+ this.key = (0, _geekmidas_manifest.provideKey)(canonical, "url");
54
+ this.service = {
55
+ serviceName: (0, _geekmidas_manifest.serviceKey)(canonical),
56
+ register: (options) => this.connect(options)
57
+ };
58
+ }
59
+ declare() {
60
+ return [{
61
+ kind: "encryption",
62
+ id: this.id,
63
+ provides: [this.key]
64
+ }];
65
+ }
66
+ connect(options) {
67
+ this.cipher ??= this.open(options);
68
+ return this.cipher;
69
+ }
70
+ async open(options) {
71
+ const { url } = options.envParser.create((get) => ({ url: get(this.key).string() })).parse();
72
+ const scheme = url.slice(0, url.indexOf(":") + 1);
73
+ if (scheme === "aes256gcm:") return require_cipher.keyringCipher(this.id, url, (stale, current) => console.warn(`${this.id} decrypted a value still under '${stale}' (current: '${current}'). reencrypt it, and retire '${stale}' once nothing is left under it.`));
74
+ if (scheme === _geekmidas_manifest.KMS_SCHEME) {
75
+ const { kmsCipher } = await Promise.resolve().then(() => require("./kms-B-Hm3d5r.cjs"));
76
+ return kmsCipher(this.id, url);
77
+ }
78
+ throw new require_cipher.UnknownEncryptionScheme(this.id, scheme);
79
+ }
80
+ };
81
+ //#endregion
82
+ exports.CiphertextMalformed = require_cipher.CiphertextMalformed;
83
+ exports.CiphertextNotAuthentic = require_cipher.CiphertextNotAuthentic;
84
+ exports.CurrentKeyCannotRetire = require_cipher.CurrentKeyCannotRetire;
85
+ exports.Encryption = Encryption;
86
+ exports.EncryptionKeyRetired = require_cipher.EncryptionKeyRetired;
87
+ exports.EncryptionUrlInvalid = require_cipher.EncryptionUrlInvalid;
88
+ exports.UnknownEncryptionScheme = require_cipher.UnknownEncryptionScheme;
89
+ exports.formatKeyring = require_cipher.formatKeyring;
90
+ exports.generateKeyring = require_cipher.generateKeyring;
91
+ exports.keyringCipher = require_cipher.keyringCipher;
92
+ exports.parseKeyring = require_cipher.parseKeyring;
93
+ exports.retireKey = require_cipher.retireKey;
94
+ exports.rotateKeyring = require_cipher.rotateKeyring;
95
+
96
+ //# sourceMappingURL=encryption.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encryption.cjs","names":["canonicalId","provideKey","serviceKey","keyringCipher","KMS_SCHEME","UnknownEncryptionScheme"],"sources":["../src/encryption.ts"],"sourcesContent":["/**\n * `Encryption` — a key that encrypts what the application stores.\n *\n * ```ts\n * export const pii = new Encryption('Pii');\n *\n * // an endpoint that `.dependsOn([pii])`\n * const email = await services.pii.encrypt(body.email);\n * const emailIndex = await services.pii.index(body.email);\n * await db.insertInto('users').values({ email, emailIndex }).execute();\n *\n * // and to find them again, without decrypting a column\n * db.selectFrom('users').where('emailIndex', '=', await services.pii.index(q));\n * ```\n *\n * The app names no cipher and holds no key. The construct provides one URL,\n * `<ID>_URL`, and its scheme picks the backend the way a queue's connection\n * string picks its broker:\n *\n * - **AWS** — `kms://`: envelope encryption under a KMS key that rotates\n * yearly, and a KMS HMAC key for the index. Only a function that depends on\n * the construct is granted either key.\n * - **Server, local, tests** — `aes256gcm://`: a keyring the process holds.\n * Derived locally, so `gkm dev` and `gkm test` need nothing set; generated\n * into a server stage's secrets on its first deploy, and rotated there with\n * `gkm encryption:rotate`.\n *\n * Every ciphertext names the key that wrote it, so a rotated key still opens\n * what it wrote. Retiring one is explicit — `reencrypt` the column, then\n * `gkm encryption:retire` — and a value still under an old key says so when it\n * is decrypted, once per key per process.\n */\n\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\tKMS_SCHEME,\n\tprovideKey,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport type { Service, ServiceRegisterOptions } from '@geekmidas/services';\nimport type { Construct } from './construct-interface';\nimport {\n\ttype Cipher,\n\tkeyringCipher,\n\tLOCAL_SCHEME,\n\tUnknownEncryptionScheme,\n} from './encryption/cipher';\n\nexport type { Cipher } from './encryption/cipher';\nexport {\n\tCiphertextMalformed,\n\tCiphertextNotAuthentic,\n\tCurrentKeyCannotRetire,\n\tEncryptionKeyRetired,\n\tEncryptionUrlInvalid,\n\tformatKeyring,\n\tgenerateKeyring,\n\ttype Keyring,\n\tkeyringCipher,\n\tparseKeyring,\n\tretireKey,\n\trotateKeyring,\n\tUnknownEncryptionScheme,\n} from './encryption/cipher';\n\nexport class Encryption<TName extends string = string>\n\timplements Construct<TName, Cipher>\n{\n\treadonly id: TName;\n\treadonly service: Service<Uncapitalize<TName>, Cipher>;\n\n\t/**\n\t * Declared once and read by both `declare()` and `connect()`, so the key the\n\t * target publishes and the key the client reads cannot drift.\n\t */\n\tprivate readonly key: string;\n\n\t/**\n\t * One cipher per process, held as the promise: a keyring is parsed once and\n\t * a KMS client is built once, however many handlers register it at once.\n\t */\n\tprivate cipher?: Promise<Cipher>;\n\n\tconstructor(id: ConstructName<TName>) {\n\t\tconst canonical = canonicalId(id as string);\n\n\t\tthis.id = canonical as TName;\n\t\tthis.key = provideKey(canonical, 'url');\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 [{ kind: 'encryption', id: this.id, provides: [this.key] }];\n\t}\n\n\tprivate connect(options: ServiceRegisterOptions): Promise<Cipher> {\n\t\tthis.cipher ??= this.open(options);\n\t\treturn this.cipher;\n\t}\n\n\tprivate async open(options: ServiceRegisterOptions): Promise<Cipher> {\n\t\tconst { url } = options.envParser\n\t\t\t.create((get) => ({ url: get(this.key).string() }))\n\t\t\t.parse();\n\t\tconst scheme = url.slice(0, url.indexOf(':') + 1);\n\n\t\tif (scheme === LOCAL_SCHEME) {\n\t\t\treturn keyringCipher(this.id, url, (stale, current) =>\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`${this.id} decrypted a value still under '${stale}' (current: '${current}'). reencrypt it, and retire '${stale}' once nothing is left under it.`,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\n\t\tif (scheme === KMS_SCHEME) {\n\t\t\t// Loaded only here, so a project that never deploys to AWS never\n\t\t\t// needs `@aws-sdk/client-kms` installed.\n\t\t\tconst { kmsCipher } = await import('./encryption/kms');\n\t\t\treturn kmsCipher(this.id, url);\n\t\t}\n\n\t\tthrow new UnknownEncryptionScheme(this.id, scheme);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmEA,IAAa,aAAb,MAEA;CACC;CACA;;;;;CAMA;;;;;CAMA;CAEA,YAAY,IAA0B;EACrC,MAAM,aAAA,GAAYA,oBAAAA,YAAAA,CAAY,EAAY;EAE1C,KAAK,KAAK;EACV,KAAK,OAAA,GAAMC,oBAAAA,WAAAA,CAAW,WAAW,KAAK;EAGtC,KAAK,UAAU;GACd,cAAA,GAAaC,oBAAAA,WAAAA,CAAW,SAAS;GACjC,WAAW,YAAY,KAAK,QAAQ,OAAO;EAC5C;CACD;CAEA,UAAyB;EACxB,OAAO,CAAC;GAAE,MAAM;GAAc,IAAI,KAAK;GAAI,UAAU,CAAC,KAAK,GAAG;EAAE,CAAC;CAClE;CAEA,QAAgB,SAAkD;EACjE,KAAK,WAAW,KAAK,KAAK,OAAO;EACjC,OAAO,KAAK;CACb;CAEA,MAAc,KAAK,SAAkD;EACpE,MAAM,EAAE,QAAQ,QAAQ,UACtB,QAAQ,SAAS,EAAE,KAAK,IAAI,KAAK,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAClD,MAAM;EACR,MAAM,SAAS,IAAI,MAAM,GAAG,IAAI,QAAQ,GAAG,IAAI,CAAC;EAEhD,IAAI,WAAA,cACH,OAAOC,eAAAA,cAAc,KAAK,IAAI,MAAM,OAAO,YAC1C,QAAQ,KACP,GAAG,KAAK,GAAG,kCAAkC,MAAM,eAAe,QAAQ,gCAAgC,MAAM,iCACjH,CACD;EAGD,IAAI,WAAWC,oBAAAA,YAAY;GAG1B,MAAM,EAAE,cAAc,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,oBAAA,CAAA;GAC5B,OAAO,UAAU,KAAK,IAAI,GAAG;EAC9B;EAEA,MAAM,IAAIC,eAAAA,wBAAwB,KAAK,IAAI,MAAM;CAClD;AACD"}
@@ -0,0 +1,117 @@
1
+ import { n as Construct } from "./construct-interface-B1AfqRl4.cjs";
2
+ import { Service } from "@geekmidas/services";
3
+ import { ConstructName, Declaration } from "@geekmidas/manifest";
4
+ //#region src/encryption/cipher.d.ts
5
+ /**
6
+ * The cipher behind an `Encryption` construct, and the format it writes.
7
+ *
8
+ * Every ciphertext names the key that wrote it — `gkm1.<keyId>.<payload>` — so
9
+ * `decrypt` never has to guess, a rotated key still opens what it wrote, and
10
+ * retiring a key is a decision made against data rather than a hope. The
11
+ * format version leads, so the day it has to change, both can be read.
12
+ *
13
+ * Two backends, picked by the scheme of the construct's URL, the way a queue's
14
+ * connection string picks its broker:
15
+ *
16
+ * - `aes256gcm://` — a keyring this process holds: AES-256-GCM with the newest
17
+ * key, HMAC-SHA256 for the blind index. Local, test and server stages.
18
+ * - `kms://` — envelope encryption under an AWS KMS key, and a KMS HMAC key for
19
+ * the index. The key material never leaves KMS. See `./kms`.
20
+ */
21
+ /** What a handler is given: `services.pii.encrypt(…)` and the rest. */
22
+ interface Cipher {
23
+ /** Plaintext in, a self-describing ciphertext string out. */
24
+ encrypt(plaintext: string): Promise<string>;
25
+ /** Opens any ciphertext this construct wrote, under whichever key wrote it. */
26
+ decrypt(ciphertext: string): Promise<string>;
27
+ /**
28
+ * A blind index: the same value always gives the same string, so an
29
+ * encrypted column can still be looked up by an indexed column beside it.
30
+ *
31
+ * Deterministic on purpose, which is also why its key never rotates — a
32
+ * rotated index key would make every stored index miss.
33
+ */
34
+ index(value: string): Promise<string>;
35
+ /**
36
+ * The same plaintext under the current key — what a sweep runs over a
37
+ * column before an old key is retired. Unchanged when it is already current.
38
+ */
39
+ reencrypt(ciphertext: string): Promise<string>;
40
+ }
41
+ export declare class EncryptionUrlInvalid extends Error {
42
+ readonly construct: string;
43
+ readonly reason: string;
44
+ constructor(construct: string, reason: string);
45
+ }
46
+ export declare class UnknownEncryptionScheme extends Error {
47
+ readonly construct: string;
48
+ readonly scheme: string;
49
+ constructor(construct: string, scheme: string);
50
+ }
51
+ export declare class CiphertextMalformed extends Error {
52
+ readonly construct: string;
53
+ constructor(construct: string);
54
+ }
55
+ export declare class EncryptionKeyRetired extends Error {
56
+ readonly construct: string;
57
+ readonly keyId: string;
58
+ constructor(construct: string, keyId: string);
59
+ }
60
+ export declare class CiphertextNotAuthentic extends Error {
61
+ readonly construct: string;
62
+ constructor(construct: string);
63
+ }
64
+ export declare class CurrentKeyCannotRetire extends Error {
65
+ readonly construct: string;
66
+ readonly keyId: string;
67
+ constructor(construct: string, keyId: string);
68
+ }
69
+ /** A local keyring: newest key first, and the index key that never rotates. */
70
+ interface Keyring {
71
+ keys: {
72
+ id: string;
73
+ key: Buffer;
74
+ }[];
75
+ index: Buffer;
76
+ }
77
+ /** Parse `aes256gcm://local?keys=k2.<key>,k1.<key>&index=<key>`. */
78
+ export declare function parseKeyring(construct: string, url: string): Keyring;
79
+ export declare function formatKeyring(keyring: Keyring): string;
80
+ /** A keyring with one fresh key, `k1`, and a fresh index key. */
81
+ export declare function generateKeyring(): string;
82
+ /**
83
+ * The keyring with a new current key in front, and every older one kept.
84
+ *
85
+ * Nothing is dropped: what the old keys wrote still has to open until a sweep
86
+ * has re-encrypted it — see {@link retireKey}.
87
+ */
88
+ export declare function rotateKeyring(construct: string, url: string): string;
89
+ /** The keyring without `keyId`, which must not be the current key. */
90
+ export declare function retireKey(construct: string, url: string, keyId: string): string;
91
+ /** Says, once per key per process, that a value is still under an old key. */
92
+ type StaleKeyReporter = (keyId: string, current: string) => void;
93
+ /** The `aes256gcm://` cipher: a keyring held in process. */
94
+ export declare function keyringCipher(construct: string, url: string, onStaleKey?: StaleKeyReporter): Cipher;
95
+ //#endregion
96
+ //#region src/encryption.d.ts
97
+ export declare class Encryption<TName extends string = string> implements Construct<TName, Cipher> {
98
+ readonly id: TName;
99
+ readonly service: Service<Uncapitalize<TName>, Cipher>;
100
+ /**
101
+ * Declared once and read by both `declare()` and `connect()`, so the key the
102
+ * target publishes and the key the client reads cannot drift.
103
+ */
104
+ private readonly key;
105
+ /**
106
+ * One cipher per process, held as the promise: a keyring is parsed once and
107
+ * a KMS client is built once, however many handlers register it at once.
108
+ */
109
+ private cipher?;
110
+ constructor(id: ConstructName<TName>);
111
+ declare(): Declaration[];
112
+ private connect;
113
+ private open;
114
+ }
115
+ //#endregion
116
+ export type { Cipher, Keyring };
117
+ //# sourceMappingURL=encryption.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encryption.d.cts","names":[],"sources":["../src/encryption/cipher.ts","../src/encryption.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;UAyBiB;;EAEhB,QAAQ,oBAAoB;;EAE5B,QAAQ,qBAAqB;;;;;;;;EAQ7B,MAAM,gBAAgB;;;;;EAKtB,UAAU,qBAAqB;;qBAanB,6BAA6B;WAE/B;WACA;EAFV,YACU,mBACA;;qBASE,gCAAgC;WAElC;WACA;EAFV,YACU,mBACA;;qBASE,4BAA4B;WACnB;EAArB,YAAqB;;qBAQT,6BAA6B;WAE/B;WACA;EAFV,YACU,mBACA;;qBASE,+BAA+B;WACtB;EAArB,YAAqB;;qBAQT,+BAA+B;WAEjC;WACA;EAFV,YACU,mBACA;;;UAuEM;EAChB;IAAQ;IAAY,KAAK;;EACzB,OAAO;;;wBAIQ,aAAa,mBAAmB,cAAc;wBAqC9C,cAAc,SAAS;;wBAQvB;;;;;;;wBAaA,cAAc,mBAAmB;;wBAYjC,UACf,mBACA,aACA;;KAiBW,oBAAoB,eAAe;;wBAG/B,cACf,mBACA,aACA,aAAY,mBACV;;;qBC3NU,WAAW,0CACZ,UAAU,OAAO;WAEnB,IAAI;WACJ,SAAS,QAAQ,aAAa,QAAQ;;;;;mBAM9B;;;;;UAMT;EAER,YAAY,IAAI,cAAc;EAa9B,WAAW;UAIH;UAKM"}
@@ -0,0 +1,117 @@
1
+ import { n as Construct } from "./construct-interface-ZvYQbivO.mjs";
2
+ import { ConstructName, Declaration } from "@geekmidas/manifest";
3
+ import { Service } from "@geekmidas/services";
4
+ //#region src/encryption/cipher.d.ts
5
+ /**
6
+ * The cipher behind an `Encryption` construct, and the format it writes.
7
+ *
8
+ * Every ciphertext names the key that wrote it — `gkm1.<keyId>.<payload>` — so
9
+ * `decrypt` never has to guess, a rotated key still opens what it wrote, and
10
+ * retiring a key is a decision made against data rather than a hope. The
11
+ * format version leads, so the day it has to change, both can be read.
12
+ *
13
+ * Two backends, picked by the scheme of the construct's URL, the way a queue's
14
+ * connection string picks its broker:
15
+ *
16
+ * - `aes256gcm://` — a keyring this process holds: AES-256-GCM with the newest
17
+ * key, HMAC-SHA256 for the blind index. Local, test and server stages.
18
+ * - `kms://` — envelope encryption under an AWS KMS key, and a KMS HMAC key for
19
+ * the index. The key material never leaves KMS. See `./kms`.
20
+ */
21
+ /** What a handler is given: `services.pii.encrypt(…)` and the rest. */
22
+ interface Cipher {
23
+ /** Plaintext in, a self-describing ciphertext string out. */
24
+ encrypt(plaintext: string): Promise<string>;
25
+ /** Opens any ciphertext this construct wrote, under whichever key wrote it. */
26
+ decrypt(ciphertext: string): Promise<string>;
27
+ /**
28
+ * A blind index: the same value always gives the same string, so an
29
+ * encrypted column can still be looked up by an indexed column beside it.
30
+ *
31
+ * Deterministic on purpose, which is also why its key never rotates — a
32
+ * rotated index key would make every stored index miss.
33
+ */
34
+ index(value: string): Promise<string>;
35
+ /**
36
+ * The same plaintext under the current key — what a sweep runs over a
37
+ * column before an old key is retired. Unchanged when it is already current.
38
+ */
39
+ reencrypt(ciphertext: string): Promise<string>;
40
+ }
41
+ export declare class EncryptionUrlInvalid extends Error {
42
+ readonly construct: string;
43
+ readonly reason: string;
44
+ constructor(construct: string, reason: string);
45
+ }
46
+ export declare class UnknownEncryptionScheme extends Error {
47
+ readonly construct: string;
48
+ readonly scheme: string;
49
+ constructor(construct: string, scheme: string);
50
+ }
51
+ export declare class CiphertextMalformed extends Error {
52
+ readonly construct: string;
53
+ constructor(construct: string);
54
+ }
55
+ export declare class EncryptionKeyRetired extends Error {
56
+ readonly construct: string;
57
+ readonly keyId: string;
58
+ constructor(construct: string, keyId: string);
59
+ }
60
+ export declare class CiphertextNotAuthentic extends Error {
61
+ readonly construct: string;
62
+ constructor(construct: string);
63
+ }
64
+ export declare class CurrentKeyCannotRetire extends Error {
65
+ readonly construct: string;
66
+ readonly keyId: string;
67
+ constructor(construct: string, keyId: string);
68
+ }
69
+ /** A local keyring: newest key first, and the index key that never rotates. */
70
+ interface Keyring {
71
+ keys: {
72
+ id: string;
73
+ key: Buffer;
74
+ }[];
75
+ index: Buffer;
76
+ }
77
+ /** Parse `aes256gcm://local?keys=k2.<key>,k1.<key>&index=<key>`. */
78
+ export declare function parseKeyring(construct: string, url: string): Keyring;
79
+ export declare function formatKeyring(keyring: Keyring): string;
80
+ /** A keyring with one fresh key, `k1`, and a fresh index key. */
81
+ export declare function generateKeyring(): string;
82
+ /**
83
+ * The keyring with a new current key in front, and every older one kept.
84
+ *
85
+ * Nothing is dropped: what the old keys wrote still has to open until a sweep
86
+ * has re-encrypted it — see {@link retireKey}.
87
+ */
88
+ export declare function rotateKeyring(construct: string, url: string): string;
89
+ /** The keyring without `keyId`, which must not be the current key. */
90
+ export declare function retireKey(construct: string, url: string, keyId: string): string;
91
+ /** Says, once per key per process, that a value is still under an old key. */
92
+ type StaleKeyReporter = (keyId: string, current: string) => void;
93
+ /** The `aes256gcm://` cipher: a keyring held in process. */
94
+ export declare function keyringCipher(construct: string, url: string, onStaleKey?: StaleKeyReporter): Cipher;
95
+ //#endregion
96
+ //#region src/encryption.d.ts
97
+ export declare class Encryption<TName extends string = string> implements Construct<TName, Cipher> {
98
+ readonly id: TName;
99
+ readonly service: Service<Uncapitalize<TName>, Cipher>;
100
+ /**
101
+ * Declared once and read by both `declare()` and `connect()`, so the key the
102
+ * target publishes and the key the client reads cannot drift.
103
+ */
104
+ private readonly key;
105
+ /**
106
+ * One cipher per process, held as the promise: a keyring is parsed once and
107
+ * a KMS client is built once, however many handlers register it at once.
108
+ */
109
+ private cipher?;
110
+ constructor(id: ConstructName<TName>);
111
+ declare(): Declaration[];
112
+ private connect;
113
+ private open;
114
+ }
115
+ //#endregion
116
+ export type { Cipher, Keyring };
117
+ //# sourceMappingURL=encryption.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encryption.d.mts","names":[],"sources":["../src/encryption/cipher.ts","../src/encryption.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;UAyBiB;;EAEhB,QAAQ,oBAAoB;;EAE5B,QAAQ,qBAAqB;;;;;;;;EAQ7B,MAAM,gBAAgB;;;;;EAKtB,UAAU,qBAAqB;;qBAanB,6BAA6B;WAE/B;WACA;EAFV,YACU,mBACA;;qBASE,gCAAgC;WAElC;WACA;EAFV,YACU,mBACA;;qBASE,4BAA4B;WACnB;EAArB,YAAqB;;qBAQT,6BAA6B;WAE/B;WACA;EAFV,YACU,mBACA;;qBASE,+BAA+B;WACtB;EAArB,YAAqB;;qBAQT,+BAA+B;WAEjC;WACA;EAFV,YACU,mBACA;;;UAuEM;EAChB;IAAQ;IAAY,KAAK;;EACzB,OAAO;;;wBAIQ,aAAa,mBAAmB,cAAc;wBAqC9C,cAAc,SAAS;;wBAQvB;;;;;;;wBAaA,cAAc,mBAAmB;;wBAYjC,UACf,mBACA,aACA;;KAiBW,oBAAoB,eAAe;;wBAG/B,cACf,mBACA,aACA,aAAY,mBACV;;;qBC3NU,WAAW,0CACZ,UAAU,OAAO;WAEnB,IAAI;WACJ,SAAS,QAAQ,aAAa,QAAQ;;;;;mBAM9B;;;;;UAMT;EAER,YAAY,IAAI,cAAc;EAa9B,WAAW;UAIH;UAKM"}