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

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,17 +1,15 @@
1
- import "./Construct-C0ijr2qp.cjs";
2
- import "./index-D24Xm79M.cjs";
3
- import { Declarable } from "./construct-interface-D9d4Gm4p.cjs";
4
- import "./types-BlAkSuGI.cjs";
5
- import { BuiltInSecuritySchemeId } from "./Endpoint-dav89W6-.cjs";
6
- import { EndpointBuilder, EndpointFactory, RemoveTrailingSlash } from "./index-Bd5FqCoe.cjs";
1
+ import { i as Declarable, t as Authenticator } from "./construct-interface-B1AfqRl4.cjs";
2
+ import { n as Telemetry } from "./telemetry-B48RLjyk.cjs";
3
+ import { D as BuiltInSecuritySchemeId } from "./Endpoint-DgrpG15P.cjs";
4
+ import { t as EndpointFactory } from "./EndpointFactory-Cc863XJS.cjs";
7
5
  import { EnvironmentParser } from "@geekmidas/envkit";
8
6
  import { Logger } from "@geekmidas/logger";
9
7
  import { ConstructName, Declaration, Dependency } from "@geekmidas/manifest";
10
8
  import { Telescope } from "@geekmidas/telescope";
11
-
12
9
  //#region src/rest-api.d.ts
