@geekmidas/constructs 10.0.0-alpha.12 → 10.0.0-alpha.120

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 (454) hide show
  1. package/README.md +222 -158
  2. package/dist/Construct-B7AXn0xH.d.mts +230 -0
  3. package/dist/Construct-B7AXn0xH.d.mts.map +1 -0
  4. package/dist/Construct-CFW0zjdD.d.cts +230 -0
  5. package/dist/Construct-CFW0zjdD.d.cts.map +1 -0
  6. package/dist/{Construct-BD5neF7w.mjs → Construct-CKUA-CTA.mjs} +35 -35
  7. package/dist/Construct-CKUA-CTA.mjs.map +1 -0
  8. package/dist/{Construct-CyS3RpTL.cjs → Construct-DEOVauyA.cjs} +55 -49
  9. package/dist/Construct-DEOVauyA.cjs.map +1 -0
  10. package/dist/{Cron-DmQ8vQ4b.d.cts → Cron-bdGRSROY.d.cts} +15 -9
  11. package/dist/Cron-bdGRSROY.d.cts.map +1 -0
  12. package/dist/{Cron-dh4rUgib.d.mts → Cron-i4Uetezh.d.mts} +15 -9
  13. package/dist/Cron-i4Uetezh.d.mts.map +1 -0
  14. package/dist/CronBuilder-9H4BnD6W.d.mts +47 -0
  15. package/dist/CronBuilder-9H4BnD6W.d.mts.map +1 -0
  16. package/dist/{CronBuilder-Da0C0edR.cjs → CronBuilder-BXTG10u5.cjs} +47 -31
  17. package/dist/CronBuilder-BXTG10u5.cjs.map +1 -0
  18. package/dist/CronBuilder-B_24LZpn.d.cts +47 -0
  19. package/dist/CronBuilder-B_24LZpn.d.cts.map +1 -0
  20. package/dist/{CronBuilder-CYKT5RiO.mjs → CronBuilder-D3sF9tS_.mjs} +37 -21
  21. package/dist/CronBuilder-D3sF9tS_.mjs.map +1 -0
  22. package/dist/{Endpoint-BjWKinFA.d.mts → Endpoint-CeFkSwh5.d.mts} +129 -99
  23. package/dist/Endpoint-CeFkSwh5.d.mts.map +1 -0
  24. package/dist/{Endpoint-dav89W6-.d.cts → Endpoint-DgrpG15P.d.cts} +127 -97
  25. package/dist/Endpoint-DgrpG15P.d.cts.map +1 -0
  26. package/dist/{Endpoint-DCQPMdUX.mjs → Endpoint-gPXhHKhJ.mjs} +208 -100
  27. package/dist/Endpoint-gPXhHKhJ.mjs.map +1 -0
  28. package/dist/{Endpoint-DcWXE-SZ.cjs → Endpoint-yhR2T2Wt.cjs} +248 -122
  29. package/dist/Endpoint-yhR2T2Wt.cjs.map +1 -0
  30. package/dist/{EndpointFactory-CdWB7wPw.cjs → EndpointFactory-CSrAyazj.cjs} +361 -112
  31. package/dist/EndpointFactory-CSrAyazj.cjs.map +1 -0
  32. package/dist/{index-lAO9egTb.d.mts → EndpointFactory-Cc863XJS.d.cts} +190 -136
  33. package/dist/EndpointFactory-Cc863XJS.d.cts.map +1 -0
  34. package/dist/{index-Bd5FqCoe.d.cts → EndpointFactory-Dbw9ugkX.d.mts} +189 -135
  35. package/dist/EndpointFactory-Dbw9ugkX.d.mts.map +1 -0
  36. package/dist/{EndpointFactory-CjV8F_lJ.mjs → EndpointFactory-c2ZugGig.mjs} +283 -76
  37. package/dist/EndpointFactory-c2ZugGig.mjs.map +1 -0
  38. package/dist/Function-B0uZhZnU.d.cts +76 -0
  39. package/dist/Function-B0uZhZnU.d.cts.map +1 -0
  40. package/dist/Function-B_9R7Zy1.d.mts +76 -0
  41. package/dist/Function-B_9R7Zy1.d.mts.map +1 -0
  42. package/dist/{HonoEndpointAdaptor-DtL9j19R.cjs → HonoEndpointAdaptor-CN1jjUBJ.cjs} +115 -71
  43. package/dist/HonoEndpointAdaptor-CN1jjUBJ.cjs.map +1 -0
  44. package/dist/{HonoEndpointAdaptor-P1ahhZHu.mjs → HonoEndpointAdaptor-euH1oSdY.mjs} +105 -64
  45. package/dist/HonoEndpointAdaptor-euH1oSdY.mjs.map +1 -0
  46. package/dist/{Queue-D7ZuwBhy.d.cts → Queue-B-dDXyjF.d.mts} +48 -48
  47. package/dist/Queue-B-dDXyjF.d.mts.map +1 -0
  48. package/dist/Queue-BhuofM3k.cjs +109 -0
  49. package/dist/Queue-BhuofM3k.cjs.map +1 -0
  50. package/dist/{Queue-gVGfi2Yk.d.mts → Queue-JbIjVtTf.d.cts} +49 -49
  51. package/dist/Queue-JbIjVtTf.d.cts.map +1 -0
  52. package/dist/Queue-cmhqEBOB.mjs +104 -0
  53. package/dist/Queue-cmhqEBOB.mjs.map +1 -0
  54. package/dist/QueueBuilder-48W-q8In.d.mts +75 -0
  55. package/dist/QueueBuilder-48W-q8In.d.mts.map +1 -0
  56. package/dist/QueueBuilder-DXu1qxT1.mjs +118 -0
  57. package/dist/QueueBuilder-DXu1qxT1.mjs.map +1 -0
  58. package/dist/QueueBuilder-DdU2klPu.cjs +135 -0
  59. package/dist/QueueBuilder-DdU2klPu.cjs.map +1 -0
  60. package/dist/QueueBuilder-MfpkJ3R9.d.cts +75 -0
  61. package/dist/QueueBuilder-MfpkJ3R9.d.cts.map +1 -0
  62. package/dist/{Subscriber-2mEi0ImH.d.cts → Subscriber-CEt7kHkc.d.cts} +29 -20
  63. package/dist/Subscriber-CEt7kHkc.d.cts.map +1 -0
  64. package/dist/{Subscriber-xTJ9ayPN.d.mts → Subscriber-dsxc5LKa.d.mts} +29 -20
  65. package/dist/Subscriber-dsxc5LKa.d.mts.map +1 -0
  66. package/dist/SubscriberBuilder-BRa_nrmH.d.cts +67 -0
  67. package/dist/SubscriberBuilder-BRa_nrmH.d.cts.map +1 -0
  68. package/dist/SubscriberBuilder-D9bkrYzH.d.mts +67 -0
  69. package/dist/SubscriberBuilder-D9bkrYzH.d.mts.map +1 -0
  70. package/dist/{SubscriberBuilder-BjkbeT9l.mjs → SubscriberBuilder-DRXfxWn_.mjs} +50 -24
  71. package/dist/SubscriberBuilder-DRXfxWn_.mjs.map +1 -0
  72. package/dist/{SubscriberBuilder-4OPehf2R.cjs → SubscriberBuilder-M2EAgQhC.cjs} +61 -36
  73. package/dist/SubscriberBuilder-M2EAgQhC.cjs.map +1 -0
  74. package/dist/Topic-D2R0r24C.mjs +99 -0
  75. package/dist/Topic-D2R0r24C.mjs.map +1 -0
  76. package/dist/Topic-DwS3QO0m.cjs +104 -0
  77. package/dist/Topic-DwS3QO0m.cjs.map +1 -0
  78. package/dist/adaptors/aws.cjs +200 -246
  79. package/dist/adaptors/aws.cjs.map +1 -1
  80. package/dist/adaptors/aws.d.cts +58 -62
  81. package/dist/adaptors/aws.d.cts.map +1 -1
  82. package/dist/adaptors/aws.d.mts +59 -63
  83. package/dist/adaptors/aws.d.mts.map +1 -1
  84. package/dist/adaptors/aws.mjs +171 -219
  85. package/dist/adaptors/aws.mjs.map +1 -1
  86. package/dist/adaptors/hono.cjs +3 -10
  87. package/dist/adaptors/hono.d.cts +7 -16
  88. package/dist/adaptors/hono.d.cts.map +1 -1
  89. package/dist/adaptors/hono.d.mts +9 -18
  90. package/dist/adaptors/hono.d.mts.map +1 -1
  91. package/dist/adaptors/hono.mjs +2 -10
  92. package/dist/adaptors/testing.cjs +765 -99
  93. package/dist/adaptors/testing.cjs.map +1 -1
  94. package/dist/adaptors/testing.d.cts +351 -54
  95. package/dist/adaptors/testing.d.cts.map +1 -1
  96. package/dist/adaptors/testing.d.mts +351 -54
  97. package/dist/adaptors/testing.d.mts.map +1 -1
  98. package/dist/adaptors/testing.mjs +726 -78
  99. package/dist/adaptors/testing.mjs.map +1 -1
  100. package/dist/auth-BMCJN30Y.d.cts +268 -0
  101. package/dist/auth-BMCJN30Y.d.cts.map +1 -0
  102. package/dist/auth-D_0788uW.d.mts +268 -0
  103. package/dist/auth-D_0788uW.d.mts.map +1 -0
  104. package/dist/auth.cjs +301 -33
  105. package/dist/auth.cjs.map +1 -1
  106. package/dist/auth.d.cts +2 -108
  107. package/dist/auth.d.mts +2 -108
  108. package/dist/auth.mjs +289 -27
  109. package/dist/auth.mjs.map +1 -1
  110. package/dist/{cache-BrRz3fEB.d.mts → cache-5QZzh5Er.d.mts} +3 -6
  111. package/dist/cache-5QZzh5Er.d.mts.map +1 -0
  112. package/dist/{cache-BtZY_tHe.d.cts → cache-DnGDGly3.d.cts} +3 -6
  113. package/dist/cache-DnGDGly3.d.cts.map +1 -0
  114. package/dist/cache.cjs +68 -2
  115. package/dist/cache.cjs.map +1 -0
  116. package/dist/cache.d.cts +1 -2
  117. package/dist/cache.d.mts +1 -2
  118. package/dist/cache.mjs +67 -2
  119. package/dist/cache.mjs.map +1 -0
  120. package/dist/cipher-C1lEFX63.mjs +225 -0
  121. package/dist/cipher-C1lEFX63.mjs.map +1 -0
  122. package/dist/cipher-CVxfwLjk.cjs +332 -0
  123. package/dist/cipher-CVxfwLjk.cjs.map +1 -0
  124. package/dist/cipher-DSDxPRIp.d.cts +106 -0
  125. package/dist/cipher-DSDxPRIp.d.cts.map +1 -0
  126. package/dist/cipher-DSDxPRIp.d.mts +106 -0
  127. package/dist/cipher-DSDxPRIp.d.mts.map +1 -0
  128. package/dist/{clone-DblgEZZa.mjs → clone-EKNovYHu.mjs} +3 -3
  129. package/dist/clone-EKNovYHu.mjs.map +1 -0
  130. package/dist/{clone-Dy0cR2SZ.cjs → clone-UGJpvQnL.cjs} +7 -8
  131. package/dist/clone-UGJpvQnL.cjs.map +1 -0
  132. package/dist/{construct-interface-D9d4Gm4p.d.cts → construct-interface-B1AfqRl4.d.cts} +42 -11
  133. package/dist/construct-interface-B1AfqRl4.d.cts.map +1 -0
  134. package/dist/{construct-interface-g5GM5pwR.d.mts → construct-interface-ZvYQbivO.d.mts} +42 -11
  135. package/dist/construct-interface-ZvYQbivO.d.mts.map +1 -0
  136. package/dist/construct-interface.cjs +113 -7
  137. package/dist/construct-interface.cjs.map +1 -0
  138. package/dist/construct-interface.d.cts +2 -2
  139. package/dist/construct-interface.d.mts +2 -2
  140. package/dist/construct-interface.mjs +106 -2
  141. package/dist/construct-interface.mjs.map +1 -0
  142. package/dist/credential-DYymbp_7.cjs +257 -0
  143. package/dist/credential-DYymbp_7.cjs.map +1 -0
  144. package/dist/credential-DfSAOOdY.mjs +222 -0
  145. package/dist/credential-DfSAOOdY.mjs.map +1 -0
  146. package/dist/credential.cjs +8 -96
  147. package/dist/credential.d.cts +2 -61
  148. package/dist/credential.d.mts +2 -61
  149. package/dist/credential.mjs +2 -94
  150. package/dist/crons/index.cjs +129 -7
  151. package/dist/crons/index.cjs.map +1 -1
  152. package/dist/crons/index.d.cts +45 -11
  153. package/dist/crons/index.d.cts.map +1 -1
  154. package/dist/crons/index.d.mts +45 -11
  155. package/dist/crons/index.d.mts.map +1 -1
  156. package/dist/crons/index.mjs +127 -8
  157. package/dist/crons/index.mjs.map +1 -1
  158. package/dist/database/kysely.cjs +4 -181
  159. package/dist/database/kysely.d.cts +2 -152
  160. package/dist/database/kysely.d.mts +2 -152
  161. package/dist/database/kysely.mjs +2 -180
  162. package/dist/email.cjs +25 -12
  163. package/dist/email.cjs.map +1 -1
  164. package/dist/email.d.cts +3 -7
  165. package/dist/email.d.cts.map +1 -1
  166. package/dist/email.d.mts +4 -8
  167. package/dist/email.d.mts.map +1 -1
  168. package/dist/email.mjs +16 -3
  169. package/dist/email.mjs.map +1 -1
  170. package/dist/encryption/kms.cjs +95 -0
  171. package/dist/encryption/kms.cjs.map +1 -0
  172. package/dist/encryption/kms.d.cts +7 -0
  173. package/dist/encryption/kms.d.cts.map +1 -0
  174. package/dist/encryption/kms.d.mts +7 -0
  175. package/dist/encryption/kms.d.mts.map +1 -0
  176. package/dist/encryption/kms.mjs +93 -0
  177. package/dist/encryption/kms.mjs.map +1 -0
  178. package/dist/encryption.cjs +116 -0
  179. package/dist/encryption.cjs.map +1 -0
  180. package/dist/encryption.d.cts +37 -0
  181. package/dist/encryption.d.cts.map +1 -0
  182. package/dist/encryption.d.mts +37 -0
  183. package/dist/encryption.d.mts.map +1 -0
  184. package/dist/encryption.mjs +101 -0
  185. package/dist/encryption.mjs.map +1 -0
  186. package/dist/endpoints/index.cjs +27 -16
  187. package/dist/endpoints/index.d.cts +105 -7
  188. package/dist/endpoints/index.d.cts.map +1 -0
  189. package/dist/endpoints/index.d.mts +105 -7
  190. package/dist/endpoints/index.d.mts.map +1 -0
  191. package/dist/endpoints/index.mjs +6 -10
  192. package/dist/expire-C586zznE.d.cts +38 -0
  193. package/dist/expire-C586zznE.d.cts.map +1 -0
  194. package/dist/expire-C586zznE.d.mts +38 -0
  195. package/dist/expire-C586zznE.d.mts.map +1 -0
  196. package/dist/expire-CieftS01.cjs +67 -0
  197. package/dist/expire-CieftS01.cjs.map +1 -0
  198. package/dist/expire-CpzUAfr9.mjs +50 -0
  199. package/dist/expire-CpzUAfr9.mjs.map +1 -0
  200. package/dist/external-api.cjs +106 -0
  201. package/dist/external-api.cjs.map +1 -0
  202. package/dist/external-api.d.cts +2 -0
  203. package/dist/external-api.d.mts +2 -0
  204. package/dist/external-api.mjs +103 -0
  205. package/dist/external-api.mjs.map +1 -0
  206. package/dist/fake-B7rvi4Qp.d.cts +201 -0
  207. package/dist/fake-B7rvi4Qp.d.cts.map +1 -0
  208. package/dist/fake-JXbkdao8.d.mts +201 -0
  209. package/dist/fake-JXbkdao8.d.mts.map +1 -0
  210. package/dist/file-server.cjs +66 -11
  211. package/dist/file-server.cjs.map +1 -1
  212. package/dist/file-server.d.cts +25 -10
  213. package/dist/file-server.d.cts.map +1 -1
  214. package/dist/file-server.d.mts +25 -10
  215. package/dist/file-server.d.mts.map +1 -1
  216. package/dist/file-server.mjs +58 -4
  217. package/dist/file-server.mjs.map +1 -1
  218. package/dist/functions/index.cjs +3 -6
  219. package/dist/functions/index.d.cts +3 -4
  220. package/dist/functions/index.d.mts +3 -4
  221. package/dist/functions/index.mjs +2 -6
  222. package/dist/{functions-14lpEFL4.mjs → functions-CTI-hDem.mjs} +376 -238
  223. package/dist/{functions-14lpEFL4.mjs.map → functions-CTI-hDem.mjs.map} +1 -1
  224. package/dist/{functions-i_la-N5r.cjs → functions-D7O5SGVc.cjs} +414 -264
  225. package/dist/functions-D7O5SGVc.cjs.map +1 -0
  226. package/dist/index-Cd2w-DRL.d.cts +115 -0
  227. package/dist/index-Cd2w-DRL.d.cts.map +1 -0
  228. package/dist/index-DdRjYhiJ.d.cts +119 -0
  229. package/dist/index-DdRjYhiJ.d.cts.map +1 -0
  230. package/dist/index-DdRjYhiJ.d.mts +119 -0
  231. package/dist/index-DdRjYhiJ.d.mts.map +1 -0
  232. package/dist/index-aBIcAiH5.d.mts +115 -0
  233. package/dist/index-aBIcAiH5.d.mts.map +1 -0
  234. package/dist/index.cjs +6 -3
  235. package/dist/index.d.cts +27 -4
  236. package/dist/index.d.cts.map +1 -0
  237. package/dist/index.d.mts +27 -4
  238. package/dist/index.d.mts.map +1 -0
  239. package/dist/index.mjs +3 -3
  240. package/dist/kysely-BHYV-WC-.d.cts +216 -0
  241. package/dist/kysely-BHYV-WC-.d.cts.map +1 -0
  242. package/dist/kysely-CAW3QSqp.d.mts +216 -0
  243. package/dist/kysely-CAW3QSqp.d.mts.map +1 -0
  244. package/dist/kysely-Cs4uPO8k.mjs +371 -0
  245. package/dist/kysely-Cs4uPO8k.mjs.map +1 -0
  246. package/dist/kysely-CukArHJ0.cjs +384 -0
  247. package/dist/kysely-CukArHJ0.cjs.map +1 -0
  248. package/dist/{telemetry-C3L0iS28.d.cts → lambdaTelemetry-8vnmVZQ5.d.cts} +3 -6
  249. package/dist/lambdaTelemetry-8vnmVZQ5.d.cts.map +1 -0
  250. package/dist/{telemetry-D7bVFLGi.d.mts → lambdaTelemetry-8vnmVZQ5.d.mts} +3 -6
  251. package/dist/lambdaTelemetry-8vnmVZQ5.d.mts.map +1 -0
  252. package/dist/mobile-app.cjs +74 -0
  253. package/dist/mobile-app.cjs.map +1 -0
  254. package/dist/mobile-app.d.cts +73 -0
  255. package/dist/mobile-app.d.cts.map +1 -0
  256. package/dist/mobile-app.d.mts +73 -0
  257. package/dist/mobile-app.d.mts.map +1 -0
  258. package/dist/mobile-app.mjs +73 -0
  259. package/dist/mobile-app.mjs.map +1 -0
  260. package/dist/object-storage.cjs +26 -11
  261. package/dist/object-storage.cjs.map +1 -1
  262. package/dist/object-storage.d.cts +12 -7
  263. package/dist/object-storage.d.cts.map +1 -1
  264. package/dist/object-storage.d.mts +12 -7
  265. package/dist/object-storage.d.mts.map +1 -1
  266. package/dist/object-storage.mjs +18 -5
  267. package/dist/object-storage.mjs.map +1 -1
  268. package/dist/queue/index.cjs +6 -189
  269. package/dist/queue/index.d.cts +3 -60
  270. package/dist/queue/index.d.mts +3 -60
  271. package/dist/queue/index.mjs +3 -186
  272. package/dist/random-password.cjs +86 -0
  273. package/dist/random-password.cjs.map +1 -0
  274. package/dist/random-password.d.cts +30 -0
  275. package/dist/random-password.d.cts.map +1 -0
  276. package/dist/random-password.d.mts +30 -0
  277. package/dist/random-password.d.mts.map +1 -0
  278. package/dist/random-password.mjs +84 -0
  279. package/dist/random-password.mjs.map +1 -0
  280. package/dist/{lazyAccessors-BoJN3SMd.mjs → readRequestBody-BTIl3k-D.mjs} +117 -60
  281. package/dist/readRequestBody-BTIl3k-D.mjs.map +1 -0
  282. package/dist/readRequestBody-Dej_L3c4.cjs +342 -0
  283. package/dist/readRequestBody-Dej_L3c4.cjs.map +1 -0
  284. package/dist/requestLogger-BZcXwdBs.cjs +207 -0
  285. package/dist/requestLogger-BZcXwdBs.cjs.map +1 -0
  286. package/dist/requestLogger-pA4gi3E1.mjs +178 -0
  287. package/dist/requestLogger-pA4gi3E1.mjs.map +1 -0
  288. package/dist/rest-api.cjs +90 -59
  289. package/dist/rest-api.cjs.map +1 -1
  290. package/dist/rest-api.d.cts +70 -42
  291. package/dist/rest-api.d.cts.map +1 -1
  292. package/dist/rest-api.d.mts +70 -42
  293. package/dist/rest-api.d.mts.map +1 -1
  294. package/dist/rest-api.mjs +82 -51
  295. package/dist/rest-api.mjs.map +1 -1
  296. package/dist/{chunk-DWy1uDak.cjs → rolldown-runtime-y5ARvAq5.cjs} +14 -18
  297. package/dist/runSubscriber-BHvJ8POr.mjs +109 -0
  298. package/dist/runSubscriber-BHvJ8POr.mjs.map +1 -0
  299. package/dist/runSubscriber-D8nLXIv1.cjs +126 -0
  300. package/dist/runSubscriber-D8nLXIv1.cjs.map +1 -0
  301. package/dist/shutdown-BMJmAhSt.cjs +38 -0
  302. package/dist/shutdown-BMJmAhSt.cjs.map +1 -0
  303. package/dist/shutdown-C7xa8x9S.mjs +27 -0
  304. package/dist/shutdown-C7xa8x9S.mjs.map +1 -0
  305. package/dist/site.cjs +33 -7
  306. package/dist/site.cjs.map +1 -1
  307. package/dist/site.d.cts +17 -7
  308. package/dist/site.d.cts.map +1 -1
  309. package/dist/site.d.mts +17 -7
  310. package/dist/site.d.mts.map +1 -1
  311. package/dist/site.mjs +29 -3
  312. package/dist/site.mjs.map +1 -1
  313. package/dist/stages-BSCF19o2.d.cts +56 -0
  314. package/dist/stages-BSCF19o2.d.cts.map +1 -0
  315. package/dist/stages-BSCF19o2.d.mts +56 -0
  316. package/dist/stages-BSCF19o2.d.mts.map +1 -0
  317. package/dist/subscribers/index.cjs +118 -6
  318. package/dist/subscribers/index.cjs.map +1 -0
  319. package/dist/subscribers/index.d.cts +51 -6
  320. package/dist/subscribers/index.d.cts.map +1 -0
  321. package/dist/subscribers/index.d.mts +51 -6
  322. package/dist/subscribers/index.d.mts.map +1 -0
  323. package/dist/subscribers/index.mjs +115 -5
  324. package/dist/subscribers/index.mjs.map +1 -0
  325. package/dist/surfaceEnv-CNimK76p.cjs +56 -0
  326. package/dist/surfaceEnv-CNimK76p.cjs.map +1 -0
  327. package/dist/surfaceEnv-wMT5QzgZ.mjs +45 -0
  328. package/dist/surfaceEnv-wMT5QzgZ.mjs.map +1 -0
  329. package/dist/telemetry-B48RLjyk.d.cts +40 -0
  330. package/dist/telemetry-B48RLjyk.d.cts.map +1 -0
  331. package/dist/telemetry-BEoBn6GO.d.mts +40 -0
  332. package/dist/telemetry-BEoBn6GO.d.mts.map +1 -0
  333. package/dist/telemetry.cjs +56 -0
  334. package/dist/telemetry.cjs.map +1 -0
  335. package/dist/telemetry.d.cts +2 -0
  336. package/dist/telemetry.d.mts +2 -0
  337. package/dist/telemetry.mjs +55 -0
  338. package/dist/telemetry.mjs.map +1 -0
  339. package/dist/topic/index.cjs +3 -137
  340. package/dist/topic/index.d.cts +2 -4
  341. package/dist/topic/index.d.mts +2 -4
  342. package/dist/topic/index.mjs +2 -134
  343. package/dist/tracing-Bbj1uoFJ.mjs +127 -0
  344. package/dist/tracing-Bbj1uoFJ.mjs.map +1 -0
  345. package/dist/tracing-C0ooU0V2.cjs +150 -0
  346. package/dist/tracing-C0ooU0V2.cjs.map +1 -0
  347. package/dist/{types-BlAkSuGI.d.cts → types-DMuSQeLL.d.cts} +3 -5
  348. package/dist/types-DMuSQeLL.d.cts.map +1 -0
  349. package/dist/{types-aKksMEWL.d.mts → types-DMuSQeLL.d.mts} +3 -5
  350. package/dist/types-DMuSQeLL.d.mts.map +1 -0
  351. package/dist/types.d.cts +1 -1
  352. package/dist/types.d.mts +1 -1
  353. package/dist/types.mjs +1 -0
  354. package/dist/worker.cjs +59 -34
  355. package/dist/worker.cjs.map +1 -1
  356. package/dist/worker.d.cts +70 -45
  357. package/dist/worker.d.cts.map +1 -1
  358. package/dist/worker.d.mts +71 -45
  359. package/dist/worker.d.mts.map +1 -1
  360. package/dist/worker.mjs +54 -29
  361. package/dist/worker.mjs.map +1 -1
  362. package/package.json +115 -41
  363. package/dist/Construct-BD5neF7w.mjs.map +0 -1
  364. package/dist/Construct-C0ijr2qp.d.cts +0 -117
  365. package/dist/Construct-C0ijr2qp.d.cts.map +0 -1
  366. package/dist/Construct-Ct8nalEi.d.mts +0 -117
  367. package/dist/Construct-Ct8nalEi.d.mts.map +0 -1
  368. package/dist/Construct-CyS3RpTL.cjs.map +0 -1
  369. package/dist/Cron-DmQ8vQ4b.d.cts.map +0 -1
  370. package/dist/Cron-dh4rUgib.d.mts.map +0 -1
  371. package/dist/CronBuilder-BquXDbDI.d.cts +0 -44
  372. package/dist/CronBuilder-BquXDbDI.d.cts.map +0 -1
  373. package/dist/CronBuilder-CGgY2080.d.mts +0 -44
  374. package/dist/CronBuilder-CGgY2080.d.mts.map +0 -1
  375. package/dist/CronBuilder-CYKT5RiO.mjs.map +0 -1
  376. package/dist/CronBuilder-Da0C0edR.cjs.map +0 -1
  377. package/dist/Endpoint-BjWKinFA.d.mts.map +0 -1
  378. package/dist/Endpoint-DCQPMdUX.mjs.map +0 -1
  379. package/dist/Endpoint-DcWXE-SZ.cjs.map +0 -1
  380. package/dist/Endpoint-dav89W6-.d.cts.map +0 -1
  381. package/dist/EndpointFactory-CdWB7wPw.cjs.map +0 -1
  382. package/dist/EndpointFactory-CjV8F_lJ.mjs.map +0 -1
  383. package/dist/HonoEndpointAdaptor-DtL9j19R.cjs.map +0 -1
  384. package/dist/HonoEndpointAdaptor-P1ahhZHu.mjs.map +0 -1
  385. package/dist/Queue-D7ZuwBhy.d.cts.map +0 -1
  386. package/dist/Queue-gVGfi2Yk.d.mts.map +0 -1
  387. package/dist/Subscriber-2mEi0ImH.d.cts.map +0 -1
  388. package/dist/Subscriber-xTJ9ayPN.d.mts.map +0 -1
  389. package/dist/SubscriberBuilder-4OPehf2R.cjs.map +0 -1
  390. package/dist/SubscriberBuilder-BjkbeT9l.mjs.map +0 -1
  391. package/dist/SubscriberBuilder-Dptmo-1A.d.mts +0 -62
  392. package/dist/SubscriberBuilder-Dptmo-1A.d.mts.map +0 -1
  393. package/dist/SubscriberBuilder-waNhzjSM.d.cts +0 -62
  394. package/dist/SubscriberBuilder-waNhzjSM.d.cts.map +0 -1
  395. package/dist/Topic-19QeHBIR.d.cts +0 -91
  396. package/dist/Topic-19QeHBIR.d.cts.map +0 -1
  397. package/dist/Topic-DuFeqkBh.d.mts +0 -91
  398. package/dist/Topic-DuFeqkBh.d.mts.map +0 -1
  399. package/dist/auth.d.cts.map +0 -1
  400. package/dist/auth.d.mts.map +0 -1
  401. package/dist/cache-0ANvRQnD.mjs +0 -51
  402. package/dist/cache-0ANvRQnD.mjs.map +0 -1
  403. package/dist/cache-3WSvAulx.cjs +0 -57
  404. package/dist/cache-3WSvAulx.cjs.map +0 -1
  405. package/dist/cache-BrRz3fEB.d.mts.map +0 -1
  406. package/dist/cache-BtZY_tHe.d.cts.map +0 -1
  407. package/dist/clone-DblgEZZa.mjs.map +0 -1
  408. package/dist/clone-Dy0cR2SZ.cjs.map +0 -1
  409. package/dist/construct-interface-BfjcOD_E.cjs +0 -117
  410. package/dist/construct-interface-BfjcOD_E.cjs.map +0 -1
  411. package/dist/construct-interface-D9d4Gm4p.d.cts.map +0 -1
  412. package/dist/construct-interface-Z4CpS8tK.mjs +0 -81
  413. package/dist/construct-interface-Z4CpS8tK.mjs.map +0 -1
  414. package/dist/construct-interface-g5GM5pwR.d.mts.map +0 -1
  415. package/dist/credential.cjs.map +0 -1
  416. package/dist/credential.d.cts.map +0 -1
  417. package/dist/credential.d.mts.map +0 -1
  418. package/dist/credential.mjs.map +0 -1
  419. package/dist/database/kysely.cjs.map +0 -1
  420. package/dist/database/kysely.d.cts.map +0 -1
  421. package/dist/database/kysely.d.mts.map +0 -1
  422. package/dist/database/kysely.mjs.map +0 -1
  423. package/dist/functions-i_la-N5r.cjs.map +0 -1
  424. package/dist/index-Bd5FqCoe.d.cts.map +0 -1
  425. package/dist/index-BknhM6Ux.d.mts +0 -31
  426. package/dist/index-BknhM6Ux.d.mts.map +0 -1
  427. package/dist/index-CBSfrowv.d.cts +0 -31
  428. package/dist/index-CBSfrowv.d.cts.map +0 -1
  429. package/dist/index-D24Xm79M.d.cts +0 -171
  430. package/dist/index-D24Xm79M.d.cts.map +0 -1
  431. package/dist/index-_ajboYxK.d.mts +0 -171
  432. package/dist/index-_ajboYxK.d.mts.map +0 -1
  433. package/dist/index-lAO9egTb.d.mts.map +0 -1
  434. package/dist/lazyAccessors-BoJN3SMd.mjs.map +0 -1
  435. package/dist/lazyAccessors-e3j2oE2m.cjs +0 -274
  436. package/dist/lazyAccessors-e3j2oE2m.cjs.map +0 -1
  437. package/dist/processAudits-CGqttuXm.cjs +0 -92
  438. package/dist/processAudits-CGqttuXm.cjs.map +0 -1
  439. package/dist/processAudits-Dmts9H_b.mjs +0 -80
  440. package/dist/processAudits-Dmts9H_b.mjs.map +0 -1
  441. package/dist/queue/index.cjs.map +0 -1
  442. package/dist/queue/index.d.cts.map +0 -1
  443. package/dist/queue/index.d.mts.map +0 -1
  444. package/dist/queue/index.mjs.map +0 -1
  445. package/dist/surfaceEnv-BFXEms2f.cjs +0 -39
  446. package/dist/surfaceEnv-BFXEms2f.cjs.map +0 -1
  447. package/dist/surfaceEnv-C3Ktahea.mjs +0 -27
  448. package/dist/surfaceEnv-C3Ktahea.mjs.map +0 -1
  449. package/dist/telemetry-C3L0iS28.d.cts.map +0 -1
  450. package/dist/telemetry-D7bVFLGi.d.mts.map +0 -1
  451. package/dist/topic/index.cjs.map +0 -1
  452. package/dist/topic/index.mjs.map +0 -1
  453. package/dist/types-BlAkSuGI.d.cts.map +0 -1
  454. package/dist/types-aKksMEWL.d.mts.map +0 -1
