@geekmidas/constructs 10.0.0-alpha.1 → 10.0.0-alpha.100

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 (422) hide show
  1. package/README.md +223 -158
  2. package/dist/{Construct-CdhThxDI.mjs → Construct-B1vGBPme.mjs} +45 -33
  3. package/dist/Construct-B1vGBPme.mjs.map +1 -0
  4. package/dist/Construct-BQALFCh2.d.cts +230 -0
  5. package/dist/Construct-BQALFCh2.d.cts.map +1 -0
  6. package/dist/{Construct-roId57cU.cjs → Construct-DUSXuTHP.cjs} +65 -47
  7. package/dist/Construct-DUSXuTHP.cjs.map +1 -0
  8. package/dist/Construct-QXnl3VqT.d.mts +230 -0
  9. package/dist/Construct-QXnl3VqT.d.mts.map +1 -0
  10. package/dist/Cron-DI3nKoic.d.cts +45 -0
  11. package/dist/Cron-DI3nKoic.d.cts.map +1 -0
  12. package/dist/Cron-uYAHPnp7.d.mts +45 -0
  13. package/dist/Cron-uYAHPnp7.d.mts.map +1 -0
  14. package/dist/CronBuilder-C0Ek1-RA.cjs +121 -0
  15. package/dist/CronBuilder-C0Ek1-RA.cjs.map +1 -0
  16. package/dist/CronBuilder-DaSUm2Na.d.mts +47 -0
  17. package/dist/CronBuilder-DaSUm2Na.d.mts.map +1 -0
  18. package/dist/CronBuilder-Dmix_Pen.mjs +109 -0
  19. package/dist/CronBuilder-Dmix_Pen.mjs.map +1 -0
  20. package/dist/CronBuilder-g1lZLWyG.d.cts +47 -0
  21. package/dist/CronBuilder-g1lZLWyG.d.cts.map +1 -0
  22. package/dist/{Endpoint-BTj58Gob.mjs → Endpoint-BG4UJ9oA.mjs} +146 -109
  23. package/dist/Endpoint-BG4UJ9oA.mjs.map +1 -0
  24. package/dist/{Endpoint-BBkV6l0k.cjs → Endpoint-BoUg8ocM.cjs} +174 -131
  25. package/dist/Endpoint-BoUg8ocM.cjs.map +1 -0
  26. package/dist/{Endpoint-BKR5QH6O.d.mts → Endpoint-Du-NwPX2.d.mts} +83 -91
  27. package/dist/Endpoint-Du-NwPX2.d.mts.map +1 -0
  28. package/dist/{Endpoint-BQ9O0P1w.d.cts → Endpoint-aCvBMPoH.d.cts} +82 -90
  29. package/dist/Endpoint-aCvBMPoH.d.cts.map +1 -0
  30. package/dist/{EndpointFactory-BejSTzbB.mjs → EndpointFactory-BDtsrEvJ.mjs} +60 -77
  31. package/dist/EndpointFactory-BDtsrEvJ.mjs.map +1 -0
  32. package/dist/{EndpointFactory-DYoGLaIT.cjs → EndpointFactory-DJ7gXLpR.cjs} +96 -113
  33. package/dist/EndpointFactory-DJ7gXLpR.cjs.map +1 -0
  34. package/dist/{index-D5zqAJ2e.d.cts → EndpointFactory-DMYdJCOj.d.mts} +78 -134
  35. package/dist/EndpointFactory-DMYdJCOj.d.mts.map +1 -0
  36. package/dist/{index-Cvz551AO.d.mts → EndpointFactory-I7s1co3Y.d.cts} +79 -135
  37. package/dist/EndpointFactory-I7s1co3Y.d.cts.map +1 -0
  38. package/dist/Function-DuqGcbOI.d.mts +76 -0
  39. package/dist/Function-DuqGcbOI.d.mts.map +1 -0
  40. package/dist/Function-Pu-1kKZz.d.cts +76 -0
  41. package/dist/Function-Pu-1kKZz.d.cts.map +1 -0
  42. package/dist/{HonoEndpointAdaptor-7aYNdqJq.mjs → HonoEndpointAdaptor-PtPlbeKY.mjs} +75 -57
  43. package/dist/HonoEndpointAdaptor-PtPlbeKY.mjs.map +1 -0
  44. package/dist/{HonoEndpointAdaptor-wMsCyMgt.cjs → HonoEndpointAdaptor-zVzVLJEO.cjs} +83 -62
  45. package/dist/HonoEndpointAdaptor-zVzVLJEO.cjs.map +1 -0
  46. package/dist/Queue-A3wfD0it.cjs +109 -0
  47. package/dist/Queue-A3wfD0it.cjs.map +1 -0
  48. package/dist/Queue-D6USGS4q.mjs +104 -0
  49. package/dist/Queue-D6USGS4q.mjs.map +1 -0
  50. package/dist/{Queue-D6WeziRD.d.cts → Queue-DlsHRzUp.d.mts} +48 -48
  51. package/dist/Queue-DlsHRzUp.d.mts.map +1 -0
  52. package/dist/{Queue-DpUeqdC8.d.mts → Queue-HPyi0e1i.d.cts} +49 -49
  53. package/dist/Queue-HPyi0e1i.d.cts.map +1 -0
  54. package/dist/QueueBuilder-BjuF0UBl.cjs +135 -0
  55. package/dist/QueueBuilder-BjuF0UBl.cjs.map +1 -0
  56. package/dist/QueueBuilder-Cue73M4t.mjs +118 -0
  57. package/dist/QueueBuilder-Cue73M4t.mjs.map +1 -0
  58. package/dist/QueueBuilder-OSi6LkV9.d.cts +75 -0
  59. package/dist/QueueBuilder-OSi6LkV9.d.cts.map +1 -0
  60. package/dist/QueueBuilder-QHsnVt1P.d.mts +75 -0
  61. package/dist/QueueBuilder-QHsnVt1P.d.mts.map +1 -0
  62. package/dist/{Subscriber-4rBJgDKI.d.mts → Subscriber-Bpp02cGr.d.cts} +30 -21
  63. package/dist/Subscriber-Bpp02cGr.d.cts.map +1 -0
  64. package/dist/{Subscriber-DVQowdyj.d.cts → Subscriber-CtN9R48-.d.mts} +29 -20
  65. package/dist/Subscriber-CtN9R48-.d.mts.map +1 -0
  66. package/dist/SubscriberBuilder-CDy4nHCz.mjs +134 -0
  67. package/dist/SubscriberBuilder-CDy4nHCz.mjs.map +1 -0
  68. package/dist/SubscriberBuilder-CuCMFpYW.d.mts +67 -0
  69. package/dist/SubscriberBuilder-CuCMFpYW.d.mts.map +1 -0
  70. package/dist/SubscriberBuilder-D_owVoHo.cjs +145 -0
  71. package/dist/SubscriberBuilder-D_owVoHo.cjs.map +1 -0
  72. package/dist/SubscriberBuilder-g3fAVWgs.d.cts +67 -0
  73. package/dist/SubscriberBuilder-g3fAVWgs.d.cts.map +1 -0
  74. package/dist/Topic-D74b5cgs.mjs +99 -0
  75. package/dist/Topic-D74b5cgs.mjs.map +1 -0
  76. package/dist/Topic-GHxcU8AG.cjs +104 -0
  77. package/dist/Topic-GHxcU8AG.cjs.map +1 -0
  78. package/dist/adaptors/aws.cjs +332 -188
  79. package/dist/adaptors/aws.cjs.map +1 -1
  80. package/dist/adaptors/aws.d.cts +114 -44
  81. package/dist/adaptors/aws.d.cts.map +1 -1
  82. package/dist/adaptors/aws.d.mts +114 -44
  83. package/dist/adaptors/aws.d.mts.map +1 -1
  84. package/dist/adaptors/aws.mjs +308 -166
  85. package/dist/adaptors/aws.mjs.map +1 -1
  86. package/dist/adaptors/hono.cjs +3 -11
  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 +8 -17
  90. package/dist/adaptors/hono.d.mts.map +1 -1
  91. package/dist/adaptors/hono.mjs +2 -11
  92. package/dist/adaptors/testing.cjs +743 -90
  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 +706 -71
  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-CcuceLYo.d.mts +268 -0
  103. package/dist/auth-CcuceLYo.d.mts.map +1 -0
  104. package/dist/auth.cjs +302 -34
  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 +290 -28
  109. package/dist/auth.mjs.map +1 -1
  110. package/dist/{cache-CdQ7OLpR.d.cts → cache-CXh6GIgb.d.mts} +4 -7
  111. package/dist/cache-CXh6GIgb.d.mts.map +1 -0
  112. package/dist/{cache-DYoJFcfd.d.mts → cache-DnGDGly3.d.cts} +4 -7
  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/{clone-DblgEZZa.mjs → clone-EKNovYHu.mjs} +3 -3
  125. package/dist/clone-EKNovYHu.mjs.map +1 -0
  126. package/dist/{clone-Dy0cR2SZ.cjs → clone-UGJpvQnL.cjs} +7 -8
  127. package/dist/clone-UGJpvQnL.cjs.map +1 -0
  128. package/dist/{construct-interface-BqwRNYA2.d.mts → construct-interface-B1AfqRl4.d.cts} +43 -12
  129. package/dist/construct-interface-B1AfqRl4.d.cts.map +1 -0
  130. package/dist/{construct-interface-D2nNkHUN.d.cts → construct-interface-DluK3_da.d.mts} +43 -12
  131. package/dist/construct-interface-DluK3_da.d.mts.map +1 -0
  132. package/dist/construct-interface.cjs +113 -7
  133. package/dist/construct-interface.cjs.map +1 -0
  134. package/dist/construct-interface.d.cts +2 -2
  135. package/dist/construct-interface.d.mts +2 -2
  136. package/dist/construct-interface.mjs +106 -2
  137. package/dist/construct-interface.mjs.map +1 -0
  138. package/dist/credential.cjs +77 -17
  139. package/dist/credential.cjs.map +1 -1
  140. package/dist/credential.d.cts +34 -9
  141. package/dist/credential.d.cts.map +1 -1
  142. package/dist/credential.d.mts +34 -9
  143. package/dist/credential.d.mts.map +1 -1
  144. package/dist/credential.mjs +71 -13
  145. package/dist/credential.mjs.map +1 -1
  146. package/dist/crons/index.cjs +189 -85
  147. package/dist/crons/index.cjs.map +1 -1
  148. package/dist/crons/index.d.cts +70 -48
  149. package/dist/crons/index.d.cts.map +1 -1
  150. package/dist/crons/index.d.mts +70 -48
  151. package/dist/crons/index.d.mts.map +1 -1
  152. package/dist/crons/index.mjs +183 -81
  153. package/dist/crons/index.mjs.map +1 -1
  154. package/dist/database/kysely.cjs +4 -181
  155. package/dist/database/kysely.d.cts +2 -152
  156. package/dist/database/kysely.d.mts +2 -152
  157. package/dist/database/kysely.mjs +2 -180
  158. package/dist/email.cjs +25 -12
  159. package/dist/email.cjs.map +1 -1
  160. package/dist/email.d.cts +3 -7
  161. package/dist/email.d.cts.map +1 -1
  162. package/dist/email.d.mts +3 -7
  163. package/dist/email.d.mts.map +1 -1
  164. package/dist/email.mjs +16 -3
  165. package/dist/email.mjs.map +1 -1
  166. package/dist/encryption.cjs +96 -0
  167. package/dist/encryption.cjs.map +1 -0
  168. package/dist/encryption.d.cts +117 -0
  169. package/dist/encryption.d.cts.map +1 -0
  170. package/dist/encryption.d.mts +117 -0
  171. package/dist/encryption.d.mts.map +1 -0
  172. package/dist/encryption.mjs +83 -0
  173. package/dist/encryption.mjs.map +1 -0
  174. package/dist/endpoints/index.cjs +8 -11
  175. package/dist/endpoints/index.d.cts +51 -7
  176. package/dist/endpoints/index.d.cts.map +1 -0
  177. package/dist/endpoints/index.d.mts +51 -7
  178. package/dist/endpoints/index.d.mts.map +1 -0
  179. package/dist/endpoints/index.mjs +6 -11
  180. package/dist/external-api-MJ8id87V.d.mts +105 -0
  181. package/dist/external-api-MJ8id87V.d.mts.map +1 -0
  182. package/dist/external-api-O107yzZJ.d.cts +105 -0
  183. package/dist/external-api-O107yzZJ.d.cts.map +1 -0
  184. package/dist/external-api.cjs +142 -0
  185. package/dist/external-api.cjs.map +1 -0
  186. package/dist/external-api.d.cts +2 -0
  187. package/dist/external-api.d.mts +2 -0
  188. package/dist/external-api.mjs +139 -0
  189. package/dist/external-api.mjs.map +1 -0
  190. package/dist/file-server.cjs +42 -10
  191. package/dist/file-server.cjs.map +1 -1
  192. package/dist/file-server.d.cts +6 -10
  193. package/dist/file-server.d.cts.map +1 -1
  194. package/dist/file-server.d.mts +6 -10
  195. package/dist/file-server.d.mts.map +1 -1
  196. package/dist/file-server.mjs +34 -2
  197. package/dist/file-server.mjs.map +1 -1
  198. package/dist/functions/index.cjs +2 -6
  199. package/dist/functions/index.d.cts +3 -4
  200. package/dist/functions/index.d.mts +3 -4
  201. package/dist/functions/index.mjs +2 -6
  202. package/dist/{functions-Cpff1uZH.mjs → functions-BFizikJU.mjs} +394 -243
  203. package/dist/functions-BFizikJU.mjs.map +1 -0
  204. package/dist/{functions-DukjG8ov.cjs → functions-CfzJG9hK.cjs} +432 -275
  205. package/dist/functions-CfzJG9hK.cjs.map +1 -0
  206. package/dist/index-BuzRvKOQ.d.cts +115 -0
  207. package/dist/index-BuzRvKOQ.d.cts.map +1 -0
  208. package/dist/index-CTkKOer4.d.mts +115 -0
  209. package/dist/index-CTkKOer4.d.mts.map +1 -0
  210. package/dist/index-CeEtxDmK.d.cts +79 -0
  211. package/dist/index-CeEtxDmK.d.cts.map +1 -0
  212. package/dist/index-CeEtxDmK.d.mts +79 -0
  213. package/dist/index-CeEtxDmK.d.mts.map +1 -0
  214. package/dist/index.cjs +6 -3
  215. package/dist/index.d.cts +27 -4
  216. package/dist/index.d.cts.map +1 -0
  217. package/dist/index.d.mts +27 -4
  218. package/dist/index.d.mts.map +1 -0
  219. package/dist/index.mjs +3 -3
  220. package/dist/kms-B-Hm3d5r.cjs +85 -0
  221. package/dist/kms-B-Hm3d5r.cjs.map +1 -0
  222. package/dist/kms-BdUlMJEZ.mjs +85 -0
  223. package/dist/kms-BdUlMJEZ.mjs.map +1 -0
  224. package/dist/kysely-Bii4l6eP.mjs +370 -0
  225. package/dist/kysely-Bii4l6eP.mjs.map +1 -0
  226. package/dist/kysely-CO_Dk43W.cjs +383 -0
  227. package/dist/kysely-CO_Dk43W.cjs.map +1 -0
  228. package/dist/kysely-D0bpzgPs.d.cts +175 -0
  229. package/dist/kysely-D0bpzgPs.d.cts.map +1 -0
  230. package/dist/kysely-DUqC3Ie0.d.mts +175 -0
  231. package/dist/kysely-DUqC3Ie0.d.mts.map +1 -0
  232. package/dist/{telemetry-C3L0iS28.d.cts → lambdaTelemetry-8vnmVZQ5.d.cts} +3 -6
  233. package/dist/lambdaTelemetry-8vnmVZQ5.d.cts.map +1 -0
  234. package/dist/{telemetry-D7bVFLGi.d.mts → lambdaTelemetry-8vnmVZQ5.d.mts} +3 -6
  235. package/dist/lambdaTelemetry-8vnmVZQ5.d.mts.map +1 -0
  236. package/dist/{lazyAccessors-DM6HcXQk.mjs → lazyAccessors-CFanua0O.mjs} +20 -21
  237. package/dist/lazyAccessors-CFanua0O.mjs.map +1 -0
  238. package/dist/{lazyAccessors-DrJj8NpA.cjs → lazyAccessors-hJKGv8Ay.cjs} +60 -62
  239. package/dist/lazyAccessors-hJKGv8Ay.cjs.map +1 -0
  240. package/dist/mobile-app.cjs +73 -0
  241. package/dist/mobile-app.cjs.map +1 -0
  242. package/dist/mobile-app.d.cts +61 -0
  243. package/dist/mobile-app.d.cts.map +1 -0
  244. package/dist/mobile-app.d.mts +61 -0
  245. package/dist/mobile-app.d.mts.map +1 -0
  246. package/dist/mobile-app.mjs +72 -0
  247. package/dist/mobile-app.mjs.map +1 -0
  248. package/dist/object-storage.cjs +18 -10
  249. package/dist/object-storage.cjs.map +1 -1
  250. package/dist/object-storage.d.cts +3 -7
  251. package/dist/object-storage.d.cts.map +1 -1
  252. package/dist/object-storage.d.mts +3 -7
  253. package/dist/object-storage.d.mts.map +1 -1
  254. package/dist/object-storage.mjs +11 -3
  255. package/dist/object-storage.mjs.map +1 -1
  256. package/dist/processAudits-BRRVVHUB.mjs +131 -0
  257. package/dist/processAudits-BRRVVHUB.mjs.map +1 -0
  258. package/dist/processAudits-DasOZjPl.cjs +154 -0
  259. package/dist/processAudits-DasOZjPl.cjs.map +1 -0
  260. package/dist/queue/index.cjs +6 -189
  261. package/dist/queue/index.d.cts +3 -60
  262. package/dist/queue/index.d.mts +3 -60
  263. package/dist/queue/index.mjs +3 -186
  264. package/dist/rest-api.cjs +92 -63
  265. package/dist/rest-api.cjs.map +1 -1
  266. package/dist/rest-api.d.cts +81 -61
  267. package/dist/rest-api.d.cts.map +1 -1
  268. package/dist/rest-api.d.mts +81 -61
  269. package/dist/rest-api.d.mts.map +1 -1
  270. package/dist/rest-api.mjs +84 -55
  271. package/dist/rest-api.mjs.map +1 -1
  272. package/dist/{chunk-DWy1uDak.cjs → rolldown-runtime-y5ARvAq5.cjs} +14 -18
  273. package/dist/runSubscriber-BHvJ8POr.mjs +109 -0
  274. package/dist/runSubscriber-BHvJ8POr.mjs.map +1 -0
  275. package/dist/runSubscriber-D8nLXIv1.cjs +126 -0
  276. package/dist/runSubscriber-D8nLXIv1.cjs.map +1 -0
  277. package/dist/shutdown-BMJmAhSt.cjs +38 -0
  278. package/dist/shutdown-BMJmAhSt.cjs.map +1 -0
  279. package/dist/shutdown-C7xa8x9S.mjs +27 -0
  280. package/dist/shutdown-C7xa8x9S.mjs.map +1 -0
  281. package/dist/site.cjs +35 -9
  282. package/dist/site.cjs.map +1 -1
  283. package/dist/site.d.cts +25 -22
  284. package/dist/site.d.cts.map +1 -1
  285. package/dist/site.d.mts +25 -22
  286. package/dist/site.d.mts.map +1 -1
  287. package/dist/site.mjs +31 -5
  288. package/dist/site.mjs.map +1 -1
  289. package/dist/stages-BSCF19o2.d.cts +56 -0
  290. package/dist/stages-BSCF19o2.d.cts.map +1 -0
  291. package/dist/stages-BSCF19o2.d.mts +56 -0
  292. package/dist/stages-BSCF19o2.d.mts.map +1 -0
  293. package/dist/subscribers/index.cjs +111 -101
  294. package/dist/subscribers/index.cjs.map +1 -1
  295. package/dist/subscribers/index.d.cts +44 -56
  296. package/dist/subscribers/index.d.cts.map +1 -1
  297. package/dist/subscribers/index.d.mts +44 -56
  298. package/dist/subscribers/index.d.mts.map +1 -1
  299. package/dist/subscribers/index.mjs +108 -98
  300. package/dist/subscribers/index.mjs.map +1 -1
  301. package/dist/surfaceEnv-CNimK76p.cjs +56 -0
  302. package/dist/surfaceEnv-CNimK76p.cjs.map +1 -0
  303. package/dist/surfaceEnv-wMT5QzgZ.mjs +45 -0
  304. package/dist/surfaceEnv-wMT5QzgZ.mjs.map +1 -0
  305. package/dist/telemetry-B48RLjyk.d.cts +40 -0
  306. package/dist/telemetry-B48RLjyk.d.cts.map +1 -0
  307. package/dist/telemetry-DRtT1_0A.d.mts +40 -0
  308. package/dist/telemetry-DRtT1_0A.d.mts.map +1 -0
  309. package/dist/telemetry.cjs +56 -0
  310. package/dist/telemetry.cjs.map +1 -0
  311. package/dist/telemetry.d.cts +2 -0
  312. package/dist/telemetry.d.mts +2 -0
  313. package/dist/telemetry.mjs +55 -0
  314. package/dist/telemetry.mjs.map +1 -0
  315. package/dist/topic/index.cjs +3 -137
  316. package/dist/topic/index.d.cts +2 -32
  317. package/dist/topic/index.d.mts +2 -32
  318. package/dist/topic/index.mjs +2 -134
  319. package/dist/tracing-CxaZ98IB.mjs +110 -0
  320. package/dist/tracing-CxaZ98IB.mjs.map +1 -0
  321. package/dist/tracing-DPMidF_r.cjs +127 -0
  322. package/dist/tracing-DPMidF_r.cjs.map +1 -0
  323. package/dist/{types-BlAkSuGI.d.cts → types-DMuSQeLL.d.cts} +3 -5
  324. package/dist/types-DMuSQeLL.d.cts.map +1 -0
  325. package/dist/{types-aKksMEWL.d.mts → types-DMuSQeLL.d.mts} +3 -5
  326. package/dist/types-DMuSQeLL.d.mts.map +1 -0
  327. package/dist/types.d.cts +1 -1
  328. package/dist/types.d.mts +1 -1
  329. package/dist/types.mjs +1 -0
  330. package/dist/worker.cjs +191 -0
  331. package/dist/worker.cjs.map +1 -0
  332. package/dist/worker.d.cts +171 -0
  333. package/dist/worker.d.cts.map +1 -0
  334. package/dist/worker.d.mts +171 -0
  335. package/dist/worker.d.mts.map +1 -0
  336. package/dist/worker.mjs +190 -0
  337. package/dist/worker.mjs.map +1 -0
  338. package/package.json +116 -70
  339. package/dist/AWSScheduledFunction-9bJS4WdJ.d.cts +0 -122
  340. package/dist/AWSScheduledFunction-9bJS4WdJ.d.cts.map +0 -1
  341. package/dist/AWSScheduledFunction-BJjj8B5V.mjs +0 -243
  342. package/dist/AWSScheduledFunction-BJjj8B5V.mjs.map +0 -1
  343. package/dist/AWSScheduledFunction-BO5iEMSh.d.mts +0 -122
  344. package/dist/AWSScheduledFunction-BO5iEMSh.d.mts.map +0 -1
  345. package/dist/AWSScheduledFunction-qu4ieRZR.cjs +0 -255
  346. package/dist/AWSScheduledFunction-qu4ieRZR.cjs.map +0 -1
  347. package/dist/Construct-B-xc0SE9.d.mts +0 -104
  348. package/dist/Construct-B-xc0SE9.d.mts.map +0 -1
  349. package/dist/Construct-CdhThxDI.mjs.map +0 -1
  350. package/dist/Construct-WhCXIOPV.d.cts +0 -104
  351. package/dist/Construct-WhCXIOPV.d.cts.map +0 -1
  352. package/dist/Construct-roId57cU.cjs.map +0 -1
  353. package/dist/Endpoint-BBkV6l0k.cjs.map +0 -1
  354. package/dist/Endpoint-BKR5QH6O.d.mts.map +0 -1
  355. package/dist/Endpoint-BQ9O0P1w.d.cts.map +0 -1
  356. package/dist/Endpoint-BTj58Gob.mjs.map +0 -1
  357. package/dist/EndpointFactory-BejSTzbB.mjs.map +0 -1
  358. package/dist/EndpointFactory-DYoGLaIT.cjs.map +0 -1
  359. package/dist/HonoEndpointAdaptor-7aYNdqJq.mjs.map +0 -1
  360. package/dist/HonoEndpointAdaptor-wMsCyMgt.cjs.map +0 -1
  361. package/dist/Queue-D6WeziRD.d.cts.map +0 -1
  362. package/dist/Queue-DpUeqdC8.d.mts.map +0 -1
  363. package/dist/Subscriber-4rBJgDKI.d.mts.map +0 -1
  364. package/dist/Subscriber-DVQowdyj.d.cts.map +0 -1
  365. package/dist/Topic-Ohx9dvWr.d.cts +0 -91
  366. package/dist/Topic-Ohx9dvWr.d.cts.map +0 -1
  367. package/dist/Topic-cmy2jOUy.d.mts +0 -91
  368. package/dist/Topic-cmy2jOUy.d.mts.map +0 -1
  369. package/dist/auth.d.cts.map +0 -1
  370. package/dist/auth.d.mts.map +0 -1
  371. package/dist/cache-0ANvRQnD.mjs +0 -51
  372. package/dist/cache-0ANvRQnD.mjs.map +0 -1
  373. package/dist/cache-3WSvAulx.cjs +0 -57
  374. package/dist/cache-3WSvAulx.cjs.map +0 -1
  375. package/dist/cache-CdQ7OLpR.d.cts.map +0 -1
  376. package/dist/cache-DYoJFcfd.d.mts.map +0 -1
  377. package/dist/clone-DblgEZZa.mjs.map +0 -1
  378. package/dist/clone-Dy0cR2SZ.cjs.map +0 -1
  379. package/dist/construct-interface-BfjcOD_E.cjs +0 -117
  380. package/dist/construct-interface-BfjcOD_E.cjs.map +0 -1
  381. package/dist/construct-interface-BqwRNYA2.d.mts.map +0 -1
  382. package/dist/construct-interface-D2nNkHUN.d.cts.map +0 -1
  383. package/dist/construct-interface-Z4CpS8tK.mjs +0 -81
  384. package/dist/construct-interface-Z4CpS8tK.mjs.map +0 -1
  385. package/dist/database/kysely.cjs.map +0 -1
  386. package/dist/database/kysely.d.cts.map +0 -1
  387. package/dist/database/kysely.d.mts.map +0 -1
  388. package/dist/database/kysely.mjs.map +0 -1
  389. package/dist/functions-Cpff1uZH.mjs.map +0 -1
  390. package/dist/functions-DukjG8ov.cjs.map +0 -1
  391. package/dist/index-BTvozlUD.d.cts +0 -163
  392. package/dist/index-BTvozlUD.d.cts.map +0 -1
  393. package/dist/index-Cvz551AO.d.mts.map +0 -1
  394. package/dist/index-D5zqAJ2e.d.cts.map +0 -1
  395. package/dist/index-L7pz0R0T.d.mts +0 -162
  396. package/dist/index-L7pz0R0T.d.mts.map +0 -1
  397. package/dist/lazyAccessors-DM6HcXQk.mjs.map +0 -1
  398. package/dist/lazyAccessors-DrJj8NpA.cjs.map +0 -1
  399. package/dist/processAudits-Bc8rz6Ev.cjs +0 -92
  400. package/dist/processAudits-Bc8rz6Ev.cjs.map +0 -1
  401. package/dist/processAudits-D89tICM4.mjs +0 -80
  402. package/dist/processAudits-D89tICM4.mjs.map +0 -1
  403. package/dist/publisher-CGEo8UKD.mjs +0 -41
  404. package/dist/publisher-CGEo8UKD.mjs.map +0 -1
  405. package/dist/publisher-CqGsXB2X.cjs +0 -53
  406. package/dist/publisher-CqGsXB2X.cjs.map +0 -1
  407. package/dist/queue/index.cjs.map +0 -1
  408. package/dist/queue/index.d.cts.map +0 -1
  409. package/dist/queue/index.d.mts.map +0 -1
  410. package/dist/queue/index.mjs.map +0 -1
  411. package/dist/surfaceEnv-BFXEms2f.cjs +0 -39
  412. package/dist/surfaceEnv-BFXEms2f.cjs.map +0 -1
  413. package/dist/surfaceEnv-C3Ktahea.mjs +0 -27
  414. package/dist/surfaceEnv-C3Ktahea.mjs.map +0 -1
  415. package/dist/telemetry-C3L0iS28.d.cts.map +0 -1
  416. package/dist/telemetry-D7bVFLGi.d.mts.map +0 -1
  417. package/dist/topic/index.cjs.map +0 -1
  418. package/dist/topic/index.d.cts.map +0 -1
  419. package/dist/topic/index.d.mts.map +0 -1
  420. package/dist/topic/index.mjs.map +0 -1
  421. package/dist/types-BlAkSuGI.d.cts.map +0 -1
  422. package/dist/types-aKksMEWL.d.mts.map +0 -1
