@geekmidas/constructs 7.0.1 → 10.0.0-alpha.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 (385) hide show
  1. package/README.md +71 -44
  2. package/dist/{AWSScheduledFunction-ysaCsdWx.d.mts → AWSScheduledFunction-BvFvBsBN.d.cts} +10 -5
  3. package/dist/{AWSScheduledFunction-ysaCsdWx.d.mts.map → AWSScheduledFunction-BvFvBsBN.d.cts.map} +1 -1
  4. package/dist/{AWSScheduledFunction-CTIa90EH.d.cts → AWSScheduledFunction-CVccZO-L.d.mts} +10 -5
  5. package/dist/{AWSScheduledFunction-CTIa90EH.d.cts.map → AWSScheduledFunction-CVccZO-L.d.mts.map} +1 -1
  6. package/dist/{AWSScheduledFunction-CufMMhGB.mjs → AWSScheduledFunction-Db1lttJH.mjs} +3 -3
  7. package/dist/{AWSScheduledFunction-CufMMhGB.mjs.map → AWSScheduledFunction-Db1lttJH.mjs.map} +1 -1
  8. package/dist/{AWSScheduledFunction-DbkDr8CA.cjs → AWSScheduledFunction-qu4ieRZR.cjs} +9 -9
  9. package/dist/{AWSScheduledFunction-DbkDr8CA.cjs.map → AWSScheduledFunction-qu4ieRZR.cjs.map} +1 -1
  10. package/dist/{Construct-_1wX7p_Y.d.cts → Construct-B-xc0SE9.d.mts} +27 -5
  11. package/dist/Construct-B-xc0SE9.d.mts.map +1 -0
  12. package/dist/{Construct-r0U2zBwW.mjs → Construct-HmWM6YYu.mjs} +4 -3
  13. package/dist/Construct-HmWM6YYu.mjs.map +1 -0
  14. package/dist/{Construct-DCMuYOox.d.mts → Construct-WhCXIOPV.d.cts} +29 -7
  15. package/dist/Construct-WhCXIOPV.d.cts.map +1 -0
  16. package/dist/{Construct-vXMZJgRp.cjs → Construct-roId57cU.cjs} +7 -43
  17. package/dist/Construct-roId57cU.cjs.map +1 -0
  18. package/dist/{lazyAccessors-DmTG8sQH.cjs → Endpoint-BBkV6l0k.cjs} +869 -1079
  19. package/dist/Endpoint-BBkV6l0k.cjs.map +1 -0
  20. package/dist/{lazyAccessors-DfqZR6C4.mjs → Endpoint-BGwpNEX4.mjs} +840 -1003
  21. package/dist/Endpoint-BGwpNEX4.mjs.map +1 -0
  22. package/dist/{Endpoint-CAzNbDEt.d.cts → Endpoint-BnxZqIX-.d.cts} +53 -4
  23. package/dist/Endpoint-BnxZqIX-.d.cts.map +1 -0
  24. package/dist/{Endpoint-CLPSIl6S.d.mts → Endpoint-ROcXU-eH.d.mts} +55 -6
  25. package/dist/Endpoint-ROcXU-eH.d.mts.map +1 -0
  26. package/dist/EndpointFactory-DYoGLaIT.cjs +850 -0
  27. package/dist/EndpointFactory-DYoGLaIT.cjs.map +1 -0
  28. package/dist/EndpointFactory-Di0X9AWp.mjs +808 -0
  29. package/dist/EndpointFactory-Di0X9AWp.mjs.map +1 -0
  30. package/dist/{HonoEndpointAdaptor-DJDT3PMx.mjs → HonoEndpointAdaptor-DFKIIG2o.mjs} +5 -4
  31. package/dist/HonoEndpointAdaptor-DFKIIG2o.mjs.map +1 -0
  32. package/dist/{HonoEndpointAdaptor-CkJENANP.cjs → HonoEndpointAdaptor-wMsCyMgt.cjs} +24 -23
  33. package/dist/HonoEndpointAdaptor-wMsCyMgt.cjs.map +1 -0
  34. package/dist/{Queue-DaxjwmOQ.d.cts → Queue-D6WeziRD.d.cts} +43 -4
  35. package/dist/Queue-D6WeziRD.d.cts.map +1 -0
  36. package/dist/{Queue-HBDf0fqz.d.mts → Queue-DpUeqdC8.d.mts} +43 -4
  37. package/dist/Queue-DpUeqdC8.d.mts.map +1 -0
  38. package/dist/{Subscriber-B69ngPwl.d.cts → Subscriber-4rBJgDKI.d.mts} +9 -4
  39. package/dist/{Subscriber-B69ngPwl.d.cts.map → Subscriber-4rBJgDKI.d.mts.map} +1 -1
  40. package/dist/{Subscriber-D8Xm-86W.d.mts → Subscriber-DVQowdyj.d.cts} +11 -6
  41. package/dist/Subscriber-DVQowdyj.d.cts.map +1 -0
  42. package/dist/{Topic-C5ZMfveW.d.cts → Topic-Ohx9dvWr.d.cts} +33 -2
  43. package/dist/Topic-Ohx9dvWr.d.cts.map +1 -0
  44. package/dist/{Topic-DT10AqHk.d.mts → Topic-cmy2jOUy.d.mts} +33 -2
  45. package/dist/Topic-cmy2jOUy.d.mts.map +1 -0
  46. package/dist/adaptors/aws.cjs +39 -26
  47. package/dist/adaptors/aws.cjs.map +1 -1
  48. package/dist/adaptors/aws.d.cts +24 -16
  49. package/dist/adaptors/aws.d.cts.map +1 -1
  50. package/dist/adaptors/aws.d.mts +25 -17
  51. package/dist/adaptors/aws.d.mts.map +1 -1
  52. package/dist/adaptors/aws.mjs +26 -14
  53. package/dist/adaptors/aws.mjs.map +1 -1
  54. package/dist/adaptors/hono.cjs +9 -6
  55. package/dist/adaptors/hono.d.cts +7 -6
  56. package/dist/adaptors/hono.d.cts.map +1 -1
  57. package/dist/adaptors/hono.d.mts +8 -7
  58. package/dist/adaptors/hono.d.mts.map +1 -1
  59. package/dist/adaptors/hono.mjs +9 -6
  60. package/dist/adaptors/testing.cjs +18 -14
  61. package/dist/adaptors/testing.cjs.map +1 -1
  62. package/dist/adaptors/testing.d.cts +7 -6
  63. package/dist/adaptors/testing.d.cts.map +1 -1
  64. package/dist/adaptors/testing.d.mts +11 -10
  65. package/dist/adaptors/testing.d.mts.map +1 -1
  66. package/dist/adaptors/testing.mjs +10 -7
  67. package/dist/adaptors/testing.mjs.map +1 -1
  68. package/dist/auth.cjs +165 -0
  69. package/dist/auth.cjs.map +1 -0
  70. package/dist/auth.d.cts +108 -0
  71. package/dist/auth.d.cts.map +1 -0
  72. package/dist/auth.d.mts +108 -0
  73. package/dist/auth.d.mts.map +1 -0
  74. package/dist/auth.mjs +164 -0
  75. package/dist/auth.mjs.map +1 -0
  76. package/dist/cache-0ANvRQnD.mjs +51 -0
  77. package/dist/cache-0ANvRQnD.mjs.map +1 -0
  78. package/dist/cache-3WSvAulx.cjs +57 -0
  79. package/dist/cache-3WSvAulx.cjs.map +1 -0
  80. package/dist/cache-CdQ7OLpR.d.cts +47 -0
  81. package/dist/cache-CdQ7OLpR.d.cts.map +1 -0
  82. package/dist/cache-DYoJFcfd.d.mts +47 -0
  83. package/dist/cache-DYoJFcfd.d.mts.map +1 -0
  84. package/dist/cache.cjs +3 -0
  85. package/dist/cache.d.cts +3 -0
  86. package/dist/cache.d.mts +3 -0
  87. package/dist/cache.mjs +3 -0
  88. package/dist/chunk-DWy1uDak.cjs +39 -0
  89. package/dist/clone-DblgEZZa.mjs +39 -0
  90. package/dist/clone-DblgEZZa.mjs.map +1 -0
  91. package/dist/clone-Dy0cR2SZ.cjs +45 -0
  92. package/dist/clone-Dy0cR2SZ.cjs.map +1 -0
  93. package/dist/construct-interface-BfjcOD_E.cjs +117 -0
  94. package/dist/construct-interface-BfjcOD_E.cjs.map +1 -0
  95. package/dist/construct-interface-BqwRNYA2.d.mts +131 -0
  96. package/dist/construct-interface-BqwRNYA2.d.mts.map +1 -0
  97. package/dist/construct-interface-D2nNkHUN.d.cts +131 -0
  98. package/dist/construct-interface-D2nNkHUN.d.cts.map +1 -0
  99. package/dist/construct-interface-Z4CpS8tK.mjs +81 -0
  100. package/dist/construct-interface-Z4CpS8tK.mjs.map +1 -0
  101. package/dist/construct-interface.cjs +8 -0
  102. package/dist/construct-interface.d.cts +2 -0
  103. package/dist/construct-interface.d.mts +2 -0
  104. package/dist/construct-interface.mjs +3 -0
  105. package/dist/credential.cjs +96 -0
  106. package/dist/credential.cjs.map +1 -0
  107. package/dist/credential.d.cts +61 -0
  108. package/dist/credential.d.cts.map +1 -0
  109. package/dist/credential.d.mts +61 -0
  110. package/dist/credential.d.mts.map +1 -0
  111. package/dist/credential.mjs +94 -0
  112. package/dist/credential.mjs.map +1 -0
  113. package/dist/crons/index.cjs +39 -37
  114. package/dist/crons/index.cjs.map +1 -1
  115. package/dist/crons/index.d.cts +21 -8
  116. package/dist/crons/index.d.cts.map +1 -1
  117. package/dist/crons/index.d.mts +29 -13
  118. package/dist/crons/index.d.mts.map +1 -1
  119. package/dist/crons/index.mjs +37 -36
  120. package/dist/crons/index.mjs.map +1 -1
  121. package/dist/database/kysely.cjs +181 -0
  122. package/dist/database/kysely.cjs.map +1 -0
  123. package/dist/database/kysely.d.cts +152 -0
  124. package/dist/database/kysely.d.cts.map +1 -0
  125. package/dist/database/kysely.d.mts +152 -0
  126. package/dist/database/kysely.d.mts.map +1 -0
  127. package/dist/database/kysely.mjs +180 -0
  128. package/dist/database/kysely.mjs.map +1 -0
  129. package/dist/email.cjs +59 -0
  130. package/dist/email.cjs.map +1 -0
  131. package/dist/email.d.cts +50 -0
  132. package/dist/email.d.cts.map +1 -0
  133. package/dist/email.d.mts +50 -0
  134. package/dist/email.d.mts.map +1 -0
  135. package/dist/email.mjs +58 -0
  136. package/dist/email.mjs.map +1 -0
  137. package/dist/endpoints/index.cjs +21 -747
  138. package/dist/endpoints/index.d.cts +7 -343
  139. package/dist/endpoints/index.d.mts +7 -342
  140. package/dist/endpoints/index.mjs +11 -738
  141. package/dist/file-server.cjs +154 -0
  142. package/dist/file-server.cjs.map +1 -0
  143. package/dist/file-server.d.cts +156 -0
  144. package/dist/file-server.d.cts.map +1 -0
  145. package/dist/file-server.d.mts +156 -0
  146. package/dist/file-server.d.mts.map +1 -0
  147. package/dist/file-server.mjs +152 -0
  148. package/dist/file-server.mjs.map +1 -0
  149. package/dist/functions/index.cjs +4 -2
  150. package/dist/functions/index.d.cts +3 -2
  151. package/dist/functions/index.d.mts +3 -2
  152. package/dist/functions/index.mjs +4 -2
  153. package/dist/{functions-B-qt91O7.mjs → functions-CvT_q7Y4.mjs} +55 -51
  154. package/dist/functions-CvT_q7Y4.mjs.map +1 -0
  155. package/dist/{functions-C8i1kCMM.cjs → functions-DukjG8ov.cjs} +62 -57
  156. package/dist/functions-DukjG8ov.cjs.map +1 -0
  157. package/dist/index-7OcOWe75.d.cts +419 -0
  158. package/dist/index-7OcOWe75.d.cts.map +1 -0
  159. package/dist/index-Bt-F7u8L.d.mts +419 -0
  160. package/dist/index-Bt-F7u8L.d.mts.map +1 -0
  161. package/dist/{index-DP6fqv0I.d.mts → index-CPeqtKgq.d.mts} +48 -19
  162. package/dist/index-CPeqtKgq.d.mts.map +1 -0
  163. package/dist/{index-BGeTScmi.d.cts → index-Dadljnh_.d.cts} +36 -9
  164. package/dist/index-Dadljnh_.d.cts.map +1 -0
  165. package/dist/index.cjs +1 -1
  166. package/dist/index.d.cts +3 -3
  167. package/dist/index.d.mts +3 -3
  168. package/dist/index.mjs +1 -1
  169. package/dist/lazyAccessors-DM6HcXQk.mjs +175 -0
  170. package/dist/lazyAccessors-DM6HcXQk.mjs.map +1 -0
  171. package/dist/lazyAccessors-DrJj8NpA.cjs +223 -0
  172. package/dist/lazyAccessors-DrJj8NpA.cjs.map +1 -0
  173. package/dist/object-storage.cjs +48 -0
  174. package/dist/object-storage.cjs.map +1 -0
  175. package/dist/object-storage.d.cts +36 -0
  176. package/dist/object-storage.d.cts.map +1 -0
  177. package/dist/object-storage.d.mts +36 -0
  178. package/dist/object-storage.d.mts.map +1 -0
  179. package/dist/object-storage.mjs +47 -0
  180. package/dist/object-storage.mjs.map +1 -0
  181. package/dist/{processAudits-CKjjivyz.cjs → processAudits-Bc8rz6Ev.cjs} +3 -3
  182. package/dist/{processAudits-CKjjivyz.cjs.map → processAudits-Bc8rz6Ev.cjs.map} +1 -1
  183. package/dist/{processAudits-ySnizdMG.mjs → processAudits-D89tICM4.mjs} +1 -1
  184. package/dist/{processAudits-ySnizdMG.mjs.map → processAudits-D89tICM4.mjs.map} +1 -1
  185. package/dist/{publisher-BrFOF847.mjs → publisher-CGEo8UKD.mjs} +1 -1
  186. package/dist/{publisher-BrFOF847.mjs.map → publisher-CGEo8UKD.mjs.map} +1 -1
  187. package/dist/{publisher-lFQleddL.cjs → publisher-CqGsXB2X.cjs} +1 -1
  188. package/dist/{publisher-lFQleddL.cjs.map → publisher-CqGsXB2X.cjs.map} +1 -1
  189. package/dist/queue/index.cjs +92 -30
  190. package/dist/queue/index.cjs.map +1 -1
  191. package/dist/queue/index.d.cts +19 -4
  192. package/dist/queue/index.d.cts.map +1 -1
  193. package/dist/queue/index.d.mts +22 -6
  194. package/dist/queue/index.d.mts.map +1 -1
  195. package/dist/queue/index.mjs +90 -29
  196. package/dist/queue/index.mjs.map +1 -1
  197. package/dist/rest-api.cjs +187 -0
  198. package/dist/rest-api.cjs.map +1 -0
  199. package/dist/rest-api.d.cts +221 -0
  200. package/dist/rest-api.d.cts.map +1 -0
  201. package/dist/rest-api.d.mts +221 -0
  202. package/dist/rest-api.d.mts.map +1 -0
  203. package/dist/rest-api.mjs +186 -0
  204. package/dist/rest-api.mjs.map +1 -0
  205. package/dist/site.cjs +48 -0
  206. package/dist/site.cjs.map +1 -0
  207. package/dist/site.d.cts +101 -0
  208. package/dist/site.d.cts.map +1 -0
  209. package/dist/site.d.mts +101 -0
  210. package/dist/site.d.mts.map +1 -0
  211. package/dist/site.mjs +47 -0
  212. package/dist/site.mjs.map +1 -0
  213. package/dist/subscribers/index.cjs +35 -27
  214. package/dist/subscribers/index.cjs.map +1 -1
  215. package/dist/subscribers/index.d.cts +20 -5
  216. package/dist/subscribers/index.d.cts.map +1 -1
  217. package/dist/subscribers/index.d.mts +23 -7
  218. package/dist/subscribers/index.d.mts.map +1 -1
  219. package/dist/subscribers/index.mjs +34 -27
  220. package/dist/subscribers/index.mjs.map +1 -1
  221. package/dist/surfaceEnv-BFXEms2f.cjs +39 -0
  222. package/dist/surfaceEnv-BFXEms2f.cjs.map +1 -0
  223. package/dist/surfaceEnv-C3Ktahea.mjs +27 -0
  224. package/dist/surfaceEnv-C3Ktahea.mjs.map +1 -0
  225. package/dist/{telemetry-3vdxGn4q.d.mts → telemetry-C3L0iS28.d.cts} +2 -2
  226. package/dist/{telemetry-3vdxGn4q.d.mts.map → telemetry-C3L0iS28.d.cts.map} +1 -1
  227. package/dist/{telemetry-Dqx-D3F7.d.cts → telemetry-D7bVFLGi.d.mts} +2 -2
  228. package/dist/{telemetry-Dqx-D3F7.d.cts.map → telemetry-D7bVFLGi.d.mts.map} +1 -1
  229. package/dist/topic/index.cjs +56 -13
  230. package/dist/topic/index.cjs.map +1 -1
  231. package/dist/topic/index.d.cts +2 -2
  232. package/dist/topic/index.d.cts.map +1 -1
  233. package/dist/topic/index.d.mts +2 -2
  234. package/dist/topic/index.d.mts.map +1 -1
  235. package/dist/topic/index.mjs +54 -12
  236. package/dist/topic/index.mjs.map +1 -1
  237. package/dist/{types-BDNGr7pv.d.mts → types-BlAkSuGI.d.cts} +1 -1
  238. package/dist/{types-BDNGr7pv.d.mts.map → types-BlAkSuGI.d.cts.map} +1 -1
  239. package/dist/{types-BdAaYDvd.d.cts → types-aKksMEWL.d.mts} +1 -1
  240. package/dist/{types-BdAaYDvd.d.cts.map → types-aKksMEWL.d.mts.map} +1 -1
  241. package/dist/types.d.cts +1 -1
  242. package/dist/types.d.mts +1 -1
  243. package/package.json +155 -23
  244. package/CHANGELOG.md +0 -366
  245. package/dist/Construct-DCMuYOox.d.mts.map +0 -1
  246. package/dist/Construct-_1wX7p_Y.d.cts.map +0 -1
  247. package/dist/Construct-r0U2zBwW.mjs.map +0 -1
  248. package/dist/Construct-vXMZJgRp.cjs.map +0 -1
  249. package/dist/Endpoint-CAzNbDEt.d.cts.map +0 -1
  250. package/dist/Endpoint-CLPSIl6S.d.mts.map +0 -1
  251. package/dist/HonoEndpointAdaptor-CkJENANP.cjs.map +0 -1
  252. package/dist/HonoEndpointAdaptor-DJDT3PMx.mjs.map +0 -1
  253. package/dist/Queue-DaxjwmOQ.d.cts.map +0 -1
  254. package/dist/Queue-HBDf0fqz.d.mts.map +0 -1
  255. package/dist/Subscriber-D8Xm-86W.d.mts.map +0 -1
  256. package/dist/Topic-C5ZMfveW.d.cts.map +0 -1
  257. package/dist/Topic-DT10AqHk.d.mts.map +0 -1
  258. package/dist/endpoints/index.cjs.map +0 -1
  259. package/dist/endpoints/index.d.cts.map +0 -1
  260. package/dist/endpoints/index.d.mts.map +0 -1
  261. package/dist/endpoints/index.mjs.map +0 -1
  262. package/dist/functions-B-qt91O7.mjs.map +0 -1
  263. package/dist/functions-C8i1kCMM.cjs.map +0 -1
  264. package/dist/index-BGeTScmi.d.cts.map +0 -1
  265. package/dist/index-DP6fqv0I.d.mts.map +0 -1
  266. package/dist/lazyAccessors-DfqZR6C4.mjs.map +0 -1
  267. package/dist/lazyAccessors-DmTG8sQH.cjs.map +0 -1
  268. package/src/Construct.ts +0 -204
  269. package/src/__benchmarks__/build-time-optimization.bench.ts +0 -274
  270. package/src/__benchmarks__/endpoint.bench.ts +0 -494
  271. package/src/__benchmarks__/fixtures.ts +0 -241
  272. package/src/__benchmarks__/hono-adaptor.bench.ts +0 -533
  273. package/src/__benchmarks__/hono-server.bench.ts +0 -249
  274. package/src/__benchmarks__/response-builder.bench.ts +0 -428
  275. package/src/__benchmarks__/strategies/strategy-a-lazy-services.ts +0 -319
  276. package/src/__benchmarks__/strategies/strategy-c-middleware.ts +0 -530
  277. package/src/__benchmarks__/strategies/strategy-d-opt-in-events.ts +0 -567
  278. package/src/__tests__/Construct.environment.spec.ts +0 -704
  279. package/src/__tests__/publisher.setting.spec.ts +0 -508
  280. package/src/__tests__/publisher.spec.ts +0 -452
  281. package/src/adaptors/aws.ts +0 -6
  282. package/src/adaptors/hono.ts +0 -1
  283. package/src/adaptors/testing.ts +0 -11
  284. package/src/crons/AWSScheduledFunction.ts +0 -73
  285. package/src/crons/Cron.ts +0 -149
  286. package/src/crons/CronBuilder.ts +0 -271
  287. package/src/crons/__tests__/AWSScheduledFunction.spec.ts +0 -152
  288. package/src/crons/__tests__/Cron.spec.ts +0 -464
  289. package/src/crons/__tests__/CronBuilder.state-isolation.spec.ts +0 -227
  290. package/src/crons/index.ts +0 -12
  291. package/src/endpoints/AmazonApiGatewayEndpointAdaptor.ts +0 -677
  292. package/src/endpoints/AmazonApiGatewayV1EndpointAdaptor.ts +0 -105
  293. package/src/endpoints/AmazonApiGatewayV2EndpointAdaptor.ts +0 -97
  294. package/src/endpoints/Authorizer.ts +0 -152
  295. package/src/endpoints/Endpoint.ts +0 -1287
  296. package/src/endpoints/EndpointBuilder.ts +0 -758
  297. package/src/endpoints/EndpointFactory.ts +0 -1148
  298. package/src/endpoints/HonoEndpointAdaptor.ts +0 -677
  299. package/src/endpoints/MswEndpointAdaptor.ts +0 -226
  300. package/src/endpoints/TestEndpointAdaptor.ts +0 -422
  301. package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.audits.spec.ts +0 -499
  302. package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.events.spec.ts +0 -560
  303. package/src/endpoints/__tests__/AmazonApiGatewayV1EndpointAdaptor.spec.ts +0 -1304
  304. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.audits.spec.ts +0 -626
  305. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.events.spec.ts +0 -732
  306. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.factory-publisher.spec.ts +0 -296
  307. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.kysely-audit.integration.spec.ts +0 -951
  308. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.responseType.spec.ts +0 -111
  309. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.rls.spec.ts +0 -307
  310. package/src/endpoints/__tests__/AmazonApiGatewayV2EndpointAdaptor.spec.ts +0 -629
  311. package/src/endpoints/__tests__/Authorizer.spec.ts +0 -286
  312. package/src/endpoints/__tests__/Endpoint.cookies.spec.ts +0 -207
  313. package/src/endpoints/__tests__/Endpoint.headers.spec.ts +0 -187
  314. package/src/endpoints/__tests__/Endpoint.manifest.spec.ts +0 -175
  315. package/src/endpoints/__tests__/Endpoint.spec.ts +0 -857
  316. package/src/endpoints/__tests__/EndpointBuilder.audit.spec.ts +0 -448
  317. package/src/endpoints/__tests__/EndpointBuilder.responseType.spec.ts +0 -47
  318. package/src/endpoints/__tests__/EndpointBuilder.spec.ts +0 -523
  319. package/src/endpoints/__tests__/EndpointFactory.authorizers.spec.ts +0 -492
  320. package/src/endpoints/__tests__/EndpointFactory.database-auditor.spec.ts +0 -509
  321. package/src/endpoints/__tests__/EndpointFactory.reference-audit.spec.ts +0 -190
  322. package/src/endpoints/__tests__/EndpointFactory.spec.ts +0 -479
  323. package/src/endpoints/__tests__/EndpointFactory.state-isolation.spec.ts +0 -155
  324. package/src/endpoints/__tests__/HonoEndpointAdaptor.audit-transactions.spec.ts +0 -703
  325. package/src/endpoints/__tests__/HonoEndpointAdaptor.audits.spec.ts +0 -632
  326. package/src/endpoints/__tests__/HonoEndpointAdaptor.events.spec.ts +0 -577
  327. package/src/endpoints/__tests__/HonoEndpointAdaptor.kysely-audit.integration.spec.ts +0 -1067
  328. package/src/endpoints/__tests__/HonoEndpointAdaptor.openapi.spec.ts +0 -317
  329. package/src/endpoints/__tests__/HonoEndpointAdaptor.pgboss-publisher.spec.ts +0 -289
  330. package/src/endpoints/__tests__/HonoEndpointAdaptor.responseType.spec.ts +0 -128
  331. package/src/endpoints/__tests__/HonoEndpointAdaptor.spec.ts +0 -1207
  332. package/src/endpoints/__tests__/MswEndpointAdaptor.spec.ts +0 -211
  333. package/src/endpoints/__tests__/ResponseBuilder.spec.ts +0 -235
  334. package/src/endpoints/__tests__/TestEndpointAdaptor.audits.spec.ts +0 -602
  335. package/src/endpoints/__tests__/TestEndpointAdaptor.spec.ts +0 -1044
  336. package/src/endpoints/__tests__/__snapshots__/HonoEndpointAdaptor.spec.ts.snap +0 -54
  337. package/src/endpoints/__tests__/endpoint-types.test.ts +0 -88
  338. package/src/endpoints/__tests__/helpers.spec.ts +0 -37
  339. package/src/endpoints/__tests__/lazyAccessors.spec.ts +0 -330
  340. package/src/endpoints/__tests__/processAudits.spec.ts +0 -631
  341. package/src/endpoints/audit.ts +0 -87
  342. package/src/endpoints/helpers.ts +0 -98
  343. package/src/endpoints/index.ts +0 -42
  344. package/src/endpoints/lazyAccessors.ts +0 -241
  345. package/src/endpoints/parseHonoQuery.ts +0 -16
  346. package/src/endpoints/parseQueryParams.ts +0 -32
  347. package/src/endpoints/processAudits.ts +0 -371
  348. package/src/endpoints/rls.ts +0 -67
  349. package/src/functions/AWSLambdaFunction.ts +0 -348
  350. package/src/functions/BaseFunctionBuilder.ts +0 -201
  351. package/src/functions/Function.ts +0 -238
  352. package/src/functions/FunctionBuilder.ts +0 -391
  353. package/src/functions/FunctionExecutionWrapper.ts +0 -216
  354. package/src/functions/TestFunctionAdaptor.ts +0 -217
  355. package/src/functions/__tests__/AWSLambdaFunctionAdaptor.spec.ts +0 -513
  356. package/src/functions/__tests__/Function.audits.spec.ts +0 -393
  357. package/src/functions/__tests__/Function.spec.ts +0 -477
  358. package/src/functions/__tests__/FunctionBuilder.state-isolation.spec.ts +0 -207
  359. package/src/functions/__tests__/TestFunctionAdaptor.spec.ts +0 -480
  360. package/src/functions/index.ts +0 -12
  361. package/src/index.ts +0 -23
  362. package/src/publisher.ts +0 -93
  363. package/src/queue/AWSLambdaQueueAdaptor.ts +0 -162
  364. package/src/queue/Queue.ts +0 -128
  365. package/src/queue/QueueBuilder.ts +0 -115
  366. package/src/queue/TestQueueAdaptor.ts +0 -63
  367. package/src/queue/__tests__/QueueBuilder.spec.ts +0 -137
  368. package/src/queue/index.ts +0 -12
  369. package/src/subscribers/AWSLambdaSubscriberAdaptor.ts +0 -342
  370. package/src/subscribers/Subscriber.ts +0 -117
  371. package/src/subscribers/SubscriberBuilder.ts +0 -186
  372. package/src/subscribers/TestSubscriberAdaptor.ts +0 -133
  373. package/src/subscribers/__tests__/AWSLambdaSubscriberAdaptor.spec.ts +0 -1018
  374. package/src/subscribers/__tests__/Subscriber.spec.ts +0 -430
  375. package/src/subscribers/__tests__/TestSubscriberAdaptor.spec.ts +0 -652
  376. package/src/subscribers/index.ts +0 -6
  377. package/src/telemetry.ts +0 -103
  378. package/src/topic/Topic.ts +0 -103
  379. package/src/topic/TopicBuilder.ts +0 -51
  380. package/src/topic/__tests__/TopicBuilder.spec.ts +0 -82
  381. package/src/topic/index.ts +0 -11
  382. package/src/types.ts +0 -13
  383. package/test.ts +0 -91
  384. package/tsconfig.json +0 -9
  385. package/tsdown.config.ts +0 -34
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clone-DblgEZZa.mjs","names":["instance: T","delta: Record<string, unknown>"],"sources":["../src/clone.ts"],"sourcesContent":["/**\n * Cloning a builder, without enumerating its fields.\n *\n * The builders were mutable singletons that reset themselves by listing every\n * field at the end of `.handle()`. Two things followed from that, and both were\n * real:\n *\n * A configured base could not be reused. `const fn = f.logger(log)` handed back\n * `f` itself, and the first `.handle()` reset `_logger` to the default — so the\n * second handler built from that base silently logged somewhere else. Every\n * field in the reset block behaved the same way, which made\n * `f.logger(l).timeout(60_000)` a base that worked exactly once.\n *\n * And a field left out of the reset list leaked into the next handler instead.\n * `_constructs` was left out, so a function was granted a bucket a *previous*\n * function had declared — an over-grant in the field a deploy reads to size an\n * IAM policy.\n *\n * Both are the same defect: a hand-maintained list of fields that has to be\n * edited every time a field is added, and is silent when it isn't. So this\n * copies whatever the instance actually has, and the list stops existing. The\n * prototype is carried over, so `instanceof` and every method still resolve,\n * and the constructor is deliberately not re-run — this copies state rather\n * than initialising it.\n *\n * Fields must be replaced rather than mutated in place: a clone and its parent\n * share whatever array a field points at, so `_events.push(…)` would be seen by\n * both. Every builder assigns a fresh array instead, which is what makes\n * sharing the reference safe.\n */\nexport function cloneWith<T extends object>(\n\tinstance: T,\n\tdelta: Record<string, unknown>,\n): T {\n\tconst next = Object.create(Object.getPrototypeOf(instance)) as T;\n\n\treturn Object.assign(next, instance, delta);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,SAAgB,UACfA,UACAC,OACI;CACJ,MAAM,OAAO,OAAO,OAAO,OAAO,eAAe,SAAS,CAAC;AAE3D,QAAO,OAAO,OAAO,MAAM,UAAU,MAAM;AAC3C"}
@@ -0,0 +1,45 @@
1
+
2
+ //#region src/clone.ts
3
+ /**
4
+ * Cloning a builder, without enumerating its fields.
5
+ *
6
+ * The builders were mutable singletons that reset themselves by listing every
7
+ * field at the end of `.handle()`. Two things followed from that, and both were
8
+ * real:
9
+ *
10
+ * A configured base could not be reused. `const fn = f.logger(log)` handed back
11
+ * `f` itself, and the first `.handle()` reset `_logger` to the default — so the
12
+ * second handler built from that base silently logged somewhere else. Every
13
+ * field in the reset block behaved the same way, which made
14
+ * `f.logger(l).timeout(60_000)` a base that worked exactly once.
15
+ *
16
+ * And a field left out of the reset list leaked into the next handler instead.
17
+ * `_constructs` was left out, so a function was granted a bucket a *previous*
18
+ * function had declared — an over-grant in the field a deploy reads to size an
19
+ * IAM policy.
20
+ *
21
+ * Both are the same defect: a hand-maintained list of fields that has to be
22
+ * edited every time a field is added, and is silent when it isn't. So this
23
+ * copies whatever the instance actually has, and the list stops existing. The
24
+ * prototype is carried over, so `instanceof` and every method still resolve,
25
+ * and the constructor is deliberately not re-run — this copies state rather
26
+ * than initialising it.
27
+ *
28
+ * Fields must be replaced rather than mutated in place: a clone and its parent
29
+ * share whatever array a field points at, so `_events.push(…)` would be seen by
30
+ * both. Every builder assigns a fresh array instead, which is what makes
31
+ * sharing the reference safe.
32
+ */
33
+ function cloneWith(instance, delta) {
34
+ const next = Object.create(Object.getPrototypeOf(instance));
35
+ return Object.assign(next, instance, delta);
36
+ }
37
+
38
+ //#endregion
39
+ Object.defineProperty(exports, 'cloneWith', {
40
+ enumerable: true,
41
+ get: function () {
42
+ return cloneWith;
43
+ }
44
+ });
45
+ //# sourceMappingURL=clone-Dy0cR2SZ.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clone-Dy0cR2SZ.cjs","names":["instance: T","delta: Record<string, unknown>"],"sources":["../src/clone.ts"],"sourcesContent":["/**\n * Cloning a builder, without enumerating its fields.\n *\n * The builders were mutable singletons that reset themselves by listing every\n * field at the end of `.handle()`. Two things followed from that, and both were\n * real:\n *\n * A configured base could not be reused. `const fn = f.logger(log)` handed back\n * `f` itself, and the first `.handle()` reset `_logger` to the default — so the\n * second handler built from that base silently logged somewhere else. Every\n * field in the reset block behaved the same way, which made\n * `f.logger(l).timeout(60_000)` a base that worked exactly once.\n *\n * And a field left out of the reset list leaked into the next handler instead.\n * `_constructs` was left out, so a function was granted a bucket a *previous*\n * function had declared — an over-grant in the field a deploy reads to size an\n * IAM policy.\n *\n * Both are the same defect: a hand-maintained list of fields that has to be\n * edited every time a field is added, and is silent when it isn't. So this\n * copies whatever the instance actually has, and the list stops existing. The\n * prototype is carried over, so `instanceof` and every method still resolve,\n * and the constructor is deliberately not re-run — this copies state rather\n * than initialising it.\n *\n * Fields must be replaced rather than mutated in place: a clone and its parent\n * share whatever array a field points at, so `_events.push(…)` would be seen by\n * both. Every builder assigns a fresh array instead, which is what makes\n * sharing the reference safe.\n */\nexport function cloneWith<T extends object>(\n\tinstance: T,\n\tdelta: Record<string, unknown>,\n): T {\n\tconst next = Object.create(Object.getPrototypeOf(instance)) as T;\n\n\treturn Object.assign(next, instance, delta);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,SAAgB,UACfA,UACAC,OACI;CACJ,MAAM,OAAO,OAAO,OAAO,OAAO,eAAe,SAAS,CAAC;AAE3D,QAAO,OAAO,OAAO,MAAM,UAAU,MAAM;AAC3C"}
@@ -0,0 +1,117 @@
1
+
2
+ //#region src/construct-interface.ts
3
+ /**
4
+ * The edge that points at a construct.
5
+ *
6
+ * A construct's *canonical* node is the one carrying its own id — the others are
7
+ * things it owns rather than things it is, like the signing secret beside an
8
+ * auth server — so the kind an edge records is read off that node instead of
9
+ * being written down beside it. Hand-written kinds are the same fact stated
10
+ * twice, and the copy is what goes stale when a construct changes what it
11
+ * declares.
12
+ *
13
+ * @throws {NotAConstruct} when the value declares nothing under its own id.
14
+ */
15
+ function edgeTo(construct) {
16
+ const canonical = construct.declare().find((declaration) => declaration.id === construct.id);
17
+ if (!canonical) throw new NotAConstruct(construct);
18
+ return {
19
+ target: construct.id,
20
+ kind: canonical.kind
21
+ };
22
+ }
23
+ /**
24
+ * The services of a list of constructs, at runtime.
25
+ *
26
+ * @throws {NotAConstruct} when handed something else. The type already refuses
27
+ * it, but a JavaScript caller gets no such warning, and a `Service` slipping
28
+ * through would fail later as an undefined key in the handler.
29
+ */
30
+ function servicesOf(constructs) {
31
+ return constructs.map((construct) => {
32
+ if (!isConsumable(construct)) throw new NotAConstruct(construct);
33
+ return construct.service;
34
+ });
35
+ }
36
+ /**
37
+ * The other half of `servicesOf`: the same edge, as the manifest records it.
38
+ *
39
+ * `.dependsOn()` used to keep only the services, which is what a handler runs
40
+ * with — and an id cannot be recovered from a service name reliably, so the
41
+ * edges were gone by the time the build could read them. Both halves are taken
42
+ * from one call now, and `existing` is folded in so repeated `.dependsOn()`
43
+ * calls accumulate the way `.services()` already does.
44
+ */
45
+ function idsOf(constructs, existing = []) {
46
+ return [...new Set([...existing, ...constructs.map(({ id }) => id)])];
47
+ }
48
+ /** Something that is not a construct was passed to `.dependsOn()`. */
49
+ var NotAConstruct = class extends Error {
50
+ constructor(value) {
51
+ const name = typeof value === "object" && value !== null && "serviceName" in value ? `the service '${String(value.serviceName)}'` : `a ${typeof value}`;
52
+ super(`.dependsOn() takes constructs, and was given ${name}. Pass it to .services([…]) instead, or lift it with Construct.fromService().`);
53
+ this.value = value;
54
+ this.name = "NotAConstruct";
55
+ }
56
+ };
57
+ /**
58
+ * Whether a value is a construct rather than a bare `Service`.
59
+ *
60
+ * Structural rather than `instanceof`: a construct from a second copy of
61
+ * `@geekmidas/constructs` — a linked workspace, two versions in a lockfile — is
62
+ * still a construct, and `instanceof` is exactly the check that says otherwise.
63
+ */
64
+ function isConsumable(value) {
65
+ if (typeof value !== "object" || value === null) return false;
66
+ const candidate = value;
67
+ return typeof candidate.id === "string" && typeof candidate.declare === "function" && typeof candidate.service?.serviceName === "string";
68
+ }
69
+ /**
70
+ * The service behind either face.
71
+ *
72
+ * `.database()` and the publisher slots take a construct now; they took a
73
+ * `Service` before and still do, because a hand-written one is exactly what
74
+ * `Construct.fromService` exists to lift and not everything has been lifted.
75
+ */
76
+ function serviceOf(source) {
77
+ return isConsumable(source) ? source.service : source;
78
+ }
79
+
80
+ //#endregion
81
+ Object.defineProperty(exports, 'NotAConstruct', {
82
+ enumerable: true,
83
+ get: function () {
84
+ return NotAConstruct;
85
+ }
86
+ });
87
+ Object.defineProperty(exports, 'edgeTo', {
88
+ enumerable: true,
89
+ get: function () {
90
+ return edgeTo;
91
+ }
92
+ });
93
+ Object.defineProperty(exports, 'idsOf', {
94
+ enumerable: true,
95
+ get: function () {
96
+ return idsOf;
97
+ }
98
+ });
99
+ Object.defineProperty(exports, 'isConsumable', {
100
+ enumerable: true,
101
+ get: function () {
102
+ return isConsumable;
103
+ }
104
+ });
105
+ Object.defineProperty(exports, 'serviceOf', {
106
+ enumerable: true,
107
+ get: function () {
108
+ return serviceOf;
109
+ }
110
+ });
111
+ Object.defineProperty(exports, 'servicesOf', {
112
+ enumerable: true,
113
+ get: function () {
114
+ return servicesOf;
115
+ }
116
+ });
117
+ //# sourceMappingURL=construct-interface-BfjcOD_E.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"construct-interface-BfjcOD_E.cjs","names":["construct: Declarable","constructs: T","constructs: readonly Consumable[]","existing: readonly string[]","value: unknown","source: Consumable<TName, TClient> | Service<TName, TClient>"],"sources":["../src/construct-interface.ts"],"sourcesContent":["/**\n * The construct contract.\n *\n * A construct is three things at once — an infrastructure requirement at build\n * time, a runtime capability, and something other code can consume — which is\n * what forces exactly these three members.\n *\n * An **interface**, not a base class: `Endpoint`, `Cron`, `Queue`, and `Topic`\n * can satisfy it without inheritance surgery, a lifted `Service` can satisfy it\n * as a plain object, and `.dependsOn()` gets its enforcement structurally — a\n * `Service` (`{ serviceName, register }`) simply does not match\n * `{ id, declare, service }`, with no `instanceof` anywhere.\n *\n * Lives in its own module while the existing abstract `Construct` class is\n * still in use; it takes that name once the class is gone.\n */\n\nimport type { Declaration, Dependency } from '@geekmidas/manifest';\nimport type { Service } from '@geekmidas/services';\n\n/**\n * @typeParam TName - the construct's canonical id, PascalCase. Keeping it a\n * literal is what lets the service key be `Uncapitalize<TName>` — a TypeScript\n * intrinsic, so no custom transform needs a runtime twin.\n * @typeParam TClient - what consuming this construct hands you. `never` means it\n * owns no address and cannot be consumed: a `Cron` is fired by a schedule and a\n * `Subscriber` is reached through its topic, so `.dependsOn()` on either is a\n * compile error rather than a stub that throws.\n */\nexport interface Construct<TName extends string = string, TClient = never> {\n\t/** Canonical, PascalCase, unique within the manifest. */\n\treadonly id: TName;\n\n\t/**\n\t * The build-time face: what this construct contributes to the manifest.\n\t *\n\t * Returns an array because some constructs contribute more than one node — a\n\t * queue declares the queue and its worker, a database declares its migrator\n\t * and seeder. Most return one.\n\t */\n\tdeclare(): Declaration[];\n\n\t/**\n\t * The consumable face — the address this construct owns, as a client.\n\t *\n\t * A field assigned once rather than a getter. `Construct.getEnvironment`\n\t * caches by service *object*, and `Topic.publisher` returns a fresh literal\n\t * on every access, so that cache never hits for topics or queues today.\n\t */\n\treadonly service: [TClient] extends [never]\n\t\t? never\n\t\t: Service<Uncapitalize<TName>, TClient>;\n}\n\n/**\n * The build-time face alone — an id and what it contributes to the manifest.\n *\n * Weaker than {@link Consumable} on purpose. An edge is not always an\n * injection: a site depending on an API needs that API's *address at build\n * time* and has no service record to put a client into, so requiring one would\n * make the weakest kind of edge impossible to express with the strongest\n * interface. Discovery asks this same question and nothing more.\n */\nexport interface Declarable<TName extends string = string> {\n\treadonly id: TName;\n\tdeclare(): Declaration[];\n}\n\n/**\n * The edge that points at a construct.\n *\n * A construct's *canonical* node is the one carrying its own id — the others are\n * things it owns rather than things it is, like the signing secret beside an\n * auth server — so the kind an edge records is read off that node instead of\n * being written down beside it. Hand-written kinds are the same fact stated\n * twice, and the copy is what goes stale when a construct changes what it\n * declares.\n *\n * @throws {NotAConstruct} when the value declares nothing under its own id.\n */\nexport function edgeTo(construct: Declarable): Dependency {\n\tconst canonical = construct\n\t\t.declare()\n\t\t.find((declaration) => declaration.id === construct.id);\n\n\tif (!canonical) throw new NotAConstruct(construct);\n\n\treturn { target: construct.id, kind: canonical.kind };\n}\n\n/** What consuming a construct hands you. */\nexport type Infer<C> =\n\tC extends Construct<string, infer TClient> ? TClient : never;\n\n/** A construct's canonical id. */\nexport type NameOf<C> =\n\tC extends Construct<infer TName, unknown> ? TName : never;\n\n/**\n * What `.dependsOn([…])` accepts: a construct that owns a client.\n *\n * Structural, and deliberately narrower than {@link Construct} — it is the\n * face a *consumer* needs, so the builders can accept a database, a bucket, a\n * mail sender, a queue, or a topic without importing any of them. A plain\n * `Service` is not one of these, which is the point: constructs-only confines\n * env sniffing to `.services()` and the explicit lift, so retiring that method\n * retires implicit inference with it.\n */\nexport interface Consumable<TName extends string = string, TClient = unknown> {\n\treadonly id: TName;\n\treadonly service: Service<Uncapitalize<TName>, TClient>;\n\tdeclare(): Declaration[];\n}\n\n/**\n * The services a list of constructs dissolves into.\n *\n * A mapped tuple, so `[db, uploads]` types as `[Service<'orders', Kysely<DB>>,\n * Service<'uploads', StorageClient>]` and the handler's service record gains\n * both keys — the same machinery `.services()` already uses, which is why\n * `dependsOn` needs no type plumbing of its own.\n */\nexport type ServicesOf<T extends readonly Consumable[]> = {\n\t[K in keyof T]: T[K]['service'];\n};\n\n/**\n * The services of a list of constructs, at runtime.\n *\n * @throws {NotAConstruct} when handed something else. The type already refuses\n * it, but a JavaScript caller gets no such warning, and a `Service` slipping\n * through would fail later as an undefined key in the handler.\n */\nexport function servicesOf<const T extends readonly Consumable[]>(\n\tconstructs: T,\n): ServicesOf<T> {\n\treturn constructs.map((construct) => {\n\t\tif (!isConsumable(construct)) throw new NotAConstruct(construct);\n\n\t\treturn construct.service;\n\t}) as ServicesOf<T>;\n}\n\n/**\n * The other half of `servicesOf`: the same edge, as the manifest records it.\n *\n * `.dependsOn()` used to keep only the services, which is what a handler runs\n * with — and an id cannot be recovered from a service name reliably, so the\n * edges were gone by the time the build could read them. Both halves are taken\n * from one call now, and `existing` is folded in so repeated `.dependsOn()`\n * calls accumulate the way `.services()` already does.\n */\nexport function idsOf(\n\tconstructs: readonly Consumable[],\n\texisting: readonly string[] = [],\n): string[] {\n\treturn [...new Set([...existing, ...constructs.map(({ id }) => id)])];\n}\n\n/** Something that is not a construct was passed to `.dependsOn()`. */\nexport class NotAConstruct extends Error {\n\tconstructor(readonly value: unknown) {\n\t\tconst name =\n\t\t\ttypeof value === 'object' && value !== null && 'serviceName' in value\n\t\t\t\t? `the service '${String((value as { serviceName: unknown }).serviceName)}'`\n\t\t\t\t: `a ${typeof value}`;\n\n\t\tsuper(\n\t\t\t`.dependsOn() takes constructs, and was given ${name}. ` +\n\t\t\t\t`Pass it to .services([…]) instead, or lift it with ` +\n\t\t\t\t`Construct.fromService().`,\n\t\t);\n\t\tthis.name = 'NotAConstruct';\n\t}\n}\n\n/**\n * Whether a value is a construct rather than a bare `Service`.\n *\n * Structural rather than `instanceof`: a construct from a second copy of\n * `@geekmidas/constructs` — a linked workspace, two versions in a lockfile — is\n * still a construct, and `instanceof` is exactly the check that says otherwise.\n */\nexport function isConsumable(value: unknown): value is Consumable {\n\tif (typeof value !== 'object' || value === null) return false;\n\n\tconst candidate = value as Partial<Consumable>;\n\n\treturn (\n\t\ttypeof candidate.id === 'string' &&\n\t\ttypeof candidate.declare === 'function' &&\n\t\ttypeof (candidate.service as Service | undefined)?.serviceName === 'string'\n\t);\n}\n\n/**\n * The service behind either face.\n *\n * `.database()` and the publisher slots take a construct now; they took a\n * `Service` before and still do, because a hand-written one is exactly what\n * `Construct.fromService` exists to lift and not everything has been lifted.\n */\nexport function serviceOf<TName extends string, TClient>(\n\tsource: Consumable<TName, TClient> | Service<TName, TClient>,\n): Service<TName, TClient> {\n\t// A construct's service key is `Uncapitalize<TName>` and the slot is typed\n\t// by `TName`; the two describe the same key, and only the cast says so.\n\treturn isConsumable(source)\n\t\t? (source.service as unknown as Service<TName, TClient>)\n\t\t: (source as Service<TName, TClient>);\n}\n"],"mappings":";;;;;;;;;;;;;;AAgFA,SAAgB,OAAOA,WAAmC;CACzD,MAAM,YAAY,UAChB,SAAS,CACT,KAAK,CAAC,gBAAgB,YAAY,OAAO,UAAU,GAAG;AAExD,MAAK,UAAW,OAAM,IAAI,cAAc;AAExC,QAAO;EAAE,QAAQ,UAAU;EAAI,MAAM,UAAU;CAAM;AACrD;;;;;;;;AA6CD,SAAgB,WACfC,YACgB;AAChB,QAAO,WAAW,IAAI,CAAC,cAAc;AACpC,OAAK,aAAa,UAAU,CAAE,OAAM,IAAI,cAAc;AAEtD,SAAO,UAAU;CACjB,EAAC;AACF;;;;;;;;;;AAWD,SAAgB,MACfC,YACAC,WAA8B,CAAE,GACrB;AACX,QAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,UAAU,GAAG,WAAW,IAAI,CAAC,EAAE,IAAI,KAAK,GAAG,AAAC,EAAE;AACrE;;AAGD,IAAa,gBAAb,cAAmC,MAAM;CACxC,YAAqBC,OAAgB;EACpC,MAAM,cACE,UAAU,YAAY,UAAU,QAAQ,iBAAiB,SAC5D,eAAe,OAAQ,MAAmC,YAAY,CAAC,MACvE,WAAW,MAAM;AAEtB,SACE,+CAA+C,KAAK,+EAGrD;EAVmB;AAWpB,OAAK,OAAO;CACZ;AACD;;;;;;;;AASD,SAAgB,aAAaA,OAAqC;AACjE,YAAW,UAAU,YAAY,UAAU,KAAM,QAAO;CAExD,MAAM,YAAY;AAElB,eACQ,UAAU,OAAO,mBACjB,UAAU,YAAY,qBACrB,UAAU,SAAiC,gBAAgB;AAEpE;;;;;;;;AASD,SAAgB,UACfC,QAC0B;AAG1B,QAAO,aAAa,OAAO,GACvB,OAAO,UACP;AACJ"}
@@ -0,0 +1,131 @@
1
+ import { Declaration, Dependency } from "@geekmidas/manifest";
2
+ import { Service } from "@geekmidas/services";
3
+
4
+ //#region src/construct-interface.d.ts
5
+
6
+ /**
7
+ * @typeParam TName - the construct's canonical id, PascalCase. Keeping it a
8
+ * literal is what lets the service key be `Uncapitalize<TName>` — a TypeScript
9
+ * intrinsic, so no custom transform needs a runtime twin.
10
+ * @typeParam TClient - what consuming this construct hands you. `never` means it
11
+ * owns no address and cannot be consumed: a `Cron` is fired by a schedule and a
12
+ * `Subscriber` is reached through its topic, so `.dependsOn()` on either is a
13
+ * compile error rather than a stub that throws.
14
+ */
15
+ interface Construct<TName extends string = string, TClient = never> {
16
+ /** Canonical, PascalCase, unique within the manifest. */
17
+ readonly id: TName;
18
+ /**
19
+ * The build-time face: what this construct contributes to the manifest.
20
+ *
21
+ * Returns an array because some constructs contribute more than one node — a
22
+ * queue declares the queue and its worker, a database declares its migrator
23
+ * and seeder. Most return one.
24
+ */
25
+ declare(): Declaration[];
26
+ /**
27
+ * The consumable face — the address this construct owns, as a client.
28
+ *
29
+ * A field assigned once rather than a getter. `Construct.getEnvironment`
30
+ * caches by service *object*, and `Topic.publisher` returns a fresh literal
31
+ * on every access, so that cache never hits for topics or queues today.
32
+ */
33
+ readonly service: [TClient] extends [never] ? never : Service<Uncapitalize<TName>, TClient>;
34
+ }
35
+ /**
36
+ * The build-time face alone — an id and what it contributes to the manifest.
37
+ *
38
+ * Weaker than {@link Consumable} on purpose. An edge is not always an
39
+ * injection: a site depending on an API needs that API's *address at build
40
+ * time* and has no service record to put a client into, so requiring one would
41
+ * make the weakest kind of edge impossible to express with the strongest
42
+ * interface. Discovery asks this same question and nothing more.
43
+ */
44
+ interface Declarable<TName extends string = string> {
45
+ readonly id: TName;
46
+ declare(): Declaration[];
47
+ }
48
+ /**
49
+ * The edge that points at a construct.
50
+ *
51
+ * A construct's *canonical* node is the one carrying its own id — the others are
52
+ * things it owns rather than things it is, like the signing secret beside an
53
+ * auth server — so the kind an edge records is read off that node instead of
54
+ * being written down beside it. Hand-written kinds are the same fact stated
55
+ * twice, and the copy is what goes stale when a construct changes what it
56
+ * declares.
57
+ *
58
+ * @throws {NotAConstruct} when the value declares nothing under its own id.
59
+ */
60
+ declare function edgeTo(construct: Declarable): Dependency;
61
+ /** What consuming a construct hands you. */
62
+ type Infer<C> = C extends Construct<string, infer TClient> ? TClient : never;
63
+ /** A construct's canonical id. */
64
+ type NameOf<C> = C extends Construct<infer TName, unknown> ? TName : never;
65
+ /**
66
+ * What `.dependsOn([…])` accepts: a construct that owns a client.
67
+ *
68
+ * Structural, and deliberately narrower than {@link Construct} — it is the
69
+ * face a *consumer* needs, so the builders can accept a database, a bucket, a
70
+ * mail sender, a queue, or a topic without importing any of them. A plain
71
+ * `Service` is not one of these, which is the point: constructs-only confines
72
+ * env sniffing to `.services()` and the explicit lift, so retiring that method
73
+ * retires implicit inference with it.
74
+ */
75
+ interface Consumable<TName extends string = string, TClient = unknown> {
76
+ readonly id: TName;
77
+ readonly service: Service<Uncapitalize<TName>, TClient>;
78
+ declare(): Declaration[];
79
+ }
80
+ /**
81
+ * The services a list of constructs dissolves into.
82
+ *
83
+ * A mapped tuple, so `[db, uploads]` types as `[Service<'orders', Kysely<DB>>,
84
+ * Service<'uploads', StorageClient>]` and the handler's service record gains
85
+ * both keys — the same machinery `.services()` already uses, which is why
86
+ * `dependsOn` needs no type plumbing of its own.
87
+ */
88
+ type ServicesOf<T extends readonly Consumable[]> = { [K in keyof T]: T[K]['service'] };
89
+ /**
90
+ * The services of a list of constructs, at runtime.
91
+ *
92
+ * @throws {NotAConstruct} when handed something else. The type already refuses
93
+ * it, but a JavaScript caller gets no such warning, and a `Service` slipping
94
+ * through would fail later as an undefined key in the handler.
95
+ */
96
+ declare function servicesOf<const T extends readonly Consumable[]>(constructs: T): ServicesOf<T>;
97
+ /**
98
+ * The other half of `servicesOf`: the same edge, as the manifest records it.
99
+ *
100
+ * `.dependsOn()` used to keep only the services, which is what a handler runs
101
+ * with — and an id cannot be recovered from a service name reliably, so the
102
+ * edges were gone by the time the build could read them. Both halves are taken
103
+ * from one call now, and `existing` is folded in so repeated `.dependsOn()`
104
+ * calls accumulate the way `.services()` already does.
105
+ */
106
+ declare function idsOf(constructs: readonly Consumable[], existing?: readonly string[]): string[];
107
+ /** Something that is not a construct was passed to `.dependsOn()`. */
108
+ declare class NotAConstruct extends Error {
109
+ readonly value: unknown;
110
+ constructor(value: unknown);
111
+ }
112
+ /**
113
+ * Whether a value is a construct rather than a bare `Service`.
114
+ *
115
+ * Structural rather than `instanceof`: a construct from a second copy of
116
+ * `@geekmidas/constructs` — a linked workspace, two versions in a lockfile — is
117
+ * still a construct, and `instanceof` is exactly the check that says otherwise.
118
+ */
119
+ declare function isConsumable(value: unknown): value is Consumable;
120
+ /**
121
+ * The service behind either face.
122
+ *
123
+ * `.database()` and the publisher slots take a construct now; they took a
124
+ * `Service` before and still do, because a hand-written one is exactly what
125
+ * `Construct.fromService` exists to lift and not everything has been lifted.
126
+ */
127
+ declare function serviceOf<TName extends string, TClient>(source: Consumable<TName, TClient> | Service<TName, TClient>): Service<TName, TClient>;
128
+ //# sourceMappingURL=construct-interface.d.ts.map
129
+ //#endregion
130
+ export { Construct, Consumable, Declarable, Infer, NameOf, NotAConstruct, ServicesOf, edgeTo, idsOf, isConsumable, serviceOf, servicesOf };
131
+ //# sourceMappingURL=construct-interface-BqwRNYA2.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"construct-interface-BqwRNYA2.d.mts","names":[],"sources":["../src/construct-interface.ts"],"sourcesContent":[],"mappings":";;;;;AAiEuB;AAevB;;;;AAAyD;AAWzD;;;AACW,UA/DM,SA+DN,CAAA,cAAA,MAAA,GAAA,MAAA,EAAA,UAAA,KAAA,CAAA,CAAA;EAAS;EAAiC,SAAA,EAAA,EA7DvC,KA6DuC;EAGzC;;;;;AACsC;AAYlD;EAA2B,OAAA,EAAA,EApEf,WAoEe,EAAA;EAAA;;;;;;AAGJ;EAWX,SAAA,OAAU,EAAA,CAzEF,OAyEE,CAAA,SAAA,CAAA,KAAA,CAAA,GAAA,KAAA,GAvElB,OAuEkB,CAvEV,YAuEU,CAvEG,KAuEH,CAAA,EAvEW,OAuEX,CAAA;;;;;;AACF;AAUpB;;;;AAEc,UAxEG,UAwEH,CAAA,cAAA,MAAA,GAAA,MAAA,CAAA,CAAA;EAAC,SAAZ,EAAA,EAvEW,KAuEX;EAAU,OAAA,EAAA,EAtED,WAsEC,EAAA;AAiBb;AAQA;AAuBA;AAmBA;;;;;;;;;;AAEG,iBA5Ha,MAAA,CA4Hb,SAAA,EA5H+B,UA4H/B,CAAA,EA5H4C,UA4H5C;AAAO;KAjHE,WACX,UAAU,mCAAmC;;KAGlC,YACX,UAAU,kCAAkC;;;;;;;;;;;UAY5B;eACH;oBACK,QAAQ,aAAa,QAAQ;aACpC;;;;;;;;;;KAWA,8BAA8B,8BAC7B,IAAI,EAAE;;;;;;;;iBAUH,oCAAoC,0BACvC,IACV,WAAW;;;;;;;;;;iBAiBE,KAAA,sBACM;;cAOT,aAAA,SAAsB,KAAK;;;;;;;;;;;iBAuBxB,YAAA,2BAAuC;;;;;;;;iBAmBvC,iDACP,WAAW,OAAO,WAAW,QAAQ,OAAO,WAClD,QAAQ,OAAO"}
@@ -0,0 +1,131 @@
1
+ import { Service } from "@geekmidas/services";
2
+ import { Declaration, Dependency } from "@geekmidas/manifest";
3
+
4
+ //#region src/construct-interface.d.ts
5
+
6
+ /**
7
+ * @typeParam TName - the construct's canonical id, PascalCase. Keeping it a
8
+ * literal is what lets the service key be `Uncapitalize<TName>` — a TypeScript
9
+ * intrinsic, so no custom transform needs a runtime twin.
10
+ * @typeParam TClient - what consuming this construct hands you. `never` means it
11
+ * owns no address and cannot be consumed: a `Cron` is fired by a schedule and a
12
+ * `Subscriber` is reached through its topic, so `.dependsOn()` on either is a
13
+ * compile error rather than a stub that throws.
14
+ */
15
+ interface Construct<TName extends string = string, TClient = never> {
16
+ /** Canonical, PascalCase, unique within the manifest. */
17
+ readonly id: TName;
18
+ /**
19
+ * The build-time face: what this construct contributes to the manifest.
20
+ *
21
+ * Returns an array because some constructs contribute more than one node — a
22
+ * queue declares the queue and its worker, a database declares its migrator
23
+ * and seeder. Most return one.
24
+ */
25
+ declare(): Declaration[];
26
+ /**
27
+ * The consumable face — the address this construct owns, as a client.
28
+ *
29
+ * A field assigned once rather than a getter. `Construct.getEnvironment`
30
+ * caches by service *object*, and `Topic.publisher` returns a fresh literal
31
+ * on every access, so that cache never hits for topics or queues today.
32
+ */
33
+ readonly service: [TClient] extends [never] ? never : Service<Uncapitalize<TName>, TClient>;
34
+ }
35
+ /**
36
+ * The build-time face alone — an id and what it contributes to the manifest.
37
+ *
38
+ * Weaker than {@link Consumable} on purpose. An edge is not always an
39
+ * injection: a site depending on an API needs that API's *address at build
40
+ * time* and has no service record to put a client into, so requiring one would
41
+ * make the weakest kind of edge impossible to express with the strongest
42
+ * interface. Discovery asks this same question and nothing more.
43
+ */
44
+ interface Declarable<TName extends string = string> {
45
+ readonly id: TName;
46
+ declare(): Declaration[];
47
+ }
48
+ /**
49
+ * The edge that points at a construct.
50
+ *
51
+ * A construct's *canonical* node is the one carrying its own id — the others are
52
+ * things it owns rather than things it is, like the signing secret beside an
53
+ * auth server — so the kind an edge records is read off that node instead of
54
+ * being written down beside it. Hand-written kinds are the same fact stated
55
+ * twice, and the copy is what goes stale when a construct changes what it
56
+ * declares.
57
+ *
58
+ * @throws {NotAConstruct} when the value declares nothing under its own id.
59
+ */
60
+ declare function edgeTo(construct: Declarable): Dependency;
61
+ /** What consuming a construct hands you. */
62
+ type Infer<C> = C extends Construct<string, infer TClient> ? TClient : never;
63
+ /** A construct's canonical id. */
64
+ type NameOf<C> = C extends Construct<infer TName, unknown> ? TName : never;
65
+ /**
66
+ * What `.dependsOn([…])` accepts: a construct that owns a client.
67
+ *
68
+ * Structural, and deliberately narrower than {@link Construct} — it is the
69
+ * face a *consumer* needs, so the builders can accept a database, a bucket, a
70
+ * mail sender, a queue, or a topic without importing any of them. A plain
71
+ * `Service` is not one of these, which is the point: constructs-only confines
72
+ * env sniffing to `.services()` and the explicit lift, so retiring that method
73
+ * retires implicit inference with it.
74
+ */
75
+ interface Consumable<TName extends string = string, TClient = unknown> {
76
+ readonly id: TName;
77
+ readonly service: Service<Uncapitalize<TName>, TClient>;
78
+ declare(): Declaration[];
79
+ }
80
+ /**
81
+ * The services a list of constructs dissolves into.
82
+ *
83
+ * A mapped tuple, so `[db, uploads]` types as `[Service<'orders', Kysely<DB>>,
84
+ * Service<'uploads', StorageClient>]` and the handler's service record gains
85
+ * both keys — the same machinery `.services()` already uses, which is why
86
+ * `dependsOn` needs no type plumbing of its own.
87
+ */
88
+ type ServicesOf<T extends readonly Consumable[]> = { [K in keyof T]: T[K]['service'] };
89
+ /**
90
+ * The services of a list of constructs, at runtime.
91
+ *
92
+ * @throws {NotAConstruct} when handed something else. The type already refuses
93
+ * it, but a JavaScript caller gets no such warning, and a `Service` slipping
94
+ * through would fail later as an undefined key in the handler.
95
+ */
96
+ declare function servicesOf<const T extends readonly Consumable[]>(constructs: T): ServicesOf<T>;
97
+ /**
98
+ * The other half of `servicesOf`: the same edge, as the manifest records it.
99
+ *
100
+ * `.dependsOn()` used to keep only the services, which is what a handler runs
101
+ * with — and an id cannot be recovered from a service name reliably, so the
102
+ * edges were gone by the time the build could read them. Both halves are taken
103
+ * from one call now, and `existing` is folded in so repeated `.dependsOn()`
104
+ * calls accumulate the way `.services()` already does.
105
+ */
106
+ declare function idsOf(constructs: readonly Consumable[], existing?: readonly string[]): string[];
107
+ /** Something that is not a construct was passed to `.dependsOn()`. */
108
+ declare class NotAConstruct extends Error {
109
+ readonly value: unknown;
110
+ constructor(value: unknown);
111
+ }
112
+ /**
113
+ * Whether a value is a construct rather than a bare `Service`.
114
+ *
115
+ * Structural rather than `instanceof`: a construct from a second copy of
116
+ * `@geekmidas/constructs` — a linked workspace, two versions in a lockfile — is
117
+ * still a construct, and `instanceof` is exactly the check that says otherwise.
118
+ */
119
+ declare function isConsumable(value: unknown): value is Consumable;
120
+ /**
121
+ * The service behind either face.
122
+ *
123
+ * `.database()` and the publisher slots take a construct now; they took a
124
+ * `Service` before and still do, because a hand-written one is exactly what
125
+ * `Construct.fromService` exists to lift and not everything has been lifted.
126
+ */
127
+ declare function serviceOf<TName extends string, TClient>(source: Consumable<TName, TClient> | Service<TName, TClient>): Service<TName, TClient>;
128
+ //# sourceMappingURL=construct-interface.d.ts.map
129
+ //#endregion
130
+ export { Construct, Consumable, Declarable, Infer, NameOf, NotAConstruct, ServicesOf, edgeTo, idsOf, isConsumable, serviceOf, servicesOf };
131
+ //# sourceMappingURL=construct-interface-D2nNkHUN.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"construct-interface-D2nNkHUN.d.cts","names":[],"sources":["../src/construct-interface.ts"],"sourcesContent":[],"mappings":";;;;;AAiEuB;AAevB;;;;AAAyD;AAWzD;;;AACW,UA/DM,SA+DN,CAAA,cAAA,MAAA,GAAA,MAAA,EAAA,UAAA,KAAA,CAAA,CAAA;EAAS;EAAiC,SAAA,EAAA,EA7DvC,KA6DuC;EAGzC;;;;;AACsC;AAYlD;EAA2B,OAAA,EAAA,EApEf,WAoEe,EAAA;EAAA;;;;;;AAGJ;EAWX,SAAA,OAAU,EAAA,CAzEF,OAyEE,CAAA,SAAA,CAAA,KAAA,CAAA,GAAA,KAAA,GAvElB,OAuEkB,CAvEV,YAuEU,CAvEG,KAuEH,CAAA,EAvEW,OAuEX,CAAA;;;;;;AACF;AAUpB;;;;AAEc,UAxEG,UAwEH,CAAA,cAAA,MAAA,GAAA,MAAA,CAAA,CAAA;EAAC,SAAZ,EAAA,EAvEW,KAuEX;EAAU,OAAA,EAAA,EAtED,WAsEC,EAAA;AAiBb;AAQA;AAuBA;AAmBA;;;;;;;;;;AAEG,iBA5Ha,MAAA,CA4Hb,SAAA,EA5H+B,UA4H/B,CAAA,EA5H4C,UA4H5C;AAAO;KAjHE,WACX,UAAU,mCAAmC;;KAGlC,YACX,UAAU,kCAAkC;;;;;;;;;;;UAY5B;eACH;oBACK,QAAQ,aAAa,QAAQ;aACpC;;;;;;;;;;KAWA,8BAA8B,8BAC7B,IAAI,EAAE;;;;;;;;iBAUH,oCAAoC,0BACvC,IACV,WAAW;;;;;;;;;;iBAiBE,KAAA,sBACM;;cAOT,aAAA,SAAsB,KAAK;;;;;;;;;;;iBAuBxB,YAAA,2BAAuC;;;;;;;;iBAmBvC,iDACP,WAAW,OAAO,WAAW,QAAQ,OAAO,WAClD,QAAQ,OAAO"}
@@ -0,0 +1,81 @@
1
+ //#region src/construct-interface.ts
2
+ /**
3
+ * The edge that points at a construct.
4
+ *
5
+ * A construct's *canonical* node is the one carrying its own id — the others are
6
+ * things it owns rather than things it is, like the signing secret beside an
7
+ * auth server — so the kind an edge records is read off that node instead of
8
+ * being written down beside it. Hand-written kinds are the same fact stated
9
+ * twice, and the copy is what goes stale when a construct changes what it
10
+ * declares.
11
+ *
12
+ * @throws {NotAConstruct} when the value declares nothing under its own id.
13
+ */
14
+ function edgeTo(construct) {
15
+ const canonical = construct.declare().find((declaration) => declaration.id === construct.id);
16
+ if (!canonical) throw new NotAConstruct(construct);
17
+ return {
18
+ target: construct.id,
19
+ kind: canonical.kind
20
+ };
21
+ }
22
+ /**
23
+ * The services of a list of constructs, at runtime.
24
+ *
25
+ * @throws {NotAConstruct} when handed something else. The type already refuses
26
+ * it, but a JavaScript caller gets no such warning, and a `Service` slipping
27
+ * through would fail later as an undefined key in the handler.
28
+ */
29
+ function servicesOf(constructs) {
30
+ return constructs.map((construct) => {
31
+ if (!isConsumable(construct)) throw new NotAConstruct(construct);
32
+ return construct.service;
33
+ });
34
+ }
35
+ /**
36
+ * The other half of `servicesOf`: the same edge, as the manifest records it.
37
+ *
38
+ * `.dependsOn()` used to keep only the services, which is what a handler runs
39
+ * with — and an id cannot be recovered from a service name reliably, so the
40
+ * edges were gone by the time the build could read them. Both halves are taken
41
+ * from one call now, and `existing` is folded in so repeated `.dependsOn()`
42
+ * calls accumulate the way `.services()` already does.
43
+ */
44
+ function idsOf(constructs, existing = []) {
45
+ return [...new Set([...existing, ...constructs.map(({ id }) => id)])];
46
+ }
47
+ /** Something that is not a construct was passed to `.dependsOn()`. */
48
+ var NotAConstruct = class extends Error {
49
+ constructor(value) {
50
+ const name = typeof value === "object" && value !== null && "serviceName" in value ? `the service '${String(value.serviceName)}'` : `a ${typeof value}`;
51
+ super(`.dependsOn() takes constructs, and was given ${name}. Pass it to .services([…]) instead, or lift it with Construct.fromService().`);
52
+ this.value = value;
53
+ this.name = "NotAConstruct";
54
+ }
55
+ };
56
+ /**
57
+ * Whether a value is a construct rather than a bare `Service`.
58
+ *
59
+ * Structural rather than `instanceof`: a construct from a second copy of
60
+ * `@geekmidas/constructs` — a linked workspace, two versions in a lockfile — is
61
+ * still a construct, and `instanceof` is exactly the check that says otherwise.
62
+ */
63
+ function isConsumable(value) {
64
+ if (typeof value !== "object" || value === null) return false;
65
+ const candidate = value;
66
+ return typeof candidate.id === "string" && typeof candidate.declare === "function" && typeof candidate.service?.serviceName === "string";
67
+ }
68
+ /**
69
+ * The service behind either face.
70
+ *
71
+ * `.database()` and the publisher slots take a construct now; they took a
72
+ * `Service` before and still do, because a hand-written one is exactly what
73
+ * `Construct.fromService` exists to lift and not everything has been lifted.
74
+ */
75
+ function serviceOf(source) {
76
+ return isConsumable(source) ? source.service : source;
77
+ }
78
+
79
+ //#endregion
80
+ export { NotAConstruct, edgeTo, idsOf, isConsumable, serviceOf, servicesOf };
81
+ //# sourceMappingURL=construct-interface-Z4CpS8tK.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"construct-interface-Z4CpS8tK.mjs","names":["construct: Declarable","constructs: T","constructs: readonly Consumable[]","existing: readonly string[]","value: unknown","source: Consumable<TName, TClient> | Service<TName, TClient>"],"sources":["../src/construct-interface.ts"],"sourcesContent":["/**\n * The construct contract.\n *\n * A construct is three things at once — an infrastructure requirement at build\n * time, a runtime capability, and something other code can consume — which is\n * what forces exactly these three members.\n *\n * An **interface**, not a base class: `Endpoint`, `Cron`, `Queue`, and `Topic`\n * can satisfy it without inheritance surgery, a lifted `Service` can satisfy it\n * as a plain object, and `.dependsOn()` gets its enforcement structurally — a\n * `Service` (`{ serviceName, register }`) simply does not match\n * `{ id, declare, service }`, with no `instanceof` anywhere.\n *\n * Lives in its own module while the existing abstract `Construct` class is\n * still in use; it takes that name once the class is gone.\n */\n\nimport type { Declaration, Dependency } from '@geekmidas/manifest';\nimport type { Service } from '@geekmidas/services';\n\n/**\n * @typeParam TName - the construct's canonical id, PascalCase. Keeping it a\n * literal is what lets the service key be `Uncapitalize<TName>` — a TypeScript\n * intrinsic, so no custom transform needs a runtime twin.\n * @typeParam TClient - what consuming this construct hands you. `never` means it\n * owns no address and cannot be consumed: a `Cron` is fired by a schedule and a\n * `Subscriber` is reached through its topic, so `.dependsOn()` on either is a\n * compile error rather than a stub that throws.\n */\nexport interface Construct<TName extends string = string, TClient = never> {\n\t/** Canonical, PascalCase, unique within the manifest. */\n\treadonly id: TName;\n\n\t/**\n\t * The build-time face: what this construct contributes to the manifest.\n\t *\n\t * Returns an array because some constructs contribute more than one node — a\n\t * queue declares the queue and its worker, a database declares its migrator\n\t * and seeder. Most return one.\n\t */\n\tdeclare(): Declaration[];\n\n\t/**\n\t * The consumable face — the address this construct owns, as a client.\n\t *\n\t * A field assigned once rather than a getter. `Construct.getEnvironment`\n\t * caches by service *object*, and `Topic.publisher` returns a fresh literal\n\t * on every access, so that cache never hits for topics or queues today.\n\t */\n\treadonly service: [TClient] extends [never]\n\t\t? never\n\t\t: Service<Uncapitalize<TName>, TClient>;\n}\n\n/**\n * The build-time face alone — an id and what it contributes to the manifest.\n *\n * Weaker than {@link Consumable} on purpose. An edge is not always an\n * injection: a site depending on an API needs that API's *address at build\n * time* and has no service record to put a client into, so requiring one would\n * make the weakest kind of edge impossible to express with the strongest\n * interface. Discovery asks this same question and nothing more.\n */\nexport interface Declarable<TName extends string = string> {\n\treadonly id: TName;\n\tdeclare(): Declaration[];\n}\n\n/**\n * The edge that points at a construct.\n *\n * A construct's *canonical* node is the one carrying its own id — the others are\n * things it owns rather than things it is, like the signing secret beside an\n * auth server — so the kind an edge records is read off that node instead of\n * being written down beside it. Hand-written kinds are the same fact stated\n * twice, and the copy is what goes stale when a construct changes what it\n * declares.\n *\n * @throws {NotAConstruct} when the value declares nothing under its own id.\n */\nexport function edgeTo(construct: Declarable): Dependency {\n\tconst canonical = construct\n\t\t.declare()\n\t\t.find((declaration) => declaration.id === construct.id);\n\n\tif (!canonical) throw new NotAConstruct(construct);\n\n\treturn { target: construct.id, kind: canonical.kind };\n}\n\n/** What consuming a construct hands you. */\nexport type Infer<C> =\n\tC extends Construct<string, infer TClient> ? TClient : never;\n\n/** A construct's canonical id. */\nexport type NameOf<C> =\n\tC extends Construct<infer TName, unknown> ? TName : never;\n\n/**\n * What `.dependsOn([…])` accepts: a construct that owns a client.\n *\n * Structural, and deliberately narrower than {@link Construct} — it is the\n * face a *consumer* needs, so the builders can accept a database, a bucket, a\n * mail sender, a queue, or a topic without importing any of them. A plain\n * `Service` is not one of these, which is the point: constructs-only confines\n * env sniffing to `.services()` and the explicit lift, so retiring that method\n * retires implicit inference with it.\n */\nexport interface Consumable<TName extends string = string, TClient = unknown> {\n\treadonly id: TName;\n\treadonly service: Service<Uncapitalize<TName>, TClient>;\n\tdeclare(): Declaration[];\n}\n\n/**\n * The services a list of constructs dissolves into.\n *\n * A mapped tuple, so `[db, uploads]` types as `[Service<'orders', Kysely<DB>>,\n * Service<'uploads', StorageClient>]` and the handler's service record gains\n * both keys — the same machinery `.services()` already uses, which is why\n * `dependsOn` needs no type plumbing of its own.\n */\nexport type ServicesOf<T extends readonly Consumable[]> = {\n\t[K in keyof T]: T[K]['service'];\n};\n\n/**\n * The services of a list of constructs, at runtime.\n *\n * @throws {NotAConstruct} when handed something else. The type already refuses\n * it, but a JavaScript caller gets no such warning, and a `Service` slipping\n * through would fail later as an undefined key in the handler.\n */\nexport function servicesOf<const T extends readonly Consumable[]>(\n\tconstructs: T,\n): ServicesOf<T> {\n\treturn constructs.map((construct) => {\n\t\tif (!isConsumable(construct)) throw new NotAConstruct(construct);\n\n\t\treturn construct.service;\n\t}) as ServicesOf<T>;\n}\n\n/**\n * The other half of `servicesOf`: the same edge, as the manifest records it.\n *\n * `.dependsOn()` used to keep only the services, which is what a handler runs\n * with — and an id cannot be recovered from a service name reliably, so the\n * edges were gone by the time the build could read them. Both halves are taken\n * from one call now, and `existing` is folded in so repeated `.dependsOn()`\n * calls accumulate the way `.services()` already does.\n */\nexport function idsOf(\n\tconstructs: readonly Consumable[],\n\texisting: readonly string[] = [],\n): string[] {\n\treturn [...new Set([...existing, ...constructs.map(({ id }) => id)])];\n}\n\n/** Something that is not a construct was passed to `.dependsOn()`. */\nexport class NotAConstruct extends Error {\n\tconstructor(readonly value: unknown) {\n\t\tconst name =\n\t\t\ttypeof value === 'object' && value !== null && 'serviceName' in value\n\t\t\t\t? `the service '${String((value as { serviceName: unknown }).serviceName)}'`\n\t\t\t\t: `a ${typeof value}`;\n\n\t\tsuper(\n\t\t\t`.dependsOn() takes constructs, and was given ${name}. ` +\n\t\t\t\t`Pass it to .services([…]) instead, or lift it with ` +\n\t\t\t\t`Construct.fromService().`,\n\t\t);\n\t\tthis.name = 'NotAConstruct';\n\t}\n}\n\n/**\n * Whether a value is a construct rather than a bare `Service`.\n *\n * Structural rather than `instanceof`: a construct from a second copy of\n * `@geekmidas/constructs` — a linked workspace, two versions in a lockfile — is\n * still a construct, and `instanceof` is exactly the check that says otherwise.\n */\nexport function isConsumable(value: unknown): value is Consumable {\n\tif (typeof value !== 'object' || value === null) return false;\n\n\tconst candidate = value as Partial<Consumable>;\n\n\treturn (\n\t\ttypeof candidate.id === 'string' &&\n\t\ttypeof candidate.declare === 'function' &&\n\t\ttypeof (candidate.service as Service | undefined)?.serviceName === 'string'\n\t);\n}\n\n/**\n * The service behind either face.\n *\n * `.database()` and the publisher slots take a construct now; they took a\n * `Service` before and still do, because a hand-written one is exactly what\n * `Construct.fromService` exists to lift and not everything has been lifted.\n */\nexport function serviceOf<TName extends string, TClient>(\n\tsource: Consumable<TName, TClient> | Service<TName, TClient>,\n): Service<TName, TClient> {\n\t// A construct's service key is `Uncapitalize<TName>` and the slot is typed\n\t// by `TName`; the two describe the same key, and only the cast says so.\n\treturn isConsumable(source)\n\t\t? (source.service as unknown as Service<TName, TClient>)\n\t\t: (source as Service<TName, TClient>);\n}\n"],"mappings":";;;;;;;;;;;;;AAgFA,SAAgB,OAAOA,WAAmC;CACzD,MAAM,YAAY,UAChB,SAAS,CACT,KAAK,CAAC,gBAAgB,YAAY,OAAO,UAAU,GAAG;AAExD,MAAK,UAAW,OAAM,IAAI,cAAc;AAExC,QAAO;EAAE,QAAQ,UAAU;EAAI,MAAM,UAAU;CAAM;AACrD;;;;;;;;AA6CD,SAAgB,WACfC,YACgB;AAChB,QAAO,WAAW,IAAI,CAAC,cAAc;AACpC,OAAK,aAAa,UAAU,CAAE,OAAM,IAAI,cAAc;AAEtD,SAAO,UAAU;CACjB,EAAC;AACF;;;;;;;;;;AAWD,SAAgB,MACfC,YACAC,WAA8B,CAAE,GACrB;AACX,QAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,UAAU,GAAG,WAAW,IAAI,CAAC,EAAE,IAAI,KAAK,GAAG,AAAC,EAAE;AACrE;;AAGD,IAAa,gBAAb,cAAmC,MAAM;CACxC,YAAqBC,OAAgB;EACpC,MAAM,cACE,UAAU,YAAY,UAAU,QAAQ,iBAAiB,SAC5D,eAAe,OAAQ,MAAmC,YAAY,CAAC,MACvE,WAAW,MAAM;AAEtB,SACE,+CAA+C,KAAK,+EAGrD;EAVmB;AAWpB,OAAK,OAAO;CACZ;AACD;;;;;;;;AASD,SAAgB,aAAaA,OAAqC;AACjE,YAAW,UAAU,YAAY,UAAU,KAAM,QAAO;CAExD,MAAM,YAAY;AAElB,eACQ,UAAU,OAAO,mBACjB,UAAU,YAAY,qBACrB,UAAU,SAAiC,gBAAgB;AAEpE;;;;;;;;AASD,SAAgB,UACfC,QAC0B;AAG1B,QAAO,aAAa,OAAO,GACvB,OAAO,UACP;AACJ"}
@@ -0,0 +1,8 @@
1
+ const require_construct_interface = require('./construct-interface-BfjcOD_E.cjs');
2
+
3
+ exports.NotAConstruct = require_construct_interface.NotAConstruct;
4
+ exports.edgeTo = require_construct_interface.edgeTo;
5
+ exports.idsOf = require_construct_interface.idsOf;
6
+ exports.isConsumable = require_construct_interface.isConsumable;
7
+ exports.serviceOf = require_construct_interface.serviceOf;
8
+ exports.servicesOf = require_construct_interface.servicesOf;
@@ -0,0 +1,2 @@
1
+ import { Construct, Consumable, Declarable, Infer, NameOf, NotAConstruct, ServicesOf, edgeTo, idsOf, isConsumable, serviceOf, servicesOf } from "./construct-interface-D2nNkHUN.cjs";
2
+ export { Construct, Consumable, Declarable, Infer, NameOf, NotAConstruct, ServicesOf, edgeTo, idsOf, isConsumable, serviceOf, servicesOf };
@@ -0,0 +1,2 @@
1
+ import { Construct, Consumable, Declarable, Infer, NameOf, NotAConstruct, ServicesOf, edgeTo, idsOf, isConsumable, serviceOf, servicesOf } from "./construct-interface-BqwRNYA2.mjs";
2
+ export { Construct, Consumable, Declarable, Infer, NameOf, NotAConstruct, ServicesOf, edgeTo, idsOf, isConsumable, serviceOf, servicesOf };
@@ -0,0 +1,3 @@
1
+ import { NotAConstruct, edgeTo, idsOf, isConsumable, serviceOf, servicesOf } from "./construct-interface-Z4CpS8tK.mjs";
2
+
3
+ export { NotAConstruct, edgeTo, idsOf, isConsumable, serviceOf, servicesOf };