@geekmidas/constructs 10.0.0-alpha.6 → 10.0.0-alpha.60

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 (405) hide show
  1. package/README.md +223 -158
  2. package/dist/{Construct-BD5neF7w.mjs → Construct-BO1X-kt9.mjs} +32 -33
  3. package/dist/Construct-BO1X-kt9.mjs.map +1 -0
  4. package/dist/Construct-BQALFCh2.d.cts +230 -0
  5. package/dist/Construct-BQALFCh2.d.cts.map +1 -0
  6. package/dist/{Construct-CyS3RpTL.cjs → Construct-DmvXceVY.cjs} +52 -47
  7. package/dist/Construct-DmvXceVY.cjs.map +1 -0
  8. package/dist/Construct-QXnl3VqT.d.mts +230 -0
  9. package/dist/Construct-QXnl3VqT.d.mts.map +1 -0
  10. package/dist/{Cron-DmQ8vQ4b.d.cts → Cron-DI3nKoic.d.cts} +15 -9
  11. package/dist/Cron-DI3nKoic.d.cts.map +1 -0
  12. package/dist/{Cron-dh4rUgib.d.mts → Cron-uYAHPnp7.d.mts} +15 -9
  13. package/dist/Cron-uYAHPnp7.d.mts.map +1 -0
  14. package/dist/{CronBuilder-Da0C0edR.cjs → CronBuilder-BoHzlWU_.cjs} +47 -31
  15. package/dist/CronBuilder-BoHzlWU_.cjs.map +1 -0
  16. package/dist/{CronBuilder-CYKT5RiO.mjs → CronBuilder-CCgt0wCE.mjs} +37 -21
  17. package/dist/CronBuilder-CCgt0wCE.mjs.map +1 -0
  18. package/dist/CronBuilder-DaSUm2Na.d.mts +47 -0
  19. package/dist/CronBuilder-DaSUm2Na.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-Bm9HjTPc.d.cts} +70 -93
  23. package/dist/Endpoint-Bm9HjTPc.d.cts.map +1 -0
  24. package/dist/{Endpoint-DCQPMdUX.mjs → Endpoint-CQ9RJ7p2.mjs} +130 -109
  25. package/dist/Endpoint-CQ9RJ7p2.mjs.map +1 -0
  26. package/dist/{Endpoint-DcWXE-SZ.cjs → Endpoint-DOi8c_Gy.cjs} +158 -131
  27. package/dist/Endpoint-DOi8c_Gy.cjs.map +1 -0
  28. package/dist/{Endpoint-dav89W6-.d.cts → Endpoint-KyMeR-B-.d.mts} +71 -94
  29. package/dist/Endpoint-KyMeR-B-.d.mts.map +1 -0
  30. package/dist/{index-Bd5FqCoe.d.cts → EndpointFactory-B6eZ3RDd.d.cts} +62 -132
  31. package/dist/EndpointFactory-B6eZ3RDd.d.cts.map +1 -0
  32. package/dist/{EndpointFactory-CdWB7wPw.cjs → EndpointFactory-Bo9lkMqB.cjs} +75 -110
  33. package/dist/EndpointFactory-Bo9lkMqB.cjs.map +1 -0
  34. package/dist/{EndpointFactory-CjV8F_lJ.mjs → EndpointFactory-DR1rebok.mjs} +39 -74
  35. package/dist/EndpointFactory-DR1rebok.mjs.map +1 -0
  36. package/dist/{index-lAO9egTb.d.mts → EndpointFactory-GYkAuG3u.d.mts} +63 -133
  37. package/dist/EndpointFactory-GYkAuG3u.d.mts.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-XyxwoFnE.cjs} +52 -54
  43. package/dist/HonoEndpointAdaptor-XyxwoFnE.cjs.map +1 -0
  44. package/dist/{HonoEndpointAdaptor-P1ahhZHu.mjs → HonoEndpointAdaptor-ja49poBI.mjs} +42 -47
  45. package/dist/HonoEndpointAdaptor-ja49poBI.mjs.map +1 -0
  46. package/dist/Queue-D5jcw0mu.cjs +109 -0
  47. package/dist/Queue-D5jcw0mu.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-hwPN-t31.mjs +104 -0
  53. package/dist/Queue-hwPN-t31.mjs.map +1 -0
  54. package/dist/QueueBuilder-BFQn3OzZ.cjs +135 -0
  55. package/dist/QueueBuilder-BFQn3OzZ.cjs.map +1 -0
  56. package/dist/QueueBuilder-DCuYdjMw.mjs +118 -0
  57. package/dist/QueueBuilder-DCuYdjMw.mjs.map +1 -0
  58. package/dist/QueueBuilder-OSi6LkV9.d.cts +75 -0
  59. package/dist/QueueBuilder-OSi6LkV9.d.cts.map +1 -0
  60. package/dist/QueueBuilder-QHsnVt1P.d.mts +75 -0
  61. package/dist/QueueBuilder-QHsnVt1P.d.mts.map +1 -0
  62. package/dist/{Subscriber-2mEi0ImH.d.cts → Subscriber-Bpp02cGr.d.cts} +29 -20
  63. package/dist/Subscriber-Bpp02cGr.d.cts.map +1 -0
  64. package/dist/{Subscriber-xTJ9ayPN.d.mts → Subscriber-CtN9R48-.d.mts} +29 -20
  65. package/dist/Subscriber-CtN9R48-.d.mts.map +1 -0
  66. package/dist/{SubscriberBuilder-4OPehf2R.cjs → SubscriberBuilder-C2PwqwIl.cjs} +61 -36
  67. package/dist/SubscriberBuilder-C2PwqwIl.cjs.map +1 -0
  68. package/dist/SubscriberBuilder-CuCMFpYW.d.mts +67 -0
  69. package/dist/SubscriberBuilder-CuCMFpYW.d.mts.map +1 -0
  70. package/dist/{SubscriberBuilder-BjkbeT9l.mjs → SubscriberBuilder-DMFk_Ap1.mjs} +50 -24
  71. package/dist/SubscriberBuilder-DMFk_Ap1.mjs.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-CkxOTrMv.cjs +104 -0
  75. package/dist/Topic-CkxOTrMv.cjs.map +1 -0
  76. package/dist/Topic-hPffOsot.mjs +99 -0
  77. package/dist/Topic-hPffOsot.mjs.map +1 -0
  78. package/dist/adaptors/aws.cjs +118 -216
  79. package/dist/adaptors/aws.cjs.map +1 -1
  80. package/dist/adaptors/aws.d.cts +34 -53
  81. package/dist/adaptors/aws.d.cts.map +1 -1
  82. package/dist/adaptors/aws.d.mts +35 -54
  83. package/dist/adaptors/aws.d.mts.map +1 -1
  84. package/dist/adaptors/aws.mjs +91 -191
  85. package/dist/adaptors/aws.mjs.map +1 -1
  86. package/dist/adaptors/hono.cjs +3 -10
  87. package/dist/adaptors/hono.d.cts +7 -16
  88. package/dist/adaptors/hono.d.cts.map +1 -1
  89. package/dist/adaptors/hono.d.mts +8 -17
  90. package/dist/adaptors/hono.d.mts.map +1 -1
  91. package/dist/adaptors/hono.mjs +2 -10
  92. package/dist/adaptors/testing.cjs +711 -89
  93. package/dist/adaptors/testing.cjs.map +1 -1
  94. package/dist/adaptors/testing.d.cts +325 -54
  95. package/dist/adaptors/testing.d.cts.map +1 -1
  96. package/dist/adaptors/testing.d.mts +325 -54
  97. package/dist/adaptors/testing.d.mts.map +1 -1
  98. package/dist/adaptors/testing.mjs +676 -70
  99. package/dist/adaptors/testing.mjs.map +1 -1
  100. package/dist/auth-CIFXNuDk.d.cts +194 -0
  101. package/dist/auth-CIFXNuDk.d.cts.map +1 -0
  102. package/dist/auth-CJ9Ff6Lu.d.mts +194 -0
  103. package/dist/auth-CJ9Ff6Lu.d.mts.map +1 -0
  104. package/dist/auth.cjs +172 -31
  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 +161 -24
  109. package/dist/auth.mjs.map +1 -1
  110. package/dist/{cache-BrRz3fEB.d.mts → cache-CXh6GIgb.d.mts} +3 -6
  111. package/dist/cache-CXh6GIgb.d.mts.map +1 -0
  112. package/dist/{cache-BtZY_tHe.d.cts → cache-DnGDGly3.d.cts} +3 -6
  113. package/dist/cache-DnGDGly3.d.cts.map +1 -0
  114. package/dist/cache.cjs +68 -2
  115. package/dist/cache.cjs.map +1 -0
  116. package/dist/cache.d.cts +1 -2
  117. package/dist/cache.d.mts +1 -2
  118. package/dist/cache.mjs +67 -2
  119. package/dist/cache.mjs.map +1 -0
  120. package/dist/cipher-C1lEFX63.mjs +225 -0
  121. package/dist/cipher-C1lEFX63.mjs.map +1 -0
  122. package/dist/cipher-CVxfwLjk.cjs +332 -0
  123. package/dist/cipher-CVxfwLjk.cjs.map +1 -0
  124. package/dist/{clone-DblgEZZa.mjs → clone-EKNovYHu.mjs} +3 -3
  125. package/dist/clone-EKNovYHu.mjs.map +1 -0
  126. package/dist/{clone-Dy0cR2SZ.cjs → clone-UGJpvQnL.cjs} +7 -8
  127. package/dist/clone-UGJpvQnL.cjs.map +1 -0
  128. package/dist/{construct-interface-D9d4Gm4p.d.cts → construct-interface-B1AfqRl4.d.cts} +42 -11
  129. package/dist/construct-interface-B1AfqRl4.d.cts.map +1 -0
  130. package/dist/{construct-interface-g5GM5pwR.d.mts → construct-interface-DluK3_da.d.mts} +42 -11
  131. package/dist/construct-interface-DluK3_da.d.mts.map +1 -0
  132. package/dist/construct-interface.cjs +113 -7
  133. package/dist/construct-interface.cjs.map +1 -0
  134. package/dist/construct-interface.d.cts +2 -2
  135. package/dist/construct-interface.d.mts +2 -2
  136. package/dist/construct-interface.mjs +106 -2
  137. package/dist/construct-interface.mjs.map +1 -0
  138. package/dist/credential.cjs +63 -16
  139. package/dist/credential.cjs.map +1 -1
  140. package/dist/credential.d.cts +16 -9
  141. package/dist/credential.d.cts.map +1 -1
  142. package/dist/credential.d.mts +16 -9
  143. package/dist/credential.d.mts.map +1 -1
  144. package/dist/credential.mjs +58 -12
  145. package/dist/credential.mjs.map +1 -1
  146. package/dist/crons/index.cjs +105 -7
  147. package/dist/crons/index.cjs.map +1 -1
  148. package/dist/crons/index.d.cts +40 -11
  149. package/dist/crons/index.d.cts.map +1 -1
  150. package/dist/crons/index.d.mts +40 -11
  151. package/dist/crons/index.d.mts.map +1 -1
  152. package/dist/crons/index.mjs +103 -8
  153. package/dist/crons/index.mjs.map +1 -1
  154. package/dist/database/kysely.cjs +4 -181
  155. package/dist/database/kysely.d.cts +2 -152
  156. package/dist/database/kysely.d.mts +2 -152
  157. package/dist/database/kysely.mjs +2 -180
  158. package/dist/email.cjs +25 -12
  159. package/dist/email.cjs.map +1 -1
  160. package/dist/email.d.cts +3 -7
  161. package/dist/email.d.cts.map +1 -1
  162. package/dist/email.d.mts +3 -7
  163. package/dist/email.d.mts.map +1 -1
  164. package/dist/email.mjs +16 -3
  165. package/dist/email.mjs.map +1 -1
  166. package/dist/encryption.cjs +96 -0
  167. package/dist/encryption.cjs.map +1 -0
  168. package/dist/encryption.d.cts +117 -0
  169. package/dist/encryption.d.cts.map +1 -0
  170. package/dist/encryption.d.mts +117 -0
  171. package/dist/encryption.d.mts.map +1 -0
  172. package/dist/encryption.mjs +83 -0
  173. package/dist/encryption.mjs.map +1 -0
  174. package/dist/endpoints/index.cjs +8 -10
  175. package/dist/endpoints/index.d.cts +51 -7
  176. package/dist/endpoints/index.d.cts.map +1 -0
  177. package/dist/endpoints/index.d.mts +51 -7
  178. package/dist/endpoints/index.d.mts.map +1 -0
  179. package/dist/endpoints/index.mjs +6 -10
  180. package/dist/external-api-CWY9orcO.d.mts +86 -0
  181. package/dist/external-api-CWY9orcO.d.mts.map +1 -0
  182. package/dist/external-api-D-5WB-sr.d.cts +86 -0
  183. package/dist/external-api-D-5WB-sr.d.cts.map +1 -0
  184. package/dist/external-api.cjs +124 -0
  185. package/dist/external-api.cjs.map +1 -0
  186. package/dist/external-api.d.cts +2 -0
  187. package/dist/external-api.d.mts +2 -0
  188. package/dist/external-api.mjs +121 -0
  189. package/dist/external-api.mjs.map +1 -0
  190. package/dist/file-server.cjs +42 -10
  191. package/dist/file-server.cjs.map +1 -1
  192. package/dist/file-server.d.cts +6 -10
  193. package/dist/file-server.d.cts.map +1 -1
  194. package/dist/file-server.d.mts +6 -10
  195. package/dist/file-server.d.mts.map +1 -1
  196. package/dist/file-server.mjs +34 -2
  197. package/dist/file-server.mjs.map +1 -1
  198. package/dist/functions/index.cjs +3 -6
  199. package/dist/functions/index.d.cts +3 -4
  200. package/dist/functions/index.d.mts +3 -4
  201. package/dist/functions/index.mjs +2 -6
  202. package/dist/{functions-i_la-N5r.cjs → functions-CbP5ZKma.cjs} +414 -264
  203. package/dist/functions-CbP5ZKma.cjs.map +1 -0
  204. package/dist/{functions-14lpEFL4.mjs → functions-Di6n5ltG.mjs} +376 -238
  205. package/dist/{functions-14lpEFL4.mjs.map → functions-Di6n5ltG.mjs.map} +1 -1
  206. package/dist/index-BuzRvKOQ.d.cts +115 -0
  207. package/dist/index-BuzRvKOQ.d.cts.map +1 -0
  208. package/dist/index-CTkKOer4.d.mts +115 -0
  209. package/dist/index-CTkKOer4.d.mts.map +1 -0
  210. package/dist/index-CeEtxDmK.d.cts +79 -0
  211. package/dist/index-CeEtxDmK.d.cts.map +1 -0
  212. package/dist/index-CeEtxDmK.d.mts +79 -0
  213. package/dist/index-CeEtxDmK.d.mts.map +1 -0
  214. package/dist/index.cjs +6 -3
  215. package/dist/index.d.cts +26 -4
  216. package/dist/index.d.cts.map +1 -0
  217. package/dist/index.d.mts +26 -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-BEm5sDlU.d.cts +173 -0
  225. package/dist/kysely-BEm5sDlU.d.cts.map +1 -0
  226. package/dist/kysely-BRzzawr2.cjs +301 -0
  227. package/dist/kysely-BRzzawr2.cjs.map +1 -0
  228. package/dist/kysely-BYfM6Zby.mjs +288 -0
  229. package/dist/kysely-BYfM6Zby.mjs.map +1 -0
  230. package/dist/kysely-CjuvdXEV.d.mts +173 -0
  231. package/dist/kysely-CjuvdXEV.d.mts.map +1 -0
  232. package/dist/{lazyAccessors-BoJN3SMd.mjs → lazyAccessors-CFanua0O.mjs} +20 -60
  233. package/dist/lazyAccessors-CFanua0O.mjs.map +1 -0
  234. package/dist/{lazyAccessors-e3j2oE2m.cjs → lazyAccessors-hJKGv8Ay.cjs} +60 -113
  235. package/dist/lazyAccessors-hJKGv8Ay.cjs.map +1 -0
  236. package/dist/mobile-app.cjs +73 -0
  237. package/dist/mobile-app.cjs.map +1 -0
  238. package/dist/mobile-app.d.cts +61 -0
  239. package/dist/mobile-app.d.cts.map +1 -0
  240. package/dist/mobile-app.d.mts +61 -0
  241. package/dist/mobile-app.d.mts.map +1 -0
  242. package/dist/mobile-app.mjs +72 -0
  243. package/dist/mobile-app.mjs.map +1 -0
  244. package/dist/object-storage.cjs +18 -10
  245. package/dist/object-storage.cjs.map +1 -1
  246. package/dist/object-storage.d.cts +3 -7
  247. package/dist/object-storage.d.cts.map +1 -1
  248. package/dist/object-storage.d.mts +3 -7
  249. package/dist/object-storage.d.mts.map +1 -1
  250. package/dist/object-storage.mjs +11 -3
  251. package/dist/object-storage.mjs.map +1 -1
  252. package/dist/{processAudits-Dmts9H_b.mjs → processAudits-BpRlPQMW.mjs} +16 -19
  253. package/dist/processAudits-BpRlPQMW.mjs.map +1 -0
  254. package/dist/{processAudits-CGqttuXm.cjs → processAudits-D_2W5x8k.cjs} +26 -30
  255. package/dist/processAudits-D_2W5x8k.cjs.map +1 -0
  256. package/dist/queue/index.cjs +6 -189
  257. package/dist/queue/index.d.cts +3 -60
  258. package/dist/queue/index.d.mts +3 -60
  259. package/dist/queue/index.mjs +3 -186
  260. package/dist/rest-api.cjs +88 -63
  261. package/dist/rest-api.cjs.map +1 -1
  262. package/dist/rest-api.d.cts +68 -61
  263. package/dist/rest-api.d.cts.map +1 -1
  264. package/dist/rest-api.d.mts +68 -61
  265. package/dist/rest-api.d.mts.map +1 -1
  266. package/dist/rest-api.mjs +80 -55
  267. package/dist/rest-api.mjs.map +1 -1
  268. package/dist/{chunk-DWy1uDak.cjs → rolldown-runtime-y5ARvAq5.cjs} +14 -18
  269. package/dist/runSubscriber-BRp9a_qi.cjs +126 -0
  270. package/dist/runSubscriber-BRp9a_qi.cjs.map +1 -0
  271. package/dist/runSubscriber-BYEY_bfA.mjs +109 -0
  272. package/dist/runSubscriber-BYEY_bfA.mjs.map +1 -0
  273. package/dist/shutdown-BMJmAhSt.cjs +38 -0
  274. package/dist/shutdown-BMJmAhSt.cjs.map +1 -0
  275. package/dist/shutdown-C7xa8x9S.mjs +27 -0
  276. package/dist/shutdown-C7xa8x9S.mjs.map +1 -0
  277. package/dist/site.cjs +34 -9
  278. package/dist/site.cjs.map +1 -1
  279. package/dist/site.d.cts +17 -22
  280. package/dist/site.d.cts.map +1 -1
  281. package/dist/site.d.mts +17 -22
  282. package/dist/site.d.mts.map +1 -1
  283. package/dist/site.mjs +30 -5
  284. package/dist/site.mjs.map +1 -1
  285. package/dist/subscribers/index.cjs +111 -6
  286. package/dist/subscribers/index.cjs.map +1 -0
  287. package/dist/subscribers/index.d.cts +50 -6
  288. package/dist/subscribers/index.d.cts.map +1 -0
  289. package/dist/subscribers/index.d.mts +50 -6
  290. package/dist/subscribers/index.d.mts.map +1 -0
  291. package/dist/subscribers/index.mjs +108 -5
  292. package/dist/subscribers/index.mjs.map +1 -0
  293. package/dist/surfaceEnv-CNimK76p.cjs +56 -0
  294. package/dist/surfaceEnv-CNimK76p.cjs.map +1 -0
  295. package/dist/surfaceEnv-wMT5QzgZ.mjs +45 -0
  296. package/dist/surfaceEnv-wMT5QzgZ.mjs.map +1 -0
  297. package/dist/{telemetry-C3L0iS28.d.cts → telemetry-DGcFlVpB.d.cts} +2 -5
  298. package/dist/telemetry-DGcFlVpB.d.cts.map +1 -0
  299. package/dist/{telemetry-D7bVFLGi.d.mts → telemetry-DGcFlVpB.d.mts} +2 -5
  300. package/dist/telemetry-DGcFlVpB.d.mts.map +1 -0
  301. package/dist/topic/index.cjs +3 -137
  302. package/dist/topic/index.d.cts +2 -4
  303. package/dist/topic/index.d.mts +2 -4
  304. package/dist/topic/index.mjs +2 -134
  305. package/dist/{types-BlAkSuGI.d.cts → types-DMuSQeLL.d.cts} +3 -5
  306. package/dist/types-DMuSQeLL.d.cts.map +1 -0
  307. package/dist/{types-aKksMEWL.d.mts → types-DMuSQeLL.d.mts} +3 -5
  308. package/dist/types-DMuSQeLL.d.mts.map +1 -0
  309. package/dist/types.d.cts +1 -1
  310. package/dist/types.d.mts +1 -1
  311. package/dist/types.mjs +1 -0
  312. package/dist/worker.cjs +58 -34
  313. package/dist/worker.cjs.map +1 -1
  314. package/dist/worker.d.cts +63 -45
  315. package/dist/worker.d.cts.map +1 -1
  316. package/dist/worker.d.mts +63 -44
  317. package/dist/worker.d.mts.map +1 -1
  318. package/dist/worker.mjs +53 -29
  319. package/dist/worker.mjs.map +1 -1
  320. package/package.json +82 -41
  321. package/dist/Construct-BD5neF7w.mjs.map +0 -1
  322. package/dist/Construct-C0ijr2qp.d.cts +0 -117
  323. package/dist/Construct-C0ijr2qp.d.cts.map +0 -1
  324. package/dist/Construct-Ct8nalEi.d.mts +0 -117
  325. package/dist/Construct-Ct8nalEi.d.mts.map +0 -1
  326. package/dist/Construct-CyS3RpTL.cjs.map +0 -1
  327. package/dist/Cron-DmQ8vQ4b.d.cts.map +0 -1
  328. package/dist/Cron-dh4rUgib.d.mts.map +0 -1
  329. package/dist/CronBuilder-BquXDbDI.d.cts +0 -44
  330. package/dist/CronBuilder-BquXDbDI.d.cts.map +0 -1
  331. package/dist/CronBuilder-CGgY2080.d.mts +0 -44
  332. package/dist/CronBuilder-CGgY2080.d.mts.map +0 -1
  333. package/dist/CronBuilder-CYKT5RiO.mjs.map +0 -1
  334. package/dist/CronBuilder-Da0C0edR.cjs.map +0 -1
  335. package/dist/Endpoint-BjWKinFA.d.mts.map +0 -1
  336. package/dist/Endpoint-DCQPMdUX.mjs.map +0 -1
  337. package/dist/Endpoint-DcWXE-SZ.cjs.map +0 -1
  338. package/dist/Endpoint-dav89W6-.d.cts.map +0 -1
  339. package/dist/EndpointFactory-CdWB7wPw.cjs.map +0 -1
  340. package/dist/EndpointFactory-CjV8F_lJ.mjs.map +0 -1
  341. package/dist/HonoEndpointAdaptor-DtL9j19R.cjs.map +0 -1
  342. package/dist/HonoEndpointAdaptor-P1ahhZHu.mjs.map +0 -1
  343. package/dist/Queue-D7ZuwBhy.d.cts.map +0 -1
  344. package/dist/Queue-gVGfi2Yk.d.mts.map +0 -1
  345. package/dist/Subscriber-2mEi0ImH.d.cts.map +0 -1
  346. package/dist/Subscriber-xTJ9ayPN.d.mts.map +0 -1
  347. package/dist/SubscriberBuilder-4OPehf2R.cjs.map +0 -1
  348. package/dist/SubscriberBuilder-BjkbeT9l.mjs.map +0 -1
  349. package/dist/SubscriberBuilder-Dptmo-1A.d.mts +0 -62
  350. package/dist/SubscriberBuilder-Dptmo-1A.d.mts.map +0 -1
  351. package/dist/SubscriberBuilder-waNhzjSM.d.cts +0 -62
  352. package/dist/SubscriberBuilder-waNhzjSM.d.cts.map +0 -1
  353. package/dist/Topic-19QeHBIR.d.cts +0 -91
  354. package/dist/Topic-19QeHBIR.d.cts.map +0 -1
  355. package/dist/Topic-DuFeqkBh.d.mts +0 -91
  356. package/dist/Topic-DuFeqkBh.d.mts.map +0 -1
  357. package/dist/auth.d.cts.map +0 -1
  358. package/dist/auth.d.mts.map +0 -1
  359. package/dist/cache-0ANvRQnD.mjs +0 -51
  360. package/dist/cache-0ANvRQnD.mjs.map +0 -1
  361. package/dist/cache-3WSvAulx.cjs +0 -57
  362. package/dist/cache-3WSvAulx.cjs.map +0 -1
  363. package/dist/cache-BrRz3fEB.d.mts.map +0 -1
  364. package/dist/cache-BtZY_tHe.d.cts.map +0 -1
  365. package/dist/clone-DblgEZZa.mjs.map +0 -1
  366. package/dist/clone-Dy0cR2SZ.cjs.map +0 -1
  367. package/dist/construct-interface-BfjcOD_E.cjs +0 -117
  368. package/dist/construct-interface-BfjcOD_E.cjs.map +0 -1
  369. package/dist/construct-interface-D9d4Gm4p.d.cts.map +0 -1
  370. package/dist/construct-interface-Z4CpS8tK.mjs +0 -81
  371. package/dist/construct-interface-Z4CpS8tK.mjs.map +0 -1
  372. package/dist/construct-interface-g5GM5pwR.d.mts.map +0 -1
  373. package/dist/database/kysely.cjs.map +0 -1
  374. package/dist/database/kysely.d.cts.map +0 -1
  375. package/dist/database/kysely.d.mts.map +0 -1
  376. package/dist/database/kysely.mjs.map +0 -1
  377. package/dist/functions-i_la-N5r.cjs.map +0 -1
  378. package/dist/index-Bd5FqCoe.d.cts.map +0 -1
  379. package/dist/index-BknhM6Ux.d.mts +0 -31
  380. package/dist/index-BknhM6Ux.d.mts.map +0 -1
  381. package/dist/index-CBSfrowv.d.cts +0 -31
  382. package/dist/index-CBSfrowv.d.cts.map +0 -1
  383. package/dist/index-D24Xm79M.d.cts +0 -171
  384. package/dist/index-D24Xm79M.d.cts.map +0 -1
  385. package/dist/index-_ajboYxK.d.mts +0 -171
  386. package/dist/index-_ajboYxK.d.mts.map +0 -1
  387. package/dist/index-lAO9egTb.d.mts.map +0 -1
  388. package/dist/lazyAccessors-BoJN3SMd.mjs.map +0 -1
  389. package/dist/lazyAccessors-e3j2oE2m.cjs.map +0 -1
  390. package/dist/processAudits-CGqttuXm.cjs.map +0 -1
  391. package/dist/processAudits-Dmts9H_b.mjs.map +0 -1
  392. package/dist/queue/index.cjs.map +0 -1
  393. package/dist/queue/index.d.cts.map +0 -1
  394. package/dist/queue/index.d.mts.map +0 -1
  395. package/dist/queue/index.mjs.map +0 -1
  396. package/dist/surfaceEnv-BFXEms2f.cjs +0 -39
  397. package/dist/surfaceEnv-BFXEms2f.cjs.map +0 -1
  398. package/dist/surfaceEnv-C3Ktahea.mjs +0 -27
  399. package/dist/surfaceEnv-C3Ktahea.mjs.map +0 -1
  400. package/dist/telemetry-C3L0iS28.d.cts.map +0 -1
  401. package/dist/telemetry-D7bVFLGi.d.mts.map +0 -1
  402. package/dist/topic/index.cjs.map +0 -1
  403. package/dist/topic/index.mjs.map +0 -1
  404. package/dist/types-BlAkSuGI.d.cts.map +0 -1
  405. package/dist/types-aKksMEWL.d.mts.map +0 -1