@@ -1,4 +1,3 @@
1
-
2
1
  //#region src/clone.ts
3
2
  /**
4
3
  * Cloning a builder, without enumerating its fields.
@@ -34,12 +33,12 @@ function cloneWith(instance, delta) {
34
33
  const next = Object.create(Object.getPrototypeOf(instance));
35
34
  return Object.assign(next, instance, delta);
36
35
  }
37
-
38
36
  //#endregion
39
- Object.defineProperty(exports, 'cloneWith', {
40
- enumerable: true,
41
- get: function () {
42
- return cloneWith;
43
- }
37
+ Object.defineProperty(exports, "cloneWith", {
38
+ enumerable: true,
39
+ get: function() {
40
+ return cloneWith;
41
+ }
44
42
  });
45
- //# sourceMappingURL=clone-Dy0cR2SZ.cjs.map
43
+
44
+ //# sourceMappingURL=clone-UGJpvQnL.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clone-UGJpvQnL.cjs","names":[],"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,UACf,UACA,OACI;CACJ,MAAM,OAAO,OAAO,OAAO,OAAO,eAAe,QAAQ,CAAC;CAE1D,OAAO,OAAO,OAAO,MAAM,UAAU,KAAK;AAC3C"}
@@ -1,8 +1,7 @@
1
+ import { EnvironmentParser } from "@geekmidas/envkit";
1
2
  import { Service } from "@geekmidas/services";
2
3
  import { Declaration, Dependency } from "@geekmidas/manifest";
3
-
4
4
  //#region src/construct-interface.d.ts
5
-
6
5
  /**
7
6
  * @typeParam TName - the construct's canonical id, PascalCase. Keeping it a
8
7
  * literal is what lets the service key be `Uncapitalize<TName>` — a TypeScript
@@ -27,8 +26,8 @@ interface Construct<TName extends string = string, TClient = never> {
27
26
  * The consumable face — the address this construct owns, as a client.
28
27
  *
29
28
  * 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.
29
+ * and `ServiceDiscovery` cache by service *object*, so a getter returning a
30
+ * fresh literal on every access would never hit either cache.
32
31
  */
