@geekmidas/constructs 10.0.0-alpha.98 → 10.0.0

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 (533) hide show
  1. package/CHANGELOG.md +437 -0
  2. package/README.md +193 -285
  3. package/dist/AWSScheduledFunction-BzGCUbkk.d.mts +117 -0
  4. package/dist/AWSScheduledFunction-BzGCUbkk.d.mts.map +1 -0
  5. package/dist/AWSScheduledFunction-C42adp8A.cjs +266 -0
  6. package/dist/AWSScheduledFunction-C42adp8A.cjs.map +1 -0
  7. package/dist/AWSScheduledFunction-CsNJhXQj.d.cts +117 -0
  8. package/dist/AWSScheduledFunction-CsNJhXQj.d.cts.map +1 -0
  9. package/dist/AWSScheduledFunction-KP6lqbsW.mjs +254 -0
  10. package/dist/AWSScheduledFunction-KP6lqbsW.mjs.map +1 -0
  11. package/dist/{Construct-B1vGBPme.mjs → Construct-BWF5HxaM.mjs} +37 -47
  12. package/dist/Construct-BWF5HxaM.mjs.map +1 -0
  13. package/dist/Construct-JlyQkBkv.d.cts +117 -0
  14. package/dist/Construct-JlyQkBkv.d.cts.map +1 -0
  15. package/dist/{Construct-DUSXuTHP.cjs → Construct-TGIM_E4o.cjs} +88 -67
  16. package/dist/Construct-TGIM_E4o.cjs.map +1 -0
  17. package/dist/Construct-pxwC6fDD.d.mts +117 -0
  18. package/dist/Construct-pxwC6fDD.d.mts.map +1 -0
  19. package/dist/{Endpoint-Du-NwPX2.d.mts → Endpoint-B0P_pEMr.d.mts} +85 -126
  20. package/dist/Endpoint-B0P_pEMr.d.mts.map +1 -0
  21. package/dist/{Endpoint-aCvBMPoH.d.cts → Endpoint-BLZ7r67m.d.cts} +84 -125
  22. package/dist/Endpoint-BLZ7r67m.d.cts.map +1 -0
  23. package/dist/{HonoEndpointAdaptor-PtPlbeKY.mjs → HonoEndpointAdaptor-BMVwx2cz.mjs} +69 -81
  24. package/dist/HonoEndpointAdaptor-BMVwx2cz.mjs.map +1 -0
  25. package/dist/{HonoEndpointAdaptor-zVzVLJEO.cjs → HonoEndpointAdaptor-DPDsDi-D.cjs} +77 -92
  26. package/dist/HonoEndpointAdaptor-DPDsDi-D.cjs.map +1 -0
  27. package/dist/Queue-BL68oDJ-.d.mts +66 -0
  28. package/dist/Queue-BL68oDJ-.d.mts.map +1 -0
  29. package/dist/Queue-DxJ6btRE.d.cts +66 -0
  30. package/dist/Queue-DxJ6btRE.d.cts.map +1 -0
  31. package/dist/Subscriber-BpVhcGhX.d.cts +47 -0
  32. package/dist/Subscriber-BpVhcGhX.d.cts.map +1 -0
  33. package/dist/Subscriber-DF6xsBAJ.d.mts +47 -0
  34. package/dist/Subscriber-DF6xsBAJ.d.mts.map +1 -0
  35. package/dist/Topic-DJXoDeMP.d.cts +60 -0
  36. package/dist/Topic-DJXoDeMP.d.cts.map +1 -0
  37. package/dist/Topic-DxWQBgMN.d.mts +60 -0
  38. package/dist/Topic-DxWQBgMN.d.mts.map +1 -0
  39. package/dist/adaptors/aws.cjs +205 -355
  40. package/dist/adaptors/aws.cjs.map +1 -1
  41. package/dist/adaptors/aws.d.cts +48 -126
  42. package/dist/adaptors/aws.d.cts.map +1 -1
  43. package/dist/adaptors/aws.d.mts +49 -127
  44. package/dist/adaptors/aws.d.mts.map +1 -1
  45. package/dist/adaptors/aws.mjs +178 -325
  46. package/dist/adaptors/aws.mjs.map +1 -1
  47. package/dist/adaptors/hono.cjs +9 -3
  48. package/dist/adaptors/hono.d.cts +15 -7
  49. package/dist/adaptors/hono.d.cts.map +1 -1
  50. package/dist/adaptors/hono.d.mts +17 -9
  51. package/dist/adaptors/hono.d.mts.map +1 -1
  52. package/dist/adaptors/hono.mjs +9 -2
  53. package/dist/adaptors/testing.cjs +209 -831
  54. package/dist/adaptors/testing.cjs.map +1 -1
  55. package/dist/adaptors/testing.d.cts +55 -351
  56. package/dist/adaptors/testing.d.cts.map +1 -1
  57. package/dist/adaptors/testing.d.mts +53 -349
  58. package/dist/adaptors/testing.d.mts.map +1 -1
  59. package/dist/adaptors/testing.mjs +195 -798
  60. package/dist/adaptors/testing.mjs.map +1 -1
  61. package/dist/{clone-UGJpvQnL.cjs → clone-I_WIpiFf.cjs} +8 -7
  62. package/dist/clone-I_WIpiFf.cjs.map +1 -0
  63. package/dist/{clone-EKNovYHu.mjs → clone-pdXxc0t3.mjs} +3 -3
  64. package/dist/clone-pdXxc0t3.mjs.map +1 -0
  65. package/dist/crons/index.cjs +66 -190
  66. package/dist/crons/index.cjs.map +1 -1
  67. package/dist/crons/index.d.cts +35 -70
  68. package/dist/crons/index.d.cts.map +1 -1
  69. package/dist/crons/index.d.mts +32 -70
  70. package/dist/crons/index.d.mts.map +1 -1
  71. package/dist/crons/index.mjs +63 -184
  72. package/dist/crons/index.mjs.map +1 -1
  73. package/dist/endpoints/index.cjs +761 -19
  74. package/dist/endpoints/index.cjs.map +1 -0
  75. package/dist/endpoints/index.d.cts +322 -22
  76. package/dist/endpoints/index.d.cts.map +1 -1
  77. package/dist/endpoints/index.d.mts +321 -22
  78. package/dist/endpoints/index.d.mts.map +1 -1
  79. package/dist/endpoints/index.mjs +751 -6
  80. package/dist/endpoints/index.mjs.map +1 -0
  81. package/dist/functions/index.cjs +5 -2
  82. package/dist/functions/index.d.cts +3 -3
  83. package/dist/functions/index.d.mts +3 -3
  84. package/dist/functions/index.mjs +5 -2
  85. package/dist/{functions-BFizikJU.mjs → functions-EqTloHjo.mjs} +331 -425
  86. package/dist/functions-EqTloHjo.mjs.map +1 -0
  87. package/dist/{functions-CfzJG9hK.cjs → functions-SqtCDc9c.cjs} +370 -459
  88. package/dist/functions-SqtCDc9c.cjs.map +1 -0
  89. package/dist/index-C7iynzLI.d.mts +139 -0
  90. package/dist/index-C7iynzLI.d.mts.map +1 -0
  91. package/dist/index-D4dM_WDY.d.cts +142 -0
  92. package/dist/index-D4dM_WDY.d.cts.map +1 -0
  93. package/dist/index.cjs +3 -6
  94. package/dist/index.d.cts +4 -27
  95. package/dist/index.d.mts +4 -27
  96. package/dist/index.mjs +3 -3
  97. package/dist/{Endpoint-BG4UJ9oA.mjs → lazyAccessors-CCTK19xj.mjs} +1040 -914
  98. package/dist/lazyAccessors-CCTK19xj.mjs.map +1 -0
  99. package/dist/{Endpoint-BoUg8ocM.cjs → lazyAccessors-D04oftGw.cjs} +1127 -960
  100. package/dist/lazyAccessors-D04oftGw.cjs.map +1 -0
  101. package/dist/monitors/index.cjs +49 -0
  102. package/dist/monitors/index.cjs.map +1 -0
  103. package/dist/monitors/index.d.cts +45 -0
  104. package/dist/monitors/index.d.cts.map +1 -0
  105. package/dist/monitors/index.d.mts +45 -0
  106. package/dist/monitors/index.d.mts.map +1 -0
  107. package/dist/monitors/index.mjs +48 -0
  108. package/dist/monitors/index.mjs.map +1 -0
  109. package/dist/processAudits-BJZT5gmy.cjs +92 -0
  110. package/dist/processAudits-BJZT5gmy.cjs.map +1 -0
  111. package/dist/processAudits-CwyaaSQc.mjs +80 -0
  112. package/dist/processAudits-CwyaaSQc.mjs.map +1 -0
  113. package/dist/publisher-BZgcrVPy.cjs +53 -0
  114. package/dist/publisher-BZgcrVPy.cjs.map +1 -0
  115. package/dist/publisher-CnpeMv-r.mjs +41 -0
  116. package/dist/publisher-CnpeMv-r.mjs.map +1 -0
  117. package/dist/queue/index.cjs +114 -6
  118. package/dist/queue/index.cjs.map +1 -0
  119. package/dist/queue/index.d.cts +45 -3
  120. package/dist/queue/index.d.cts.map +1 -0
  121. package/dist/queue/index.d.mts +44 -3
  122. package/dist/queue/index.d.mts.map +1 -0
  123. package/dist/queue/index.mjs +112 -3
  124. package/dist/queue/index.mjs.map +1 -0
  125. package/dist/subscribers/index.cjs +80 -111
  126. package/dist/subscribers/index.cjs.map +1 -1
  127. package/dist/subscribers/index.d.cts +43 -46
  128. package/dist/subscribers/index.d.cts.map +1 -1
  129. package/dist/subscribers/index.d.mts +42 -46
  130. package/dist/subscribers/index.d.mts.map +1 -1
  131. package/dist/subscribers/index.mjs +78 -108
  132. package/dist/subscribers/index.mjs.map +1 -1
  133. package/dist/{lambdaTelemetry-8vnmVZQ5.d.cts → telemetry-C--EgYVr.d.mts} +7 -4
  134. package/dist/telemetry-C--EgYVr.d.mts.map +1 -0
  135. package/dist/{lambdaTelemetry-8vnmVZQ5.d.mts → telemetry-Dqx-D3F7.d.cts} +7 -4
  136. package/dist/telemetry-Dqx-D3F7.d.cts.map +1 -0
  137. package/dist/topic/index.cjs +91 -3
  138. package/dist/topic/index.cjs.map +1 -0
  139. package/dist/topic/index.d.cts +32 -2
  140. package/dist/topic/index.d.cts.map +1 -0
  141. package/dist/topic/index.d.mts +32 -2
  142. package/dist/topic/index.d.mts.map +1 -0
  143. package/dist/topic/index.mjs +89 -2
  144. package/dist/topic/index.mjs.map +1 -0
  145. package/dist/{types-DMuSQeLL.d.cts → types-BdAaYDvd.d.cts} +5 -3
  146. package/dist/types-BdAaYDvd.d.cts.map +1 -0
  147. package/dist/{types-DMuSQeLL.d.mts → types-DNngH0fX.d.mts} +5 -3
  148. package/dist/types-DNngH0fX.d.mts.map +1 -0
  149. package/dist/types.d.cts +1 -1
  150. package/dist/types.d.mts +1 -1
  151. package/dist/types.mjs +0 -1
  152. package/package.json +55 -223
  153. package/src/Construct.ts +209 -0
  154. package/src/__benchmarks__/build-time-optimization.bench.ts +274 -0
  155. package/src/__benchmarks__/endpoint.bench.ts +494 -0
  156. package/src/__benchmarks__/fixtures.ts +241 -0
  157. package/src/__benchmarks__/hono-adaptor.bench.ts +533 -0
  158. package/src/__benchmarks__/hono-server.bench.ts +249 -0
  159. package/src/__benchmarks__/response-builder.bench.ts +428 -0
  160. package/src/__benchmarks__/strategies/strategy-a-lazy-services.ts +319 -0
  161. package/src/__benchmarks__/strategies/strategy-c-middleware.ts +530 -0
  162. package/src/__benchmarks__/strategies/strategy-d-opt-in-events.ts +567 -0
  163. package/src/__tests__/Construct.environment.spec.ts +704 -0
  164. package/src/__tests__/builder-reuse.spec.ts +587 -0
  165. package/src/__tests__/monitor.spec.ts +636 -0
  166. package/src/__tests__/publisher.setting.spec.ts +508 -0
  167. package/src/__tests__/publisher.spec.ts +452 -0
  168. package/src/adaptors/aws.ts +6 -0
  169. package/src/adaptors/hono.ts +1 -0
  170. package/src/adaptors/testing.ts +11 -0
  171. package/src/clone.ts +38 -0
  172. package/src/crons/AWSScheduledFunction.ts +73 -0
  173. package/src/crons/Cron.ts +149 -0
  174. package/src/crons/CronBuilder.ts +261 -0
  175. package/src/crons/__tests__/AWSScheduledFunction.spec.ts +152 -0
  176. package/src/crons/__tests__/Cron.spec.ts +472 -0
  177. package/src/crons/__tests__/CronBuilder.state-isolation.spec.ts +273 -0
  178. package/src/crons/index.ts +12 -0
  179. package/src/endpoints/AmazonApiGatewayEndpointAdaptor.ts +698 -0
  180. package/src/endpoints/AmazonApiGatewayV1EndpointAdaptor.ts +105 -0
  181. package/src/endpoints/AmazonApiGatewayV2EndpointAdaptor.ts +97 -0
  182. package/src/endpoints/Authorizer.ts +152 -0
  183. package/src/endpoints/Endpoint.ts +1287 -0
  184. package/src/endpoints/EndpointBuilder.ts +749 -0
  185. package/src/endpoints/EndpointFactory.ts +1179 -0
  186. package/src/endpoints/HonoEndpointAdaptor.ts +692 -0
  187. package/src/endpoints/MswEndpointAdaptor.ts +226 -0
  188. package/src/endpoints/TestEndpointAdaptor.ts +466 -0
  189. package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.audits.spec.ts +499 -0
  190. package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.events.spec.ts +560 -0
  191. package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.spec.ts +1304 -0
  192. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.audits.spec.ts +626 -0
  193. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.events.spec.ts +732 -0
  194. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.factory-publisher.spec.ts +296 -0
  195. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.kysely-audit.integration.spec.ts +951 -0
  196. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.responseType.spec.ts +111 -0
  197. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.rls.spec.ts +307 -0
  198. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.spec.ts +629 -0
  199. package/src/endpoints/__tests__/Authorizer.spec.ts +286 -0
  200. package/src/endpoints/__tests__/Endpoint.cookies.spec.ts +207 -0
  201. package/src/endpoints/__tests__/Endpoint.headers.spec.ts +187 -0
  202. package/src/endpoints/__tests__/Endpoint.manifest.spec.ts +175 -0
  203. package/src/endpoints/__tests__/Endpoint.spec.ts +857 -0
  204. package/src/endpoints/__tests__/EndpointBuilder.audit.spec.ts +451 -0
  205. package/src/endpoints/__tests__/EndpointBuilder.responseType.spec.ts +50 -0
  206. package/src/endpoints/__tests__/EndpointBuilder.spec.ts +531 -0
  207. package/src/endpoints/__tests__/EndpointFactory.authorizers.spec.ts +492 -0
  208. package/src/endpoints/__tests__/EndpointFactory.database-auditor.spec.ts +509 -0
  209. package/src/endpoints/__tests__/EndpointFactory.reference-audit.spec.ts +190 -0
  210. package/src/endpoints/__tests__/EndpointFactory.spec.ts +479 -0
  211. package/src/endpoints/__tests__/EndpointFactory.state-isolation.spec.ts +155 -0
  212. package/src/endpoints/__tests__/HonoEndpointAdaptor.audit-transactions.spec.ts +703 -0
  213. package/src/endpoints/__tests__/HonoEndpointAdaptor.audits.spec.ts +632 -0
  214. package/src/endpoints/__tests__/HonoEndpointAdaptor.events.spec.ts +577 -0
  215. package/src/endpoints/__tests__/HonoEndpointAdaptor.kysely-audit.integration.spec.ts +1067 -0
  216. package/src/endpoints/__tests__/HonoEndpointAdaptor.openapi.spec.ts +317 -0
  217. package/src/endpoints/__tests__/HonoEndpointAdaptor.pgboss-publisher.spec.ts +289 -0
  218. package/src/endpoints/__tests__/HonoEndpointAdaptor.responseType.spec.ts +128 -0
  219. package/src/endpoints/__tests__/HonoEndpointAdaptor.spec.ts +1207 -0
  220. package/src/endpoints/__tests__/MswEndpointAdaptor.spec.ts +211 -0
  221. package/src/endpoints/__tests__/ResponseBuilder.spec.ts +235 -0
  222. package/src/endpoints/__tests__/TestEndpointAdaptor.audits.spec.ts +602 -0
  223. package/src/endpoints/__tests__/TestEndpointAdaptor.spec.ts +1044 -0
  224. package/src/endpoints/__tests__/__snapshots__/HonoEndpointAdaptor.spec.ts.snap +54 -0
  225. package/src/endpoints/__tests__/endpoint-types.test.ts +88 -0
  226. package/src/endpoints/__tests__/helpers.spec.ts +37 -0
  227. package/src/endpoints/__tests__/lazyAccessors.spec.ts +330 -0
  228. package/src/endpoints/__tests__/processAudits.spec.ts +631 -0
  229. package/src/endpoints/audit.ts +87 -0
  230. package/src/endpoints/helpers.ts +98 -0
  231. package/src/endpoints/index.ts +42 -0
  232. package/src/endpoints/lazyAccessors.ts +241 -0
  233. package/src/endpoints/parseHonoQuery.ts +16 -0
  234. package/src/endpoints/parseQueryParams.ts +32 -0
  235. package/src/endpoints/processAudits.ts +371 -0
  236. package/src/endpoints/rls.ts +67 -0
  237. package/src/functions/AWSLambdaFunction.ts +374 -0
  238. package/src/functions/BaseFunctionBuilder.ts +212 -0
  239. package/src/functions/Function.ts +238 -0
  240. package/src/functions/FunctionBuilder.ts +381 -0
  241. package/src/functions/FunctionExecutionWrapper.ts +216 -0
  242. package/src/functions/TestFunctionAdaptor.ts +252 -0
  243. package/src/functions/__tests__/AWSLambdaFunctionAdaptor.spec.ts +513 -0
  244. package/src/functions/__tests__/Function.audits.spec.ts +393 -0
  245. package/src/functions/__tests__/Function.spec.ts +477 -0
  246. package/src/functions/__tests__/FunctionBuilder.state-isolation.spec.ts +250 -0
  247. package/src/functions/__tests__/TestFunctionAdaptor.spec.ts +480 -0
  248. package/src/functions/index.ts +12 -0
  249. package/src/index.ts +29 -0
  250. package/src/monitor.ts +145 -0
  251. package/src/monitors/heartbeat.ts +86 -0
  252. package/src/monitors/index.ts +6 -0
  253. package/src/publisher.ts +93 -0
  254. package/src/queue/AWSLambdaQueueAdaptor.ts +162 -0
  255. package/src/queue/Queue.ts +128 -0
  256. package/src/queue/QueueBuilder.ts +115 -0
  257. package/src/queue/TestQueueAdaptor.ts +63 -0
  258. package/src/queue/__tests__/QueueBuilder.spec.ts +137 -0
  259. package/src/queue/index.ts +12 -0
  260. package/src/subscribers/AWSLambdaSubscriberAdaptor.ts +342 -0
  261. package/src/subscribers/Subscriber.ts +117 -0
  262. package/src/subscribers/SubscriberBuilder.ts +183 -0
  263. package/src/subscribers/TestSubscriberAdaptor.ts +133 -0
  264. package/src/subscribers/__tests__/AWSLambdaSubscriberAdaptor.spec.ts +1018 -0
  265. package/src/subscribers/__tests__/Subscriber.spec.ts +430 -0
  266. package/src/subscribers/__tests__/TestSubscriberAdaptor.spec.ts +652 -0
  267. package/src/subscribers/index.ts +6 -0
  268. package/src/telemetry.ts +103 -0
  269. package/src/topic/Topic.ts +103 -0
  270. package/src/topic/TopicBuilder.ts +53 -0
  271. package/src/topic/__tests__/TopicBuilder.spec.ts +82 -0
  272. package/src/topic/index.ts +11 -0
  273. package/src/types.ts +13 -0
  274. package/test.ts +91 -0
  275. package/tsconfig.json +9 -0
  276. package/tsdown.config.ts +35 -0
  277. package/dist/Construct-B1vGBPme.mjs.map +0 -1
  278. package/dist/Construct-BQALFCh2.d.cts +0 -230
  279. package/dist/Construct-BQALFCh2.d.cts.map +0 -1
  280. package/dist/Construct-DUSXuTHP.cjs.map +0 -1
  281. package/dist/Construct-QXnl3VqT.d.mts +0 -230
  282. package/dist/Construct-QXnl3VqT.d.mts.map +0 -1
  283. package/dist/Cron-DI3nKoic.d.cts +0 -45
  284. package/dist/Cron-DI3nKoic.d.cts.map +0 -1
  285. package/dist/Cron-uYAHPnp7.d.mts +0 -45
  286. package/dist/Cron-uYAHPnp7.d.mts.map +0 -1
  287. package/dist/CronBuilder-C0Ek1-RA.cjs +0 -121
  288. package/dist/CronBuilder-C0Ek1-RA.cjs.map +0 -1
  289. package/dist/CronBuilder-DaSUm2Na.d.mts +0 -47
  290. package/dist/CronBuilder-DaSUm2Na.d.mts.map +0 -1
  291. package/dist/CronBuilder-Dmix_Pen.mjs +0 -109
  292. package/dist/CronBuilder-Dmix_Pen.mjs.map +0 -1
  293. package/dist/CronBuilder-g1lZLWyG.d.cts +0 -47
  294. package/dist/CronBuilder-g1lZLWyG.d.cts.map +0 -1
  295. package/dist/Endpoint-BG4UJ9oA.mjs.map +0 -1
  296. package/dist/Endpoint-BoUg8ocM.cjs.map +0 -1
  297. package/dist/Endpoint-Du-NwPX2.d.mts.map +0 -1
  298. package/dist/Endpoint-aCvBMPoH.d.cts.map +0 -1
  299. package/dist/EndpointFactory-BDtsrEvJ.mjs +0 -791
  300. package/dist/EndpointFactory-BDtsrEvJ.mjs.map +0 -1
  301. package/dist/EndpointFactory-DJ7gXLpR.cjs +0 -833
  302. package/dist/EndpointFactory-DJ7gXLpR.cjs.map +0 -1
  303. package/dist/EndpointFactory-DMYdJCOj.d.mts +0 -363
  304. package/dist/EndpointFactory-DMYdJCOj.d.mts.map +0 -1
  305. package/dist/EndpointFactory-I7s1co3Y.d.cts +0 -363
  306. package/dist/EndpointFactory-I7s1co3Y.d.cts.map +0 -1
  307. package/dist/Function-DuqGcbOI.d.mts +0 -76
  308. package/dist/Function-DuqGcbOI.d.mts.map +0 -1
  309. package/dist/Function-Pu-1kKZz.d.cts +0 -76
  310. package/dist/Function-Pu-1kKZz.d.cts.map +0 -1
  311. package/dist/HonoEndpointAdaptor-PtPlbeKY.mjs.map +0 -1
  312. package/dist/HonoEndpointAdaptor-zVzVLJEO.cjs.map +0 -1
  313. package/dist/Queue-A3wfD0it.cjs +0 -109
  314. package/dist/Queue-A3wfD0it.cjs.map +0 -1
  315. package/dist/Queue-D6USGS4q.mjs +0 -104
  316. package/dist/Queue-D6USGS4q.mjs.map +0 -1
  317. package/dist/Queue-DlsHRzUp.d.mts +0 -105
  318. package/dist/Queue-DlsHRzUp.d.mts.map +0 -1
  319. package/dist/Queue-HPyi0e1i.d.cts +0 -105
  320. package/dist/Queue-HPyi0e1i.d.cts.map +0 -1
  321. package/dist/QueueBuilder-BjuF0UBl.cjs +0 -135
  322. package/dist/QueueBuilder-BjuF0UBl.cjs.map +0 -1
  323. package/dist/QueueBuilder-Cue73M4t.mjs +0 -118
  324. package/dist/QueueBuilder-Cue73M4t.mjs.map +0 -1
  325. package/dist/QueueBuilder-OSi6LkV9.d.cts +0 -75
  326. package/dist/QueueBuilder-OSi6LkV9.d.cts.map +0 -1
  327. package/dist/QueueBuilder-QHsnVt1P.d.mts +0 -75
  328. package/dist/QueueBuilder-QHsnVt1P.d.mts.map +0 -1
  329. package/dist/Subscriber-Bpp02cGr.d.cts +0 -61
  330. package/dist/Subscriber-Bpp02cGr.d.cts.map +0 -1
  331. package/dist/Subscriber-CtN9R48-.d.mts +0 -61
  332. package/dist/Subscriber-CtN9R48-.d.mts.map +0 -1
  333. package/dist/SubscriberBuilder-CDy4nHCz.mjs +0 -134
  334. package/dist/SubscriberBuilder-CDy4nHCz.mjs.map +0 -1
  335. package/dist/SubscriberBuilder-CuCMFpYW.d.mts +0 -67
  336. package/dist/SubscriberBuilder-CuCMFpYW.d.mts.map +0 -1
  337. package/dist/SubscriberBuilder-D_owVoHo.cjs +0 -145
  338. package/dist/SubscriberBuilder-D_owVoHo.cjs.map +0 -1
  339. package/dist/SubscriberBuilder-g3fAVWgs.d.cts +0 -67
  340. package/dist/SubscriberBuilder-g3fAVWgs.d.cts.map +0 -1
  341. package/dist/Topic-D74b5cgs.mjs +0 -99
  342. package/dist/Topic-D74b5cgs.mjs.map +0 -1
  343. package/dist/Topic-GHxcU8AG.cjs +0 -104
  344. package/dist/Topic-GHxcU8AG.cjs.map +0 -1
  345. package/dist/auth-BMCJN30Y.d.cts +0 -268
  346. package/dist/auth-BMCJN30Y.d.cts.map +0 -1
  347. package/dist/auth-CcuceLYo.d.mts +0 -268
  348. package/dist/auth-CcuceLYo.d.mts.map +0 -1
  349. package/dist/auth.cjs +0 -433
  350. package/dist/auth.cjs.map +0 -1
  351. package/dist/auth.d.cts +0 -2
  352. package/dist/auth.d.mts +0 -2
  353. package/dist/auth.mjs +0 -426
  354. package/dist/auth.mjs.map +0 -1
  355. package/dist/cache-CXh6GIgb.d.mts +0 -44
  356. package/dist/cache-CXh6GIgb.d.mts.map +0 -1
  357. package/dist/cache-DnGDGly3.d.cts +0 -44
  358. package/dist/cache-DnGDGly3.d.cts.map +0 -1
  359. package/dist/cache.cjs +0 -69
  360. package/dist/cache.cjs.map +0 -1
  361. package/dist/cache.d.cts +0 -2
  362. package/dist/cache.d.mts +0 -2
  363. package/dist/cache.mjs +0 -68
  364. package/dist/cache.mjs.map +0 -1
  365. package/dist/cipher-C1lEFX63.mjs +0 -225
  366. package/dist/cipher-C1lEFX63.mjs.map +0 -1
  367. package/dist/cipher-CVxfwLjk.cjs +0 -332
  368. package/dist/cipher-CVxfwLjk.cjs.map +0 -1
  369. package/dist/clone-EKNovYHu.mjs.map +0 -1
  370. package/dist/clone-UGJpvQnL.cjs.map +0 -1
  371. package/dist/construct-interface-B1AfqRl4.d.cts +0 -162
  372. package/dist/construct-interface-B1AfqRl4.d.cts.map +0 -1
  373. package/dist/construct-interface-DluK3_da.d.mts +0 -162
  374. package/dist/construct-interface-DluK3_da.d.mts.map +0 -1
  375. package/dist/construct-interface.cjs +0 -114
  376. package/dist/construct-interface.cjs.map +0 -1
  377. package/dist/construct-interface.d.cts +0 -2
  378. package/dist/construct-interface.d.mts +0 -2
  379. package/dist/construct-interface.mjs +0 -107
  380. package/dist/construct-interface.mjs.map +0 -1
  381. package/dist/credential.cjs +0 -156
  382. package/dist/credential.cjs.map +0 -1
  383. package/dist/credential.d.cts +0 -86
  384. package/dist/credential.d.cts.map +0 -1
  385. package/dist/credential.d.mts +0 -86
  386. package/dist/credential.d.mts.map +0 -1
  387. package/dist/credential.mjs +0 -152
  388. package/dist/credential.mjs.map +0 -1
  389. package/dist/database/kysely.cjs +0 -4
  390. package/dist/database/kysely.d.cts +0 -2
  391. package/dist/database/kysely.d.mts +0 -2
  392. package/dist/database/kysely.mjs +0 -2
  393. package/dist/email.cjs +0 -72
  394. package/dist/email.cjs.map +0 -1
  395. package/dist/email.d.cts +0 -46
  396. package/dist/email.d.cts.map +0 -1
  397. package/dist/email.d.mts +0 -46
  398. package/dist/email.d.mts.map +0 -1
  399. package/dist/email.mjs +0 -71
  400. package/dist/email.mjs.map +0 -1
  401. package/dist/encryption.cjs +0 -96
  402. package/dist/encryption.cjs.map +0 -1
  403. package/dist/encryption.d.cts +0 -117
  404. package/dist/encryption.d.cts.map +0 -1
  405. package/dist/encryption.d.mts +0 -117
  406. package/dist/encryption.d.mts.map +0 -1
  407. package/dist/encryption.mjs +0 -83
  408. package/dist/encryption.mjs.map +0 -1
  409. package/dist/external-api-MJ8id87V.d.mts +0 -105
  410. package/dist/external-api-MJ8id87V.d.mts.map +0 -1
  411. package/dist/external-api-O107yzZJ.d.cts +0 -105
  412. package/dist/external-api-O107yzZJ.d.cts.map +0 -1
  413. package/dist/external-api.cjs +0 -142
  414. package/dist/external-api.cjs.map +0 -1
  415. package/dist/external-api.d.cts +0 -2
  416. package/dist/external-api.d.mts +0 -2
  417. package/dist/external-api.mjs +0 -139
  418. package/dist/external-api.mjs.map +0 -1
  419. package/dist/file-server.cjs +0 -186
  420. package/dist/file-server.cjs.map +0 -1
  421. package/dist/file-server.d.cts +0 -152
  422. package/dist/file-server.d.cts.map +0 -1
  423. package/dist/file-server.d.mts +0 -152
  424. package/dist/file-server.d.mts.map +0 -1
  425. package/dist/file-server.mjs +0 -184
  426. package/dist/file-server.mjs.map +0 -1
  427. package/dist/functions-BFizikJU.mjs.map +0 -1
  428. package/dist/functions-CfzJG9hK.cjs.map +0 -1
  429. package/dist/index-BuzRvKOQ.d.cts +0 -115
  430. package/dist/index-BuzRvKOQ.d.cts.map +0 -1
  431. package/dist/index-CTkKOer4.d.mts +0 -115
  432. package/dist/index-CTkKOer4.d.mts.map +0 -1
  433. package/dist/index-CeEtxDmK.d.cts +0 -79
  434. package/dist/index-CeEtxDmK.d.cts.map +0 -1
  435. package/dist/index-CeEtxDmK.d.mts +0 -79
  436. package/dist/index-CeEtxDmK.d.mts.map +0 -1
  437. package/dist/index.d.cts.map +0 -1
  438. package/dist/index.d.mts.map +0 -1
  439. package/dist/kms-B-Hm3d5r.cjs +0 -85
  440. package/dist/kms-B-Hm3d5r.cjs.map +0 -1
  441. package/dist/kms-BdUlMJEZ.mjs +0 -85
  442. package/dist/kms-BdUlMJEZ.mjs.map +0 -1
  443. package/dist/kysely-Bii4l6eP.mjs +0 -370
  444. package/dist/kysely-Bii4l6eP.mjs.map +0 -1
  445. package/dist/kysely-CO_Dk43W.cjs +0 -383
  446. package/dist/kysely-CO_Dk43W.cjs.map +0 -1
  447. package/dist/kysely-D0bpzgPs.d.cts +0 -175
  448. package/dist/kysely-D0bpzgPs.d.cts.map +0 -1
  449. package/dist/kysely-DUqC3Ie0.d.mts +0 -175
  450. package/dist/kysely-DUqC3Ie0.d.mts.map +0 -1
  451. package/dist/lambdaTelemetry-8vnmVZQ5.d.cts.map +0 -1
  452. package/dist/lambdaTelemetry-8vnmVZQ5.d.mts.map +0 -1
  453. package/dist/lazyAccessors-CFanua0O.mjs +0 -174
  454. package/dist/lazyAccessors-CFanua0O.mjs.map +0 -1
  455. package/dist/lazyAccessors-hJKGv8Ay.cjs +0 -221
  456. package/dist/lazyAccessors-hJKGv8Ay.cjs.map +0 -1
  457. package/dist/mobile-app.cjs +0 -73
  458. package/dist/mobile-app.cjs.map +0 -1
  459. package/dist/mobile-app.d.cts +0 -61
  460. package/dist/mobile-app.d.cts.map +0 -1
  461. package/dist/mobile-app.d.mts +0 -61
  462. package/dist/mobile-app.d.mts.map +0 -1
  463. package/dist/mobile-app.mjs +0 -72
  464. package/dist/mobile-app.mjs.map +0 -1
  465. package/dist/object-storage.cjs +0 -56
  466. package/dist/object-storage.cjs.map +0 -1
  467. package/dist/object-storage.d.cts +0 -32
  468. package/dist/object-storage.d.cts.map +0 -1
  469. package/dist/object-storage.d.mts +0 -32
  470. package/dist/object-storage.d.mts.map +0 -1
  471. package/dist/object-storage.mjs +0 -55
  472. package/dist/object-storage.mjs.map +0 -1
  473. package/dist/processAudits-BRRVVHUB.mjs +0 -131
  474. package/dist/processAudits-BRRVVHUB.mjs.map +0 -1
  475. package/dist/processAudits-DasOZjPl.cjs +0 -154
  476. package/dist/processAudits-DasOZjPl.cjs.map +0 -1
  477. package/dist/rest-api.cjs +0 -216
  478. package/dist/rest-api.cjs.map +0 -1
  479. package/dist/rest-api.d.cts +0 -241
  480. package/dist/rest-api.d.cts.map +0 -1
  481. package/dist/rest-api.d.mts +0 -241
  482. package/dist/rest-api.d.mts.map +0 -1
  483. package/dist/rest-api.mjs +0 -215
  484. package/dist/rest-api.mjs.map +0 -1
  485. package/dist/rolldown-runtime-y5ARvAq5.cjs +0 -35
  486. package/dist/runSubscriber-BHvJ8POr.mjs +0 -109
  487. package/dist/runSubscriber-BHvJ8POr.mjs.map +0 -1
  488. package/dist/runSubscriber-D8nLXIv1.cjs +0 -126
  489. package/dist/runSubscriber-D8nLXIv1.cjs.map +0 -1
  490. package/dist/shutdown-BMJmAhSt.cjs +0 -38
  491. package/dist/shutdown-BMJmAhSt.cjs.map +0 -1
  492. package/dist/shutdown-C7xa8x9S.mjs +0 -27
  493. package/dist/shutdown-C7xa8x9S.mjs.map +0 -1
  494. package/dist/site.cjs +0 -74
  495. package/dist/site.cjs.map +0 -1
  496. package/dist/site.d.cts +0 -104
  497. package/dist/site.d.cts.map +0 -1
  498. package/dist/site.d.mts +0 -104
  499. package/dist/site.d.mts.map +0 -1
  500. package/dist/site.mjs +0 -73
  501. package/dist/site.mjs.map +0 -1
  502. package/dist/stages-BSCF19o2.d.cts +0 -56
  503. package/dist/stages-BSCF19o2.d.cts.map +0 -1
  504. package/dist/stages-BSCF19o2.d.mts +0 -56
  505. package/dist/stages-BSCF19o2.d.mts.map +0 -1
  506. package/dist/surfaceEnv-CNimK76p.cjs +0 -56
  507. package/dist/surfaceEnv-CNimK76p.cjs.map +0 -1
  508. package/dist/surfaceEnv-wMT5QzgZ.mjs +0 -45
  509. package/dist/surfaceEnv-wMT5QzgZ.mjs.map +0 -1
  510. package/dist/telemetry-B48RLjyk.d.cts +0 -40
  511. package/dist/telemetry-B48RLjyk.d.cts.map +0 -1
  512. package/dist/telemetry-DRtT1_0A.d.mts +0 -40
  513. package/dist/telemetry-DRtT1_0A.d.mts.map +0 -1
  514. package/dist/telemetry.cjs +0 -56
  515. package/dist/telemetry.cjs.map +0 -1
  516. package/dist/telemetry.d.cts +0 -2
  517. package/dist/telemetry.d.mts +0 -2
  518. package/dist/telemetry.mjs +0 -55
  519. package/dist/telemetry.mjs.map +0 -1
  520. package/dist/tracing-CxaZ98IB.mjs +0 -110
  521. package/dist/tracing-CxaZ98IB.mjs.map +0 -1
  522. package/dist/tracing-DPMidF_r.cjs +0 -127
  523. package/dist/tracing-DPMidF_r.cjs.map +0 -1
  524. package/dist/types-DMuSQeLL.d.cts.map +0 -1
  525. package/dist/types-DMuSQeLL.d.mts.map +0 -1
  526. package/dist/worker.cjs +0 -191
  527. package/dist/worker.cjs.map +0 -1
  528. package/dist/worker.d.cts +0 -171
  529. package/dist/worker.d.cts.map +0 -1
  530. package/dist/worker.d.mts +0 -171
  531. package/dist/worker.d.mts.map +0 -1
  532. package/dist/worker.mjs +0 -190
  533. package/dist/worker.mjs.map +0 -1