13
-
14
- interface RestApiConfig<TAuthorizers extends readonly string[] = readonly []> {
10
+ /** The factory a surface builds its endpoints from. */
11
+ type Endpoints = EndpointFactory<[], '', Logger>;
12
+ export interface RestApiConfig<TAuthorizers extends readonly string[] = readonly []> {
15
13
  /**
16
14
  * The app that serves this surface, relative to the workspace root —
17
15
  * `'apps/api'`, or `'.'` in a single-app project.
@@ -24,6 +22,12 @@ interface RestApiConfig<TAuthorizers extends readonly string[] = readonly []> {
24
22
  * `constructs` glob.
25
23
  */
26
24
  path: string;
25
+ /**
26
+ * The label it answers on under a stage's domain — `api` for
27
+ * `api.myapp.com`, from `domains` — and under the project locally,
28
+ * `api.myapp.localhost`. Absent, its id kebab-cased.
29
+ */
30
+ subdomain?: string;
27
31
  /**
28
32
  * CORS tunables. The *origins* are never here — they are read off the
29
33
  * constructs that declared an edge to this surface, which is the whole point
@@ -86,23 +90,35 @@ interface RestApiConfig<TAuthorizers extends readonly string[] = readonly []> {
86
90
  * printed an import for. The entry already imports the surface.
87
91
  */
88
92
  telescope?: Telescope;
93
+ /**
94
+ * What this surface's process emits — the `Telemetry` construct, passed
95
+ * like the logger: a fact about the process, not a grant to a route.
96
+ *
97
+ * An edge to the node, so the deploy hands this process the `OTEL_*` keys
98
+ * its stage resolves, and the build fails without the OpenTelemetry
99
+ * packages. Where the telemetry goes is never here: it is the deploy's,
100
+ * per stage.
101
+ */
102
+ telemetry?: Telemetry;
89
103
  }
90
104
  /**
91
105
  * What is *not* here, and why.
92
106
  *
93
- * `dependsOn`, `database`, `auditor` and `publisher` all inject a capability
107
+ * `dependsOn`, `database`, `auditor` and `.event(topic, …)` all inject a capability
94
108
  * into a handler. Putting one on the surface hands it to every route the
95
109
  * surface serves — a health check gets the database because a report needed it
96
110
  * — which is the thing least privilege forbids and the reason `.calls()` is not
97
- * spelled `dependsOn`. They belong to the endpoint, or to a factory branched
98
- * from `api.endpoints` for a group of endpoints that genuinely share them.
111
+ * spelled `dependsOn`. They belong to the endpoint, or to a branch —
112
+ * `api.database(db)` — for a group of endpoints that genuinely share them. A
113
+ * branch is a new factory; the surface config stays free of grants.
99
114
  *
100
115
  * `auth` is not here either: `.auth(construct)` already declares it, and a
101
116
  * second way to say the same thing is the duplication this whole model removes.
102
117
  *
103
118
  * What is left is what the *process* is rather than what a route may reach.
104
119
  */
105
- declare class RestApi<TName extends string = string, const TAuthorizers extends readonly string[] = readonly []> implements Declarable<TName> {
120
+ export declare class RestApi<TName extends string = string, const TAuthorizers extends readonly string[] = readonly []> implements Declarable<TName> {
121
+ #private;
106
122
  private readonly config;
107
123
  /** Internal: how `.calls()` carries edges into the copy it returns. */
108
124
  private readonly dependencies;
@@ -138,34 +154,46 @@ declare class RestApi<TName extends string = string, const TAuthorizers extends
138
154
  readonly envParser: EnvironmentParser<{}>;
139
155
  /** The Telescope instance, when this surface was given one. */
140
156
  readonly telescope?: Telescope;
141
- constructor(id: ConstructName<TName>, config: RestApiConfig<TAuthorizers>, /** Internal: how `.calls()` carries edges into the copy it returns. */
142
- dependencies?: readonly Dependency[], /** Internal: how `.auth()` carries the authenticator into its copy. */
143
- authenticator?: string | undefined);
157
+ /** What this surface's process emits, when it was given a `Telemetry`. */
158
+ readonly telemetry?: Telemetry;
159
+ constructor(id: ConstructName<TName>, config: RestApiConfig<TAuthorizers>,
160
+ /** Internal: how `.calls()` carries edges into the copy it returns. */
161
+ dependencies?: readonly Dependency[],
162
+ /** Internal: how `.auth()` carries the authenticator into its copy. */
163
+ authenticator?: Authenticator | undefined);
164
+ /** `api.get('/users')` — one route on this surface. */
165
+ readonly get: Endpoints['get'];
166
+ readonly post: Endpoints['post'];
167
+ readonly put: Endpoints['put'];
168
+ readonly patch: Endpoints['patch'];
169
+ readonly delete: Endpoints['delete'];
170
+ readonly options: Endpoints['options'];
144
171
  /**
145
- * This surface's endpoint factory.
146
- *
147
- * `api.get('/users')` is the short form and covers most routes. Reach for
148
- * this one when a *group* of endpoints shares something a single route would
149
- * otherwise repeat — a database, an auditor, a publisher:
172
+ * A branch for a *group* of endpoints that shares what a single route would
173
+ * otherwise repeat — a database, an auditor, a publisher, a session:
150
174
  *
151
175
  * ```ts
152
- * const audited = api.endpoints.database(db).auditor(AuditStore);
153
- * export const createUser = audited.post('/users').handle(...);
176
+ * export const router = api.database(database);
177
+ * export const createUser = router.post('/users').handle(({ db }) => …);
154
178
  * ```
155
179
  *
156
- * A factory branched from here keeps the surface, so its endpoints still
157
- * know which API serves them. That is deliberately narrower than putting the
158
- * same thing in the surface's own config: a group opts in, where a surface
159
- * would grant it to every route it serves.
180
+ * Each returns a new factory and leaves the surface as it was. That is the
181
+ * whole difference from putting the same thing in the surface's config: a
182
+ * group opts in, where the surface would grant it to every route it serves —
183
+ * a health check handed the database because a profile endpoint needed it.
184
+ *
185
+ * `dependsOn` is deliberately not here. It is per endpoint, and on the
186
+ * surface it would read as the API depending on something, which is what
187
+ * `.calls()` and `.auth()` say instead.
160
188
  */
161
- readonly endpoints: EndpointFactory<[], '', Logger>;
162
- /** `api.get('/users')` — sugar for `api.endpoints.get('/users')`. */
163
- get<TPath extends string>(path: TPath): EndpointBuilder<RemoveTrailingSlash<TPath>, "GET", {}, [], Logger, undefined, unknown, undefined, string, readonly string[], undefined, string, never, undefined, string>;
164
- post<TPath extends string>(path: TPath): EndpointBuilder<RemoveTrailingSlash<TPath>, "POST", {}, [], Logger, undefined, unknown, undefined, string, readonly string[], undefined, string, never, undefined, string>;
165
- put<TPath extends string>(path: TPath): EndpointBuilder<RemoveTrailingSlash<TPath>, "PUT", {}, [], Logger, undefined, unknown, undefined, string, readonly string[], undefined, string, never, undefined, string>;
166
- patch<TPath extends string>(path: TPath): EndpointBuilder<RemoveTrailingSlash<TPath>, "PATCH", {}, [], Logger, undefined, unknown, undefined, string, readonly string[], undefined, string, never, undefined, string>;
167
- delete<TPath extends string>(path: TPath): EndpointBuilder<RemoveTrailingSlash<TPath>, "DELETE", {}, [], Logger, undefined, unknown, undefined, string, readonly string[], undefined, string, never, undefined, string>;
168
- options<TPath extends string>(path: TPath): EndpointBuilder<RemoveTrailingSlash<TPath>, "OPTIONS", {}, [], Logger, undefined, unknown, undefined, string, readonly string[], undefined, string, never, undefined, string>;
189
+ readonly database: Endpoints['database'];
190
+ readonly session: Endpoints['session'];
191
+ readonly auditor: Endpoints['auditor'];
192
+ readonly actor: Endpoints['actor'];
193
+ readonly authorizer: Endpoints['authorizer'];
194
+ readonly authorize: Endpoints['authorize'];
195
+ readonly rls: Endpoints['rls'];
196
+ readonly route: Endpoints['route'];
169
197
  /**
170
198
  * What authenticates this surface.
171
199
  *
@@ -175,12 +203,13 @@ declare class RestApi<TName extends string = string, const TAuthorizers extends
175
203
  * what a request is allowed to be. A surface with two of the first is a
176
204
  * mistake; two of the second is Tuesday.
177
205
  *
178
- * It records the id, not a client. Every endpoint consumes the same thing —
179
- * `verify(request) → Session | null` — and that is what every provider
180
- * shares, whether the server is mounted in this process, deployed beside it,
181
- * or an OIDC issuer somebody else runs.
206
+ * It declares the id, and keeps the construct: a session callback reads from
207
+ * it as `auth` — `session(async ({ auth }) => auth.getSession())` — which
208
+ * calls the construct's `verify(headers)`. That is the one thing every
209
+ * provider shares, whether the server is mounted in this process, deployed
210
+ * beside it, or an OIDC issuer somebody else runs.
182
211
  */
183
- auth(construct: Declarable): RestApi<TName, TAuthorizers>;
212
+ auth(construct: Authenticator): RestApi<TName, TAuthorizers>;
184
213
  /**
185
214
  * Other surfaces this one calls.
186
215
  *
@@ -207,7 +236,6 @@ declare class RestApi<TName extends string = string, const TAuthorizers extends
207
236
  */
208
237
  declare(): Declaration[];
209
238
  }
210
- //# sourceMappingURL=rest-api.d.ts.map
211
239
  //#endregion
212
- export { RestApi, RestApiConfig };
240
+ export type { Authenticator };
213
241
  //# sourceMappingURL=rest-api.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rest-api.d.cts","names":[],"sources":["../src/rest-api.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;AAkLM,UA3IW,aA2IX,CAAA,qBAAA,SAAA,MAAA,EAAA,GAAA,SAAA,EAAA,CAAA,CAAA;EAAa;;;;;;;;;;;EAiEoB,IAAA,EAAA,MAAA;EAAA;;;;;EAID,IAAA,CAAA,EAAA;IAAA,MAAA,CAAA,EAAA,MAAA;IAAA,WAAA,CAAA,EAAA,OAAA;IAIH,YAAA,CAAA,EAAA,SAAA,MAAA,EAAA;IAAK,aAAA,CAAA,EAAA,SAAA,MAAA,EAAA;EAAA,CAAA;EAAA;;;;;EAIC,WAAA,CAAA,EAtL1B,YAsL0B;EAAA;;;;;;;;;;;;;;;;AAnHlB;;qBAhDH,uBAAuB;;;;;;;;;;WAUjC;;;;;;;;cAQG;;;;;;;;cAQA;;;;;;;;;;;;;;;;;cAmBA,8GAGA,WAAW;;;;;;eAEV;;;;;;;;;;;;;;;;;;mBAoBI;;;;;;;;;sBAUG;;uBAGC;kBAGhB,cAAc,gBACO,cAAc;0BAEC;;;;;;;;;;;;;;;;;;;sBAuDrB,wBAAwB;;kCAGZ,QAAK,gBAAA,oBAAA,uBAAA;mCAIJ,QAAK,gBAAA,oBAAA,wBAAA;kCAIN,QAAK,gBAAA,oBAAA,uBAAA;oCAIH,QAAK,gBAAA,oBAAA,yBAAA;qCAIJ,QAAK,gBAAA,oBAAA,0BAAA;sCAIJ,QAAK,gBAAA,oBAAA,2BAAA;;;;;;;;;;;;;;;kBAkBzB,aAAa,QAAQ,OAAO;;;;;;;;;;;;;;;6BAuBjB,eAAe,QAAQ,OAAO;;;;;;;;;;aAkB9C"}
1
+ {"version":3,"file":"rest-api.d.cts","names":[],"sources":["../src/rest-api.ts"],"mappings":";;;;;;;;;;KAmDK,YAAY,wBAAwB;iBAExB,cAIhB;;;;;;;;;;;;EAaA;;;;;;EAMA;;;;;;EAMA;IACC;IACA;IACA;IACA;;;;;;;EAOD,cAAc;;;;;;;;;;;;;;;;;;;EAmBd,mBAAmB,uBAAuB;;;;;;;;;;EAU1C,SAAS;;;;;;;;EAQT,YAAY;;;;;;;;EAQZ,YAAY;;;;;;;;;;EAUZ,YAAY;;;;;;;;;;;;;;;;;;qBAoBA,QACZ,qCACM,iEACM,WAAW;;mBA0CL;;mBAEA;;mBAEA;WA5CT,IAAI;;;;;;WAOJ;IACR;IACA;IACA;;;;;;;;;WAUQ,QAAQ;;;;;;;;;WAUR,WAAW;;WAGX,YAAY;;WAGZ,YAAY;EAErB,YACC,IAAI,cAAc,QACD,QAAQ,cAAc,eAEtB;;EAAA,wBAAuB,cAEvB;;EAAA,gBAAgB;;WAyEzB,KAAK;WACL,MAAM;WACN,KAAK;WACL,OAAO;WACP,QAAQ;WACR,SAAS;;;;;;;;;;;;;;;;;;;WAoBT,UAAU;WACV,SAAS;WACT,SAAS;WACT,OAAO;WACP,YAAY;WACZ,WAAW;WACX,KAAK;WACL,OAAO;;;;;;;;;;;;;;;;EAiBhB,KAAK,WAAW,gBAAgB,QAAQ,OAAO;;;;;;;;;;;;;;;EAuB/C,MAAM,qBAAqB,eAAe,QAAQ,OAAO;;;;;;;;;;EAkBzD,WAAW"}
@@ -1,17 +1,15 @@
1
- import "./Construct-Ct8nalEi.mjs";
2
- import "./index-_ajboYxK.mjs";
3
- import { Declarable } from "./construct-interface-g5GM5pwR.mjs";
4
- import "./types-aKksMEWL.mjs";
5
- import { BuiltInSecuritySchemeId } from "./Endpoint-BjWKinFA.mjs";
6
- import { EndpointBuilder, EndpointFactory, RemoveTrailingSlash } from "./index-lAO9egTb.mjs";
1
+ import { i as Declarable, t as Authenticator } from "./construct-interface-ZvYQbivO.mjs";
2
+ import { n as Telemetry } from "./telemetry-BEoBn6GO.mjs";
3
+ import { D as BuiltInSecuritySchemeId } from "./Endpoint-CeFkSwh5.mjs";
4
+ import { t as EndpointFactory } from "./EndpointFactory-Dbw9ugkX.mjs";
7
5
  import { ConstructName, Declaration, Dependency } from "@geekmidas/manifest";
8
6
  import { EnvironmentParser } from "@geekmidas/envkit";
9
7
  import { Logger } from "@geekmidas/logger";
10
8
  import { Telescope } from "@geekmidas/telescope";
11
-
12
9
  //#region src/rest-api.d.ts
13
-
14
- interface RestApiConfig<TAuthorizers extends readonly string[] = readonly []> {
10
+ /** The factory a surface builds its endpoints from. */
11
+ type Endpoints = EndpointFactory<[], '', Logger>;
12
+ export interface RestApiConfig<TAuthorizers extends readonly string[] = readonly []> {
15
13
  /**
16
14
  * The app that serves this surface, relative to the workspace root —
17
15
  * `'apps/api'`, or `'.'` in a single-app project.
@@ -24,6 +22,12 @@ interface RestApiConfig<TAuthorizers extends readonly string[] = readonly []> {
24
22
  * `constructs` glob.
25
23
  */
26
24
  path: string;
25
+ /**
26
+ * The label it answers on under a stage's domain — `api` for
27
+ * `api.myapp.com`, from `domains` — and under the project locally,
28
+ * `api.myapp.localhost`. Absent, its id kebab-cased.
29
+ */
30
+ subdomain?: string;
27
31
  /**
28
32
  * CORS tunables. The *origins* are never here — they are read off the
29
33
  * constructs that declared an edge to this surface, which is the whole point
@@ -86,23 +90,35 @@ interface RestApiConfig<TAuthorizers extends readonly string[] = readonly []> {
86
90
  * printed an import for. The entry already imports the surface.
87
91
  */
88
92
  telescope?: Telescope;
93
+ /**
94
+ * What this surface's process emits — the `Telemetry` construct, passed
95
+ * like the logger: a fact about the process, not a grant to a route.
96
+ *
97
+ * An edge to the node, so the deploy hands this process the `OTEL_*` keys
98
+ * its stage resolves, and the build fails without the OpenTelemetry
99
+ * packages. Where the telemetry goes is never here: it is the deploy's,
100
+ * per stage.
101
+ */
102
+ telemetry?: Telemetry;
89
103
  }
90
104
  /**
91
105
  * What is *not* here, and why.
92
106
  *
93
- * `dependsOn`, `database`, `auditor` and `publisher` all inject a capability
107
+ * `dependsOn`, `database`, `auditor` and `.event(topic, …)` all inject a capability
94
108
  * into a handler. Putting one on the surface hands it to every route the
95
109
  * surface serves — a health check gets the database because a report needed it
96
110
  * — which is the thing least privilege forbids and the reason `.calls()` is not
97
- * spelled `dependsOn`. They belong to the endpoint, or to a factory branched
98
- * from `api.endpoints` for a group of endpoints that genuinely share them.
111
+ * spelled `dependsOn`. They belong to the endpoint, or to a branch —
112
+ * `api.database(db)` — for a group of endpoints that genuinely share them. A
113
+ * branch is a new factory; the surface config stays free of grants.
99
114
  *
100
115
  * `auth` is not here either: `.auth(construct)` already declares it, and a
101
116
  * second way to say the same thing is the duplication this whole model removes.
102
117
  *
103
118
  * What is left is what the *process* is rather than what a route may reach.
104
119
  */
105
- declare class RestApi<TName extends string = string, const TAuthorizers extends readonly string[] = readonly []> implements Declarable<TName> {
120
+ export declare class RestApi<TName extends string = string, const TAuthorizers extends readonly string[] = readonly []> implements Declarable<TName> {
121
+ #private;
106
122
  private readonly config;
107
123
  /** Internal: how `.calls()` carries edges into the copy it returns. */
108
124
  private readonly dependencies;
@@ -138,34 +154,46 @@ declare class RestApi<TName extends string = string, const TAuthorizers extends
138
154
  readonly envParser: EnvironmentParser<{}>;
139
155
  /** The Telescope instance, when this surface was given one. */
140
156
  readonly telescope?: Telescope;
141
- constructor(id: ConstructName<TName>, config: RestApiConfig<TAuthorizers>, /** Internal: how `.calls()` carries edges into the copy it returns. */
142
- dependencies?: readonly Dependency[], /** Internal: how `.auth()` carries the authenticator into its copy. */
143
- authenticator?: string | undefined);
157
+ /** What this surface's process emits, when it was given a `Telemetry`. */
158
+ readonly telemetry?: Telemetry;
159
+ constructor(id: ConstructName<TName>, config: RestApiConfig<TAuthorizers>,
160
+ /** Internal: how `.calls()` carries edges into the copy it returns. */
161
+ dependencies?: readonly Dependency[],
162
+ /** Internal: how `.auth()` carries the authenticator into its copy. */
163
+ authenticator?: Authenticator | undefined);
164
+ /** `api.get('/users')` — one route on this surface. */
165
+ readonly get: Endpoints['get'];
166
+ readonly post: Endpoints['post'];
167
+ readonly put: Endpoints['put'];
168
+ readonly patch: Endpoints['patch'];
169
+ readonly delete: Endpoints['delete'];
170
+ readonly options: Endpoints['options'];
144
171
  /**
145
- * This surface's endpoint factory.
146
- *
147
- * `api.get('/users')` is the short form and covers most routes. Reach for
148
- * this one when a *group* of endpoints shares something a single route would
149
- * otherwise repeat — a database, an auditor, a publisher:
172
+ * A branch for a *group* of endpoints that shares what a single route would
173
+ * otherwise repeat — a database, an auditor, a publisher, a session:
150
174
  *
151
175
  * ```ts
152
- * const audited = api.endpoints.database(db).auditor(AuditStore);
153
- * export const createUser = audited.post('/users').handle(...);
176
+ * export const router = api.database(database);
177
+ * export const createUser = router.post('/users').handle(({ db }) => …);
154
178
  * ```
155
179
  *
156
- * A factory branched from here keeps the surface, so its endpoints still
157
- * know which API serves them. That is deliberately narrower than putting the
158
- * same thing in the surface's own config: a group opts in, where a surface
159
- * would grant it to every route it serves.
180
+ * Each returns a new factory and leaves the surface as it was. That is the
181
+ * whole difference from putting the same thing in the surface's config: a
182
+ * group opts in, where the surface would grant it to every route it serves —
183
+ * a health check handed the database because a profile endpoint needed it.
184
+ *
185
+ * `dependsOn` is deliberately not here. It is per endpoint, and on the
186
+ * surface it would read as the API depending on something, which is what
187
+ * `.calls()` and `.auth()` say instead.
160
188
  */
161
- readonly endpoints: EndpointFactory<[], '', Logger>;
162
- /** `api.get('/users')` — sugar for `api.endpoints.get('/users')`. */
163
- get<TPath extends string>(path: TPath): EndpointBuilder<RemoveTrailingSlash<TPath>, "GET", {}, [], Logger, undefined, unknown, undefined, string, readonly string[], undefined, string, ExtractStorageAuditAction<NonNullable<TAuditStorage>>, undefined, string>;
164
- post<TPath extends string>(path: TPath): EndpointBuilder<RemoveTrailingSlash<TPath>, "POST", {}, [], Logger, undefined, unknown, undefined, string, readonly string[], undefined, string, ExtractStorageAuditAction<NonNullable<TAuditStorage>>, undefined, string>;
165
- put<TPath extends string>(path: TPath): EndpointBuilder<RemoveTrailingSlash<TPath>, "PUT", {}, [], Logger, undefined, unknown, undefined, string, readonly string[], undefined, string, ExtractStorageAuditAction<NonNullable<TAuditStorage>>, undefined, string>;
166
- patch<TPath extends string>(path: TPath): EndpointBuilder<RemoveTrailingSlash<TPath>, "PATCH", {}, [], Logger, undefined, unknown, undefined, string, readonly string[], undefined, string, ExtractStorageAuditAction<NonNullable<TAuditStorage>>, undefined, string>;
167
- delete<TPath extends string>(path: TPath): EndpointBuilder<RemoveTrailingSlash<TPath>, "DELETE", {}, [], Logger, undefined, unknown, undefined, string, readonly string[], undefined, string, ExtractStorageAuditAction<NonNullable<TAuditStorage>>, undefined, string>;
168
- options<TPath extends string>(path: TPath): EndpointBuilder<RemoveTrailingSlash<TPath>, "OPTIONS", {}, [], Logger, undefined, unknown, undefined, string, readonly string[], undefined, string, ExtractStorageAuditAction<NonNullable<TAuditStorage>>, undefined, string>;
189
+ readonly database: Endpoints['database'];
190
+ readonly session: Endpoints['session'];
191
+ readonly auditor: Endpoints['auditor'];
192
+ readonly actor: Endpoints['actor'];
193
+ readonly authorizer: Endpoints['authorizer'];
194
+ readonly authorize: Endpoints['authorize'];
195
+ readonly rls: Endpoints['rls'];
196
+ readonly route: Endpoints['route'];
169
197
  /**
170
198
  * What authenticates this surface.
171
199
  *
@@ -175,12 +203,13 @@ declare class RestApi<TName extends string = string, const TAuthorizers extends
175
203
  * what a request is allowed to be. A surface with two of the first is a
176
204
  * mistake; two of the second is Tuesday.
177
205
  *
178
- * It records the id, not a client. Every endpoint consumes the same thing —
179
- * `verify(request) → Session | null` — and that is what every provider
180
- * shares, whether the server is mounted in this process, deployed beside it,
181
- * or an OIDC issuer somebody else runs.
206
+ * It declares the id, and keeps the construct: a session callback reads from
207
+ * it as `auth` — `session(async ({ auth }) => auth.getSession())` — which
208
+ * calls the construct's `verify(headers)`. That is the one thing every
209
+ * provider shares, whether the server is mounted in this process, deployed
210
+ * beside it, or an OIDC issuer somebody else runs.
182
211
  */
183
- auth(construct: Declarable): RestApi<TName, TAuthorizers>;
212
+ auth(construct: Authenticator): RestApi<TName, TAuthorizers>;
184
213
  /**
185
214
  * Other surfaces this one calls.
186
215
  *
@@ -207,7 +236,6 @@ declare class RestApi<TName extends string = string, const TAuthorizers extends
207
236
  */
208
237
  declare(): Declaration[];
209
238
  }
210
- //# sourceMappingURL=rest-api.d.ts.map
211
239
  //#endregion
212
- export { RestApi, RestApiConfig };
240
+ export type { Authenticator };
213
241
  //# sourceMappingURL=rest-api.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rest-api.d.mts","names":[],"sources":["../src/rest-api.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;AAkLM,UA3IW,aA2IX,CAAA,qBAAA,SAAA,MAAA,EAAA,GAAA,SAAA,EAAA,CAAA,CAAA;EAAa;;;;;;;;;;;EA6DmB,IAAA,EAAA,MAAA;EAAA;;;;;EAIC,IAAA,CAAA,EAAA;IAAA,MAAA,CAAA,EAAA,MAAA;IAAA,WAAA,CAAA,EAAA,OAAA;IAAA,YAAA,CAAA,EAAA,SAAA,MAAA,EAAA;IAIN,aAAA,CAAA,EAAA,SAAA,MAAA,EAAA;EAAK,CAAA;EAAA;;;;;EAAA,WAAA,CAAA,EA9KvB,YA8KuB;EAAA;;;;;;;;;;;;;;;;;;EAYI,iBAAA,EAvKtB,YAuKsB,CAAA,MAAA,CAAA,GAvKC,uBAuKD,GAAA,MAAA;EAAA;;;;;;;;;EAkBL,MAuBT,CAAA,EAtMlB,MAsMkB;EAAU;;;;;AAhKf;;cA9BV;;;;;;;;cAQA;;;;;;;;;;;;;;;;;cAmBA,8GAGA,WAAW;;;;;;eAEV;;;;;;;;;;;;;;;;;;mBAoBI;;;;;;;;;sBAUG;;uBAGC;kBAGhB,cAAc,gBACO,cAAc;0BAEC;;;;;;;;;;;;;;;;;;;sBAuDrB,wBAAwB;;kCAGZ,QAAK,gBAAA,oBAAA,uBAAA,qFAAA,0BAAA,YAAA;mCAIJ,QAAK,gBAAA,oBAAA,wBAAA,qFAAA,0BAAA,YAAA;kCAIN,QAAK,gBAAA,oBAAA,uBAAA,qFAAA,0BAAA,YAAA;oCAIH,QAAK,gBAAA,oBAAA,yBAAA,qFAAA,0BAAA,YAAA;qCAIJ,QAAK,gBAAA,oBAAA,0BAAA,qFAAA,0BAAA,YAAA;sCAIJ,QAAK,gBAAA,oBAAA,2BAAA,qFAAA,0BAAA,YAAA;;;;;;;;;;;;;;;kBAkBzB,aAAa,QAAQ,OAAO;;;;;;;;;;;;;;;6BAuBjB,eAAe,QAAQ,OAAO;;;;;;;;;;aAkB9C"}
1
+ {"version":3,"file":"rest-api.d.mts","names":[],"sources":["../src/rest-api.ts"],"mappings":";;;;;;;;;;KAmDK,YAAY,wBAAwB;iBAExB,cAIhB;;;;;;;;;;;;EAaA;;;;;;EAMA;;;;;;EAMA;IACC;IACA;IACA;IACA;;;;;;;EAOD,cAAc;;;;;;;;;;;;;;;;;;;EAmBd,mBAAmB,uBAAuB;;;;;;;;;;EAU1C,SAAS;;;;;;;;EAQT,YAAY;;;;;;;;EAQZ,YAAY;;;;;;;;;;EAUZ,YAAY;;;;;;;;;;;;;;;;;;qBAoBA,QACZ,qCACM,iEACM,WAAW;;mBA0CL;;mBAEA;;mBAEA;WA5CT,IAAI;;;;;;WAOJ;IACR;IACA;IACA;;;;;;;;;WAUQ,QAAQ;;;;;;;;;WAUR,WAAW;;WAGX,YAAY;;WAGZ,YAAY;EAErB,YACC,IAAI,cAAc,QACD,QAAQ,cAAc,eAEtB;;EAAA,wBAAuB,cAEvB;;EAAA,gBAAgB;;WAyEzB,KAAK;WACL,MAAM;WACN,KAAK;WACL,OAAO;WACP,QAAQ;WACR,SAAS;;;;;;;;;;;;;;;;;;;WAoBT,UAAU;WACV,SAAS;WACT,SAAS;WACT,OAAO;WACP,YAAY;WACZ,WAAW;WACX,KAAK;WACL,OAAO;;;;;;;;;;;;;;;;EAiBhB,KAAK,WAAW,gBAAgB,QAAQ,OAAO;;;;;;;;;;;;;;;EAuB/C,MAAM,qBAAqB,eAAe,QAAQ,OAAO;;;;;;;;;;EAkBzD,WAAW"}
package/dist/rest-api.mjs CHANGED
@@ -1,23 +1,19 @@
1
- import "./Construct-BD5neF7w.mjs";
2
- import { edgeTo } from "./construct-interface-Z4CpS8tK.mjs";
3
- import "./functions-14lpEFL4.mjs";
4
- import { EndpointFactory } from "./EndpointFactory-CjV8F_lJ.mjs";
5
- import "./clone-DblgEZZa.mjs";
6
- import "./Endpoint-DCQPMdUX.mjs";
7
- import { envParserFor } from "./surfaceEnv-C3Ktahea.mjs";
1
+ import { edgeTo } from "./construct-interface.mjs";
2
+ import { p as getSecurityScheme, t as EndpointFactory } from "./EndpointFactory-c2ZugGig.mjs";
3
+ import { n as envParserFor } from "./surfaceEnv-wMT5QzgZ.mjs";
8
4
  import { canonicalId, provideKey } from "@geekmidas/manifest";
9
5
  import { DEFAULT_LOGGER } from "@geekmidas/logger/console";
10
-
11
6
  //#region src/rest-api.ts
12
7
  /**
13
8
  * What is *not* here, and why.
14
9
  *
15
- * `dependsOn`, `database`, `auditor` and `publisher` all inject a capability
10
+ * `dependsOn`, `database`, `auditor` and `.event(topic, …)` all inject a capability
16
11
  * into a handler. Putting one on the surface hands it to every route the
17
12
  * surface serves — a health check gets the database because a report needed it
18
13
  * — which is the thing least privilege forbids and the reason `.calls()` is not
19
- * spelled `dependsOn`. They belong to the endpoint, or to a factory branched
20
- * from `api.endpoints` for a group of endpoints that genuinely share them.
14
+ * spelled `dependsOn`. They belong to the endpoint, or to a branch —
15
+ * `api.database(db)` — for a group of endpoints that genuinely share them. A
16
+ * branch is a new factory; the surface config stays free of grants.
21
17
  *
22
18
  * `auth` is not here either: `.auth(construct)` already declares it, and a
23
19
  * second way to say the same thing is the duplication this whole model removes.
@@ -25,6 +21,9 @@ import { DEFAULT_LOGGER } from "@geekmidas/logger/console";
25
21
  * What is left is what the *process* is rather than what a route may reach.
26
22
  */
27
23
  var RestApi = class RestApi {
24
+ config;
25
+ dependencies;
26
+ authenticator;
28
27
  id;
29
28
  /**
30
29
  * Declared once and read by both `declare()` and anything that consumes this
@@ -51,6 +50,8 @@ var RestApi = class RestApi {
51
50
  envParser;
52
51
  /** The Telescope instance, when this surface was given one. */
53
52
  telescope;
53
+ /** What this surface's process emits, when it was given a `Telemetry`. */
54
+ telemetry;
54
55
  constructor(id, config, dependencies = [], authenticator) {
55
56
  this.config = config;
56
57
  this.dependencies = dependencies;
@@ -64,57 +65,84 @@ var RestApi = class RestApi {
64
65
  };
65
66
  this.logger = config.logger ?? DEFAULT_LOGGER;
66
67
  this.telescope = config.telescope;
68
+ this.telemetry = config.telemetry;
67
69
  this.envParser = envParserFor(config.envParser ? {
68
70
  id: canonical,
69
71
  envParser: config.envParser
70
72
  } : void 0);
71
- this.endpoints = new EndpointFactory({
73
+ this.#endpoints = new EndpointFactory({
72
74
  defaultLogger: this.logger,
73
- ...config.authorizers ? { availableAuthorizers: config.authorizers.map((name) => ({ name })) } : {},
75
+ ...config.authorizers ? { availableAuthorizers: config.authorizers.map((name) => {
76
+ const securityScheme = getSecurityScheme(name);
77
+ return securityScheme ? {
78
+ name,
79
+ securityScheme
80
+ } : { name };
81
+ }) } : {},
74
82
  ...config.defaultAuthorizer && config.defaultAuthorizer !== "none" ? { defaultAuthorizerName: config.defaultAuthorizer } : {},
75
83
  surface: {
76
84
  id: this.id,
77
- envParser: this.envParser
85
+ envParser: this.envParser,
86
+ ...authenticator ? { auth: authenticator } : {}
78
87
  }
79
88
  });
89
+ const endpoints = this.#endpoints;
90
+ this.get = endpoints.get.bind(endpoints);
91
+ this.post = endpoints.post.bind(endpoints);
92
+ this.put = endpoints.put.bind(endpoints);
93
+ this.patch = endpoints.patch.bind(endpoints);
94
+ this.delete = endpoints.delete.bind(endpoints);
95
+ this.options = endpoints.options.bind(endpoints);
96
+ this.database = endpoints.database.bind(endpoints);
97
+ this.session = endpoints.session.bind(endpoints);
98
+ this.auditor = endpoints.auditor.bind(endpoints);
99
+ this.actor = endpoints.actor.bind(endpoints);
100
+ this.authorizer = endpoints.authorizer.bind(endpoints);
101
+ this.authorize = endpoints.authorize.bind(endpoints);
102
+ this.rls = endpoints.rls.bind(endpoints);
103
+ this.route = endpoints.route.bind(endpoints);
80
104
  }
81
105
  /**
82
- * This surface's endpoint factory.
106
+ * This surface's endpoint factory, which every method below starts from.
83
107
  *
84
- * `api.get('/users')` is the short form and covers most routes. Reach for
85
- * this one when a *group* of endpoints shares something a single route would
86
- * otherwise repeat — a database, an auditor, a publisher:
108
+ * Private: a surface *is* where endpoints are built, so there is no second
109
+ * object to reach through first. `api.database(db)` said the same
110
+ * thing as `api.database(db)` with one more word to learn.
111
+ */
112
+ #endpoints;
113
+ /** `api.get('/users')` — one route on this surface. */
114
+ get;
115
+ post;
116
+ put;
117
+ patch;
118
+ delete;
119
+ options;
120
+ /**
121
+ * A branch for a *group* of endpoints that shares what a single route would
122
+ * otherwise repeat — a database, an auditor, a publisher, a session:
87
123
  *
88
124
  * ```ts
89
- * const audited = api.endpoints.database(db).auditor(AuditStore);
90
- * export const createUser = audited.post('/users').handle(...);
125
+ * export const router = api.database(database);
126
+ * export const createUser = router.post('/users').handle(({ db }) => …);
91
127
  * ```
92
128
  *
93
- * A factory branched from here keeps the surface, so its endpoints still
94
- * know which API serves them. That is deliberately narrower than putting the
95
- * same thing in the surface's own config: a group opts in, where a surface
96
- * would grant it to every route it serves.
129
+ * Each returns a new factory and leaves the surface as it was. That is the
130
+ * whole difference from putting the same thing in the surface's config: a
131
+ * group opts in, where the surface would grant it to every route it serves —
132
+ * a health check handed the database because a profile endpoint needed it.
133
+ *
134
+ * `dependsOn` is deliberately not here. It is per endpoint, and on the
135
+ * surface it would read as the API depending on something, which is what
136
+ * `.calls()` and `.auth()` say instead.
97
137
  */
98
- endpoints;
99
- /** `api.get('/users')` — sugar for `api.endpoints.get('/users')`. */
100
- get(path) {
101
- return this.endpoints.get(path);
102
- }
103
- post(path) {
104
- return this.endpoints.post(path);
105
- }
106
- put(path) {
107
- return this.endpoints.put(path);
108
- }
109
- patch(path) {
110
- return this.endpoints.patch(path);
111
- }
112
- delete(path) {
113
- return this.endpoints.delete(path);
114
- }
115
- options(path) {
116
- return this.endpoints.options(path);
117
- }
138
+ database;
139
+ session;
140
+ auditor;
141
+ actor;
142
+ authorizer;
143
+ authorize;
144
+ rls;
145
+ route;
118
146
  /**
119
147
  * What authenticates this surface.
120
148
  *
@@ -124,13 +152,14 @@ var RestApi = class RestApi {
124
152
  * what a request is allowed to be. A surface with two of the first is a
125
153
  * mistake; two of the second is Tuesday.
126
154
  *
127
- * It records the id, not a client. Every endpoint consumes the same thing —
128
- * `verify(request) → Session | null` — and that is what every provider
129
- * shares, whether the server is mounted in this process, deployed beside it,
130
- * or an OIDC issuer somebody else runs.
155
+ * It declares the id, and keeps the construct: a session callback reads from
156
+ * it as `auth` — `session(async ({ auth }) => auth.getSession())` — which
157
+ * calls the construct's `verify(headers)`. That is the one thing every
158
+ * provider shares, whether the server is mounted in this process, deployed
159
+ * beside it, or an OIDC issuer somebody else runs.
131
160
  */
132
161
  auth(construct) {
133
- return new RestApi(this.id, this.config, [...this.dependencies, edgeTo(construct)], construct.id);
162
+ return new RestApi(this.id, this.config, [...this.dependencies, edgeTo(construct)], construct);
134
163
  }
135
164
  /**
136
165
  * Other surfaces this one calls.
@@ -163,11 +192,13 @@ var RestApi = class RestApi {
163
192
  kind: "rest-api",
164
193
  id: this.id,
165
194
  path: this.config.path,
195
+ ...this.config.subdomain ? { subdomain: this.config.subdomain } : {},
166
196
  ...this.config.telescope ? { telescope: true } : {},
167
197
  ...this.config.cors ? { cors: this.config.cors } : {},
168
- ...this.authenticator ? { auth: this.authenticator } : {},
198
+ ...this.authenticator ? { auth: this.authenticator.id } : {},
169
199
  endpoints: [],
170
200
  ...this.dependencies.length ? { calls: this.dependencies } : {},
201
+ ...this.config.telemetry ? { telemetry: this.config.telemetry.id } : {},
171
202
  ...this.config.authorizers?.length ? { authorizers: this.config.authorizers } : {},
172
203
  defaultAuthorizer: this.config.defaultAuthorizer,
173
204
  provides: [
@@ -178,7 +209,7 @@ var RestApi = class RestApi {
178
209
  }];
179
210
  }
180
211
  };
181
-
182
212
  //#endregion
183
213
  export { RestApi };
214
+
184
215
  //# sourceMappingURL=rest-api.mjs.map