33
32
  readonly service: [TClient] extends [never] ? never : Service<Uncapitalize<TName>, TClient>;
34
33
  }
@@ -45,6 +44,17 @@ interface Declarable<TName extends string = string> {
45
44
  readonly id: TName;
46
45
  declare(): Declaration[];
47
46
  }
47
+ /**
48
+ * A construct that authenticates requests — what `RestApi.auth()` takes.
49
+ *
50
+ * `verify` is the one thing every provider shares: given a request's headers,
51
+ * whose request is it — the session, or `null` when there is none. Whether the
52
+ * provider is a server mounted beside the API, deployed elsewhere, or an issuer
53
+ * somebody else runs is its own business; a surface only ever asks this.
54
+ */
55
+ interface Authenticator<TSession = unknown> extends Declarable {
56
+ verify(headers: Headers, envParser: EnvironmentParser<{}>): Promise<TSession | null>;
57
+ }
48
58
  /**
49
59
  * The edge that points at a construct.
50
60
  *
@@ -85,7 +95,7 @@ interface Consumable<TName extends string = string, TClient = unknown> {
85
95
  * both keys — the same machinery `.services()` already uses, which is why
86
96
  * `dependsOn` needs no type plumbing of its own.
87
97
  */
88
- type ServicesOf<T extends readonly Consumable[]> = { [K in keyof T]: T[K]['service'] };
98
+ type ServicesOf<T extends readonly Consumable[]> = { [K in keyof T]: T[K]['service']; };
89
99
  /**
90
100
  * The services of a list of constructs, at runtime.
91
101
  *
@@ -104,6 +114,28 @@ declare function servicesOf<const T extends readonly Consumable[]>(constructs: T
104
114
  * calls accumulate the way `.services()` already does.
105
115
  */