@@ -1,230 +0,0 @@
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
@@ -1 +0,0 @@
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 +0,0 @@
1
- {"version":3,"file":"Construct-DUSXuTHP.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{ 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}\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,KAAK,MAAM,GACb,uDACD;GAEA,OAAO,CAAC;EACT;CACD;AACD;AAEA,IAAY,gBAAL,yBAAA,eAAA;CACN,cAAA,UAAA;CACA,cAAA,cAAA;CACA,cAAA,cAAA;CACA,cAAA,gBAAA;CACA,cAAA,WAAA;CACA,cAAA,WAAA;;AACD,EAAA,CAAA,CAAA;;;;;;;;;;;;;;;AAgBA,eAAsB,aAAa,SAAwC;CAC1E,MAAM,UAAU,IAAIC,0BAAAA,yBAAyB;CAE7C,QAAA,GAAOC,0BAAAA,uBAAAA,CAAuB,eAC7B,QAAQ,SAAS;EAChB,WAAW;EACX,SAAS;CACV,CAAC,CACF;AACD"}
@@ -1,230 +0,0 @@
1
- import { t as StandardSchemaV1 } from "./index-CeEtxDmK.mjs";
2
- import { SniffResult } from "@geekmidas/envkit/sniffer";
3
- import { ConstructName, Declaration } from "@geekmidas/manifest";
4
- import { EventPublisher, PublishableMessage } from "@geekmidas/events";
5
- import { Service, ServiceContext, ServiceDiscovery } from "@geekmidas/services";
6
- import { AuditStorage } from "@geekmidas/audit";
7
- import { Logger } from "@geekmidas/logger";
8
- import { InferStandardSchema } from "@geekmidas/schema";
9
- //#region src/topic/Topic.d.ts
10
- /** A topic's event contract — a map of event type → payload schema. */
11
- type TopicEvents = Record<string, StandardSchemaV1>;
12
- /**
13
- * The union of wire messages a topic carries, derived from its event map:
14
- * `{ type: 'user.created'; payload: … } | { type: 'user.updated'; payload: … }`.
15
- */
16
- type TopicMessage<TEvents extends TopicEvents> = { [K in keyof TEvents & string]: PublishableMessage<K, InferStandardSchema<TEvents[K]>>; }[keyof TEvents & string];
17
- /**
18
- * A topic — pub/sub fan-out. Unlike a `Queue` (point-to-point, one consumer), a
19
- * topic is a *resource* owned by no single handler: it declares the event
20
- * contract, and any number of subscribers (`worker.topic(topic)`) bind to it.
21
- * `gkm build` discovers it into the manifest's `topics` field; infra provisions
22
- * an SNS topic.
23
- *
24
- * A construct publishes with `.event(topic, { type, payload })`, repeatable
25
- * across topics, each event going through its own topic's publisher. That also
26
- * puts `services.<topic>` in the handler, as `.dependsOn([topic])` does, for an
27
- * event the handler decides on itself.
28
- *
29
- * ```ts
30
- * export const users = new Topic('Users', {
31
- * events: { 'user.created': z.object({ userId: z.string() }) },
32
- * });
33
- * ```
34
- */
35
- declare class Topic<TName extends string = string, TEvents extends TopicEvents = TopicEvents> extends Construct {
36
- __IS_TOPIC__: boolean;
37
- static isTopic(obj: unknown): obj is Topic<string, TopicEvents>;
38
- /**
39
- * The canonical id this topic is declared under.
40
- *
41
- * Derived from the name, so `users` and `Users` are one topic. The name is
42
- * left alone: subscribers bind to it and it is what the broker routes on.
43
- */
44
- readonly id: string;
45
- /** The name it was declared with — what the broker routes on. */
46
- readonly name: TName;
47
- /**
48
- * The event contract — a map of event type → payload schema. Named
49
- * `eventSchemas` (not `events`) to avoid clashing with `Construct.events`,
50
- * which is the array of `MappedEvent`s a construct *publishes*.
51
- */
52
- readonly eventSchemas: TEvents;
53
- /**
54
- * The topic as a dependency — what `.dependsOn([users])` and
55
- * `.event(users, …)` dissolve into, reachable as `services.users`.
56
- *
57
- * The producer, because publishing is the only thing depending on a topic
58
- * can mean: a subscriber binds to the topic instead, and is never handed
59
- * this. It reads `<NAME>_PUBLISHER_CONNECTION_STRING` and picks the
60
- * transport from its protocol — `pgboss://` locally, `sns://` deployed.
61
- *
62
- * A field assigned once, not a getter: services are cached by object
63
- * identity, and a fresh literal on every access never hit that cache.
64
- */
65
- readonly service: Service<Uncapitalize<TName>, EventPublisher<TopicMessage<TEvents>>>;
66
- /** The producer's env key, read by both {@link declare} and the service. */
67
- private readonly connectionKey;
68
- constructor(name: ConstructName<TName>, options: TopicOptions<TEvents>);
69
- /**
70
- * What this topic is in the manifest.
71
- *
72
- * Only the producer's key: a subscriber is *bound* to a topic rather than
73
- * depending on it, so the binding is an edge the deploy target reads and not
74
- * an env key anyone can hold. Locally both sides meet on the same broker.
75
- */
76
- declare(): Declaration[];
77
- /** The event type names this topic carries. */
78
- get eventTypes(): (keyof TEvents & string)[];
79
- }
80
- interface TopicOptions<TEvents extends TopicEvents> {
81
- /** Each event this topic carries — its type, and its payload's schema. */
82
- events: TEvents;
83
- }
84
- //#endregion
85
- //#region src/publisher.d.ts
86
- /**
87
- * An event a construct publishes to a topic once its handler has succeeded.
88
- *
89
- * It carries its topic, so a construct can publish to as many topics as it
90
- * names — each event goes through the publisher of the topic it was declared
91
- * against, never a single shared one.
92
- */
93
- interface TopicEvent<TOutput = any> {
94
- /** The topic's service: the publisher this event is sent through. */
95
- topic: Service<string, EventPublisher<any>>;
96
- type: string;
97
- /** The event's payload, from what the handler returned. */
98
- payload: (output: TOutput) => unknown;
99
- /** Publish only when this holds for what the handler returned. */
100
- when?: (output: TOutput) => boolean;
101
- }
102
- /**
103
- * What `.event(topic, …)` takes: one of the topic's event types, and a payload
104
- * of that event's shape built from the handler's output.
105
- */
106
- type EventFor<TTopic extends Topic<any, any>, TOutput> = TTopic extends Topic<string, infer TEvents> ? { [K in keyof TEvents & string]: {
107
- type: K;
108
- payload: (output: TOutput) => InferStandardSchema<TEvents[K]>;
109
- when?: (output: TOutput) => boolean;
110
- }; }[keyof TEvents & string] : never;
111
- /** Publish a construct's declared events for what its handler returned. */
112
- declare function publishConstructEvents<OutSchema extends StandardSchemaV1 | undefined = undefined>(construct: Pick<Construct, 'events' | 'logger'>, response: InferStandardSchema<OutSchema>, serviceDiscovery: ServiceDiscovery<any>, logger?: Logger, provided?: Readonly<Record<string, unknown>>): Promise<void>;
113
- //#endregion
114
- //#region src/Construct.d.ts
115
- /**
116
- * Noop context for environment sniffing.
117
- * Used when calling service.register() to detect env vars without a real request.
118
- * Returns dummy values since services should only use context in instance methods,
119
- * not during registration.
120
- */
121
- declare const snifferContext: ServiceContext;
122
- declare abstract class Construct<TLogger extends Logger = Logger, OutSchema extends StandardSchemaV1 | undefined = undefined, TServices extends Service[] = [], TAuditStorageServiceName extends string = string, TAuditStorage extends AuditStorage | undefined = undefined, TDatabaseServiceName extends string = string, TDatabase = unknown> {
123
- readonly type: ConstructType;
124
- readonly logger: TLogger;
125
- readonly services: TServices;
126
- /**
127
- * What this construct publishes once its handler succeeds — each event
128
- * bound to its own topic, so a construct publishes to as many as it names.
129
- */
130
- readonly events: TopicEvent[];
131
- outputSchema?: OutSchema | undefined;
132
- readonly timeout?: number | undefined;
133
- readonly memorySize?: number | undefined;
134
- readonly auditorStorageService?: Service<TAuditStorageServiceName, TAuditStorage>;
135
- /**
136
- * The constructs this one declared an edge to, by id.
137
- *
138
- * What the manifest records. `services` is the same information in the
139
- * form a handler runs with — clients, keyed by name — and an id cannot be
140
- * recovered from one of those reliably, so both are kept.
141
- *
142
- * Last in the list because every other parameter is positional and already
143
- * spoken for; a new one anywhere else silently rebinds existing callers.
144
- */
145
- readonly constructs: string[];
146
- /** Database service for this construct (used by Endpoint for RLS/audit context) */
147
- databaseService?: Service<TDatabaseServiceName, TDatabase>;
148
- /**
149
- * The deploy unit that runs this, by construct id.
150
- *
151
- * What an endpoint's `surface` is to it, and for the same reason: something
152
- * has to say which process a runnable belongs to, and until this existed the
153
- * only thing that said so was the directory its file sat in. Set by the
154
- * factory it was built from — `worker.crons`, `api.get(…)` — so it is
155
- * carried rather than configured.
156
- *
157
- * Undefined for a construct built from a free-standing builder, which is
158
- * still how `c`, `s` and `f` work.
159
- */
160
- owner?: string;
161
- constructor(type: ConstructType, logger: TLogger, services: TServices,
162
- /**
163
- * What this construct publishes once its handler succeeds — each event
164
- * bound to its own topic, so a construct publishes to as many as it names.
165
- */
166
- events?: TopicEvent[], outputSchema?: OutSchema | undefined, timeout?: number | undefined, memorySize?: number | undefined, auditorStorageService?: Service<TAuditStorageServiceName, TAuditStorage>,
167
- /**
168
- * The constructs this one declared an edge to, by id.
169
- *
170
- * What the manifest records. `services` is the same information in the
171
- * form a handler runs with — clients, keyed by name — and an id cannot be
172
- * recovered from one of those reliably, so both are kept.
173
- *
174
- * Last in the list because every other parameter is positional and already
175
- * spoken for; a new one anywhere else silently rebinds existing callers.
176
- */
177
- constructs?: string[]);
178
- /**
179
- * Returns an array of environment variable names required by this construct's services.
180
- * This is determined by running a "sniffer" EnvironmentParser through each service's
181
- * register method to track which environment variables are accessed.
182
- *
183
- * Results are cached per service class to handle singleton patterns where
184
- * subsequent register() calls may short-circuit and not access env vars.
185
- *
186
- * @param markOptional - When true, optional vars (those accessed via `.optional()` or
187
- * `.default()`) are suffixed with `?` in the returned array (e.g. `'PORT?'`).
188
- * @returns Promise that resolves to array of environment variable names, sorted alphabetically
189
- *
190
- * @example
191
- * ```typescript
192
- * const endpoint = e
193
- * .services([databaseService, authService])
194
- * .get('/users')
195
- * .handle(async () => []);
196
- *
197
- * await endpoint.getEnvironment(); // ['AUTH_SECRET', 'DATABASE_URL']
198
- * await endpoint.getEnvironment({ markOptional: true }); // ['AUTH_SECRET', 'DATABASE_URL', 'PORT?']
199
- * ```
200
- */
201
- getEnvironment(opts?: {
202
- markOptional?: boolean;
203
- }): Promise<string[]>;
204
- }
205
- declare enum ConstructType {
206
- Cron = "dev.geekmidas.function.cron",
207
- Endpoint = "dev.geekmidas.function.endpoint",
208
- Function = "dev.geekmidas.function.function",
209
- Subscriber = "dev.geekmidas.function.subscriber",
210
- Queue = "dev.geekmidas.function.queue",
211
- Topic = "dev.geekmidas.resource.topic"
212
- }
213
- /**
214
- * Utility to test sniffing a service for environment variables.
215
- * Useful for debugging services that throw errors during sniffing.
216
- *
217
- * @example
218
- * ```typescript
219
- * import { sniffService } from '@geekmidas/constructs';
220
- * import { authService } from './services/AuthService';
221
- *
222
- * const result = await sniffService(authService);
223
- * console.log('Env vars:', result.envVars);
224
- * console.log('Error:', result.error);
225
- * ```
226
- */
227
- declare function sniffService(service: Service): Promise<SniffResult>;
228
- //#endregion
229
- export { EventFor as a, Topic as c, TopicOptions as d, snifferContext as i, TopicEvents as l, ConstructType as n, TopicEvent as o, sniffService as r, publishConstructEvents as s, Construct as t, TopicMessage as u };
230
- //# sourceMappingURL=Construct-QXnl3VqT.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Construct-QXnl3VqT.d.mts","names":[],"sources":["../src/topic/Topic.ts","../src/publisher.ts","../src/Construct.ts"],"mappings":";;;;;;;;;;KAoBY,cAAc,eAAe;;;;;KAM7B,aAAa,gBAAgB,kBACvC,WAAW,mBAAmB,mBAC9B,GACA,oBAAoB,QAAQ,cAEtB;;;;;;;;;;;;;;;;;;;cAoBK,MACZ,+BACA,gBAAgB,cAAc,qBACrB;EACT;SAEO,QAAQ,eAAe,OAAO,cAAc;;;;;;;WAc1C;;WAGA,MAAM;;;;;;WAON,cAAc;;;;;;;;;;;;;WAcd,SAAS,QACjB,aAAa,QACb,eAAe,aAAa;;mBAIZ;EAEjB,YAAY,MAAM,cAAc,QAAQ,SAAS,aAAa;;;;;;;;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,45 +0,0 @@
1
- import { t as StandardSchemaV1 } from "./index-CeEtxDmK.cjs";
2
- import { o as TopicEvent } from "./Construct-BQALFCh2.cjs";
3
- import { i as FunctionHandler, n as Function } from "./Function-Pu-1kKZz.cjs";
4
- import "./index-BuzRvKOQ.cjs";
5
- import { Logger } from "@geekmidas/logger";
6
- import { ComposableStandardSchema } from "@geekmidas/schema";
7
- import { Service } from "@geekmidas/services";
8
- import { AuditableAction } from "@geekmidas/audit";
9
- //#region src/crons/Cron.d.ts
10
- declare class Cron<TInput extends ComposableStandardSchema | undefined = undefined, TServices extends Service[] = [], TLogger extends Logger = Logger, OutSchema extends StandardSchemaV1 | undefined = undefined, TDatabase = undefined, TDatabaseServiceName extends string = string> extends Function<TInput, TServices, TLogger, OutSchema, undefined, string, TDatabase, TDatabaseServiceName, AuditableAction<string, unknown>, FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase>> {
11
- protected _schedule?: ScheduleExpression | undefined;
12
- /**
13
- * Where this cron's schedule lives when a server runs it.
14
- *
15
- * Carried from the worker that built it, which declared it once with
16
- * `.database(db)`. Unread on AWS, where the schedule is an EventBridge rule
17
- * and nothing in this process fires anything.
18
- *
19
- * A service rather than the construct, because what reads it is service
20
- * discovery in the generated server — which registers services, and failed
21
- * on the construct with `service.register is not a function`.
22
- */
23
- scheduleStore?: Service<string, unknown>;
24
- static isCron(obj: any): obj is Cron<any, any, any, any>;
25
- constructor(fn: FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase>, timeout?: number, _schedule?: ScheduleExpression | undefined, input?: TInput, outputSchema?: OutSchema, services?: TServices, logger?: TLogger,
26
- /** What it publishes once it has run, each to its own topic. */
27
- events?: TopicEvent[], memorySize?: number, databaseService?: Service<TDatabaseServiceName, TDatabase>,
28
- /**
29
- * The construct ids `.dependsOn()` named — last, so no existing positional
30
- * argument moves.
31
- */
32
- constructs?: string[]);
33
- get schedule(): ScheduleExpression | undefined;
34
- }
35
- type RateExpression = `rate(${string})`;
36
- type CronMinute = '*' | number | `${number}` | `${number}-${number}` | `${number}/${number}` | `*/${number}` | `${number},${number}` | string;
37
- type CronHour = '*' | number | `${number}` | `${number}-${number}` | `${number}/${number}` | `*/${number}` | `${number},${number}` | string;
38
- type CronDay = '*' | number | `${number}` | `${number}-${number}` | `${number}/${number}` | `*/${number}` | `${number},${number}` | string;
39
- type CronMonth = '*' | number | `${number}` | `${number}-${number}` | `${number}/${number}` | `*/${number}` | 'JAN' | 'FEB' | 'MAR' | 'APR' | 'MAY' | 'JUN' | 'JUL' | 'AUG' | 'SEP' | 'OCT' | 'NOV' | 'DEC' | string;
40
- type CronWeekday = '*' | number | `${number}` | `${number}-${number}` | `${number}/${number}` | `*/${number}` | 'SUN' | 'MON' | 'TUE' | 'WED' | 'THU' | 'FRI' | 'SAT' | `${string}-${string}` | string;
41
- type CronExpression = `cron(${CronMinute} ${CronHour} ${CronDay} ${CronMonth} ${CronWeekday})`;
42
- type ScheduleExpression = RateExpression | CronExpression;
43
- //#endregion
44
- export { ScheduleExpression as i, CronExpression as n, RateExpression as r, Cron as t };
45
- //# sourceMappingURL=Cron-DI3nKoic.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Cron-DI3nKoic.d.cts","names":[],"sources":["../src/crons/Cron.ts"],"mappings":";;;;;;;;;cAUa,KACZ,eAAe,kDACf,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,kBAAkB,0CAClB,uBACA,sDACS,SACT,QACA,WACA,SACA,8BAGA,WACA,sBACA,kCACA,gBAAgB,QAAQ,WAAW,SAAS,WAAW;YA0B5C,YAAY;;;;;;;;;;;;EAbvB,gBAAgB;SAET,OAAO,WAAW,OAAO;EAQhC,YACC,IAAI,gBAAgB,QAAQ,WAAW,SAAS,WAAW,YAC3D,kBACU,YAAY,gCACtB,QAAQ,QACR,eAAe,WACf,WAAU,WACV,SAAS,SAET;;EAAA,SAAQ,cACR,qBACA,kBAAkB,QAAQ,sBAAsB,YAKhD;;;;;EAAA;MAkBG,YAAY;;KAKL;KAEP;KAUA;KAUA;KAUA;KAqBA;KAiBO,yBACH,cAAc,YAAY,WAAW,aAAa;KAE/C,qBAAqB,iBAAiB"}
@@ -1,45 +0,0 @@
1
- import { t as StandardSchemaV1 } from "./index-CeEtxDmK.mjs";
2
- import { o as TopicEvent } from "./Construct-QXnl3VqT.mjs";
3
- import { i as FunctionHandler, n as Function } from "./Function-DuqGcbOI.mjs";
4
- import "./index-CTkKOer4.mjs";
5
- import { Service } from "@geekmidas/services";
6
- import { AuditableAction } from "@geekmidas/audit";
7
- import { Logger } from "@geekmidas/logger";
8
- import { ComposableStandardSchema } from "@geekmidas/schema";
9
- //#region src/crons/Cron.d.ts
10
- declare class Cron<TInput extends ComposableStandardSchema | undefined = undefined, TServices extends Service[] = [], TLogger extends Logger = Logger, OutSchema extends StandardSchemaV1 | undefined = undefined, TDatabase = undefined, TDatabaseServiceName extends string = string> extends Function<TInput, TServices, TLogger, OutSchema, undefined, string, TDatabase, TDatabaseServiceName, AuditableAction<string, unknown>, FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase>> {
11
- protected _schedule?: ScheduleExpression | undefined;
12
- /**
13
- * Where this cron's schedule lives when a server runs it.
14
- *
15
- * Carried from the worker that built it, which declared it once with
16
- * `.database(db)`. Unread on AWS, where the schedule is an EventBridge rule
17
- * and nothing in this process fires anything.
18
- *
19
- * A service rather than the construct, because what reads it is service
20
- * discovery in the generated server — which registers services, and failed
21
- * on the construct with `service.register is not a function`.
22
- */
23
- scheduleStore?: Service<string, unknown>;
24
- static isCron(obj: any): obj is Cron<any, any, any, any>;
25
- constructor(fn: FunctionHandler<TInput, TServices, TLogger, OutSchema, TDatabase>, timeout?: number, _schedule?: ScheduleExpression | undefined, input?: TInput, outputSchema?: OutSchema, services?: TServices, logger?: TLogger,
26
- /** What it publishes once it has run, each to its own topic. */
27
- events?: TopicEvent[], memorySize?: number, databaseService?: Service<TDatabaseServiceName, TDatabase>,
28
- /**
29
- * The construct ids `.dependsOn()` named — last, so no existing positional
30
- * argument moves.
31
- */
32
- constructs?: string[]);
33
- get schedule(): ScheduleExpression | undefined;
34
- }
35
- type RateExpression = `rate(${string})`;
36
- type CronMinute = '*' | number | `${number}` | `${number}-${number}` | `${number}/${number}` | `*/${number}` | `${number},${number}` | string;
37
- type CronHour = '*' | number | `${number}` | `${number}-${number}` | `${number}/${number}` | `*/${number}` | `${number},${number}` | string;
38
- type CronDay = '*' | number | `${number}` | `${number}-${number}` | `${number}/${number}` | `*/${number}` | `${number},${number}` | string;
39
- type CronMonth = '*' | number | `${number}` | `${number}-${number}` | `${number}/${number}` | `*/${number}` | 'JAN' | 'FEB' | 'MAR' | 'APR' | 'MAY' | 'JUN' | 'JUL' | 'AUG' | 'SEP' | 'OCT' | 'NOV' | 'DEC' | string;
40
- type CronWeekday = '*' | number | `${number}` | `${number}-${number}` | `${number}/${number}` | `*/${number}` | 'SUN' | 'MON' | 'TUE' | 'WED' | 'THU' | 'FRI' | 'SAT' | `${string}-${string}` | string;
41
- type CronExpression = `cron(${CronMinute} ${CronHour} ${CronDay} ${CronMonth} ${CronWeekday})`;
42
- type ScheduleExpression = RateExpression | CronExpression;
43
- //#endregion
44
- export { ScheduleExpression as i, CronExpression as n, RateExpression as r, Cron as t };
45
- //# sourceMappingURL=Cron-uYAHPnp7.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Cron-uYAHPnp7.d.mts","names":[],"sources":["../src/crons/Cron.ts"],"mappings":";;;;;;;;;cAUa,KACZ,eAAe,kDACf,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,kBAAkB,0CAClB,uBACA,sDACS,SACT,QACA,WACA,SACA,8BAGA,WACA,sBACA,kCACA,gBAAgB,QAAQ,WAAW,SAAS,WAAW;YA0B5C,YAAY;;;;;;;;;;;;EAbvB,gBAAgB;SAET,OAAO,WAAW,OAAO;EAQhC,YACC,IAAI,gBAAgB,QAAQ,WAAW,SAAS,WAAW,YAC3D,kBACU,YAAY,gCACtB,QAAQ,QACR,eAAe,WACf,WAAU,WACV,SAAS,SAET;;EAAA,SAAQ,cACR,qBACA,kBAAkB,QAAQ,sBAAsB,YAKhD;;;;;EAAA;MAkBG,YAAY;;KAKL;KAEP;KAUA;KAUA;KAUA;KAqBA;KAiBO,yBACH,cAAc,YAAY,WAAW,aAAa;KAE/C,qBAAqB,iBAAiB"}