@geekmidas/constructs 10.0.0-alpha.4 → 10.0.0-alpha.40

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 (370) hide show
  1. package/README.md +223 -158
  2. package/dist/{Construct-BD5neF7w.mjs → Construct-BO1X-kt9.mjs} +32 -33
  3. package/dist/Construct-BO1X-kt9.mjs.map +1 -0
  4. package/dist/Construct-BQALFCh2.d.cts +230 -0
  5. package/dist/Construct-BQALFCh2.d.cts.map +1 -0
  6. package/dist/{Construct-CyS3RpTL.cjs → Construct-DmvXceVY.cjs} +52 -47
  7. package/dist/Construct-DmvXceVY.cjs.map +1 -0
  8. package/dist/Construct-QXnl3VqT.d.mts +230 -0
  9. package/dist/Construct-QXnl3VqT.d.mts.map +1 -0
  10. package/dist/{Cron-B2OFsfDM.d.cts → Cron-CMEGfRs8.d.cts} +21 -8
  11. package/dist/Cron-CMEGfRs8.d.cts.map +1 -0
  12. package/dist/{Cron-ByxdOfpE.d.mts → Cron-D6X4-xjB.d.mts} +21 -8
  13. package/dist/Cron-D6X4-xjB.d.mts.map +1 -0
  14. package/dist/CronBuilder-CEK7aOqD.d.cts +46 -0
  15. package/dist/CronBuilder-CEK7aOqD.d.cts.map +1 -0
  16. package/dist/CronBuilder-DB35T5dL.cjs +116 -0
  17. package/dist/CronBuilder-DB35T5dL.cjs.map +1 -0
  18. package/dist/CronBuilder-Dv0IlZs0.mjs +104 -0
  19. package/dist/CronBuilder-Dv0IlZs0.mjs.map +1 -0
  20. package/dist/CronBuilder-O_gvButp.d.mts +46 -0
  21. package/dist/CronBuilder-O_gvButp.d.mts.map +1 -0
  22. package/dist/{Endpoint-Dij_wOcc.mjs → Endpoint-CQAeh1Rh.mjs} +117 -109
  23. package/dist/Endpoint-CQAeh1Rh.mjs.map +1 -0
  24. package/dist/{Endpoint-DODn1RhN.cjs → Endpoint-D1L9qu5C.cjs} +145 -131
  25. package/dist/Endpoint-D1L9qu5C.cjs.map +1 -0
  26. package/dist/{Endpoint-2Wg7T7Cq.d.mts → Endpoint-Dp5AKIXl.d.cts} +69 -93
  27. package/dist/Endpoint-Dp5AKIXl.d.cts.map +1 -0
  28. package/dist/{Endpoint-DrD8a1yH.d.cts → Endpoint-DtI7heFm.d.mts} +70 -94
  29. package/dist/Endpoint-DtI7heFm.d.mts.map +1 -0
  30. package/dist/{EndpointFactory-b4ituq-s.mjs → EndpointFactory-BBdNeaGJ.mjs} +39 -74
  31. package/dist/EndpointFactory-BBdNeaGJ.mjs.map +1 -0
  32. package/dist/{EndpointFactory-BHFMmFkV.cjs → EndpointFactory-BZOCOaK6.cjs} +75 -110
  33. package/dist/EndpointFactory-BZOCOaK6.cjs.map +1 -0
  34. package/dist/{index-BxHDdy6a.d.mts → EndpointFactory-CgMDvERK.d.mts} +63 -133
  35. package/dist/EndpointFactory-CgMDvERK.d.mts.map +1 -0
  36. package/dist/{index-B8g8POkr.d.cts → EndpointFactory-FeFRmlDZ.d.cts} +62 -132
  37. package/dist/EndpointFactory-FeFRmlDZ.d.cts.map +1 -0
  38. package/dist/{HonoEndpointAdaptor-BM2jbWht.mjs → HonoEndpointAdaptor-Aui-x9Lg.mjs} +41 -47
  39. package/dist/HonoEndpointAdaptor-Aui-x9Lg.mjs.map +1 -0
  40. package/dist/{HonoEndpointAdaptor-De6IlBZe.cjs → HonoEndpointAdaptor-Cq99r9H7.cjs} +50 -53
  41. package/dist/HonoEndpointAdaptor-Cq99r9H7.cjs.map +1 -0
  42. package/dist/Queue-C1uDgjxt.mjs +100 -0
  43. package/dist/Queue-C1uDgjxt.mjs.map +1 -0
  44. package/dist/Queue-Ckmudcm8.cjs +105 -0
  45. package/dist/Queue-Ckmudcm8.cjs.map +1 -0
  46. package/dist/{Queue-D7ZuwBhy.d.cts → Queue-CpQIGB_2.d.cts} +28 -40
  47. package/dist/Queue-CpQIGB_2.d.cts.map +1 -0
  48. package/dist/{Queue-gVGfi2Yk.d.mts → Queue-YmvN2vEP.d.mts} +28 -40
  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-2mEi0ImH.d.cts → Subscriber-B91YSkZt.d.cts} +14 -16
  59. package/dist/Subscriber-B91YSkZt.d.cts.map +1 -0
  60. package/dist/{Subscriber-xTJ9ayPN.d.mts → Subscriber-BjHYe5hK.d.mts} +14 -16
  61. package/dist/Subscriber-BjHYe5hK.d.mts.map +1 -0
  62. package/dist/SubscriberBuilder-BSpQX1JT.d.cts +55 -0
  63. package/dist/SubscriberBuilder-BSpQX1JT.d.cts.map +1 -0
  64. package/dist/SubscriberBuilder-BhMphk4z.d.mts +55 -0
  65. package/dist/SubscriberBuilder-BhMphk4z.d.mts.map +1 -0
  66. package/dist/{SubscriberBuilder-4OPehf2R.cjs → SubscriberBuilder-Duk028pD.cjs} +34 -37
  67. package/dist/SubscriberBuilder-Duk028pD.cjs.map +1 -0
  68. package/dist/{SubscriberBuilder-BjkbeT9l.mjs → SubscriberBuilder-DzQUWE08.mjs} +23 -25
  69. package/dist/SubscriberBuilder-DzQUWE08.mjs.map +1 -0
  70. package/dist/Topic-CkxOTrMv.cjs +104 -0
  71. package/dist/Topic-CkxOTrMv.cjs.map +1 -0
  72. package/dist/Topic-hPffOsot.mjs +99 -0
  73. package/dist/Topic-hPffOsot.mjs.map +1 -0
  74. package/dist/adaptors/aws.cjs +171 -108
  75. package/dist/adaptors/aws.cjs.map +1 -1
  76. package/dist/adaptors/aws.d.cts +75 -43
  77. package/dist/adaptors/aws.d.cts.map +1 -1
  78. package/dist/adaptors/aws.d.mts +76 -44
  79. package/dist/adaptors/aws.d.mts.map +1 -1
  80. package/dist/adaptors/aws.mjs +143 -83
  81. package/dist/adaptors/aws.mjs.map +1 -1
  82. package/dist/adaptors/hono.cjs +3 -10
  83. package/dist/adaptors/hono.d.cts +7 -16
  84. package/dist/adaptors/hono.d.cts.map +1 -1
  85. package/dist/adaptors/hono.d.mts +8 -17
  86. package/dist/adaptors/hono.d.mts.map +1 -1
  87. package/dist/adaptors/hono.mjs +2 -10
  88. package/dist/adaptors/testing.cjs +515 -87
  89. package/dist/adaptors/testing.cjs.map +1 -1
  90. package/dist/adaptors/testing.d.cts +250 -48
  91. package/dist/adaptors/testing.d.cts.map +1 -1
  92. package/dist/adaptors/testing.d.mts +250 -48
  93. package/dist/adaptors/testing.d.mts.map +1 -1
  94. package/dist/adaptors/testing.mjs +484 -68
  95. package/dist/adaptors/testing.mjs.map +1 -1
  96. package/dist/auth-CMwml9QN.d.mts +188 -0
  97. package/dist/auth-CMwml9QN.d.mts.map +1 -0
  98. package/dist/auth-rVRDjIw_.d.cts +188 -0
  99. package/dist/auth-rVRDjIw_.d.cts.map +1 -0
  100. package/dist/auth.cjs +171 -31
  101. package/dist/auth.cjs.map +1 -1
  102. package/dist/auth.d.cts +2 -108
  103. package/dist/auth.d.mts +2 -108
  104. package/dist/auth.mjs +160 -24
  105. package/dist/auth.mjs.map +1 -1
  106. package/dist/{cache-BrRz3fEB.d.mts → cache-C9a_hVCc.d.cts} +4 -7
  107. package/dist/cache-C9a_hVCc.d.cts.map +1 -0
  108. package/dist/{cache-BtZY_tHe.d.cts → cache-CeTMI8LR.d.mts} +4 -7
  109. package/dist/cache-CeTMI8LR.d.mts.map +1 -0
  110. package/dist/cache.cjs +68 -2
  111. package/dist/cache.cjs.map +1 -0
  112. package/dist/cache.d.cts +1 -2
  113. package/dist/cache.d.mts +1 -2
  114. package/dist/cache.mjs +67 -2
  115. package/dist/cache.mjs.map +1 -0
  116. package/dist/{clone-DblgEZZa.mjs → clone-EKNovYHu.mjs} +3 -3
  117. package/dist/clone-EKNovYHu.mjs.map +1 -0
  118. package/dist/{clone-Dy0cR2SZ.cjs → clone-UGJpvQnL.cjs} +7 -8
  119. package/dist/clone-UGJpvQnL.cjs.map +1 -0
  120. package/dist/{construct-interface-g5GM5pwR.d.mts → construct-interface-_3zgxzXl.d.mts} +20 -11
  121. package/dist/construct-interface-_3zgxzXl.d.mts.map +1 -0
  122. package/dist/{construct-interface-D9d4Gm4p.d.cts → construct-interface-_xi4BPN8.d.cts} +20 -11
  123. package/dist/construct-interface-_xi4BPN8.d.cts.map +1 -0
  124. package/dist/construct-interface.cjs +87 -7
  125. package/dist/construct-interface.cjs.map +1 -0
  126. package/dist/construct-interface.d.cts +2 -2
  127. package/dist/construct-interface.d.mts +2 -2
  128. package/dist/construct-interface.mjs +81 -2
  129. package/dist/construct-interface.mjs.map +1 -0
  130. package/dist/credential.cjs +63 -16
  131. package/dist/credential.cjs.map +1 -1
  132. package/dist/credential.d.cts +16 -9
  133. package/dist/credential.d.cts.map +1 -1
  134. package/dist/credential.d.mts +16 -9
  135. package/dist/credential.d.mts.map +1 -1
  136. package/dist/credential.mjs +58 -12
  137. package/dist/credential.mjs.map +1 -1
  138. package/dist/crons/index.cjs +68 -10
  139. package/dist/crons/index.cjs.map +1 -1
  140. package/dist/crons/index.d.cts +32 -14
  141. package/dist/crons/index.d.cts.map +1 -1
  142. package/dist/crons/index.d.mts +32 -14
  143. package/dist/crons/index.d.mts.map +1 -1
  144. package/dist/crons/index.mjs +66 -10
  145. package/dist/crons/index.mjs.map +1 -1
  146. package/dist/database/kysely.cjs +40 -15
  147. package/dist/database/kysely.cjs.map +1 -1
  148. package/dist/database/kysely.d.cts +2 -152
  149. package/dist/database/kysely.d.mts +2 -152
  150. package/dist/database/kysely.mjs +28 -5
  151. package/dist/database/kysely.mjs.map +1 -1
  152. package/dist/email.cjs +25 -12
  153. package/dist/email.cjs.map +1 -1
  154. package/dist/email.d.cts +3 -7
  155. package/dist/email.d.cts.map +1 -1
  156. package/dist/email.d.mts +3 -7
  157. package/dist/email.d.mts.map +1 -1
  158. package/dist/email.mjs +16 -3
  159. package/dist/email.mjs.map +1 -1
  160. package/dist/endpoints/index.cjs +8 -10
  161. package/dist/endpoints/index.d.cts +51 -7
  162. package/dist/endpoints/index.d.cts.map +1 -0
  163. package/dist/endpoints/index.d.mts +51 -7
  164. package/dist/endpoints/index.d.mts.map +1 -0
  165. package/dist/endpoints/index.mjs +6 -10
  166. package/dist/external-api-DS3mujT5.d.mts +86 -0
  167. package/dist/external-api-DS3mujT5.d.mts.map +1 -0
  168. package/dist/external-api-LBfE-q3g.d.cts +86 -0
  169. package/dist/external-api-LBfE-q3g.d.cts.map +1 -0
  170. package/dist/external-api.cjs +124 -0
  171. package/dist/external-api.cjs.map +1 -0
  172. package/dist/external-api.d.cts +2 -0
  173. package/dist/external-api.d.mts +2 -0
  174. package/dist/external-api.mjs +121 -0
  175. package/dist/external-api.mjs.map +1 -0
  176. package/dist/file-server.cjs +42 -10
  177. package/dist/file-server.cjs.map +1 -1
  178. package/dist/file-server.d.cts +6 -10
  179. package/dist/file-server.d.cts.map +1 -1
  180. package/dist/file-server.d.mts +6 -10
  181. package/dist/file-server.d.mts.map +1 -1
  182. package/dist/file-server.mjs +34 -2
  183. package/dist/file-server.mjs.map +1 -1
  184. package/dist/functions/index.cjs +2 -6
  185. package/dist/functions/index.d.cts +2 -4
  186. package/dist/functions/index.d.mts +2 -4
  187. package/dist/functions/index.mjs +2 -6
  188. package/dist/{functions-Ck21Uyq0.mjs → functions-DCIfCRR-.mjs} +371 -241
  189. package/dist/functions-DCIfCRR-.mjs.map +1 -0
  190. package/dist/{functions-DJJA7VGc.cjs → functions-ZH60FE7H.cjs} +409 -273
  191. package/dist/functions-ZH60FE7H.cjs.map +1 -0
  192. package/dist/{index-AIfVzkhi.d.cts → index-B0kxstwf.d.cts} +49 -42
  193. package/dist/index-B0kxstwf.d.cts.map +1 -0
  194. package/dist/index-CeEtxDmK.d.cts +79 -0
  195. package/dist/index-CeEtxDmK.d.cts.map +1 -0
  196. package/dist/index-CeEtxDmK.d.mts +79 -0
  197. package/dist/index-CeEtxDmK.d.mts.map +1 -0
  198. package/dist/{index-CubPzHd9.d.mts → index-CjVEjOw0.d.mts} +49 -42
  199. package/dist/index-CjVEjOw0.d.mts.map +1 -0
  200. package/dist/index.cjs +3 -3
  201. package/dist/index.d.cts +4 -4
  202. package/dist/index.d.mts +4 -4
  203. package/dist/index.mjs +2 -3
  204. package/dist/kysely-BJ8IQ_1P.d.mts +159 -0
  205. package/dist/kysely-BJ8IQ_1P.d.mts.map +1 -0
  206. package/dist/kysely-DVF8wOT4.d.cts +159 -0
  207. package/dist/kysely-DVF8wOT4.d.cts.map +1 -0
  208. package/dist/{lazyAccessors-BoJN3SMd.mjs → lazyAccessors-CFanua0O.mjs} +20 -60
  209. package/dist/lazyAccessors-CFanua0O.mjs.map +1 -0
  210. package/dist/{lazyAccessors-e3j2oE2m.cjs → lazyAccessors-hJKGv8Ay.cjs} +60 -113
  211. package/dist/lazyAccessors-hJKGv8Ay.cjs.map +1 -0
  212. package/dist/mobile-app.cjs +70 -0
  213. package/dist/mobile-app.cjs.map +1 -0
  214. package/dist/mobile-app.d.cts +61 -0
  215. package/dist/mobile-app.d.cts.map +1 -0
  216. package/dist/mobile-app.d.mts +61 -0
  217. package/dist/mobile-app.d.mts.map +1 -0
  218. package/dist/mobile-app.mjs +69 -0
  219. package/dist/mobile-app.mjs.map +1 -0
  220. package/dist/object-storage.cjs +18 -10
  221. package/dist/object-storage.cjs.map +1 -1
  222. package/dist/object-storage.d.cts +3 -7
  223. package/dist/object-storage.d.cts.map +1 -1
  224. package/dist/object-storage.d.mts +3 -7
  225. package/dist/object-storage.d.mts.map +1 -1
  226. package/dist/object-storage.mjs +11 -3
  227. package/dist/object-storage.mjs.map +1 -1
  228. package/dist/{processAudits-Dmts9H_b.mjs → processAudits-BpRlPQMW.mjs} +16 -19
  229. package/dist/processAudits-BpRlPQMW.mjs.map +1 -0
  230. package/dist/{processAudits-CGqttuXm.cjs → processAudits-D_2W5x8k.cjs} +26 -30
  231. package/dist/processAudits-D_2W5x8k.cjs.map +1 -0
  232. package/dist/queue/index.cjs +6 -189
  233. package/dist/queue/index.d.cts +3 -60
  234. package/dist/queue/index.d.mts +3 -60
  235. package/dist/queue/index.mjs +3 -186
  236. package/dist/rest-api.cjs +87 -63
  237. package/dist/rest-api.cjs.map +1 -1
  238. package/dist/rest-api.d.cts +62 -61
  239. package/dist/rest-api.d.cts.map +1 -1
  240. package/dist/rest-api.d.mts +62 -61
  241. package/dist/rest-api.d.mts.map +1 -1
  242. package/dist/rest-api.mjs +79 -55
  243. package/dist/rest-api.mjs.map +1 -1
  244. package/dist/{chunk-DWy1uDak.cjs → rolldown-runtime-y5ARvAq5.cjs} +14 -18
  245. package/dist/site.cjs +33 -9
  246. package/dist/site.cjs.map +1 -1
  247. package/dist/site.d.cts +11 -22
  248. package/dist/site.d.cts.map +1 -1
  249. package/dist/site.d.mts +11 -22
  250. package/dist/site.d.mts.map +1 -1
  251. package/dist/site.mjs +29 -5
  252. package/dist/site.mjs.map +1 -1
  253. package/dist/subscribers/index.cjs +2 -11
  254. package/dist/subscribers/index.d.cts +3 -14
  255. package/dist/subscribers/index.d.mts +3 -14
  256. package/dist/subscribers/index.mjs +2 -11
  257. package/dist/surfaceEnv-CNimK76p.cjs +56 -0
  258. package/dist/surfaceEnv-CNimK76p.cjs.map +1 -0
  259. package/dist/surfaceEnv-wMT5QzgZ.mjs +45 -0
  260. package/dist/surfaceEnv-wMT5QzgZ.mjs.map +1 -0
  261. package/dist/{telemetry-C3L0iS28.d.cts → telemetry-DGcFlVpB.d.cts} +2 -5
  262. package/dist/telemetry-DGcFlVpB.d.cts.map +1 -0
  263. package/dist/{telemetry-D7bVFLGi.d.mts → telemetry-DGcFlVpB.d.mts} +2 -5
  264. package/dist/telemetry-DGcFlVpB.d.mts.map +1 -0
  265. package/dist/topic/index.cjs +3 -137
  266. package/dist/topic/index.d.cts +2 -32
  267. package/dist/topic/index.d.mts +2 -32
  268. package/dist/topic/index.mjs +2 -134
  269. package/dist/{types-BlAkSuGI.d.cts → types-DMuSQeLL.d.cts} +3 -5
  270. package/dist/types-DMuSQeLL.d.cts.map +1 -0
  271. package/dist/{types-aKksMEWL.d.mts → types-DMuSQeLL.d.mts} +3 -5
  272. package/dist/types-DMuSQeLL.d.mts.map +1 -0
  273. package/dist/types.d.cts +1 -1
  274. package/dist/types.d.mts +1 -1
  275. package/dist/types.mjs +1 -0
  276. package/dist/worker.cjs +118 -35
  277. package/dist/worker.cjs.map +1 -1
  278. package/dist/worker.d.cts +95 -42
  279. package/dist/worker.d.cts.map +1 -1
  280. package/dist/worker.d.mts +95 -42
  281. package/dist/worker.d.mts.map +1 -1
  282. package/dist/worker.mjs +113 -30
  283. package/dist/worker.mjs.map +1 -1
  284. package/package.json +66 -41
  285. package/dist/Construct-BD5neF7w.mjs.map +0 -1
  286. package/dist/Construct-C0ijr2qp.d.cts +0 -117
  287. package/dist/Construct-C0ijr2qp.d.cts.map +0 -1
  288. package/dist/Construct-Ct8nalEi.d.mts +0 -117
  289. package/dist/Construct-Ct8nalEi.d.mts.map +0 -1
  290. package/dist/Construct-CyS3RpTL.cjs.map +0 -1
  291. package/dist/Cron-B2OFsfDM.d.cts.map +0 -1
  292. package/dist/Cron-ByxdOfpE.d.mts.map +0 -1
  293. package/dist/CronBuilder-BL0AP6fs.d.mts +0 -44
  294. package/dist/CronBuilder-BL0AP6fs.d.mts.map +0 -1
  295. package/dist/CronBuilder-CdibiHNB.mjs +0 -84
  296. package/dist/CronBuilder-CdibiHNB.mjs.map +0 -1
  297. package/dist/CronBuilder-DyUr6nYz.cjs +0 -96
  298. package/dist/CronBuilder-DyUr6nYz.cjs.map +0 -1
  299. package/dist/CronBuilder-LSJMfqnq.d.cts +0 -44
  300. package/dist/CronBuilder-LSJMfqnq.d.cts.map +0 -1
  301. package/dist/Endpoint-2Wg7T7Cq.d.mts.map +0 -1
  302. package/dist/Endpoint-DODn1RhN.cjs.map +0 -1
  303. package/dist/Endpoint-Dij_wOcc.mjs.map +0 -1
  304. package/dist/Endpoint-DrD8a1yH.d.cts.map +0 -1
  305. package/dist/EndpointFactory-BHFMmFkV.cjs.map +0 -1
  306. package/dist/EndpointFactory-b4ituq-s.mjs.map +0 -1
  307. package/dist/HonoEndpointAdaptor-BM2jbWht.mjs.map +0 -1
  308. package/dist/HonoEndpointAdaptor-De6IlBZe.cjs.map +0 -1
  309. package/dist/Queue-D7ZuwBhy.d.cts.map +0 -1
  310. package/dist/Queue-gVGfi2Yk.d.mts.map +0 -1
  311. package/dist/Subscriber-2mEi0ImH.d.cts.map +0 -1
  312. package/dist/Subscriber-xTJ9ayPN.d.mts.map +0 -1
  313. package/dist/SubscriberBuilder-4OPehf2R.cjs.map +0 -1
  314. package/dist/SubscriberBuilder-BjkbeT9l.mjs.map +0 -1
  315. package/dist/SubscriberBuilder-Dptmo-1A.d.mts +0 -62
  316. package/dist/SubscriberBuilder-Dptmo-1A.d.mts.map +0 -1
  317. package/dist/SubscriberBuilder-waNhzjSM.d.cts +0 -62
  318. package/dist/SubscriberBuilder-waNhzjSM.d.cts.map +0 -1
  319. package/dist/Topic-19QeHBIR.d.cts +0 -91
  320. package/dist/Topic-19QeHBIR.d.cts.map +0 -1
  321. package/dist/Topic-DuFeqkBh.d.mts +0 -91
  322. package/dist/Topic-DuFeqkBh.d.mts.map +0 -1
  323. package/dist/auth.d.cts.map +0 -1
  324. package/dist/auth.d.mts.map +0 -1
  325. package/dist/cache-0ANvRQnD.mjs +0 -51
  326. package/dist/cache-0ANvRQnD.mjs.map +0 -1
  327. package/dist/cache-3WSvAulx.cjs +0 -57
  328. package/dist/cache-3WSvAulx.cjs.map +0 -1
  329. package/dist/cache-BrRz3fEB.d.mts.map +0 -1
  330. package/dist/cache-BtZY_tHe.d.cts.map +0 -1
  331. package/dist/clone-DblgEZZa.mjs.map +0 -1
  332. package/dist/clone-Dy0cR2SZ.cjs.map +0 -1
  333. package/dist/construct-interface-BfjcOD_E.cjs +0 -117
  334. package/dist/construct-interface-BfjcOD_E.cjs.map +0 -1
  335. package/dist/construct-interface-D9d4Gm4p.d.cts.map +0 -1
  336. package/dist/construct-interface-Z4CpS8tK.mjs +0 -81
  337. package/dist/construct-interface-Z4CpS8tK.mjs.map +0 -1
  338. package/dist/construct-interface-g5GM5pwR.d.mts.map +0 -1
  339. package/dist/database/kysely.d.cts.map +0 -1
  340. package/dist/database/kysely.d.mts.map +0 -1
  341. package/dist/functions-Ck21Uyq0.mjs.map +0 -1
  342. package/dist/functions-DJJA7VGc.cjs.map +0 -1
  343. package/dist/index-AIfVzkhi.d.cts.map +0 -1
  344. package/dist/index-B8g8POkr.d.cts.map +0 -1
  345. package/dist/index-BxHDdy6a.d.mts.map +0 -1
  346. package/dist/index-CubPzHd9.d.mts.map +0 -1
  347. package/dist/lazyAccessors-BoJN3SMd.mjs.map +0 -1
  348. package/dist/lazyAccessors-e3j2oE2m.cjs.map +0 -1
  349. package/dist/processAudits-CGqttuXm.cjs.map +0 -1
  350. package/dist/processAudits-Dmts9H_b.mjs.map +0 -1
  351. package/dist/queue/index.cjs.map +0 -1
  352. package/dist/queue/index.d.cts.map +0 -1
  353. package/dist/queue/index.d.mts.map +0 -1
  354. package/dist/queue/index.mjs.map +0 -1
  355. package/dist/subscribers/index.cjs.map +0 -1
  356. package/dist/subscribers/index.d.cts.map +0 -1
  357. package/dist/subscribers/index.d.mts.map +0 -1
  358. package/dist/subscribers/index.mjs.map +0 -1
  359. package/dist/surfaceEnv-BFXEms2f.cjs +0 -39
  360. package/dist/surfaceEnv-BFXEms2f.cjs.map +0 -1
  361. package/dist/surfaceEnv-C3Ktahea.mjs +0 -27
  362. package/dist/surfaceEnv-C3Ktahea.mjs.map +0 -1
  363. package/dist/telemetry-C3L0iS28.d.cts.map +0 -1
  364. package/dist/telemetry-D7bVFLGi.d.mts.map +0 -1
  365. package/dist/topic/index.cjs.map +0 -1
  366. package/dist/topic/index.d.cts.map +0 -1
  367. package/dist/topic/index.d.mts.map +0 -1
  368. package/dist/topic/index.mjs.map +0 -1
  369. package/dist/types-BlAkSuGI.d.cts.map +0 -1
  370. package/dist/types-aKksMEWL.d.mts.map +0 -1