106
116
  declare function idsOf(constructs: readonly Consumable[], existing?: readonly string[]): string[];
117
+ /**
118
+ * The edges after `.database(source)` names a builder's database.
119
+ *
120
+ * A database replaces the one before it — a worker's default, overridden by a
121
+ * runnable that names its own — so the edge the previous one added goes with
122
+ * it. Left behind, a Lambda built from a queue that moved to another database
123
+ * would still be granted the worker's.
124
+ *
125
+ * Only an edge `.database()` added is removed, which is why it is returned as
126
+ * `_databaseEdge` for the next call to read — and not even that one when
127
+ * `.dependsOn()` has since named the same construct, since the handler still
128
+ * reaches it through `services`.
129
+ */
130
+ declare function databaseEdges(current: {
131
+ constructs: readonly string[];
132
+ edge: string | undefined;
133
+ service: Service | undefined;
134
+ services: readonly Service[];
135
+ }, source: unknown): {
136
+ _constructs: string[];
137
+ _databaseEdge: string | undefined;
138
+ };
107
139
  /** Something that is not a construct was passed to `.dependsOn()`. */
108
140
  declare class NotAConstruct extends Error {
109
141
  readonly value: unknown;
@@ -120,12 +152,11 @@ declare function isConsumable(value: unknown): value is Consumable;
120
152
  /**
121
153
  * The service behind either face.
122
154
  *
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.
155
+ * `.database()` and the auditor slot take a construct now; they took a
156
+ * `Service` before and still do, because not every hand-written service has a
157
+ * construct to stand for it.
126
158
  */
127
159
  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
160
  //#endregion
130
- export { Construct, Consumable, Declarable, Infer, NameOf, NotAConstruct, ServicesOf, edgeTo, idsOf, isConsumable, serviceOf, servicesOf };
131
- //# sourceMappingURL=construct-interface-D9d4Gm4p.d.cts.map
161
+ export { Infer as a, ServicesOf as c, idsOf as d, isConsumable as f, Declarable as i, databaseEdges as l, servicesOf as m, Construct as n, NameOf as o, serviceOf as p, Consumable as r, NotAConstruct as s, Authenticator as t, edgeTo as u };
162
+ //# sourceMappingURL=construct-interface-B1AfqRl4.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"construct-interface-B1AfqRl4.d.cts","names":[],"sources":["../src/construct-interface.ts"],"mappings":";;;;;;;;;;;;;UA8BiB,UAAU,+BAA+B;;WAEhD,IAAI;;;;;;;;EASb,WAAW;;;;;;;;WASF,UAAU,mCAEhB,QAAQ,aAAa,QAAQ;;;;;;;;;;;UAYhB,WAAW;WAClB,IAAI;EACb,WAAW;;;;;;;;;;UAWK,cAAc,4BAA4B;EAC1D,OACC,SAAS,SACT,WAAW,wBACT,QAAQ;;;;;;;;;;;;;;iBAeI,OAAO,WAAW,aAAa;;KAWnC,MAAM,KACjB,UAAU,wBAAwB,WAAW;;KAGlC,OAAO,KAClB,UAAU,gBAAgB,kBAAkB;;;;;;;;;;;UAY5B,WAAW,+BAA+B;WACjD,IAAI;WACJ,SAAS,QAAQ,aAAa,QAAQ;EAC/C,WAAW;;;;;;;;;;KAWA,WAAW,mBAAmB,mBACxC,WAAW,IAAI,EAAE;;;;;;;;iBAUH,iBAAiB,mBAAmB,cACnD,YAAY,IACV,WAAW;;;;;;;;;;iBAiBE,MACf,qBAAqB,cACrB;;;;;;;;;;;;;;iBAkBe,cACf;EACC;EACA;EACA,SAAS;EACT,mBAAmB;GAEpB;EACI;EAAuB;;;cAgBf,sBAAsB;WACb;EAArB,YAAqB;;;;;;;;;iBAqBN,aAAa,iBAAiB,SAAS;;;;;;;;iBAmBvC,UAAU,sBAAsB,SAC/C,QAAQ,WAAW,OAAO,WAAW,QAAQ,OAAO,WAClD,QAAQ,OAAO"}
@@ -1,8 +1,7 @@
1
1
  import { Declaration, Dependency } from "@geekmidas/manifest";
2
2
  import { Service } from "@geekmidas/services";
3
-
3
+ import { EnvironmentParser } from "@geekmidas/envkit";
4
4
  //#region src/construct-interface.d.ts
5
-
6
5
  /**
7
6
  * @typeParam TName - the construct's canonical id, PascalCase. Keeping it a
8
7
  * literal is what lets the service key be `Uncapitalize<TName>` — a TypeScript
@@ -27,8 +26,8 @@ interface Construct<TName extends string = string, TClient = never> {
27
26
  * The consumable face — the address this construct owns, as a client.
28
27
  *
29
28
  * 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.
29
+ * and `ServiceDiscovery` cache by service *object*, so a getter returning a
30
+ * fresh literal on every access would never hit either cache.
32
31
  */
33
32
  readonly service: [TClient] extends [never] ? never : Service<Uncapitalize<TName>, TClient>;
34
33
  }