@@ -0,0 +1,83 @@
1
+ import { _ as rotateKeyring, a as EncryptionUrlInvalid, d as generateKeyring, f as keyringCipher, g as retireKey, h as parseKeyring, i as EncryptionKeyRetired, n as CiphertextNotAuthentic, r as CurrentKeyCannotRetire, s as UnknownEncryptionScheme, t as CiphertextMalformed, u as formatKeyring } from "./cipher-C1lEFX63.mjs";
2
+ import { KMS_SCHEME, canonicalId, provideKey, serviceKey } from "@geekmidas/manifest";
3
+ //#region src/encryption.ts
4
+ /**
5
+ * `Encryption` — a key that encrypts what the application stores.
6
+ *
7
+ * ```ts
8
+ * export const pii = new Encryption('Pii');
9
+ *
10
+ * // an endpoint that `.dependsOn([pii])`
11
+ * const email = await services.pii.encrypt(body.email);
12
+ * const emailIndex = await services.pii.index(body.email);
13
+ * await db.insertInto('users').values({ email, emailIndex }).execute();
14
+ *
15
+ * // and to find them again, without decrypting a column
16
+ * db.selectFrom('users').where('emailIndex', '=', await services.pii.index(q));
17
+ * ```
18
+ *
19
+ * The app names no cipher and holds no key. The construct provides one URL,
20
+ * `<ID>_URL`, and its scheme picks the backend the way a queue's connection
21
+ * string picks its broker:
22
+ *
23
+ * - **AWS** — `kms://`: envelope encryption under a KMS key that rotates
24
+ * yearly, and a KMS HMAC key for the index. Only a function that depends on
25
+ * the construct is granted either key.
26
+ * - **Server, local, tests** — `aes256gcm://`: a keyring the process holds.
27
+ * Derived locally, so `gkm dev` and `gkm test` need nothing set; generated
28
+ * into a server stage's secrets on its first deploy, and rotated there with
29
+ * `gkm encryption:rotate`.
30
+ *
31
+ * Every ciphertext names the key that wrote it, so a rotated key still opens
32
+ * what it wrote. Retiring one is explicit — `reencrypt` the column, then
33
+ * `gkm encryption:retire` — and a value still under an old key says so when it
34
+ * is decrypted, once per key per process.
35
+ */
36
+ var Encryption = class {
37
+ id;
38
+ service;
39
+ /**
40
+ * Declared once and read by both `declare()` and `connect()`, so the key the
41
+ * target publishes and the key the client reads cannot drift.
42
+ */
43
+ key;
44
+ /**
45
+ * One cipher per process, held as the promise: a keyring is parsed once and
46
+ * a KMS client is built once, however many handlers register it at once.
47
+ */
48
+ cipher;
49
+ constructor(id) {
50
+ const canonical = canonicalId(id);
51
+ this.id = canonical;
52
+ this.key = provideKey(canonical, "url");
53
+ this.service = {
54
+ serviceName: serviceKey(canonical),
55
+ register: (options) => this.connect(options)
56
+ };
57
+ }
58
+ declare() {
59
+ return [{
60
+ kind: "encryption",
61
+ id: this.id,
62
+ provides: [this.key]
63
+ }];
64
+ }
65
+ connect(options) {
66
+ this.cipher ??= this.open(options);
67
+ return this.cipher;
68
+ }
69
+ async open(options) {
70
+ const { url } = options.envParser.create((get) => ({ url: get(this.key).string() })).parse();
71
+ const scheme = url.slice(0, url.indexOf(":") + 1);
72
+ if (scheme === "aes256gcm:") return keyringCipher(this.id, url, (stale, current) => console.warn(`${this.id} decrypted a value still under '${stale}' (current: '${current}'). reencrypt it, and retire '${stale}' once nothing is left under it.`));
73
+ if (scheme === KMS_SCHEME) {
74
+ const { kmsCipher } = await import("./kms-BdUlMJEZ.mjs");
75
+ return kmsCipher(this.id, url);
76
+ }
77
+ throw new UnknownEncryptionScheme(this.id, scheme);
78
+ }
79
+ };
80
+ //#endregion
81
+ export { CiphertextMalformed, CiphertextNotAuthentic, CurrentKeyCannotRetire, Encryption, EncryptionKeyRetired, EncryptionUrlInvalid, UnknownEncryptionScheme, formatKeyring, generateKeyring, keyringCipher, parseKeyring, retireKey, rotateKeyring };
82
+
83
+ //# sourceMappingURL=encryption.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encryption.mjs","names":[],"sources":["../src/encryption.ts"],"sourcesContent":["/**\n * `Encryption` — a key that encrypts what the application stores.\n *\n * ```ts\n * export const pii = new Encryption('Pii');\n *\n * // an endpoint that `.dependsOn([pii])`\n * const email = await services.pii.encrypt(body.email);\n * const emailIndex = await services.pii.index(body.email);\n * await db.insertInto('users').values({ email, emailIndex }).execute();\n *\n * // and to find them again, without decrypting a column\n * db.selectFrom('users').where('emailIndex', '=', await services.pii.index(q));\n * ```\n *\n * The app names no cipher and holds no key. The construct provides one URL,\n * `<ID>_URL`, and its scheme picks the backend the way a queue's connection\n * string picks its broker:\n *\n * - **AWS** — `kms://`: envelope encryption under a KMS key that rotates\n * yearly, and a KMS HMAC key for the index. Only a function that depends on\n * the construct is granted either key.\n * - **Server, local, tests** — `aes256gcm://`: a keyring the process holds.\n * Derived locally, so `gkm dev` and `gkm test` need nothing set; generated\n * into a server stage's secrets on its first deploy, and rotated there with\n * `gkm encryption:rotate`.\n *\n * Every ciphertext names the key that wrote it, so a rotated key still opens\n * what it wrote. Retiring one is explicit — `reencrypt` the column, then\n * `gkm encryption:retire` — and a value still under an old key says so when it\n * is decrypted, once per key per process.\n */\n\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\tKMS_SCHEME,\n\tprovideKey,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport type { Service, ServiceRegisterOptions } from '@geekmidas/services';\nimport type { Construct } from './construct-interface';\nimport {\n\ttype Cipher,\n\tkeyringCipher,\n\tLOCAL_SCHEME,\n\tUnknownEncryptionScheme,\n} from './encryption/cipher';\n\nexport type { Cipher } from './encryption/cipher';\nexport {\n\tCiphertextMalformed,\n\tCiphertextNotAuthentic,\n\tCurrentKeyCannotRetire,\n\tEncryptionKeyRetired,\n\tEncryptionUrlInvalid,\n\tformatKeyring,\n\tgenerateKeyring,\n\ttype Keyring,\n\tkeyringCipher,\n\tparseKeyring,\n\tretireKey,\n\trotateKeyring,\n\tUnknownEncryptionScheme,\n} from './encryption/cipher';\n\nexport class Encryption<TName extends string = string>\n\timplements Construct<TName, Cipher>\n{\n\treadonly id: TName;\n\treadonly service: Service<Uncapitalize<TName>, Cipher>;\n\n\t/**\n\t * Declared once and read by both `declare()` and `connect()`, so the key the\n\t * target publishes and the key the client reads cannot drift.\n\t */\n\tprivate readonly key: string;\n\n\t/**\n\t * One cipher per process, held as the promise: a keyring is parsed once and\n\t * a KMS client is built once, however many handlers register it at once.\n\t */\n\tprivate cipher?: Promise<Cipher>;\n\n\tconstructor(id: ConstructName<TName>) {\n\t\tconst canonical = canonicalId(id as string);\n\n\t\tthis.id = canonical as TName;\n\t\tthis.key = provideKey(canonical, 'url');\n\n\t\t// A field, not a getter: consumers cache services by object identity.\n\t\tthis.service = {\n\t\t\tserviceName: serviceKey(canonical) as Uncapitalize<TName>,\n\t\t\tregister: (options) => this.connect(options),\n\t\t};\n\t}\n\n\tdeclare(): Declaration[] {\n\t\treturn [{ kind: 'encryption', id: this.id, provides: [this.key] }];\n\t}\n\n\tprivate connect(options: ServiceRegisterOptions): Promise<Cipher> {\n\t\tthis.cipher ??= this.open(options);\n\t\treturn this.cipher;\n\t}\n\n\tprivate async open(options: ServiceRegisterOptions): Promise<Cipher> {\n\t\tconst { url } = options.envParser\n\t\t\t.create((get) => ({ url: get(this.key).string() }))\n\t\t\t.parse();\n\t\tconst scheme = url.slice(0, url.indexOf(':') + 1);\n\n\t\tif (scheme === LOCAL_SCHEME) {\n\t\t\treturn keyringCipher(this.id, url, (stale, current) =>\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`${this.id} decrypted a value still under '${stale}' (current: '${current}'). reencrypt it, and retire '${stale}' once nothing is left under it.`,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\n\t\tif (scheme === KMS_SCHEME) {\n\t\t\t// Loaded only here, so a project that never deploys to AWS never\n\t\t\t// needs `@aws-sdk/client-kms` installed.\n\t\t\tconst { kmsCipher } = await import('./encryption/kms');\n\t\t\treturn kmsCipher(this.id, url);\n\t\t}\n\n\t\tthrow new UnknownEncryptionScheme(this.id, scheme);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmEA,IAAa,aAAb,MAEA;CACC;CACA;;;;;CAMA;;;;;CAMA;CAEA,YAAY,IAA0B;EACrC,MAAM,YAAY,YAAY,EAAY;EAE1C,KAAK,KAAK;EACV,KAAK,MAAM,WAAW,WAAW,KAAK;EAGtC,KAAK,UAAU;GACd,aAAa,WAAW,SAAS;GACjC,WAAW,YAAY,KAAK,QAAQ,OAAO;EAC5C;CACD;CAEA,UAAyB;EACxB,OAAO,CAAC;GAAE,MAAM;GAAc,IAAI,KAAK;GAAI,UAAU,CAAC,KAAK,GAAG;EAAE,CAAC;CAClE;CAEA,QAAgB,SAAkD;EACjE,KAAK,WAAW,KAAK,KAAK,OAAO;EACjC,OAAO,KAAK;CACb;CAEA,MAAc,KAAK,SAAkD;EACpE,MAAM,EAAE,QAAQ,QAAQ,UACtB,QAAQ,SAAS,EAAE,KAAK,IAAI,KAAK,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAClD,MAAM;EACR,MAAM,SAAS,IAAI,MAAM,GAAG,IAAI,QAAQ,GAAG,IAAI,CAAC;EAEhD,IAAI,WAAA,cACH,OAAO,cAAc,KAAK,IAAI,MAAM,OAAO,YAC1C,QAAQ,KACP,GAAG,KAAK,GAAG,kCAAkC,MAAM,eAAe,QAAQ,gCAAgC,MAAM,iCACjH,CACD;EAGD,IAAI,WAAW,YAAY;GAG1B,MAAM,EAAE,cAAc,MAAM,OAAO;GACnC,OAAO,UAAU,KAAK,IAAI,GAAG;EAC9B;EAEA,MAAM,IAAI,wBAAwB,KAAK,IAAI,MAAM;CAClD;AACD"}
@@ -1,17 +1,14 @@
1
- require('../construct-interface-BfjcOD_E.cjs');
2
- require('../Construct-roId57cU.cjs');
3
- require('../functions-DukjG8ov.cjs');
4
- const require_EndpointFactory = require('../EndpointFactory-DYoGLaIT.cjs');
5
- require('../clone-Dy0cR2SZ.cjs');
6
- const require_Endpoint = require('../Endpoint-BBkV6l0k.cjs');
7
- const require_surfaceEnv = require('../surfaceEnv-BFXEms2f.cjs');
8
- const require_publisher = require('../publisher-CqGsXB2X.cjs');
9
- const require_lazyAccessors = require('../lazyAccessors-DrJj8NpA.cjs');
10
-
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_EndpointFactory = require("../EndpointFactory-DJ7gXLpR.cjs");
3
+ const require_functions = require("../functions-CfzJG9hK.cjs");
4
+ const require_Endpoint = require("../Endpoint-BoUg8ocM.cjs");
5
+ const require_surfaceEnv = require("../surfaceEnv-CNimK76p.cjs");
6
+ const require_lazyAccessors = require("../lazyAccessors-hJKGv8Ay.cjs");
11
7
  exports.BUILT_IN_SECURITY_SCHEMES = require_EndpointFactory.BUILT_IN_SECURITY_SCHEMES;