@@ -1,15 +1,12 @@
1
1
  import { SnifferEnvironmentParser, sniffWithFireAndForget } from "@geekmidas/envkit/sniffer";
2
-
3
- //#region rolldown:runtime
2
+ //#region \0rolldown/runtime.js
4
3
  var __create = Object.create;
5
4
  var __defProp = Object.defineProperty;
6
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
8
7
  var __getProtoOf = Object.getPrototypeOf;
9
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __commonJS = (cb, mod) => function() {
11
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
- };
9
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
13
10
  var __copyProps = (to, from, except, desc) => {
14
11
  if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
12
  key = keys[i];
@@ -20,14 +17,13 @@ var __copyProps = (to, from, except, desc) => {
20
17
  }
21
18
  return to;
22
19
  };
23
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
24
21
  value: mod,
25
22
  enumerable: true
26
23
  }) : target, mod));
27
-
28
24
  //#endregion
29
- //#region ../../node_modules/.pnpm/lodash.compact@3.0.1/node_modules/lodash.compact/index.js
30
- var require_lodash = __commonJS({ "../../node_modules/.pnpm/lodash.compact@3.0.1/node_modules/lodash.compact/index.js"(exports, module) {
25
+ //#region src/Construct.ts
26
+ var import_lodash_compact = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
31
27
  /**
32
28
  * lodash 3.0.1 (Custom Build) <https://lodash.com/>
33
29
  * Build: `lodash modularize exports="npm" -o ./`
@@ -50,7 +46,7 @@ var require_lodash = __commonJS({ "../../node_modules/.pnpm/lodash.compact@3.0.1
50
46
  * _.compact([0, 1, false, 2, '', 3]);
51
47
  * // => [1, 2, 3]
52
48
  */
53
- function compact$1(array) {
49
+ function compact(array) {
54
50
  var index = -1, length = array ? array.length : 0, resIndex = 0, result = [];
55
51
  while (++index < length) {
56
52
  var value = array[index];
@@ -58,12 +54,8 @@ var require_lodash = __commonJS({ "../../node_modules/.pnpm/lodash.compact@3.0.1
58
54
  }
59
55
  return result;
60
56
  }
61
- module.exports = compact$1;
62
- } });
63
-
64
- //#endregion
65
- //#region src/Construct.ts
66
- var import_lodash = __toESM(require_lodash(), 1);
57
+ module.exports = compact;
58
+ })))(), 1);
67
59
  const serviceEnvCache = /* @__PURE__ */ new Map();