@@ -45,6 +44,17 @@ interface Declarable<TName extends string = string> {
45
44
  readonly id: TName;
46
45
  declare(): Declaration[];
47
46
  }
47
+ /**
48
+ * A construct that authenticates requests — what `RestApi.auth()` takes.
49
+ *
50
+ * `verify` is the one thing every provider shares: given a request's headers,
51
+ * whose request is it — the session, or `null` when there is none. Whether the
52
+ * provider is a server mounted beside the API, deployed elsewhere, or an issuer
53
+ * somebody else runs is its own business; a surface only ever asks this.
54
+ */
55
+ interface Authenticator<TSession = unknown> extends Declarable {
56
+ verify(headers: Headers, envParser: EnvironmentParser<{}>): Promise<TSession | null>;
57
+ }
48
58
  /**
49
59
  * The edge that points at a construct.
50
60
  *
@@ -85,7 +95,7 @@ interface Consumable<TName extends string = string, TClient = unknown> {
85
95
  * both keys — the same machinery `.services()` already uses, which is why
86
96
  * `dependsOn` needs no type plumbing of its own.
87
97
  */
88
- type ServicesOf<T extends readonly Consumable[]> = { [K in keyof T]: T[K]['service'] };
98
+ type ServicesOf<T extends readonly Consumable[]> = { [K in keyof T]: T[K]['service']; };
89
99
  /**
90
100
  * The services of a list of constructs, at runtime.
91
101
  *
@@ -104,6 +114,28 @@ declare function servicesOf<const T extends readonly Consumable[]>(constructs: T
104
114
  * calls accumulate the way `.services()` already does.
105
115
  */
