@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
@@ -0,0 +1,231 @@
1
+ import { n as StandardSchemaV1 } from "./index-DdRjYhiJ.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
+ Processor = "dev.geekmidas.function.processor"
213
+ }
214
+ /**
215
+ * Utility to test sniffing a service for environment variables.
216
+ * Useful for debugging services that throw errors during sniffing.
217
+ *
218
+ * @example
219
+ * ```typescript
220
+ * import { sniffService } from '@geekmidas/constructs';
221
+ * import { authService } from './services/AuthService';
222
+ *
223
+ * const result = await sniffService(authService);
224
+ * console.log('Env vars:', result.envVars);
225
+ * console.log('Error:', result.error);
226
+ * ```
227
+ */
228
+ declare function sniffService(service: Service): Promise<SniffResult>;
229
+ //#endregion
230
+ 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 };
231
+ //# sourceMappingURL=Construct-127M7yrl.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Construct-127M7yr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B,eAAe,uBACN,8BACA,iCACA,wBAAwB,QACvC,0BACA,gBAYe;;;;;;;;;;;EAAA;;;;;;;;;;;;;;;;;;;;;;;;EA0BX,eACL;IAAQ;MACN;;aAiEQ;EACX;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;;;;;;;;;;;iBAiBqB,aAAa,SAAS,UAAU,QAAQ"}
@@ -81,14 +81,14 @@ const snifferContext = {
81
81
  },
82
82
  hasContext() {
83
83
  return false;
84
- }
84
+ },
85
+ getUser() {}
85
86
  };