68
60
  /**
69
61
  * Noop context for environment sniffing.
@@ -92,6 +84,15 @@ const snifferContext = {
92
84
  }
93
85
  };
94
86
  var Construct = class {
87
+ type;
88
+ logger;
89
+ services;
90
+ events;
91
+ outputSchema;
92
+ timeout;
93
+ memorySize;
94
+ auditorStorageService;
95
+ constructs;
95
96
  /** Database service for this construct (used by Endpoint for RLS/audit context) */
96
97
  databaseService;
97
98
  /**
@@ -100,19 +101,18 @@ var Construct = class {
100
101
  * What an endpoint's `surface` is to it, and for the same reason: something
101
102
  * has to say which process a runnable belongs to, and until this existed the
102
103
  * only thing that said so was the directory its file sat in. Set by the
103
- * factory it was built from — `worker.crons`, `api.endpoints` — so it is
104
+ * factory it was built from — `worker.crons`, `api.get(…)` — so it is
104
105
  * carried rather than configured.
105
106
  *
106
107
  * Undefined for a construct built from a free-standing builder, which is
107
108
  * still how `c`, `s` and `f` work.
108
109
  */
109
110
  owner;
110
- constructor(type, logger, services, events = [], publisherService, outputSchema, timeout, memorySize, auditorStorageService, constructs = []) {
111
+ constructor(type, logger, services, events = [], outputSchema, timeout, memorySize, auditorStorageService, constructs = []) {
111
112
  this.type = type;
112
113
  this.logger = logger;
113
114
  this.services = services;
114
115
  this.events = events;
115
- this.publisherService = publisherService;
116
116
  this.outputSchema = outputSchema;
117
117
  this.timeout = timeout;
118
118
  this.memorySize = memorySize;
@@ -146,10 +146,9 @@ var Construct = class {
146
146
  const { markOptional = false } = opts;
147
147
  const envVars = /* @__PURE__ */ new Set();
148
148
  const optionalVars = /* @__PURE__ */ new Set();
149
- const services = (0, import_lodash.default)([
149
+ const services = (0, import_lodash_compact.default)([
150
150
  ...this.services,
151
- this.publisherService,
152
- this.publisherService,
151
+ ...this.events.map(({ topic }) => topic),
153
152
  this.auditorStorageService,
154
153
  this.databaseService
155
154
  ]);
@@ -186,14 +185,14 @@ var Construct = class {
186
185
  }
187
186
  }
188
187
  };
189
- let ConstructType = /* @__PURE__ */ function(ConstructType$1) {
190
- ConstructType$1["Cron"] = "dev.geekmidas.function.cron";
191
- ConstructType$1["Endpoint"] = "dev.geekmidas.function.endpoint";
192
- ConstructType$1["Function"] = "dev.geekmidas.function.function";
193
- ConstructType$1["Subscriber"] = "dev.geekmidas.function.subscriber";
194
- ConstructType$1["Queue"] = "dev.geekmidas.function.queue";
195
- ConstructType$1["Topic"] = "dev.geekmidas.resource.topic";
196
- return ConstructType$1;
188
+ let ConstructType = /* @__PURE__ */ function(ConstructType) {
189
+ ConstructType["Cron"] = "dev.geekmidas.function.cron";
190
+ ConstructType["Endpoint"] = "dev.geekmidas.function.endpoint";
191
+ ConstructType["Function"] = "dev.geekmidas.function.function";
192
+ ConstructType["Subscriber"] = "dev.geekmidas.function.subscriber";
193
+ ConstructType["Queue"] = "dev.geekmidas.function.queue";
194
+ ConstructType["Topic"] = "dev.geekmidas.resource.topic";
195
+ return ConstructType;
197
196
  }({});
198
197
  /**
199
198
  * Utility to test sniffing a service for environment variables.
@@ -216,7 +215,7 @@ async function sniffService(service) {
216
215
  context: snifferContext
217
216
  }));
218
217
  }
219
-
220
218
  //#endregion
221
- export { Construct, ConstructType, __commonJS, __toESM, sniffService, snifferContext };
222
- //# sourceMappingURL=Construct-BD5neF7w.mjs.map
219
+ export { __commonJSMin as a, snifferContext as i, ConstructType as n, __toESM as o, sniffService as r, Construct as t };
220
+
221
+ //# sourceMappingURL=Construct-BO1X-kt9.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Construct-BO1X-kt9.mjs","names":["compact"],"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,IAAI,yBAAyB;CAE7C,OAAO,uBAAuB,eAC7B,QAAQ,SAAS;EAChB,WAAW;EACX,SAAS;CACV,CAAC,CACF;AACD"}
@@ -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;;;;;;;;EAkC9D,WAAW;;MAmBP,qBAAqB;;UAKT,aAAa,gBAAgB;;EAE7C,QAAQ;;;;;;;;;;;UCpJQ,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,8 +1,7 @@
1
- const require_chunk = require('./chunk-DWy1uDak.cjs');
2
- const __geekmidas_envkit_sniffer = require_chunk.__toESM(require("@geekmidas/envkit/sniffer"));
3
-
1
+ const require_rolldown_runtime = require("./rolldown-runtime-y5ARvAq5.cjs");
2
+ let _geekmidas_envkit_sniffer = require("@geekmidas/envkit/sniffer");
4
3
  //#region ../../node_modules/.pnpm/lodash.compact@3.0.1/node_modules/lodash.compact/index.js
5
- var require_lodash = require_chunk.__commonJS({ "../../node_modules/.pnpm/lodash.compact@3.0.1/node_modules/lodash.compact/index.js"(exports, module) {
4
+ var require_lodash_compact = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
6
5
  /**
7
6
  * lodash 3.0.1 (Custom Build) <https://lodash.com/>
8
7
  * Build: `lodash modularize exports="npm" -o ./`
@@ -25,7 +24,7 @@ var require_lodash = require_chunk.__commonJS({ "../../node_modules/.pnpm/lodash
25
24
  * _.compact([0, 1, false, 2, '', 3]);
26
25
  * // => [1, 2, 3]
27
26
  */
28
- function compact$1(array) {
27
+ function compact(array) {
29
28
  var index = -1, length = array ? array.length : 0, resIndex = 0, result = [];
30
29
  while (++index < length) {
31
30
  var value = array[index];
@@ -33,12 +32,11 @@ var require_lodash = require_chunk.__commonJS({ "../../node_modules/.pnpm/lodash
33
32
  }
34
33
  return result;
35
34
  }
36
- module.exports = compact$1;
37
- } });
38
-
35
+ module.exports = compact;
36
+ }));
39
37
  //#endregion
40
38
  //#region src/Construct.ts
41
- var import_lodash = require_chunk.__toESM(require_lodash(), 1);
39
+ var import_lodash_compact = /* @__PURE__ */ require_rolldown_runtime.__toESM(require_lodash_compact(), 1);
42
40
  const serviceEnvCache = /* @__PURE__ */ new Map();
43
41
  /**
44
42
  * Noop context for environment sniffing.
@@ -67,6 +65,15 @@ const snifferContext = {
67
65
  }
68
66
  };
69
67
  var Construct = class {
68
+ type;
69
+ logger;
70
+ services;
71
+ events;
72
+ outputSchema;
73
+ timeout;
74
+ memorySize;
75
+ auditorStorageService;
76
+ constructs;
70
77
  /** Database service for this construct (used by Endpoint for RLS/audit context) */
71
78
  databaseService;
72
79
  /**
@@ -75,19 +82,18 @@ var Construct = class {
75
82
  * What an endpoint's `surface` is to it, and for the same reason: something
76
83
  * has to say which process a runnable belongs to, and until this existed the
77
84
  * only thing that said so was the directory its file sat in. Set by the
78
- * factory it was built from — `worker.crons`, `api.endpoints` — so it is
85
+ * factory it was built from — `worker.crons`, `api.get(…)` — so it is
79
86
  * carried rather than configured.
80
87
  *
81
88
  * Undefined for a construct built from a free-standing builder, which is
82
89
  * still how `c`, `s` and `f` work.
83
90
  */
84
91
  owner;
85
- constructor(type, logger, services, events = [], publisherService, outputSchema, timeout, memorySize, auditorStorageService, constructs = []) {
92
+ constructor(type, logger, services, events = [], outputSchema, timeout, memorySize, auditorStorageService, constructs = []) {
86
93
  this.type = type;
87
94
  this.logger = logger;
88
95
  this.services = services;
89
96
  this.events = events;
90
- this.publisherService = publisherService;
91
97
  this.outputSchema = outputSchema;
92
98
  this.timeout = timeout;
93
99
  this.memorySize = memorySize;
@@ -121,10 +127,9 @@ var Construct = class {
121
127
  const { markOptional = false } = opts;
122
128
  const envVars = /* @__PURE__ */ new Set();
123
129
  const optionalVars = /* @__PURE__ */ new Set();
124
- const services = (0, import_lodash.default)([
130
+ const services = (0, import_lodash_compact.default)([
125
131
  ...this.services,
126
- this.publisherService,
127
- this.publisherService,
132
+ ...this.events.map(({ topic }) => topic),
128
133
  this.auditorStorageService,
129
134
  this.databaseService
130
135
  ]);
@@ -161,14 +166,14 @@ var Construct = class {
161
166
  }
162
167
  }
163
168
  };
164
- let ConstructType = /* @__PURE__ */ function(ConstructType$1) {
165
- ConstructType$1["Cron"] = "dev.geekmidas.function.cron";
166
- ConstructType$1["Endpoint"] = "dev.geekmidas.function.endpoint";
167
- ConstructType$1["Function"] = "dev.geekmidas.function.function";
168
- ConstructType$1["Subscriber"] = "dev.geekmidas.function.subscriber";
169
- ConstructType$1["Queue"] = "dev.geekmidas.function.queue";
170
- ConstructType$1["Topic"] = "dev.geekmidas.resource.topic";
171
- return ConstructType$1;
169
+ let ConstructType = /* @__PURE__ */ function(ConstructType) {
170
+ ConstructType["Cron"] = "dev.geekmidas.function.cron";
171
+ ConstructType["Endpoint"] = "dev.geekmidas.function.endpoint";
172
+ ConstructType["Function"] = "dev.geekmidas.function.function";
173
+ ConstructType["Subscriber"] = "dev.geekmidas.function.subscriber";
174
+ ConstructType["Queue"] = "dev.geekmidas.function.queue";
175
+ ConstructType["Topic"] = "dev.geekmidas.resource.topic";
176
+ return ConstructType;
172
177
  }({});
173
178
  /**
174
179
  * Utility to test sniffing a service for environment variables.
@@ -185,36 +190,36 @@ let ConstructType = /* @__PURE__ */ function(ConstructType$1) {
185
190
  * ```
186
191
  */
187
192
  async function sniffService(service) {
188
- const sniffer = new __geekmidas_envkit_sniffer.SnifferEnvironmentParser();
189
- return (0, __geekmidas_envkit_sniffer.sniffWithFireAndForget)(sniffer, () => service.register({
193
+ const sniffer = new _geekmidas_envkit_sniffer.SnifferEnvironmentParser();
194
+ return (0, _geekmidas_envkit_sniffer.sniffWithFireAndForget)(sniffer, () => service.register({
190
195
  envParser: sniffer,
191
196
  context: snifferContext
192
197
  }));
193
198
  }
194
-
195
199
  //#endregion
196
- Object.defineProperty(exports, 'Construct', {
197
- enumerable: true,
198
- get: function () {
199
- return Construct;
200
- }
200
+ Object.defineProperty(exports, "Construct", {
201
+ enumerable: true,
202
+ get: function() {
203
+ return Construct;
204
+ }
201
205
  });
202
- Object.defineProperty(exports, 'ConstructType', {
203
- enumerable: true,
204
- get: function () {
205
- return ConstructType;
206
- }
206
+ Object.defineProperty(exports, "ConstructType", {
207
+ enumerable: true,
208
+ get: function() {
209
+ return ConstructType;
210
+ }
207
211
  });
208
- Object.defineProperty(exports, 'sniffService', {
209
- enumerable: true,
210
- get: function () {
211
- return sniffService;
212
- }
212
+ Object.defineProperty(exports, "sniffService", {
213
+ enumerable: true,
214
+ get: function() {
215
+ return sniffService;
216
+ }
213
217
  });
214
- Object.defineProperty(exports, 'snifferContext', {
215
- enumerable: true,
216
- get: function () {
217
- return snifferContext;
218
- }
218
+ Object.defineProperty(exports, "snifferContext", {
219
+ enumerable: true,
220
+ get: function() {
221
+ return snifferContext;
222
+ }
219
223
  });
220
- //# sourceMappingURL=Construct-CyS3RpTL.cjs.map
224
+
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":"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"}