106
116
  declare function idsOf(constructs: readonly Consumable[], existing?: readonly string[]): string[];
117
+ /**
118
+ * The edges after `.database(source)` names a builder's database.
119
+ *
120
+ * A database replaces the one before it — a worker's default, overridden by a
121
+ * runnable that names its own — so the edge the previous one added goes with
122
+ * it. Left behind, a Lambda built from a queue that moved to another database
123
+ * would still be granted the worker's.
124
+ *
125
+ * Only an edge `.database()` added is removed, which is why it is returned as
126
+ * `_databaseEdge` for the next call to read — and not even that one when
127
+ * `.dependsOn()` has since named the same construct, since the handler still
128
+ * reaches it through `services`.
129
+ */
130
+ declare function databaseEdges(current: {
131
+ constructs: readonly string[];
132
+ edge: string | undefined;
133
+ service: Service | undefined;
134
+ services: readonly Service[];
135
+ }, source: unknown): {
136
+ _constructs: string[];
137
+ _databaseEdge: string | undefined;
138
+ };
107
139
  /** Something that is not a construct was passed to `.dependsOn()`. */
108
140
  declare class NotAConstruct extends Error {
109
141
  readonly value: unknown;
@@ -120,12 +152,11 @@ declare function isConsumable(value: unknown): value is Consumable;
120
152
  /**
121
153
  * The service behind either face.
122
154
  *
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.
155
+ * `.database()` and the auditor slot take a construct now; they took a
156
+ * `Service` before and still do, because not every hand-written service has a
157
+ * construct to stand for it.
126
158
  */
127
159
  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
160
  //#endregion
130
- export { Construct, Consumable, Declarable, Infer, NameOf, NotAConstruct, ServicesOf, edgeTo, idsOf, isConsumable, serviceOf, servicesOf };
131
- //# sourceMappingURL=construct-interface-g5GM5pwR.d.mts.map
161
+ export { Infer as a, ServicesOf as c, idsOf as d, isConsumable as f, Declarable as i, databaseEdges as l, servicesOf as m, Construct as n, NameOf as o, serviceOf as p, Consumable as r, NotAConstruct as s, Authenticator as t, edgeTo as u };
162
+ //# sourceMappingURL=construct-interface-ZvYQbivO.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"construct-interface-ZvYQbivO.d.mts","names":[],"sources":["../src/construct-interface.ts"],"mappings":";;;;;;;;;;;;;UA8BiB,UAAU,+BAA+B;;WAEhD,IAAI;;;;;;;;EASb,WAAW;;;;;;;;WASF,UAAU,mCAEhB,QAAQ,aAAa,QAAQ;;;;;;;;;;;UAYhB,WAAW;WAClB,IAAI;EACb,WAAW;;;;;;;;;;UAWK,cAAc,4BAA4B;EAC1D,OACC,SAAS,SACT,WAAW,wBACT,QAAQ;;;;;;;;;;;;;;iBAeI,OAAO,WAAW,aAAa;;KAWnC,MAAM,KACjB,UAAU,wBAAwB,WAAW;;KAGlC,OAAO,KAClB,UAAU,gBAAgB,kBAAkB;;;;;;;;;;;UAY5B,WAAW,+BAA+B;WACjD,IAAI;WACJ,SAAS,QAAQ,aAAa,QAAQ;EAC/C,WAAW;;;;;;;;;;KAWA,WAAW,mBAAmB,mBACxC,WAAW,IAAI,EAAE;;;;;;;;iBAUH,iBAAiB,mBAAmB,cACnD,YAAY,IACV,WAAW;;;;;;;;;;iBAiBE,MACf,qBAAqB,cACrB;;;;;;;;;;;;;;iBAkBe,cACf;EACC;EACA;EACA,SAAS;EACT,mBAAmB;GAEpB;EACI;EAAuB;;;cAgBf,sBAAsB;WACb;EAArB,YAAqB;;;;;;;;;iBAqBN,aAAa,iBAAiB,SAAS;;;;;;;;iBAmBvC,UAAU,sBAAsB,SAC/C,QAAQ,WAAW,OAAO,WAAW,QAAQ,OAAO,WAClD,QAAQ,OAAO"}
@@ -1,8 +1,114 @@
1
- const require_construct_interface = require('./construct-interface-BfjcOD_E.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
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 [.../* @__PURE__ */ new Set([...existing, ...constructs.map(({ id }) => id)])];
47
+ }
48
+ /**
49
+ * The edges after `.database(source)` names a builder's database.
50
+ *
51
+ * A database replaces the one before it — a worker's default, overridden by a
52
+ * runnable that names its own — so the edge the previous one added goes with
53
+ * it. Left behind, a Lambda built from a queue that moved to another database
54
+ * would still be granted the worker's.
55
+ *
56
+ * Only an edge `.database()` added is removed, which is why it is returned as
57
+ * `_databaseEdge` for the next call to read — and not even that one when
58
+ * `.dependsOn()` has since named the same construct, since the handler still
59
+ * reaches it through `services`.
60
+ */
61
+ function databaseEdges(current, source) {
62
+ const stillDependedOn = current.service !== void 0 && current.services.includes(current.service);
63
+ const kept = current.edge && !stillDependedOn ? current.constructs.filter((id) => id !== current.edge) : [...current.constructs];
64
+ if (!isConsumable(source) || kept.includes(source.id)) return {
65
+ _constructs: kept,
66
+ _databaseEdge: void 0
67
+ };
68
+ return {
69
+ _constructs: [...kept, source.id],
70
+ _databaseEdge: source.id
71
+ };
72
+ }
73
+ /** Something that is not a construct was passed to `.dependsOn()`. */
74
+ var NotAConstruct = class extends Error {
75
+ value;
76
+ constructor(value) {
77
+ const name = typeof value === "object" && value !== null && "serviceName" in value ? `the service '${String(value.serviceName)}'` : `a ${typeof value}`;
78
+ super(`.dependsOn() takes constructs, and was given ${name}. Pass it to .services([…]) instead.`);
79
+ this.value = value;
80
+ this.name = "NotAConstruct";
81
+ }
82
+ };
83
+ /**
84
+ * Whether a value is a construct rather than a bare `Service`.
85
+ *
86
+ * Structural rather than `instanceof`: a construct from a second copy of
87
+ * `@geekmidas/constructs` — a linked workspace, two versions in a lockfile — is
88
+ * still a construct, and `instanceof` is exactly the check that says otherwise.
89
+ */
90
+ function isConsumable(value) {
91
+ if (typeof value !== "object" || value === null) return false;
92
+ const candidate = value;
93
+ return typeof candidate.id === "string" && typeof candidate.declare === "function" && typeof candidate.service?.serviceName === "string";
94
+ }
95
+ /**
96
+ * The service behind either face.
97
+ *
98
+ * `.database()` and the auditor slot take a construct now; they took a
99
+ * `Service` before and still do, because not every hand-written service has a
100
+ * construct to stand for it.
101
+ */
102
+ function serviceOf(source) {
103
+ return isConsumable(source) ? source.service : source;
104
+ }
105
+ //#endregion
106
+ exports.NotAConstruct = NotAConstruct;
107
+ exports.databaseEdges = databaseEdges;
108
+ exports.edgeTo = edgeTo;
109
+ exports.idsOf = idsOf;
110
+ exports.isConsumable = isConsumable;
111
+ exports.serviceOf = serviceOf;
112
+ exports.servicesOf = servicesOf;
2
113
 
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;
114
+ //# sourceMappingURL=construct-interface.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"construct-interface.cjs","names":[],"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 { EnvironmentParser } from '@geekmidas/envkit';\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 * and `ServiceDiscovery` cache by service *object*, so a getter returning a\n\t * fresh literal on every access would never hit either cache.\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 * A construct that authenticates requests — what `RestApi.auth()` takes.\n *\n * `verify` is the one thing every provider shares: given a request's headers,\n * whose request is it — the session, or `null` when there is none. Whether the\n * provider is a server mounted beside the API, deployed elsewhere, or an issuer\n * somebody else runs is its own business; a surface only ever asks this.\n */\nexport interface Authenticator<TSession = unknown> extends Declarable {\n\tverify(\n\t\theaders: Headers,\n\t\tenvParser: EnvironmentParser<{}>,\n\t): Promise<TSession | null>;\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/**\n * The edges after `.database(source)` names a builder's database.\n *\n * A database replaces the one before it — a worker's default, overridden by a\n * runnable that names its own — so the edge the previous one added goes with\n * it. Left behind, a Lambda built from a queue that moved to another database\n * would still be granted the worker's.\n *\n * Only an edge `.database()` added is removed, which is why it is returned as\n * `_databaseEdge` for the next call to read — and not even that one when\n * `.dependsOn()` has since named the same construct, since the handler still\n * reaches it through `services`.\n */\nexport function databaseEdges(\n\tcurrent: {\n\t\tconstructs: readonly string[];\n\t\tedge: string | undefined;\n\t\tservice: Service | undefined;\n\t\tservices: readonly Service[];\n\t},\n\tsource: unknown,\n): { _constructs: string[]; _databaseEdge: string | undefined } {\n\tconst stillDependedOn =\n\t\tcurrent.service !== undefined && current.services.includes(current.service);\n\tconst kept =\n\t\tcurrent.edge && !stillDependedOn\n\t\t\t? current.constructs.filter((id) => id !== current.edge)\n\t\t\t: [...current.constructs];\n\n\tif (!isConsumable(source) || kept.includes(source.id)) {\n\t\treturn { _constructs: kept, _databaseEdge: undefined };\n\t}\n\n\treturn { _constructs: [...kept, source.id], _databaseEdge: source.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.`,\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 auditor slot take a construct now; they took a\n * `Service` before and still do, because not every hand-written service has a\n * construct to stand for it.\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":";;;;;;;;;;;;;;AAgGA,SAAgB,OAAO,WAAmC;CACzD,MAAM,YAAY,UAChB,QAAQ,CAAC,CACT,MAAM,gBAAgB,YAAY,OAAO,UAAU,EAAE;CAEvD,IAAI,CAAC,WAAW,MAAM,IAAI,cAAc,SAAS;CAEjD,OAAO;EAAE,QAAQ,UAAU;EAAI,MAAM,UAAU;CAAK;AACrD;;;;;;;;AA6CA,SAAgB,WACf,YACgB;CAChB,OAAO,WAAW,KAAK,cAAc;EACpC,IAAI,CAAC,aAAa,SAAS,GAAG,MAAM,IAAI,cAAc,SAAS;EAE/D,OAAO,UAAU;CAClB,CAAC;AACF;;;;;;;;;;AAWA,SAAgB,MACf,YACA,WAA8B,CAAC,GACpB;CACX,OAAO,CAAC,mBAAG,IAAI,IAAI,CAAC,GAAG,UAAU,GAAG,WAAW,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;AACrE;;;;;;;;;;;;;;AAeA,SAAgB,cACf,SAMA,QAC+D;CAC/D,MAAM,kBACL,QAAQ,YAAY,KAAA,KAAa,QAAQ,SAAS,SAAS,QAAQ,OAAO;CAC3E,MAAM,OACL,QAAQ,QAAQ,CAAC,kBACd,QAAQ,WAAW,QAAQ,OAAO,OAAO,QAAQ,IAAI,IACrD,CAAC,GAAG,QAAQ,UAAU;CAE1B,IAAI,CAAC,aAAa,MAAM,KAAK,KAAK,SAAS,OAAO,EAAE,GACnD,OAAO;EAAE,aAAa;EAAM,eAAe,KAAA;CAAU;CAGtD,OAAO;EAAE,aAAa,CAAC,GAAG,MAAM,OAAO,EAAE;EAAG,eAAe,OAAO;CAAG;AACtE;;AAGA,IAAa,gBAAb,cAAmC,MAAM;CACnB;CAArB,YAAY,OAAyB;EACpC,MAAM,OACL,OAAO,UAAU,YAAY,UAAU,QAAQ,iBAAiB,QAC7D,gBAAgB,OAAQ,MAAmC,WAAW,EAAE,KACxE,KAAK,OAAO;EAEhB,MACC,gDAAgD,KAAK,qCAEtD;EAToB,KAAA,QAAA;EAUpB,KAAK,OAAO;CACb;AACD;;;;;;;;AASA,SAAgB,aAAa,OAAqC;CACjE,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO;CAExD,MAAM,YAAY;CAElB,OACC,OAAO,UAAU,OAAO,YACxB,OAAO,UAAU,YAAY,cAC7B,OAAQ,UAAU,SAAiC,gBAAgB;AAErE;;;;;;;;AASA,SAAgB,UACf,QAC0B;CAG1B,OAAO,aAAa,MAAM,IACtB,OAAO,UACP;AACL"}
@@ -1,2 +1,2 @@
1
- import { Construct, Consumable, Declarable, Infer, NameOf, NotAConstruct, ServicesOf, edgeTo, idsOf, isConsumable, serviceOf, servicesOf } from "./construct-interface-D9d4Gm4p.cjs";
2
- export { Construct, Consumable, Declarable, Infer, NameOf, NotAConstruct, ServicesOf, edgeTo, idsOf, isConsumable, serviceOf, servicesOf };
1
+ import { a as Infer, c as ServicesOf, d as idsOf, f as isConsumable, i as Declarable, l as databaseEdges, m as servicesOf, n as Construct, o as NameOf, p as serviceOf, r as Consumable, s as NotAConstruct, t as Authenticator, u as edgeTo } from "./construct-interface-B1AfqRl4.cjs";
2
+ export { Authenticator, Construct, Consumable, Declarable, Infer, NameOf, NotAConstruct, ServicesOf, databaseEdges, edgeTo, idsOf, isConsumable, serviceOf, servicesOf };
@@ -1,2 +1,2 @@
1
- import { Construct, Consumable, Declarable, Infer, NameOf, NotAConstruct, ServicesOf, edgeTo, idsOf, isConsumable, serviceOf, servicesOf } from "./construct-interface-g5GM5pwR.mjs";
2
- export { Construct, Consumable, Declarable, Infer, NameOf, NotAConstruct, ServicesOf, edgeTo, idsOf, isConsumable, serviceOf, servicesOf };
1
+ import { a as Infer, c as ServicesOf, d as idsOf, f as isConsumable, i as Declarable, l as databaseEdges, m as servicesOf, n as Construct, o as NameOf, p as serviceOf, r as Consumable, s as NotAConstruct, t as Authenticator, u as edgeTo } from "./construct-interface-ZvYQbivO.mjs";
2
+ export { Authenticator, Construct, Consumable, Declarable, Infer, NameOf, NotAConstruct, ServicesOf, databaseEdges, edgeTo, idsOf, isConsumable, serviceOf, servicesOf };
@@ -1,3 +1,107 @@
1
- import { NotAConstruct, edgeTo, idsOf, isConsumable, serviceOf, servicesOf } from "./construct-interface-Z4CpS8tK.mjs";
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 [.../* @__PURE__ */ new Set([...existing, ...constructs.map(({ id }) => id)])];
46
+ }
47
+ /**
48
+ * The edges after `.database(source)` names a builder's database.
49
+ *
50
+ * A database replaces the one before it — a worker's default, overridden by a
51
+ * runnable that names its own — so the edge the previous one added goes with
52
+ * it. Left behind, a Lambda built from a queue that moved to another database
53
+ * would still be granted the worker's.
54
+ *
55
+ * Only an edge `.database()` added is removed, which is why it is returned as
56
+ * `_databaseEdge` for the next call to read — and not even that one when
57
+ * `.dependsOn()` has since named the same construct, since the handler still
58
+ * reaches it through `services`.
59
+ */
60
+ function databaseEdges(current, source) {
61
+ const stillDependedOn = current.service !== void 0 && current.services.includes(current.service);
62
+ const kept = current.edge && !stillDependedOn ? current.constructs.filter((id) => id !== current.edge) : [...current.constructs];
63
+ if (!isConsumable(source) || kept.includes(source.id)) return {
64
+ _constructs: kept,
65
+ _databaseEdge: void 0
66
+ };
67
+ return {
68
+ _constructs: [...kept, source.id],
69
+ _databaseEdge: source.id
70
+ };
71
+ }
72
+ /** Something that is not a construct was passed to `.dependsOn()`. */
73
+ var NotAConstruct = class extends Error {
74
+ value;
75
+ constructor(value) {
76
+ const name = typeof value === "object" && value !== null && "serviceName" in value ? `the service '${String(value.serviceName)}'` : `a ${typeof value}`;
77
+ super(`.dependsOn() takes constructs, and was given ${name}. Pass it to .services([…]) instead.`);
78
+ this.value = value;
79
+ this.name = "NotAConstruct";
80
+ }
81
+ };
82
+ /**
83
+ * Whether a value is a construct rather than a bare `Service`.
84
+ *
85
+ * Structural rather than `instanceof`: a construct from a second copy of
86
+ * `@geekmidas/constructs` — a linked workspace, two versions in a lockfile — is
87
+ * still a construct, and `instanceof` is exactly the check that says otherwise.
88
+ */
89
+ function isConsumable(value) {
90
+ if (typeof value !== "object" || value === null) return false;
91
+ const candidate = value;
92
+ return typeof candidate.id === "string" && typeof candidate.declare === "function" && typeof candidate.service?.serviceName === "string";
93
+ }
94
+ /**
95
+ * The service behind either face.
96
+ *
97
+ * `.database()` and the auditor slot take a construct now; they took a
98
+ * `Service` before and still do, because not every hand-written service has a
99
+ * construct to stand for it.
100
+ */
101
+ function serviceOf(source) {
102
+ return isConsumable(source) ? source.service : source;
103
+ }
104
+ //#endregion
105
+ export { NotAConstruct, databaseEdges, edgeTo, idsOf, isConsumable, serviceOf, servicesOf };
2
106
 
