@geekmidas/constructs 10.0.0-alpha.13 → 10.0.0-alpha.130

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 (444) hide show
  1. package/README.md +222 -158
  2. package/dist/Construct-127M7yrl.d.cts +231 -0
  3. package/dist/Construct-127M7yrl.d.cts.map +1 -0
  4. package/dist/{Construct-BeYVu_QF.mjs → Construct-CGuc_Ijk.mjs} +8 -9
  5. package/dist/Construct-CGuc_Ijk.mjs.map +1 -0
  6. package/dist/{Construct-DqdlARxq.cjs → Construct-DorKS0Ua.cjs} +8 -9
  7. package/dist/Construct-DorKS0Ua.cjs.map +1 -0
  8. package/dist/Construct-DySlwh8o.d.mts +231 -0
  9. package/dist/Construct-DySlwh8o.d.mts.map +1 -0
  10. package/dist/{Cron-DKqnnTdH.d.cts → Cron-CFkpEys6.d.cts} +14 -7
  11. package/dist/Cron-CFkpEys6.d.cts.map +1 -0
  12. package/dist/{Cron-SyqS5oWJ.d.mts → Cron-CQoDSu-n.d.mts} +14 -7
  13. package/dist/Cron-CQoDSu-n.d.mts.map +1 -0
  14. package/dist/CronBuilder-1W-G_i15.d.mts +47 -0
  15. package/dist/CronBuilder-1W-G_i15.d.mts.map +1 -0
  16. package/dist/{CronBuilder-D_0HNBTr.mjs → CronBuilder-BJ5LoadF.mjs} +28 -11
  17. package/dist/CronBuilder-BJ5LoadF.mjs.map +1 -0
  18. package/dist/{CronBuilder-BdnI6lxF.cjs → CronBuilder-B_NSP-Y5.cjs} +27 -10
  19. package/dist/CronBuilder-B_NSP-Y5.cjs.map +1 -0
  20. package/dist/CronBuilder-OaCRRFVk.d.cts +47 -0
  21. package/dist/CronBuilder-OaCRRFVk.d.cts.map +1 -0
  22. package/dist/{Endpoint-C6yyHpRS.d.cts → Endpoint-BEh-jW-f.d.cts} +122 -41
  23. package/dist/Endpoint-BEh-jW-f.d.cts.map +1 -0
  24. package/dist/Endpoint-BcUorcBa.cjs +576 -0
  25. package/dist/Endpoint-BcUorcBa.cjs.map +1 -0
  26. package/dist/Endpoint-BgvG36NO.mjs +547 -0
  27. package/dist/Endpoint-BgvG36NO.mjs.map +1 -0
  28. package/dist/{Endpoint-DuT4TEEq.d.mts → Endpoint-DTXDggNl.d.mts} +124 -43
  29. package/dist/Endpoint-DTXDggNl.d.mts.map +1 -0
  30. package/dist/{index-BPSZ_Lp_.d.cts → EndpointFactory-B2dCS9dy.d.cts} +187 -104
  31. package/dist/EndpointFactory-B2dCS9dy.d.cts.map +1 -0
  32. package/dist/{EndpointFactory-ptPR1cXw.mjs → EndpointFactory-C1NlpCAS.mjs} +270 -54
  33. package/dist/EndpointFactory-C1NlpCAS.mjs.map +1 -0
  34. package/dist/{index-BoZ-iisU.d.mts → EndpointFactory-D2HXcUrJ.d.mts} +188 -105
  35. package/dist/EndpointFactory-D2HXcUrJ.d.mts.map +1 -0
  36. package/dist/{EndpointFactory-M8OQKZRY.cjs → EndpointFactory-gqmIRVWg.cjs} +310 -52
  37. package/dist/EndpointFactory-gqmIRVWg.cjs.map +1 -0
  38. package/dist/Function-BIEsY0Hm.d.cts +76 -0
  39. package/dist/Function-BIEsY0Hm.d.cts.map +1 -0
  40. package/dist/Function-DfMzTGS4.d.mts +76 -0
  41. package/dist/Function-DfMzTGS4.d.mts.map +1 -0
  42. package/dist/{HonoEndpointAdaptor-7QagYKdP.cjs → HonoEndpointAdaptor-BJlj20fQ.cjs} +79 -31
  43. package/dist/HonoEndpointAdaptor-BJlj20fQ.cjs.map +1 -0
  44. package/dist/{HonoEndpointAdaptor-CYHA0WAt.mjs → HonoEndpointAdaptor-BlbkUDNo.mjs} +76 -28
  45. package/dist/HonoEndpointAdaptor-BlbkUDNo.mjs.map +1 -0
  46. package/dist/ObjectSubscriberBuilder-HmBwFn2o.d.mts +129 -0
  47. package/dist/ObjectSubscriberBuilder-HmBwFn2o.d.mts.map +1 -0
  48. package/dist/ObjectSubscriberBuilder-l-64yUiF.d.cts +129 -0
  49. package/dist/ObjectSubscriberBuilder-l-64yUiF.d.cts.map +1 -0
  50. package/dist/ProcessorBuilder-B2_stA8f.d.mts +216 -0
  51. package/dist/ProcessorBuilder-B2_stA8f.d.mts.map +1 -0
  52. package/dist/ProcessorBuilder-C62bIOwj.d.cts +216 -0
  53. package/dist/ProcessorBuilder-C62bIOwj.d.cts.map +1 -0
  54. package/dist/{Queue-D9X6OoON.d.mts → Queue-BnK3UH8r.d.mts} +42 -41
  55. package/dist/Queue-BnK3UH8r.d.mts.map +1 -0
  56. package/dist/{Queue-DYPB2KWL.d.cts → Queue-C4rijiM7.d.cts} +43 -42
  57. package/dist/Queue-C4rijiM7.d.cts.map +1 -0
  58. package/dist/Queue-D4Iaidrs.cjs +109 -0
  59. package/dist/Queue-D4Iaidrs.cjs.map +1 -0
  60. package/dist/Queue-u8w8_HpE.mjs +104 -0
  61. package/dist/Queue-u8w8_HpE.mjs.map +1 -0
  62. package/dist/QueueBuilder-2wP5lEC8.mjs +118 -0
  63. package/dist/QueueBuilder-2wP5lEC8.mjs.map +1 -0
  64. package/dist/QueueBuilder-B3vL1ED2.d.mts +75 -0
  65. package/dist/QueueBuilder-B3vL1ED2.d.mts.map +1 -0
  66. package/dist/QueueBuilder-BcPBQSSX.d.cts +75 -0
  67. package/dist/QueueBuilder-BcPBQSSX.d.cts.map +1 -0
  68. package/dist/QueueBuilder-BxsZ9o5z.cjs +135 -0
  69. package/dist/QueueBuilder-BxsZ9o5z.cjs.map +1 -0
  70. package/dist/Subscriber-BdCtfFXL.d.cts +73 -0
  71. package/dist/Subscriber-BdCtfFXL.d.cts.map +1 -0
  72. package/dist/Subscriber-DDo4HFNn.d.mts +73 -0
  73. package/dist/Subscriber-DDo4HFNn.d.mts.map +1 -0
  74. package/dist/SubscriberBuilder-3msj1U2w.mjs +230 -0
  75. package/dist/SubscriberBuilder-3msj1U2w.mjs.map +1 -0
  76. package/dist/SubscriberBuilder-CQst6Iz3.cjs +253 -0
  77. package/dist/SubscriberBuilder-CQst6Iz3.cjs.map +1 -0
  78. package/dist/Topic-DN2gYJ-p.mjs +99 -0
  79. package/dist/Topic-DN2gYJ-p.mjs.map +1 -0
  80. package/dist/Topic-Dp9Q7Lj2.cjs +104 -0
  81. package/dist/Topic-Dp9Q7Lj2.cjs.map +1 -0
  82. package/dist/adaptors/aws.cjs +134 -160
  83. package/dist/adaptors/aws.cjs.map +1 -1
  84. package/dist/adaptors/aws.d.cts +57 -48
  85. package/dist/adaptors/aws.d.cts.map +1 -1
  86. package/dist/adaptors/aws.d.mts +58 -49
  87. package/dist/adaptors/aws.d.mts.map +1 -1
  88. package/dist/adaptors/aws.mjs +130 -157
  89. package/dist/adaptors/aws.mjs.map +1 -1
  90. package/dist/adaptors/hono.cjs +1 -1
  91. package/dist/adaptors/hono.d.cts +5 -6
  92. package/dist/adaptors/hono.d.cts.map +1 -1
  93. package/dist/adaptors/hono.d.mts +6 -7
  94. package/dist/adaptors/hono.d.mts.map +1 -1
  95. package/dist/adaptors/hono.mjs +1 -1
  96. package/dist/adaptors/testing.cjs +824 -38
  97. package/dist/adaptors/testing.cjs.map +1 -1
  98. package/dist/adaptors/testing.d.cts +368 -39
  99. package/dist/adaptors/testing.d.cts.map +1 -1
  100. package/dist/adaptors/testing.d.mts +367 -38
  101. package/dist/adaptors/testing.d.mts.map +1 -1
  102. package/dist/adaptors/testing.mjs +802 -34
  103. package/dist/adaptors/testing.mjs.map +1 -1
  104. package/dist/auth-BMCJN30Y.d.cts +268 -0
  105. package/dist/auth-BMCJN30Y.d.cts.map +1 -0
  106. package/dist/auth-D_0788uW.d.mts +268 -0
  107. package/dist/auth-D_0788uW.d.mts.map +1 -0
  108. package/dist/auth.cjs +289 -46
  109. package/dist/auth.cjs.map +1 -1
  110. package/dist/auth.d.cts +2 -104
  111. package/dist/auth.d.mts +2 -104
  112. package/dist/auth.mjs +285 -48
  113. package/dist/auth.mjs.map +1 -1
  114. package/dist/cache-5QZzh5Er.d.mts +44 -0
  115. package/dist/cache-5QZzh5Er.d.mts.map +1 -0
  116. package/dist/cache-DnGDGly3.d.cts +44 -0
  117. package/dist/cache-DnGDGly3.d.cts.map +1 -0
  118. package/dist/cache.d.cts +2 -43
  119. package/dist/cache.d.mts +2 -43
  120. package/dist/cipher-C1lEFX63.mjs +225 -0
  121. package/dist/cipher-C1lEFX63.mjs.map +1 -0
  122. package/dist/cipher-CVxfwLjk.cjs +332 -0
  123. package/dist/cipher-CVxfwLjk.cjs.map +1 -0
  124. package/dist/cipher-DSDxPRIp.d.cts +106 -0
  125. package/dist/cipher-DSDxPRIp.d.cts.map +1 -0
  126. package/dist/cipher-DSDxPRIp.d.mts +106 -0
  127. package/dist/cipher-DSDxPRIp.d.mts.map +1 -0
  128. package/dist/{construct-interface-DPlxfpoS.d.mts → construct-interface-B1AfqRl4.d.cts} +42 -8
  129. package/dist/construct-interface-B1AfqRl4.d.cts.map +1 -0
  130. package/dist/{construct-interface-DgXTJcOD.d.cts → construct-interface-ZvYQbivO.d.mts} +42 -8
  131. package/dist/construct-interface-ZvYQbivO.d.mts.map +1 -0
  132. package/dist/construct-interface.cjs +30 -4
  133. package/dist/construct-interface.cjs.map +1 -1
  134. package/dist/construct-interface.d.cts +2 -2
  135. package/dist/construct-interface.d.mts +2 -2
  136. package/dist/construct-interface.mjs +30 -5
  137. package/dist/construct-interface.mjs.map +1 -1
  138. package/dist/credential-DYymbp_7.cjs +257 -0
  139. package/dist/credential-DYymbp_7.cjs.map +1 -0
  140. package/dist/credential-DfSAOOdY.mjs +222 -0
  141. package/dist/credential-DfSAOOdY.mjs.map +1 -0
  142. package/dist/credential.cjs +7 -129
  143. package/dist/credential.d.cts +2 -58
  144. package/dist/credential.d.mts +2 -58
  145. package/dist/credential.mjs +2 -128
  146. package/dist/crons/index.cjs +126 -1
  147. package/dist/crons/index.cjs.map +1 -1
  148. package/dist/crons/index.d.cts +43 -3
  149. package/dist/crons/index.d.cts.map +1 -1
  150. package/dist/crons/index.d.mts +43 -3
  151. package/dist/crons/index.d.mts.map +1 -1
  152. package/dist/crons/index.mjs +125 -2
  153. package/dist/crons/index.mjs.map +1 -1
  154. package/dist/database/kysely.cjs +3 -194
  155. package/dist/database/kysely.d.cts +2 -149
  156. package/dist/database/kysely.d.mts +2 -149
  157. package/dist/database/kysely.mjs +2 -192
  158. package/dist/email.d.cts +1 -1
  159. package/dist/email.d.cts.map +1 -1
  160. package/dist/email.d.mts +2 -2
  161. package/dist/email.d.mts.map +1 -1
  162. package/dist/encryption/kms.cjs +95 -0
  163. package/dist/encryption/kms.cjs.map +1 -0
  164. package/dist/encryption/kms.d.cts +7 -0
  165. package/dist/encryption/kms.d.cts.map +1 -0
  166. package/dist/encryption/kms.d.mts +7 -0
  167. package/dist/encryption/kms.d.mts.map +1 -0
  168. package/dist/encryption/kms.mjs +93 -0
  169. package/dist/encryption/kms.mjs.map +1 -0
  170. package/dist/encryption.cjs +116 -0
  171. package/dist/encryption.cjs.map +1 -0
  172. package/dist/encryption.d.cts +37 -0
  173. package/dist/encryption.d.cts.map +1 -0
  174. package/dist/encryption.d.mts +37 -0
  175. package/dist/encryption.d.mts.map +1 -0
  176. package/dist/encryption.mjs +101 -0
  177. package/dist/encryption.mjs.map +1 -0
  178. package/dist/endpoints/index.cjs +25 -10
  179. package/dist/endpoints/index.d.cts +105 -3
  180. package/dist/endpoints/index.d.cts.map +1 -0
  181. package/dist/endpoints/index.d.mts +105 -3
  182. package/dist/endpoints/index.d.mts.map +1 -0
  183. package/dist/endpoints/index.mjs +5 -4
  184. package/dist/expire-C586zznE.d.cts +38 -0
  185. package/dist/expire-C586zznE.d.cts.map +1 -0
  186. package/dist/expire-C586zznE.d.mts +38 -0
  187. package/dist/expire-C586zznE.d.mts.map +1 -0
  188. package/dist/expire-CieftS01.cjs +67 -0
  189. package/dist/expire-CieftS01.cjs.map +1 -0
  190. package/dist/expire-CpzUAfr9.mjs +50 -0
  191. package/dist/expire-CpzUAfr9.mjs.map +1 -0
  192. package/dist/external-api.cjs +106 -0
  193. package/dist/external-api.cjs.map +1 -0
  194. package/dist/external-api.d.cts +2 -0
  195. package/dist/external-api.d.mts +2 -0
  196. package/dist/external-api.mjs +103 -0
  197. package/dist/external-api.mjs.map +1 -0
  198. package/dist/fake-BUgcX2Dk.d.cts +201 -0
  199. package/dist/fake-BUgcX2Dk.d.cts.map +1 -0
  200. package/dist/fake-D472nkKb.d.mts +201 -0
  201. package/dist/fake-D472nkKb.d.mts.map +1 -0
  202. package/dist/file-server.cjs +123 -30
  203. package/dist/file-server.cjs.map +1 -1
  204. package/dist/file-server.d.cts +115 -1
  205. package/dist/file-server.d.cts.map +1 -1
  206. package/dist/file-server.d.mts +115 -1
  207. package/dist/file-server.d.mts.map +1 -1
  208. package/dist/file-server.mjs +122 -32
  209. package/dist/file-server.mjs.map +1 -1
  210. package/dist/functions/index.cjs +1 -1
  211. package/dist/functions/index.d.cts +2 -1
  212. package/dist/functions/index.d.mts +2 -1
  213. package/dist/functions/index.mjs +1 -1
  214. package/dist/{functions-C53GW2eQ.mjs → functions-BvIDQKAA.mjs} +117 -22
  215. package/dist/functions-BvIDQKAA.mjs.map +1 -0
  216. package/dist/{functions-B6qCvfmy.cjs → functions-DLF6-IK8.cjs} +122 -18
  217. package/dist/functions-DLF6-IK8.cjs.map +1 -0
  218. package/dist/index-BtzMzhMA.d.cts +115 -0
  219. package/dist/index-BtzMzhMA.d.cts.map +1 -0
  220. package/dist/{index-CeEtxDmK.d.cts → index-DdRjYhiJ.d.cts} +42 -2
  221. package/dist/{index-CeEtxDmK.d.cts.map → index-DdRjYhiJ.d.cts.map} +1 -1
  222. package/dist/{index-CeEtxDmK.d.mts → index-DdRjYhiJ.d.mts} +42 -2
  223. package/dist/{index-CeEtxDmK.d.mts.map → index-DdRjYhiJ.d.mts.map} +1 -1
  224. package/dist/index-DuriFjYD.d.mts +115 -0
  225. package/dist/index-DuriFjYD.d.mts.map +1 -0
  226. package/dist/index.cjs +4 -1
  227. package/dist/index.d.cts +26 -3
  228. package/dist/index.d.cts.map +1 -0
  229. package/dist/index.d.mts +26 -3
  230. package/dist/index.d.mts.map +1 -0
  231. package/dist/index.mjs +3 -2
  232. package/dist/kysely-BHYV-WC-.d.cts +216 -0
  233. package/dist/kysely-BHYV-WC-.d.cts.map +1 -0
  234. package/dist/kysely-CAW3QSqp.d.mts +216 -0
  235. package/dist/kysely-CAW3QSqp.d.mts.map +1 -0
  236. package/dist/kysely-Cs4uPO8k.mjs +371 -0
  237. package/dist/kysely-Cs4uPO8k.mjs.map +1 -0
  238. package/dist/kysely-CukArHJ0.cjs +384 -0
  239. package/dist/kysely-CukArHJ0.cjs.map +1 -0
  240. package/dist/{telemetry-DGcFlVpB.d.cts → lambdaTelemetry-8vnmVZQ5.d.cts} +2 -2
  241. package/dist/lambdaTelemetry-8vnmVZQ5.d.cts.map +1 -0
  242. package/dist/{telemetry-DGcFlVpB.d.mts → lambdaTelemetry-8vnmVZQ5.d.mts} +2 -2
  243. package/dist/lambdaTelemetry-8vnmVZQ5.d.mts.map +1 -0
  244. package/dist/mobile-app.cjs +74 -0
  245. package/dist/mobile-app.cjs.map +1 -0
  246. package/dist/mobile-app.d.cts +73 -0
  247. package/dist/mobile-app.d.cts.map +1 -0
  248. package/dist/mobile-app.d.mts +73 -0
  249. package/dist/mobile-app.d.mts.map +1 -0
  250. package/dist/mobile-app.mjs +73 -0
  251. package/dist/mobile-app.mjs.map +1 -0
  252. package/dist/object-storage.cjs +8 -1
  253. package/dist/object-storage.cjs.map +1 -1
  254. package/dist/object-storage.d.cts +10 -1
  255. package/dist/object-storage.d.cts.map +1 -1
  256. package/dist/object-storage.d.mts +10 -1
  257. package/dist/object-storage.d.mts.map +1 -1
  258. package/dist/object-storage.mjs +7 -2
  259. package/dist/object-storage.mjs.map +1 -1
  260. package/dist/pattern-C1CEcglD.mjs +241 -0
  261. package/dist/pattern-C1CEcglD.mjs.map +1 -0
  262. package/dist/pattern-QFaUIr77.cjs +288 -0
  263. package/dist/pattern-QFaUIr77.cjs.map +1 -0
  264. package/dist/processors/index.cjs +214 -0
  265. package/dist/processors/index.cjs.map +1 -0
  266. package/dist/processors/index.d.cts +78 -0
  267. package/dist/processors/index.d.cts.map +1 -0
  268. package/dist/processors/index.d.mts +78 -0
  269. package/dist/processors/index.d.mts.map +1 -0
  270. package/dist/processors/index.mjs +193 -0
  271. package/dist/processors/index.mjs.map +1 -0
  272. package/dist/queue/index.cjs +5 -192
  273. package/dist/queue/index.d.cts +3 -53
  274. package/dist/queue/index.d.mts +3 -53
  275. package/dist/queue/index.mjs +3 -190
  276. package/dist/random-password.cjs +86 -0
  277. package/dist/random-password.cjs.map +1 -0
  278. package/dist/random-password.d.cts +30 -0
  279. package/dist/random-password.d.cts.map +1 -0
  280. package/dist/random-password.d.mts +30 -0
  281. package/dist/random-password.d.mts.map +1 -0
  282. package/dist/random-password.mjs +84 -0
  283. package/dist/random-password.mjs.map +1 -0
  284. package/dist/{lazyAccessors-BHtcqgz2.mjs → readRequestBody-BTIl3k-D.mjs} +99 -39
  285. package/dist/readRequestBody-BTIl3k-D.mjs.map +1 -0
  286. package/dist/{lazyAccessors-Dx9NLwJZ.cjs → readRequestBody-Dej_L3c4.cjs} +118 -46
  287. package/dist/readRequestBody-Dej_L3c4.cjs.map +1 -0
  288. package/dist/requestLogger-BZcXwdBs.cjs +207 -0
  289. package/dist/requestLogger-BZcXwdBs.cjs.map +1 -0
  290. package/dist/requestLogger-pA4gi3E1.mjs +178 -0
  291. package/dist/requestLogger-pA4gi3E1.mjs.map +1 -0
  292. package/dist/rest-api.cjs +76 -43
  293. package/dist/rest-api.cjs.map +1 -1
  294. package/dist/rest-api.d.cts +64 -31
  295. package/dist/rest-api.d.cts.map +1 -1
  296. package/dist/rest-api.d.mts +64 -31
  297. package/dist/rest-api.d.mts.map +1 -1
  298. package/dist/rest-api.mjs +76 -43
  299. package/dist/rest-api.mjs.map +1 -1
  300. package/dist/runSubscriber-B1Yg4dID.cjs +128 -0
  301. package/dist/runSubscriber-B1Yg4dID.cjs.map +1 -0
  302. package/dist/runSubscriber-JCgkeYbE.mjs +111 -0
  303. package/dist/runSubscriber-JCgkeYbE.mjs.map +1 -0
  304. package/dist/shutdown-BMJmAhSt.cjs +38 -0
  305. package/dist/shutdown-BMJmAhSt.cjs.map +1 -0
  306. package/dist/shutdown-C7xa8x9S.mjs +27 -0
  307. package/dist/shutdown-C7xa8x9S.mjs.map +1 -0
  308. package/dist/site.cjs +9 -3
  309. package/dist/site.cjs.map +1 -1
  310. package/dist/site.d.cts +44 -1
  311. package/dist/site.d.cts.map +1 -1
  312. package/dist/site.d.mts +44 -1
  313. package/dist/site.d.mts.map +1 -1
  314. package/dist/site.mjs +9 -3
  315. package/dist/site.mjs.map +1 -1
  316. package/dist/stages-DaTaoQei.d.cts +73 -0
  317. package/dist/stages-DaTaoQei.d.cts.map +1 -0
  318. package/dist/stages-DaTaoQei.d.mts +73 -0
  319. package/dist/stages-DaTaoQei.d.mts.map +1 -0
  320. package/dist/subscribers/index.cjs +134 -1
  321. package/dist/subscribers/index.cjs.map +1 -0
  322. package/dist/subscribers/index.d.cts +74 -3
  323. package/dist/subscribers/index.d.cts.map +1 -0
  324. package/dist/subscribers/index.d.mts +74 -3
  325. package/dist/subscribers/index.d.mts.map +1 -0
  326. package/dist/subscribers/index.mjs +132 -2
  327. package/dist/subscribers/index.mjs.map +1 -0
  328. package/dist/telemetry-B48RLjyk.d.cts +40 -0
  329. package/dist/telemetry-B48RLjyk.d.cts.map +1 -0
  330. package/dist/telemetry-BEoBn6GO.d.mts +40 -0
  331. package/dist/telemetry-BEoBn6GO.d.mts.map +1 -0
  332. package/dist/telemetry.cjs +56 -0
  333. package/dist/telemetry.cjs.map +1 -0
  334. package/dist/telemetry.d.cts +2 -0
  335. package/dist/telemetry.d.mts +2 -0
  336. package/dist/telemetry.mjs +55 -0
  337. package/dist/telemetry.mjs.map +1 -0
  338. package/dist/topic/index.cjs +2 -134
  339. package/dist/topic/index.d.cts +2 -3
  340. package/dist/topic/index.d.mts +2 -3
  341. package/dist/topic/index.mjs +2 -132
  342. package/dist/tracing-Bbj1uoFJ.mjs +127 -0
  343. package/dist/tracing-Bbj1uoFJ.mjs.map +1 -0
  344. package/dist/tracing-C0ooU0V2.cjs +150 -0
  345. package/dist/tracing-C0ooU0V2.cjs.map +1 -0
  346. package/dist/websocket-api.cjs +769 -0
  347. package/dist/websocket-api.cjs.map +1 -0
  348. package/dist/websocket-api.d.cts +449 -0
  349. package/dist/websocket-api.d.cts.map +1 -0
  350. package/dist/websocket-api.d.mts +449 -0
  351. package/dist/websocket-api.d.mts.map +1 -0
  352. package/dist/websocket-api.mjs +755 -0
  353. package/dist/websocket-api.mjs.map +1 -0
  354. package/dist/worker.cjs +70 -23
  355. package/dist/worker.cjs.map +1 -1
  356. package/dist/worker.d.cts +86 -36
  357. package/dist/worker.d.cts.map +1 -1
  358. package/dist/worker.d.mts +87 -37
  359. package/dist/worker.d.mts.map +1 -1
  360. package/dist/worker.mjs +70 -23
  361. package/dist/worker.mjs.map +1 -1
  362. package/package.json +145 -44
  363. package/dist/Construct-BeYVu_QF.mjs.map +0 -1
  364. package/dist/Construct-DfbwIntp.d.cts +0 -115
  365. package/dist/Construct-DfbwIntp.d.cts.map +0 -1
  366. package/dist/Construct-DqdlARxq.cjs.map +0 -1
  367. package/dist/Construct-l5aOn_jv.d.mts +0 -115
  368. package/dist/Construct-l5aOn_jv.d.mts.map +0 -1
  369. package/dist/Cron-DKqnnTdH.d.cts.map +0 -1
  370. package/dist/Cron-SyqS5oWJ.d.mts.map +0 -1
  371. package/dist/CronBuilder-BdnI6lxF.cjs.map +0 -1
  372. package/dist/CronBuilder-CRGnDfTq.d.mts +0 -41
  373. package/dist/CronBuilder-CRGnDfTq.d.mts.map +0 -1
  374. package/dist/CronBuilder-D_0HNBTr.mjs.map +0 -1
  375. package/dist/CronBuilder-Df1q9PNy.d.cts +0 -41
  376. package/dist/CronBuilder-Df1q9PNy.d.cts.map +0 -1
  377. package/dist/Endpoint-BCiCYvx2.mjs +0 -1665
  378. package/dist/Endpoint-BCiCYvx2.mjs.map +0 -1
  379. package/dist/Endpoint-C6yyHpRS.d.cts.map +0 -1
  380. package/dist/Endpoint-DuT4TEEq.d.mts.map +0 -1
  381. package/dist/Endpoint-s0AyrQGC.cjs +0 -1683
  382. package/dist/Endpoint-s0AyrQGC.cjs.map +0 -1
  383. package/dist/EndpointFactory-M8OQKZRY.cjs.map +0 -1
  384. package/dist/EndpointFactory-ptPR1cXw.mjs.map +0 -1
  385. package/dist/HonoEndpointAdaptor-7QagYKdP.cjs.map +0 -1
  386. package/dist/HonoEndpointAdaptor-CYHA0WAt.mjs.map +0 -1
  387. package/dist/Queue-D9X6OoON.d.mts.map +0 -1
  388. package/dist/Queue-DYPB2KWL.d.cts.map +0 -1
  389. package/dist/Subscriber-C4heaAyO.d.mts +0 -51
  390. package/dist/Subscriber-C4heaAyO.d.mts.map +0 -1
  391. package/dist/Subscriber-CotDUELC.d.cts +0 -51
  392. package/dist/Subscriber-CotDUELC.d.cts.map +0 -1
  393. package/dist/SubscriberBuilder-BEv0eoHy.d.cts +0 -59
  394. package/dist/SubscriberBuilder-BEv0eoHy.d.cts.map +0 -1
  395. package/dist/SubscriberBuilder-C0ZEtGDI.cjs +0 -125
  396. package/dist/SubscriberBuilder-C0ZEtGDI.cjs.map +0 -1
  397. package/dist/SubscriberBuilder-h7B_cHMr.mjs +0 -114
  398. package/dist/SubscriberBuilder-h7B_cHMr.mjs.map +0 -1
  399. package/dist/SubscriberBuilder-tyH5yTk5.d.mts +0 -59
  400. package/dist/SubscriberBuilder-tyH5yTk5.d.mts.map +0 -1
  401. package/dist/Topic-DEVGo0Dm.d.cts +0 -89
  402. package/dist/Topic-DEVGo0Dm.d.cts.map +0 -1
  403. package/dist/Topic-zk_6Gthr.d.mts +0 -89
  404. package/dist/Topic-zk_6Gthr.d.mts.map +0 -1
  405. package/dist/auth.d.cts.map +0 -1
  406. package/dist/auth.d.mts.map +0 -1
  407. package/dist/cache.d.cts.map +0 -1
  408. package/dist/cache.d.mts.map +0 -1
  409. package/dist/construct-interface-DPlxfpoS.d.mts.map +0 -1
  410. package/dist/construct-interface-DgXTJcOD.d.cts.map +0 -1
  411. package/dist/credential.cjs.map +0 -1
  412. package/dist/credential.d.cts.map +0 -1
  413. package/dist/credential.d.mts.map +0 -1
  414. package/dist/credential.mjs.map +0 -1
  415. package/dist/database/kysely.cjs.map +0 -1
  416. package/dist/database/kysely.d.cts.map +0 -1
  417. package/dist/database/kysely.d.mts.map +0 -1
  418. package/dist/database/kysely.mjs.map +0 -1
  419. package/dist/functions-B6qCvfmy.cjs.map +0 -1
  420. package/dist/functions-C53GW2eQ.mjs.map +0 -1
  421. package/dist/index-B2urf3YI.d.cts +0 -26
  422. package/dist/index-B2urf3YI.d.cts.map +0 -1
  423. package/dist/index-BPSZ_Lp_.d.cts.map +0 -1
  424. package/dist/index-BoZ-iisU.d.mts.map +0 -1
  425. package/dist/index-CdaU--_B.d.cts +0 -165
  426. package/dist/index-CdaU--_B.d.cts.map +0 -1
  427. package/dist/index-DMCDvnsM.d.mts +0 -26
  428. package/dist/index-DMCDvnsM.d.mts.map +0 -1
  429. package/dist/index-PQRWOQj4.d.mts +0 -165
  430. package/dist/index-PQRWOQj4.d.mts.map +0 -1
  431. package/dist/lazyAccessors-BHtcqgz2.mjs.map +0 -1
  432. package/dist/lazyAccessors-Dx9NLwJZ.cjs.map +0 -1
  433. package/dist/processAudits-BpRlPQMW.mjs +0 -77
  434. package/dist/processAudits-BpRlPQMW.mjs.map +0 -1
  435. package/dist/processAudits-D_2W5x8k.cjs +0 -88
  436. package/dist/processAudits-D_2W5x8k.cjs.map +0 -1
  437. package/dist/queue/index.cjs.map +0 -1
  438. package/dist/queue/index.d.cts.map +0 -1
  439. package/dist/queue/index.d.mts.map +0 -1
  440. package/dist/queue/index.mjs.map +0 -1
  441. package/dist/telemetry-DGcFlVpB.d.cts.map +0 -1
  442. package/dist/telemetry-DGcFlVpB.d.mts.map +0 -1
  443. package/dist/topic/index.cjs.map +0 -1
  444. package/dist/topic/index.mjs.map +0 -1
