@geekmidas/constructs 10.0.0-alpha.37 → 10.0.0-alpha.39

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 (267) hide show
  1. package/README.md +156 -155
  2. package/dist/{Construct-Detz65RA.mjs → Construct-BO1X-kt9.mjs} +3 -6
  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-yG9Sw-5p.cjs → Construct-DmvXceVY.cjs} +3 -6
  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-CA2oa2nC.d.cts → Cron-CMEGfRs8.d.cts} +7 -5
  11. package/dist/Cron-CMEGfRs8.d.cts.map +1 -0
  12. package/dist/{Cron-B_iuyNxr.d.mts → Cron-D6X4-xjB.d.mts} +7 -5
  13. package/dist/Cron-D6X4-xjB.d.mts.map +1 -0
  14. package/dist/{CronBuilder-B_KqaodP.d.cts → CronBuilder-CEK7aOqD.d.cts} +21 -16
  15. package/dist/CronBuilder-CEK7aOqD.d.cts.map +1 -0
  16. package/dist/{CronBuilder-BbnT7tqo.cjs → CronBuilder-DB35T5dL.cjs} +13 -11
  17. package/dist/CronBuilder-DB35T5dL.cjs.map +1 -0
  18. package/dist/{CronBuilder-BRkzUOAs.mjs → CronBuilder-Dv0IlZs0.mjs} +14 -12
  19. package/dist/CronBuilder-Dv0IlZs0.mjs.map +1 -0
  20. package/dist/{CronBuilder-BIKCLWu7.d.mts → CronBuilder-O_gvButp.d.mts} +21 -16
  21. package/dist/CronBuilder-O_gvButp.d.mts.map +1 -0
  22. package/dist/{Endpoint-DO332Dnm.mjs → Endpoint-CQAeh1Rh.mjs} +5 -5
  23. package/dist/Endpoint-CQAeh1Rh.mjs.map +1 -0
  24. package/dist/{Endpoint-QKuFg5gs.cjs → Endpoint-D1L9qu5C.cjs} +5 -5
  25. package/dist/Endpoint-D1L9qu5C.cjs.map +1 -0
  26. package/dist/{Endpoint-1-XYQSx0.d.cts → Endpoint-Dp5AKIXl.d.cts} +10 -13
  27. package/dist/Endpoint-Dp5AKIXl.d.cts.map +1 -0
  28. package/dist/{Endpoint-GFIxYb9L.d.mts → Endpoint-DtI7heFm.d.mts} +10 -13
  29. package/dist/Endpoint-DtI7heFm.d.mts.map +1 -0
  30. package/dist/{EndpointFactory-B9HAjDAP.mjs → EndpointFactory-BBdNeaGJ.mjs} +23 -52
  31. package/dist/EndpointFactory-BBdNeaGJ.mjs.map +1 -0
  32. package/dist/{EndpointFactory-BmO0WnXE.cjs → EndpointFactory-BZOCOaK6.cjs} +22 -51
  33. package/dist/EndpointFactory-BZOCOaK6.cjs.map +1 -0
  34. package/dist/{EndpointFactory-BCZdh_u3.d.mts → EndpointFactory-CgMDvERK.d.mts} +58 -48
  35. package/dist/EndpointFactory-CgMDvERK.d.mts.map +1 -0
  36. package/dist/{EndpointFactory-BnK_YkW1.d.cts → EndpointFactory-FeFRmlDZ.d.cts} +58 -48
  37. package/dist/EndpointFactory-FeFRmlDZ.d.cts.map +1 -0
  38. package/dist/{HonoEndpointAdaptor-CiqAZ5Mt.mjs → HonoEndpointAdaptor-Aui-x9Lg.mjs} +4 -3
  39. package/dist/HonoEndpointAdaptor-Aui-x9Lg.mjs.map +1 -0
  40. package/dist/{HonoEndpointAdaptor-DoEQdC3r.cjs → HonoEndpointAdaptor-Cq99r9H7.cjs} +5 -4
  41. package/dist/HonoEndpointAdaptor-Cq99r9H7.cjs.map +1 -0
  42. package/dist/{Queue-DpKTLl6E.mjs → Queue-C1uDgjxt.mjs} +29 -48
  43. package/dist/Queue-C1uDgjxt.mjs.map +1 -0
  44. package/dist/{Queue-B7yRXQmL.cjs → Queue-Ckmudcm8.cjs} +29 -48
  45. package/dist/Queue-Ckmudcm8.cjs.map +1 -0
  46. package/dist/{Queue-Bhzi2WQC.d.cts → Queue-CpQIGB_2.d.cts} +22 -33
  47. package/dist/Queue-CpQIGB_2.d.cts.map +1 -0
  48. package/dist/{Queue-BoUA-e83.d.mts → Queue-YmvN2vEP.d.mts} +21 -32
  49. package/dist/Queue-YmvN2vEP.d.mts.map +1 -0
  50. package/dist/QueueBuilder-CJNcv4dy.cjs +112 -0
  51. package/dist/QueueBuilder-CJNcv4dy.cjs.map +1 -0
  52. package/dist/QueueBuilder-CM0WUxfw.d.mts +62 -0
  53. package/dist/QueueBuilder-CM0WUxfw.d.mts.map +1 -0
  54. package/dist/QueueBuilder-XEnnOWGe.d.cts +62 -0
  55. package/dist/QueueBuilder-XEnnOWGe.d.cts.map +1 -0
  56. package/dist/QueueBuilder-XuPKZwKH.mjs +95 -0
  57. package/dist/QueueBuilder-XuPKZwKH.mjs.map +1 -0
  58. package/dist/{Subscriber-DQCaiOXF.d.cts → Subscriber-B91YSkZt.d.cts} +12 -13
  59. package/dist/Subscriber-B91YSkZt.d.cts.map +1 -0
  60. package/dist/{Subscriber-CIO3pwji.d.mts → Subscriber-BjHYe5hK.d.mts} +11 -12
  61. package/dist/Subscriber-BjHYe5hK.d.mts.map +1 -0
  62. package/dist/{SubscriberBuilder-CjDGSTZc.d.cts → SubscriberBuilder-BSpQX1JT.d.cts} +19 -23
  63. package/dist/SubscriberBuilder-BSpQX1JT.d.cts.map +1 -0
  64. package/dist/{SubscriberBuilder-C2FRfd26.d.mts → SubscriberBuilder-BhMphk4z.d.mts} +18 -22
  65. package/dist/SubscriberBuilder-BhMphk4z.d.mts.map +1 -0
  66. package/dist/{SubscriberBuilder-C2bCOuPT.cjs → SubscriberBuilder-Duk028pD.cjs} +11 -19
  67. package/dist/SubscriberBuilder-Duk028pD.cjs.map +1 -0
  68. package/dist/{SubscriberBuilder-B4YRTBng.mjs → SubscriberBuilder-DzQUWE08.mjs} +11 -19
  69. package/dist/SubscriberBuilder-DzQUWE08.mjs.map +1 -0
  70. package/dist/{Topic-D5rlM9wS.cjs → Topic-BBVXC3H4.cjs} +46 -51
  71. package/dist/Topic-BBVXC3H4.cjs.map +1 -0
  72. package/dist/Topic-DOw051ch.mjs +98 -0
  73. package/dist/Topic-DOw051ch.mjs.map +1 -0
  74. package/dist/adaptors/aws.cjs +5 -5
  75. package/dist/adaptors/aws.cjs.map +1 -1
  76. package/dist/adaptors/aws.d.cts +26 -26
  77. package/dist/adaptors/aws.d.cts.map +1 -1
  78. package/dist/adaptors/aws.d.mts +25 -25
  79. package/dist/adaptors/aws.d.mts.map +1 -1
  80. package/dist/adaptors/aws.mjs +5 -5
  81. package/dist/adaptors/aws.mjs.map +1 -1
  82. package/dist/adaptors/hono.cjs +1 -1
  83. package/dist/adaptors/hono.d.cts +4 -5
  84. package/dist/adaptors/hono.d.cts.map +1 -1
  85. package/dist/adaptors/hono.d.mts +4 -5
  86. package/dist/adaptors/hono.d.mts.map +1 -1
  87. package/dist/adaptors/hono.mjs +1 -1
  88. package/dist/adaptors/testing.cjs +59 -23
  89. package/dist/adaptors/testing.cjs.map +1 -1
  90. package/dist/adaptors/testing.d.cts +40 -28
  91. package/dist/adaptors/testing.d.cts.map +1 -1
  92. package/dist/adaptors/testing.d.mts +40 -28
  93. package/dist/adaptors/testing.d.mts.map +1 -1
  94. package/dist/adaptors/testing.mjs +59 -23
  95. package/dist/adaptors/testing.mjs.map +1 -1
  96. package/dist/{auth-c6nWnvD8.d.cts → auth-CMwml9QN.d.mts} +4 -4
  97. package/dist/{auth-c6nWnvD8.d.cts.map → auth-CMwml9QN.d.mts.map} +1 -1
  98. package/dist/{auth-pS_U1H_X.d.mts → auth-rVRDjIw_.d.cts} +4 -4
  99. package/dist/{auth-pS_U1H_X.d.mts.map → auth-rVRDjIw_.d.cts.map} +1 -1
  100. package/dist/auth.d.cts +1 -1
  101. package/dist/auth.d.mts +1 -1
  102. package/dist/{cache-B2s0b-ss.d.mts → cache-C9a_hVCc.d.cts} +3 -3
  103. package/dist/{cache-B2s0b-ss.d.mts.map → cache-C9a_hVCc.d.cts.map} +1 -1
  104. package/dist/{cache-CYe2Kzjc.d.cts → cache-CeTMI8LR.d.mts} +3 -3
  105. package/dist/{cache-CYe2Kzjc.d.cts.map → cache-CeTMI8LR.d.mts.map} +1 -1
  106. package/dist/cache.d.cts +1 -1
  107. package/dist/cache.d.mts +1 -1
  108. package/dist/{construct-interface-D2gesxos.d.mts → construct-interface-_3zgxzXl.d.mts} +11 -20
  109. package/dist/{construct-interface-D2gesxos.d.mts.map → construct-interface-_3zgxzXl.d.mts.map} +1 -1
  110. package/dist/{construct-interface-DPusCUSQ.d.cts → construct-interface-_xi4BPN8.d.cts} +11 -20
  111. package/dist/{construct-interface-DPusCUSQ.d.cts.map → construct-interface-_xi4BPN8.d.cts.map} +1 -1
  112. package/dist/construct-interface.cjs +4 -33
  113. package/dist/construct-interface.cjs.map +1 -1
  114. package/dist/construct-interface.d.cts +2 -2
  115. package/dist/construct-interface.d.mts +2 -2
  116. package/dist/construct-interface.mjs +5 -32
  117. package/dist/construct-interface.mjs.map +1 -1
  118. package/dist/credential.cjs +22 -9
  119. package/dist/credential.cjs.map +1 -1
  120. package/dist/credential.d.cts +12 -2
  121. package/dist/credential.d.cts.map +1 -1
  122. package/dist/credential.d.mts +12 -2
  123. package/dist/credential.d.mts.map +1 -1
  124. package/dist/credential.mjs +22 -10
  125. package/dist/credential.mjs.map +1 -1
  126. package/dist/crons/index.cjs +1 -1
  127. package/dist/crons/index.d.cts +2 -2
  128. package/dist/crons/index.d.mts +2 -2
  129. package/dist/crons/index.mjs +1 -1
  130. package/dist/database/kysely.d.cts +1 -1
  131. package/dist/database/kysely.d.mts +1 -1
  132. package/dist/email.d.cts +1 -1
  133. package/dist/email.d.mts +1 -1
  134. package/dist/endpoints/index.cjs +5 -4
  135. package/dist/endpoints/index.d.cts +4 -13
  136. package/dist/endpoints/index.d.cts.map +1 -1
  137. package/dist/endpoints/index.d.mts +4 -13
  138. package/dist/endpoints/index.d.mts.map +1 -1
  139. package/dist/endpoints/index.mjs +4 -3
  140. package/dist/external-api-DS3mujT5.d.mts +86 -0
  141. package/dist/external-api-DS3mujT5.d.mts.map +1 -0
  142. package/dist/external-api-LBfE-q3g.d.cts +86 -0
  143. package/dist/external-api-LBfE-q3g.d.cts.map +1 -0
  144. package/dist/external-api.cjs +124 -0
  145. package/dist/external-api.cjs.map +1 -0
  146. package/dist/external-api.d.cts +2 -0
  147. package/dist/external-api.d.mts +2 -0
  148. package/dist/external-api.mjs +121 -0
  149. package/dist/external-api.mjs.map +1 -0
  150. package/dist/file-server.d.cts +1 -1
  151. package/dist/file-server.d.mts +1 -1
  152. package/dist/functions/index.cjs +1 -1
  153. package/dist/functions/index.d.cts +1 -1
  154. package/dist/functions/index.d.mts +1 -1
  155. package/dist/functions/index.mjs +1 -1
  156. package/dist/{functions-DlFm8HmH.mjs → functions-DCIfCRR-.mjs} +94 -23
  157. package/dist/functions-DCIfCRR-.mjs.map +1 -0
  158. package/dist/{functions-DKN6aQWJ.cjs → functions-ZH60FE7H.cjs} +99 -19
  159. package/dist/functions-ZH60FE7H.cjs.map +1 -0
  160. package/dist/{index-BI23K3wy.d.cts → index-B0kxstwf.d.cts} +36 -24
  161. package/dist/index-B0kxstwf.d.cts.map +1 -0
  162. package/dist/{index-yb3fXNyH.d.mts → index-CjVEjOw0.d.mts} +36 -24
  163. package/dist/index-CjVEjOw0.d.mts.map +1 -0
  164. package/dist/index.cjs +1 -1
  165. package/dist/index.d.cts +1 -1
  166. package/dist/index.d.mts +1 -1
  167. package/dist/index.mjs +1 -1
  168. package/dist/{kysely-CEVXacPN.d.cts → kysely-BJ8IQ_1P.d.mts} +4 -4
  169. package/dist/{kysely-CEVXacPN.d.cts.map → kysely-BJ8IQ_1P.d.mts.map} +1 -1
  170. package/dist/{kysely-mcTdPNhl.d.mts → kysely-DVF8wOT4.d.cts} +4 -4
  171. package/dist/{kysely-mcTdPNhl.d.mts.map → kysely-DVF8wOT4.d.cts.map} +1 -1
  172. package/dist/{lazyAccessors-BHtcqgz2.mjs → lazyAccessors-CFanua0O.mjs} +2 -39
  173. package/dist/lazyAccessors-CFanua0O.mjs.map +1 -0
  174. package/dist/{lazyAccessors-Dx9NLwJZ.cjs → lazyAccessors-hJKGv8Ay.cjs} +1 -50
  175. package/dist/lazyAccessors-hJKGv8Ay.cjs.map +1 -0
  176. package/dist/mobile-app.d.cts +1 -1
  177. package/dist/mobile-app.d.mts +1 -1
  178. package/dist/object-storage.d.cts +1 -1
  179. package/dist/object-storage.d.mts +1 -1
  180. package/dist/processAudits-BpRlPQMW.mjs.map +1 -1
  181. package/dist/processAudits-D_2W5x8k.cjs.map +1 -1
  182. package/dist/queue/index.cjs +4 -78
  183. package/dist/queue/index.d.cts +3 -53
  184. package/dist/queue/index.d.mts +3 -53
  185. package/dist/queue/index.mjs +3 -77
  186. package/dist/rest-api.cjs +2 -4
  187. package/dist/rest-api.cjs.map +1 -1
  188. package/dist/rest-api.d.cts +4 -5
  189. package/dist/rest-api.d.cts.map +1 -1
  190. package/dist/rest-api.d.mts +4 -5
  191. package/dist/rest-api.d.mts.map +1 -1
  192. package/dist/rest-api.mjs +2 -4
  193. package/dist/rest-api.mjs.map +1 -1
  194. package/dist/site.d.cts +1 -1
  195. package/dist/site.d.mts +1 -1
  196. package/dist/subscribers/index.cjs +1 -1
  197. package/dist/subscribers/index.d.cts +2 -2
  198. package/dist/subscribers/index.d.mts +2 -2
  199. package/dist/subscribers/index.mjs +1 -1
  200. package/dist/topic/index.cjs +1 -36
  201. package/dist/topic/index.d.cts +2 -3
  202. package/dist/topic/index.d.mts +2 -3
  203. package/dist/topic/index.mjs +2 -35
  204. package/dist/worker.cjs +26 -17
  205. package/dist/worker.cjs.map +1 -1
  206. package/dist/worker.d.cts +37 -29
  207. package/dist/worker.d.cts.map +1 -1
  208. package/dist/worker.d.mts +37 -29
  209. package/dist/worker.d.mts.map +1 -1
  210. package/dist/worker.mjs +26 -17
  211. package/dist/worker.mjs.map +1 -1
  212. package/package.json +41 -31
  213. package/dist/Construct-DTqYvkPG.d.cts +0 -115
  214. package/dist/Construct-DTqYvkPG.d.cts.map +0 -1
  215. package/dist/Construct-Detz65RA.mjs.map +0 -1
  216. package/dist/Construct-pVadmURD.d.mts +0 -115
  217. package/dist/Construct-pVadmURD.d.mts.map +0 -1
  218. package/dist/Construct-yG9Sw-5p.cjs.map +0 -1
  219. package/dist/Cron-B_iuyNxr.d.mts.map +0 -1
  220. package/dist/Cron-CA2oa2nC.d.cts.map +0 -1
  221. package/dist/CronBuilder-BIKCLWu7.d.mts.map +0 -1
  222. package/dist/CronBuilder-BRkzUOAs.mjs.map +0 -1
  223. package/dist/CronBuilder-B_KqaodP.d.cts.map +0 -1
  224. package/dist/CronBuilder-BbnT7tqo.cjs.map +0 -1
  225. package/dist/Endpoint-1-XYQSx0.d.cts.map +0 -1
  226. package/dist/Endpoint-DO332Dnm.mjs.map +0 -1
  227. package/dist/Endpoint-GFIxYb9L.d.mts.map +0 -1
  228. package/dist/Endpoint-QKuFg5gs.cjs.map +0 -1
  229. package/dist/EndpointFactory-B9HAjDAP.mjs.map +0 -1
  230. package/dist/EndpointFactory-BCZdh_u3.d.mts.map +0 -1
  231. package/dist/EndpointFactory-BmO0WnXE.cjs.map +0 -1
  232. package/dist/EndpointFactory-BnK_YkW1.d.cts.map +0 -1
  233. package/dist/HonoEndpointAdaptor-CiqAZ5Mt.mjs.map +0 -1
  234. package/dist/HonoEndpointAdaptor-DoEQdC3r.cjs.map +0 -1
  235. package/dist/Queue-B7yRXQmL.cjs.map +0 -1
  236. package/dist/Queue-Bhzi2WQC.d.cts.map +0 -1
  237. package/dist/Queue-BoUA-e83.d.mts.map +0 -1
  238. package/dist/Queue-DpKTLl6E.mjs.map +0 -1
  239. package/dist/Subscriber-CIO3pwji.d.mts.map +0 -1
  240. package/dist/Subscriber-DQCaiOXF.d.cts.map +0 -1
  241. package/dist/SubscriberBuilder-B4YRTBng.mjs.map +0 -1
  242. package/dist/SubscriberBuilder-C2FRfd26.d.mts.map +0 -1
  243. package/dist/SubscriberBuilder-C2bCOuPT.cjs.map +0 -1
  244. package/dist/SubscriberBuilder-CjDGSTZc.d.cts.map +0 -1
  245. package/dist/Topic-Ct3Le8Wt.mjs +0 -103
  246. package/dist/Topic-Ct3Le8Wt.mjs.map +0 -1
  247. package/dist/Topic-D5rlM9wS.cjs.map +0 -1
  248. package/dist/Topic-D6blllEn.d.cts +0 -89
  249. package/dist/Topic-D6blllEn.d.cts.map +0 -1
  250. package/dist/Topic-DVvheJ_-.d.mts +0 -89
  251. package/dist/Topic-DVvheJ_-.d.mts.map +0 -1
  252. package/dist/functions-DKN6aQWJ.cjs.map +0 -1
  253. package/dist/functions-DlFm8HmH.mjs.map +0 -1
  254. package/dist/index-BI23K3wy.d.cts.map +0 -1
  255. package/dist/index-fnpjXiA-.d.mts +0 -26
  256. package/dist/index-fnpjXiA-.d.mts.map +0 -1
  257. package/dist/index-tE_119SX.d.cts +0 -26
  258. package/dist/index-tE_119SX.d.cts.map +0 -1
  259. package/dist/index-yb3fXNyH.d.mts.map +0 -1
  260. package/dist/lazyAccessors-BHtcqgz2.mjs.map +0 -1
  261. package/dist/lazyAccessors-Dx9NLwJZ.cjs.map +0 -1
  262. package/dist/queue/index.cjs.map +0 -1
  263. package/dist/queue/index.d.cts.map +0 -1
  264. package/dist/queue/index.d.mts.map +0 -1
  265. package/dist/queue/index.mjs.map +0 -1
  266. package/dist/topic/index.cjs.map +0 -1
  267. package/dist/topic/index.mjs.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import { t as StandardSchemaV1 } from "./index-CeEtxDmK.mjs";
