@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
@@ -0,0 +1,230 @@
1
+ import { t as StandardSchemaV1 } from "./index-CeEtxDmK.cjs";
2
+ import { Logger } from "@geekmidas/logger";
3
+ import { InferStandardSchema } from "@geekmidas/schema";
4
+ import { Service, ServiceContext, ServiceDiscovery } from "@geekmidas/services";
5
+ import { AuditStorage } from "@geekmidas/audit";
6
+ import { SniffResult } from "@geekmidas/envkit/sniffer";
7
+ import { EventPublisher, PublishableMessage } from "@geekmidas/events";
8
+ import { ConstructName, Declaration } from "@geekmidas/manifest";
9
+ //#region src/topic/Topic.d.ts
10
+ /** A topic's event contract — a map of event type → payload schema. */
11
+ type TopicEvents = Record<string, StandardSchemaV1>;
12
+ /**
13
+ * The union of wire messages a topic carries, derived from its event map:
14
+ * `{ type: 'user.created'; payload: … } | { type: 'user.updated'; payload: … }`.
15
+ */
16
+ type TopicMessage<TEvents extends TopicEvents> = { [K in keyof TEvents & string]: PublishableMessage<K, InferStandardSchema<TEvents[K]>>; }[keyof TEvents & string];
17
+ /**
18
+ * A topic — pub/sub fan-out. Unlike a `Queue` (point-to-point, one consumer), a
19
+ * topic is a *resource* owned by no single handler: it declares the event
20
+ * contract, and any number of subscribers (`worker.topic(topic)`) bind to it.
21
+ * `gkm build` discovers it into the manifest's `topics` field; infra provisions
22
+ * an SNS topic.
23
+ *
24
+ * A construct publishes with `.event(topic, { type, payload })`, repeatable
25
+ * across topics, each event going through its own topic's publisher. That also
26
+ * puts `services.<topic>` in the handler, as `.dependsOn([topic])` does, for an
27
+ * event the handler decides on itself.
28
+ *
29
+ * ```ts
30
+ * export const users = new Topic('Users', {
31
+ * events: { 'user.created': z.object({ userId: z.string() }) },
32
+ * });
33
+ * ```
34
+ */
35
+ declare class Topic<TName extends string = string, TEvents extends TopicEvents = TopicEvents> extends Construct {
36
+ __IS_TOPIC__: boolean;
37
+ static isTopic(obj: unknown): obj is Topic<string, TopicEvents>;
38
+ /**
39
+ * The canonical id this topic is declared under.
40
+ *
41
+ * Derived from the name, so `users` and `Users` are one topic. The name is
42
+ * left alone: subscribers bind to it and it is what the broker routes on.
43
+ */
44
+ readonly id: string;
45
+ /** The name it was declared with — what the broker routes on. */
46
+ readonly name: TName;
47
+ /**
48
+ * The event contract — a map of event type → payload schema. Named
49
+ * `eventSchemas` (not `events`) to avoid clashing with `Construct.events`,
50
+ * which is the array of `MappedEvent`s a construct *publishes*.
51
+ */
52
+ readonly eventSchemas: TEvents;
53
+ /**
54
+ * The topic as a dependency — what `.dependsOn([users])` and
55
+ * `.event(users, …)` dissolve into, reachable as `services.users`.
56
+ *
57
+ * The producer, because publishing is the only thing depending on a topic
58
+ * can mean: a subscriber binds to the topic instead, and is never handed
59
+ * this. It reads `<NAME>_PUBLISHER_CONNECTION_STRING` and picks the
60
+ * transport from its protocol — `pgboss://` locally, `sns://` deployed.
61
+ *
62
+ * A field assigned once, not a getter: services are cached by object
63
+ * identity, and a fresh literal on every access never hit that cache.
64
+ */
65
+ readonly service: Service<Uncapitalize<TName>, EventPublisher<TopicMessage<TEvents>>>;
66
+ /** The producer's env key, read by both {@link declare} and the service. */
67
+ private readonly connectionKey;
68
+ constructor(name: ConstructName<TName>, options: TopicOptions<TEvents>);
69
+ /**
70
+ * What this topic is in the manifest.
71
+ *
72
+ * Only the producer's key: a subscriber is *bound* to a topic rather than
73
+ * depending on it, so the binding is an edge the deploy target reads and not
74
+ * an env key anyone can hold. Locally both sides meet on the same broker.
75
+ */
76
+ declare(): Declaration[];
77
+ /** The event type names this topic carries. */
78
+ get eventTypes(): (keyof TEvents & string)[];
79
+ }
80
+ interface TopicOptions<TEvents extends TopicEvents> {
81
+ /** Each event this topic carries — its type, and its payload's schema. */
82
+ events: TEvents;
83
+ }
84
+ //#endregion
85
+ //#region src/publisher.d.ts
86
+ /**
87
+ * An event a construct publishes to a topic once its handler has succeeded.
88
+ *
89
+ * It carries its topic, so a construct can publish to as many topics as it
90
+ * names — each event goes through the publisher of the topic it was declared
91
+ * against, never a single shared one.
92
+ */
93
+ interface TopicEvent<TOutput = any> {
94
+ /** The topic's service: the publisher this event is sent through. */
95
+ topic: Service<string, EventPublisher<any>>;
96
+ type: string;
97
+ /** The event's payload, from what the handler returned. */
98
+ payload: (output: TOutput) => unknown;
99
+ /** Publish only when this holds for what the handler returned. */
100
+ when?: (output: TOutput) => boolean;
101
+ }
102
+ /**
103
+ * What `.event(topic, …)` takes: one of the topic's event types, and a payload
104
+ * of that event's shape built from the handler's output.
105
+ */
106
+ type EventFor<TTopic extends Topic<any, any>, TOutput> = TTopic extends Topic<string, infer TEvents> ? { [K in keyof TEvents & string]: {
107
+ type: K;
108
+ payload: (output: TOutput) => InferStandardSchema<TEvents[K]>;
109
+ when?: (output: TOutput) => boolean;
110
+ }; }[keyof TEvents & string] : never;
111
+ /** Publish a construct's declared events for what its handler returned. */
112
+ declare function publishConstructEvents<OutSchema extends StandardSchemaV1 | undefined = undefined>(construct: Pick<Construct, 'events' | 'logger'>, response: InferStandardSchema<OutSchema>, serviceDiscovery: ServiceDiscovery<any>, logger?: Logger, provided?: Readonly<Record<string, unknown>>): Promise<void>;
113
+ //#endregion
114
+ //#region src/Construct.d.ts
115
+ /**
116
+ * Noop context for environment sniffing.
117
+ * Used when calling service.register() to detect env vars without a real request.
118
+ * Returns dummy values since services should only use context in instance methods,
119
+ * not during registration.
120
+ */
121
+ declare const snifferContext: ServiceContext;
122
+ declare abstract class Construct<TLogger extends Logger = Logger, OutSchema extends StandardSchemaV1 | undefined = undefined, TServices extends Service[] = [], TAuditStorageServiceName extends string = string, TAuditStorage extends AuditStorage | undefined = undefined, TDatabaseServiceName extends string = string, TDatabase = unknown> {
123
+ readonly type: ConstructType;
124
+ readonly logger: TLogger;
125
+ readonly services: TServices;
126
+ /**
127
+ * What this construct publishes once its handler succeeds — each event
128
+ * bound to its own topic, so a construct publishes to as many as it names.
129
+ */
130
+ readonly events: TopicEvent[];
131
+ outputSchema?: OutSchema | undefined;
132
+ readonly timeout?: number | undefined;
133
+ readonly memorySize?: number | undefined;
134
+ readonly auditorStorageService?: Service<TAuditStorageServiceName, TAuditStorage>;
135
+ /**
136
+ * The constructs this one declared an edge to, by id.
137
+ *
138
+ * What the manifest records. `services` is the same information in the
139
+ * form a handler runs with — clients, keyed by name — and an id cannot be
140
+ * recovered from one of those reliably, so both are kept.
141
+ *
142
+ * Last in the list because every other parameter is positional and already
143
+ * spoken for; a new one anywhere else silently rebinds existing callers.
144
+ */
145
+ readonly constructs: string[];
146
+ /** Database service for this construct (used by Endpoint for RLS/audit context) */
147
+ databaseService?: Service<TDatabaseServiceName, TDatabase>;
148
+ /**
149
+ * The deploy unit that runs this, by construct id.
150
+ *
151
+ * What an endpoint's `surface` is to it, and for the same reason: something
152
+ * has to say which process a runnable belongs to, and until this existed the
153
+ * only thing that said so was the directory its file sat in. Set by the
154
+ * factory it was built from — `worker.crons`, `api.get(…)` — so it is
155
+ * carried rather than configured.
156
+ *
157
+ * Undefined for a construct built from a free-standing builder, which is
158
+ * still how `c`, `s` and `f` work.
159
+ */
160
+ owner?: string;
161
+ constructor(type: ConstructType, logger: TLogger, services: TServices,
162
+ /**
163
+ * What this construct publishes once its handler succeeds — each event
164
+ * bound to its own topic, so a construct publishes to as many as it names.
165
+ */
166
+ events?: TopicEvent[], outputSchema?: OutSchema | undefined, timeout?: number | undefined, memorySize?: number | undefined, auditorStorageService?: Service<TAuditStorageServiceName, TAuditStorage>,
167
+ /**
168
+ * The constructs this one declared an edge to, by id.
169
+ *
170
+ * What the manifest records. `services` is the same information in the
171
+ * form a handler runs with — clients, keyed by name — and an id cannot be
172
+ * recovered from one of those reliably, so both are kept.
173
+ *
174
+ * Last in the list because every other parameter is positional and already
175
+ * spoken for; a new one anywhere else silently rebinds existing callers.
176
+ */
177
+ constructs?: string[]);
178
+ /**
179
+ * Returns an array of environment variable names required by this construct's services.
180
+ * This is determined by running a "sniffer" EnvironmentParser through each service's
181
+ * register method to track which environment variables are accessed.
182
+ *
183
+ * Results are cached per service class to handle singleton patterns where
184
+ * subsequent register() calls may short-circuit and not access env vars.
185
+ *
186
+ * @param markOptional - When true, optional vars (those accessed via `.optional()` or
187
+ * `.default()`) are suffixed with `?` in the returned array (e.g. `'PORT?'`).
188
+ * @returns Promise that resolves to array of environment variable names, sorted alphabetically
189
+ *
190
+ * @example
191
+ * ```typescript
192
+ * const endpoint = e
193
+ * .services([databaseService, authService])
194
+ * .get('/users')
195
+ * .handle(async () => []);
196
+ *
197
+ * await endpoint.getEnvironment(); // ['AUTH_SECRET', 'DATABASE_URL']
198
+ * await endpoint.getEnvironment({ markOptional: true }); // ['AUTH_SECRET', 'DATABASE_URL', 'PORT?']
199
+ * ```
200
+ */
201
+ getEnvironment(opts?: {
202
+ markOptional?: boolean;
203
+ }): Promise<string[]>;
204
+ }
205
+ declare enum ConstructType {
206
+ Cron = "dev.geekmidas.function.cron",
207
+ Endpoint = "dev.geekmidas.function.endpoint",
208
+ Function = "dev.geekmidas.function.function",
209
+ Subscriber = "dev.geekmidas.function.subscriber",
210
+ Queue = "dev.geekmidas.function.queue",
211
+ Topic = "dev.geekmidas.resource.topic"
212
+ }
213
+ /**
214
+ * Utility to test sniffing a service for environment variables.
215
+ * Useful for debugging services that throw errors during sniffing.
216
+ *
217
+ * @example
218
+ * ```typescript
219
+ * import { sniffService } from '@geekmidas/constructs';
220
+ * import { authService } from './services/AuthService';
221
+ *
222
+ * const result = await sniffService(authService);
223
+ * console.log('Env vars:', result.envVars);
224
+ * console.log('Error:', result.error);
225
+ * ```
226
+ */
227
+ declare function sniffService(service: Service): Promise<SniffResult>;
228
+ //#endregion
229
+ export { EventFor as a, Topic as c, TopicOptions as d, snifferContext as i, TopicEvents as l, ConstructType as n, TopicEvent as o, sniffService as r, publishConstructEvents as s, Construct as t, TopicMessage as u };
230
+ //# sourceMappingURL=Construct-BQALFCh2.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Construct-BQALFCh2.d.cts","names":[],"sources":["../src/topic/Topic.ts","../src/publisher.ts","../src/Construct.ts"],"mappings":";;;;;;;;;;KAoBY,cAAc,eAAe;;;;;KAM7B,aAAa,gBAAgB,kBACvC,WAAW,mBAAmB,mBAC9B,GACA,oBAAoB,QAAQ,cAEtB;;;;;;;;;;;;;;;;;;;cAoBK,MACZ,+BACA,gBAAgB,cAAc,qBACrB;EACT;SAEO,QAAQ,eAAe,OAAO,cAAc;;;;;;;WAc1C;;WAGA,MAAM;;;;;;WAON,cAAc;;;;;;;;;;;;;WAcd,SAAS,QACjB,aAAa,QACb,eAAe,aAAa;;mBAIZ;EAEjB,YAAY,MAAM,cAAc,QAAQ,SAAS,aAAa;;;;;;;;EA8B9D,WAAW;;MAmBP,qBAAqB;;UAKT,aAAa,gBAAgB;;EAE7C,QAAQ;;;;;;;;;;;UChJQ,WAAW;;EAE3B,OAAO,gBAAgB;EACvB;;EAEA,UAAU,QAAQ;;EAElB,QAAQ,QAAQ;;;;;;KAOL,SACX,eAAe,iBACf,WACG,eAAe,oBAAoB,cAEnC,WAAW;EACX,MAAM;EACN,UAAU,QAAQ,YAAY,oBAAoB,QAAQ;EAC1D,QAAQ,QAAQ;WAEV;;iBAwFY,uBACrB,kBAAkB,0CAElB,WAAW,KAAK,iCAChB,UAAU,oBAAoB,YAC9B,kBAAkB,uBAClB,SAAQ,QACR,WAAU,SAAS,2BAA6B;;;;;;;;;cC5G3C,gBAAgB;uBAsBA,UACrB,gBAAgB,SAAS,QACzB,kBAAkB,0CAClB,kBAAkB,gBAClB,kDACA,sBAAsB,sCACtB,8CACA;WAoBiB,MAAM;WACN,QAAQ;WACR,UAAU;;;;;WAKV,QAAQ;EACjB,eAAe;WACN;WACA;WACA,wBAAwB,QACvC,0BACA;;;;;;;;;;;WAYe;;EA1CV,kBAAkB,QAAQ,sBAAsB;;;;;;;;;;;;;EAchD;EAEP,YACiB,MAAM,eACN,QAAQ,SACR,UAAU,WAKV;;;;;EAAA,SAAQ,cACjB,eAAe,uBACN,8BACA,iCACA,wBAAwB,QACvC,0BACA,gBAYe;;;;;;;;;;;EAAA;;;;;;;;;;;;;;;;;;;;;;;;EA0BX,eACL;IAAQ;MACN;;aAiEQ;EACX;EACA;EACA;EACA;EACA;EACA;;;;;;;;;;;;;;;;iBAiBqB,aAAa,SAAS,UAAU,QAAQ"}
@@ -69,7 +69,6 @@ var Construct = class {
69
69
  logger;
70
70
  services;
71
71
  events;
72
- publisherService;
73
72
  outputSchema;
74
73
  timeout;
75
74
  memorySize;
@@ -90,12 +89,11 @@ var Construct = class {
90
89
  * still how `c`, `s` and `f` work.
91
90
  */
92
91
  owner;
93
- constructor(type, logger, services, events = [], publisherService, outputSchema, timeout, memorySize, auditorStorageService, constructs = []) {
92
+ constructor(type, logger, services, events = [], outputSchema, timeout, memorySize, auditorStorageService, constructs = []) {
94
93
  this.type = type;
95
94
  this.logger = logger;
96
95
  this.services = services;
97
96
  this.events = events;
98
- this.publisherService = publisherService;
99
97
  this.outputSchema = outputSchema;
100
98
  this.timeout = timeout;
101
99
  this.memorySize = memorySize;
@@ -131,8 +129,7 @@ var Construct = class {
131
129
  const optionalVars = /* @__PURE__ */ new Set();
132
130
  const services = (0, import_lodash_compact.default)([
133
131
  ...this.services,
134
- this.publisherService,
135
- this.publisherService,
132
+ ...this.events.map(({ topic }) => topic),
136
133
  this.auditorStorageService,
137
134
  this.databaseService
138
135
  ]);
@@ -225,4 +222,4 @@ Object.defineProperty(exports, "snifferContext", {
225
222
  }
226
223
  });
227
224
 
228
- //# sourceMappingURL=Construct-yG9Sw-5p.cjs.map
225
+ //# sourceMappingURL=Construct-DmvXceVY.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Construct-DmvXceVY.cjs","names":["compact","SnifferEnvironmentParser","sniffWithFireAndForget"],"sources":["../../../node_modules/.pnpm/lodash.compact@3.0.1/node_modules/lodash.compact/index.js","../src/Construct.ts"],"sourcesContent":["/**\n * lodash 3.0.1 (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license <https://lodash.com/license>\n */\n\n/**\n * Creates an array with all falsey values removed. The values `false`, `null`,\n * `0`, `\"\"`, `undefined`, and `NaN` are falsey.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to compact.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * _.compact([0, 1, false, 2, '', 3]);\n * // => [1, 2, 3]\n */\nfunction compact(array) {\n var index = -1,\n length = array ? array.length : 0,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (value) {\n result[resIndex++] = value;\n }\n }\n return result;\n}\n\nmodule.exports = compact;\n","import type { AuditStorage } from '@geekmidas/audit';\nimport {\n\tSnifferEnvironmentParser,\n\ttype SniffResult,\n\tsniffWithFireAndForget,\n} from '@geekmidas/envkit/sniffer';\nimport type { Logger } from '@geekmidas/logger';\nimport type { Service, ServiceContext } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport compact from 'lodash.compact';\nimport type { TopicEvent } from './publisher';\n\n// Cache for service environment variables to handle singleton services\n// Stores both the full list and the optional subset so the same sniff result\n// can satisfy both getEnvironment() and getEnvironment({ markOptional: true }).\nconst serviceEnvCache = new Map<\n\tService,\n\t{ envVars: string[]; optionalEnvVars: string[] }\n>();\n\n/**\n * Noop context for environment sniffing.\n * Used when calling service.register() to detect env vars without a real request.\n * Returns dummy values since services should only use context in instance methods,\n * not during registration.\n */\nconst snifferContext: ServiceContext = {\n\tgetLogger() {\n\t\t// Return a noop logger for sniffing - services shouldn't log during registration\n\t\treturn {\n\t\t\tdebug: () => {},\n\t\t\tinfo: () => {},\n\t\t\twarn: () => {},\n\t\t\terror: () => {},\n\t\t\tchild: () => snifferContext.getLogger(),\n\t\t} as unknown as Logger;\n\t},\n\tgetRequestId() {\n\t\treturn 'sniffer-context';\n\t},\n\tgetRequestStartTime() {\n\t\treturn Date.now();\n\t},\n\thasContext() {\n\t\treturn false;\n\t},\n};\n\nexport abstract class Construct<\n\tTLogger extends Logger = Logger,\n\tOutSchema extends StandardSchemaV1 | undefined = undefined,\n\tTServices extends Service[] = [],\n\tTAuditStorageServiceName extends string = string,\n\tTAuditStorage extends AuditStorage | undefined = undefined,\n\tTDatabaseServiceName extends string = string,\n\tTDatabase = unknown,\n> {\n\t/** Database service for this construct (used by Endpoint for RLS/audit context) */\n\tpublic databaseService?: Service<TDatabaseServiceName, TDatabase>;\n\n\t/**\n\t * The deploy unit that runs this, by construct id.\n\t *\n\t * What an endpoint's `surface` is to it, and for the same reason: something\n\t * has to say which process a runnable belongs to, and until this existed the\n\t * only thing that said so was the directory its file sat in. Set by the\n\t * factory it was built from — `worker.crons`, `api.get(…)` — so it is\n\t * carried rather than configured.\n\t *\n\t * Undefined for a construct built from a free-standing builder, which is\n\t * still how `c`, `s` and `f` work.\n\t */\n\tpublic owner?: string;\n\n\tconstructor(\n\t\tpublic readonly type: ConstructType,\n\t\tpublic readonly logger: TLogger,\n\t\tpublic readonly services: TServices,\n\t\t/**\n\t\t * What this construct publishes once its handler succeeds — each event\n\t\t * bound to its own topic, so a construct publishes to as many as it names.\n\t\t */\n\t\tpublic readonly events: TopicEvent[] = [],\n\t\tpublic outputSchema?: OutSchema,\n\t\tpublic readonly timeout?: number,\n\t\tpublic readonly memorySize?: number,\n\t\tpublic readonly auditorStorageService?: Service<\n\t\t\tTAuditStorageServiceName,\n\t\t\tTAuditStorage\n\t\t>,\n\t\t/**\n\t\t * The constructs this one declared an edge to, by id.\n\t\t *\n\t\t * What the manifest records. `services` is the same information in the\n\t\t * form a handler runs with — clients, keyed by name — and an id cannot be\n\t\t * recovered from one of those reliably, so both are kept.\n\t\t *\n\t\t * Last in the list because every other parameter is positional and already\n\t\t * spoken for; a new one anywhere else silently rebinds existing callers.\n\t\t */\n\t\tpublic readonly constructs: string[] = [],\n\t) {}\n\n\t/**\n\t * Returns an array of environment variable names required by this construct's services.\n\t * This is determined by running a \"sniffer\" EnvironmentParser through each service's\n\t * register method to track which environment variables are accessed.\n\t *\n\t * Results are cached per service class to handle singleton patterns where\n\t * subsequent register() calls may short-circuit and not access env vars.\n\t *\n\t * @param markOptional - When true, optional vars (those accessed via `.optional()` or\n\t * `.default()`) are suffixed with `?` in the returned array (e.g. `'PORT?'`).\n\t * @returns Promise that resolves to array of environment variable names, sorted alphabetically\n\t *\n\t * @example\n\t * ```typescript\n\t * const endpoint = e\n\t * .services([databaseService, authService])\n\t * .get('/users')\n\t * .handle(async () => []);\n\t *\n\t * await endpoint.getEnvironment(); // ['AUTH_SECRET', 'DATABASE_URL']\n\t * await endpoint.getEnvironment({ markOptional: true }); // ['AUTH_SECRET', 'DATABASE_URL', 'PORT?']\n\t * ```\n\t */\n\tasync getEnvironment(\n\t\topts: { markOptional?: boolean } = {},\n\t): Promise<string[]> {\n\t\tconst { markOptional = false } = opts;\n\t\tconst envVars = new Set<string>();\n\t\tconst optionalVars = new Set<string>();\n\t\tconst services: Service[] = compact([\n\t\t\t...this.services,\n\t\t\t// Each topic an event names is a dependency like any other.\n\t\t\t...this.events.map(({ topic }) => topic),\n\t\t\tthis.auditorStorageService,\n\t\t\tthis.databaseService,\n\t\t]);\n\n\t\ttry {\n\t\t\tfor (const service of services) {\n\t\t\t\t// Check cache first - handles singleton services that short-circuit\n\t\t\t\tif (serviceEnvCache.has(service)) {\n\t\t\t\t\tconst cached = serviceEnvCache.get(service)!;\n\t\t\t\t\tcached.envVars.forEach((v) => envVars.add(v));\n\t\t\t\t\tcached.optionalEnvVars.forEach((v) => optionalVars.add(v));\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Use sniffService to properly handle all error scenarios\n\t\t\t\tconst result = await sniffService(service);\n\n\t\t\t\t// Log any issues for debugging\n\t\t\t\tif (result.error) {\n\t\t\t\t\tthis.logger.warn(\n\t\t\t\t\t\t{ error: result.error.message, service: service.serviceName },\n\t\t\t\t\t\t'Service threw error during env sniffing (env vars still captured)',\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (result.unhandledRejections.length > 0) {\n\t\t\t\t\tthis.logger.warn(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\terrors: result.unhandledRejections.map((e) => e.message),\n\t\t\t\t\t\t\tservice: service.serviceName,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t'Fire-and-forget rejections during env sniffing (suppressed)',\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Cache and collect env vars (both required and optional)\n\t\t\t\tserviceEnvCache.set(service, {\n\t\t\t\t\tenvVars: result.envVars,\n\t\t\t\t\toptionalEnvVars: result.optionalEnvVars,\n\t\t\t\t});\n\t\t\t\tresult.envVars.forEach((v) => envVars.add(v));\n\t\t\t\tresult.optionalEnvVars.forEach((v) => optionalVars.add(v));\n\t\t\t}\n\n\t\t\tconst sorted = Array.from(envVars).sort();\n\t\t\tif (!markOptional || optionalVars.size === 0) return sorted;\n\t\t\treturn sorted.map((v) => (optionalVars.has(v) ? `${v}?` : v));\n\t\t} catch (error) {\n\t\t\tthis.logger.error(\n\t\t\t\t{ error },\n\t\t\t\t'Error determining environment variables for construct',\n\t\t\t);\n\n\t\t\treturn [];\n\t\t}\n\t}\n}\n\nexport enum ConstructType {\n\tCron = 'dev.geekmidas.function.cron',\n\tEndpoint = 'dev.geekmidas.function.endpoint',\n\tFunction = 'dev.geekmidas.function.function',\n\tSubscriber = 'dev.geekmidas.function.subscriber',\n\tQueue = 'dev.geekmidas.function.queue',\n\tTopic = 'dev.geekmidas.resource.topic',\n}\n\n/**\n * Utility to test sniffing a service for environment variables.\n * Useful for debugging services that throw errors during sniffing.\n *\n * @example\n * ```typescript\n * import { sniffService } from '@geekmidas/constructs';\n * import { authService } from './services/AuthService';\n *\n * const result = await sniffService(authService);\n * console.log('Env vars:', result.envVars);\n * console.log('Error:', result.error);\n * ```\n */\nexport async function sniffService(service: Service): Promise<SniffResult> {\n\tconst sniffer = new SnifferEnvironmentParser();\n\n\treturn sniffWithFireAndForget(sniffer, () =>\n\t\tservice.register({\n\t\t\tenvParser: sniffer as any,\n\t\t\tcontext: snifferContext,\n\t\t}),\n\t);\n}\n\n// Export for testing\nexport { snifferContext };\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;CAuBA,SAAS,QAAQ,OAAO;EACtB,IAAI,QAAQ,IACR,SAAS,QAAQ,MAAM,SAAS,GAChC,WAAW,GACX,SAAS,CAAC;EAEd,OAAO,EAAE,QAAQ,QAAQ;GACvB,IAAI,QAAQ,MAAM;GAClB,IAAI,OACF,OAAO,cAAc;EAEzB;EACA,OAAO;CACT;CAEA,OAAO,UAAU;;;;;ACvBjB,MAAM,kCAAkB,IAAI,IAG1B;;;;;;;AAQF,MAAM,iBAAiC;CACtC,YAAY;EAEX,OAAO;GACN,aAAa,CAAC;GACd,YAAY,CAAC;GACb,YAAY,CAAC;GACb,aAAa,CAAC;GACd,aAAa,eAAe,UAAU;EACvC;CACD;CACA,eAAe;EACd,OAAO;CACR;CACA,sBAAsB;EACrB,OAAO,KAAK,IAAI;CACjB;CACA,aAAa;EACZ,OAAO;CACR;AACD;AAEA,IAAsB,YAAtB,MAQE;CAmBgB;CACA;CACA;CAKA;CACT;CACS;CACA;CACA;CAcA;;CA1CjB;;;;;;;;;;;;;CAcA;CAEA,YACC,MACA,QACA,UAKA,SAAuC,CAAC,GACxC,cACA,SACA,YACA,uBAcA,aAAuC,CAAC,GACvC;EA1Be,KAAA,OAAA;EACA,KAAA,SAAA;EACA,KAAA,WAAA;EAKA,KAAA,SAAA;EACT,KAAA,eAAA;EACS,KAAA,UAAA;EACA,KAAA,aAAA;EACA,KAAA,wBAAA;EAcA,KAAA,aAAA;CACd;;;;;;;;;;;;;;;;;;;;;;;;CAyBH,MAAM,eACL,OAAmC,CAAC,GAChB;EACpB,MAAM,EAAE,eAAe,UAAU;EACjC,MAAM,0BAAU,IAAI,IAAY;EAChC,MAAM,+BAAe,IAAI,IAAY;EACrC,MAAM,YAAA,GAAsBA,sBAAAA,QAAAA,CAAQ;GACnC,GAAG,KAAK;GAER,GAAG,KAAK,OAAO,KAAK,EAAE,YAAY,KAAK;GACvC,KAAK;GACL,KAAK;EACN,CAAC;EAED,IAAI;GACH,KAAK,MAAM,WAAW,UAAU;IAE/B,IAAI,gBAAgB,IAAI,OAAO,GAAG;KACjC,MAAM,SAAS,gBAAgB,IAAI,OAAO;KAC1C,OAAO,QAAQ,SAAS,MAAM,QAAQ,IAAI,CAAC,CAAC;KAC5C,OAAO,gBAAgB,SAAS,MAAM,aAAa,IAAI,CAAC,CAAC;KACzD;IACD;IAGA,MAAM,SAAS,MAAM,aAAa,OAAO;IAGzC,IAAI,OAAO,OACV,KAAK,OAAO,KACX;KAAE,OAAO,OAAO,MAAM;KAAS,SAAS,QAAQ;IAAY,GAC5D,mEACD;IAED,IAAI,OAAO,oBAAoB,SAAS,GACvC,KAAK,OAAO,KACX;KACC,QAAQ,OAAO,oBAAoB,KAAK,MAAM,EAAE,OAAO;KACvD,SAAS,QAAQ;IAClB,GACA,6DACD;IAID,gBAAgB,IAAI,SAAS;KAC5B,SAAS,OAAO;KAChB,iBAAiB,OAAO;IACzB,CAAC;IACD,OAAO,QAAQ,SAAS,MAAM,QAAQ,IAAI,CAAC,CAAC;IAC5C,OAAO,gBAAgB,SAAS,MAAM,aAAa,IAAI,CAAC,CAAC;GAC1D;GAEA,MAAM,SAAS,MAAM,KAAK,OAAO,CAAC,CAAC,KAAK;GACxC,IAAI,CAAC,gBAAgB,aAAa,SAAS,GAAG,OAAO;GACrD,OAAO,OAAO,KAAK,MAAO,aAAa,IAAI,CAAC,IAAI,GAAG,EAAE,KAAK,CAAE;EAC7D,SAAS,OAAO;GACf,KAAK,OAAO,MACX,EAAE,MAAM,GACR,uDACD;GAEA,OAAO,CAAC;EACT;CACD;AACD;AAEA,IAAY,gBAAL,yBAAA,eAAA;CACN,cAAA,UAAA;CACA,cAAA,cAAA;CACA,cAAA,cAAA;CACA,cAAA,gBAAA;CACA,cAAA,WAAA;CACA,cAAA,WAAA;;AACD,EAAA,CAAA,CAAA;;;;;;;;;;;;;;;AAgBA,eAAsB,aAAa,SAAwC;CAC1E,MAAM,UAAU,IAAIC,0BAAAA,yBAAyB;CAE7C,QAAA,GAAOC,0BAAAA,uBAAAA,CAAuB,eAC7B,QAAQ,SAAS;EAChB,WAAW;EACX,SAAS;CACV,CAAC,CACF;AACD"}
@@ -0,0 +1,230 @@
1
+ import { t as StandardSchemaV1 } from "./index-CeEtxDmK.mjs";
2
+ import { SniffResult } from "@geekmidas/envkit/sniffer";
3
+ import { ConstructName, Declaration } from "@geekmidas/manifest";
4
+ import { EventPublisher, PublishableMessage } from "@geekmidas/events";
5
+ import { Service, ServiceContext, ServiceDiscovery } from "@geekmidas/services";
6
+ import { AuditStorage } from "@geekmidas/audit";
7
+ import { Logger } from "@geekmidas/logger";
8
+ import { InferStandardSchema } from "@geekmidas/schema";
9
+ //#region src/topic/Topic.d.ts
10
+ /** A topic's event contract — a map of event type → payload schema. */
11
+ type TopicEvents = Record<string, StandardSchemaV1>;
12
+ /**
13
+ * The union of wire messages a topic carries, derived from its event map:
14
+ * `{ type: 'user.created'; payload: … } | { type: 'user.updated'; payload: … }`.
15
+ */
16
+ type TopicMessage<TEvents extends TopicEvents> = { [K in keyof TEvents & string]: PublishableMessage<K, InferStandardSchema<TEvents[K]>>; }[keyof TEvents & string];
17
+ /**
18
+ * A topic — pub/sub fan-out. Unlike a `Queue` (point-to-point, one consumer), a
19
+ * topic is a *resource* owned by no single handler: it declares the event
20
+ * contract, and any number of subscribers (`worker.topic(topic)`) bind to it.
21
+ * `gkm build` discovers it into the manifest's `topics` field; infra provisions
22
+ * an SNS topic.
23
+ *
24
+ * A construct publishes with `.event(topic, { type, payload })`, repeatable
25
+ * across topics, each event going through its own topic's publisher. That also
26
+ * puts `services.<topic>` in the handler, as `.dependsOn([topic])` does, for an
27
+ * event the handler decides on itself.
28
+ *
29
+ * ```ts
30
+ * export const users = new Topic('Users', {
31
+ * events: { 'user.created': z.object({ userId: z.string() }) },
32
+ * });
33
+ * ```
34
+ */
35
+ declare class Topic<TName extends string = string, TEvents extends TopicEvents = TopicEvents> extends Construct {
36
+ __IS_TOPIC__: boolean;
37
+ static isTopic(obj: unknown): obj is Topic<string, TopicEvents>;
38
+ /**
39
+ * The canonical id this topic is declared under.
40
+ *
41
+ * Derived from the name, so `users` and `Users` are one topic. The name is
42
+ * left alone: subscribers bind to it and it is what the broker routes on.
43
+ */
44
+ readonly id: string;
45
+ /** The name it was declared with — what the broker routes on. */
46
+ readonly name: TName;
47
+ /**
48
+ * The event contract — a map of event type → payload schema. Named
49
+ * `eventSchemas` (not `events`) to avoid clashing with `Construct.events`,
50
+ * which is the array of `MappedEvent`s a construct *publishes*.
51
+ */
52
+ readonly eventSchemas: TEvents;
53
+ /**
54
+ * The topic as a dependency — what `.dependsOn([users])` and
55
+ * `.event(users, …)` dissolve into, reachable as `services.users`.
56
+ *
57
+ * The producer, because publishing is the only thing depending on a topic
58
+ * can mean: a subscriber binds to the topic instead, and is never handed
59
+ * this. It reads `<NAME>_PUBLISHER_CONNECTION_STRING` and picks the
60
+ * transport from its protocol — `pgboss://` locally, `sns://` deployed.
61
+ *
62
+ * A field assigned once, not a getter: services are cached by object
63
+ * identity, and a fresh literal on every access never hit that cache.
64
+ */
65
+ readonly service: Service<Uncapitalize<TName>, EventPublisher<TopicMessage<TEvents>>>;
66
+ /** The producer's env key, read by both {@link declare} and the service. */
67
+ private readonly connectionKey;
68
+ constructor(name: ConstructName<TName>, options: TopicOptions<TEvents>);
69
+ /**
70
+ * What this topic is in the manifest.
71
+ *
72
+ * Only the producer's key: a subscriber is *bound* to a topic rather than
73
+ * depending on it, so the binding is an edge the deploy target reads and not
74
+ * an env key anyone can hold. Locally both sides meet on the same broker.
75
+ */
76
+ declare(): Declaration[];
77
+ /** The event type names this topic carries. */
78
+ get eventTypes(): (keyof TEvents & string)[];
79
+ }
80
+ interface TopicOptions<TEvents extends TopicEvents> {
81
+ /** Each event this topic carries — its type, and its payload's schema. */
82
+ events: TEvents;
83
+ }
84
+ //#endregion
85
+ //#region src/publisher.d.ts
86
+ /**
87
+ * An event a construct publishes to a topic once its handler has succeeded.
88
+ *
89
+ * It carries its topic, so a construct can publish to as many topics as it
90
+ * names — each event goes through the publisher of the topic it was declared
91
+ * against, never a single shared one.
92
+ */
93
+ interface TopicEvent<TOutput = any> {
94
+ /** The topic's service: the publisher this event is sent through. */
95
+ topic: Service<string, EventPublisher<any>>;
96
+ type: string;
97
+ /** The event's payload, from what the handler returned. */
98
+ payload: (output: TOutput) => unknown;
99
+ /** Publish only when this holds for what the handler returned. */
100
+ when?: (output: TOutput) => boolean;
101
+ }
102
+ /**
103
+ * What `.event(topic, …)` takes: one of the topic's event types, and a payload
104
+ * of that event's shape built from the handler's output.
105
+ */
106
+ type EventFor<TTopic extends Topic<any, any>, TOutput> = TTopic extends Topic<string, infer TEvents> ? { [K in keyof TEvents & string]: {
107
+ type: K;
108
+ payload: (output: TOutput) => InferStandardSchema<TEvents[K]>;
109
+ when?: (output: TOutput) => boolean;
110
+ }; }[keyof TEvents & string] : never;
111
+ /** Publish a construct's declared events for what its handler returned. */
112
+ declare function publishConstructEvents<OutSchema extends StandardSchemaV1 | undefined = undefined>(construct: Pick<Construct, 'events' | 'logger'>, response: InferStandardSchema<OutSchema>, serviceDiscovery: ServiceDiscovery<any>, logger?: Logger, provided?: Readonly<Record<string, unknown>>): Promise<void>;
113
+ //#endregion
114
+ //#region src/Construct.d.ts
115
+ /**
116
+ * Noop context for environment sniffing.
117
+ * Used when calling service.register() to detect env vars without a real request.
118
+ * Returns dummy values since services should only use context in instance methods,
119
+ * not during registration.
120
+ */
121
+ declare const snifferContext: ServiceContext;
122
+ declare abstract class Construct<TLogger extends Logger = Logger, OutSchema extends StandardSchemaV1 | undefined = undefined, TServices extends Service[] = [], TAuditStorageServiceName extends string = string, TAuditStorage extends AuditStorage | undefined = undefined, TDatabaseServiceName extends string = string, TDatabase = unknown> {
123
+ readonly type: ConstructType;
124
+ readonly logger: TLogger;
125
+ readonly services: TServices;
126
+ /**
127
+ * What this construct publishes once its handler succeeds — each event
128
+ * bound to its own topic, so a construct publishes to as many as it names.
129
+ */
130
+ readonly events: TopicEvent[];
131
+ outputSchema?: OutSchema | undefined;
132
+ readonly timeout?: number | undefined;
133
+ readonly memorySize?: number | undefined;
134
+ readonly auditorStorageService?: Service<TAuditStorageServiceName, TAuditStorage>;
135
+ /**
136
+ * The constructs this one declared an edge to, by id.
137
+ *
138
+ * What the manifest records. `services` is the same information in the
139
+ * form a handler runs with — clients, keyed by name — and an id cannot be
140
+ * recovered from one of those reliably, so both are kept.
141
+ *
142
+ * Last in the list because every other parameter is positional and already
143
+ * spoken for; a new one anywhere else silently rebinds existing callers.
144
+ */
145
+ readonly constructs: string[];
146
+ /** Database service for this construct (used by Endpoint for RLS/audit context) */
147
+ databaseService?: Service<TDatabaseServiceName, TDatabase>;
148
+ /**
149
+ * The deploy unit that runs this, by construct id.
150
+ *
151
+ * What an endpoint's `surface` is to it, and for the same reason: something
152
+ * has to say which process a runnable belongs to, and until this existed the
153
+ * only thing that said so was the directory its file sat in. Set by the
154
+ * factory it was built from — `worker.crons`, `api.get(…)` — so it is
155
+ * carried rather than configured.
156
+ *
157
+ * Undefined for a construct built from a free-standing builder, which is
158
+ * still how `c`, `s` and `f` work.
159
+ */
160
+ owner?: string;
161
+ constructor(type: ConstructType, logger: TLogger, services: TServices,
162
+ /**
163
+ * What this construct publishes once its handler succeeds — each event
164
+ * bound to its own topic, so a construct publishes to as many as it names.
165
+ */
166
+ events?: TopicEvent[], outputSchema?: OutSchema | undefined, timeout?: number | undefined, memorySize?: number | undefined, auditorStorageService?: Service<TAuditStorageServiceName, TAuditStorage>,
167
+ /**
168
+ * The constructs this one declared an edge to, by id.
169
+ *
170
+ * What the manifest records. `services` is the same information in the
171
+ * form a handler runs with — clients, keyed by name — and an id cannot be
172
+ * recovered from one of those reliably, so both are kept.
173
+ *
174
+ * Last in the list because every other parameter is positional and already
175
+ * spoken for; a new one anywhere else silently rebinds existing callers.
176
+ */
177
+ constructs?: string[]);
178
+ /**
179
+ * Returns an array of environment variable names required by this construct's services.
180
+ * This is determined by running a "sniffer" EnvironmentParser through each service's
181
+ * register method to track which environment variables are accessed.
182
+ *
183
+ * Results are cached per service class to handle singleton patterns where
184
+ * subsequent register() calls may short-circuit and not access env vars.
185
+ *
186
+ * @param markOptional - When true, optional vars (those accessed via `.optional()` or
187
+ * `.default()`) are suffixed with `?` in the returned array (e.g. `'PORT?'`).
188
+ * @returns Promise that resolves to array of environment variable names, sorted alphabetically
189
+ *
190
+ * @example
191
+ * ```typescript
192
+ * const endpoint = e
193
+ * .services([databaseService, authService])
194
+ * .get('/users')
195
+ * .handle(async () => []);
196
+ *
197
+ * await endpoint.getEnvironment(); // ['AUTH_SECRET', 'DATABASE_URL']
198
+ * await endpoint.getEnvironment({ markOptional: true }); // ['AUTH_SECRET', 'DATABASE_URL', 'PORT?']
199
+ * ```
200
+ */
201
+ getEnvironment(opts?: {
202
+ markOptional?: boolean;
203
+ }): Promise<string[]>;
204
+ }
205
+ declare enum ConstructType {
206
+ Cron = "dev.geekmidas.function.cron",
207
+ Endpoint = "dev.geekmidas.function.endpoint",
208
+ Function = "dev.geekmidas.function.function",
209
+ Subscriber = "dev.geekmidas.function.subscriber",
210
+ Queue = "dev.geekmidas.function.queue",
211
+ Topic = "dev.geekmidas.resource.topic"
212
+ }
213
+ /**
214
+ * Utility to test sniffing a service for environment variables.
215
+ * Useful for debugging services that throw errors during sniffing.
216
+ *
217
+ * @example
218
+ * ```typescript
219
+ * import { sniffService } from '@geekmidas/constructs';
220
+ * import { authService } from './services/AuthService';
221
+ *
222
+ * const result = await sniffService(authService);
223
+ * console.log('Env vars:', result.envVars);
224
+ * console.log('Error:', result.error);
225
+ * ```
226
+ */
227
+ declare function sniffService(service: Service): Promise<SniffResult>;
228
+ //#endregion
229
+ export { EventFor as a, Topic as c, TopicOptions as d, snifferContext as i, TopicEvents as l, ConstructType as n, TopicEvent as o, sniffService as r, publishConstructEvents as s, Construct as t, TopicMessage as u };
230
+ //# sourceMappingURL=Construct-QXnl3VqT.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Construct-QXnl3VqT.d.mts","names":[],"sources":["../src/topic/Topic.ts","../src/publisher.ts","../src/Construct.ts"],"mappings":";;;;;;;;;;KAoBY,cAAc,eAAe;;;;;KAM7B,aAAa,gBAAgB,kBACvC,WAAW,mBAAmB,mBAC9B,GACA,oBAAoB,QAAQ,cAEtB;;;;;;;;;;;;;;;;;;;cAoBK,MACZ,+BACA,gBAAgB,cAAc,qBACrB;EACT;SAEO,QAAQ,eAAe,OAAO,cAAc;;;;;;;WAc1C;;WAGA,MAAM;;;;;;WAON,cAAc;;;;;;;;;;;;;WAcd,SAAS,QACjB,aAAa,QACb,eAAe,aAAa;;mBAIZ;EAEjB,YAAY,MAAM,cAAc,QAAQ,SAAS,aAAa;;;;;;;;EA8B9D,WAAW;;MAmBP,qBAAqB;;UAKT,aAAa,gBAAgB;;EAE7C,QAAQ;;;;;;;;;;;UChJQ,WAAW;;EAE3B,OAAO,gBAAgB;EACvB;;EAEA,UAAU,QAAQ;;EAElB,QAAQ,QAAQ;;;;;;KAOL,SACX,eAAe,iBACf,WACG,eAAe,oBAAoB,cAEnC,WAAW;EACX,MAAM;EACN,UAAU,QAAQ,YAAY,oBAAoB,QAAQ;EAC1D,QAAQ,QAAQ;WAEV;;iBAwFY,uBACrB,kBAAkB,0CAElB,WAAW,KAAK,iCAChB,UAAU,oBAAoB,YAC9B,kBAAkB,uBAClB,SAAQ,QACR,WAAU,SAAS,2BAA6B;;;;;;;;;cC5G3C,gBAAgB;uBAsBA,UACrB,gBAAgB,SAAS,QACzB,kBAAkB,0CAClB,kBAAkB,gBAClB,kDACA,sBAAsB,sCACtB,8CACA;WAoBiB,MAAM;WACN,QAAQ;WACR,UAAU;;;;;WAKV,QAAQ;EACjB,eAAe;WACN;WACA;WACA,wBAAwB,QACvC,0BACA;;;;;;;;;;;WAYe;;EA1CV,kBAAkB,QAAQ,sBAAsB;;;;;;;;;;;;;EAchD;EAEP,YACiB,MAAM,eACN,QAAQ,SACR,UAAU,WAKV;;;;;EAAA,SAAQ,cACjB,eAAe,uBACN,8BACA,iCACA,wBAAwB,QACvC,0BACA,gBAYe;;;;;;;;;;;EAAA;;;;;;;;;;;;;;;;;;;;;;;;EA0BX,eACL;IAAQ;MACN;;aAiEQ;EACX;EACA;EACA;EACA;EACA;EACA;;;;;;;;;;;;;;;;iBAiBqB,aAAa,SAAS,UAAU,QAAQ"}
@@ -1,12 +1,12 @@
1
1
  import { t as StandardSchemaV1 } from "./index-CeEtxDmK.cjs";
2
- import { a as FunctionHandler, r as Function } from "./index-BI23K3wy.cjs";
3
- import { EventPublisher } from "@geekmidas/events";
2
+ import { o as TopicEvent } from "./Construct-BQALFCh2.cjs";
3
+ import { a as FunctionHandler, r as Function } from "./index-B0kxstwf.cjs";
4
4
  import { Logger } from "@geekmidas/logger";
5
5
  import { ComposableStandardSchema } from "@geekmidas/schema";
6
6
  import { Service } from "@geekmidas/services";
7
7
  import { AuditableAction } from "@geekmidas/audit";
8
8
  //#region src/crons/Cron.d.ts
9
- declare class Cron<TInput extends ComposableStandardSchema | undefined = undefined, TServices extends Service[] = [], TLogger extends Logger = Logger, OutSchema extends StandardSchemaV1 | undefined = undefined, TEventPublisher extends EventPublisher<any> | undefined = undefined, TEventPublisherServiceName extends string = string, TDatabase = undefined, TDatabaseServiceName extends string = string> extends Function<TInput, TServices, TLogger, OutSchema, TEventPublisher, TEventPublisherServiceName, undefined, string, TDatabase, TDatabaseServiceName, AuditableAction<string, unknown>, FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase>> {
9
+ declare class Cron<TInput extends ComposableStandardSchema | undefined = undefined, TServices extends Service[] = [], TLogger extends Logger = Logger, OutSchema extends StandardSchemaV1 | undefined = undefined, TDatabase = undefined, TDatabaseServiceName extends string = string> extends Function<TInput, TServices, TLogger, OutSchema, undefined, string, TDatabase, TDatabaseServiceName, AuditableAction<string, unknown>, FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase>> {
10
10
  protected _schedule?: ScheduleExpression | undefined;
11
11
  /**
12
12
  * Where this cron's schedule lives when a server runs it.
@@ -21,7 +21,9 @@ declare class Cron<TInput extends ComposableStandardSchema | undefined = undefin
21
21
  */
22
22
  scheduleStore?: Service<string, unknown>;
23
23
  static isCron(obj: any): obj is Cron<any, any, any, any>;
24
- constructor(fn: FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase>, timeout?: number, _schedule?: ScheduleExpression | undefined, input?: TInput, outputSchema?: OutSchema, services?: TServices, logger?: TLogger, publisherService?: Service<TEventPublisherServiceName, TEventPublisher>, events?: any[], memorySize?: number, databaseService?: Service<TDatabaseServiceName, TDatabase>,
24
+ constructor(fn: FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase>, timeout?: number, _schedule?: ScheduleExpression | undefined, input?: TInput, outputSchema?: OutSchema, services?: TServices, logger?: TLogger,
25
+ /** What it publishes once it has run, each to its own topic. */
26
+ events?: TopicEvent[], memorySize?: number, databaseService?: Service<TDatabaseServiceName, TDatabase>,
25
27
  /**
26
28
  * The construct ids `.dependsOn()` named — last, so no existing positional
27
29
  * argument moves.
@@ -39,4 +41,4 @@ type CronExpression = `cron(${CronMinute} ${CronHour} ${CronDay} ${CronMonth} ${
39
41
  type ScheduleExpression = RateExpression | CronExpression;
40
42
  //#endregion
41
43
  export { ScheduleExpression as i, CronExpression as n, RateExpression as r, Cron as t };
42
- //# sourceMappingURL=Cron-CA2oa2nC.d.cts.map
44
+ //# sourceMappingURL=Cron-CMEGfRs8.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Cron-CMEGfRs8.d.cts","names":[],"sources":["../src/crons/Cron.ts"],"mappings":";;;;;;;;cAUa,KACZ,eAAe,kDACf,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,kBAAkB,0CAClB,uBACA,sDACS,SACT,QACA,WACA,SACA,8BAGA,WACA,sBACA,kCACA,gBAAgB,QAAQ,WAAW,SAAS,WAAW;YA0B5C,YAAY;;;;;;;;;;;;EAbvB,gBAAgB;SAET,OAAO,WAAW,OAAO;EAQhC,YACC,IAAI,gBAAgB,QAAQ,WAAW,SAAS,WAAW,YAC3D,kBACU,YAAY,gCACtB,QAAQ,QACR,eAAe,WACf,WAAU,WACV,SAAS,SAET;;EAAA,SAAQ,cACR,qBACA,kBAAkB,QAAQ,sBAAsB,YAKhD;;;;;EAAA;MAkBG,YAAY;;KAKL;KAEP;KAUA;KAUA;KAUA;KAqBA;KAiBO,yBACH,cAAc,YAAY,WAAW,aAAa;KAE/C,qBAAqB,iBAAiB"}
@@ -1,12 +1,12 @@
1
1
  import { t as StandardSchemaV1 } from "./index-CeEtxDmK.mjs";
2
- import { a as FunctionHandler, r as Function } from "./index-yb3fXNyH.mjs";
3
- import { EventPublisher } from "@geekmidas/events";
2
+ import { o as TopicEvent } from "./Construct-QXnl3VqT.mjs";
3
+ import { a as FunctionHandler, r as Function } from "./index-CjVEjOw0.mjs";
4
4
  import { Service } from "@geekmidas/services";
5
5
  import { AuditableAction } from "@geekmidas/audit";
6
6
  import { Logger } from "@geekmidas/logger";
7
7
  import { ComposableStandardSchema } from "@geekmidas/schema";
8
8
  //#region src/crons/Cron.d.ts
9
- declare class Cron<TInput extends ComposableStandardSchema | undefined = undefined, TServices extends Service[] = [], TLogger extends Logger = Logger, OutSchema extends StandardSchemaV1 | undefined = undefined, TEventPublisher extends EventPublisher<any> | undefined = undefined, TEventPublisherServiceName extends string = string, TDatabase = undefined, TDatabaseServiceName extends string = string> extends Function<TInput, TServices, TLogger, OutSchema, TEventPublisher, TEventPublisherServiceName, undefined, string, TDatabase, TDatabaseServiceName, AuditableAction<string, unknown>, FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase>> {
9
+ declare class Cron<TInput extends ComposableStandardSchema | undefined = undefined, TServices extends Service[] = [], TLogger extends Logger = Logger, OutSchema extends StandardSchemaV1 | undefined = undefined, TDatabase = undefined, TDatabaseServiceName extends string = string> extends Function<TInput, TServices, TLogger, OutSchema, undefined, string, TDatabase, TDatabaseServiceName, AuditableAction<string, unknown>, FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase>> {
10
10
  protected _schedule?: ScheduleExpression | undefined;
11
11
  /**
12
12
  * Where this cron's schedule lives when a server runs it.
@@ -21,7 +21,9 @@ declare class Cron<TInput extends ComposableStandardSchema | undefined = undefin
21
21
  */
22
22
  scheduleStore?: Service<string, unknown>;
23
23
  static isCron(obj: any): obj is Cron<any, any, any, any>;
24
- constructor(fn: FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase>, timeout?: number, _schedule?: ScheduleExpression | undefined, input?: TInput, outputSchema?: OutSchema, services?: TServices, logger?: TLogger, publisherService?: Service<TEventPublisherServiceName, TEventPublisher>, events?: any[], memorySize?: number, databaseService?: Service<TDatabaseServiceName, TDatabase>,
24
+ constructor(fn: FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase>, timeout?: number, _schedule?: ScheduleExpression | undefined, input?: TInput, outputSchema?: OutSchema, services?: TServices, logger?: TLogger,
25
+ /** What it publishes once it has run, each to its own topic. */
26
+ events?: TopicEvent[], memorySize?: number, databaseService?: Service<TDatabaseServiceName, TDatabase>,
25
27
  /**
26
28
  * The construct ids `.dependsOn()` named — last, so no existing positional
27
29
  * argument moves.
@@ -39,4 +41,4 @@ type CronExpression = `cron(${CronMinute} ${CronHour} ${CronDay} ${CronMonth} ${
39
41
  type ScheduleExpression = RateExpression | CronExpression;
40
42
  //#endregion
41
43
  export { ScheduleExpression as i, CronExpression as n, RateExpression as r, Cron as t };
42
- //# sourceMappingURL=Cron-B_iuyNxr.d.mts.map
44
+ //# sourceMappingURL=Cron-D6X4-xjB.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Cron-D6X4-xjB.d.mts","names":[],"sources":["../src/crons/Cron.ts"],"mappings":";;;;;;;;cAUa,KACZ,eAAe,kDACf,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,kBAAkB,0CAClB,uBACA,sDACS,SACT,QACA,WACA,SACA,8BAGA,WACA,sBACA,kCACA,gBAAgB,QAAQ,WAAW,SAAS,WAAW;YA0B5C,YAAY;;;;;;;;;;;;EAbvB,gBAAgB;SAET,OAAO,WAAW,OAAO;EAQhC,YACC,IAAI,gBAAgB,QAAQ,WAAW,SAAS,WAAW,YAC3D,kBACU,YAAY,gCACtB,QAAQ,QACR,eAAe,WACf,WAAU,WACV,SAAS,SAET;;EAAA,SAAQ,cACR,qBACA,kBAAkB,QAAQ,sBAAsB,YAKhD;;;;;EAAA;MAkBG,YAAY;;KAKL;KAEP;KAUA;KAUA;KAUA;KAqBA;KAiBO,yBACH,cAAc,YAAY,WAAW,aAAa;KAE/C,qBAAqB,iBAAiB"}