86
87
  var Construct = class {
87
88
  type;
88
89
  logger;
89
90
  services;
90
91
  events;
91
- publisherService;
92
92
  outputSchema;
93
93
  timeout;
94
94
  memorySize;
@@ -102,19 +102,18 @@ var Construct = class {
102
102
  * What an endpoint's `surface` is to it, and for the same reason: something
103
103
  * has to say which process a runnable belongs to, and until this existed the
104
104
  * only thing that said so was the directory its file sat in. Set by the
105
- * factory it was built from — `worker.crons`, `api.endpoints` — so it is
105
+ * factory it was built from — `worker.crons`, `api.get(…)` — so it is
106
106
  * carried rather than configured.
107
107
  *
108
108
  * Undefined for a construct built from a free-standing builder, which is
109
109
  * still how `c`, `s` and `f` work.
110
110
  */
111
111
  owner;
112
- constructor(type, logger, services, events = [], publisherService, outputSchema, timeout, memorySize, auditorStorageService, constructs = []) {
112
+ constructor(type, logger, services, events = [], outputSchema, timeout, memorySize, auditorStorageService, constructs = []) {
113
113
  this.type = type;
114
114
  this.logger = logger;
115
115
  this.services = services;
116
116
  this.events = events;
117
- this.publisherService = publisherService;
118
117
  this.outputSchema = outputSchema;
119
118
  this.timeout = timeout;
120
119
  this.memorySize = memorySize;
@@ -150,8 +149,7 @@ var Construct = class {
150
149
  const optionalVars = /* @__PURE__ */ new Set();
151
150
  const services = (0, import_lodash_compact.default)([
152
151
  ...this.services,
153
- this.publisherService,
154
- this.publisherService,
152
+ ...this.events.map(({ topic }) => topic),
155
153
  this.auditorStorageService,
156
154
  this.databaseService
157
155
  ]);
@@ -183,7 +181,7 @@ var Construct = class {
183
181
  if (!markOptional || optionalVars.size === 0) return sorted;
184
182
  return sorted.map((v) => optionalVars.has(v) ? `${v}?` : v);
185
183
  } catch (error) {
186
- this.logger.error({ error }, "Error determining environment variables for construct");
184
+ this.logger.error({ err: error }, "Error determining environment variables for construct");
187
185
  return [];
188
186
  }
189
187
  }
@@ -195,6 +193,7 @@ let ConstructType = /* @__PURE__ */ function(ConstructType) {
195
193
  ConstructType["Subscriber"] = "dev.geekmidas.function.subscriber";
196
194
  ConstructType["Queue"] = "dev.geekmidas.function.queue";
197
195
  ConstructType["Topic"] = "dev.geekmidas.resource.topic";
196
+ ConstructType["Processor"] = "dev.geekmidas.function.processor";
198
197
  return ConstructType;
199
198
  }({});
200
199
  /**
@@ -221,4 +220,4 @@ async function sniffService(service) {
221
220
  //#endregion
222
221
  export { __commonJSMin as a, snifferContext as i, ConstructType as n, __toESM as o, sniffService as r, Construct as t };
223
222
 
224
- //# sourceMappingURL=Construct-BeYVu_QF.mjs.map
223
+ //# sourceMappingURL=Construct-CGuc_Ijk.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Construct-CGuc_Ijk.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\tgetUser() {\n\t\treturn undefined;\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{ err: 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\tProcessor = 'dev.geekmidas.function.processor',\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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,IAAI,yBAAyB;CAE7C,OAAO,uBAAuB,eAC7B,QAAQ,SAAS;EAChB,WAAW;EACX,SAAS;CACV,CAAC,CACF;AACD"}
@@ -62,14 +62,14 @@ const snifferContext = {
62
62
  },
63
63
  hasContext() {
64
64
  return false;
65
- }
65
+ },
66
+ getUser() {}
66
67
  };
67
68
  var Construct = class {
68
69
  type;
69
70
  logger;
70
71
  services;
71
72
  events;
72
- publisherService;
73
73
  outputSchema;
74
74
  timeout;
75
75
  memorySize;
@@ -83,19 +83,18 @@ var Construct = class {
83
83
  * What an endpoint's `surface` is to it, and for the same reason: something
84
84
  * has to say which process a runnable belongs to, and until this existed the
85
85
  * only thing that said so was the directory its file sat in. Set by the
86
- * factory it was built from — `worker.crons`, `api.endpoints` — so it is
86
+ * factory it was built from — `worker.crons`, `api.get(…)` — so it is
87
87
  * carried rather than configured.
88
88
  *
89
89
  * Undefined for a construct built from a free-standing builder, which is
90
90
  * still how `c`, `s` and `f` work.
91
91
  */
92
92
  owner;
93
- constructor(type, logger, services, events = [], publisherService, outputSchema, timeout, memorySize, auditorStorageService, constructs = []) {
93
+ constructor(type, logger, services, events = [], outputSchema, timeout, memorySize, auditorStorageService, constructs = []) {
94
94
  this.type = type;
95
95
  this.logger = logger;
96
96
  this.services = services;
97
97
  this.events = events;
98
- this.publisherService = publisherService;
99
98
  this.outputSchema = outputSchema;
100
99
  this.timeout = timeout;
101
100
  this.memorySize = memorySize;
@@ -131,8 +130,7 @@ var Construct = class {
131
130
  const optionalVars = /* @__PURE__ */ new Set();
132
131
  const services = (0, import_lodash_compact.default)([
133
132
  ...this.services,
134
- this.publisherService,
135
- this.publisherService,
133
+ ...this.events.map(({ topic }) => topic),
136
134
  this.auditorStorageService,
137
135
  this.databaseService
138
136
  ]);
@@ -164,7 +162,7 @@ var Construct = class {
164
162
  if (!markOptional || optionalVars.size === 0) return sorted;
165
163
  return sorted.map((v) => optionalVars.has(v) ? `${v}?` : v);
166
164
  } catch (error) {
167
- this.logger.error({ error }, "Error determining environment variables for construct");
165
+ this.logger.error({ err: error }, "Error determining environment variables for construct");
168
166
  return [];
169
167
  }
170
168
  }
@@ -176,6 +174,7 @@ let ConstructType = /* @__PURE__ */ function(ConstructType) {
176
174
  ConstructType["Subscriber"] = "dev.geekmidas.function.subscriber";
177
175
  ConstructType["Queue"] = "dev.geekmidas.function.queue";
178
176
  ConstructType["Topic"] = "dev.geekmidas.resource.topic";
177
+ ConstructType["Processor"] = "dev.geekmidas.function.processor";
179
178
  return ConstructType;
180
179
  }({});
181
180
  /**
@@ -225,4 +224,4 @@ Object.defineProperty(exports, "snifferContext", {
225
224
  }
226
225
  });
227
226
 
228
- //# sourceMappingURL=Construct-DqdlARxq.cjs.map
227
+ //# sourceMappingURL=Construct-DorKS0Ua.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Construct-DorKS0Ua.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\tgetUser() {\n\t\treturn undefined;\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{ err: 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\tProcessor = 'dev.geekmidas.function.processor',\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,QA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