2
- import { t as Construct } from "./Construct-pVadmURD.mjs";
2
+ import { t as Construct } from "./Construct-QXnl3VqT.mjs";
3
3
  import { Declaration } from "@geekmidas/manifest";
4
4
  import { EventPublisher, PublishableMessage } from "@geekmidas/events";
5
5
  import { Service, ServiceRecord } from "@geekmidas/services";
@@ -16,13 +16,14 @@ type QueueMessage<TName extends string, TMessage extends StandardSchemaV1> = Pub
16
16
  /**
17
17
  * A queue worker — a point-to-point SQS-style queue and its single consumer.
18
18
  * Unlike a `Subscriber` (topic fan-out, filtered by `subscribedEvents`), a queue
19
- * drains every message of its one `message` type. Build one with `q` (see
20
- * `QueueBuilder`); `gkm build` discovers it into the manifest's `queues` field.
19
+ * drains every message of its one `message` type. Build one from the worker
20
+ * that runs it — `worker.queue('Emails').message(schema).handle(…)` — and
21
+ * `gkm build` discovers it into the manifest's `queues` field.
21
22
  *
22
- * The producer side is {@link Queue.publisher} — a ready-to-inject `Service`
23
- * that any endpoint/function drops into `.services([...])` to send messages.
23
+ * Producers send to it by depending on it: `.dependsOn([emails])` makes
24
+ * `services.emails` the publisher.
24
25
  */