package/dist/site.d.cts CHANGED
@@ -1,29 +1,26 @@
1
- import { Declarable } from "./construct-interface-D9d4Gm4p.cjs";
1
+ import { i as Declarable } from "./construct-interface-B1AfqRl4.cjs";
2
2
  import { ConstructName, Declaration, Dependency, SiteDeclaration } from "@geekmidas/manifest";
3
-
4
3
  //#region src/site.d.ts
5
-
6
4
  /**
7
- * A site's config is flat, where a surface's nests its `app`.
5
+ * Where a site's source lives, and the little else a layout can differ by.
8
6
  *
9
- * Not an inconsistency: a `RestApi` may or may not have a process of its own,
10
- * so "what the surface is" and "how its process is built" are separable there
11
- * and worth separating. A site *is* its app — there is nothing to separate it
12
- * from, and `{ app: { path } }` would be a wrapper around the only thing in it.
13
- *
14
- * Every field is optional, so `new StaticSite('Web')` is a complete site.
7
+ * Only `path` is required: `new StaticSite('Web', { path: 'apps/web' })` is a
8
+ * complete site.
15
9
  */
16
- interface StaticSiteConfig {
10
+ export interface StaticSiteConfig {
17
11
  /**
18
- * Where its source lives, relative to the workspace root.
19
- *
20
- * Optional, and normally omitted: `apps/<kebab-id>` where that directory
21
- * exists, and the workspace root otherwise. `StaticSite('Web')` means
22
- * `apps/web`, which is the thing the id already said.
12
+ * Where its source lives, relative to the workspace root — `'apps/web'`.
23
13
  *
24
- * Worth writing only when the layout differs — `path: 'sites/marketing'`.
14
+ * Required, the same field `RestApi` and `BetterAuth` take. It was
15
+ * inferred from the id, which made a site's home whatever was on disk.
16
+ */
17
+ path: string;
18
+ /**
19
+ * The label it answers on under a stage's domain — `api` for
20
+ * `api.myapp.com`, from `deploy.domains` — and under the project locally,
21
+ * `api.myapp.localhost`. Absent, its id kebab-cased.
25
22
  */
26
- path?: string;
23
+ subdomain?: string;
27
24
  /**
28
25
  * The port it answers on locally.
29
26
  *
@@ -60,7 +57,7 @@ interface StaticSiteConfig {
60
57
  */
61
58
  variant?: SiteDeclaration['variant'];
62
59
  }
63
- declare class StaticSite<TName extends string = string> implements Declarable<TName> {
60
+ export declare class StaticSite<TName extends string = string> implements Declarable<TName> {
64
61
  private readonly config;
65
62
  /**
66
63
  * Internal: how `.dependsOn()` carries edges into the copy it returns.
@@ -73,7 +70,7 @@ declare class StaticSite<TName extends string = string> implements Declarable<TN
73
70
  readonly keys: {
74
71
  url: string;
75
72
  };
76
- constructor(id: ConstructName<TName>, config?: StaticSiteConfig,
73
+ constructor(id: ConstructName<TName>, config: StaticSiteConfig,
77
74
  /**
78
75
  * Internal: how `.dependsOn()` carries edges into the copy it returns.
79
76
  * Written as a parameter rather than a mutable field so the builder can
@@ -95,7 +92,5 @@ declare class StaticSite<TName extends string = string> implements Declarable<TN
95
92
  dependsOn(constructs: readonly Declarable[]): StaticSite<TName>;
96
93
  declare(): Declaration[];
97
94
  }
98
- //# sourceMappingURL=site.d.ts.map
99
95
  //#endregion
100
- export { StaticSite, StaticSiteConfig };
101
96
  //# sourceMappingURL=site.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"site.d.cts","names":[],"sources":["../src/site.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;UA4CiB,gBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA0CN;;cAGE,qDACD,WAAW;;;;;;;;;eAET;;;;kBAIR,cAAc,iBACO;;;;;;;0BAOe;;;;;;;;;;;;iCAiBV,eAAe,WAAW;aAO9C"}
1
+ {"version":3,"file":"site.d.cts","names":[],"sources":["../src/site.ts"],"mappings":";;;;;;;;;iBAwCiB;;;;;;;EAOhB;;;;;;EAMA;;;;;;;EAOA;;;;;;;EAOA;IAAW;IAAiB;;;;;;;;;;EAS5B;;;;;;;;;EASA,UAAU;;qBAGE,WAAW,0CACZ,WAAW;mBAOJ;;;;;;;mBAOA;WAZT,IAAI;WACJ;IAAQ;;EAEjB,YACC,IAAI,cAAc,QACD,QAAQ,kBAOR;;;;;;;EAAA,wBAAuB;;;;;;;;;;;;EAiBzC,UAAU,qBAAqB,eAAe,WAAW;EAOzD,WAAW"}
package/dist/site.d.mts CHANGED
@@ -1,29 +1,26 @@
1
- import { Declarable } from "./construct-interface-g5GM5pwR.mjs";
1
+ import { i as Declarable } from "./construct-interface-DluK3_da.mjs";
2
2
  import { ConstructName, Declaration, Dependency, SiteDeclaration } from "@geekmidas/manifest";
3
-
4
3
  //#region src/site.d.ts
5
-
6
4
  /**
7
- * A site's config is flat, where a surface's nests its `app`.
5
+ * Where a site's source lives, and the little else a layout can differ by.
8
6
  *
9
- * Not an inconsistency: a `RestApi` may or may not have a process of its own,
10
- * so "what the surface is" and "how its process is built" are separable there
11
- * and worth separating. A site *is* its app — there is nothing to separate it
12
- * from, and `{ app: { path } }` would be a wrapper around the only thing in it.
13
- *
14
- * Every field is optional, so `new StaticSite('Web')` is a complete site.
7
+ * Only `path` is required: `new StaticSite('Web', { path: 'apps/web' })` is a
8
+ * complete site.
15
9
  */
16
- interface StaticSiteConfig {
10
+ export interface StaticSiteConfig {
17
11
  /**
18
- * Where its source lives, relative to the workspace root.
19
- *
20
- * Optional, and normally omitted: `apps/<kebab-id>` where that directory
21
- * exists, and the workspace root otherwise. `StaticSite('Web')` means
22
- * `apps/web`, which is the thing the id already said.
12
+ * Where its source lives, relative to the workspace root — `'apps/web'`.
23
13
  *
24
- * Worth writing only when the layout differs — `path: 'sites/marketing'`.
14
+ * Required, the same field `RestApi` and `BetterAuth` take. It was
15
+ * inferred from the id, which made a site's home whatever was on disk.
16
+ */
17
+ path: string;
18
+ /**
19
+ * The label it answers on under a stage's domain — `api` for
20
+ * `api.myapp.com`, from `deploy.domains` — and under the project locally,
21
+ * `api.myapp.localhost`. Absent, its id kebab-cased.
25
22
  */
26
- path?: string;
23
+ subdomain?: string;
27
24
  /**
28
25
  * The port it answers on locally.
29
26
  *
@@ -60,7 +57,7 @@ interface StaticSiteConfig {
60
57
  */
61
58
  variant?: SiteDeclaration['variant'];
62
59
  }
63
- declare class StaticSite<TName extends string = string> implements Declarable<TName> {
60
+ export declare class StaticSite<TName extends string = string> implements Declarable<TName> {
64
61
  private readonly config;
65
62
  /**
66
63
  * Internal: how `.dependsOn()` carries edges into the copy it returns.
@@ -73,7 +70,7 @@ declare class StaticSite<TName extends string = string> implements Declarable<TN
73
70
  readonly keys: {
74
71
  url: string;
75
72
  };
76
- constructor(id: ConstructName<TName>, config?: StaticSiteConfig,
73
+ constructor(id: ConstructName<TName>, config: StaticSiteConfig,
77
74
  /**
78
75
  * Internal: how `.dependsOn()` carries edges into the copy it returns.
79
76
  * Written as a parameter rather than a mutable field so the builder can
@@ -95,7 +92,5 @@ declare class StaticSite<TName extends string = string> implements Declarable<TN
95
92
  dependsOn(constructs: readonly Declarable[]): StaticSite<TName>;
96
93
  declare(): Declaration[];
97
94
  }
98
- //# sourceMappingURL=site.d.ts.map
99
95
  //#endregion
100
- export { StaticSite, StaticSiteConfig };
101
96
  //# sourceMappingURL=site.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"site.d.mts","names":[],"sources":["../src/site.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;UA4CiB,gBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA0CN;;cAGE,qDACD,WAAW;;;;;;;;;eAET;;;;kBAIR,cAAc,iBACO;;;;;;;0BAOe;;;;;;;;;;;;iCAiBV,eAAe,WAAW;aAO9C"}
1
+ {"version":3,"file":"site.d.mts","names":[],"sources":["../src/site.ts"],"mappings":";;;;;;;;;iBAwCiB;;;;;;;EAOhB;;;;;;EAMA;;;;;;;EAOA;;;;;;;EAOA;IAAW;IAAiB;;;;;;;;;;EAS5B;;;;;;;;;EASA,UAAU;;qBAGE,WAAW,0CACZ,WAAW;mBAOJ;;;;;;;mBAOA;WAZT,IAAI;WACJ;IAAQ;;EAEjB,YACC,IAAI,cAAc,QACD,QAAQ,kBAOR;;;;;;;EAAA,wBAAuB;;;;;;;;;;;;EAiBzC,UAAU,qBAAqB,eAAe,WAAW;EAOzD,WAAW"}
package/dist/site.mjs CHANGED
@@ -1,11 +1,35 @@
1
- import { edgeTo } from "./construct-interface-Z4CpS8tK.mjs";
1
+ import { edgeTo } from "./construct-interface.mjs";
2
2
  import { canonicalId, provideKey } from "@geekmidas/manifest";
3
-
4
3
  //#region src/site.ts
4
+ /**
5
+ * `StaticSite` — a frontend, declared like anything else.
6
+ *
7
+ * The point is not that a site needs provisioning; it is that a site is the
8
+ * *consumer* whose edges make four hand-maintained lists derivable. Declaring it
9
+ * is what turns "which origins does the API allow" from something a person keeps
10
+ * in step into something the graph already knows.
11
+ *
12
+ * ```ts
13
+ * export const console = new StaticSite('Console', { path: 'apps/console' })
14
+ * .dependsOn([api, auth]);
15
+ * ```
16
+ *
17
+ * It has no `.service`. A site is not a process that registers clients — it is
18
+ * built, and the values it needs are inlined or fetched by its own framework —
19
+ * so the edge is {@link Declarable} rather than {@link Consumable}, and the
20
+ * asymmetry is the honest one: a site consumes addresses, not connections.
21
+ *
22
+ * Only the static variant ships. SSR deploy shapes are unstable and each one is
23
+ * its own maintenance, so they follow rather than arrive together. A mobile app
24
+ * is not a site — it is reached by a scheme, not a URL — and is its own
25
+ * construct: see `MobileApp`.
26
+ */
5
27
  var StaticSite = class StaticSite {
28
+ config;
29
+ dependencies;
6
30
  id;
7
31
  keys;
8
- constructor(id, config = {}, dependencies = []) {
32
+ constructor(id, config, dependencies = []) {
9
33
  this.config = config;
10
34
  this.dependencies = dependencies;
11
35
  this.id = canonicalId(id);
@@ -30,8 +54,9 @@ var StaticSite = class StaticSite {
30
54
  kind: "site",
31
55
  id: this.id,
32
56
  variant: this.config.variant ?? "static",
57
+ ...this.config.subdomain ? { subdomain: this.config.subdomain } : {},
33
58
  app: {
34
- ...this.config.path ? { path: this.config.path } : {},
59
+ path: this.config.path,
35
60
  ...this.config.port ? { port: this.config.port } : {},
36
61
  ...this.config.config ? { config: this.config.config } : {}
37
62
  },
@@ -41,7 +66,7 @@ var StaticSite = class StaticSite {
41
66
  }];
42
67
  }
43
68
  };
44
-
45
69
  //#endregion
46
70
  export { StaticSite };
71
+
47
72
  //# sourceMappingURL=site.mjs.map
package/dist/site.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"site.mjs","names":["id: ConstructName<TName>","config: StaticSiteConfig","dependencies: readonly Dependency[]","constructs: readonly Declarable[]"],"sources":["../src/site.ts"],"sourcesContent":["/**\n * `StaticSite` — a frontend, declared like anything else.\n *\n * The point is not that a site needs provisioning; it is that a site is the\n * *consumer* whose edges make four hand-maintained lists derivable. Declaring it\n * is what turns \"which origins does the API allow\" from something a person keeps\n * in step into something the graph already knows.\n *\n * ```ts\n * export const console = new StaticSite('Console', { path: 'apps/console' })\n * .dependsOn([api, auth]);\n * ```\n *\n * It has no `.service`. A site is not a process that registers clients — it is\n * built, and the values it needs are inlined or fetched by its own framework —\n * so the edge is {@link Declarable} rather than {@link Consumable}, and the\n * asymmetry is the honest one: a site consumes addresses, not connections.\n *\n * Only the static variant ships. SSR deploy shapes are unstable and each one is\n * its own maintenance, so they follow rather than arrive together; Expo and\n * mobile are out of scope entirely, because an app store is not infrastructure\n * and there is no URL to hand anyone.\n */\n\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\ttype Dependency,\n\tprovideKey,\n\ttype SiteDeclaration,\n} from '@geekmidas/manifest';\nimport { type Declarable, edgeTo } from './construct-interface';\n\n/**\n * A site's config is flat, where a surface's nests its `app`.\n *\n * Not an inconsistency: a `RestApi` may or may not have a process of its own,\n * so \"what the surface is\" and \"how its process is built\" are separable there\n * and worth separating. A site *is* its app — there is nothing to separate it\n * from, and `{ app: { path } }` would be a wrapper around the only thing in it.\n *\n * Every field is optional, so `new StaticSite('Web')` is a complete site.\n */\nexport interface StaticSiteConfig {\n\t/**\n\t * Where its source lives, relative to the workspace root.\n\t *\n\t * Optional, and normally omitted: `apps/<kebab-id>` where that directory\n\t * exists, and the workspace root otherwise. `StaticSite('Web')` means\n\t * `apps/web`, which is the thing the id already said.\n\t *\n\t * Worth writing only when the layout differs — `path: 'sites/marketing'`.\n\t */\n\tpath?: string;\n\t/**\n\t * The port it answers on locally.\n\t *\n\t * Normally omitted: ports are assigned in a stable order, so adding a site\n\t * does not renumber the ones already running.\n\t */\n\tport?: number;\n\t/**\n\t * Modules to import when sniffing which env vars this site reads.\n\t *\n\t * A frontend's values are inlined at build time, so the build has to know\n\t * which ones it reads before it reads them.\n\t */\n\tconfig?: { client?: string; server?: string };\n\t/**\n\t * Whether the base domain points at this site.\n\t *\n\t * A project with one site needs this no more than a project with one\n\t * database needs to say which database. It matters when there are several\n\t * and none is called `web`: the base domain then belongs to whichever site\n\t * says so, rather than to whichever file the glob happened to reach first.\n\t */\n\troot?: boolean;\n\t/**\n\t * Which framework builds it.\n\t *\n\t * It selects how values are delivered — `VITE_`, `NEXT_PUBLIC_`, a fetched\n\t * `config.json` — and never which values there are. One neutral name from the\n\t * construct, one serialisation per framework, the same rule as everywhere\n\t * else.\n\t */\n\tvariant?: SiteDeclaration['variant'];\n}\n\nexport class StaticSite<TName extends string = string>\n\timplements Declarable<TName>\n{\n\treadonly id: TName;\n\treadonly keys: { url: string };\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly config: StaticSiteConfig = {},\n\t\t/**\n\t\t * Internal: how `.dependsOn()` carries edges into the copy it returns.\n\t\t * Written as a parameter rather than a mutable field so the builder can\n\t\t * stay immutable without a clone method, the same shape\n\t\t * `KyselyDatabase` uses for its derived forms.\n\t\t */\n\t\tprivate readonly dependencies: readonly Dependency[] = [],\n\t) {\n\t\tthis.id = canonicalId(id as string) as TName;\n\t\tthis.keys = { url: provideKey(this.id, 'url') };\n\t}\n\n\t/**\n\t * What this site calls.\n\t *\n\t * Immutable, like every other builder here: it returns a new site rather than\n\t * mutating this one, so a module that exports both a base and a variant of it\n\t * cannot have the second silently change the first.\n\t *\n\t * Takes {@link Declarable} rather than {@link Consumable} because a site's\n\t * edge is a build-time link and not a service injection — requiring a client\n\t * would exclude exactly the surfaces a frontend actually depends on.\n\t */\n\tdependsOn(constructs: readonly Declarable[]): StaticSite<TName> {\n\t\treturn new StaticSite<TName>(this.id as ConstructName<TName>, this.config, [\n\t\t\t...this.dependencies,\n\t\t\t...constructs.map(edgeTo),\n\t\t]);\n\t}\n\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'site',\n\t\t\t\tid: this.id,\n\t\t\t\tvariant: this.config.variant ?? 'static',\n\t\t\t\tapp: {\n\t\t\t\t\t...(this.config.path ? { path: this.config.path } : {}),\n\t\t\t\t\t...(this.config.port ? { port: this.config.port } : {}),\n\t\t\t\t\t...(this.config.config ? { config: this.config.config } : {}),\n\t\t\t\t},\n\t\t\t\t...(this.config.root ? { root: true } : {}),\n\t\t\t\tdependencies: this.dependencies,\n\t\t\t\tprovides: [this.keys.url],\n\t\t\t},\n\t\t];\n\t}\n}\n"],"mappings":";;;;AAyFA,IAAa,aAAb,MAAa,WAEb;CACC,AAAS;CACT,AAAS;CAET,YACCA,IACiBC,SAA2B,CAAE,GAO7BC,eAAsC,CAAE,GACxD;EARgB;EAOA;AAEjB,OAAK,KAAK,YAAY,GAAa;AACnC,OAAK,OAAO,EAAE,KAAK,WAAW,KAAK,IAAI,MAAM,CAAE;CAC/C;;;;;;;;;;;;CAaD,UAAUC,YAAsD;AAC/D,SAAO,IAAI,WAAkB,KAAK,IAA4B,KAAK,QAAQ,CAC1E,GAAG,KAAK,cACR,GAAG,WAAW,IAAI,OAAO,AACzB;CACD;CAED,UAAyB;AACxB,SAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,SAAS,KAAK,OAAO,WAAW;GAChC,KAAK;IACJ,GAAI,KAAK,OAAO,OAAO,EAAE,MAAM,KAAK,OAAO,KAAM,IAAG,CAAE;IACtD,GAAI,KAAK,OAAO,OAAO,EAAE,MAAM,KAAK,OAAO,KAAM,IAAG,CAAE;IACtD,GAAI,KAAK,OAAO,SAAS,EAAE,QAAQ,KAAK,OAAO,OAAQ,IAAG,CAAE;GAC5D;GACD,GAAI,KAAK,OAAO,OAAO,EAAE,MAAM,KAAM,IAAG,CAAE;GAC1C,cAAc,KAAK;GACnB,UAAU,CAAC,KAAK,KAAK,GAAI;EACzB,CACD;CACD;AACD"}
1
+ {"version":3,"file":"site.mjs","names":[],"sources":["../src/site.ts"],"sourcesContent":["/**\n * `StaticSite` — a frontend, declared like anything else.\n *\n * The point is not that a site needs provisioning; it is that a site is the\n * *consumer* whose edges make four hand-maintained lists derivable. Declaring it\n * is what turns \"which origins does the API allow\" from something a person keeps\n * in step into something the graph already knows.\n *\n * ```ts\n * export const console = new StaticSite('Console', { path: 'apps/console' })\n * .dependsOn([api, auth]);\n * ```\n *\n * It has no `.service`. A site is not a process that registers clients — it is\n * built, and the values it needs are inlined or fetched by its own framework —\n * so the edge is {@link Declarable} rather than {@link Consumable}, and the\n * asymmetry is the honest one: a site consumes addresses, not connections.\n *\n * Only the static variant ships. SSR deploy shapes are unstable and each one is\n * its own maintenance, so they follow rather than arrive together. A mobile app\n * is not a site — it is reached by a scheme, not a URL — and is its own\n * construct: see `MobileApp`.\n */\n\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\ttype Dependency,\n\tprovideKey,\n\ttype SiteDeclaration,\n} from '@geekmidas/manifest';\nimport { type Declarable, edgeTo } from './construct-interface';\n\n/**\n * Where a site's source lives, and the little else a layout can differ by.\n *\n * Only `path` is required: `new StaticSite('Web', { path: 'apps/web' })` is a\n * complete site.\n */\nexport interface StaticSiteConfig {\n\t/**\n\t * Where its source lives, relative to the workspace root — `'apps/web'`.\n\t *\n\t * Required, the same field `RestApi` and `BetterAuth` take. It was\n\t * inferred from the id, which made a site's home whatever was on disk.\n\t */\n\tpath: string;\n\t/**\n\t * The label it answers on under a stage's domain — `api` for\n\t * `api.myapp.com`, from `deploy.domains` — and under the project locally,\n\t * `api.myapp.localhost`. Absent, its id kebab-cased.\n\t */\n\tsubdomain?: string;\n\t/**\n\t * The port it answers on locally.\n\t *\n\t * Normally omitted: ports are assigned in a stable order, so adding a site\n\t * does not renumber the ones already running.\n\t */\n\tport?: number;\n\t/**\n\t * Modules to import when sniffing which env vars this site reads.\n\t *\n\t * A frontend's values are inlined at build time, so the build has to know\n\t * which ones it reads before it reads them.\n\t */\n\tconfig?: { client?: string; server?: string };\n\t/**\n\t * Whether the base domain points at this site.\n\t *\n\t * A project with one site needs this no more than a project with one\n\t * database needs to say which database. It matters when there are several\n\t * and none is called `web`: the base domain then belongs to whichever site\n\t * says so, rather than to whichever file the glob happened to reach first.\n\t */\n\troot?: boolean;\n\t/**\n\t * Which framework builds it.\n\t *\n\t * It selects how values are delivered — `VITE_`, `NEXT_PUBLIC_`, a fetched\n\t * `config.json` — and never which values there are. One neutral name from the\n\t * construct, one serialisation per framework, the same rule as everywhere\n\t * else.\n\t */\n\tvariant?: SiteDeclaration['variant'];\n}\n\nexport class StaticSite<TName extends string = string>\n\timplements Declarable<TName>\n{\n\treadonly id: TName;\n\treadonly keys: { url: string };\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly config: StaticSiteConfig,\n\t\t/**\n\t\t * Internal: how `.dependsOn()` carries edges into the copy it returns.\n\t\t * Written as a parameter rather than a mutable field so the builder can\n\t\t * stay immutable without a clone method, the same shape\n\t\t * `KyselyDatabase` uses for its derived forms.\n\t\t */\n\t\tprivate readonly dependencies: readonly Dependency[] = [],\n\t) {\n\t\tthis.id = canonicalId(id as string) as TName;\n\t\tthis.keys = { url: provideKey(this.id, 'url') };\n\t}\n\n\t/**\n\t * What this site calls.\n\t *\n\t * Immutable, like every other builder here: it returns a new site rather than\n\t * mutating this one, so a module that exports both a base and a variant of it\n\t * cannot have the second silently change the first.\n\t *\n\t * Takes {@link Declarable} rather than {@link Consumable} because a site's\n\t * edge is a build-time link and not a service injection — requiring a client\n\t * would exclude exactly the surfaces a frontend actually depends on.\n\t */\n\tdependsOn(constructs: readonly Declarable[]): StaticSite<TName> {\n\t\treturn new StaticSite<TName>(this.id as ConstructName<TName>, this.config, [\n\t\t\t...this.dependencies,\n\t\t\t...constructs.map(edgeTo),\n\t\t]);\n\t}\n\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'site',\n\t\t\t\tid: this.id,\n\t\t\t\tvariant: this.config.variant ?? 'static',\n\t\t\t\t...(this.config.subdomain ? { subdomain: this.config.subdomain } : {}),\n\t\t\t\tapp: {\n\t\t\t\t\tpath: this.config.path,\n\t\t\t\t\t...(this.config.port ? { port: this.config.port } : {}),\n\t\t\t\t\t...(this.config.config ? { config: this.config.config } : {}),\n\t\t\t\t},\n\t\t\t\t...(this.config.root ? { root: true } : {}),\n\t\t\t\tdependencies: this.dependencies,\n\t\t\t\tprovides: [this.keys.url],\n\t\t\t},\n\t\t];\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAwFA,IAAa,aAAb,MAAa,WAEb;CAMmB;CAOA;CAZlB;CACA;CAEA,YACC,IACA,QAOA,eAAuD,CAAC,GACvD;EARgB,KAAA,SAAA;EAOA,KAAA,eAAA;EAEjB,KAAK,KAAK,YAAY,EAAY;EAClC,KAAK,OAAO,EAAE,KAAK,WAAW,KAAK,IAAI,KAAK,EAAE;CAC/C;;;;;;;;;;;;CAaA,UAAU,YAAsD;EAC/D,OAAO,IAAI,WAAkB,KAAK,IAA4B,KAAK,QAAQ,CAC1E,GAAG,KAAK,cACR,GAAG,WAAW,IAAI,MAAM,CACzB,CAAC;CACF;CAEA,UAAyB;EACxB,OAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,SAAS,KAAK,OAAO,WAAW;GAChC,GAAI,KAAK,OAAO,YAAY,EAAE,WAAW,KAAK,OAAO,UAAU,IAAI,CAAC;GACpE,KAAK;IACJ,MAAM,KAAK,OAAO;IAClB,GAAI,KAAK,OAAO,OAAO,EAAE,MAAM,KAAK,OAAO,KAAK,IAAI,CAAC;IACrD,GAAI,KAAK,OAAO,SAAS,EAAE,QAAQ,KAAK,OAAO,OAAO,IAAI,CAAC;GAC5D;GACA,GAAI,KAAK,OAAO,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;GACzC,cAAc,KAAK;GACnB,UAAU,CAAC,KAAK,KAAK,GAAG;EACzB,CACD;CACD;AACD"}
@@ -1,7 +1,112 @@
1
- require('../construct-interface-BfjcOD_E.cjs');
2
- require('../Construct-CyS3RpTL.cjs');
3
- require('../clone-Dy0cR2SZ.cjs');
4
- const require_SubscriberBuilder = require('../SubscriberBuilder-4OPehf2R.cjs');
5
-
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_SubscriberBuilder = require("../SubscriberBuilder-C2PwqwIl.cjs");
3
+ const require_runSubscriber = require("../runSubscriber-BRp9a_qi.cjs");
4
+ let _geekmidas_errors = require("@geekmidas/errors");
5
+ let _geekmidas_services = require("@geekmidas/services");
6
+ let _geekmidas_events_sns = require("@geekmidas/events/sns");
7
+ //#region src/subscribers/SnsPushSubscriberAdaptor.ts
8
+ /**
9
+ * A topic subscriber run by SNS pushing to an HTTP endpoint, rather than by a
10
+ * poller.
11
+ *
12
+ * The notification is read as the Lambda event SNS would have invoked a
13
+ * function with, and run through the same parsing, services and handler as the
14
+ * Lambda adaptor — without its middy wrapper, which is Lambda's alone: a
15
+ * server serving this route has no reason to install `@middy/core`.
16
+ */
17
+ var SnsPushSubscriberAdaptor = class {
18
+ envParser;
19
+ subscriber;
20
+ options;
21
+ constructor(envParser, subscriber, options) {
22
+ this.envParser = envParser;
23
+ this.subscriber = subscriber;
24
+ this.options = options;
25
+ }
26
+ async handle(body) {
27
+ const message = body;
28
+ if (typeof message?.Type !== "string" || !message.TopicArn) return refuse(400, "not an SNS message");
29
+ if (message.TopicArn !== this.options.topicArn) return refuse(403, `not subscribed to ${message.TopicArn}`);
30
+ if (this.options.verify) try {
31
+ await (0, _geekmidas_events_sns.verifySnsMessage)(message);
32
+ } catch (error) {
33
+ this.subscriber.logger.warn({
34
+ error,
35
+ topicArn: message.TopicArn
36
+ }, "Refused an SNS message that did not verify");
37
+ return refuse(403, error.name);
38
+ }
39
+ switch (message.Type) {
40
+ case "SubscriptionConfirmation":
41
+ await (0, _geekmidas_events_sns.confirmSnsSubscription)(this.options.emulatorEndpoint && message.SubscribeURL ? {
42
+ ...message,
43
+ SubscribeURL: throughEndpoint(message.SubscribeURL, this.options.emulatorEndpoint)
44
+ } : message);
45
+ this.subscriber.logger.info({ topicArn: message.TopicArn }, "Confirmed SNS subscription");
46
+ return {
47
+ status: 200,
48
+ body: { status: "confirmed" }
49
+ };
50
+ case "Notification": try {
51
+ await this.notify(message);
52
+ return {
53
+ status: 200,
54
+ body: { status: "ok" }
55
+ };
56
+ } catch (error) {
57
+ return refuse(500, error.name);
58
+ }
59
+ default: return {
60
+ status: 200,
61
+ body: { status: "ignored" }
62
+ };
63
+ }
64
+ }
65
+ async notify(message) {
66
+ const requestId = message.MessageId;
67
+ const logger = this.subscriber.logger.child({ requestId });
68
+ await (0, _geekmidas_services.runWithRequestContext)({
69
+ logger,
70
+ requestId,
71
+ startTime: Date.now(),
72
+ operation: `subscriber ${this.subscriber.topicName ?? "sns"}`
73
+ }, async () => {
74
+ try {
75
+ const { services, db } = await require_runSubscriber.subscriberContext(this.subscriber, this.envParser);
76
+ const events = require_runSubscriber.subscribedEvents(this.subscriber, (0, _geekmidas_events_sns.toSnsEvent)(message), logger);
77
+ await require_runSubscriber.runSubscriber(this.subscriber, {
78
+ events,
79
+ services,
80
+ logger,
81
+ db
82
+ });
83
+ } catch (error) {
84
+ logger.error(error, "Error processing subscriber");
85
+ throw (0, _geekmidas_errors.wrapError)(error);
86
+ }
87
+ });
88
+ }
89
+ };
90
+ /** `url`, sent to `endpoint`'s origin instead of its own. */
91
+ function throughEndpoint(url, endpoint) {
92
+ const target = new URL(url);
93
+ const origin = new URL(endpoint);
94
+ target.protocol = origin.protocol;
95
+ target.host = origin.host;
96
+ return target.toString();
97
+ }
98
+ function refuse(status, error) {
99
+ return {
100
+ status,
101
+ body: {
102
+ status: "refused",
103
+ error
104
+ }
105
+ };
106
+ }
107
+ //#endregion
108
+ exports.SnsPushSubscriberAdaptor = SnsPushSubscriberAdaptor;
6
109
  exports.Subscriber = require_SubscriberBuilder.Subscriber;
7
- exports.SubscriberBuilder = require_SubscriberBuilder.SubscriberBuilder;
110
+ exports.SubscriberBuilder = require_SubscriberBuilder.SubscriberBuilder;
111
+
112
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":["verifySnsMessage","confirmSnsSubscription","runWithRequestContext","subscriberContext","subscribedEvents","toSnsEvent","runSubscriber","wrapError"],"sources":["../../src/subscribers/SnsPushSubscriberAdaptor.ts"],"sourcesContent":["import type { EnvironmentParser } from '@geekmidas/envkit';\nimport { wrapError } from '@geekmidas/errors';\nimport {\n\tconfirmSnsSubscription,\n\ttype SnsHttpMessage,\n\ttoSnsEvent,\n\tverifySnsMessage,\n} from '@geekmidas/events/sns';\nimport { runWithRequestContext } from '@geekmidas/services';\nimport {\n\trunSubscriber,\n\tsubscribedEvents,\n\tsubscriberContext,\n} from './runSubscriber';\nimport type { Subscriber } from './Subscriber';\n\nexport interface SnsPushOptions {\n\t/** The topic this subscriber is subscribed to. Anything else is refused. */\n\ttopicArn: string;\n\t/**\n\t * Verify each message's signature. Off only against an emulator, which\n\t * signs nothing — decided by the connection string's endpoint, never by\n\t * anything the request says about itself.\n\t */\n\tverify: boolean;\n\t/**\n\t * The emulator's address, as this server was configured with it. An\n\t * emulator names itself in `SubscribeURL` by the port it listens on inside\n\t * its container, which is not the port published to the host — so against\n\t * one, the confirmation is sent here instead. From configuration, never\n\t * from the request.\n\t */\n\temulatorEndpoint?: string;\n}\n\n/** What to answer SNS with. A non-2xx tells SNS to retry. */\nexport interface SnsPushResponse {\n\tstatus: 200 | 400 | 403 | 500;\n\tbody: { status: string; error?: string };\n}\n\n/**\n * A topic subscriber run by SNS pushing to an HTTP endpoint, rather than by a\n * poller.\n *\n * The notification is read as the Lambda event SNS would have invoked a\n * function with, and run through the same parsing, services and handler as the\n * Lambda adaptor — without its middy wrapper, which is Lambda's alone: a\n * server serving this route has no reason to install `@middy/core`.\n */\nexport class SnsPushSubscriberAdaptor {\n\tconstructor(\n\t\tprivate readonly envParser: EnvironmentParser<{}>,\n\t\treadonly subscriber: Subscriber<any, any, any, any, any, any, any>,\n\t\tprivate readonly options: SnsPushOptions,\n\t) {}\n\n\tasync handle(body: unknown): Promise<SnsPushResponse> {\n\t\tconst message = body as SnsHttpMessage;\n\t\tif (typeof message?.Type !== 'string' || !message.TopicArn) {\n\t\t\treturn refuse(400, 'not an SNS message');\n\t\t}\n\t\t// Checked before the signature: a genuine message for another topic is\n\t\t// still not this subscriber's to confirm or to handle.\n\t\tif (message.TopicArn !== this.options.topicArn) {\n\t\t\treturn refuse(403, `not subscribed to ${message.TopicArn}`);\n\t\t}\n\n\t\tif (this.options.verify) {\n\t\t\ttry {\n\t\t\t\tawait verifySnsMessage(message);\n\t\t\t} catch (error) {\n\t\t\t\tthis.subscriber.logger.warn(\n\t\t\t\t\t{ error, topicArn: message.TopicArn },\n\t\t\t\t\t'Refused an SNS message that did not verify',\n\t\t\t\t);\n\t\t\t\treturn refuse(403, (error as Error).name);\n\t\t\t}\n\t\t}\n\n\t\tswitch (message.Type) {\n\t\t\tcase 'SubscriptionConfirmation':\n\t\t\t\tawait confirmSnsSubscription(\n\t\t\t\t\tthis.options.emulatorEndpoint && message.SubscribeURL\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t...message,\n\t\t\t\t\t\t\t\tSubscribeURL: throughEndpoint(\n\t\t\t\t\t\t\t\t\tmessage.SubscribeURL,\n\t\t\t\t\t\t\t\t\tthis.options.emulatorEndpoint,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: message,\n\t\t\t\t);\n\t\t\t\tthis.subscriber.logger.info(\n\t\t\t\t\t{ topicArn: message.TopicArn },\n\t\t\t\t\t'Confirmed SNS subscription',\n\t\t\t\t);\n\t\t\t\treturn { status: 200, body: { status: 'confirmed' } };\n\t\t\tcase 'Notification':\n\t\t\t\ttry {\n\t\t\t\t\tawait this.notify(message);\n\t\t\t\t\treturn { status: 200, body: { status: 'ok' } };\n\t\t\t\t} catch (error) {\n\t\t\t\t\t// Already logged. A 500 makes SNS retry, which is the point of\n\t\t\t\t\t// answering at all.\n\t\t\t\t\treturn refuse(500, (error as Error).name);\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn { status: 200, body: { status: 'ignored' } };\n\t\t}\n\t}\n\n\tprivate async notify(message: SnsHttpMessage): Promise<void> {\n\t\tconst requestId = message.MessageId;\n\t\tconst logger = this.subscriber.logger.child({ requestId });\n\n\t\tawait runWithRequestContext(\n\t\t\t{\n\t\t\t\tlogger,\n\t\t\t\trequestId,\n\t\t\t\tstartTime: Date.now(),\n\t\t\t\toperation: `subscriber ${this.subscriber.topicName ?? 'sns'}`,\n\t\t\t},\n\t\t\tasync () => {\n\t\t\t\ttry {\n\t\t\t\t\tconst { services, db } = await subscriberContext(\n\t\t\t\t\t\tthis.subscriber,\n\t\t\t\t\t\tthis.envParser,\n\t\t\t\t\t);\n\t\t\t\t\tconst events = subscribedEvents(\n\t\t\t\t\t\tthis.subscriber,\n\t\t\t\t\t\ttoSnsEvent(message),\n\t\t\t\t\t\tlogger,\n\t\t\t\t\t);\n\t\t\t\t\tawait runSubscriber(this.subscriber, {\n\t\t\t\t\t\tevents,\n\t\t\t\t\t\tservices,\n\t\t\t\t\t\tlogger,\n\t\t\t\t\t\tdb,\n\t\t\t\t\t});\n\t\t\t\t} catch (error) {\n\t\t\t\t\tlogger.error(error as object, 'Error processing subscriber');\n\t\t\t\t\tthrow wrapError(error);\n\t\t\t\t}\n\t\t\t},\n\t\t);\n\t}\n}\n\n/** `url`, sent to `endpoint`'s origin instead of its own. */\nfunction throughEndpoint(url: string, endpoint: string): string {\n\tconst target = new URL(url);\n\tconst origin = new URL(endpoint);\n\ttarget.protocol = origin.protocol;\n\ttarget.host = origin.host;\n\treturn target.toString();\n}\n\nfunction refuse(\n\tstatus: SnsPushResponse['status'],\n\terror: string,\n): SnsPushResponse {\n\treturn { status, body: { status: 'refused', error } };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAkDA,IAAa,2BAAb,MAAsC;CAEnB;CACR;CACQ;CAHlB,YACC,WACA,YACA,SACC;EAHgB,KAAA,YAAA;EACR,KAAA,aAAA;EACQ,KAAA,UAAA;CACf;CAEH,MAAM,OAAO,MAAyC;EACrD,MAAM,UAAU;EAChB,IAAI,OAAO,SAAS,SAAS,YAAY,CAAC,QAAQ,UACjD,OAAO,OAAO,KAAK,oBAAoB;EAIxC,IAAI,QAAQ,aAAa,KAAK,QAAQ,UACrC,OAAO,OAAO,KAAK,qBAAqB,QAAQ,UAAU;EAG3D,IAAI,KAAK,QAAQ,QAChB,IAAI;GACH,OAAA,GAAMA,sBAAAA,iBAAAA,CAAiB,OAAO;EAC/B,SAAS,OAAO;GACf,KAAK,WAAW,OAAO,KACtB;IAAE;IAAO,UAAU,QAAQ;GAAS,GACpC,4CACD;GACA,OAAO,OAAO,KAAM,MAAgB,IAAI;EACzC;EAGD,QAAQ,QAAQ,MAAhB;GACC,KAAK;IACJ,OAAA,GAAMC,sBAAAA,uBAAAA,CACL,KAAK,QAAQ,oBAAoB,QAAQ,eACtC;KACA,GAAG;KACH,cAAc,gBACb,QAAQ,cACR,KAAK,QAAQ,gBACd;IACD,IACC,OACJ;IACA,KAAK,WAAW,OAAO,KACtB,EAAE,UAAU,QAAQ,SAAS,GAC7B,4BACD;IACA,OAAO;KAAE,QAAQ;KAAK,MAAM,EAAE,QAAQ,YAAY;IAAE;GACrD,KAAK,gBACJ,IAAI;IACH,MAAM,KAAK,OAAO,OAAO;IACzB,OAAO;KAAE,QAAQ;KAAK,MAAM,EAAE,QAAQ,KAAK;IAAE;GAC9C,SAAS,OAAO;IAGf,OAAO,OAAO,KAAM,MAAgB,IAAI;GACzC;GACD,SACC,OAAO;IAAE,QAAQ;IAAK,MAAM,EAAE,QAAQ,UAAU;GAAE;EACpD;CACD;CAEA,MAAc,OAAO,SAAwC;EAC5D,MAAM,YAAY,QAAQ;EAC1B,MAAM,SAAS,KAAK,WAAW,OAAO,MAAM,EAAE,UAAU,CAAC;EAEzD,OAAA,GAAMC,oBAAAA,sBAAAA,CACL;GACC;GACA;GACA,WAAW,KAAK,IAAI;GACpB,WAAW,cAAc,KAAK,WAAW,aAAa;EACvD,GACA,YAAY;GACX,IAAI;IACH,MAAM,EAAE,UAAU,OAAO,MAAMC,sBAAAA,kBAC9B,KAAK,YACL,KAAK,SACN;IACA,MAAM,SAASC,sBAAAA,iBACd,KAAK,aAAA,GACLC,sBAAAA,WAAAA,CAAW,OAAO,GAClB,MACD;IACA,MAAMC,sBAAAA,cAAc,KAAK,YAAY;KACpC;KACA;KACA;KACA;IACD,CAAC;GACF,SAAS,OAAO;IACf,OAAO,MAAM,OAAiB,6BAA6B;IAC3D,OAAA,GAAMC,kBAAAA,UAAAA,CAAU,KAAK;GACtB;EACD,CACD;CACD;AACD;;AAGA,SAAS,gBAAgB,KAAa,UAA0B;CAC/D,MAAM,SAAS,IAAI,IAAI,GAAG;CAC1B,MAAM,SAAS,IAAI,IAAI,QAAQ;CAC/B,OAAO,WAAW,OAAO;CACzB,OAAO,OAAO,OAAO;CACrB,OAAO,OAAO,SAAS;AACxB;AAEA,SAAS,OACR,QACA,OACkB;CAClB,OAAO;EAAE;EAAQ,MAAM;GAAE,QAAQ;GAAW;EAAM;CAAE;AACrD"}
@@ -1,6 +1,50 @@
1
- import "../Construct-C0ijr2qp.cjs";
2
- import "../construct-interface-D9d4Gm4p.cjs";
3
- import { Subscriber } from "../Subscriber-2mEi0ImH.cjs";
4
- import "../Topic-19QeHBIR.cjs";
5
- import { SubscriberBuilder } from "../SubscriberBuilder-waNhzjSM.cjs";
6
- export { Subscriber, SubscriberBuilder };
1
+ import { t as Subscriber } from "../Subscriber-Bpp02cGr.cjs";
2
+ import { t as SubscriberBuilder } from "../SubscriberBuilder-g3fAVWgs.cjs";
3
+ import { EnvironmentParser } from "@geekmidas/envkit";
4
+ //#region src/subscribers/SnsPushSubscriberAdaptor.d.ts
5
+ interface SnsPushOptions {
6
+ /** The topic this subscriber is subscribed to. Anything else is refused. */
7
+ topicArn: string;
8
+ /**
9
+ * Verify each message's signature. Off only against an emulator, which
10
+ * signs nothing — decided by the connection string's endpoint, never by
11
+ * anything the request says about itself.
12
+ */
13
+ verify: boolean;
14
+ /**
15
+ * The emulator's address, as this server was configured with it. An
16
+ * emulator names itself in `SubscribeURL` by the port it listens on inside
17
+ * its container, which is not the port published to the host — so against
18
+ * one, the confirmation is sent here instead. From configuration, never
19
+ * from the request.
20
+ */
21
+ emulatorEndpoint?: string;
22
+ }
23
+ /** What to answer SNS with. A non-2xx tells SNS to retry. */
24
+ interface SnsPushResponse {
25
+ status: 200 | 400 | 403 | 500;
26
+ body: {
27
+ status: string;
28
+ error?: string;
29
+ };
30
+ }
31
+ /**
32
+ * A topic subscriber run by SNS pushing to an HTTP endpoint, rather than by a
33
+ * poller.
34
+ *
35
+ * The notification is read as the Lambda event SNS would have invoked a
36
+ * function with, and run through the same parsing, services and handler as the
37
+ * Lambda adaptor — without its middy wrapper, which is Lambda's alone: a
38
+ * server serving this route has no reason to install `@middy/core`.
39
+ */
40
+ export declare class SnsPushSubscriberAdaptor {
41
+ private readonly envParser;
42
+ readonly subscriber: Subscriber<any, any, any, any, any, any, any>;
43
+ private readonly options;
44
+ constructor(envParser: EnvironmentParser<{}>, subscriber: Subscriber<any, any, any, any, any, any, any>, options: SnsPushOptions);
45
+ handle(body: unknown): Promise<SnsPushResponse>;
46
+ private notify;
47
+ }
48
+ //#endregion
49
+ export { type SnsPushOptions, type SnsPushResponse, Subscriber, SubscriberBuilder };
50
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/subscribers/SnsPushSubscriberAdaptor.ts"],"mappings":";;;;UAgBiB;;EAEhB;;;;;;EAMA;;;;;;;;EAQA;;;UAIgB;EAChB;EACA;IAAQ;IAAgB;;;;;;;;;;;;qBAYZ;mBAEM;WACR,YAAY;mBACJ;EAHlB,YACkB,WAAW,uBACnB,YAAY,+CACJ,SAAS;EAGrB,OAAO,gBAAgB,QAAQ;UAuDvB"}
@@ -1,6 +1,50 @@
1
- import "../Construct-Ct8nalEi.mjs";
2
- import "../construct-interface-g5GM5pwR.mjs";
3
- import { Subscriber } from "../Subscriber-xTJ9ayPN.mjs";
4
- import "../Topic-DuFeqkBh.mjs";
5
- import { SubscriberBuilder } from "../SubscriberBuilder-Dptmo-1A.mjs";
6
- export { Subscriber, SubscriberBuilder };
1
+ import { t as Subscriber } from "../Subscriber-CtN9R48-.mjs";
2
+ import { t as SubscriberBuilder } from "../SubscriberBuilder-CuCMFpYW.mjs";
3
+ import { EnvironmentParser } from "@geekmidas/envkit";
4
+ //#region src/subscribers/SnsPushSubscriberAdaptor.d.ts
5
+ interface SnsPushOptions {
6
+ /** The topic this subscriber is subscribed to. Anything else is refused. */
7
+ topicArn: string;
8
+ /**
9
+ * Verify each message's signature. Off only against an emulator, which
10
+ * signs nothing — decided by the connection string's endpoint, never by
11
+ * anything the request says about itself.
12
+ */
13
+ verify: boolean;
14
+ /**
15
+ * The emulator's address, as this server was configured with it. An
16
+ * emulator names itself in `SubscribeURL` by the port it listens on inside
17
+ * its container, which is not the port published to the host — so against
18
+ * one, the confirmation is sent here instead. From configuration, never
19
+ * from the request.
20
+ */
21
+ emulatorEndpoint?: string;
22
+ }
23
+ /** What to answer SNS with. A non-2xx tells SNS to retry. */
24
+ interface SnsPushResponse {
25
+ status: 200 | 400 | 403 | 500;
26
+ body: {
27
+ status: string;
28
+ error?: string;
29
+ };
30
+ }
31
+ /**
32
+ * A topic subscriber run by SNS pushing to an HTTP endpoint, rather than by a
33
+ * poller.
34
+ *
35
+ * The notification is read as the Lambda event SNS would have invoked a
36
+ * function with, and run through the same parsing, services and handler as the
37
+ * Lambda adaptor — without its middy wrapper, which is Lambda's alone: a
38
+ * server serving this route has no reason to install `@middy/core`.
39
+ */
40
+ export declare class SnsPushSubscriberAdaptor {
41
+ private readonly envParser;
42
+ readonly subscriber: Subscriber<any, any, any, any, any, any, any>;
43
+ private readonly options;
44
+ constructor(envParser: EnvironmentParser<{}>, subscriber: Subscriber<any, any, any, any, any, any, any>, options: SnsPushOptions);
45
+ handle(body: unknown): Promise<SnsPushResponse>;
46
+ private notify;
47
+ }
48
+ //#endregion
49
+ export { type SnsPushOptions, type SnsPushResponse, Subscriber, SubscriberBuilder };
50
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/subscribers/SnsPushSubscriberAdaptor.ts"],"mappings":";;;;UAgBiB;;EAEhB;;;;;;EAMA;;;;;;;;EAQA;;;UAIgB;EAChB;EACA;IAAQ;IAAgB;;;;;;;;;;;;qBAYZ;mBAEM;WACR,YAAY;mBACJ;EAHlB,YACkB,WAAW,uBACnB,YAAY,+CACJ,SAAS;EAGrB,OAAO,gBAAgB,QAAQ;UAuDvB"}
@@ -1,6 +1,109 @@
1
- import "../Construct-BD5neF7w.mjs";
2
- import "../construct-interface-Z4CpS8tK.mjs";
3
- import "../clone-DblgEZZa.mjs";
4
- import { Subscriber, SubscriberBuilder } from "../SubscriberBuilder-BjkbeT9l.mjs";
1
+ import { n as Subscriber, t as SubscriberBuilder } from "../SubscriberBuilder-DMFk_Ap1.mjs";
2
+ import { n as subscribedEvents, r as subscriberContext, t as runSubscriber } from "../runSubscriber-BYEY_bfA.mjs";
3
+ import { wrapError } from "@geekmidas/errors";
4
+ import { runWithRequestContext } from "@geekmidas/services";
5
+ import { confirmSnsSubscription, toSnsEvent, verifySnsMessage } from "@geekmidas/events/sns";
6
+ //#region src/subscribers/SnsPushSubscriberAdaptor.ts
7
+ /**
8
+ * A topic subscriber run by SNS pushing to an HTTP endpoint, rather than by a
9
+ * poller.
10
+ *
11
+ * The notification is read as the Lambda event SNS would have invoked a
12
+ * function with, and run through the same parsing, services and handler as the
13
+ * Lambda adaptor — without its middy wrapper, which is Lambda's alone: a
14
+ * server serving this route has no reason to install `@middy/core`.
15
+ */
16
+ var SnsPushSubscriberAdaptor = class {
17
+ envParser;
18
+ subscriber;
19
+ options;
20
+ constructor(envParser, subscriber, options) {
21
+ this.envParser = envParser;
22
+ this.subscriber = subscriber;
23
+ this.options = options;
24
+ }
25
+ async handle(body) {
26
+ const message = body;
27
+ if (typeof message?.Type !== "string" || !message.TopicArn) return refuse(400, "not an SNS message");
28
+ if (message.TopicArn !== this.options.topicArn) return refuse(403, `not subscribed to ${message.TopicArn}`);
29
+ if (this.options.verify) try {
30
+ await verifySnsMessage(message);
31
+ } catch (error) {
32
+ this.subscriber.logger.warn({
33
+ error,
34
+ topicArn: message.TopicArn
35
+ }, "Refused an SNS message that did not verify");
36
+ return refuse(403, error.name);
37
+ }
38
+ switch (message.Type) {
39
+ case "SubscriptionConfirmation":
40
+ await confirmSnsSubscription(this.options.emulatorEndpoint && message.SubscribeURL ? {
41
+ ...message,
42
+ SubscribeURL: throughEndpoint(message.SubscribeURL, this.options.emulatorEndpoint)
43
+ } : message);
44
+ this.subscriber.logger.info({ topicArn: message.TopicArn }, "Confirmed SNS subscription");
45
+ return {
46
+ status: 200,
47
+ body: { status: "confirmed" }
48
+ };
49
+ case "Notification": try {
50
+ await this.notify(message);
51
+ return {
52
+ status: 200,
53
+ body: { status: "ok" }
54
+ };
55
+ } catch (error) {
56
+ return refuse(500, error.name);
57
+ }
58
+ default: return {
59
+ status: 200,
60
+ body: { status: "ignored" }
61
+ };
62
+ }
63
+ }
64
+ async notify(message) {
65
+ const requestId = message.MessageId;
66
+ const logger = this.subscriber.logger.child({ requestId });
67
+ await runWithRequestContext({
68
+ logger,
69
+ requestId,
70
+ startTime: Date.now(),
71
+ operation: `subscriber ${this.subscriber.topicName ?? "sns"}`
72
+ }, async () => {
73
+ try {
74
+ const { services, db } = await subscriberContext(this.subscriber, this.envParser);
75
+ const events = subscribedEvents(this.subscriber, toSnsEvent(message), logger);
76
+ await runSubscriber(this.subscriber, {
77
+ events,
78
+ services,
79
+ logger,
80
+ db
81
+ });
82
+ } catch (error) {
83
+ logger.error(error, "Error processing subscriber");
84
+ throw wrapError(error);
85
+ }
86
+ });
87
+ }
88
+ };
89
+ /** `url`, sent to `endpoint`'s origin instead of its own. */
90
+ function throughEndpoint(url, endpoint) {
91
+ const target = new URL(url);
92
+ const origin = new URL(endpoint);
93
+ target.protocol = origin.protocol;
94
+ target.host = origin.host;
95
+ return target.toString();
96
+ }
97
+ function refuse(status, error) {
98
+ return {
99
+ status,
100
+ body: {
101
+ status: "refused",
102
+ error
103
+ }
104
+ };
105
+ }
106
+ //#endregion
107
+ export { SnsPushSubscriberAdaptor, Subscriber, SubscriberBuilder };
5
108
 
6
- export { Subscriber, SubscriberBuilder };
109
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/subscribers/SnsPushSubscriberAdaptor.ts"],"sourcesContent":["import type { EnvironmentParser } from '@geekmidas/envkit';\nimport { wrapError } from '@geekmidas/errors';\nimport {\n\tconfirmSnsSubscription,\n\ttype SnsHttpMessage,\n\ttoSnsEvent,\n\tverifySnsMessage,\n} from '@geekmidas/events/sns';\nimport { runWithRequestContext } from '@geekmidas/services';\nimport {\n\trunSubscriber,\n\tsubscribedEvents,\n\tsubscriberContext,\n} from './runSubscriber';\nimport type { Subscriber } from './Subscriber';\n\nexport interface SnsPushOptions {\n\t/** The topic this subscriber is subscribed to. Anything else is refused. */\n\ttopicArn: string;\n\t/**\n\t * Verify each message's signature. Off only against an emulator, which\n\t * signs nothing — decided by the connection string's endpoint, never by\n\t * anything the request says about itself.\n\t */\n\tverify: boolean;\n\t/**\n\t * The emulator's address, as this server was configured with it. An\n\t * emulator names itself in `SubscribeURL` by the port it listens on inside\n\t * its container, which is not the port published to the host — so against\n\t * one, the confirmation is sent here instead. From configuration, never\n\t * from the request.\n\t */\n\temulatorEndpoint?: string;\n}\n\n/** What to answer SNS with. A non-2xx tells SNS to retry. */\nexport interface SnsPushResponse {\n\tstatus: 200 | 400 | 403 | 500;\n\tbody: { status: string; error?: string };\n}\n\n/**\n * A topic subscriber run by SNS pushing to an HTTP endpoint, rather than by a\n * poller.\n *\n * The notification is read as the Lambda event SNS would have invoked a\n * function with, and run through the same parsing, services and handler as the\n * Lambda adaptor — without its middy wrapper, which is Lambda's alone: a\n * server serving this route has no reason to install `@middy/core`.\n */\nexport class SnsPushSubscriberAdaptor {\n\tconstructor(\n\t\tprivate readonly envParser: EnvironmentParser<{}>,\n\t\treadonly subscriber: Subscriber<any, any, any, any, any, any, any>,\n\t\tprivate readonly options: SnsPushOptions,\n\t) {}\n\n\tasync handle(body: unknown): Promise<SnsPushResponse> {\n\t\tconst message = body as SnsHttpMessage;\n\t\tif (typeof message?.Type !== 'string' || !message.TopicArn) {\n\t\t\treturn refuse(400, 'not an SNS message');\n\t\t}\n\t\t// Checked before the signature: a genuine message for another topic is\n\t\t// still not this subscriber's to confirm or to handle.\n\t\tif (message.TopicArn !== this.options.topicArn) {\n\t\t\treturn refuse(403, `not subscribed to ${message.TopicArn}`);\n\t\t}\n\n\t\tif (this.options.verify) {\n\t\t\ttry {\n\t\t\t\tawait verifySnsMessage(message);\n\t\t\t} catch (error) {\n\t\t\t\tthis.subscriber.logger.warn(\n\t\t\t\t\t{ error, topicArn: message.TopicArn },\n\t\t\t\t\t'Refused an SNS message that did not verify',\n\t\t\t\t);\n\t\t\t\treturn refuse(403, (error as Error).name);\n\t\t\t}\n\t\t}\n\n\t\tswitch (message.Type) {\n\t\t\tcase 'SubscriptionConfirmation':\n\t\t\t\tawait confirmSnsSubscription(\n\t\t\t\t\tthis.options.emulatorEndpoint && message.SubscribeURL\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t...message,\n\t\t\t\t\t\t\t\tSubscribeURL: throughEndpoint(\n\t\t\t\t\t\t\t\t\tmessage.SubscribeURL,\n\t\t\t\t\t\t\t\t\tthis.options.emulatorEndpoint,\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: message,\n\t\t\t\t);\n\t\t\t\tthis.subscriber.logger.info(\n\t\t\t\t\t{ topicArn: message.TopicArn },\n\t\t\t\t\t'Confirmed SNS subscription',\n\t\t\t\t);\n\t\t\t\treturn { status: 200, body: { status: 'confirmed' } };\n\t\t\tcase 'Notification':\n\t\t\t\ttry {\n\t\t\t\t\tawait this.notify(message);\n\t\t\t\t\treturn { status: 200, body: { status: 'ok' } };\n\t\t\t\t} catch (error) {\n\t\t\t\t\t// Already logged. A 500 makes SNS retry, which is the point of\n\t\t\t\t\t// answering at all.\n\t\t\t\t\treturn refuse(500, (error as Error).name);\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn { status: 200, body: { status: 'ignored' } };\n\t\t}\n\t}\n\n\tprivate async notify(message: SnsHttpMessage): Promise<void> {\n\t\tconst requestId = message.MessageId;\n\t\tconst logger = this.subscriber.logger.child({ requestId });\n\n\t\tawait runWithRequestContext(\n\t\t\t{\n\t\t\t\tlogger,\n\t\t\t\trequestId,\n\t\t\t\tstartTime: Date.now(),\n\t\t\t\toperation: `subscriber ${this.subscriber.topicName ?? 'sns'}`,\n\t\t\t},\n\t\t\tasync () => {\n\t\t\t\ttry {\n\t\t\t\t\tconst { services, db } = await subscriberContext(\n\t\t\t\t\t\tthis.subscriber,\n\t\t\t\t\t\tthis.envParser,\n\t\t\t\t\t);\n\t\t\t\t\tconst events = subscribedEvents(\n\t\t\t\t\t\tthis.subscriber,\n\t\t\t\t\t\ttoSnsEvent(message),\n\t\t\t\t\t\tlogger,\n\t\t\t\t\t);\n\t\t\t\t\tawait runSubscriber(this.subscriber, {\n\t\t\t\t\t\tevents,\n\t\t\t\t\t\tservices,\n\t\t\t\t\t\tlogger,\n\t\t\t\t\t\tdb,\n\t\t\t\t\t});\n\t\t\t\t} catch (error) {\n\t\t\t\t\tlogger.error(error as object, 'Error processing subscriber');\n\t\t\t\t\tthrow wrapError(error);\n\t\t\t\t}\n\t\t\t},\n\t\t);\n\t}\n}\n\n/** `url`, sent to `endpoint`'s origin instead of its own. */\nfunction throughEndpoint(url: string, endpoint: string): string {\n\tconst target = new URL(url);\n\tconst origin = new URL(endpoint);\n\ttarget.protocol = origin.protocol;\n\ttarget.host = origin.host;\n\treturn target.toString();\n}\n\nfunction refuse(\n\tstatus: SnsPushResponse['status'],\n\terror: string,\n): SnsPushResponse {\n\treturn { status, body: { status: 'refused', error } };\n}\n"],"mappings":";;;;;;;;;;;;;;;AAkDA,IAAa,2BAAb,MAAsC;CAEnB;CACR;CACQ;CAHlB,YACC,WACA,YACA,SACC;EAHgB,KAAA,YAAA;EACR,KAAA,aAAA;EACQ,KAAA,UAAA;CACf;CAEH,MAAM,OAAO,MAAyC;EACrD,MAAM,UAAU;EAChB,IAAI,OAAO,SAAS,SAAS,YAAY,CAAC,QAAQ,UACjD,OAAO,OAAO,KAAK,oBAAoB;EAIxC,IAAI,QAAQ,aAAa,KAAK,QAAQ,UACrC,OAAO,OAAO,KAAK,qBAAqB,QAAQ,UAAU;EAG3D,IAAI,KAAK,QAAQ,QAChB,IAAI;GACH,MAAM,iBAAiB,OAAO;EAC/B,SAAS,OAAO;GACf,KAAK,WAAW,OAAO,KACtB;IAAE;IAAO,UAAU,QAAQ;GAAS,GACpC,4CACD;GACA,OAAO,OAAO,KAAM,MAAgB,IAAI;EACzC;EAGD,QAAQ,QAAQ,MAAhB;GACC,KAAK;IACJ,MAAM,uBACL,KAAK,QAAQ,oBAAoB,QAAQ,eACtC;KACA,GAAG;KACH,cAAc,gBACb,QAAQ,cACR,KAAK,QAAQ,gBACd;IACD,IACC,OACJ;IACA,KAAK,WAAW,OAAO,KACtB,EAAE,UAAU,QAAQ,SAAS,GAC7B,4BACD;IACA,OAAO;KAAE,QAAQ;KAAK,MAAM,EAAE,QAAQ,YAAY;IAAE;GACrD,KAAK,gBACJ,IAAI;IACH,MAAM,KAAK,OAAO,OAAO;IACzB,OAAO;KAAE,QAAQ;KAAK,MAAM,EAAE,QAAQ,KAAK;IAAE;GAC9C,SAAS,OAAO;IAGf,OAAO,OAAO,KAAM,MAAgB,IAAI;GACzC;GACD,SACC,OAAO;IAAE,QAAQ;IAAK,MAAM,EAAE,QAAQ,UAAU;GAAE;EACpD;CACD;CAEA,MAAc,OAAO,SAAwC;EAC5D,MAAM,YAAY,QAAQ;EAC1B,MAAM,SAAS,KAAK,WAAW,OAAO,MAAM,EAAE,UAAU,CAAC;EAEzD,MAAM,sBACL;GACC;GACA;GACA,WAAW,KAAK,IAAI;GACpB,WAAW,cAAc,KAAK,WAAW,aAAa;EACvD,GACA,YAAY;GACX,IAAI;IACH,MAAM,EAAE,UAAU,OAAO,MAAM,kBAC9B,KAAK,YACL,KAAK,SACN;IACA,MAAM,SAAS,iBACd,KAAK,YACL,WAAW,OAAO,GAClB,MACD;IACA,MAAM,cAAc,KAAK,YAAY;KACpC;KACA;KACA;KACA;IACD,CAAC;GACF,SAAS,OAAO;IACf,OAAO,MAAM,OAAiB,6BAA6B;IAC3D,MAAM,UAAU,KAAK;GACtB;EACD,CACD;CACD;AACD;;AAGA,SAAS,gBAAgB,KAAa,UAA0B;CAC/D,MAAM,SAAS,IAAI,IAAI,GAAG;CAC1B,MAAM,SAAS,IAAI,IAAI,QAAQ;CAC/B,OAAO,WAAW,OAAO;CACzB,OAAO,OAAO,OAAO;CACrB,OAAO,OAAO,SAAS;AACxB;AAEA,SAAS,OACR,QACA,OACkB;CAClB,OAAO;EAAE;EAAQ,MAAM;GAAE,QAAQ;GAAW;EAAM;CAAE;AACrD"}