@@ -1,5 +1,6 @@
1
- import { t as StandardSchemaV1 } from "./index-CeEtxDmK.mjs";
2
- import { t as Construct } from "./Construct-l5aOn_jv.mjs";
1
+ import { n as StandardSchemaV1 } from "./index-DdRjYhiJ.mjs";
2
+ import { t as Construct } from "./Construct-DySlwh8o.mjs";
3
+ import { t as DatabaseContext } from "./Function-DfMzTGS4.mjs";
3
4
  import { Declaration } from "@geekmidas/manifest";
4
5
  import { EventPublisher, PublishableMessage } from "@geekmidas/events";
5
6
  import { Service, ServiceRecord } from "@geekmidas/services";
@@ -16,15 +17,19 @@ type QueueMessage<TName extends string, TMessage extends StandardSchemaV1> = Pub
16
17
  /**
17
18
  * A queue worker — a point-to-point SQS-style queue and its single consumer.
18
19
  * 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.
20
+ * drains every message of its one `message` type. Build one from the worker
21
+ * that runs it — `worker.queue('Emails').message(schema).handle(…)` — and
22
+ * `gkm build` discovers it into the manifest's `queues` field.
21
23
  *
22
- * The producer side is {@link Queue.publisher} — a ready-to-inject `Service`
23
- * that any endpoint/function drops into `.services([...])` to send messages.
24
+ * Producers send to it by depending on it: `.dependsOn([emails])` makes
25
+ * `services.emails` the publisher.
26
+ *
27
+ * Its handler gets `db` when it has a database: the worker's, declared once
28
+ * with `worker.database(db)`, or its own with `.database(other)`.
24
29
  */
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> {
30
+ declare class Queue<TName extends string = string, TMessage extends StandardSchemaV1 = StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger, TDatabase = undefined, TDatabaseServiceName extends string = string> extends Construct<TLogger, undefined, TServices, string, undefined, TDatabaseServiceName, TDatabase> {
26
31
  readonly name: TName;
27
- readonly handler: QueueHandler<TMessage, TServices, TLogger>;
32
+ readonly handler: QueueHandler<TMessage, TServices, TLogger, TDatabase>;
28
33
  readonly messageSchema: TMessage;
29
34
  readonly timeout: number;
30
35
  readonly services: TServices;
@@ -34,7 +39,7 @@ declare class Queue<TName extends string = string, TMessage extends StandardSche
34
39
  /** Whether the queue is FIFO (deployed). */
35
40
  readonly fifo?: boolean | undefined;
36
41
  __IS_QUEUE__: boolean;
37
- static isQueue(obj: unknown): obj is Queue<string, StandardSchemaV1, Service[], Logger>;
42
+ static isQueue(obj: unknown): obj is Queue<string, StandardSchemaV1, Service[], Logger, any>;
38
43
  /**
39
44
  * The canonical id this queue is declared under.
40
45
  *
@@ -45,12 +50,22 @@ declare class Queue<TName extends string = string, TMessage extends StandardSche
45
50
  */
46
51
  readonly id: string;
47
52
  /**
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.
53
+ * The queue as a dependency — what `.dependsOn([emails])` dissolves into,
54
+ * reachable as `services.emails`.
55
+ *
56
+ * The producer: the queue's one consumer is the handler it was built with,
57
+ * so the only thing another construct can want from a queue is to send to
58
+ * it. It reads `<NAME>_PUBLISHER_CONNECTION_STRING` and picks the transport
59
+ * from its protocol — `pgboss://` locally, `sqs://` deployed. A field
60
+ * assigned once, not a getter: services are cached by object identity.
61
+ */
62
+ readonly service: Service<Uncapitalize<TName>, EventPublisher<QueueMessage<TName, TMessage>>>;
63
+ /**
64
+ * The producer's env key. Read by both {@link declare} and the service, so
65
+ * what the target publishes and what the producer looks up cannot drift.
51
66
  */
52
67
  private readonly connectionKey;
53
- constructor(name: TName, handler: QueueHandler<TMessage, TServices, TLogger>, messageSchema: TMessage, timeout?: number, services?: TServices, logger?: TLogger,
68
+ constructor(name: TName, handler: QueueHandler<TMessage, TServices, TLogger, TDatabase>, messageSchema: TMessage, timeout?: number, services?: TServices, logger?: TLogger,
54
69
  /** SQS event-source batch size (deployed). */
55
70
  batchSize?: number | undefined,
56
71
  /** Whether the queue is FIFO (deployed). */
@@ -59,7 +74,12 @@ declare class Queue<TName extends string = string, TMessage extends StandardSche
59
74
  * The construct ids the *worker* `.dependsOn()` named — last, so no
60
75
  * existing positional argument moves.
61
76
  */
62
- constructs?: string[]);
77
+ constructs?: string[],
78
+ /**
79
+ * What the handler's `db` is registered from — after `constructs`, for
80
+ * the same reason.
81
+ */
82
+ databaseService?: Service<TDatabaseServiceName, TDatabase>);
63
83
  /**
64
84
  * What this queue is in the manifest.
65
85
  *
@@ -69,36 +89,17 @@ declare class Queue<TName extends string = string, TMessage extends StandardSche
69
89
  * running and what connection string to inject.
70
90
  */
71
91
  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
92
  }
95
- /** The context a queue handler receives — a batch of typed messages. */
96
- type QueueContext<TMessage extends StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger> = {
93
+ /**
94
+ * The context a queue handler receives — a batch of typed messages, and `db`
95
+ * when the queue has a database.
96
+ */
97
+ type QueueContext<TMessage extends StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger, TDatabase = undefined> = {
97
98
  messages: InferStandardSchema<TMessage>[];
98
99
  services: ServiceRecord<TServices>;
99
100
  logger: TLogger;
100
- };
101
- type QueueHandler<TMessage extends StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger> = (ctx: QueueContext<TMessage, TServices, TLogger>) => unknown | Promise<unknown>;
101
+ } & DatabaseContext<TDatabase>;
102
+ type QueueHandler<TMessage extends StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger, TDatabase = undefined> = (ctx: QueueContext<TMessage, TServices, TLogger, TDatabase>) => unknown | Promise<unknown>;
102
103
  //#endregion
103
104
  export { QueueMessage as i, QueueContext as n, QueueHandler as r, Queue as t };
104
- //# sourceMappingURL=Queue-D9X6OoON.d.mts.map
105
+ //# sourceMappingURL=Queue-BnK3UH8r.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Queue-BnK3UH8r.d.mts","names":[],"sources":["../src/queue/Queue.ts"],"mappings":";;;;;;;;;;;;;;;KA0BY,aACX,sBACA,iBAAiB,oBACd,mBAAmB,OAAO,oBAAoB;;;;;;;;;;;;;;cAerC,MACZ,+BACA,iBAAiB,mBAAmB,kBACpC,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,uBACA,sDACS,UACT,oBAEA,8BAGA,sBACA;WA8CiB,MAAM;WACN,SAAS,aACxB,UACA,WACA,SACA;WAEe,eAAe;WACN;WACA,UAAU;WACV,QAAQ;;WAEjB;;WAEA;EA1DjB;SAEO,QACN,eACE,OAAO,cAAc,kBAAkB,WAAW;;;;;;;;;WAgB5C;;;;;;;;;;;WAYA,SAAS,QACjB,aAAa,QACb,eAAe,aAAa,OAAO;;;;;mBAOnB;EAEjB,YACiB,MAAM,OACN,SAAS,aACxB,UACA,WACA,SACA,YAEe,eAAe,UACN,kBACA,WAAU,WACV,SAAQ,SAEjB;;EAAA,gCAEA;;EAAA,4BAKhB;;;;;EAAA,uBAKA;;;;;EAAA,kBAAkB,QAAQ,sBAAsB;;;;;;;;;EAyCjD,WAAW;;;;;;KA8BA,aACX,iBAAiB,kBACjB,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB;EAEA,UAAU,oBAAoB;EAC9B,UAAU,cAAc;EACxB,QAAQ;IACL,gBAAgB;KAER,aACX,iBAAiB,kBACjB,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,0BAEA,KAAK,aAAa,UAAU,WAAW,SAAS,yBAClC"}
@@ -1,9 +1,10 @@
1
- import { t as StandardSchemaV1 } from "./index-CeEtxDmK.cjs";
2
- import { t as Construct } from "./Construct-DfbwIntp.cjs";
3
- import { EventPublisher, PublishableMessage } from "@geekmidas/events";
1
+ import { n as StandardSchemaV1 } from "./index-DdRjYhiJ.cjs";
2
+ import { t as Construct } from "./Construct-127M7yrl.cjs";
3
+ import { t as DatabaseContext } from "./Function-BIEsY0Hm.cjs";
4
4
  import { Logger } from "@geekmidas/logger";
5
5
  import { InferStandardSchema } from "@geekmidas/schema";
6
6
  import { Service, ServiceRecord } from "@geekmidas/services";
7
+ import { EventPublisher, PublishableMessage } from "@geekmidas/events";
7
8
  import { Declaration } from "@geekmidas/manifest";
8
9
  //#region src/queue/Queue.d.ts
9
10
  /**
@@ -16,15 +17,19 @@ type QueueMessage<TName extends string, TMessage extends StandardSchemaV1> = Pub
16
17
  /**
17
18
  * A queue worker — a point-to-point SQS-style queue and its single consumer.
18
19
  * 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.
20
+ * drains every message of its one `message` type. Build one from the worker
21
+ * that runs it — `worker.queue('Emails').message(schema).handle(…)` — and
22
+ * `gkm build` discovers it into the manifest's `queues` field.
21
23
  *
22
- * The producer side is {@link Queue.publisher} — a ready-to-inject `Service`
23
- * that any endpoint/function drops into `.services([...])` to send messages.
24
+ * Producers send to it by depending on it: `.dependsOn([emails])` makes
25
+ * `services.emails` the publisher.
26
+ *
27
+ * Its handler gets `db` when it has a database: the worker's, declared once
28
+ * with `worker.database(db)`, or its own with `.database(other)`.
24
29
  */
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> {
30
+ declare class Queue<TName extends string = string, TMessage extends StandardSchemaV1 = StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger, TDatabase = undefined, TDatabaseServiceName extends string = string> extends Construct<TLogger, undefined, TServices, string, undefined, TDatabaseServiceName, TDatabase> {
26
31
  readonly name: TName;
27
- readonly handler: QueueHandler<TMessage, TServices, TLogger>;
32
+ readonly handler: QueueHandler<TMessage, TServices, TLogger, TDatabase>;
28
33
  readonly messageSchema: TMessage;
29
34
  readonly timeout: number;
30
35
  readonly services: TServices;
@@ -34,7 +39,7 @@ declare class Queue<TName extends string = string, TMessage extends StandardSche
34
39
  /** Whether the queue is FIFO (deployed). */
35
40
  readonly fifo?: boolean | undefined;
36
41
  __IS_QUEUE__: boolean;
37
- static isQueue(obj: unknown): obj is Queue<string, StandardSchemaV1, Service[], Logger>;
42
+ static isQueue(obj: unknown): obj is Queue<string, StandardSchemaV1, Service[], Logger, any>;
38
43
  /**
39
44
  * The canonical id this queue is declared under.
40
45
  *
@@ -45,12 +50,22 @@ declare class Queue<TName extends string = string, TMessage extends StandardSche
45
50
  */
46
51
  readonly id: string;
47
52
  /**
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.
53
+ * The queue as a dependency — what `.dependsOn([emails])` dissolves into,
54
+ * reachable as `services.emails`.
55
+ *
56
+ * The producer: the queue's one consumer is the handler it was built with,
57
+ * so the only thing another construct can want from a queue is to send to
58
+ * it. It reads `<NAME>_PUBLISHER_CONNECTION_STRING` and picks the transport
59
+ * from its protocol — `pgboss://` locally, `sqs://` deployed. A field
60
+ * assigned once, not a getter: services are cached by object identity.
61
+ */
62
+ readonly service: Service<Uncapitalize<TName>, EventPublisher<QueueMessage<TName, TMessage>>>;
63
+ /**
64
+ * The producer's env key. Read by both {@link declare} and the service, so
65
+ * what the target publishes and what the producer looks up cannot drift.
51
66
  */
52
67
  private readonly connectionKey;
53
- constructor(name: TName, handler: QueueHandler<TMessage, TServices, TLogger>, messageSchema: TMessage, timeout?: number, services?: TServices, logger?: TLogger,
68
+ constructor(name: TName, handler: QueueHandler<TMessage, TServices, TLogger, TDatabase>, messageSchema: TMessage, timeout?: number, services?: TServices, logger?: TLogger,
54
69
  /** SQS event-source batch size (deployed). */
55
70
  batchSize?: number | undefined,
56
71
  /** Whether the queue is FIFO (deployed). */
@@ -59,7 +74,12 @@ declare class Queue<TName extends string = string, TMessage extends StandardSche
59
74
  * The construct ids the *worker* `.dependsOn()` named — last, so no
60
75
  * existing positional argument moves.
61
76
  */
62
- constructs?: string[]);
77
+ constructs?: string[],
78
+ /**
79
+ * What the handler's `db` is registered from — after `constructs`, for
80
+ * the same reason.
81
+ */
82
+ databaseService?: Service<TDatabaseServiceName, TDatabase>);
63
83
  /**
64
84
  * What this queue is in the manifest.
65
85
  *
@@ -69,36 +89,17 @@ declare class Queue<TName extends string = string, TMessage extends StandardSche
69
89
  * running and what connection string to inject.
70
90
  */
71
91
  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
92
  }
95
- /** The context a queue handler receives — a batch of typed messages. */
96
- type QueueContext<TMessage extends StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger> = {
93
+ /**
94
+ * The context a queue handler receives — a batch of typed messages, and `db`
95
+ * when the queue has a database.
96
+ */
97
+ type QueueContext<TMessage extends StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger, TDatabase = undefined> = {
97
98
  messages: InferStandardSchema<TMessage>[];
98
99
  services: ServiceRecord<TServices>;
99
100
  logger: TLogger;
100
- };
101
- type QueueHandler<TMessage extends StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger> = (ctx: QueueContext<TMessage, TServices, TLogger>) => unknown | Promise<unknown>;
101
+ } & DatabaseContext<TDatabase>;
102
+ type QueueHandler<TMessage extends StandardSchemaV1, TServices extends Service[] = [], TLogger extends Logger = Logger, TDatabase = undefined> = (ctx: QueueContext<TMessage, TServices, TLogger, TDatabase>) => unknown | Promise<unknown>;
102
103
  //#endregion
103
104
  export { QueueMessage as i, QueueContext as n, QueueHandler as r, Queue as t };
104
- //# sourceMappingURL=Queue-DYPB2KWL.d.cts.map
105
+ //# sourceMappingURL=Queue-C4rijiM7.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Queue-C4rijiM7.d.cts","names":[],"sources":["../src/queue/Queue.ts"],"mappings":";;;;;;;;;;;;;;;KA0BY,aACX,sBACA,iBAAiB,oBACd,mBAAmB,OAAO,oBAAoB;;;;;;;;;;;;;;cAerC,MACZ,+BACA,iBAAiB,mBAAmB,kBACpC,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,uBACA,sDACS,UACT,oBAEA,8BAGA,sBACA;WA8CiB,MAAM;WACN,SAAS,aACxB,UACA,WACA,SACA;WAEe,eAAe;WACN;WACA,UAAU;WACV,QAAQ;;WAEjB;;WAEA;EA1DjB;SAEO,QACN,eACE,OAAO,cAAc,kBAAkB,WAAW;;;;;;;;;WAgB5C;;;;;;;;;;;WAYA,SAAS,QACjB,aAAa,QACb,eAAe,aAAa,OAAO;;;;;mBAOnB;EAEjB,YACiB,MAAM,OACN,SAAS,aACxB,UACA,WACA,SACA,YAEe,eAAe,UACN,kBACA,WAAU,WACV,SAAQ,SAEjB;;EAAA,gCAEA;;EAAA,4BAKhB;;;;;EAAA,uBAKA;;;;;EAAA,kBAAkB,QAAQ,sBAAsB;;;;;;;;;EAyCjD,WAAW;;;;;;KA8BA,aACX,iBAAiB,kBACjB,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB;EAEA,UAAU,oBAAoB;EAC9B,UAAU,cAAc;EACxB,QAAQ;IACL,gBAAgB;KAER,aACX,iBAAiB,kBACjB,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,0BAEA,KAAK,aAAa,UAAU,WAAW,SAAS,yBAClC"}
@@ -0,0 +1,109 @@
1
+ const require_Construct = require("./Construct-DorKS0Ua.cjs");
2
+ let _geekmidas_manifest = require("@geekmidas/manifest");
3
+ let _geekmidas_logger_console = require("@geekmidas/logger/console");
4
+ let _geekmidas_events = require("@geekmidas/events");
5
+ //#region src/queue/Queue.ts
6
+ /**
7
+ * A queue worker — a point-to-point SQS-style queue and its single consumer.
8
+ * Unlike a `Subscriber` (topic fan-out, filtered by `subscribedEvents`), a queue
9
+ * drains every message of its one `message` type. Build one from the worker
10
+ * that runs it — `worker.queue('Emails').message(schema).handle(…)` — and
11
+ * `gkm build` discovers it into the manifest's `queues` field.
12
+ *
13
+ * Producers send to it by depending on it: `.dependsOn([emails])` makes
14
+ * `services.emails` the publisher.
15
+ *
16
+ * Its handler gets `db` when it has a database: the worker's, declared once
17
+ * with `worker.database(db)`, or its own with `.database(other)`.
18
+ */
19
+ var Queue = class extends require_Construct.Construct {
20
+ name;
21
+ handler;
22
+ messageSchema;
23
+ timeout;
24
+ services;
25
+ logger;
26
+ batchSize;
27
+ fifo;
28
+ __IS_QUEUE__ = true;
29
+ static isQueue(obj) {
30
+ return Boolean(obj && obj.__IS_QUEUE__ === true && obj.type === "dev.geekmidas.function.queue");
31
+ }
32
+ /**
33
+ * The canonical id this queue is declared under.
34
+ *
35
+ * Derived from the name rather than given separately, so `emails` and
36
+ * `Emails` are one queue. The name stays what it was: it is the wire `type`
37
+ * a producer sends and the worker subscribes to, and changing that would
38
+ * silently orphan in-flight messages.
39
+ */
40
+ id;
41
+ /**
42
+ * The queue as a dependency — what `.dependsOn([emails])` dissolves into,
43
+ * reachable as `services.emails`.
44
+ *
45
+ * The producer: the queue's one consumer is the handler it was built with,
46
+ * so the only thing another construct can want from a queue is to send to
47
+ * it. It reads `<NAME>_PUBLISHER_CONNECTION_STRING` and picks the transport
48
+ * from its protocol — `pgboss://` locally, `sqs://` deployed. A field
49
+ * assigned once, not a getter: services are cached by object identity.
50
+ */
51
+ service;
52
+ /**
53
+ * The producer's env key. Read by both {@link declare} and the service, so
54
+ * what the target publishes and what the producer looks up cannot drift.
55
+ */
56
+ connectionKey;
57
+ constructor(name, handler, messageSchema, timeout = 3e4, services = [], logger = _geekmidas_logger_console.DEFAULT_LOGGER, batchSize, fifo, constructs = [], databaseService) {
58
+ super("dev.geekmidas.function.queue", logger, services, [], void 0, timeout, void 0, void 0, constructs);
59
+ this.name = name;
60
+ this.handler = handler;
61
+ this.messageSchema = messageSchema;
62
+ this.timeout = timeout;
63
+ this.services = services;
64
+ this.logger = logger;
65
+ this.batchSize = batchSize;
66
+ this.fifo = fifo;
67
+ this.databaseService = databaseService;
68
+ this.id = (0, _geekmidas_manifest.canonicalId)(name);
69
+ this.connectionKey = (0, _geekmidas_manifest.provideKey)(this.id, "publisherConnectionString");
70
+ const envVar = this.connectionKey;
71
+ this.service = {
72
+ serviceName: (0, _geekmidas_manifest.serviceKey)(this.id),
73
+ async register({ envParser }) {
74
+ const { connectionString } = envParser.create((get) => ({ connectionString: get(envVar).string() })).parse();
75
+ return _geekmidas_events.Publisher.fromConnectionString(connectionString);
76
+ }
77
+ };
78
+ }
79
+ /**
80
+ * What this queue is in the manifest.
81
+ *
82
+ * A queue is a resource, not a handler: the worker is reached *through* it,
83
+ * so the declaration carries the producer's key and nothing about the code
84
+ * that drains it. The local target reads this to know which broker has to be
85
+ * running and what connection string to inject.
86
+ */
87
+ declare() {
88
+ return [{
89
+ kind: "queue",
90
+ id: this.id,
91
+ provides: [this.connectionKey],
92
+ ...this.fifo ? { fifo: true } : {},
93
+ worker: {
94
+ id: `${this.id}Worker`,
95
+ handler: `${this.id}.handler`,
96
+ dependencies: []
97
+ }
98
+ }];
99
+ }
100
+ };
101
+ //#endregion
102
+ Object.defineProperty(exports, "Queue", {
103
+ enumerable: true,
104
+ get: function() {
105
+ return Queue;
106
+ }
107
+ });
108
+
109
+ //# sourceMappingURL=Queue-D4Iaidrs.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Queue-D4Iaidrs.cjs","names":["Construct","DEFAULT_LOGGER","canonicalId","provideKey","serviceKey","Publisher"],"sources":["../src/queue/Queue.ts"],"sourcesContent":["import {\n\ttype EventPublisher,\n\ttype EventPublisherConnectionString,\n\ttype PublishableMessage,\n\tPublisher,\n} from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport { DEFAULT_LOGGER } from '@geekmidas/logger/console';\nimport {\n\tcanonicalId,\n\ttype Declaration,\n\tprovideKey,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport type { InferStandardSchema } from '@geekmidas/schema';\nimport type { Service, ServiceRecord } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { Construct, ConstructType } from '../Construct';\nimport type { DatabaseContext } from '../functions/Function';\n\n/**\n * The wire message a queue carries: `{ type: <queue name>, payload: <message> }`.\n * The producer publishes this shape and the worker receives the `payload`s as\n * its `messages`. Typing `type` to the queue name keeps the publisher fully\n * typed and lets pg-boss (local) / SQS (deployed) route by name.\n */\nexport type QueueMessage<\n\tTName extends string,\n\tTMessage extends StandardSchemaV1,\n> = PublishableMessage<TName, InferStandardSchema<TMessage>>;\n\n/**\n * A queue worker — a point-to-point SQS-style queue and its single consumer.\n * Unlike a `Subscriber` (topic fan-out, filtered by `subscribedEvents`), a queue\n * drains every message of its one `message` type. Build one from the worker\n * that runs it — `worker.queue('Emails').message(schema).handle(…)` — and\n * `gkm build` discovers it into the manifest's `queues` field.\n *\n * Producers send to it by depending on it: `.dependsOn([emails])` makes\n * `services.emails` the publisher.\n *\n * Its handler gets `db` when it has a database: the worker's, declared once\n * with `worker.database(db)`, or its own with `.database(other)`.\n */\nexport class Queue<\n\tTName extends string = string,\n\tTMessage extends StandardSchemaV1 = StandardSchemaV1,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTDatabase = undefined,\n\tTDatabaseServiceName extends string = string,\n> extends Construct<\n\tTLogger,\n\tundefined,\n\tTServices,\n\tstring,\n\tundefined,\n\tTDatabaseServiceName,\n\tTDatabase\n> {\n\t__IS_QUEUE__ = true;\n\n\tstatic isQueue(\n\t\tobj: unknown,\n\t): obj is Queue<string, StandardSchemaV1, Service[], Logger, any> {\n\t\treturn Boolean(\n\t\t\tobj &&\n\t\t\t\t(obj as { __IS_QUEUE__?: boolean }).__IS_QUEUE__ === true &&\n\t\t\t\t(obj as Construct).type === ConstructType.Queue,\n\t\t);\n\t}\n\n\t/**\n\t * The canonical id this queue is declared under.\n\t *\n\t * Derived from the name rather than given separately, so `emails` and\n\t * `Emails` are one queue. The name stays what it was: it is the wire `type`\n\t * a producer sends and the worker subscribes to, and changing that would\n\t * silently orphan in-flight messages.\n\t */\n\treadonly id: string;\n\n\t/**\n\t * The queue as a dependency — what `.dependsOn([emails])` dissolves into,\n\t * reachable as `services.emails`.\n\t *\n\t * The producer: the queue's one consumer is the handler it was built with,\n\t * so the only thing another construct can want from a queue is to send to\n\t * it. It reads `<NAME>_PUBLISHER_CONNECTION_STRING` and picks the transport\n\t * from its protocol — `pgboss://` locally, `sqs://` deployed. A field\n\t * assigned once, not a getter: services are cached by object identity.\n\t */\n\treadonly service: Service<\n\t\tUncapitalize<TName>,\n\t\tEventPublisher<QueueMessage<TName, TMessage>>\n\t>;\n\n\t/**\n\t * The producer's env key. Read by both {@link declare} and the service, so\n\t * what the target publishes and what the producer looks up cannot drift.\n\t */\n\tprivate readonly connectionKey: string;\n\n\tconstructor(\n\t\tpublic readonly name: TName,\n\t\tpublic readonly handler: QueueHandler<\n\t\t\tTMessage,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTDatabase\n\t\t>,\n\t\tpublic readonly messageSchema: TMessage,\n\t\tpublic override readonly timeout: number = 30000,\n\t\tpublic override readonly services: TServices = [] as unknown as TServices,\n\t\tpublic override readonly logger: TLogger = DEFAULT_LOGGER as TLogger,\n\t\t/** SQS event-source batch size (deployed). */\n\t\tpublic readonly batchSize?: number,\n\t\t/** Whether the queue is FIFO (deployed). */\n\t\tpublic readonly fifo?: boolean,\n\t\t/**\n\t\t * The construct ids the *worker* `.dependsOn()` named — last, so no\n\t\t * existing positional argument moves.\n\t\t */\n\t\tconstructs: string[] = [],\n\t\t/**\n\t\t * What the handler's `db` is registered from — after `constructs`, for\n\t\t * the same reason.\n\t\t */\n\t\tdatabaseService?: Service<TDatabaseServiceName, TDatabase>,\n\t) {\n\t\tsuper(\n\t\t\tConstructType.Queue,\n\t\t\tlogger,\n\t\t\tservices,\n\t\t\t[],\n\t\t\tundefined,\n\t\t\ttimeout,\n\t\t\tundefined, // memorySize\n\t\t\tundefined, // auditorStorageService\n\t\t\tconstructs,\n\t\t);\n\n\t\tthis.databaseService = databaseService;\n\t\tthis.id = canonicalId(name);\n\t\tthis.connectionKey = provideKey(this.id, 'publisherConnectionString');\n\n\t\tconst envVar = this.connectionKey;\n\t\tthis.service = {\n\t\t\tserviceName: serviceKey(this.id) as Uncapitalize<TName>,\n\t\t\tasync register({ envParser }) {\n\t\t\t\tconst { connectionString } = envParser\n\t\t\t\t\t.create((get) => ({ connectionString: get(envVar).string() }))\n\t\t\t\t\t.parse();\n\n\t\t\t\treturn Publisher.fromConnectionString<QueueMessage<TName, TMessage>>(\n\t\t\t\t\tconnectionString as EventPublisherConnectionString,\n\t\t\t\t);\n\t\t\t},\n\t\t};\n\t}\n\n\t/**\n\t * What this queue is in the manifest.\n\t *\n\t * A queue is a resource, not a handler: the worker is reached *through* it,\n\t * so the declaration carries the producer's key and nothing about the code\n\t * that drains it. The local target reads this to know which broker has to be\n\t * running and what connection string to inject.\n\t */\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'queue',\n\t\t\t\tid: this.id,\n\t\t\t\tprovides: [this.connectionKey],\n\t\t\t\t...(this.fifo ? { fifo: true } : {}),\n\t\t\t\t// Nested rather than a sibling node, because position carries the\n\t\t\t\t// trigger: this handler is reached by messages on this queue and\n\t\t\t\t// by nothing else, so there is no `trigger` field to keep in step.\n\t\t\t\t//\n\t\t\t\t// `handler` is the export name; which directory the build wrote it\n\t\t\t\t// to is the target's business, and a path with a cloud in it does\n\t\t\t\t// not belong in a neutral declaration.\n\t\t\t\tworker: {\n\t\t\t\t\tid: `${this.id}Worker`,\n\t\t\t\t\thandler: `${this.id}.handler`,\n\t\t\t\t\t// Filled by the build from what the worker declared. Empty is a\n\t\t\t\t\t// stated gap, not a claim that it reaches nothing.\n\t\t\t\t\tdependencies: [],\n\t\t\t\t},\n\t\t\t},\n\t\t];\n\t}\n}\n\n/**\n * The context a queue handler receives — a batch of typed messages, and `db`\n * when the queue has a database.\n */\nexport type QueueContext<\n\tTMessage extends StandardSchemaV1,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTDatabase = undefined,\n> = {\n\tmessages: InferStandardSchema<TMessage>[];\n\tservices: ServiceRecord<TServices>;\n\tlogger: TLogger;\n} & DatabaseContext<TDatabase>;\n\nexport type QueueHandler<\n\tTMessage extends StandardSchemaV1,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTDatabase = undefined,\n> = (\n\tctx: QueueContext<TMessage, TServices, TLogger, TDatabase>,\n) => unknown | Promise<unknown>;\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4CA,IAAa,QAAb,cAOUA,kBAAAA,UAQR;CA6CgB;CACA;CAMA;CACS;CACA;CACA;CAET;CAEA;CA1DjB,eAAe;CAEf,OAAO,QACN,KACiE;EACjE,OAAO,QACN,OACE,IAAmC,iBAAiB,QACpD,IAAkB,SAAA,8BACrB;CACD;;;;;;;;;CAUA;;;;;;;;;;;CAYA;;;;;CASA;CAEA,YACC,MACA,SAMA,eACA,UAA2C,KAC3C,WAA+C,CAAC,GAChD,SAA2CC,0BAAAA,gBAE3C,WAEA,MAKA,aAAuB,CAAC,GAKxB,iBACC;EACD,MAAA,gCAEC,QACA,UACA,CAAC,GACD,KAAA,GACA,SACA,KAAA,GACA,KAAA,GACA,UACD;EApCgB,KAAA,OAAA;EACA,KAAA,UAAA;EAMA,KAAA,gBAAA;EACS,KAAA,UAAA;EACA,KAAA,WAAA;EACA,KAAA,SAAA;EAET,KAAA,YAAA;EAEA,KAAA,OAAA;EAwBhB,KAAK,kBAAkB;EACvB,KAAK,MAAA,GAAKC,oBAAAA,YAAAA,CAAY,IAAI;EAC1B,KAAK,iBAAA,GAAgBC,oBAAAA,WAAAA,CAAW,KAAK,IAAI,2BAA2B;EAEpE,MAAM,SAAS,KAAK;EACpB,KAAK,UAAU;GACd,cAAA,GAAaC,oBAAAA,WAAAA,CAAW,KAAK,EAAE;GAC/B,MAAM,SAAS,EAAE,aAAa;IAC7B,MAAM,EAAE,qBAAqB,UAC3B,QAAQ,SAAS,EAAE,kBAAkB,IAAI,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAC7D,MAAM;IAER,OAAOC,kBAAAA,UAAU,qBAChB,gBACD;GACD;EACD;CACD;;;;;;;;;CAUA,UAAyB;EACxB,OAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,UAAU,CAAC,KAAK,aAAa;GAC7B,GAAI,KAAK,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;GAQlC,QAAQ;IACP,IAAI,GAAG,KAAK,GAAG;IACf,SAAS,GAAG,KAAK,GAAG;IAGpB,cAAc,CAAC;GAChB;EACD,CACD;CACD;AACD"}
@@ -0,0 +1,104 @@
1
+ import { t as Construct } from "./Construct-CGuc_Ijk.mjs";
2
+ import { canonicalId, provideKey, serviceKey } from "@geekmidas/manifest";
3
+ import { DEFAULT_LOGGER } from "@geekmidas/logger/console";
4
+ import { Publisher } from "@geekmidas/events";
5
+ //#region src/queue/Queue.ts
6
+ /**
7
+ * A queue worker — a point-to-point SQS-style queue and its single consumer.
8
+ * Unlike a `Subscriber` (topic fan-out, filtered by `subscribedEvents`), a queue
9
+ * drains every message of its one `message` type. Build one from the worker
10
+ * that runs it — `worker.queue('Emails').message(schema).handle(…)` — and
11
+ * `gkm build` discovers it into the manifest's `queues` field.
12
+ *
13
+ * Producers send to it by depending on it: `.dependsOn([emails])` makes
14
+ * `services.emails` the publisher.
15
+ *
16
+ * Its handler gets `db` when it has a database: the worker's, declared once
17
+ * with `worker.database(db)`, or its own with `.database(other)`.
18
+ */
19
+ var Queue = class extends Construct {
20
+ name;
21
+ handler;
22
+ messageSchema;
23
+ timeout;
24
+ services;
25
+ logger;
26
+ batchSize;
27
+ fifo;
28
+ __IS_QUEUE__ = true;
29
+ static isQueue(obj) {
30
+ return Boolean(obj && obj.__IS_QUEUE__ === true && obj.type === "dev.geekmidas.function.queue");
31
+ }
32
+ /**
33
+ * The canonical id this queue is declared under.
34
+ *
35
+ * Derived from the name rather than given separately, so `emails` and
36
+ * `Emails` are one queue. The name stays what it was: it is the wire `type`
37
+ * a producer sends and the worker subscribes to, and changing that would
38
+ * silently orphan in-flight messages.
39
+ */
40
+ id;
41
+ /**
42
+ * The queue as a dependency — what `.dependsOn([emails])` dissolves into,
43
+ * reachable as `services.emails`.
44
+ *
45
+ * The producer: the queue's one consumer is the handler it was built with,
46
+ * so the only thing another construct can want from a queue is to send to
47
+ * it. It reads `<NAME>_PUBLISHER_CONNECTION_STRING` and picks the transport
48
+ * from its protocol — `pgboss://` locally, `sqs://` deployed. A field
49
+ * assigned once, not a getter: services are cached by object identity.
50
+ */
51
+ service;
52
+ /**
53
+ * The producer's env key. Read by both {@link declare} and the service, so
54
+ * what the target publishes and what the producer looks up cannot drift.
55
+ */
56
+ connectionKey;
57
+ constructor(name, handler, messageSchema, timeout = 3e4, services = [], logger = DEFAULT_LOGGER, batchSize, fifo, constructs = [], databaseService) {
58
+ super("dev.geekmidas.function.queue", logger, services, [], void 0, timeout, void 0, void 0, constructs);
59
+ this.name = name;
60
+ this.handler = handler;
61
+ this.messageSchema = messageSchema;
62
+ this.timeout = timeout;
63
+ this.services = services;
64
+ this.logger = logger;
65
+ this.batchSize = batchSize;
66
+ this.fifo = fifo;
67
+ this.databaseService = databaseService;
68
+ this.id = canonicalId(name);
69
+ this.connectionKey = provideKey(this.id, "publisherConnectionString");
70
+ const envVar = this.connectionKey;
71
+ this.service = {
72
+ serviceName: serviceKey(this.id),
73
+ async register({ envParser }) {
74
+ const { connectionString } = envParser.create((get) => ({ connectionString: get(envVar).string() })).parse();
75
+ return Publisher.fromConnectionString(connectionString);
76
+ }
77
+ };
78
+ }
79
+ /**
80
+ * What this queue is in the manifest.
81
+ *
82
+ * A queue is a resource, not a handler: the worker is reached *through* it,
83
+ * so the declaration carries the producer's key and nothing about the code
84
+ * that drains it. The local target reads this to know which broker has to be
85
+ * running and what connection string to inject.
86
+ */
87
+ declare() {
88
+ return [{
89
+ kind: "queue",
90
+ id: this.id,
91
+ provides: [this.connectionKey],
92
+ ...this.fifo ? { fifo: true } : {},
93
+ worker: {
94
+ id: `${this.id}Worker`,
95
+ handler: `${this.id}.handler`,
96
+ dependencies: []
97
+ }
98
+ }];
99
+ }
100
+ };
101
+ //#endregion
102
+ export { Queue as t };
103
+
104
+ //# sourceMappingURL=Queue-u8w8_HpE.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Queue-u8w8_HpE.mjs","names":[],"sources":["../src/queue/Queue.ts"],"sourcesContent":["import {\n\ttype EventPublisher,\n\ttype EventPublisherConnectionString,\n\ttype PublishableMessage,\n\tPublisher,\n} from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport { DEFAULT_LOGGER } from '@geekmidas/logger/console';\nimport {\n\tcanonicalId,\n\ttype Declaration,\n\tprovideKey,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport type { InferStandardSchema } from '@geekmidas/schema';\nimport type { Service, ServiceRecord } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { Construct, ConstructType } from '../Construct';\nimport type { DatabaseContext } from '../functions/Function';\n\n/**\n * The wire message a queue carries: `{ type: <queue name>, payload: <message> }`.\n * The producer publishes this shape and the worker receives the `payload`s as\n * its `messages`. Typing `type` to the queue name keeps the publisher fully\n * typed and lets pg-boss (local) / SQS (deployed) route by name.\n */\nexport type QueueMessage<\n\tTName extends string,\n\tTMessage extends StandardSchemaV1,\n> = PublishableMessage<TName, InferStandardSchema<TMessage>>;\n\n/**\n * A queue worker — a point-to-point SQS-style queue and its single consumer.\n * Unlike a `Subscriber` (topic fan-out, filtered by `subscribedEvents`), a queue\n * drains every message of its one `message` type. Build one from the worker\n * that runs it — `worker.queue('Emails').message(schema).handle(…)` — and\n * `gkm build` discovers it into the manifest's `queues` field.\n *\n * Producers send to it by depending on it: `.dependsOn([emails])` makes\n * `services.emails` the publisher.\n *\n * Its handler gets `db` when it has a database: the worker's, declared once\n * with `worker.database(db)`, or its own with `.database(other)`.\n */\nexport class Queue<\n\tTName extends string = string,\n\tTMessage extends StandardSchemaV1 = StandardSchemaV1,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTDatabase = undefined,\n\tTDatabaseServiceName extends string = string,\n> extends Construct<\n\tTLogger,\n\tundefined,\n\tTServices,\n\tstring,\n\tundefined,\n\tTDatabaseServiceName,\n\tTDatabase\n> {\n\t__IS_QUEUE__ = true;\n\n\tstatic isQueue(\n\t\tobj: unknown,\n\t): obj is Queue<string, StandardSchemaV1, Service[], Logger, any> {\n\t\treturn Boolean(\n\t\t\tobj &&\n\t\t\t\t(obj as { __IS_QUEUE__?: boolean }).__IS_QUEUE__ === true &&\n\t\t\t\t(obj as Construct).type === ConstructType.Queue,\n\t\t);\n\t}\n\n\t/**\n\t * The canonical id this queue is declared under.\n\t *\n\t * Derived from the name rather than given separately, so `emails` and\n\t * `Emails` are one queue. The name stays what it was: it is the wire `type`\n\t * a producer sends and the worker subscribes to, and changing that would\n\t * silently orphan in-flight messages.\n\t */\n\treadonly id: string;\n\n\t/**\n\t * The queue as a dependency — what `.dependsOn([emails])` dissolves into,\n\t * reachable as `services.emails`.\n\t *\n\t * The producer: the queue's one consumer is the handler it was built with,\n\t * so the only thing another construct can want from a queue is to send to\n\t * it. It reads `<NAME>_PUBLISHER_CONNECTION_STRING` and picks the transport\n\t * from its protocol — `pgboss://` locally, `sqs://` deployed. A field\n\t * assigned once, not a getter: services are cached by object identity.\n\t */\n\treadonly service: Service<\n\t\tUncapitalize<TName>,\n\t\tEventPublisher<QueueMessage<TName, TMessage>>\n\t>;\n\n\t/**\n\t * The producer's env key. Read by both {@link declare} and the service, so\n\t * what the target publishes and what the producer looks up cannot drift.\n\t */\n\tprivate readonly connectionKey: string;\n\n\tconstructor(\n\t\tpublic readonly name: TName,\n\t\tpublic readonly handler: QueueHandler<\n\t\t\tTMessage,\n\t\t\tTServices,\n\t\t\tTLogger,\n\t\t\tTDatabase\n\t\t>,\n\t\tpublic readonly messageSchema: TMessage,\n\t\tpublic override readonly timeout: number = 30000,\n\t\tpublic override readonly services: TServices = [] as unknown as TServices,\n\t\tpublic override readonly logger: TLogger = DEFAULT_LOGGER as TLogger,\n\t\t/** SQS event-source batch size (deployed). */\n\t\tpublic readonly batchSize?: number,\n\t\t/** Whether the queue is FIFO (deployed). */\n\t\tpublic readonly fifo?: boolean,\n\t\t/**\n\t\t * The construct ids the *worker* `.dependsOn()` named — last, so no\n\t\t * existing positional argument moves.\n\t\t */\n\t\tconstructs: string[] = [],\n\t\t/**\n\t\t * What the handler's `db` is registered from — after `constructs`, for\n\t\t * the same reason.\n\t\t */\n\t\tdatabaseService?: Service<TDatabaseServiceName, TDatabase>,\n\t) {\n\t\tsuper(\n\t\t\tConstructType.Queue,\n\t\t\tlogger,\n\t\t\tservices,\n\t\t\t[],\n\t\t\tundefined,\n\t\t\ttimeout,\n\t\t\tundefined, // memorySize\n\t\t\tundefined, // auditorStorageService\n\t\t\tconstructs,\n\t\t);\n\n\t\tthis.databaseService = databaseService;\n\t\tthis.id = canonicalId(name);\n\t\tthis.connectionKey = provideKey(this.id, 'publisherConnectionString');\n\n\t\tconst envVar = this.connectionKey;\n\t\tthis.service = {\n\t\t\tserviceName: serviceKey(this.id) as Uncapitalize<TName>,\n\t\t\tasync register({ envParser }) {\n\t\t\t\tconst { connectionString } = envParser\n\t\t\t\t\t.create((get) => ({ connectionString: get(envVar).string() }))\n\t\t\t\t\t.parse();\n\n\t\t\t\treturn Publisher.fromConnectionString<QueueMessage<TName, TMessage>>(\n\t\t\t\t\tconnectionString as EventPublisherConnectionString,\n\t\t\t\t);\n\t\t\t},\n\t\t};\n\t}\n\n\t/**\n\t * What this queue is in the manifest.\n\t *\n\t * A queue is a resource, not a handler: the worker is reached *through* it,\n\t * so the declaration carries the producer's key and nothing about the code\n\t * that drains it. The local target reads this to know which broker has to be\n\t * running and what connection string to inject.\n\t */\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'queue',\n\t\t\t\tid: this.id,\n\t\t\t\tprovides: [this.connectionKey],\n\t\t\t\t...(this.fifo ? { fifo: true } : {}),\n\t\t\t\t// Nested rather than a sibling node, because position carries the\n\t\t\t\t// trigger: this handler is reached by messages on this queue and\n\t\t\t\t// by nothing else, so there is no `trigger` field to keep in step.\n\t\t\t\t//\n\t\t\t\t// `handler` is the export name; which directory the build wrote it\n\t\t\t\t// to is the target's business, and a path with a cloud in it does\n\t\t\t\t// not belong in a neutral declaration.\n\t\t\t\tworker: {\n\t\t\t\t\tid: `${this.id}Worker`,\n\t\t\t\t\thandler: `${this.id}.handler`,\n\t\t\t\t\t// Filled by the build from what the worker declared. Empty is a\n\t\t\t\t\t// stated gap, not a claim that it reaches nothing.\n\t\t\t\t\tdependencies: [],\n\t\t\t\t},\n\t\t\t},\n\t\t];\n\t}\n}\n\n/**\n * The context a queue handler receives — a batch of typed messages, and `db`\n * when the queue has a database.\n */\nexport type QueueContext<\n\tTMessage extends StandardSchemaV1,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTDatabase = undefined,\n> = {\n\tmessages: InferStandardSchema<TMessage>[];\n\tservices: ServiceRecord<TServices>;\n\tlogger: TLogger;\n} & DatabaseContext<TDatabase>;\n\nexport type QueueHandler<\n\tTMessage extends StandardSchemaV1,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n\tTDatabase = undefined,\n> = (\n\tctx: QueueContext<TMessage, TServices, TLogger, TDatabase>,\n) => unknown | Promise<unknown>;\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4CA,IAAa,QAAb,cAOU,UAQR;CA6CgB;CACA;CAMA;CACS;CACA;CACA;CAET;CAEA;CA1DjB,eAAe;CAEf,OAAO,QACN,KACiE;EACjE,OAAO,QACN,OACE,IAAmC,iBAAiB,QACpD,IAAkB,SAAA,8BACrB;CACD;;;;;;;;;CAUA;;;;;;;;;;;CAYA;;;;;CASA;CAEA,YACC,MACA,SAMA,eACA,UAA2C,KAC3C,WAA+C,CAAC,GAChD,SAA2C,gBAE3C,WAEA,MAKA,aAAuB,CAAC,GAKxB,iBACC;EACD,MAAA,gCAEC,QACA,UACA,CAAC,GACD,KAAA,GACA,SACA,KAAA,GACA,KAAA,GACA,UACD;EApCgB,KAAA,OAAA;EACA,KAAA,UAAA;EAMA,KAAA,gBAAA;EACS,KAAA,UAAA;EACA,KAAA,WAAA;EACA,KAAA,SAAA;EAET,KAAA,YAAA;EAEA,KAAA,OAAA;EAwBhB,KAAK,kBAAkB;EACvB,KAAK,KAAK,YAAY,IAAI;EAC1B,KAAK,gBAAgB,WAAW,KAAK,IAAI,2BAA2B;EAEpE,MAAM,SAAS,KAAK;EACpB,KAAK,UAAU;GACd,aAAa,WAAW,KAAK,EAAE;GAC/B,MAAM,SAAS,EAAE,aAAa;IAC7B,MAAM,EAAE,qBAAqB,UAC3B,QAAQ,SAAS,EAAE,kBAAkB,IAAI,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAC7D,MAAM;IAER,OAAO,UAAU,qBAChB,gBACD;GACD;EACD;CACD;;;;;;;;;CAUA,UAAyB;EACxB,OAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,UAAU,CAAC,KAAK,aAAa;GAC7B,GAAI,KAAK,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;GAQlC,QAAQ;IACP,IAAI,GAAG,KAAK,GAAG;IACf,SAAS,GAAG,KAAK,GAAG;IAGpB,cAAc,CAAC;GAChB;EACD,CACD;CACD;AACD"}
@@ -0,0 +1,118 @@
1
+ import { databaseEdges, idsOf, serviceOf, servicesOf } from "./construct-interface.mjs";
2
+ import { t as cloneWith } from "./clone-EKNovYHu.mjs";
3
+ import { t as Queue } from "./Queue-u8w8_HpE.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 }`. The handler's `db` is the worker's database
12
+ * unless `.database(other)` names another.
13
+ */
14
+ var QueueBuilder = class {
15
+ _name;
16
+ _messageSchema;
17
+ _timeout = 3e4;
18
+ _batchSize;
19
+ _fifo;
20
+ _services = [];
21
+ /** The construct ids `.dependsOn()` named — what the manifest records. */
22
+ _constructs = [];
23
+ _logger = DEFAULT_LOGGER;
24
+ /** The worker that runs this queue's consumer — stamped by `worker.queue()`. */
25
+ _owner;
26
+ /** What the handler's `db` comes from — the worker's, unless overridden. */
27
+ _databaseService;
28
+ /** The edge `.database()` added, so the next one can replace it. */
29
+ _databaseEdge;
30
+ /** The queue name — drives the infra queue and its `<NAME>_*` env vars. */
31
+ queue(name) {
32
+ return cloneWith(this, { _name: name });
33
+ }
34
+ timeout(timeout) {
35
+ return cloneWith(this, { _timeout: timeout });
36
+ }
37
+ /** SQS event-source batch size (deployed). */
38
+ batchSize(batchSize) {
39
+ return cloneWith(this, { _batchSize: batchSize });
40
+ }
41
+ /** Mark the queue as FIFO (deployed). */
42
+ fifo(fifo = true) {
43
+ return cloneWith(this, { _fifo: fifo });
44
+ }
45
+ /**
46
+ * Depend on constructs — a database, a bucket, a mail sender, a queue, a
47
+ * topic.
48
+ *
49
+ * It records the edge and dissolves each construct's client into the
50
+ * handler's service record under the construct's own id, so
51
+ * `.dependsOn([uploads])` is what makes `services.uploads` exist and type.
52
+ *
53
+ * Constructs only. A `Service` does not match the shape, which is what keeps
54
+ * env sniffing confined to `.services()` and the explicit lift.
55
+ */
56
+ dependsOn(constructs) {
57
+ const services = servicesOf(constructs);
58
+ return cloneWith(this, {
59
+ _services: [...this._services, ...services],
60
+ _constructs: idsOf(constructs, this._constructs)
61
+ });
62
+ }
63
+ services(services) {
64
+ return cloneWith(this, { _services: [...this._services, ...services] });
65
+ }
66
+ logger(logger) {
67
+ return cloneWith(this, { _logger: logger });
68
+ }
69
+ /**
70
+ * The database the handler receives as `db`.
71
+ *
72
+ * A queue built from a worker already has the worker's, when the worker
73
+ * named one with `.database(db)`; this replaces it — the edge as well as
74
+ * the client — for a consumer that works against a different database.
75
+ */
76
+ database(source) {
77
+ return cloneWith(this, {
78
+ _databaseService: serviceOf(source),
79
+ ...databaseEdges({
80
+ constructs: this._constructs,
81
+ edge: this._databaseEdge,
82
+ service: this._databaseService,
83
+ services: this._services
84
+ }, source)
85
+ });
86
+ }
87
+ /** The typed message (job) payload the queue carries. */
88
+ message(schema) {
89
+ return cloneWith(this, { _messageSchema: schema });
90
+ }
91
+ handle(fn) {
92
+ if (!this._name) throw new QueueNeedsName();
93
+ if (!this._messageSchema) throw new QueueNeedsMessage(this._name);
94
+ const queue = new Queue(this._name, fn, this._messageSchema, this._timeout, this._services, this._logger, this._batchSize, this._fifo, this._constructs, this._databaseService);
95
+ queue.owner = this._owner;
96
+ return queue;
97
+ }
98
+ };
99
+ /** A queue built without a name — only reachable by building one by hand. */
100
+ var QueueNeedsName = class extends Error {
101
+ constructor() {
102
+ super("A queue needs a name: build it from a worker, worker.queue('Emails').");
103
+ this.name = "QueueNeedsName";
104
+ }
105
+ };
106
+ /** A queue whose message was never described. */
107
+ var QueueNeedsMessage = class extends Error {
108
+ queue;
109
+ constructor(queue) {
110
+ super(`Queue '${queue}' has no message: call .message(schema) before .handle(), so its producers and its consumer agree on what it carries.`);
111
+ this.queue = queue;
112
+ this.name = "QueueNeedsMessage";
113
+ }
114
+ };
115
+ //#endregion
116
+ export { QueueNeedsMessage as n, QueueNeedsName as r, QueueBuilder as t };
117
+
118
+ //# sourceMappingURL=QueueBuilder-2wP5lEC8.mjs.map