25
- declare class Queue<TName extends string = string, TMessage extends StandardSchemaV1 = StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger> extends Construct<TLogger, string, undefined, undefined, TServices> {
26
+ declare class Queue<TName extends string = string, TMessage extends StandardSchemaV1 = StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger> extends Construct<TLogger, undefined, TServices> {
26
27
  readonly name: TName;
27
28
  readonly handler: QueueHandler<TMessage, TServices, TLogger>;
28
29
  readonly messageSchema: TMessage;
@@ -45,9 +46,19 @@ declare class Queue<TName extends string = string, TMessage extends StandardSche
45
46
  */
46
47
  readonly id: string;
47
48
  /**
48
- * The producer's env key. Read by both {@link declare} and
49
- * {@link publisher}, so what the target publishes and what the producer
50
- * looks up cannot drift.
49
+ * The queue as a dependency — what `.dependsOn([emails])` dissolves into,
50
+ * reachable as `services.emails`.
51
+ *
52
+ * The producer: the queue's one consumer is the handler it was built with,
53
+ * so the only thing another construct can want from a queue is to send to
54
+ * it. It reads `<NAME>_PUBLISHER_CONNECTION_STRING` and picks the transport
55
+ * from its protocol — `pgboss://` locally, `sqs://` deployed. A field
56
+ * assigned once, not a getter: services are cached by object identity.
57
+ */
58
+ readonly service: Service<Uncapitalize<TName>, EventPublisher<QueueMessage<TName, TMessage>>>;
59
+ /**
60
+ * The producer's env key. Read by both {@link declare} and the service, so
61
+ * what the target publishes and what the producer looks up cannot drift.
51
62
  */
52
63
  private readonly connectionKey;
53
64
  constructor(name: TName, handler: QueueHandler<TMessage, TServices, TLogger>, messageSchema: TMessage, timeout?: number, services?: TServices, logger?: TLogger,
@@ -69,28 +80,6 @@ declare class Queue<TName extends string = string, TMessage extends StandardSche
69
80
  * running and what connection string to inject.
70
81
  */
71
82
  declare(): Declaration[];
72
- /**
73
- * The producer side — a `Service` exposing an `EventPublisher` typed to this
74
- * queue's message. Inject it via `.services([queue.publisher])`; the handler
75
- * then calls `services.<name>Publisher.publish([{ type, payload }])`.
76
- *
77
- * It reads `<NAME>_PUBLISHER_CONNECTION_STRING` and builds the transport from
78
- * the URL protocol — `pgboss://` locally, `sqs://` deployed — so the same
79
- * code publishes to Postgres in dev and SQS in prod. Because it's a `Service`,
80
- * `Construct.getEnvironment()` sniffs it, so the env requirement flows into
81
- * the manifest and infra links exactly this queue with least privilege.
82
- */
83
- /**
84
- * The queue as a dependency — what `.dependsOn([emailsQueue])` dissolves
85
- * into, reachable as `services.emails`.
86
- *
87
- * It is the producer: a consumer is the worker written right here, so the
88
- * only thing another construct can want from a queue is the ability to send
89
- * to it. {@link publisher} is the same service under its older
90
- * `<name>Publisher` key, kept for `.services([queue.publisher])`.
91
- */
92
- get service(): Service<Uncapitalize<TName>, EventPublisher<QueueMessage<TName, TMessage>>>;
93
- get publisher(): Service<`${TName}Publisher`, EventPublisher<QueueMessage<TName, TMessage>>>;
94
83
  }
95
84
  /** The context a queue handler receives — a batch of typed messages. */
96
85
  type QueueContext<TMessage extends StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger> = {
@@ -101,4 +90,4 @@ type QueueContext<TMessage extends StandardSchemaV1, TServices extends Service[]
101
90
  type QueueHandler<TMessage extends StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger> = (ctx: QueueContext<TMessage, TServices, TLogger>) => unknown | Promise<unknown>;
102
91
  //#endregion
103
92
  export { QueueMessage as i, QueueContext as n, QueueHandler as r, Queue as t };
104
- //# sourceMappingURL=Queue-BoUA-e83.d.mts.map
93
+ //# sourceMappingURL=Queue-YmvN2vEP.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Queue-YmvN2vEP.d.mts","names":[],"sources":["../src/queue/Queue.ts"],"mappings":";;;;;;;;;;;;;;KAyBY,aACX,sBACA,iBAAiB,oBACd,mBAAmB,OAAO,oBAAoB;;;;;;;;;;;cAYrC,MACZ,+BACA,iBAAiB,mBAAmB,kBACpC,kBAAkB,gBAClB,gBAAgB,SAAS,gBAChB,UAAU,oBAAoB;WA6CtB,MAAM;WACN,SAAS,aAAa,UAAU,WAAW;WAC3C,eAAe;WACN;WACA,UAAU;WACV,QAAQ;;WAEjB;;WAEA;EArDjB;SAEO,QACN,eACE,OAAO,cAAc,kBAAkB,WAAW;;;;;;;;;WAgB5C;;;;;;;;;;;WAYA,SAAS,QACjB,aAAa,QACb,eAAe,aAAa,OAAO;;;;;mBAOnB;EAEjB,YACiB,MAAM,OACN,SAAS,aAAa,UAAU,WAAW,UAC3C,eAAe,UACN,kBACA,WAAU,WACV,SAAQ,SAEjB;;EAAA,gCAEA;;EAAA,4BAKhB;;;;;EAAA;;;;;;;;;EAwCD,WAAW;;;KA2BA,aACX,iBAAiB,kBACjB,kBAAkB,gBAClB,gBAAgB,SAAS;EAEzB,UAAU,oBAAoB;EAC9B,UAAU,cAAc;EACxB,QAAQ;;KAGG,aACX,iBAAiB,kBACjB,kBAAkB,gBAClB,gBAAgB,SAAS,WAEzB,KAAK,aAAa,UAAU,WAAW,uBACzB"}
@@ -0,0 +1,112 @@
1
+ const require_construct_interface = require("./construct-interface.cjs");
2
+ const require_clone = require("./clone-UGJpvQnL.cjs");
3
+ const require_Queue = require("./Queue-Ckmudcm8.cjs");
4
+ let _geekmidas_logger_console = require("@geekmidas/logger/console");
5
+ //#region src/queue/QueueBuilder.ts
6
+ /**
7
+ * Builds a {@link Queue} and its one consumer. Reached through
8
+ * `worker.queue('orders')`, never constructed by hand: the worker stamps itself
9
+ * as the owner. `message` is the typed job payload and `handle` the consumer.
10
+ * The queue name is captured as a literal so `queue.service` publishes
11
+ * `{ type: '<name>', payload }`.
12
+ */
13
+ var QueueBuilder = class {
14
+ _name;
15
+ _messageSchema;
16
+ _timeout = 3e4;
17
+ _batchSize;
18
+ _fifo;
19
+ _services = [];
20
+ /** The construct ids `.dependsOn()` named — what the manifest records. */
21
+ _constructs = [];
22
+ _logger = _geekmidas_logger_console.DEFAULT_LOGGER;
23
+ /** The worker that runs this queue's consumer — stamped by `worker.queue()`. */
24
+ _owner;
25
+ /** The queue name — drives the infra queue and its `<NAME>_*` env vars. */
26
+ queue(name) {
27
+ return require_clone.cloneWith(this, { _name: name });
28
+ }
29
+ timeout(timeout) {
30
+ return require_clone.cloneWith(this, { _timeout: timeout });
31
+ }
32
+ /** SQS event-source batch size (deployed). */
33
+ batchSize(batchSize) {
34
+ return require_clone.cloneWith(this, { _batchSize: batchSize });
35
+ }
36
+ /** Mark the queue as FIFO (deployed). */
37
+ fifo(fifo = true) {
38
+ return require_clone.cloneWith(this, { _fifo: fifo });
39
+ }
40
+ /**
41
+ * Depend on constructs — a database, a bucket, a mail sender, a queue, a
42
+ * topic.
43
+ *
44
+ * It records the edge and dissolves each construct's client into the
45
+ * handler's service record under the construct's own id, so
46
+ * `.dependsOn([uploads])` is what makes `services.uploads` exist and type.
47
+ *
48
+ * Constructs only. A `Service` does not match the shape, which is what keeps
49
+ * env sniffing confined to `.services()` and the explicit lift.
50
+ */
51
+ dependsOn(constructs) {
52
+ const services = require_construct_interface.servicesOf(constructs);
53
+ return require_clone.cloneWith(this, {
54
+ _services: [...this._services, ...services],
55
+ _constructs: require_construct_interface.idsOf(constructs, this._constructs)
56
+ });
57
+ }
58
+ services(services) {
59
+ return require_clone.cloneWith(this, { _services: [...this._services, ...services] });
60
+ }
61
+ logger(logger) {
62
+ return require_clone.cloneWith(this, { _logger: logger });
63
+ }
64
+ /** The typed message (job) payload the queue carries. */
65
+ message(schema) {
66
+ return require_clone.cloneWith(this, { _messageSchema: schema });
67
+ }
68
+ handle(fn) {
69
+ if (!this._name) throw new QueueNeedsName();
70
+ if (!this._messageSchema) throw new QueueNeedsMessage(this._name);
71
+ const queue = new require_Queue.Queue(this._name, fn, this._messageSchema, this._timeout, this._services, this._logger, this._batchSize, this._fifo, this._constructs);
72
+ queue.owner = this._owner;
73
+ return queue;
74
+ }
75
+ };
76
+ /** A queue built without a name — only reachable by building one by hand. */
77
+ var QueueNeedsName = class extends Error {
78
+ constructor() {
79
+ super("A queue needs a name: build it from a worker, worker.queue('Emails').");
80
+ this.name = "QueueNeedsName";
81
+ }
82
+ };
83
+ /** A queue whose message was never described. */
84
+ var QueueNeedsMessage = class extends Error {
85
+ queue;
86
+ constructor(queue) {
87
+ super(`Queue '${queue}' has no message: call .message(schema) before .handle(), so its producers and its consumer agree on what it carries.`);
88
+ this.queue = queue;
89
+ this.name = "QueueNeedsMessage";
90
+ }
91
+ };
92
+ //#endregion
93
+ Object.defineProperty(exports, "QueueBuilder", {
94
+ enumerable: true,
95
+ get: function() {
96
+ return QueueBuilder;
97
+ }
98
+ });
99
+ Object.defineProperty(exports, "QueueNeedsMessage", {
100
+ enumerable: true,
101
+ get: function() {
102
+ return QueueNeedsMessage;
103
+ }
104
+ });
105
+ Object.defineProperty(exports, "QueueNeedsName", {
106
+ enumerable: true,
107
+ get: function() {
108
+ return QueueNeedsName;
109
+ }
110
+ });
111
+
112
+ //# sourceMappingURL=QueueBuilder-CJNcv4dy.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueueBuilder-CJNcv4dy.cjs","names":["DEFAULT_LOGGER","cloneWith","servicesOf","idsOf","Queue"],"sources":["../src/queue/QueueBuilder.ts"],"sourcesContent":["import type { Logger } from '@geekmidas/logger';\nimport { DEFAULT_LOGGER } from '@geekmidas/logger/console';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { cloneWith } from '../clone';\nimport {\n\ttype Consumable,\n\tidsOf,\n\ttype ServicesOf,\n\tservicesOf,\n} from '../construct-interface';\nimport { Queue, type QueueHandler } from './Queue';\n\n/**\n * Builds a {@link Queue} and its one consumer. Reached through\n * `worker.queue('orders')`, never constructed by hand: the worker stamps itself\n * as the owner. `message` is the typed job payload and `handle` the consumer.\n * The queue name is captured as a literal so `queue.service` publishes\n * `{ type: '<name>', payload }`.\n */\nexport class QueueBuilder<\n\tTName extends string = string,\n\tTMessage extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n> {\n\tprivate _name?: string;\n\tprivate _messageSchema?: TMessage;\n\tprivate _timeout = 30000;\n\tprivate _batchSize?: number;\n\tprivate _fifo?: boolean;\n\tprivate _services: TServices = [] as Service[] as TServices;\n\t/** The construct ids `.dependsOn()` named — what the manifest records. */\n\tpublic _constructs: string[] = [];\n\tprivate _logger: TLogger = DEFAULT_LOGGER as TLogger;\n\t/** The worker that runs this queue's consumer — stamped by `worker.queue()`. */\n\tpublic _owner?: string;\n\n\t/** The queue name — drives the infra queue and its `<NAME>_*` env vars. */\n\tqueue<T extends string>(\n\t\tname: T,\n\t): QueueBuilder<T, TMessage, TServices, TLogger> {\n\t\treturn cloneWith(this, { _name: name }) as unknown as QueueBuilder<\n\t\t\tT,\n\t\t\tTMessage,\n\t\t\tTServices,\n\t\t\tTLogger\n\t\t>;\n\t}\n\n\ttimeout(timeout: number): this {\n\t\treturn cloneWith(this, { _timeout: timeout });\n\t}\n\n\t/** SQS event-source batch size (deployed). */\n\tbatchSize(batchSize: number): this {\n\t\treturn cloneWith(this, { _batchSize: batchSize });\n\t}\n\n\t/** Mark the queue as FIFO (deployed). */\n\tfifo(fifo = true): this {\n\t\treturn cloneWith(this, { _fifo: fifo });\n\t}\n\n\t/**\n\t * Depend on constructs — a database, a bucket, a mail sender, a queue, a\n\t * topic.\n\t *\n\t * It records the edge and dissolves each construct's client into the\n\t * handler's service record under the construct's own id, so\n\t * `.dependsOn([uploads])` is what makes `services.uploads` exist and type.\n\t *\n\t * Constructs only. A `Service` does not match the shape, which is what keeps\n\t * env sniffing confined to `.services()` and the explicit lift.\n\t */\n\tdependsOn<const T extends readonly Consumable[]>(\n\t\tconstructs: T,\n\t): QueueBuilder<TName, TMessage, [...TServices, ...ServicesOf<T>], TLogger> {\n\t\t// Both halves of the edge, from one call and one clone: the services the\n\t\t// handler runs with, and the ids the manifest records. Recording them\n\t\t// separately is what let them drift apart.\n\t\t//\n\t\t// `servicesOf` is the half that validates, so it runs first — recording\n\t\t// ids ahead of it left a caught `NotAConstruct` with `undefined` already\n\t\t// on a `string[]`.\n\t\tconst services = servicesOf(constructs) as unknown as Service[];\n\n\t\treturn cloneWith(this, {\n\t\t\t_services: [...this._services, ...services],\n\t\t\t_constructs: idsOf(constructs, this._constructs),\n\t\t}) as unknown as QueueBuilder<\n\t\t\tTName,\n\t\t\tTMessage,\n\t\t\t[...TServices, ...ServicesOf<T>],\n\t\t\tTLogger\n\t\t>;\n\t}\n\n\tservices<T extends Service[]>(\n\t\tservices: T,\n\t): QueueBuilder<TName, TMessage, [...TServices, ...T], TLogger> {\n\t\treturn cloneWith(this, {\n\t\t\t_services: [...this._services, ...services] as unknown as TServices,\n\t\t}) as unknown as QueueBuilder<\n\t\t\tTName,\n\t\t\tTMessage,\n\t\t\t[...TServices, ...T],\n\t\t\tTLogger\n\t\t>;\n\t}\n\n\tlogger<T extends Logger>(\n\t\tlogger: T,\n\t): QueueBuilder<TName, TMessage, TServices, T> {\n\t\treturn cloneWith(this, {\n\t\t\t_logger: logger as unknown as TLogger,\n\t\t}) as unknown as QueueBuilder<TName, TMessage, TServices, T>;\n\t}\n\n\t/** The typed message (job) payload the queue carries. */\n\tmessage<T extends StandardSchemaV1>(\n\t\tschema: T,\n\t): QueueBuilder<TName, T, TServices, TLogger> {\n\t\treturn cloneWith(this, {\n\t\t\t_messageSchema: schema as unknown as TMessage,\n\t\t}) as unknown as QueueBuilder<TName, T, TServices, TLogger>;\n\t}\n\n\thandle(\n\t\tfn: QueueHandler<NonNullable<TMessage>, TServices, TLogger>,\n\t): Queue<TName, NonNullable<TMessage>, TServices, TLogger> {\n\t\tif (!this._name) throw new QueueNeedsName();\n\t\tif (!this._messageSchema) throw new QueueNeedsMessage(this._name);\n\n\t\tconst queue = new Queue<TName, NonNullable<TMessage>, TServices, TLogger>(\n\t\t\tthis._name as TName,\n\t\t\tfn,\n\t\t\tthis._messageSchema as NonNullable<TMessage>,\n\t\t\tthis._timeout,\n\t\t\tthis._services,\n\t\t\tthis._logger,\n\t\t\tthis._batchSize,\n\t\t\tthis._fifo,\n\t\t\tthis._constructs,\n\t\t);\n\t\t// Which process runs the consumer: the worker it was built from.\n\t\tqueue.owner = this._owner;\n\n\t\t// No reset. `.handle()` reads this builder and leaves it alone, so a\n\t\t// configured base — `const fn = f.logger(log).timeout(60_000)` — keeps\n\t\t// its configuration for every construct built from it. The reset that\n\t\t// used to be here wiped the base on first use, which made a base usable\n\t\t// exactly once, and quietly reverted the logger to the default.\n\n\t\treturn queue;\n\t}\n}\n\n/** A queue built without a name — only reachable by building one by hand. */\nexport class QueueNeedsName extends Error {\n\tconstructor() {\n\t\tsuper(\n\t\t\t\"A queue needs a name: build it from a worker, worker.queue('Emails').\",\n\t\t);\n\t\tthis.name = 'QueueNeedsName';\n\t}\n}\n\n/** A queue whose message was never described. */\nexport class QueueNeedsMessage extends Error {\n\tconstructor(readonly queue: string) {\n\t\tsuper(\n\t\t\t`Queue '${queue}' has no message: call .message(schema) before .handle(), ` +\n\t\t\t\t'so its producers and its consumer agree on what it carries.',\n\t\t);\n\t\tthis.name = 'QueueNeedsMessage';\n\t}\n}\n"],"mappings":";;;;;;;;;;;;AAoBA,IAAa,eAAb,MAKE;CACD;CACA;CACA,WAAmB;CACnB;CACA;CACA,YAA+B,CAAC;;CAEhC,cAA+B,CAAC;CAChC,UAA2BA,0BAAAA;;CAE3B;;CAGA,MACC,MACgD;EAChD,OAAOC,cAAAA,UAAU,MAAM,EAAE,OAAO,KAAK,CAAC;CAMvC;CAEA,QAAQ,SAAuB;EAC9B,OAAOA,cAAAA,UAAU,MAAM,EAAE,UAAU,QAAQ,CAAC;CAC7C;;CAGA,UAAU,WAAyB;EAClC,OAAOA,cAAAA,UAAU,MAAM,EAAE,YAAY,UAAU,CAAC;CACjD;;CAGA,KAAK,OAAO,MAAY;EACvB,OAAOA,cAAAA,UAAU,MAAM,EAAE,OAAO,KAAK,CAAC;CACvC;;;;;;;;;;;;CAaA,UACC,YAC2E;EAQ3E,MAAM,WAAWC,4BAAAA,WAAW,UAAU;EAEtC,OAAOD,cAAAA,UAAU,MAAM;GACtB,WAAW,CAAC,GAAG,KAAK,WAAW,GAAG,QAAQ;GAC1C,aAAaE,4BAAAA,MAAM,YAAY,KAAK,WAAW;EAChD,CAAC;CAMF;CAEA,SACC,UAC+D;EAC/D,OAAOF,cAAAA,UAAU,MAAM,EACtB,WAAW,CAAC,GAAG,KAAK,WAAW,GAAG,QAAQ,EAC3C,CAAC;CAMF;CAEA,OACC,QAC8C;EAC9C,OAAOA,cAAAA,UAAU,MAAM,EACtB,SAAS,OACV,CAAC;CACF;;CAGA,QACC,QAC6C;EAC7C,OAAOA,cAAAA,UAAU,MAAM,EACtB,gBAAgB,OACjB,CAAC;CACF;CAEA,OACC,IAC0D;EAC1D,IAAI,CAAC,KAAK,OAAO,MAAM,IAAI,eAAe;EAC1C,IAAI,CAAC,KAAK,gBAAgB,MAAM,IAAI,kBAAkB,KAAK,KAAK;EAEhE,MAAM,QAAQ,IAAIG,cAAAA,MACjB,KAAK,OACL,IACA,KAAK,gBACL,KAAK,UACL,KAAK,WACL,KAAK,SACL,KAAK,YACL,KAAK,OACL,KAAK,WACN;EAEA,MAAM,QAAQ,KAAK;EAQnB,OAAO;CACR;AACD;;AAGA,IAAa,iBAAb,cAAoC,MAAM;CACzC,cAAc;EACb,MACC,uEACD;EACA,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,oBAAb,cAAuC,MAAM;CACvB;CAArB,YAAY,OAAwB;EACnC,MACC,UAAU,MAAM,sHAEjB;EAJoB,KAAA,QAAA;EAKpB,KAAK,OAAO;CACb;AACD"}
@@ -0,0 +1,62 @@
1
+ import { t as StandardSchemaV1 } from "./index-CeEtxDmK.mjs";
2
+ import { c as ServicesOf, r as Consumable } from "./construct-interface-_3zgxzXl.mjs";
3
+ import { r as QueueHandler, t as Queue } from "./Queue-YmvN2vEP.mjs";
4
+ import { Service } from "@geekmidas/services";
5
+ import { Logger } from "@geekmidas/logger";
6
+ //#region src/queue/QueueBuilder.d.ts
7
+ /**
8
+ * Builds a {@link Queue} and its one consumer. Reached through
9
+ * `worker.queue('orders')`, never constructed by hand: the worker stamps itself
10
+ * as the owner. `message` is the typed job payload and `handle` the consumer.
11
+ * The queue name is captured as a literal so `queue.service` publishes
12
+ * `{ type: '<name>', payload }`.
13
+ */
14
+ declare class QueueBuilder<TName extends string = string, TMessage extends StandardSchemaV1 | undefined = undefined, TServices extends Service[] = [], TLogger extends Logger = Logger> {
15
+ private _name?;
16
+ private _messageSchema?;
17
+ private _timeout;
18
+ private _batchSize?;
19
+ private _fifo?;
20
+ private _services;
21
+ /** The construct ids `.dependsOn()` named — what the manifest records. */
22
+ _constructs: string[];
23
+ private _logger;
24
+ /** The worker that runs this queue's consumer — stamped by `worker.queue()`. */
25
+ _owner?: string;
26
+ /** The queue name — drives the infra queue and its `<NAME>_*` env vars. */
27
+ queue<T extends string>(name: T): QueueBuilder<T, TMessage, TServices, TLogger>;
28
+ timeout(timeout: number): this;
29
+ /** SQS event-source batch size (deployed). */
30
+ batchSize(batchSize: number): this;
31
+ /** Mark the queue as FIFO (deployed). */
32
+ fifo(fifo?: boolean): this;
33
+ /**
34
+ * Depend on constructs — a database, a bucket, a mail sender, a queue, a
35
+ * topic.
36
+ *
37
+ * It records the edge and dissolves each construct's client into the
38
+ * handler's service record under the construct's own id, so
39
+ * `.dependsOn([uploads])` is what makes `services.uploads` exist and type.
40
+ *
41
+ * Constructs only. A `Service` does not match the shape, which is what keeps
42
+ * env sniffing confined to `.services()` and the explicit lift.
43
+ */
44
+ dependsOn<const T extends readonly Consumable[]>(constructs: T): QueueBuilder<TName, TMessage, [...TServices, ...ServicesOf<T>], TLogger>;
45
+ services<T extends Service[]>(services: T): QueueBuilder<TName, TMessage, [...TServices, ...T], TLogger>;
46
+ logger<T extends Logger>(logger: T): QueueBuilder<TName, TMessage, TServices, T>;
47
+ /** The typed message (job) payload the queue carries. */
48
+ message<T extends StandardSchemaV1>(schema: T): QueueBuilder<TName, T, TServices, TLogger>;
49
+ handle(fn: QueueHandler<NonNullable<TMessage>, TServices, TLogger>): Queue<TName, NonNullable<TMessage>, TServices, TLogger>;
50
+ }
51
+ /** A queue built without a name — only reachable by building one by hand. */
52
+ declare class QueueNeedsName extends Error {
53
+ constructor();
54
+ }
55
+ /** A queue whose message was never described. */
56
+ declare class QueueNeedsMessage extends Error {
57
+ readonly queue: string;
58
+ constructor(queue: string);
59
+ }
60
+ //#endregion
61
+ export { QueueNeedsMessage as n, QueueNeedsName as r, QueueBuilder as t };
62
+ //# sourceMappingURL=QueueBuilder-CM0WUxfw.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueueBuilder-CM0WUxfw.d.mts","names":[],"sources":["../src/queue/QueueBuilder.ts"],"mappings":";;;;;;;;;;;;;cAoBa,aACZ,+BACA,iBAAiB,0CACjB,kBAAkB,gBAClB,gBAAgB,SAAS;UAEjB;UACA;UACA;UACA;UACA;UACA;;EAED;UACC;;EAED;;EAGP,MAAM,kBACL,MAAM,IACJ,aAAa,GAAG,UAAU,WAAW;EASxC,QAAQ;;EAKR,UAAU;;EAKV,KAAK;;;;;;;;;;;;EAeL,gBAAgB,mBAAmB,cAClC,YAAY,IACV,aAAa,OAAO,cAAc,cAAc,WAAW,KAAK;EAqBnE,SAAS,UAAU,WAClB,UAAU,IACR,aAAa,OAAO,cAAc,cAAc,IAAI;EAWvD,OAAO,UAAU,QAChB,QAAQ,IACN,aAAa,OAAO,UAAU,WAAW;;EAO5C,QAAQ,UAAU,kBACjB,QAAQ,IACN,aAAa,OAAO,GAAG,WAAW;EAMrC,OACC,IAAI,aAAa,YAAY,WAAW,WAAW,WACjD,MAAM,OAAO,YAAY,WAAW,WAAW;;;cA6BtC,uBAAuB;EACnC;;;cASY,0BAA0B;WACjB;EAArB,YAAqB"}
@@ -0,0 +1,62 @@
1
+ import { t as StandardSchemaV1 } from "./index-CeEtxDmK.cjs";
2
+ import { c as ServicesOf, r as Consumable } from "./construct-interface-_xi4BPN8.cjs";
3
+ import { r as QueueHandler, t as Queue } from "./Queue-CpQIGB_2.cjs";
4
+ import { Logger } from "@geekmidas/logger";
5
+ import { Service } from "@geekmidas/services";
6
+ //#region src/queue/QueueBuilder.d.ts
7
+ /**
8
+ * Builds a {@link Queue} and its one consumer. Reached through
9
+ * `worker.queue('orders')`, never constructed by hand: the worker stamps itself
10
+ * as the owner. `message` is the typed job payload and `handle` the consumer.
11
+ * The queue name is captured as a literal so `queue.service` publishes
12
+ * `{ type: '<name>', payload }`.
13
+ */
14
+ declare class QueueBuilder<TName extends string = string, TMessage extends StandardSchemaV1 | undefined = undefined, TServices extends Service[] = [], TLogger extends Logger = Logger> {
15
+ private _name?;
16
+ private _messageSchema?;
17
+ private _timeout;
18
+ private _batchSize?;
19
+ private _fifo?;
20
+ private _services;
21
+ /** The construct ids `.dependsOn()` named — what the manifest records. */
22
+ _constructs: string[];
23
+ private _logger;
24
+ /** The worker that runs this queue's consumer — stamped by `worker.queue()`. */
25
+ _owner?: string;
26
+ /** The queue name — drives the infra queue and its `<NAME>_*` env vars. */
27
+ queue<T extends string>(name: T): QueueBuilder<T, TMessage, TServices, TLogger>;
28
+ timeout(timeout: number): this;
29
+ /** SQS event-source batch size (deployed). */
30
+ batchSize(batchSize: number): this;
31
+ /** Mark the queue as FIFO (deployed). */
32
+ fifo(fifo?: boolean): this;
33
+ /**
34
+ * Depend on constructs — a database, a bucket, a mail sender, a queue, a
35
+ * topic.
36
+ *
37
+ * It records the edge and dissolves each construct's client into the
38
+ * handler's service record under the construct's own id, so
39
+ * `.dependsOn([uploads])` is what makes `services.uploads` exist and type.
40
+ *
41
+ * Constructs only. A `Service` does not match the shape, which is what keeps
42
+ * env sniffing confined to `.services()` and the explicit lift.
43
+ */
44
+ dependsOn<const T extends readonly Consumable[]>(constructs: T): QueueBuilder<TName, TMessage, [...TServices, ...ServicesOf<T>], TLogger>;
45
+ services<T extends Service[]>(services: T): QueueBuilder<TName, TMessage, [...TServices, ...T], TLogger>;
46
+ logger<T extends Logger>(logger: T): QueueBuilder<TName, TMessage, TServices, T>;
47
+ /** The typed message (job) payload the queue carries. */
48
+ message<T extends StandardSchemaV1>(schema: T): QueueBuilder<TName, T, TServices, TLogger>;
49
+ handle(fn: QueueHandler<NonNullable<TMessage>, TServices, TLogger>): Queue<TName, NonNullable<TMessage>, TServices, TLogger>;
50
+ }
51
+ /** A queue built without a name — only reachable by building one by hand. */
52
+ declare class QueueNeedsName extends Error {
53
+ constructor();
54
+ }
55
+ /** A queue whose message was never described. */
56
+ declare class QueueNeedsMessage extends Error {
57
+ readonly queue: string;
58
+ constructor(queue: string);
59
+ }
60
+ //#endregion
61
+ export { QueueNeedsMessage as n, QueueNeedsName as r, QueueBuilder as t };
62
+ //# sourceMappingURL=QueueBuilder-XEnnOWGe.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueueBuilder-XEnnOWGe.d.cts","names":[],"sources":["../src/queue/QueueBuilder.ts"],"mappings":";;;;;;;;;;;;;cAoBa,aACZ,+BACA,iBAAiB,0CACjB,kBAAkB,gBAClB,gBAAgB,SAAS;UAEjB;UACA;UACA;UACA;UACA;UACA;;EAED;UACC;;EAED;;EAGP,MAAM,kBACL,MAAM,IACJ,aAAa,GAAG,UAAU,WAAW;EASxC,QAAQ;;EAKR,UAAU;;EAKV,KAAK;;;;;;;;;;;;EAeL,gBAAgB,mBAAmB,cAClC,YAAY,IACV,aAAa,OAAO,cAAc,cAAc,WAAW,KAAK;EAqBnE,SAAS,UAAU,WAClB,UAAU,IACR,aAAa,OAAO,cAAc,cAAc,IAAI;EAWvD,OAAO,UAAU,QAChB,QAAQ,IACN,aAAa,OAAO,UAAU,WAAW;;EAO5C,QAAQ,UAAU,kBACjB,QAAQ,IACN,aAAa,OAAO,GAAG,WAAW;EAMrC,OACC,IAAI,aAAa,YAAY,WAAW,WAAW,WACjD,MAAM,OAAO,YAAY,WAAW,WAAW;;;cA6BtC,uBAAuB;EACnC;;;cASY,0BAA0B;WACjB;EAArB,YAAqB"}
@@ -0,0 +1,95 @@
1
+ import { idsOf, servicesOf } from "./construct-interface.mjs";
2
+ import { t as cloneWith } from "./clone-EKNovYHu.mjs";
3
+ import { t as Queue } from "./Queue-C1uDgjxt.mjs";
4
+ import { DEFAULT_LOGGER } from "@geekmidas/logger/console";
5
+ //#region src/queue/QueueBuilder.ts
6
+ /**
7
+ * Builds a {@link Queue} and its one consumer. Reached through
8
+ * `worker.queue('orders')`, never constructed by hand: the worker stamps itself
9
+ * as the owner. `message` is the typed job payload and `handle` the consumer.
10
+ * The queue name is captured as a literal so `queue.service` publishes
11
+ * `{ type: '<name>', payload }`.
12
+ */
13
+ var QueueBuilder = class {
14
+ _name;
15
+ _messageSchema;
16
+ _timeout = 3e4;
17
+ _batchSize;
18
+ _fifo;
19
+ _services = [];
20
+ /** The construct ids `.dependsOn()` named — what the manifest records. */
21
+ _constructs = [];
22
+ _logger = DEFAULT_LOGGER;
23
+ /** The worker that runs this queue's consumer — stamped by `worker.queue()`. */
24
+ _owner;
25
+ /** The queue name — drives the infra queue and its `<NAME>_*` env vars. */
26
+ queue(name) {
27
+ return cloneWith(this, { _name: name });
28
+ }
29
+ timeout(timeout) {
30
+ return cloneWith(this, { _timeout: timeout });
31
+ }
32
+ /** SQS event-source batch size (deployed). */
33
+ batchSize(batchSize) {
34
+ return cloneWith(this, { _batchSize: batchSize });
35
+ }
36
+ /** Mark the queue as FIFO (deployed). */
37
+ fifo(fifo = true) {
38
+ return cloneWith(this, { _fifo: fifo });
39
+ }
40
+ /**
41
+ * Depend on constructs — a database, a bucket, a mail sender, a queue, a
42
+ * topic.
43
+ *
44
+ * It records the edge and dissolves each construct's client into the
45
+ * handler's service record under the construct's own id, so
46
+ * `.dependsOn([uploads])` is what makes `services.uploads` exist and type.
47
+ *
48
+ * Constructs only. A `Service` does not match the shape, which is what keeps
49
+ * env sniffing confined to `.services()` and the explicit lift.
50
+ */
51
+ dependsOn(constructs) {
52
+ const services = servicesOf(constructs);
53
+ return cloneWith(this, {
54
+ _services: [...this._services, ...services],
55
+ _constructs: idsOf(constructs, this._constructs)
56
+ });
57
+ }
58
+ services(services) {
59
+ return cloneWith(this, { _services: [...this._services, ...services] });
60
+ }
61
+ logger(logger) {
62
+ return cloneWith(this, { _logger: logger });
63
+ }
64
+ /** The typed message (job) payload the queue carries. */
65
+ message(schema) {
66
+ return cloneWith(this, { _messageSchema: schema });
67
+ }
68
+ handle(fn) {
69
+ if (!this._name) throw new QueueNeedsName();
70
+ if (!this._messageSchema) throw new QueueNeedsMessage(this._name);
71
+ const queue = new Queue(this._name, fn, this._messageSchema, this._timeout, this._services, this._logger, this._batchSize, this._fifo, this._constructs);
72
+ queue.owner = this._owner;
73
+ return queue;
74
+ }
75
+ };
76
+ /** A queue built without a name — only reachable by building one by hand. */
77
+ var QueueNeedsName = class extends Error {
78
+ constructor() {
79
+ super("A queue needs a name: build it from a worker, worker.queue('Emails').");
80
+ this.name = "QueueNeedsName";
81
+ }
82
+ };
83
+ /** A queue whose message was never described. */
84
+ var QueueNeedsMessage = class extends Error {
85
+ queue;
86
+ constructor(queue) {
87
+ super(`Queue '${queue}' has no message: call .message(schema) before .handle(), so its producers and its consumer agree on what it carries.`);
88
+ this.queue = queue;
89
+ this.name = "QueueNeedsMessage";
90
+ }
91
+ };
92
+ //#endregion
93
+ export { QueueNeedsMessage as n, QueueNeedsName as r, QueueBuilder as t };
94
+
95
+ //# sourceMappingURL=QueueBuilder-XuPKZwKH.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueueBuilder-XuPKZwKH.mjs","names":[],"sources":["../src/queue/QueueBuilder.ts"],"sourcesContent":["import type { Logger } from '@geekmidas/logger';\nimport { DEFAULT_LOGGER } from '@geekmidas/logger/console';\nimport type { Service } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { cloneWith } from '../clone';\nimport {\n\ttype Consumable,\n\tidsOf,\n\ttype ServicesOf,\n\tservicesOf,\n} from '../construct-interface';\nimport { Queue, type QueueHandler } from './Queue';\n\n/**\n * Builds a {@link Queue} and its one consumer. Reached through\n * `worker.queue('orders')`, never constructed by hand: the worker stamps itself\n * as the owner. `message` is the typed job payload and `handle` the consumer.\n * The queue name is captured as a literal so `queue.service` publishes\n * `{ type: '<name>', payload }`.\n */\nexport class QueueBuilder<\n\tTName extends string = string,\n\tTMessage extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n> {\n\tprivate _name?: string;\n\tprivate _messageSchema?: TMessage;\n\tprivate _timeout = 30000;\n\tprivate _batchSize?: number;\n\tprivate _fifo?: boolean;\n\tprivate _services: TServices = [] as Service[] as TServices;\n\t/** The construct ids `.dependsOn()` named — what the manifest records. */\n\tpublic _constructs: string[] = [];\n\tprivate _logger: TLogger = DEFAULT_LOGGER as TLogger;\n\t/** The worker that runs this queue's consumer — stamped by `worker.queue()`. */\n\tpublic _owner?: string;\n\n\t/** The queue name — drives the infra queue and its `<NAME>_*` env vars. */\n\tqueue<T extends string>(\n\t\tname: T,\n\t): QueueBuilder<T, TMessage, TServices, TLogger> {\n\t\treturn cloneWith(this, { _name: name }) as unknown as QueueBuilder<\n\t\t\tT,\n\t\t\tTMessage,\n\t\t\tTServices,\n\t\t\tTLogger\n\t\t>;\n\t}\n\n\ttimeout(timeout: number): this {\n\t\treturn cloneWith(this, { _timeout: timeout });\n\t}\n\n\t/** SQS event-source batch size (deployed). */\n\tbatchSize(batchSize: number): this {\n\t\treturn cloneWith(this, { _batchSize: batchSize });\n\t}\n\n\t/** Mark the queue as FIFO (deployed). */\n\tfifo(fifo = true): this {\n\t\treturn cloneWith(this, { _fifo: fifo });\n\t}\n\n\t/**\n\t * Depend on constructs — a database, a bucket, a mail sender, a queue, a\n\t * topic.\n\t *\n\t * It records the edge and dissolves each construct's client into the\n\t * handler's service record under the construct's own id, so\n\t * `.dependsOn([uploads])` is what makes `services.uploads` exist and type.\n\t *\n\t * Constructs only. A `Service` does not match the shape, which is what keeps\n\t * env sniffing confined to `.services()` and the explicit lift.\n\t */\n\tdependsOn<const T extends readonly Consumable[]>(\n\t\tconstructs: T,\n\t): QueueBuilder<TName, TMessage, [...TServices, ...ServicesOf<T>], TLogger> {\n\t\t// Both halves of the edge, from one call and one clone: the services the\n\t\t// handler runs with, and the ids the manifest records. Recording them\n\t\t// separately is what let them drift apart.\n\t\t//\n\t\t// `servicesOf` is the half that validates, so it runs first — recording\n\t\t// ids ahead of it left a caught `NotAConstruct` with `undefined` already\n\t\t// on a `string[]`.\n\t\tconst services = servicesOf(constructs) as unknown as Service[];\n\n\t\treturn cloneWith(this, {\n\t\t\t_services: [...this._services, ...services],\n\t\t\t_constructs: idsOf(constructs, this._constructs),\n\t\t}) as unknown as QueueBuilder<\n\t\t\tTName,\n\t\t\tTMessage,\n\t\t\t[...TServices, ...ServicesOf<T>],\n\t\t\tTLogger\n\t\t>;\n\t}\n\n\tservices<T extends Service[]>(\n\t\tservices: T,\n\t): QueueBuilder<TName, TMessage, [...TServices, ...T], TLogger> {\n\t\treturn cloneWith(this, {\n\t\t\t_services: [...this._services, ...services] as unknown as TServices,\n\t\t}) as unknown as QueueBuilder<\n\t\t\tTName,\n\t\t\tTMessage,\n\t\t\t[...TServices, ...T],\n\t\t\tTLogger\n\t\t>;\n\t}\n\n\tlogger<T extends Logger>(\n\t\tlogger: T,\n\t): QueueBuilder<TName, TMessage, TServices, T> {\n\t\treturn cloneWith(this, {\n\t\t\t_logger: logger as unknown as TLogger,\n\t\t}) as unknown as QueueBuilder<TName, TMessage, TServices, T>;\n\t}\n\n\t/** The typed message (job) payload the queue carries. */\n\tmessage<T extends StandardSchemaV1>(\n\t\tschema: T,\n\t): QueueBuilder<TName, T, TServices, TLogger> {\n\t\treturn cloneWith(this, {\n\t\t\t_messageSchema: schema as unknown as TMessage,\n\t\t}) as unknown as QueueBuilder<TName, T, TServices, TLogger>;\n\t}\n\n\thandle(\n\t\tfn: QueueHandler<NonNullable<TMessage>, TServices, TLogger>,\n\t): Queue<TName, NonNullable<TMessage>, TServices, TLogger> {\n\t\tif (!this._name) throw new QueueNeedsName();\n\t\tif (!this._messageSchema) throw new QueueNeedsMessage(this._name);\n\n\t\tconst queue = new Queue<TName, NonNullable<TMessage>, TServices, TLogger>(\n\t\t\tthis._name as TName,\n\t\t\tfn,\n\t\t\tthis._messageSchema as NonNullable<TMessage>,\n\t\t\tthis._timeout,\n\t\t\tthis._services,\n\t\t\tthis._logger,\n\t\t\tthis._batchSize,\n\t\t\tthis._fifo,\n\t\t\tthis._constructs,\n\t\t);\n\t\t// Which process runs the consumer: the worker it was built from.\n\t\tqueue.owner = this._owner;\n\n\t\t// No reset. `.handle()` reads this builder and leaves it alone, so a\n\t\t// configured base — `const fn = f.logger(log).timeout(60_000)` — keeps\n\t\t// its configuration for every construct built from it. The reset that\n\t\t// used to be here wiped the base on first use, which made a base usable\n\t\t// exactly once, and quietly reverted the logger to the default.\n\n\t\treturn queue;\n\t}\n}\n\n/** A queue built without a name — only reachable by building one by hand. */\nexport class QueueNeedsName extends Error {\n\tconstructor() {\n\t\tsuper(\n\t\t\t\"A queue needs a name: build it from a worker, worker.queue('Emails').\",\n\t\t);\n\t\tthis.name = 'QueueNeedsName';\n\t}\n}\n\n/** A queue whose message was never described. */\nexport class QueueNeedsMessage extends Error {\n\tconstructor(readonly queue: string) {\n\t\tsuper(\n\t\t\t`Queue '${queue}' has no message: call .message(schema) before .handle(), ` +\n\t\t\t\t'so its producers and its consumer agree on what it carries.',\n\t\t);\n\t\tthis.name = 'QueueNeedsMessage';\n\t}\n}\n"],"mappings":";;;;;;;;;;;;AAoBA,IAAa,eAAb,MAKE;CACD;CACA;CACA,WAAmB;CACnB;CACA;CACA,YAA+B,CAAC;;CAEhC,cAA+B,CAAC;CAChC,UAA2B;;CAE3B;;CAGA,MACC,MACgD;EAChD,OAAO,UAAU,MAAM,EAAE,OAAO,KAAK,CAAC;CAMvC;CAEA,QAAQ,SAAuB;EAC9B,OAAO,UAAU,MAAM,EAAE,UAAU,QAAQ,CAAC;CAC7C;;CAGA,UAAU,WAAyB;EAClC,OAAO,UAAU,MAAM,EAAE,YAAY,UAAU,CAAC;CACjD;;CAGA,KAAK,OAAO,MAAY;EACvB,OAAO,UAAU,MAAM,EAAE,OAAO,KAAK,CAAC;CACvC;;;;;;;;;;;;CAaA,UACC,YAC2E;EAQ3E,MAAM,WAAW,WAAW,UAAU;EAEtC,OAAO,UAAU,MAAM;GACtB,WAAW,CAAC,GAAG,KAAK,WAAW,GAAG,QAAQ;GAC1C,aAAa,MAAM,YAAY,KAAK,WAAW;EAChD,CAAC;CAMF;CAEA,SACC,UAC+D;EAC/D,OAAO,UAAU,MAAM,EACtB,WAAW,CAAC,GAAG,KAAK,WAAW,GAAG,QAAQ,EAC3C,CAAC;CAMF;CAEA,OACC,QAC8C;EAC9C,OAAO,UAAU,MAAM,EACtB,SAAS,OACV,CAAC;CACF;;CAGA,QACC,QAC6C;EAC7C,OAAO,UAAU,MAAM,EACtB,gBAAgB,OACjB,CAAC;CACF;CAEA,OACC,IAC0D;EAC1D,IAAI,CAAC,KAAK,OAAO,MAAM,IAAI,eAAe;EAC1C,IAAI,CAAC,KAAK,gBAAgB,MAAM,IAAI,kBAAkB,KAAK,KAAK;EAEhE,MAAM,QAAQ,IAAI,MACjB,KAAK,OACL,IACA,KAAK,gBACL,KAAK,UACL,KAAK,WACL,KAAK,SACL,KAAK,YACL,KAAK,OACL,KAAK,WACN;EAEA,MAAM,QAAQ,KAAK;EAQnB,OAAO;CACR;AACD;;AAGA,IAAa,iBAAb,cAAoC,MAAM;CACzC,cAAc;EACb,MACC,uEACD;EACA,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,oBAAb,cAAuC,MAAM;CACvB;CAArB,YAAY,OAAwB;EACnC,MACC,UAAU,MAAM,sHAEjB;EAJoB,KAAA,QAAA;EAKpB,KAAK,OAAO;CACb;AACD"}
@@ -1,36 +1,35 @@
1
1
  import { t as StandardSchemaV1 } from "./index-CeEtxDmK.cjs";
2
- import { t as Construct } from "./Construct-DTqYvkPG.cjs";
3
- import { EventPublisher, ExtractPublisherMessage } from "@geekmidas/events";
2
+ import { t as Construct } from "./Construct-BQALFCh2.cjs";
4
3
  import { Logger } from "@geekmidas/logger";
5
4
  import { InferStandardSchema } from "@geekmidas/schema";
6
5
  import { Service, ServiceRecord } from "@geekmidas/services";
6
+ import { EventPublisher, ExtractPublisherMessage } from "@geekmidas/events";
7
7
  //#region src/subscribers/Subscriber.d.ts
8
8
  type ExtractEventPayloads<TPublisher extends EventPublisher<any> | undefined, TEventTypes extends any[]> = TPublisher extends EventPublisher<any> ? Extract<ExtractPublisherMessage<TPublisher>, {
9
9
  type: TEventTypes[number];
10
10
  }> : never;
11
- declare class Subscriber<TServices extends Service[] = [], TLogger extends Logger = Logger, OutSchema extends StandardSchemaV1 | undefined = undefined, TEventPublisher extends EventPublisher<any> | undefined = undefined, TEventPublisherServiceName extends string = string, TSubscribedEvents extends ExtractPublisherMessage<TEventPublisher>['type'][] = ExtractPublisherMessage<TEventPublisher>['type'][]> extends Construct<TLogger, TEventPublisherServiceName, TEventPublisher, OutSchema, TServices> {
11
+ declare class Subscriber<TServices extends Service[] = [], TLogger extends Logger = Logger, OutSchema extends StandardSchemaV1 | undefined = undefined,
12
+ /** The topic's message union — what types the events this subscriber receives. */
13
+ TEventPublisher extends EventPublisher<any> | undefined = undefined, TSubscribedEvents extends ExtractPublisherMessage<TEventPublisher>['type'][] = ExtractPublisherMessage<TEventPublisher>['type'][]> extends Construct<TLogger, OutSchema, TServices> {
12
14
  readonly handler: SubscriberHandler<TEventPublisher, TSubscribedEvents, TServices, TLogger, OutSchema>;
13
15
  readonly timeout: number;
14
16
  protected _subscribedEvents?: TSubscribedEvents | undefined;
15
17
  readonly outputSchema?: OutSchema | undefined;
16
18
  readonly services: TServices;
17
19
  readonly logger: TLogger;
18
- readonly publisherService?: Service<TEventPublisherServiceName, TEventPublisher>;
19
20
  /**
20
21
  * The name of the {@link Topic} this subscriber binds to (via
21
- * `s.topic(topic)`), recorded for the manifest so infra wires the SNS
22
- * subscription. Undefined when the subscriber's events are typed from a
23
- * (hand-written) publisher instead.
22
+ * `worker.topic(topic)`), recorded for the manifest so infra wires the
23
+ * SNS subscription.
24
24
  */
25
25
  readonly topicName?: string | undefined;
26
26
  __IS_SUBSCRIBER__: boolean;
27
- static isSubscriber(obj: any): obj is Subscriber<any, any, any, any, any, any>;
28
- constructor(handler: SubscriberHandler<TEventPublisher, TSubscribedEvents, TServices, TLogger, OutSchema>, timeout?: number, _subscribedEvents?: TSubscribedEvents | undefined, outputSchema?: OutSchema | undefined, services?: TServices, logger?: TLogger, publisherService?: Service<TEventPublisherServiceName, TEventPublisher>,
27
+ static isSubscriber(obj: any): obj is Subscriber<any, any, any, any, any>;
28
+ constructor(handler: SubscriberHandler<TEventPublisher, TSubscribedEvents, TServices, TLogger, OutSchema>, timeout?: number, _subscribedEvents?: TSubscribedEvents | undefined, outputSchema?: OutSchema | undefined, services?: TServices, logger?: TLogger,
29
29
  /**
30
30
  * The name of the {@link Topic} this subscriber binds to (via
31
- * `s.topic(topic)`), recorded for the manifest so infra wires the SNS
32
- * subscription. Undefined when the subscriber's events are typed from a
33
- * (hand-written) publisher instead.
31
+ * `worker.topic(topic)`), recorded for the manifest so infra wires the
32
+ * SNS subscription.
34
33
  */
35
34
  topicName?: string | undefined,
36
35
  /**
@@ -48,4 +47,4 @@ type SubscriberContext<TEventPublisher extends EventPublisher<any> | undefined,
48
47
  };
49
48
  //#endregion
50
49
  export { SubscriberHandler as n, Subscriber as t };
51
- //# sourceMappingURL=Subscriber-DQCaiOXF.d.cts.map
50
+ //# sourceMappingURL=Subscriber-B91YSkZt.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Subscriber-B91YSkZt.d.cts","names":[],"sources":["../src/subscribers/Subscriber.ts"],"mappings":";;;;;;;KAYK,qBACJ,mBAAmB,iCACnB,6BACG,mBAAmB,sBACpB,QAAQ,wBAAwB;EAAe,MAAM;;cAG3C,WACZ,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,kBAAkB;;AAElB,wBAAwB,6CACxB,0BACC,wBAAwB,6BAA6B,wBAAwB,oCACrE,UAAU,SAAS,WAAW;WAYtB,SAAS,kBACxB,iBACA,mBACA,WACA,SACA;WAEwB;YACf,oBAAoB;WACL,eAAe;WACf,UAAU;WACV,QAAQ;;;;;;WAMjB;EA5BjB;SAEO,aAAa,WAAW,OAAO;EAQtC,YACiB,SAAS,kBACxB,iBACA,mBACA,WACA,SACA,YAEwB,kBACf,oBAAoB,+BACL,eAAe,uBACf,WAAU,WACV,SAAQ,SAMjB;;;;;;EAAA,gCAKhB;;;;;EAAA;MAeG,oBAAoB;;KAMb,kBACX,wBAAwB,iCACxB,0BAA0B,wBAAwB,4BAClD,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,kBAAkB,6CAElB,KAAK,kBACJ,iBACA,mBACA,WACA,aAEG,kBAAkB,mBACpB,oBAAoB,aAAa,QAAQ,oBAAoB,oBACvD;KAGG,kBACX,wBAAwB,iCACxB,0BAA0B,wBAAwB,4BAClD,kBAAkB,gBAClB,gBAAgB,SAAS;EAEzB,QAAQ,qBAAqB,iBAAiB;EAC9C,UAAU,cAAc;EACxB,QAAQ"}
@@ -1,5 +1,5 @@
1
1
  import { t as StandardSchemaV1 } from "./index-CeEtxDmK.mjs";
2
- import { t as Construct } from "./Construct-pVadmURD.mjs";
2
+ import { t as Construct } from "./Construct-QXnl3VqT.mjs";
3
3
  import { EventPublisher, ExtractPublisherMessage } from "@geekmidas/events";
4
4
  import { Service, ServiceRecord } from "@geekmidas/services";
5
5
  import { Logger } from "@geekmidas/logger";
@@ -8,29 +8,28 @@ import { InferStandardSchema } from "@geekmidas/schema";
8
8
  type ExtractEventPayloads<TPublisher extends EventPublisher<any> | undefined, TEventTypes extends any[]> = TPublisher extends EventPublisher<any> ? Extract<ExtractPublisherMessage<TPublisher>, {
9
9
  type: TEventTypes[number];
10
10
  }> : never;
11
- declare class Subscriber<TServices extends Service[] = [], TLogger extends Logger = Logger, OutSchema extends StandardSchemaV1 | undefined = undefined, TEventPublisher extends EventPublisher<any> | undefined = undefined, TEventPublisherServiceName extends string = string, TSubscribedEvents extends ExtractPublisherMessage<TEventPublisher>['type'][] = ExtractPublisherMessage<TEventPublisher>['type'][]> extends Construct<TLogger, TEventPublisherServiceName, TEventPublisher, OutSchema, TServices> {
11
+ declare class Subscriber<TServices extends Service[] = [], TLogger extends Logger = Logger, OutSchema extends StandardSchemaV1 | undefined = undefined,
12
+ /** The topic's message union — what types the events this subscriber receives. */
13
+ TEventPublisher extends EventPublisher<any> | undefined = undefined, TSubscribedEvents extends ExtractPublisherMessage<TEventPublisher>['type'][] = ExtractPublisherMessage<TEventPublisher>['type'][]> extends Construct<TLogger, OutSchema, TServices> {
12
14
  readonly handler: SubscriberHandler<TEventPublisher, TSubscribedEvents, TServices, TLogger, OutSchema>;
13
15
  readonly timeout: number;
14
16
  protected _subscribedEvents?: TSubscribedEvents | undefined;
15
17
  readonly outputSchema?: OutSchema | undefined;
16
18
  readonly services: TServices;
17
19
  readonly logger: TLogger;
18
- readonly publisherService?: Service<TEventPublisherServiceName, TEventPublisher>;
19
20
  /**
20
21
  * The name of the {@link Topic} this subscriber binds to (via
21
- * `s.topic(topic)`), recorded for the manifest so infra wires the SNS
22
- * subscription. Undefined when the subscriber's events are typed from a
23
- * (hand-written) publisher instead.
22
+ * `worker.topic(topic)`), recorded for the manifest so infra wires the
23
+ * SNS subscription.
24
24
  */
25
25
  readonly topicName?: string | undefined;
26
26
  __IS_SUBSCRIBER__: boolean;
27
- static isSubscriber(obj: any): obj is Subscriber<any, any, any, any, any, any>;
28
- constructor(handler: SubscriberHandler<TEventPublisher, TSubscribedEvents, TServices, TLogger, OutSchema>, timeout?: number, _subscribedEvents?: TSubscribedEvents | undefined, outputSchema?: OutSchema | undefined, services?: TServices, logger?: TLogger, publisherService?: Service<TEventPublisherServiceName, TEventPublisher>,
27
+ static isSubscriber(obj: any): obj is Subscriber<any, any, any, any, any>;
28
+ constructor(handler: SubscriberHandler<TEventPublisher, TSubscribedEvents, TServices, TLogger, OutSchema>, timeout?: number, _subscribedEvents?: TSubscribedEvents | undefined, outputSchema?: OutSchema | undefined, services?: TServices, logger?: TLogger,
29
29
  /**
30
30
  * The name of the {@link Topic} this subscriber binds to (via
31
- * `s.topic(topic)`), recorded for the manifest so infra wires the SNS
32
- * subscription. Undefined when the subscriber's events are typed from a
33
- * (hand-written) publisher instead.
31
+ * `worker.topic(topic)`), recorded for the manifest so infra wires the
32
+ * SNS subscription.
34
33
  */
35
34
  topicName?: string | undefined,
36
35
  /**
@@ -48,4 +47,4 @@ type SubscriberContext<TEventPublisher extends EventPublisher<any> | undefined,
48
47
  };
49
48
  //#endregion
50
49
  export { SubscriberHandler as n, Subscriber as t };
51
- //# sourceMappingURL=Subscriber-CIO3pwji.d.mts.map
50
+ //# sourceMappingURL=Subscriber-BjHYe5hK.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Subscriber-BjHYe5hK.d.mts","names":[],"sources":["../src/subscribers/Subscriber.ts"],"mappings":";;;;;;;KAYK,qBACJ,mBAAmB,iCACnB,6BACG,mBAAmB,sBACpB,QAAQ,wBAAwB;EAAe,MAAM;;cAG3C,WACZ,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,kBAAkB;;AAElB,wBAAwB,6CACxB,0BACC,wBAAwB,6BAA6B,wBAAwB,oCACrE,UAAU,SAAS,WAAW;WAYtB,SAAS,kBACxB,iBACA,mBACA,WACA,SACA;WAEwB;YACf,oBAAoB;WACL,eAAe;WACf,UAAU;WACV,QAAQ;;;;;;WAMjB;EA5BjB;SAEO,aAAa,WAAW,OAAO;EAQtC,YACiB,SAAS,kBACxB,iBACA,mBACA,WACA,SACA,YAEwB,kBACf,oBAAoB,+BACL,eAAe,uBACf,WAAU,WACV,SAAQ,SAMjB;;;;;;EAAA,gCAKhB;;;;;EAAA;MAeG,oBAAoB;;KAMb,kBACX,wBAAwB,iCACxB,0BAA0B,wBAAwB,4BAClD,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,kBAAkB,6CAElB,KAAK,kBACJ,iBACA,mBACA,WACA,aAEG,kBAAkB,mBACpB,oBAAoB,aAAa,QAAQ,oBAAoB,oBACvD;KAGG,kBACX,wBAAwB,iCACxB,0BAA0B,wBAAwB,4BAClD,kBAAkB,gBAClB,gBAAgB,SAAS;EAEzB,QAAQ,qBAAqB,iBAAiB;EAC9C,UAAU,cAAc;EACxB,QAAQ"}