3
- export { NotAConstruct, edgeTo, idsOf, isConsumable, serviceOf, servicesOf };
107
+ //# sourceMappingURL=construct-interface.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"construct-interface.mjs","names":[],"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 { EnvironmentParser } from '@geekmidas/envkit';\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 * and `ServiceDiscovery` cache by service *object*, so a getter returning a\n\t * fresh literal on every access would never hit either cache.\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 * A construct that authenticates requests — what `RestApi.auth()` takes.\n *\n * `verify` is the one thing every provider shares: given a request's headers,\n * whose request is it — the session, or `null` when there is none. Whether the\n * provider is a server mounted beside the API, deployed elsewhere, or an issuer\n * somebody else runs is its own business; a surface only ever asks this.\n */\nexport interface Authenticator<TSession = unknown> extends Declarable {\n\tverify(\n\t\theaders: Headers,\n\t\tenvParser: EnvironmentParser<{}>,\n\t): Promise<TSession | null>;\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/**\n * The edges after `.database(source)` names a builder's database.\n *\n * A database replaces the one before it — a worker's default, overridden by a\n * runnable that names its own — so the edge the previous one added goes with\n * it. Left behind, a Lambda built from a queue that moved to another database\n * would still be granted the worker's.\n *\n * Only an edge `.database()` added is removed, which is why it is returned as\n * `_databaseEdge` for the next call to read — and not even that one when\n * `.dependsOn()` has since named the same construct, since the handler still\n * reaches it through `services`.\n */\nexport function databaseEdges(\n\tcurrent: {\n\t\tconstructs: readonly string[];\n\t\tedge: string | undefined;\n\t\tservice: Service | undefined;\n\t\tservices: readonly Service[];\n\t},\n\tsource: unknown,\n): { _constructs: string[]; _databaseEdge: string | undefined } {\n\tconst stillDependedOn =\n\t\tcurrent.service !== undefined && current.services.includes(current.service);\n\tconst kept =\n\t\tcurrent.edge && !stillDependedOn\n\t\t\t? current.constructs.filter((id) => id !== current.edge)\n\t\t\t: [...current.constructs];\n\n\tif (!isConsumable(source) || kept.includes(source.id)) {\n\t\treturn { _constructs: kept, _databaseEdge: undefined };\n\t}\n\n\treturn { _constructs: [...kept, source.id], _databaseEdge: source.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.`,\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 auditor slot take a construct now; they took a\n * `Service` before and still do, because not every hand-written service has a\n * construct to stand for it.\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":";;;;;;;;;;;;;AAgGA,SAAgB,OAAO,WAAmC;CACzD,MAAM,YAAY,UAChB,QAAQ,CAAC,CACT,MAAM,gBAAgB,YAAY,OAAO,UAAU,EAAE;CAEvD,IAAI,CAAC,WAAW,MAAM,IAAI,cAAc,SAAS;CAEjD,OAAO;EAAE,QAAQ,UAAU;EAAI,MAAM,UAAU;CAAK;AACrD;;;;;;;;AA6CA,SAAgB,WACf,YACgB;CAChB,OAAO,WAAW,KAAK,cAAc;EACpC,IAAI,CAAC,aAAa,SAAS,GAAG,MAAM,IAAI,cAAc,SAAS;EAE/D,OAAO,UAAU;CAClB,CAAC;AACF;;;;;;;;;;AAWA,SAAgB,MACf,YACA,WAA8B,CAAC,GACpB;CACX,OAAO,CAAC,mBAAG,IAAI,IAAI,CAAC,GAAG,UAAU,GAAG,WAAW,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;AACrE;;;;;;;;;;;;;;AAeA,SAAgB,cACf,SAMA,QAC+D;CAC/D,MAAM,kBACL,QAAQ,YAAY,KAAA,KAAa,QAAQ,SAAS,SAAS,QAAQ,OAAO;CAC3E,MAAM,OACL,QAAQ,QAAQ,CAAC,kBACd,QAAQ,WAAW,QAAQ,OAAO,OAAO,QAAQ,IAAI,IACrD,CAAC,GAAG,QAAQ,UAAU;CAE1B,IAAI,CAAC,aAAa,MAAM,KAAK,KAAK,SAAS,OAAO,EAAE,GACnD,OAAO;EAAE,aAAa;EAAM,eAAe,KAAA;CAAU;CAGtD,OAAO;EAAE,aAAa,CAAC,GAAG,MAAM,OAAO,EAAE;EAAG,eAAe,OAAO;CAAG;AACtE;;AAGA,IAAa,gBAAb,cAAmC,MAAM;CACnB;CAArB,YAAY,OAAyB;EACpC,MAAM,OACL,OAAO,UAAU,YAAY,UAAU,QAAQ,iBAAiB,QAC7D,gBAAgB,OAAQ,MAAmC,WAAW,EAAE,KACxE,KAAK,OAAO;EAEhB,MACC,gDAAgD,KAAK,qCAEtD;EAToB,KAAA,QAAA;EAUpB,KAAK,OAAO;CACb;AACD;;;;;;;;AASA,SAAgB,aAAa,OAAqC;CACjE,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO;CAExD,MAAM,YAAY;CAElB,OACC,OAAO,UAAU,OAAO,YACxB,OAAO,UAAU,YAAY,cAC7B,OAAQ,UAAU,SAAiC,gBAAgB;AAErE;;;;;;;;AASA,SAAgB,UACf,QAC0B;CAG1B,OAAO,aAAa,MAAM,IACtB,OAAO,UACP;AACL"}