12
8
  exports.Endpoint = require_Endpoint.Endpoint;
13
9
  exports.EndpointBuilder = require_EndpointFactory.EndpointBuilder;
14
10
  exports.EndpointFactory = require_EndpointFactory.EndpointFactory;
11
+ exports.NoAuthenticator = require_Endpoint.NoAuthenticator;
15
12
  exports.RLS_BYPASS = require_EndpointFactory.RLS_BYPASS;
16
13
  exports.ResponseBuilder = require_Endpoint.ResponseBuilder;
17
14
  exports.createApiGatewayCookies = require_lazyAccessors.createApiGatewayCookies;
@@ -25,4 +22,4 @@ exports.defaultEnvParser = require_surfaceEnv.defaultEnvParser;
25
22
  exports.envParserFor = require_surfaceEnv.envParserFor;
26
23
  exports.getSecurityScheme = require_EndpointFactory.getSecurityScheme;
27
24
  exports.isBuiltInSecurityScheme = require_EndpointFactory.isBuiltInSecurityScheme;
28
- exports.publishConstructEvents = require_publisher.publishConstructEvents;
25
+ exports.publishConstructEvents = require_functions.publishConstructEvents;
@@ -1,7 +1,51 @@
1
- import "../Construct-WhCXIOPV.cjs";
2
- import "../index-BTvozlUD.cjs";
3
- import "../construct-interface-D2nNkHUN.cjs";
4
- import "../types-BlAkSuGI.cjs";
5
- import { ActorExtractor, Authorizer, BUILT_IN_SECURITY_SCHEMES, BuiltInSecuritySchemeId, Endpoint, EndpointContext, EndpointHandler, EndpointOutput, EndpointSchemas, MappedAudit, OAuthFlow, OAuthFlows, RLS_BYPASS, ResponseBuilder, RlsBypass, RlsConfig, RlsContext, RlsContextExtractor, SecurityScheme, createAuthorizer, getSecurityScheme, isBuiltInSecurityScheme } from "../Endpoint-BQ9O0P1w.cjs";
6
- import { EndpointBuilder, EndpointFactory, createApiGatewayCookies, createApiGatewayHeaders, createHonoCookies, createHonoHeaders, createNoopCookies, createNoopHeaders, defaultEnvParser, envParserFor, publishConstructEvents } from "../index-D5zqAJ2e.cjs";
7
- export { ActorExtractor, Authorizer, BUILT_IN_SECURITY_SCHEMES, BuiltInSecuritySchemeId, Endpoint, EndpointBuilder, EndpointContext, EndpointFactory, EndpointHandler, EndpointOutput, EndpointSchemas, MappedAudit, OAuthFlow, OAuthFlows, RLS_BYPASS, ResponseBuilder, RlsBypass, RlsConfig, RlsContext, RlsContextExtractor, SecurityScheme, createApiGatewayCookies, createApiGatewayHeaders, createAuthorizer, createHonoCookies, createHonoHeaders, createNoopCookies, createNoopHeaders, defaultEnvParser, envParserFor, getSecurityScheme, isBuiltInSecurityScheme, publishConstructEvents };
1
+ import { s as publishConstructEvents } from "../Construct-BQALFCh2.cjs";
2
+ import { A as getSecurityScheme, C as Authorizer, D as OAuthFlows, E as OAuthFlow, O as SecurityScheme, S as MappedAudit, T as BuiltInSecuritySchemeId, _ as RlsBypass, a as EndpointContext, b as RlsContextExtractor, c as EndpointSchemas, d as ResponseBuilder, g as RLS_BYPASS, h as SessionAuth, i as Endpoint, j as isBuiltInSecurityScheme, k as createAuthorizer, l as EndpointSurface, m as NoAuthenticator, n as ConvertRouteParams, o as EndpointHandler, r as CookieFn, s as EndpointOutput, u as HeaderFn, v as RlsConfig, w as BUILT_IN_SECURITY_SCHEMES, x as ActorExtractor, y as RlsContext } from "../Endpoint-aCvBMPoH.cjs";
3
+ import { n as EndpointBuilder, t as EndpointFactory } from "../EndpointFactory-I7s1co3Y.cjs";
4
+ import { EnvironmentParser } from "@geekmidas/envkit";
5
+ import { Context } from "hono";
6
+ //#region src/endpoints/lazyAccessors.d.ts
7
+ /**
8
+ * Create a lazy header accessor for Hono.
9
+ * Uses `c.req.header(name)` for single lookups (native, case-insensitive).
10
+ * Only calls `c.req.header()` to get all headers when needed.
11
+ */
12
+ export declare function createHonoHeaders(c: Context): HeaderFn;
13
+ /**
14
+ * Create a lazy cookie accessor for Hono.
15
+ * Uses `getCookie(c, name)` for single lookups (native).
16
+ * Only parses the cookie header when all cookies are requested.
17
+ */
18
+ export declare function createHonoCookies(c: Context): CookieFn;
19
+ /**
20
+ * Create a lazy header accessor for API Gateway events.
21
+ * Handles case-insensitive lookups.
22
+ */
23
+ export declare function createApiGatewayHeaders(headers: Record<string, string | undefined> | null | undefined): HeaderFn;
24
+ /**
25
+ * Create a lazy cookie accessor for API Gateway events.
26
+ * Decodes URL-encoded values to match browser behavior.
27
+ */
28
+ export declare function createApiGatewayCookies(cookies: string[] | undefined, cookieHeader: string | undefined): CookieFn;
29
+ /**
30
+ * Create a no-op header accessor (for minimal endpoints that don't use headers).
31
+ */
32
+ export declare function createNoopHeaders(): HeaderFn;
33
+ /**
34
+ * Create a no-op cookie accessor (for minimal endpoints that don't use cookies).
35
+ */
36
+ export declare function createNoopCookies(): CookieFn;
37
+ //#endregion
38
+ //#region src/endpoints/surfaceEnv.d.ts
39
+ /**
40
+ * The default parser, built once.
41
+ *
42
+ * Once because `Credentials` resolves through `globalThis` and decryption is
43
+ * not free, and because two parsers over the same environment are two caches of
44
+ * the same answer.
45
+ */
46
+ export declare function defaultEnvParser(): EnvironmentParser<{}>;
47
+ /** The parser for an endpoint, from its surface or the default. */
48
+ export declare function envParserFor(surface: EndpointSurface | undefined): EnvironmentParser<{}>;
49
+ //#endregion
50
+ export { type ActorExtractor, type Authorizer, BUILT_IN_SECURITY_SCHEMES, type BuiltInSecuritySchemeId, type ConvertRouteParams, Endpoint, EndpointBuilder, type EndpointContext, EndpointFactory, type EndpointHandler, type EndpointOutput, type EndpointSchemas, type MappedAudit, NoAuthenticator, type OAuthFlow, type OAuthFlows, RLS_BYPASS, ResponseBuilder, type RlsBypass, type RlsConfig, type RlsContext, type RlsContextExtractor, type SecurityScheme, type SessionAuth, createAuthorizer, getSecurityScheme, isBuiltInSecurityScheme, publishConstructEvents };
51
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/endpoints/lazyAccessors.ts","../../src/endpoints/surfaceEnv.ts"],"mappings":";;;;;;;;;;;wBAgBgB,kBAAkB,GAAG,UAAU;;;;;;wBAqB/B,kBAAkB,GAAG,UAAU;;;;;wBAgC/B,wBACf,SAAS,wDACP;;;;;wBAoCa,wBACf,+BACA,mCACE;;;;wBAmHa,qBAAqB;;;;wBAUrB,qBAAqB;;;;;;;;;;wBC1MrB,oBAAoB;;wBASpB,aACf,SAAS,8BACP"}
@@ -1,7 +1,51 @@
1
- import "../Construct-B-xc0SE9.mjs";
2
- import "../index-L7pz0R0T.mjs";
3
- import "../construct-interface-BqwRNYA2.mjs";
4
- import "../types-aKksMEWL.mjs";
5
- import { ActorExtractor, Authorizer, BUILT_IN_SECURITY_SCHEMES, BuiltInSecuritySchemeId, Endpoint, EndpointContext, EndpointHandler, EndpointOutput, EndpointSchemas, MappedAudit, OAuthFlow, OAuthFlows, RLS_BYPASS, ResponseBuilder, RlsBypass, RlsConfig, RlsContext, RlsContextExtractor, SecurityScheme, createAuthorizer, getSecurityScheme, isBuiltInSecurityScheme } from "../Endpoint-BKR5QH6O.mjs";
6
- import { EndpointBuilder, EndpointFactory, createApiGatewayCookies, createApiGatewayHeaders, createHonoCookies, createHonoHeaders, createNoopCookies, createNoopHeaders, defaultEnvParser, envParserFor, publishConstructEvents } from "../index-Cvz551AO.mjs";
7
- export { ActorExtractor, Authorizer, BUILT_IN_SECURITY_SCHEMES, BuiltInSecuritySchemeId, Endpoint, EndpointBuilder, EndpointContext, EndpointFactory, EndpointHandler, EndpointOutput, EndpointSchemas, MappedAudit, OAuthFlow, OAuthFlows, RLS_BYPASS, ResponseBuilder, RlsBypass, RlsConfig, RlsContext, RlsContextExtractor, SecurityScheme, createApiGatewayCookies, createApiGatewayHeaders, createAuthorizer, createHonoCookies, createHonoHeaders, createNoopCookies, createNoopHeaders, defaultEnvParser, envParserFor, getSecurityScheme, isBuiltInSecurityScheme, publishConstructEvents };
1
+ import { s as publishConstructEvents } from "../Construct-QXnl3VqT.mjs";
2
+ import { A as getSecurityScheme, C as Authorizer, D as OAuthFlows, E as OAuthFlow, O as SecurityScheme, S as MappedAudit, T as BuiltInSecuritySchemeId, _ as RlsBypass, a as EndpointContext, b as RlsContextExtractor, c as EndpointSchemas, d as ResponseBuilder, g as RLS_BYPASS, h as SessionAuth, i as Endpoint, j as isBuiltInSecurityScheme, k as createAuthorizer, l as EndpointSurface, m as NoAuthenticator, n as ConvertRouteParams, o as EndpointHandler, r as CookieFn, s as EndpointOutput, u as HeaderFn, v as RlsConfig, w as BUILT_IN_SECURITY_SCHEMES, x as ActorExtractor, y as RlsContext } from "../Endpoint-Du-NwPX2.mjs";
3
+ import { n as EndpointBuilder, t as EndpointFactory } from "../EndpointFactory-DMYdJCOj.mjs";
4
+ import { EnvironmentParser } from "@geekmidas/envkit";
5
+ import { Context } from "hono";
6
+ //#region src/endpoints/lazyAccessors.d.ts
7
+ /**
8
+ * Create a lazy header accessor for Hono.
9
+ * Uses `c.req.header(name)` for single lookups (native, case-insensitive).
10
+ * Only calls `c.req.header()` to get all headers when needed.
11
+ */
12
+ export declare function createHonoHeaders(c: Context): HeaderFn;
13
+ /**
14
+ * Create a lazy cookie accessor for Hono.
15
+ * Uses `getCookie(c, name)` for single lookups (native).
16
+ * Only parses the cookie header when all cookies are requested.
17
+ */
18
+ export declare function createHonoCookies(c: Context): CookieFn;
19
+ /**
20
+ * Create a lazy header accessor for API Gateway events.
21
+ * Handles case-insensitive lookups.
22
+ */
23
+ export declare function createApiGatewayHeaders(headers: Record<string, string | undefined> | null | undefined): HeaderFn;
24
+ /**
25
+ * Create a lazy cookie accessor for API Gateway events.
26
+ * Decodes URL-encoded values to match browser behavior.
27
+ */
28
+ export declare function createApiGatewayCookies(cookies: string[] | undefined, cookieHeader: string | undefined): CookieFn;
29
+ /**
30
+ * Create a no-op header accessor (for minimal endpoints that don't use headers).
31
+ */
32
+ export declare function createNoopHeaders(): HeaderFn;
33
+ /**
34
+ * Create a no-op cookie accessor (for minimal endpoints that don't use cookies).
35
+ */
36
+ export declare function createNoopCookies(): CookieFn;
37
+ //#endregion
38
+ //#region src/endpoints/surfaceEnv.d.ts
39
+ /**
40
+ * The default parser, built once.
41
+ *
42
+ * Once because `Credentials` resolves through `globalThis` and decryption is
43
+ * not free, and because two parsers over the same environment are two caches of
44
+ * the same answer.
45
+ */
46
+ export declare function defaultEnvParser(): EnvironmentParser<{}>;
47
+ /** The parser for an endpoint, from its surface or the default. */
48
+ export declare function envParserFor(surface: EndpointSurface | undefined): EnvironmentParser<{}>;
49
+ //#endregion
50
+ export { type ActorExtractor, type Authorizer, BUILT_IN_SECURITY_SCHEMES, type BuiltInSecuritySchemeId, type ConvertRouteParams, Endpoint, EndpointBuilder, type EndpointContext, EndpointFactory, type EndpointHandler, type EndpointOutput, type EndpointSchemas, type MappedAudit, NoAuthenticator, type OAuthFlow, type OAuthFlows, RLS_BYPASS, ResponseBuilder, type RlsBypass, type RlsConfig, type RlsContext, type RlsContextExtractor, type SecurityScheme, type SessionAuth, createAuthorizer, getSecurityScheme, isBuiltInSecurityScheme, publishConstructEvents };
51
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/endpoints/lazyAccessors.ts","../../src/endpoints/surfaceEnv.ts"],"mappings":";;;;;;;;;;;wBAgBgB,kBAAkB,GAAG,UAAU;;;;;;wBAqB/B,kBAAkB,GAAG,UAAU;;;;;wBAgC/B,wBACf,SAAS,wDACP;;;;;wBAoCa,wBACf,+BACA,mCACE;;;;wBAmHa,qBAAqB;;;;wBAUrB,qBAAqB;;;;;;;;;;wBC1MrB,oBAAoB;;wBASpB,aACf,SAAS,8BACP"}
@@ -1,11 +1,6 @@
1
- import "../Construct-CdhThxDI.mjs";
2
- import "../construct-interface-Z4CpS8tK.mjs";
3
- import "../functions-Cpff1uZH.mjs";
4
- import { BUILT_IN_SECURITY_SCHEMES, EndpointBuilder, EndpointFactory, RLS_BYPASS, createAuthorizer, getSecurityScheme, isBuiltInSecurityScheme } from "../EndpointFactory-BejSTzbB.mjs";
5
- import "../clone-DblgEZZa.mjs";
6
- import { Endpoint, ResponseBuilder } from "../Endpoint-BTj58Gob.mjs";
7
- import { defaultEnvParser, envParserFor } from "../surfaceEnv-C3Ktahea.mjs";
8
- import { publishConstructEvents } from "../publisher-CGEo8UKD.mjs";
9
- import { createApiGatewayCookies, createApiGatewayHeaders, createHonoCookies, createHonoHeaders, createNoopCookies, createNoopHeaders } from "../lazyAccessors-DM6HcXQk.mjs";
10
-
11
- export { BUILT_IN_SECURITY_SCHEMES, Endpoint, EndpointBuilder, EndpointFactory, RLS_BYPASS, ResponseBuilder, createApiGatewayCookies, createApiGatewayHeaders, createAuthorizer, createHonoCookies, createHonoHeaders, createNoopCookies, createNoopHeaders, defaultEnvParser, envParserFor, getSecurityScheme, isBuiltInSecurityScheme, publishConstructEvents };
1
+ import { a as createAuthorizer, i as BUILT_IN_SECURITY_SCHEMES, n as EndpointBuilder, o as getSecurityScheme, r as RLS_BYPASS, s as isBuiltInSecurityScheme, t as EndpointFactory } from "../EndpointFactory-BDtsrEvJ.mjs";
2
+ import { i as publishConstructEvents } from "../functions-BFizikJU.mjs";
3
+ import { n as ResponseBuilder, r as NoAuthenticator, t as Endpoint } from "../Endpoint-BG4UJ9oA.mjs";
4
+ import { n as envParserFor, t as defaultEnvParser } from "../surfaceEnv-wMT5QzgZ.mjs";
5
+ import { a as createHonoHeaders, i as createHonoCookies, n as createApiGatewayHeaders, o as createNoopCookies, s as createNoopHeaders, t as createApiGatewayCookies } from "../lazyAccessors-CFanua0O.mjs";
6
+ export { BUILT_IN_SECURITY_SCHEMES, Endpoint, EndpointBuilder, EndpointFactory, NoAuthenticator, RLS_BYPASS, ResponseBuilder, createApiGatewayCookies, createApiGatewayHeaders, createAuthorizer, createHonoCookies, createHonoHeaders, createNoopCookies, createNoopHeaders, defaultEnvParser, envParserFor, getSecurityScheme, isBuiltInSecurityScheme, publishConstructEvents };
@@ -0,0 +1,105 @@
1
+ import { t as StandardSchemaV1 } from "./index-CeEtxDmK.mjs";
2
+ import { r as Consumable } from "./construct-interface-DluK3_da.mjs";
3
+ import { n as DeployedStage, r as LocalStage } from "./stages-BSCF19o2.mjs";
4
+ import { ConstructName, Declaration } from "@geekmidas/manifest";
5
+ import { Service } from "@geekmidas/services";
6
+ //#region src/external-api.d.ts
7
+ /** What a credentials schema yields. */
8
+ type Value<TSchema extends StandardSchemaV1> = StandardSchemaV1.InferOutput<TSchema>;
9
+ /**
10
+ * Where an external API answers: one URL for every stage, or one per stage
11
+ * name with `default` for any stage not listed.
12
+ *
13
+ * Keyed by the stages `gkm.config.ts` declares once `.gkm/stages.d.ts` exists,
14
+ * so a key that names no stage — `prodution` — is a type error rather than a
15
+ * URL nothing reads. Without the file any key goes, as before.
16
+ */
17
+ type ExternalApiUrl = string | (string extends LocalStage | DeployedStage ? Readonly<Record<string, string>> : { readonly [S in LocalStage | DeployedStage]?: string; } & {
18
+ readonly default?: string;
19
+ });
20
+ interface ExternalApiOptions<TSchema extends StandardSchemaV1, TClient> {
21
+ /**
22
+ * Where it answers deployed: one URL for every stage, or one per stage
23
+ * name, with `default` for any stage not listed.
24
+ */
25
+ url: ExternalApiUrl;
26
+ /** What the stage's `<ID>_CREDENTIALS` must look like. */
27
+ credentials: TSchema;
28
+ /** What a handler is handed, built from where it answers and the credentials. */
29
+ client: (connection: {
30
+ url: string;
31
+ credentials: Value<TSchema>;
32
+ }) => TClient | Promise<TClient>;
33
+ }
34
+ declare class ExternalApi<TName extends string = string, TSchema extends StandardSchemaV1 = StandardSchemaV1, TClient = unknown> implements Consumable<TName, TClient> {
35
+ private readonly options;
36
+ readonly id: TName;
37
+ readonly service: Service<Uncapitalize<TName>, TClient>;
38
+ /** Read by both `declare()` and `connect()`, so the two cannot drift. */
39
+ private readonly keys;
40
+ /** The promise, so concurrent registrations share one client. */
41
+ private connected?;
42
+ constructor(id: ConstructName<TName>, options: ExternalApiOptions<TSchema, TClient>);
43
+ /**
44
+ * What the stage's `<ID>_CREDENTIALS` must look like — the schema the value
45
+ * is validated against where it is read. Public so a tool setting the value
46
+ * (`gkm secrets:add`) can check it, and describe its fields, before it is
47
+ * stored rather than at the first request.
48
+ */
49
+ get credentialsSchema(): TSchema;
50
+ declare(): Declaration[];
51
+ private connect;
52
+ }
53
+ /** Anything that answers a request — a Hono app, or a bare `{ fetch }`. */
54
+ interface FetchHandler {
55
+ fetch(request: Request): Response | Promise<Response>;
56
+ }
57
+ /**
58
+ * Marks a fake. A registered symbol, so a fake built by a second copy of this
59
+ * package — a linked workspace, two versions in a lockfile — is still one.
60
+ */
61
+ declare const FAKE: unique symbol;
62
+ /** What an external API's credentials look like going in, for a fake to supply. */
63
+ type CredentialsOf<TApi> = TApi extends ExternalApi<string, infer TSchema, unknown> ? StandardSchemaV1.InferInput<TSchema> : unknown;
64
+ /**
65
+ * An external API's stand-in, as `test/fakes/<id>.ts` default-exports it.
66
+ *
67
+ * `credentials` are what the fake accepts, and what a local or test stage is
68
+ * handed as `<ID>_CREDENTIALS` in place of the stage's own.
69
+ */
70
+ type Fake = {
71
+ readonly [FAKE]: true;
72
+ readonly credentials: unknown;
73
+ } & ({
74
+ readonly kind: 'app';
75
+ /** Served by gkm: in-process in a test, on its own port in `gkm dev`. */
76
+ readonly handler: FetchHandler;
77
+ } | {
78
+ readonly kind: 'image';
79
+ /** The provider's own local server, run as a container. */
80
+ readonly image: string;
81
+ /** The port it listens on inside the container. */
82
+ readonly port: number;
83
+ });
84
+ /**
85
+ * Build the fake `test/fakes/<id>.ts` default-exports.
86
+ *
87
+ * Pass the API's type to have the credentials checked against its schema —
88
+ * `fake.app<typeof polar>(…)`.
89
+ */
90
+ declare const fake: {
91
+ /** A working implementation of the API, kept beside the tests that use it. */
92
+ app<TApi = unknown>(handler: FetchHandler, options: {
93
+ credentials: CredentialsOf<TApi>;
94
+ }): Fake;
95
+ /** A local server the provider publishes — `stripe/stripe-mock`. */
96
+ image<TApi = unknown>(image: string, options: {
97
+ port: number;
98
+ credentials: CredentialsOf<TApi>;
99
+ }): Fake;
100
+ };
101
+ /** Whether a value is a fake — what gkm asks of a `test/fakes` default export. */
102
+ declare function isFake(value: unknown): value is Fake;
103
+ //#endregion
104
+ export { FetchHandler as a, Fake as i, ExternalApiOptions as n, fake as o, ExternalApiUrl as r, isFake as s, ExternalApi as t };
105
+ //# sourceMappingURL=external-api-MJ8id87V.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"external-api-MJ8id87V.d.mts","names":[],"sources":["../src/external-api.ts"],"mappings":";;;;;;;KAqDK,MAAM,gBAAgB,oBAC1B,iBAAiB,YAAY;;;;;;;;;KAUlB,0CAEO,aAAa,gBAC3B,SAAS,sCACG,KAAK,aAAa;WACrB;;UAGG,mBAAmB,gBAAgB,kBAAkB;;;;;EAKrE,KAAK;;EAEL,aAAa;;EAEb,SAAS;IACR;IACA,aAAa,MAAM;QACd,UAAU,QAAQ;;cAGZ,YACZ,+BACA,gBAAgB,mBAAmB,kBACnC,8BACY,WAAW,OAAO;mBAeZ;WAXT,IAAI;WACJ,SAAS,QAAQ,aAAa,QAAQ;;mBAG9B;;UAGT;EAER,YACC,IAAI,cAAc,QACD,SAAS,mBAAmB,SAAS;;;;;;;MA0BnD,qBAAqB;EAIzB,WAAW;UAaG;;;UA6BE;EAChB,MAAM,SAAS,UAAU,WAAW,QAAQ;;;;;;cAOvC;;KAGD,cAAc,QAClB,aAAa,0BAA0B,oBACpC,iBAAiB,WAAW;;;;;;;KASpB;YACD;WACD;;WAGE;;WAEA,SAAS;;WAGT;;WAEA;;WAEA;;;;;;;;cAUC;;EAEZ,IAAI,gBAAc,SACR,cAAY;IACV,aAAa,cAAc;MACpC;;EAUH,MAAM,gBAAc,eACN;IACF;IAAc,aAAa,cAAc;MAClD;;;iBAYY,OAAO,iBAAiB,SAAS"}
@@ -0,0 +1,105 @@
1
+ import { t as StandardSchemaV1 } from "./index-CeEtxDmK.cjs";
2
+ import { r as Consumable } from "./construct-interface-B1AfqRl4.cjs";
3
+ import { n as DeployedStage, r as LocalStage } from "./stages-BSCF19o2.cjs";
4
+ import { Service } from "@geekmidas/services";
5
+ import { ConstructName, Declaration } from "@geekmidas/manifest";
6
+ //#region src/external-api.d.ts
7
+ /** What a credentials schema yields. */
8
+ type Value<TSchema extends StandardSchemaV1> = StandardSchemaV1.InferOutput<TSchema>;
9
+ /**
10
+ * Where an external API answers: one URL for every stage, or one per stage
11
+ * name with `default` for any stage not listed.
12
+ *
13
+ * Keyed by the stages `gkm.config.ts` declares once `.gkm/stages.d.ts` exists,
14
+ * so a key that names no stage — `prodution` — is a type error rather than a
15
+ * URL nothing reads. Without the file any key goes, as before.
16
+ */
17
+ type ExternalApiUrl = string | (string extends LocalStage | DeployedStage ? Readonly<Record<string, string>> : { readonly [S in LocalStage | DeployedStage]?: string; } & {
18
+ readonly default?: string;
19
+ });
20
+ interface ExternalApiOptions<TSchema extends StandardSchemaV1, TClient> {
21
+ /**
22
+ * Where it answers deployed: one URL for every stage, or one per stage
23
+ * name, with `default` for any stage not listed.
24
+ */
25
+ url: ExternalApiUrl;
26
+ /** What the stage's `<ID>_CREDENTIALS` must look like. */
27
+ credentials: TSchema;
28
+ /** What a handler is handed, built from where it answers and the credentials. */
29
+ client: (connection: {
30
+ url: string;
31
+ credentials: Value<TSchema>;
32
+ }) => TClient | Promise<TClient>;
33
+ }
34
+ declare class ExternalApi<TName extends string = string, TSchema extends StandardSchemaV1 = StandardSchemaV1, TClient = unknown> implements Consumable<TName, TClient> {
35
+ private readonly options;
36
+ readonly id: TName;
37
+ readonly service: Service<Uncapitalize<TName>, TClient>;
38
+ /** Read by both `declare()` and `connect()`, so the two cannot drift. */
39
+ private readonly keys;
40
+ /** The promise, so concurrent registrations share one client. */
41
+ private connected?;
42
+ constructor(id: ConstructName<TName>, options: ExternalApiOptions<TSchema, TClient>);
43
+ /**
44
+ * What the stage's `<ID>_CREDENTIALS` must look like — the schema the value
45
+ * is validated against where it is read. Public so a tool setting the value
46
+ * (`gkm secrets:add`) can check it, and describe its fields, before it is
47
+ * stored rather than at the first request.
48
+ */
49
+ get credentialsSchema(): TSchema;
50
+ declare(): Declaration[];
51
+ private connect;
52
+ }
53
+ /** Anything that answers a request — a Hono app, or a bare `{ fetch }`. */
54
+ interface FetchHandler {
55
+ fetch(request: Request): Response | Promise<Response>;
56
+ }
57
+ /**
58
+ * Marks a fake. A registered symbol, so a fake built by a second copy of this
59
+ * package — a linked workspace, two versions in a lockfile — is still one.
60
+ */
61
+ declare const FAKE: unique symbol;
62
+ /** What an external API's credentials look like going in, for a fake to supply. */
63
+ type CredentialsOf<TApi> = TApi extends ExternalApi<string, infer TSchema, unknown> ? StandardSchemaV1.InferInput<TSchema> : unknown;
64
+ /**
65
+ * An external API's stand-in, as `test/fakes/<id>.ts` default-exports it.
66
+ *
67
+ * `credentials` are what the fake accepts, and what a local or test stage is
68
+ * handed as `<ID>_CREDENTIALS` in place of the stage's own.
69
+ */
70
+ type Fake = {
71
+ readonly [FAKE]: true;
72
+ readonly credentials: unknown;
73
+ } & ({
74
+ readonly kind: 'app';
75
+ /** Served by gkm: in-process in a test, on its own port in `gkm dev`. */
76
+ readonly handler: FetchHandler;
77
+ } | {
78
+ readonly kind: 'image';
79
+ /** The provider's own local server, run as a container. */
80
+ readonly image: string;
81
+ /** The port it listens on inside the container. */
82
+ readonly port: number;
83
+ });
84
+ /**
85
+ * Build the fake `test/fakes/<id>.ts` default-exports.
86
+ *
87
+ * Pass the API's type to have the credentials checked against its schema —
88
+ * `fake.app<typeof polar>(…)`.
89
+ */
90
+ declare const fake: {
91
+ /** A working implementation of the API, kept beside the tests that use it. */
92
+ app<TApi = unknown>(handler: FetchHandler, options: {
93
+ credentials: CredentialsOf<TApi>;
94
+ }): Fake;
95
+ /** A local server the provider publishes — `stripe/stripe-mock`. */
96
+ image<TApi = unknown>(image: string, options: {
97
+ port: number;
98
+ credentials: CredentialsOf<TApi>;
99
+ }): Fake;
100
+ };
101
+ /** Whether a value is a fake — what gkm asks of a `test/fakes` default export. */
102
+ declare function isFake(value: unknown): value is Fake;
103
+ //#endregion
104
+ export { FetchHandler as a, Fake as i, ExternalApiOptions as n, fake as o, ExternalApiUrl as r, isFake as s, ExternalApi as t };
105
+ //# sourceMappingURL=external-api-O107yzZJ.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"external-api-O107yzZJ.d.cts","names":[],"sources":["../src/external-api.ts"],"mappings":";;;;;;;KAqDK,MAAM,gBAAgB,oBAC1B,iBAAiB,YAAY;;;;;;;;;KAUlB,0CAEO,aAAa,gBAC3B,SAAS,sCACG,KAAK,aAAa;WACrB;;UAGG,mBAAmB,gBAAgB,kBAAkB;;;;;EAKrE,KAAK;;EAEL,aAAa;;EAEb,SAAS;IACR;IACA,aAAa,MAAM;QACd,UAAU,QAAQ;;cAGZ,YACZ,+BACA,gBAAgB,mBAAmB,kBACnC,8BACY,WAAW,OAAO;mBAeZ;WAXT,IAAI;WACJ,SAAS,QAAQ,aAAa,QAAQ;;mBAG9B;;UAGT;EAER,YACC,IAAI,cAAc,QACD,SAAS,mBAAmB,SAAS;;;;;;;MA0BnD,qBAAqB;EAIzB,WAAW;UAaG;;;UA6BE;EAChB,MAAM,SAAS,UAAU,WAAW,QAAQ;;;;;;cAOvC;;KAGD,cAAc,QAClB,aAAa,0BAA0B,oBACpC,iBAAiB,WAAW;;;;;;;KASpB;YACD;WACD;;WAGE;;WAEA,SAAS;;WAGT;;WAEA;;WAEA;;;;;;;;cAUC;;EAEZ,IAAI,gBAAc,SACR,cAAY;IACV,aAAa,cAAc;MACpC;;EAUH,MAAM,gBAAc,eACN;IACF;IAAc,aAAa,cAAc;MAClD;;;iBAYY,OAAO,iBAAiB,SAAS"}
@@ -0,0 +1,142 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_credential = require("./credential.cjs");
3
+ const require_tracing = require("./tracing-DPMidF_r.cjs");
4
+ let _geekmidas_manifest = require("@geekmidas/manifest");
5
+ //#region src/external-api.ts
6
+ /**
7
+ * `ExternalApi` — an HTTP API somebody else runs.
8
+ *
9
+ * Polar, Stripe, a payment gateway: nothing to provision, but an address that
10
+ * changes by stage and credentials the provider issued for each one. Without a
11
+ * construct every integration writes that switching by hand — an optional
12
+ * `POLAR_URL`, a fake started somewhere, a client built in a service — and the
13
+ * target cannot see any of it.
14
+ *
15
+ * ```ts
16
+ * // constructs/polar.ts
17
+ * export const polar = new ExternalApi('Polar', {
18
+ * url: 'https://www.polaraccesslink.com',
19
+ * credentials: z.object({ clientId: z.string(), clientSecret: z.string() }),
20
+ * client: ({ url, credentials }) => new PolarClient(url, credentials),
21
+ * });
22
+ *
23
+ * // test/fakes/polar.ts
24
+ * export default fake.app(new Hono().post('/v3/oauth2/token', …), {
25
+ * credentials: { clientId: 'fake', clientSecret: 'fake' },
26
+ * });
27
+ *
28
+ * // in a handler — the real API deployed, the fake locally and in tests
29
+ * .dependsOn([polar])
30
+ * .handle(({ services }) => services.polar.exchangeCode(code))
31
+ * ```
32
+ *
33
+ * Deployed, the URL is `url` — one for every stage, or one per stage name with
34
+ * a `default` — and the credentials are the stage's `<ID>_CREDENTIALS`, one
35
+ * JSON value read the way a `Credential`'s is. Locally and in tests both come
36
+ * from the fake.
37
+ *
38
+ * **The construct never names its fake.** It is found by convention, at
39
+ * `test/fakes/<id>.ts`, and read only by gkm and the generated test harness —
40
+ * so a fake, and the recorded responses it answers from, cannot end up in a
41
+ * deployed bundle however the bundler follows imports.
42
+ */
43
+ var ExternalApi = class {
44
+ options;
45
+ id;
46
+ service;
47
+ /** Read by both `declare()` and `connect()`, so the two cannot drift. */
48
+ keys;
49
+ /** The promise, so concurrent registrations share one client. */
50
+ connected;
51
+ constructor(id, options) {
52
+ this.options = options;
53
+ const canonical = (0, _geekmidas_manifest.canonicalId)(id);
54
+ this.id = canonical;
55
+ this.keys = {
56
+ url: (0, _geekmidas_manifest.provideKey)(canonical, "url"),
57
+ credentials: (0, _geekmidas_manifest.provideKey)(canonical, "credentials")
58
+ };
59
+ this.service = {
60
+ serviceName: (0, _geekmidas_manifest.serviceKey)(canonical),
61
+ register: (registerOptions) => {
62
+ this.connected ??= this.connect(registerOptions);
63
+ return this.connected;
64
+ }
65
+ };
66
+ }
67
+ /**
68
+ * What the stage's `<ID>_CREDENTIALS` must look like — the schema the value
69
+ * is validated against where it is read. Public so a tool setting the value
70
+ * (`gkm secrets:add`) can check it, and describe its fields, before it is
71
+ * stored rather than at the first request.
72
+ */
73
+ get credentialsSchema() {
74
+ return this.options.credentials;
75
+ }
76
+ declare() {
77
+ return [{
78
+ kind: "external-api",
79
+ id: this.id,
80
+ url: this.options.url,
81
+ provides: [this.keys.url, this.keys.credentials]
82
+ }];
83
+ }
84
+ async connect(options) {
85
+ const { url } = options.envParser.create((get) => ({ url: get(this.keys.url).string() })).parse();
86
+ const credentials = await require_credential.readCredentials(this.id, this.keys.credentials, this.options.credentials, options.envParser);
87
+ const client = await this.options.client({
88
+ url,
89
+ credentials
90
+ });
91
+ return require_tracing.traceClient(this.id, client, { "server.address": hostOf(url) });
92
+ }
93
+ };
94
+ function hostOf(url) {
95
+ try {
96
+ return new URL(url).host;
97
+ } catch {
98
+ return url;
99
+ }
100
+ }
101
+ /**
102
+ * Marks a fake. A registered symbol, so a fake built by a second copy of this
103
+ * package — a linked workspace, two versions in a lockfile — is still one.
104
+ */
105
+ const FAKE = Symbol.for("@geekmidas/constructs/fake");
106
+ /**
107
+ * Build the fake `test/fakes/<id>.ts` default-exports.
108
+ *
109
+ * Pass the API's type to have the credentials checked against its schema —
110
+ * `fake.app<typeof polar>(…)`.
111
+ */
112
+ const fake = {
113
+ /** A working implementation of the API, kept beside the tests that use it. */
114
+ app(handler, options) {
115
+ return {
116
+ [FAKE]: true,
117
+ kind: "app",
118
+ handler,
119
+ credentials: options.credentials
120
+ };
121
+ },
122
+ /** A local server the provider publishes — `stripe/stripe-mock`. */
123
+ image(image, options) {
124
+ return {
125
+ [FAKE]: true,
126
+ kind: "image",
127
+ image,
128
+ port: options.port,
129
+ credentials: options.credentials
130
+ };
131
+ }
132
+ };
133
+ /** Whether a value is a fake — what gkm asks of a `test/fakes` default export. */
134
+ function isFake(value) {
135
+ return typeof value === "object" && value !== null && value[FAKE] === true;
136
+ }
137
+ //#endregion
138
+ exports.ExternalApi = ExternalApi;
139
+ exports.fake = fake;
140
+ exports.isFake = isFake;
141
+
142
+ //# sourceMappingURL=external-api.cjs.map