@geekmidas/constructs 10.0.0-alpha.5 → 10.0.0-alpha.50

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 (392) hide show
  1. package/README.md +223 -158
  2. package/dist/{Construct-BD5neF7w.mjs → Construct-BO1X-kt9.mjs} +32 -33
  3. package/dist/Construct-BO1X-kt9.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-CyS3RpTL.cjs → Construct-DmvXceVY.cjs} +52 -47
  7. package/dist/Construct-DmvXceVY.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-B2OFsfDM.d.cts → Cron-DI3nKoic.d.cts} +22 -8
  11. package/dist/Cron-DI3nKoic.d.cts.map +1 -0
  12. package/dist/{Cron-CqEbBbwH.d.mts → Cron-uYAHPnp7.d.mts} +22 -8
  13. package/dist/Cron-uYAHPnp7.d.mts.map +1 -0
  14. package/dist/CronBuilder-BoHzlWU_.cjs +121 -0
  15. package/dist/CronBuilder-BoHzlWU_.cjs.map +1 -0
  16. package/dist/CronBuilder-CCgt0wCE.mjs +109 -0
  17. package/dist/CronBuilder-CCgt0wCE.mjs.map +1 -0
  18. package/dist/CronBuilder-DaSUm2Na.d.mts +47 -0
  19. package/dist/CronBuilder-DaSUm2Na.d.mts.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-Dem2XyCu.d.mts → Endpoint-BkzU6nn1.d.cts} +70 -93
  23. package/dist/Endpoint-BkzU6nn1.d.cts.map +1 -0
  24. package/dist/{Endpoint-DrD8a1yH.d.cts → Endpoint-BpboleFh.d.mts} +71 -94
  25. package/dist/Endpoint-BpboleFh.d.mts.map +1 -0
  26. package/dist/{Endpoint-Dij_wOcc.mjs → Endpoint-CQ9RJ7p2.mjs} +130 -109
  27. package/dist/Endpoint-CQ9RJ7p2.mjs.map +1 -0
  28. package/dist/{Endpoint-DODn1RhN.cjs → Endpoint-DOi8c_Gy.cjs} +158 -131
  29. package/dist/Endpoint-DOi8c_Gy.cjs.map +1 -0
  30. package/dist/{index-B8g8POkr.d.cts → EndpointFactory-BZZOleQT.d.cts} +62 -132
  31. package/dist/EndpointFactory-BZZOleQT.d.cts.map +1 -0
  32. package/dist/{EndpointFactory-BHFMmFkV.cjs → EndpointFactory-Bo9lkMqB.cjs} +75 -110
  33. package/dist/EndpointFactory-Bo9lkMqB.cjs.map +1 -0
  34. package/dist/{EndpointFactory-b4ituq-s.mjs → EndpointFactory-DR1rebok.mjs} +39 -74
  35. package/dist/EndpointFactory-DR1rebok.mjs.map +1 -0
  36. package/dist/{index-DbKmfl-q.d.mts → EndpointFactory-DnNlYflU.d.mts} +63 -133
  37. package/dist/EndpointFactory-DnNlYflU.d.mts.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-BM2jbWht.mjs → HonoEndpointAdaptor-BIS0O3M9.mjs} +41 -47
  43. package/dist/HonoEndpointAdaptor-BIS0O3M9.mjs.map +1 -0
  44. package/dist/{HonoEndpointAdaptor-De6IlBZe.cjs → HonoEndpointAdaptor-CMi0MJsF.cjs} +50 -53
  45. package/dist/HonoEndpointAdaptor-CMi0MJsF.cjs.map +1 -0
  46. package/dist/Queue-D5jcw0mu.cjs +109 -0
  47. package/dist/Queue-D5jcw0mu.cjs.map +1 -0
  48. package/dist/{Queue-D7ZuwBhy.d.cts → Queue-DlsHRzUp.d.mts} +48 -48
  49. package/dist/Queue-DlsHRzUp.d.mts.map +1 -0
  50. package/dist/{Queue-gVGfi2Yk.d.mts → Queue-HPyi0e1i.d.cts} +49 -49
  51. package/dist/Queue-HPyi0e1i.d.cts.map +1 -0
  52. package/dist/Queue-hwPN-t31.mjs +104 -0
  53. package/dist/Queue-hwPN-t31.mjs.map +1 -0
  54. package/dist/QueueBuilder-BFQn3OzZ.cjs +135 -0
  55. package/dist/QueueBuilder-BFQn3OzZ.cjs.map +1 -0
  56. package/dist/QueueBuilder-DCuYdjMw.mjs +118 -0
  57. package/dist/QueueBuilder-DCuYdjMw.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-2mEi0ImH.d.cts → Subscriber-Bpp02cGr.d.cts} +29 -20
  63. package/dist/Subscriber-Bpp02cGr.d.cts.map +1 -0
  64. package/dist/{Subscriber-xTJ9ayPN.d.mts → Subscriber-CtN9R48-.d.mts} +29 -20
  65. package/dist/Subscriber-CtN9R48-.d.mts.map +1 -0
  66. package/dist/{SubscriberBuilder-4OPehf2R.cjs → SubscriberBuilder-C2PwqwIl.cjs} +61 -36
  67. package/dist/SubscriberBuilder-C2PwqwIl.cjs.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-BjkbeT9l.mjs → SubscriberBuilder-DMFk_Ap1.mjs} +50 -24
  71. package/dist/SubscriberBuilder-DMFk_Ap1.mjs.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-CkxOTrMv.cjs +104 -0
  75. package/dist/Topic-CkxOTrMv.cjs.map +1 -0
  76. package/dist/Topic-hPffOsot.mjs +99 -0
  77. package/dist/Topic-hPffOsot.mjs.map +1 -0
  78. package/dist/adaptors/aws.cjs +189 -110
  79. package/dist/adaptors/aws.cjs.map +1 -1
  80. package/dist/adaptors/aws.d.cts +81 -45
  81. package/dist/adaptors/aws.d.cts.map +1 -1
  82. package/dist/adaptors/aws.d.mts +82 -46
  83. package/dist/adaptors/aws.d.mts.map +1 -1
  84. package/dist/adaptors/aws.mjs +161 -85
  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 +8 -17
  90. package/dist/adaptors/hono.d.mts.map +1 -1
  91. package/dist/adaptors/hono.mjs +2 -10
  92. package/dist/adaptors/testing.cjs +704 -90
  93. package/dist/adaptors/testing.cjs.map +1 -1
  94. package/dist/adaptors/testing.d.cts +325 -54
  95. package/dist/adaptors/testing.d.cts.map +1 -1
  96. package/dist/adaptors/testing.d.mts +325 -54
  97. package/dist/adaptors/testing.d.mts.map +1 -1
  98. package/dist/adaptors/testing.mjs +669 -71
  99. package/dist/adaptors/testing.mjs.map +1 -1
  100. package/dist/auth-3OAmK42n.d.cts +188 -0
  101. package/dist/auth-3OAmK42n.d.cts.map +1 -0
  102. package/dist/auth-BWbiewHa.d.mts +188 -0
  103. package/dist/auth-BWbiewHa.d.mts.map +1 -0
  104. package/dist/auth.cjs +171 -31
  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 +160 -24
  109. package/dist/auth.mjs.map +1 -1
  110. package/dist/{cache-BrRz3fEB.d.mts → cache-CXh6GIgb.d.mts} +3 -6
  111. package/dist/cache-CXh6GIgb.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/{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-D9d4Gm4p.d.cts → construct-interface-B1AfqRl4.d.cts} +42 -11
  129. package/dist/construct-interface-B1AfqRl4.d.cts.map +1 -0
  130. package/dist/{construct-interface-g5GM5pwR.d.mts → construct-interface-DluK3_da.d.mts} +42 -11
  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 +63 -16
  139. package/dist/credential.cjs.map +1 -1
  140. package/dist/credential.d.cts +16 -9
  141. package/dist/credential.d.cts.map +1 -1
  142. package/dist/credential.d.mts +16 -9
  143. package/dist/credential.d.mts.map +1 -1
  144. package/dist/credential.mjs +58 -12
  145. package/dist/credential.mjs.map +1 -1
  146. package/dist/crons/index.cjs +68 -10
  147. package/dist/crons/index.cjs.map +1 -1
  148. package/dist/crons/index.d.cts +32 -14
  149. package/dist/crons/index.d.cts.map +1 -1
  150. package/dist/crons/index.d.mts +32 -14
  151. package/dist/crons/index.d.mts.map +1 -1
  152. package/dist/crons/index.mjs +66 -10
  153. package/dist/crons/index.mjs.map +1 -1
  154. package/dist/database/kysely.cjs +40 -15
  155. package/dist/database/kysely.cjs.map +1 -1
  156. package/dist/database/kysely.d.cts +2 -152
  157. package/dist/database/kysely.d.mts +2 -152
  158. package/dist/database/kysely.mjs +28 -5
  159. package/dist/database/kysely.mjs.map +1 -1
  160. package/dist/email.cjs +25 -12
  161. package/dist/email.cjs.map +1 -1
  162. package/dist/email.d.cts +3 -7
  163. package/dist/email.d.cts.map +1 -1
  164. package/dist/email.d.mts +3 -7
  165. package/dist/email.d.mts.map +1 -1
  166. package/dist/email.mjs +16 -3
  167. package/dist/email.mjs.map +1 -1
  168. package/dist/encryption.cjs +96 -0
  169. package/dist/encryption.cjs.map +1 -0
  170. package/dist/encryption.d.cts +117 -0
  171. package/dist/encryption.d.cts.map +1 -0
  172. package/dist/encryption.d.mts +117 -0
  173. package/dist/encryption.d.mts.map +1 -0
  174. package/dist/encryption.mjs +83 -0
  175. package/dist/encryption.mjs.map +1 -0
  176. package/dist/endpoints/index.cjs +8 -10
  177. package/dist/endpoints/index.d.cts +51 -7
  178. package/dist/endpoints/index.d.cts.map +1 -0
  179. package/dist/endpoints/index.d.mts +51 -7
  180. package/dist/endpoints/index.d.mts.map +1 -0
  181. package/dist/endpoints/index.mjs +6 -10
  182. package/dist/external-api-CWY9orcO.d.mts +86 -0
  183. package/dist/external-api-CWY9orcO.d.mts.map +1 -0
  184. package/dist/external-api-D-5WB-sr.d.cts +86 -0
  185. package/dist/external-api-D-5WB-sr.d.cts.map +1 -0
  186. package/dist/external-api.cjs +124 -0
  187. package/dist/external-api.cjs.map +1 -0
  188. package/dist/external-api.d.cts +2 -0
  189. package/dist/external-api.d.mts +2 -0
  190. package/dist/external-api.mjs +121 -0
  191. package/dist/external-api.mjs.map +1 -0
  192. package/dist/file-server.cjs +42 -10
  193. package/dist/file-server.cjs.map +1 -1
  194. package/dist/file-server.d.cts +6 -10
  195. package/dist/file-server.d.cts.map +1 -1
  196. package/dist/file-server.d.mts +6 -10
  197. package/dist/file-server.d.mts.map +1 -1
  198. package/dist/file-server.mjs +34 -2
  199. package/dist/file-server.mjs.map +1 -1
  200. package/dist/functions/index.cjs +2 -6
  201. package/dist/functions/index.d.cts +3 -4
  202. package/dist/functions/index.d.mts +3 -4
  203. package/dist/functions/index.mjs +2 -6
  204. package/dist/{functions-DJJA7VGc.cjs → functions-CbP5ZKma.cjs} +421 -273
  205. package/dist/functions-CbP5ZKma.cjs.map +1 -0
  206. package/dist/{functions-Ck21Uyq0.mjs → functions-Di6n5ltG.mjs} +383 -241
  207. package/dist/functions-Di6n5ltG.mjs.map +1 -0
  208. package/dist/index-BuzRvKOQ.d.cts +115 -0
  209. package/dist/index-BuzRvKOQ.d.cts.map +1 -0
  210. package/dist/index-CTkKOer4.d.mts +115 -0
  211. package/dist/index-CTkKOer4.d.mts.map +1 -0
  212. package/dist/index-CeEtxDmK.d.cts +79 -0
  213. package/dist/index-CeEtxDmK.d.cts.map +1 -0
  214. package/dist/index-CeEtxDmK.d.mts +79 -0
  215. package/dist/index-CeEtxDmK.d.mts.map +1 -0
  216. package/dist/index.cjs +3 -3
  217. package/dist/index.d.cts +4 -4
  218. package/dist/index.d.mts +4 -4
  219. package/dist/index.mjs +2 -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-Bqov3fwv.d.mts +159 -0
  225. package/dist/kysely-Bqov3fwv.d.mts.map +1 -0
  226. package/dist/kysely-DTnkZsub.d.cts +159 -0
  227. package/dist/kysely-DTnkZsub.d.cts.map +1 -0
  228. package/dist/{lazyAccessors-BoJN3SMd.mjs → lazyAccessors-CFanua0O.mjs} +20 -60
  229. package/dist/lazyAccessors-CFanua0O.mjs.map +1 -0
  230. package/dist/{lazyAccessors-e3j2oE2m.cjs → lazyAccessors-hJKGv8Ay.cjs} +60 -113
  231. package/dist/lazyAccessors-hJKGv8Ay.cjs.map +1 -0
  232. package/dist/mobile-app.cjs +73 -0
  233. package/dist/mobile-app.cjs.map +1 -0
  234. package/dist/mobile-app.d.cts +61 -0
  235. package/dist/mobile-app.d.cts.map +1 -0
  236. package/dist/mobile-app.d.mts +61 -0
  237. package/dist/mobile-app.d.mts.map +1 -0
  238. package/dist/mobile-app.mjs +72 -0
  239. package/dist/mobile-app.mjs.map +1 -0
  240. package/dist/object-storage.cjs +18 -10
  241. package/dist/object-storage.cjs.map +1 -1
  242. package/dist/object-storage.d.cts +3 -7
  243. package/dist/object-storage.d.cts.map +1 -1
  244. package/dist/object-storage.d.mts +3 -7
  245. package/dist/object-storage.d.mts.map +1 -1
  246. package/dist/object-storage.mjs +11 -3
  247. package/dist/object-storage.mjs.map +1 -1
  248. package/dist/{processAudits-Dmts9H_b.mjs → processAudits-BpRlPQMW.mjs} +16 -19
  249. package/dist/processAudits-BpRlPQMW.mjs.map +1 -0
  250. package/dist/{processAudits-CGqttuXm.cjs → processAudits-D_2W5x8k.cjs} +26 -30
  251. package/dist/processAudits-D_2W5x8k.cjs.map +1 -0
  252. package/dist/queue/index.cjs +6 -189
  253. package/dist/queue/index.d.cts +3 -60
  254. package/dist/queue/index.d.mts +3 -60
  255. package/dist/queue/index.mjs +3 -186
  256. package/dist/rest-api.cjs +87 -63
  257. package/dist/rest-api.cjs.map +1 -1
  258. package/dist/rest-api.d.cts +62 -61
  259. package/dist/rest-api.d.cts.map +1 -1
  260. package/dist/rest-api.d.mts +62 -61
  261. package/dist/rest-api.d.mts.map +1 -1
  262. package/dist/rest-api.mjs +79 -55
  263. package/dist/rest-api.mjs.map +1 -1
  264. package/dist/{chunk-DWy1uDak.cjs → rolldown-runtime-y5ARvAq5.cjs} +14 -18
  265. package/dist/site.cjs +33 -9
  266. package/dist/site.cjs.map +1 -1
  267. package/dist/site.d.cts +11 -22
  268. package/dist/site.d.cts.map +1 -1
  269. package/dist/site.d.mts +11 -22
  270. package/dist/site.d.mts.map +1 -1
  271. package/dist/site.mjs +29 -5
  272. package/dist/site.mjs.map +1 -1
  273. package/dist/subscribers/index.cjs +2 -11
  274. package/dist/subscribers/index.d.cts +3 -14
  275. package/dist/subscribers/index.d.mts +3 -14
  276. package/dist/subscribers/index.mjs +2 -11
  277. package/dist/surfaceEnv-CNimK76p.cjs +56 -0
  278. package/dist/surfaceEnv-CNimK76p.cjs.map +1 -0
  279. package/dist/surfaceEnv-wMT5QzgZ.mjs +45 -0
  280. package/dist/surfaceEnv-wMT5QzgZ.mjs.map +1 -0
  281. package/dist/{telemetry-C3L0iS28.d.cts → telemetry-DGcFlVpB.d.cts} +2 -5
  282. package/dist/telemetry-DGcFlVpB.d.cts.map +1 -0
  283. package/dist/{telemetry-D7bVFLGi.d.mts → telemetry-DGcFlVpB.d.mts} +2 -5
  284. package/dist/telemetry-DGcFlVpB.d.mts.map +1 -0
  285. package/dist/topic/index.cjs +3 -137
  286. package/dist/topic/index.d.cts +2 -32
  287. package/dist/topic/index.d.mts +2 -32
  288. package/dist/topic/index.mjs +2 -134
  289. package/dist/{types-BlAkSuGI.d.cts → types-DMuSQeLL.d.cts} +3 -5
  290. package/dist/types-DMuSQeLL.d.cts.map +1 -0
  291. package/dist/{types-aKksMEWL.d.mts → types-DMuSQeLL.d.mts} +3 -5
  292. package/dist/types-DMuSQeLL.d.mts.map +1 -0
  293. package/dist/types.d.cts +1 -1
  294. package/dist/types.d.mts +1 -1
  295. package/dist/types.mjs +1 -0
  296. package/dist/worker.cjs +137 -38
  297. package/dist/worker.cjs.map +1 -1
  298. package/dist/worker.d.cts +113 -44
  299. package/dist/worker.d.cts.map +1 -1
  300. package/dist/worker.d.mts +113 -43
  301. package/dist/worker.d.mts.map +1 -1
  302. package/dist/worker.mjs +132 -33
  303. package/dist/worker.mjs.map +1 -1
  304. package/package.json +81 -41
  305. package/dist/Construct-BD5neF7w.mjs.map +0 -1
  306. package/dist/Construct-C0ijr2qp.d.cts +0 -117
  307. package/dist/Construct-C0ijr2qp.d.cts.map +0 -1
  308. package/dist/Construct-Ct8nalEi.d.mts +0 -117
  309. package/dist/Construct-Ct8nalEi.d.mts.map +0 -1
  310. package/dist/Construct-CyS3RpTL.cjs.map +0 -1
  311. package/dist/Cron-B2OFsfDM.d.cts.map +0 -1
  312. package/dist/Cron-CqEbBbwH.d.mts.map +0 -1
  313. package/dist/CronBuilder-Bg-9h2cc.d.mts +0 -44
  314. package/dist/CronBuilder-Bg-9h2cc.d.mts.map +0 -1
  315. package/dist/CronBuilder-CdibiHNB.mjs +0 -84
  316. package/dist/CronBuilder-CdibiHNB.mjs.map +0 -1
  317. package/dist/CronBuilder-DyUr6nYz.cjs +0 -96
  318. package/dist/CronBuilder-DyUr6nYz.cjs.map +0 -1
  319. package/dist/CronBuilder-LSJMfqnq.d.cts +0 -44
  320. package/dist/CronBuilder-LSJMfqnq.d.cts.map +0 -1
  321. package/dist/Endpoint-DODn1RhN.cjs.map +0 -1
  322. package/dist/Endpoint-Dem2XyCu.d.mts.map +0 -1
  323. package/dist/Endpoint-Dij_wOcc.mjs.map +0 -1
  324. package/dist/Endpoint-DrD8a1yH.d.cts.map +0 -1
  325. package/dist/EndpointFactory-BHFMmFkV.cjs.map +0 -1
  326. package/dist/EndpointFactory-b4ituq-s.mjs.map +0 -1
  327. package/dist/HonoEndpointAdaptor-BM2jbWht.mjs.map +0 -1
  328. package/dist/HonoEndpointAdaptor-De6IlBZe.cjs.map +0 -1
  329. package/dist/Queue-D7ZuwBhy.d.cts.map +0 -1
  330. package/dist/Queue-gVGfi2Yk.d.mts.map +0 -1
  331. package/dist/Subscriber-2mEi0ImH.d.cts.map +0 -1
  332. package/dist/Subscriber-xTJ9ayPN.d.mts.map +0 -1
  333. package/dist/SubscriberBuilder-4OPehf2R.cjs.map +0 -1
  334. package/dist/SubscriberBuilder-BjkbeT9l.mjs.map +0 -1
  335. package/dist/SubscriberBuilder-Dptmo-1A.d.mts +0 -62
  336. package/dist/SubscriberBuilder-Dptmo-1A.d.mts.map +0 -1
  337. package/dist/SubscriberBuilder-waNhzjSM.d.cts +0 -62
  338. package/dist/SubscriberBuilder-waNhzjSM.d.cts.map +0 -1
  339. package/dist/Topic-19QeHBIR.d.cts +0 -91
  340. package/dist/Topic-19QeHBIR.d.cts.map +0 -1
  341. package/dist/Topic-DuFeqkBh.d.mts +0 -91
  342. package/dist/Topic-DuFeqkBh.d.mts.map +0 -1
  343. package/dist/auth.d.cts.map +0 -1
  344. package/dist/auth.d.mts.map +0 -1
  345. package/dist/cache-0ANvRQnD.mjs +0 -51
  346. package/dist/cache-0ANvRQnD.mjs.map +0 -1
  347. package/dist/cache-3WSvAulx.cjs +0 -57
  348. package/dist/cache-3WSvAulx.cjs.map +0 -1
  349. package/dist/cache-BrRz3fEB.d.mts.map +0 -1
  350. package/dist/cache-BtZY_tHe.d.cts.map +0 -1
  351. package/dist/clone-DblgEZZa.mjs.map +0 -1
  352. package/dist/clone-Dy0cR2SZ.cjs.map +0 -1
  353. package/dist/construct-interface-BfjcOD_E.cjs +0 -117
  354. package/dist/construct-interface-BfjcOD_E.cjs.map +0 -1
  355. package/dist/construct-interface-D9d4Gm4p.d.cts.map +0 -1
  356. package/dist/construct-interface-Z4CpS8tK.mjs +0 -81
  357. package/dist/construct-interface-Z4CpS8tK.mjs.map +0 -1
  358. package/dist/construct-interface-g5GM5pwR.d.mts.map +0 -1
  359. package/dist/database/kysely.d.cts.map +0 -1
  360. package/dist/database/kysely.d.mts.map +0 -1
  361. package/dist/functions-Ck21Uyq0.mjs.map +0 -1
  362. package/dist/functions-DJJA7VGc.cjs.map +0 -1
  363. package/dist/index-AIfVzkhi.d.cts +0 -170
  364. package/dist/index-AIfVzkhi.d.cts.map +0 -1
  365. package/dist/index-B8g8POkr.d.cts.map +0 -1
  366. package/dist/index-D3zjrwjr.d.mts +0 -169
  367. package/dist/index-D3zjrwjr.d.mts.map +0 -1
  368. package/dist/index-DbKmfl-q.d.mts.map +0 -1
  369. package/dist/lazyAccessors-BoJN3SMd.mjs.map +0 -1
  370. package/dist/lazyAccessors-e3j2oE2m.cjs.map +0 -1
  371. package/dist/processAudits-CGqttuXm.cjs.map +0 -1
  372. package/dist/processAudits-Dmts9H_b.mjs.map +0 -1
  373. package/dist/queue/index.cjs.map +0 -1
  374. package/dist/queue/index.d.cts.map +0 -1
  375. package/dist/queue/index.d.mts.map +0 -1
  376. package/dist/queue/index.mjs.map +0 -1
  377. package/dist/subscribers/index.cjs.map +0 -1
  378. package/dist/subscribers/index.d.cts.map +0 -1
  379. package/dist/subscribers/index.d.mts.map +0 -1
  380. package/dist/subscribers/index.mjs.map +0 -1
  381. package/dist/surfaceEnv-BFXEms2f.cjs +0 -39
  382. package/dist/surfaceEnv-BFXEms2f.cjs.map +0 -1
  383. package/dist/surfaceEnv-C3Ktahea.mjs +0 -27
  384. package/dist/surfaceEnv-C3Ktahea.mjs.map +0 -1
  385. package/dist/telemetry-C3L0iS28.d.cts.map +0 -1
  386. package/dist/telemetry-D7bVFLGi.d.mts.map +0 -1
  387. package/dist/topic/index.cjs.map +0 -1
  388. package/dist/topic/index.d.cts.map +0 -1
  389. package/dist/topic/index.d.mts.map +0 -1
  390. package/dist/topic/index.mjs.map +0 -1
  391. package/dist/types-BlAkSuGI.d.cts.map +0 -1
  392. package/dist/types-aKksMEWL.d.mts.map +0 -1
@@ -1,8 +1,39 @@
1
1
  import { canonicalId, provideKey, serviceKey } from "@geekmidas/manifest";
2
2
  import { parseSchema } from "@geekmidas/schema/parser";
3
-
4
3
  //#region src/credential.ts
4
+ /**
5
+ * `Credential` — a third-party credential with a shape.
6
+ *
7
+ * The answer to the design's first open question, "where does `Secret` sit?".
8
+ * It sits beside a secret rather than replacing it, because the two differ by
9
+ * *lifecycle* and that is the only difference worth two kinds for: a secret is
10
+ * generated and rotated by the platform and is one opaque string, while a
11
+ * credential is issued by someone else, arrives with several fields, and is
12
+ * worth validating on the way in.
13
+ *
14
+ * ```ts
15
+ * export const stripe = new Credential('Stripe', {
16
+ * schema: z.object({ secretKey: z.string(), webhookSecret: z.string() }),
17
+ * });
18
+ *
19
+ * // in a handler — no await, already parsed and validated
20
+ * services.stripe.secretKey
21
+ * ```
22
+ *
23
+ * **Nothing about it is async at the call site**, which is the part that looks
24
+ * like it should be hard and is not. `Service.register()` may return a promise
25
+ * and `ServiceDiscovery` awaits every one before a handler runs, so fetching a
26
+ * value and validating it — including when a StandardSchema's `~standard.validate`
27
+ * returns a promise of its own — both happen inside that existing seam.
28
+ *
29
+ * **One key holding JSON, not one key per field.** That is the shape a secret
30
+ * manager stores, and it is the only shape that works with an arbitrary
31
+ * StandardSchema: the spec has no introspection API, so enumerating a schema's
32
+ * fields means reaching into one library's internals (`.shape`) and being wrong
33
+ * for every other.
34
+ */
5
35
  var Credential = class {
36
+ options;
6
37
  id;
7
38
  service;
8
39
  /**
@@ -22,7 +53,7 @@ var Credential = class {
22
53
  this.options = options;
23
54
  const canonical = canonicalId(id);
24
55
  this.id = canonical;
25
- this.keys = { credential: provideKey(canonical, "credential") };
56
+ this.keys = { credentials: provideKey(canonical, "credentials") };
26
57
  this.service = {
27
58
  serviceName: serviceKey(canonical),
28
59
  register: (registerOptions) => this.connect(registerOptions)
@@ -32,7 +63,7 @@ var Credential = class {
32
63
  return [{
33
64
  kind: "credential",
34
65
  id: this.id,
35
- provides: [this.keys.credential]
66
+ provides: [this.keys.credentials]
36
67
  }];
37
68
  }
38
69
  connect(options) {
@@ -40,16 +71,28 @@ var Credential = class {
40
71
  this.resolved ??= this.resolve(options);
41
72
  return this.resolved;
42
73
  }
43
- async resolve(options) {
44
- const { raw } = options.envParser.create((get) => ({ raw: get(this.keys.credential).string() })).parse();
45
- try {
46
- return await parseSchema(this.options.schema, decode(raw));
47
- } catch (issues) {
48
- throw new MalformedCredential(this.id, this.keys.credential, issues);
49
- }
74
+ resolve(options) {
75
+ return readCredentials(this.id, this.keys.credentials, this.options.schema, options.envParser);
50
76
  }
51
77
  };
52
78
  /**
79
+ * A credentials key, read and validated against its schema.
80
+ *
81
+ * Shared with every construct that holds a third party's credentials — an
82
+ * `ExternalApi` reads its own the same way — so the shape a stage stores and
83
+ * the error a bad value raises are the same everywhere.
84
+ *
85
+ * @throws {MalformedCredential} when the value is not what the schema says.
86
+ */
87
+ async function readCredentials(id, key, schema, envParser) {
88
+ const { raw } = envParser.create((get) => ({ raw: get(key).string() })).parse();
89
+ try {
90
+ return await parseSchema(schema, decode(raw));
91
+ } catch (issues) {
92
+ throw new MalformedCredential(id, key, issues);
93
+ }
94
+ }
95
+ /**
53
96
  * The raw environment value as the thing the schema should see.
54
97
  *
55
98
  * JSON when it is JSON, and the string itself when it is not — a credential
@@ -72,6 +115,9 @@ function decode(raw) {
72
115
  const JSON_SCHEME = "json:";
73
116
  /** A credential was set, and is not what its schema says it should be. */
74
117
  var MalformedCredential = class extends Error {
118
+ id;
119
+ key;
120
+ issues;
75
121
  constructor(id, key, issues) {
76
122
  super(`${key} is not a valid ${id} credential. It is validated where it is read, so this is the value that is set rather than the code that uses it: ${describe(issues)}`);
77
123
  this.id = id;
@@ -88,7 +134,7 @@ function describe(issues) {
88
134
  return path ? `${path}: ${issue.message}` : issue.message;
89
135
  }).join("; ");
90
136
  }
91
-
92
137
  //#endregion
93
- export { Credential, MalformedCredential };
138
+ export { Credential, MalformedCredential, readCredentials };
139
+
94
140
  //# sourceMappingURL=credential.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"credential.mjs","names":["id: ConstructName<TName>","options: CredentialOptions<TSchema>","options: ServiceRegisterOptions","raw: string","id: string","key: string","issues: unknown","issue: StandardSchemaV1.Issue"],"sources":["../src/credential.ts"],"sourcesContent":["/**\n * `Credential` — a third-party credential with a shape.\n *\n * The answer to the design's first open question, \"where does `Secret` sit?\".\n * It sits beside a secret rather than replacing it, because the two differ by\n * *lifecycle* and that is the only difference worth two kinds for: a secret is\n * generated and rotated by the platform and is one opaque string, while a\n * credential is issued by someone else, arrives with several fields, and is\n * worth validating on the way in.\n *\n * ```ts\n * export const stripe = new Credential('Stripe', {\n * schema: z.object({ secretKey: z.string(), webhookSecret: z.string() }),\n * });\n *\n * // in a handler — no await, already parsed and validated\n * services.stripe.secretKey\n * ```\n *\n * **Nothing about it is async at the call site**, which is the part that looks\n * like it should be hard and is not. `Service.register()` may return a promise\n * and `ServiceDiscovery` awaits every one before a handler runs, so fetching a\n * value and validating it — including when a StandardSchema's `~standard.validate`\n * returns a promise of its own — both happen inside that existing seam.\n *\n * **One key holding JSON, not one key per field.** That is the shape a secret\n * manager stores, and it is the only shape that works with an arbitrary\n * StandardSchema: the spec has no introspection API, so enumerating a schema's\n * fields means reaching into one library's internals (`.shape`) and being wrong\n * for every other.\n */\n\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\tprovideKey,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport { parseSchema } from '@geekmidas/schema/parser';\nimport type { Service, ServiceRegisterOptions } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { Consumable } from './construct-interface';\n\n/** What a credential's schema yields. */\ntype Value<TSchema extends StandardSchemaV1> =\n\tStandardSchemaV1.InferOutput<TSchema>;\n\nexport interface CredentialOptions<TSchema extends StandardSchemaV1> {\n\t/**\n\t * What the credential must look like.\n\t *\n\t * Validated at registration, so a malformed or half-set credential fails\n\t * when the process starts rather than on the first request that needs the\n\t * one field somebody forgot.\n\t */\n\tschema: TSchema;\n\t/**\n\t * Re-resolve on every registration instead of once per process.\n\t *\n\t * Off by default: a credential is resolved once and reused, because the\n\t * alternative is a fetch on every request. The cost of that default is that\n\t * a rotated credential needs a restart, which is the right trade for a value\n\t * that changes a few times a year — and this is the escape hatch for when it\n\t * is not.\n\t */\n\trefresh?: boolean;\n}\n\nexport class Credential<\n\tTName extends string = string,\n\tTSchema extends StandardSchemaV1 = StandardSchemaV1,\n> implements Consumable<TName, Value<TSchema>>\n{\n\t// `Consumable` rather than `Construct`, and not by preference: `Construct`\n\t// types its service as `[TClient] extends [never] ? never : Service<…>` so\n\t// that a `Cron` cannot be depended on, and TypeScript cannot evaluate that\n\t// conditional while `TClient` is still a type parameter. Every construct\n\t// with a concrete client satisfies `Construct`; the first one whose client\n\t// is generic cannot. `Consumable` is the face `.dependsOn()` requires and\n\t// carries no conditional, so it is the honest annotation here.\n\treadonly id: TName;\n\treadonly service: Service<Uncapitalize<TName>, Value<TSchema>>;\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 keys: { credential: string };\n\n\t/**\n\t * The resolved value, held as the *promise* rather than the value.\n\t *\n\t * Caching the promise is what makes two concurrent registrations share one\n\t * resolution: caching the value would let both start before either finished,\n\t * which is a duplicated fetch every cold start rather than never.\n\t */\n\tprivate resolved?: Promise<Value<TSchema>>;\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly options: CredentialOptions<TSchema>,\n\t) {\n\t\tconst canonical = canonicalId(id as string);\n\n\t\tthis.id = canonical as TName;\n\t\tthis.keys = { credential: provideKey(canonical, 'credential') };\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: (registerOptions) => this.connect(registerOptions),\n\t\t};\n\t}\n\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'credential',\n\t\t\t\tid: this.id,\n\t\t\t\tprovides: [this.keys.credential],\n\t\t\t},\n\t\t];\n\t}\n\n\tprivate connect(options: ServiceRegisterOptions): Promise<Value<TSchema>> {\n\t\tif (this.options.refresh) return this.resolve(options);\n\n\t\tthis.resolved ??= this.resolve(options);\n\n\t\treturn this.resolved;\n\t}\n\n\tprivate async resolve(\n\t\toptions: ServiceRegisterOptions,\n\t): Promise<Value<TSchema>> {\n\t\tconst { raw } = options.envParser\n\t\t\t.create((get) => ({ raw: get(this.keys.credential).string() }))\n\t\t\t.parse();\n\n\t\ttry {\n\t\t\treturn await parseSchema(this.options.schema, decode(raw));\n\t\t} catch (issues) {\n\t\t\tthrow new MalformedCredential(this.id, this.keys.credential, issues);\n\t\t}\n\t}\n}\n\n/**\n * The raw environment value as the thing the schema should see.\n *\n * JSON when it is JSON, and the string itself when it is not — a credential\n * with a single opaque field is ordinary, and requiring `\"…\"` around it would\n * be ceremony that every operator setting one by hand would get wrong once.\n */\nfunction decode(raw: string): unknown {\n\tconst value = raw.startsWith(JSON_SCHEME)\n\t\t? raw.slice(JSON_SCHEME.length)\n\t\t: raw;\n\n\ttry {\n\t\treturn JSON.parse(value);\n\t} catch {\n\t\treturn value;\n\t}\n}\n\n/**\n * The explicit form, for the case a credential legitimately *is* a JSON string\n * and must not be parsed into an object. Rare, and cheaper to support than to\n * explain.\n */\nconst JSON_SCHEME = 'json:';\n\n/** A credential was set, and is not what its schema says it should be. */\nexport class MalformedCredential extends Error {\n\tconstructor(\n\t\treadonly id: string,\n\t\treadonly key: string,\n\t\treadonly issues: unknown,\n\t) {\n\t\tsuper(\n\t\t\t`${key} is not a valid ${id} credential. ` +\n\t\t\t\t`It is validated where it is read, so this is the value that is set ` +\n\t\t\t\t`rather than the code that uses it: ${describe(issues)}`,\n\t\t);\n\t\tthis.name = 'MalformedCredential';\n\t}\n}\n\n/** StandardSchema issues as one line. */\nfunction describe(issues: unknown): string {\n\tif (!Array.isArray(issues)) return String(issues);\n\n\treturn issues\n\t\t.map((issue: StandardSchemaV1.Issue) => {\n\t\t\tconst path = issue.path\n\t\t\t\t?.map((segment) =>\n\t\t\t\t\ttypeof segment === 'object' ? String(segment.key) : String(segment),\n\t\t\t\t)\n\t\t\t\t.join('.');\n\n\t\t\treturn path ? `${path}: ${issue.message}` : issue.message;\n\t\t})\n\t\t.join('; ');\n}\n"],"mappings":";;;;AAqEA,IAAa,aAAb,MAIA;CAQC,AAAS;CACT,AAAS;;;;;CAMT,AAAiB;;;;;;;;CASjB,AAAQ;CAER,YACCA,IACiBC,SAChB;EADgB;EAEjB,MAAM,YAAY,YAAY,GAAa;AAE3C,OAAK,KAAK;AACV,OAAK,OAAO,EAAE,YAAY,WAAW,WAAW,aAAa,CAAE;AAG/D,OAAK,UAAU;GACd,aAAa,WAAW,UAAU;GAClC,UAAU,CAAC,oBAAoB,KAAK,QAAQ,gBAAgB;EAC5D;CACD;CAED,UAAyB;AACxB,SAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,UAAU,CAAC,KAAK,KAAK,UAAW;EAChC,CACD;CACD;CAED,AAAQ,QAAQC,SAA0D;AACzE,MAAI,KAAK,QAAQ,QAAS,QAAO,KAAK,QAAQ,QAAQ;AAEtD,OAAK,aAAa,KAAK,QAAQ,QAAQ;AAEvC,SAAO,KAAK;CACZ;CAED,MAAc,QACbA,SAC0B;EAC1B,MAAM,EAAE,KAAK,GAAG,QAAQ,UACtB,OAAO,CAAC,SAAS,EAAE,KAAK,IAAI,KAAK,KAAK,WAAW,CAAC,QAAQ,CAAE,GAAE,CAC9D,OAAO;AAET,MAAI;AACH,UAAO,MAAM,YAAY,KAAK,QAAQ,QAAQ,OAAO,IAAI,CAAC;EAC1D,SAAQ,QAAQ;AAChB,SAAM,IAAI,oBAAoB,KAAK,IAAI,KAAK,KAAK,YAAY;EAC7D;CACD;AACD;;;;;;;;AASD,SAAS,OAAOC,KAAsB;CACrC,MAAM,QAAQ,IAAI,WAAW,YAAY,GACtC,IAAI,MAAM,YAAY,OAAO,GAC7B;AAEH,KAAI;AACH,SAAO,KAAK,MAAM,MAAM;CACxB,QAAO;AACP,SAAO;CACP;AACD;;;;;;AAOD,MAAM,cAAc;;AAGpB,IAAa,sBAAb,cAAyC,MAAM;CAC9C,YACUC,IACAC,KACAC,QACR;AACD,SACE,EAAE,IAAI,kBAAkB,GAAG,qHAEW,SAAS,OAAO,CAAC,EACxD;EARQ;EACA;EACA;AAOT,OAAK,OAAO;CACZ;AACD;;AAGD,SAAS,SAASA,QAAyB;AAC1C,MAAK,MAAM,QAAQ,OAAO,CAAE,QAAO,OAAO,OAAO;AAEjD,QAAO,OACL,IAAI,CAACC,UAAkC;EACvC,MAAM,OAAO,MAAM,MAChB,IAAI,CAAC,mBACC,YAAY,WAAW,OAAO,QAAQ,IAAI,GAAG,OAAO,QAAQ,CACnE,CACA,KAAK,IAAI;AAEX,SAAO,QAAQ,EAAE,KAAK,IAAI,MAAM,QAAQ,IAAI,MAAM;CAClD,EAAC,CACD,KAAK,KAAK;AACZ"}
1
+ {"version":3,"file":"credential.mjs","names":[],"sources":["../src/credential.ts"],"sourcesContent":["/**\n * `Credential` — a third-party credential with a shape.\n *\n * The answer to the design's first open question, \"where does `Secret` sit?\".\n * It sits beside a secret rather than replacing it, because the two differ by\n * *lifecycle* and that is the only difference worth two kinds for: a secret is\n * generated and rotated by the platform and is one opaque string, while a\n * credential is issued by someone else, arrives with several fields, and is\n * worth validating on the way in.\n *\n * ```ts\n * export const stripe = new Credential('Stripe', {\n * schema: z.object({ secretKey: z.string(), webhookSecret: z.string() }),\n * });\n *\n * // in a handler — no await, already parsed and validated\n * services.stripe.secretKey\n * ```\n *\n * **Nothing about it is async at the call site**, which is the part that looks\n * like it should be hard and is not. `Service.register()` may return a promise\n * and `ServiceDiscovery` awaits every one before a handler runs, so fetching a\n * value and validating it — including when a StandardSchema's `~standard.validate`\n * returns a promise of its own — both happen inside that existing seam.\n *\n * **One key holding JSON, not one key per field.** That is the shape a secret\n * manager stores, and it is the only shape that works with an arbitrary\n * StandardSchema: the spec has no introspection API, so enumerating a schema's\n * fields means reaching into one library's internals (`.shape`) and being wrong\n * for every other.\n */\n\nimport {\n\ttype ConstructName,\n\tcanonicalId,\n\ttype Declaration,\n\tprovideKey,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport { parseSchema } from '@geekmidas/schema/parser';\nimport type { Service, ServiceRegisterOptions } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport type { Consumable } from './construct-interface';\n\n/** What a credential's schema yields. */\ntype Value<TSchema extends StandardSchemaV1> =\n\tStandardSchemaV1.InferOutput<TSchema>;\n\nexport interface CredentialOptions<TSchema extends StandardSchemaV1> {\n\t/**\n\t * What the credential must look like.\n\t *\n\t * Validated at registration, so a malformed or half-set credential fails\n\t * when the process starts rather than on the first request that needs the\n\t * one field somebody forgot.\n\t */\n\tschema: TSchema;\n\t/**\n\t * Re-resolve on every registration instead of once per process.\n\t *\n\t * Off by default: a credential is resolved once and reused, because the\n\t * alternative is a fetch on every request. The cost of that default is that\n\t * a rotated credential needs a restart, which is the right trade for a value\n\t * that changes a few times a year — and this is the escape hatch for when it\n\t * is not.\n\t */\n\trefresh?: boolean;\n}\n\nexport class Credential<\n\tTName extends string = string,\n\tTSchema extends StandardSchemaV1 = StandardSchemaV1,\n> implements Consumable<TName, Value<TSchema>>\n{\n\t// `Consumable` rather than `Construct`, and not by preference: `Construct`\n\t// types its service as `[TClient] extends [never] ? never : Service<…>` so\n\t// that a `Cron` cannot be depended on, and TypeScript cannot evaluate that\n\t// conditional while `TClient` is still a type parameter. Every construct\n\t// with a concrete client satisfies `Construct`; the first one whose client\n\t// is generic cannot. `Consumable` is the face `.dependsOn()` requires and\n\t// carries no conditional, so it is the honest annotation here.\n\treadonly id: TName;\n\treadonly service: Service<Uncapitalize<TName>, Value<TSchema>>;\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 keys: { credentials: string };\n\n\t/**\n\t * The resolved value, held as the *promise* rather than the value.\n\t *\n\t * Caching the promise is what makes two concurrent registrations share one\n\t * resolution: caching the value would let both start before either finished,\n\t * which is a duplicated fetch every cold start rather than never.\n\t */\n\tprivate resolved?: Promise<Value<TSchema>>;\n\n\tconstructor(\n\t\tid: ConstructName<TName>,\n\t\tprivate readonly options: CredentialOptions<TSchema>,\n\t) {\n\t\tconst canonical = canonicalId(id as string);\n\n\t\tthis.id = canonical as TName;\n\t\tthis.keys = { credentials: provideKey(canonical, 'credentials') };\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: (registerOptions) => this.connect(registerOptions),\n\t\t};\n\t}\n\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'credential',\n\t\t\t\tid: this.id,\n\t\t\t\tprovides: [this.keys.credentials],\n\t\t\t},\n\t\t];\n\t}\n\n\tprivate connect(options: ServiceRegisterOptions): Promise<Value<TSchema>> {\n\t\tif (this.options.refresh) return this.resolve(options);\n\n\t\tthis.resolved ??= this.resolve(options);\n\n\t\treturn this.resolved;\n\t}\n\n\tprivate resolve(options: ServiceRegisterOptions): Promise<Value<TSchema>> {\n\t\treturn readCredentials(\n\t\t\tthis.id,\n\t\t\tthis.keys.credentials,\n\t\t\tthis.options.schema,\n\t\t\toptions.envParser,\n\t\t);\n\t}\n}\n\n/**\n * A credentials key, read and validated against its schema.\n *\n * Shared with every construct that holds a third party's credentials — an\n * `ExternalApi` reads its own the same way — so the shape a stage stores and\n * the error a bad value raises are the same everywhere.\n *\n * @throws {MalformedCredential} when the value is not what the schema says.\n */\nexport async function readCredentials<TSchema extends StandardSchemaV1>(\n\tid: string,\n\tkey: string,\n\tschema: TSchema,\n\tenvParser: ServiceRegisterOptions['envParser'],\n): Promise<Value<TSchema>> {\n\tconst { raw } = envParser\n\t\t.create((get) => ({ raw: get(key).string() }))\n\t\t.parse();\n\n\ttry {\n\t\treturn await parseSchema(schema, decode(raw));\n\t} catch (issues) {\n\t\tthrow new MalformedCredential(id, key, issues);\n\t}\n}\n\n/**\n * The raw environment value as the thing the schema should see.\n *\n * JSON when it is JSON, and the string itself when it is not — a credential\n * with a single opaque field is ordinary, and requiring `\"…\"` around it would\n * be ceremony that every operator setting one by hand would get wrong once.\n */\nfunction decode(raw: string): unknown {\n\tconst value = raw.startsWith(JSON_SCHEME)\n\t\t? raw.slice(JSON_SCHEME.length)\n\t\t: raw;\n\n\ttry {\n\t\treturn JSON.parse(value);\n\t} catch {\n\t\treturn value;\n\t}\n}\n\n/**\n * The explicit form, for the case a credential legitimately *is* a JSON string\n * and must not be parsed into an object. Rare, and cheaper to support than to\n * explain.\n */\nconst JSON_SCHEME = 'json:';\n\n/** A credential was set, and is not what its schema says it should be. */\nexport class MalformedCredential extends Error {\n\tconstructor(\n\t\treadonly id: string,\n\t\treadonly key: string,\n\t\treadonly issues: unknown,\n\t) {\n\t\tsuper(\n\t\t\t`${key} is not a valid ${id} credential. ` +\n\t\t\t\t`It is validated where it is read, so this is the value that is set ` +\n\t\t\t\t`rather than the code that uses it: ${describe(issues)}`,\n\t\t);\n\t\tthis.name = 'MalformedCredential';\n\t}\n}\n\n/** StandardSchema issues as one line. */\nfunction describe(issues: unknown): string {\n\tif (!Array.isArray(issues)) return String(issues);\n\n\treturn issues\n\t\t.map((issue: StandardSchemaV1.Issue) => {\n\t\t\tconst path = issue.path\n\t\t\t\t?.map((segment) =>\n\t\t\t\t\ttypeof segment === 'object' ? String(segment.key) : String(segment),\n\t\t\t\t)\n\t\t\t\t.join('.');\n\n\t\t\treturn path ? `${path}: ${issue.message}` : issue.message;\n\t\t})\n\t\t.join('; ');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqEA,IAAa,aAAb,MAIA;CA4BmB;CApBlB;CACA;;;;;CAMA;;;;;;;;CASA;CAEA,YACC,IACA,SACC;EADgB,KAAA,UAAA;EAEjB,MAAM,YAAY,YAAY,EAAY;EAE1C,KAAK,KAAK;EACV,KAAK,OAAO,EAAE,aAAa,WAAW,WAAW,aAAa,EAAE;EAGhE,KAAK,UAAU;GACd,aAAa,WAAW,SAAS;GACjC,WAAW,oBAAoB,KAAK,QAAQ,eAAe;EAC5D;CACD;CAEA,UAAyB;EACxB,OAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,UAAU,CAAC,KAAK,KAAK,WAAW;EACjC,CACD;CACD;CAEA,QAAgB,SAA0D;EACzE,IAAI,KAAK,QAAQ,SAAS,OAAO,KAAK,QAAQ,OAAO;EAErD,KAAK,aAAa,KAAK,QAAQ,OAAO;EAEtC,OAAO,KAAK;CACb;CAEA,QAAgB,SAA0D;EACzE,OAAO,gBACN,KAAK,IACL,KAAK,KAAK,aACV,KAAK,QAAQ,QACb,QAAQ,SACT;CACD;AACD;;;;;;;;;;AAWA,eAAsB,gBACrB,IACA,KACA,QACA,WAC0B;CAC1B,MAAM,EAAE,QAAQ,UACd,QAAQ,SAAS,EAAE,KAAK,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAC7C,MAAM;CAER,IAAI;EACH,OAAO,MAAM,YAAY,QAAQ,OAAO,GAAG,CAAC;CAC7C,SAAS,QAAQ;EAChB,MAAM,IAAI,oBAAoB,IAAI,KAAK,MAAM;CAC9C;AACD;;;;;;;;AASA,SAAS,OAAO,KAAsB;CACrC,MAAM,QAAQ,IAAI,WAAW,WAAW,IACrC,IAAI,MAAM,YAAY,MAAM,IAC5B;CAEH,IAAI;EACH,OAAO,KAAK,MAAM,KAAK;CACxB,QAAQ;EACP,OAAO;CACR;AACD;;;;;;AAOA,MAAM,cAAc;;AAGpB,IAAa,sBAAb,cAAyC,MAAM;CAEpC;CACA;CACA;CAHV,YACC,IACA,KACA,QACC;EACD,MACC,GAAG,IAAI,kBAAkB,GAAG,qHAEW,SAAS,MAAM,GACvD;EARS,KAAA,KAAA;EACA,KAAA,MAAA;EACA,KAAA,SAAA;EAOT,KAAK,OAAO;CACb;AACD;;AAGA,SAAS,SAAS,QAAyB;CAC1C,IAAI,CAAC,MAAM,QAAQ,MAAM,GAAG,OAAO,OAAO,MAAM;CAEhD,OAAO,OACL,KAAK,UAAkC;EACvC,MAAM,OAAO,MAAM,MAChB,KAAK,YACN,OAAO,YAAY,WAAW,OAAO,QAAQ,GAAG,IAAI,OAAO,OAAO,CACnE,CAAC,CACA,KAAK,GAAG;EAEV,OAAO,OAAO,GAAG,KAAK,IAAI,MAAM,YAAY,MAAM;CACnD,CAAC,CAAC,CACD,KAAK,IAAI;AACZ"}
@@ -1,14 +1,72 @@
1
- require('../construct-interface-BfjcOD_E.cjs');
2
- require('../Construct-CyS3RpTL.cjs');
3
- require('../functions-DJJA7VGc.cjs');
4
- require('../clone-Dy0cR2SZ.cjs');
5
- const require_CronBuilder = require('../CronBuilder-DyUr6nYz.cjs');
6
-
7
- //#region src/crons/index.ts
8
- const c = new require_CronBuilder.CronBuilder();
9
-
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_CronBuilder = require("../CronBuilder-BoHzlWU_.cjs");
3
+ //#region src/crons/schedule.ts
4
+ /**
5
+ * A schedule a cron runner can take, as standard five-field cron.
6
+ *
7
+ * `ScheduleExpression` has two spellings. `cron(m h dom mon dow)` is already
8
+ * five-field cron and unwraps; `rate(n unit)` is an interval, and an interval
9
+ * is not a schedule — it says how often, where cron says when.
10
+ *
11
+ * Most intervals still have an exact cron equivalent, because they divide their
12
+ * unit evenly: `rate(5 minutes)` is every fifth minute of every hour, and that
13
+ * is `*​/5 * * * *` precisely. `rate(7 hours)` has none. There is no cron field
14
+ * that means "every seven hours" — `*​/7` in the hour field fires at 0, 7, 14
15
+ * and 21 and then starts over at midnight, so the gap between the last firing
16
+ * of one day and the first of the next is three hours rather than seven.
17
+ *
18
+ * Those are refused rather than rounded. A job that runs at the wrong hour is
19
+ * far harder to notice than one that refused to build, and a schedule quietly
20
+ * adjusted by the framework is a bug nobody goes looking for.
21
+ */
22
+ var UnrepresentableSchedule = class extends Error {
23
+ schedule;
24
+ constructor(schedule, reason) {
25
+ super(`\`${schedule}\` has no exact cron equivalent: ${reason}.\n\nCron says *when*, not *how often*, so an interval is only exact when it divides its unit evenly.
26
+ Write the schedule you mean instead — \`cron(0 */6 * * *)\` for every sixth hour, say — or pick an interval that divides: minutes into 60, hours into 24.`);
27
+ this.schedule = schedule;
28
+ this.name = "UnrepresentableSchedule";
29
+ }
30
+ };
31
+ /** Units `rate(…)` accepts, singular or plural. */
32
+ const UNITS = [
33
+ "minute",
34
+ "hour",
35
+ "day"
36
+ ];
37
+ /**
38
+ * Standard five-field cron for a schedule expression.
39
+ *
40
+ * @throws {UnrepresentableSchedule} when a `rate(…)` has no exact equivalent.
41
+ */
42
+ function toCronExpression(schedule) {
43
+ const cron = /^cron\((.+)\)$/.exec(schedule);
44
+ if (cron?.[1]) return cron[1].trim();
45
+ const rate = /^rate\(\s*(\d+)\s+(\w+?)s?\s*\)$/.exec(schedule);
46
+ if (!rate) throw new UnrepresentableSchedule(schedule, "it is neither `cron(…)` nor `rate(n unit)`");
47
+ const every = Number(rate[1]);
48
+ const unit = rate[2];
49
+ /* c8 ignore next */ if (!unit) throw new UnrepresentableSchedule(schedule, "no unit");
50
+ if (!UNITS.includes(unit)) throw new UnrepresentableSchedule(schedule, `\`${unit}\` is not one of ${UNITS.join(", ")}`);
51
+ if (every < 1) throw new UnrepresentableSchedule(schedule, "an interval must be at least 1");
52
+ switch (unit) {
53
+ case "minute":
54
+ if (every === 1) return "* * * * *";
55
+ if (60 % every !== 0) throw new UnrepresentableSchedule(schedule, `${every} does not divide 60, so the interval would reset at the top of each hour`);
56
+ return `*/${every} * * * *`;
57
+ case "hour":
58
+ if (every === 1) return "0 * * * *";
59
+ if (24 % every !== 0) throw new UnrepresentableSchedule(schedule, `${every} does not divide 24, so the interval would reset at midnight`);
60
+ return `0 */${every} * * *`;
61
+ case "day":
62
+ if (every === 1) return "0 0 * * *";
63
+ throw new UnrepresentableSchedule(schedule, "day-of-month restarts every month, so no multi-day interval is even");
64
+ }
65
+ }
10
66
  //#endregion
11
67
  exports.Cron = require_CronBuilder.Cron;
12
68
  exports.CronBuilder = require_CronBuilder.CronBuilder;
13
- exports.c = c;
69
+ exports.UnrepresentableSchedule = UnrepresentableSchedule;
70
+ exports.toCronExpression = toCronExpression;
71
+
14
72
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["CronBuilder"],"sources":["../../src/crons/index.ts"],"sourcesContent":["export {\n\tCron,\n\ttype CronExpression,\n\ttype RateExpression,\n\ttype ScheduleExpression,\n} from './Cron';\nexport { CronBuilder } from './CronBuilder';\n\nimport { CronBuilder } from './CronBuilder';\n\nexport const c = new CronBuilder();\n"],"mappings":";;;;;;;AAUA,MAAa,IAAI,IAAIA"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../../src/crons/schedule.ts"],"sourcesContent":["import type { ScheduleExpression } from './Cron';\n\n/**\n * A schedule a cron runner can take, as standard five-field cron.\n *\n * `ScheduleExpression` has two spellings. `cron(m h dom mon dow)` is already\n * five-field cron and unwraps; `rate(n unit)` is an interval, and an interval\n * is not a schedule — it says how often, where cron says when.\n *\n * Most intervals still have an exact cron equivalent, because they divide their\n * unit evenly: `rate(5 minutes)` is every fifth minute of every hour, and that\n * is `*​/5 * * * *` precisely. `rate(7 hours)` has none. There is no cron field\n * that means \"every seven hours\" — `*​/7` in the hour field fires at 0, 7, 14\n * and 21 and then starts over at midnight, so the gap between the last firing\n * of one day and the first of the next is three hours rather than seven.\n *\n * Those are refused rather than rounded. A job that runs at the wrong hour is\n * far harder to notice than one that refused to build, and a schedule quietly\n * adjusted by the framework is a bug nobody goes looking for.\n */\nexport class UnrepresentableSchedule extends Error {\n\tconstructor(\n\t\treadonly schedule: string,\n\t\treason: string,\n\t) {\n\t\tsuper(\n\t\t\t`\\`${schedule}\\` has no exact cron equivalent: ${reason}.\\n\\n` +\n\t\t\t\t'Cron says *when*, not *how often*, so an interval is only exact when ' +\n\t\t\t\t'it divides its unit evenly.\\n' +\n\t\t\t\t'Write the schedule you mean instead — `cron(0 */6 * * *)` for every ' +\n\t\t\t\t'sixth hour, say — or pick an interval that divides: minutes into 60, ' +\n\t\t\t\t'hours into 24.',\n\t\t);\n\t\tthis.name = 'UnrepresentableSchedule';\n\t}\n}\n\n/** Units `rate(…)` accepts, singular or plural. */\nconst UNITS = ['minute', 'hour', 'day'] as const;\ntype Unit = (typeof UNITS)[number];\n\n/**\n * Standard five-field cron for a schedule expression.\n *\n * @throws {UnrepresentableSchedule} when a `rate(…)` has no exact equivalent.\n */\nexport function toCronExpression(schedule: ScheduleExpression): string {\n\tconst cron = /^cron\\((.+)\\)$/.exec(schedule);\n\tif (cron?.[1]) return cron[1].trim();\n\n\tconst rate = /^rate\\(\\s*(\\d+)\\s+(\\w+?)s?\\s*\\)$/.exec(schedule);\n\tif (!rate) {\n\t\tthrow new UnrepresentableSchedule(\n\t\t\tschedule,\n\t\t\t'it is neither `cron(…)` nor `rate(n unit)`',\n\t\t);\n\t}\n\n\tconst every = Number(rate[1]);\n\tconst unit = rate[2] as Unit;\n\t/* c8 ignore next */ if (!unit)\n\t\tthrow new UnrepresentableSchedule(schedule, 'no unit');\n\n\tif (!UNITS.includes(unit)) {\n\t\tthrow new UnrepresentableSchedule(\n\t\t\tschedule,\n\t\t\t`\\`${unit}\\` is not one of ${UNITS.join(', ')}`,\n\t\t);\n\t}\n\n\tif (every < 1) {\n\t\tthrow new UnrepresentableSchedule(\n\t\t\tschedule,\n\t\t\t'an interval must be at least 1',\n\t\t);\n\t}\n\n\tswitch (unit) {\n\t\tcase 'minute':\n\t\t\tif (every === 1) return '* * * * *';\n\t\t\tif (60 % every !== 0) {\n\t\t\t\tthrow new UnrepresentableSchedule(\n\t\t\t\t\tschedule,\n\t\t\t\t\t`${every} does not divide 60, so the interval would reset at the top of each hour`,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn `*/${every} * * * *`;\n\n\t\tcase 'hour':\n\t\t\tif (every === 1) return '0 * * * *';\n\t\t\tif (24 % every !== 0) {\n\t\t\t\tthrow new UnrepresentableSchedule(\n\t\t\t\t\tschedule,\n\t\t\t\t\t`${every} does not divide 24, so the interval would reset at midnight`,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn `0 */${every} * * *`;\n\n\t\tcase 'day':\n\t\t\tif (every === 1) return '0 0 * * *';\n\t\t\t// `*/n` in day-of-month restarts on the 1st, so a 2-day interval fires\n\t\t\t// on the 1st and 3rd of a 31-day month and then again on the 1st — one\n\t\t\t// day later, not two. No month length makes that come out even.\n\t\t\tthrow new UnrepresentableSchedule(\n\t\t\t\tschedule,\n\t\t\t\t'day-of-month restarts every month, so no multi-day interval is even',\n\t\t\t);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoBA,IAAa,0BAAb,cAA6C,MAAM;CAExC;CADV,YACC,UACA,QACC;EACD,MACC,KAAK,SAAS,mCAAmC,OAAO;0JAMzD;EAVS,KAAA,WAAA;EAWT,KAAK,OAAO;CACb;AACD;;AAGA,MAAM,QAAQ;CAAC;CAAU;CAAQ;AAAK;;;;;;AAQtC,SAAgB,iBAAiB,UAAsC;CACtE,MAAM,OAAO,iBAAiB,KAAK,QAAQ;CAC3C,IAAI,OAAO,IAAI,OAAO,KAAK,EAAE,CAAC,KAAK;CAEnC,MAAM,OAAO,mCAAmC,KAAK,QAAQ;CAC7D,IAAI,CAAC,MACJ,MAAM,IAAI,wBACT,UACA,4CACD;CAGD,MAAM,QAAQ,OAAO,KAAK,EAAE;CAC5B,MAAM,OAAO,KAAK;sBACG,IAAI,CAAC,MACzB,MAAM,IAAI,wBAAwB,UAAU,SAAS;CAEtD,IAAI,CAAC,MAAM,SAAS,IAAI,GACvB,MAAM,IAAI,wBACT,UACA,KAAK,KAAK,mBAAmB,MAAM,KAAK,IAAI,GAC7C;CAGD,IAAI,QAAQ,GACX,MAAM,IAAI,wBACT,UACA,gCACD;CAGD,QAAQ,MAAR;EACC,KAAK;GACJ,IAAI,UAAU,GAAG,OAAO;GACxB,IAAI,KAAK,UAAU,GAClB,MAAM,IAAI,wBACT,UACA,GAAG,MAAM,yEACV;GAED,OAAO,KAAK,MAAM;EAEnB,KAAK;GACJ,IAAI,UAAU,GAAG,OAAO;GACxB,IAAI,KAAK,UAAU,GAClB,MAAM,IAAI,wBACT,UACA,GAAG,MAAM,6DACV;GAED,OAAO,OAAO,MAAM;EAErB,KAAK;GACJ,IAAI,UAAU,GAAG,OAAO;GAIxB,MAAM,IAAI,wBACT,UACA,qEACD;CACF;AACD"}
@@ -1,16 +1,34 @@
1
- import "../Construct-C0ijr2qp.cjs";
2
- import "../index-AIfVzkhi.cjs";
3
- import "../construct-interface-D9d4Gm4p.cjs";
4
- import { Cron, CronExpression, RateExpression, ScheduleExpression } from "../Cron-B2OFsfDM.cjs";
5
- import { CronBuilder } from "../CronBuilder-LSJMfqnq.cjs";
6
- import * as _geekmidas_logger2 from "@geekmidas/logger";
7
- import * as _geekmidas_schema0 from "@geekmidas/schema";
8
- import * as _geekmidas_services1 from "@geekmidas/services";
9
-
10
- //#region src/crons/index.d.ts
11
- declare const c: CronBuilder<_geekmidas_schema0.ComposableStandardSchema, _geekmidas_services1.Service<string, unknown>[], _geekmidas_logger2.Logger, undefined, undefined, string, undefined, string>;
12
- //# sourceMappingURL=index.d.ts.map
13
-
1
+ import { i as ScheduleExpression, n as CronExpression, r as RateExpression, t as Cron } from "../Cron-DI3nKoic.cjs";
2
+ import { t as CronBuilder } from "../CronBuilder-g1lZLWyG.cjs";
3
+ //#region src/crons/schedule.d.ts
4
+ /**
5
+ * A schedule a cron runner can take, as standard five-field cron.
6
+ *
7
+ * `ScheduleExpression` has two spellings. `cron(m h dom mon dow)` is already
8
+ * five-field cron and unwraps; `rate(n unit)` is an interval, and an interval
9
+ * is not a schedule — it says how often, where cron says when.
10
+ *
11
+ * Most intervals still have an exact cron equivalent, because they divide their
12
+ * unit evenly: `rate(5 minutes)` is every fifth minute of every hour, and that
13
+ * is `*​/5 * * * *` precisely. `rate(7 hours)` has none. There is no cron field
14
+ * that means "every seven hours" — `*​/7` in the hour field fires at 0, 7, 14
15
+ * and 21 and then starts over at midnight, so the gap between the last firing
16
+ * of one day and the first of the next is three hours rather than seven.
17
+ *
18
+ * Those are refused rather than rounded. A job that runs at the wrong hour is
19
+ * far harder to notice than one that refused to build, and a schedule quietly
20
+ * adjusted by the framework is a bug nobody goes looking for.
21
+ */
22
+ export declare class UnrepresentableSchedule extends Error {
23
+ readonly schedule: string;
24
+ constructor(schedule: string, reason: string);
25
+ }
26
+ /**
27
+ * Standard five-field cron for a schedule expression.
28
+ *
29
+ * @throws {UnrepresentableSchedule} when a `rate(…)` has no exact equivalent.
30
+ */
31
+ export declare function toCronExpression(schedule: ScheduleExpression): string;
14
32
  //#endregion
15
- export { Cron, CronBuilder, CronExpression, RateExpression, ScheduleExpression, c };
33
+ export { Cron, CronBuilder, type CronExpression, type RateExpression, type ScheduleExpression };
16
34
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/crons/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;cAUa,GAAC,YAAoB,kBAAA,CAApB,wBAAA,EAAA,oBAAA,CAAA,4BAAA,kBAAA,CAAA,MAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/crons/schedule.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;qBAoBa,gCAAgC;WAElC;EADV,YACU,kBACT;;;;;;;wBAuBc,iBAAiB,UAAU"}
@@ -1,16 +1,34 @@
1
- import "../Construct-Ct8nalEi.mjs";
2
- import "../index-D3zjrwjr.mjs";
3
- import "../construct-interface-g5GM5pwR.mjs";
4
- import { Cron, CronExpression, RateExpression, ScheduleExpression } from "../Cron-CqEbBbwH.mjs";
5
- import { CronBuilder } from "../CronBuilder-Bg-9h2cc.mjs";
6
- import * as _geekmidas_services23 from "@geekmidas/services";
7
- import * as _geekmidas_logger24 from "@geekmidas/logger";
8
- import * as _geekmidas_schema22 from "@geekmidas/schema";
9
-
10
- //#region src/crons/index.d.ts
11
- declare const c: CronBuilder<_geekmidas_schema22.ComposableStandardSchema, _geekmidas_services23.Service<string, unknown>[], _geekmidas_logger24.Logger, undefined, undefined, string, undefined, string>;
12
- //# sourceMappingURL=index.d.ts.map
13
-
1
+ import { i as ScheduleExpression, n as CronExpression, r as RateExpression, t as Cron } from "../Cron-uYAHPnp7.mjs";
2
+ import { t as CronBuilder } from "../CronBuilder-DaSUm2Na.mjs";
3
+ //#region src/crons/schedule.d.ts
4
+ /**
5
+ * A schedule a cron runner can take, as standard five-field cron.
6
+ *
7
+ * `ScheduleExpression` has two spellings. `cron(m h dom mon dow)` is already
8
+ * five-field cron and unwraps; `rate(n unit)` is an interval, and an interval
9
+ * is not a schedule — it says how often, where cron says when.
10
+ *
11
+ * Most intervals still have an exact cron equivalent, because they divide their
12
+ * unit evenly: `rate(5 minutes)` is every fifth minute of every hour, and that
13
+ * is `*​/5 * * * *` precisely. `rate(7 hours)` has none. There is no cron field
14
+ * that means "every seven hours" — `*​/7` in the hour field fires at 0, 7, 14
15
+ * and 21 and then starts over at midnight, so the gap between the last firing
16
+ * of one day and the first of the next is three hours rather than seven.
17
+ *
18
+ * Those are refused rather than rounded. A job that runs at the wrong hour is
19
+ * far harder to notice than one that refused to build, and a schedule quietly
20
+ * adjusted by the framework is a bug nobody goes looking for.
21
+ */
22
+ export declare class UnrepresentableSchedule extends Error {
23
+ readonly schedule: string;
24
+ constructor(schedule: string, reason: string);
25
+ }
26
+ /**
27
+ * Standard five-field cron for a schedule expression.
28
+ *
29
+ * @throws {UnrepresentableSchedule} when a `rate(…)` has no exact equivalent.
30
+ */
31
+ export declare function toCronExpression(schedule: ScheduleExpression): string;
14
32
  //#endregion
15
- export { Cron, CronBuilder, CronExpression, RateExpression, ScheduleExpression, c };
33
+ export { Cron, CronBuilder, type CronExpression, type RateExpression, type ScheduleExpression };
16
34
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/crons/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;cAUa,GAAC,YAAoB,mBAAA,CAApB,wBAAA,EAAA,qBAAA,CAAA,4BAAA,mBAAA,CAAA,MAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/crons/schedule.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;qBAoBa,gCAAgC;WAElC;EADV,YACU,kBACT;;;;;;;wBAuBc,iBAAiB,UAAU"}
@@ -1,12 +1,68 @@
1
- import "../Construct-BD5neF7w.mjs";
2
- import "../construct-interface-Z4CpS8tK.mjs";
3
- import "../functions-Ck21Uyq0.mjs";
4
- import "../clone-DblgEZZa.mjs";
5
- import { Cron, CronBuilder } from "../CronBuilder-CdibiHNB.mjs";
6
-
7
- //#region src/crons/index.ts
8
- const c = new CronBuilder();
9
-
1
+ import { n as Cron, t as CronBuilder } from "../CronBuilder-CCgt0wCE.mjs";
2
+ //#region src/crons/schedule.ts
3
+ /**
4
+ * A schedule a cron runner can take, as standard five-field cron.
5
+ *
6
+ * `ScheduleExpression` has two spellings. `cron(m h dom mon dow)` is already
7
+ * five-field cron and unwraps; `rate(n unit)` is an interval, and an interval
8
+ * is not a schedule — it says how often, where cron says when.
9
+ *
10
+ * Most intervals still have an exact cron equivalent, because they divide their
11
+ * unit evenly: `rate(5 minutes)` is every fifth minute of every hour, and that
12
+ * is `*​/5 * * * *` precisely. `rate(7 hours)` has none. There is no cron field
13
+ * that means "every seven hours" — `*​/7` in the hour field fires at 0, 7, 14
14
+ * and 21 and then starts over at midnight, so the gap between the last firing
15
+ * of one day and the first of the next is three hours rather than seven.
16
+ *
17
+ * Those are refused rather than rounded. A job that runs at the wrong hour is
18
+ * far harder to notice than one that refused to build, and a schedule quietly
19
+ * adjusted by the framework is a bug nobody goes looking for.
20
+ */
21
+ var UnrepresentableSchedule = class extends Error {
22
+ schedule;
23
+ constructor(schedule, reason) {
24
+ super(`\`${schedule}\` has no exact cron equivalent: ${reason}.\n\nCron says *when*, not *how often*, so an interval is only exact when it divides its unit evenly.
25
+ Write the schedule you mean instead — \`cron(0 */6 * * *)\` for every sixth hour, say — or pick an interval that divides: minutes into 60, hours into 24.`);
26
+ this.schedule = schedule;
27
+ this.name = "UnrepresentableSchedule";
28
+ }
29
+ };
30
+ /** Units `rate(…)` accepts, singular or plural. */
31
+ const UNITS = [
32
+ "minute",
33
+ "hour",
34
+ "day"
35
+ ];
36
+ /**
37
+ * Standard five-field cron for a schedule expression.
38
+ *
39
+ * @throws {UnrepresentableSchedule} when a `rate(…)` has no exact equivalent.
40
+ */
41
+ function toCronExpression(schedule) {
42
+ const cron = /^cron\((.+)\)$/.exec(schedule);
43
+ if (cron?.[1]) return cron[1].trim();
44
+ const rate = /^rate\(\s*(\d+)\s+(\w+?)s?\s*\)$/.exec(schedule);
45
+ if (!rate) throw new UnrepresentableSchedule(schedule, "it is neither `cron(…)` nor `rate(n unit)`");
46
+ const every = Number(rate[1]);
47
+ const unit = rate[2];
48
+ /* c8 ignore next */ if (!unit) throw new UnrepresentableSchedule(schedule, "no unit");
49
+ if (!UNITS.includes(unit)) throw new UnrepresentableSchedule(schedule, `\`${unit}\` is not one of ${UNITS.join(", ")}`);
50
+ if (every < 1) throw new UnrepresentableSchedule(schedule, "an interval must be at least 1");
51
+ switch (unit) {
52
+ case "minute":
53
+ if (every === 1) return "* * * * *";
54
+ if (60 % every !== 0) throw new UnrepresentableSchedule(schedule, `${every} does not divide 60, so the interval would reset at the top of each hour`);
55
+ return `*/${every} * * * *`;
56
+ case "hour":
57
+ if (every === 1) return "0 * * * *";
58
+ if (24 % every !== 0) throw new UnrepresentableSchedule(schedule, `${every} does not divide 24, so the interval would reset at midnight`);
59
+ return `0 */${every} * * *`;
60
+ case "day":
61
+ if (every === 1) return "0 0 * * *";
62
+ throw new UnrepresentableSchedule(schedule, "day-of-month restarts every month, so no multi-day interval is even");
63
+ }
64
+ }
10
65
  //#endregion
11
- export { Cron, CronBuilder, c };
66
+ export { Cron, CronBuilder, UnrepresentableSchedule, toCronExpression };
67
+
12
68
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/crons/index.ts"],"sourcesContent":["export {\n\tCron,\n\ttype CronExpression,\n\ttype RateExpression,\n\ttype ScheduleExpression,\n} from './Cron';\nexport { CronBuilder } from './CronBuilder';\n\nimport { CronBuilder } from './CronBuilder';\n\nexport const c = new CronBuilder();\n"],"mappings":";;;;;;;AAUA,MAAa,IAAI,IAAI"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/crons/schedule.ts"],"sourcesContent":["import type { ScheduleExpression } from './Cron';\n\n/**\n * A schedule a cron runner can take, as standard five-field cron.\n *\n * `ScheduleExpression` has two spellings. `cron(m h dom mon dow)` is already\n * five-field cron and unwraps; `rate(n unit)` is an interval, and an interval\n * is not a schedule — it says how often, where cron says when.\n *\n * Most intervals still have an exact cron equivalent, because they divide their\n * unit evenly: `rate(5 minutes)` is every fifth minute of every hour, and that\n * is `*​/5 * * * *` precisely. `rate(7 hours)` has none. There is no cron field\n * that means \"every seven hours\" — `*​/7` in the hour field fires at 0, 7, 14\n * and 21 and then starts over at midnight, so the gap between the last firing\n * of one day and the first of the next is three hours rather than seven.\n *\n * Those are refused rather than rounded. A job that runs at the wrong hour is\n * far harder to notice than one that refused to build, and a schedule quietly\n * adjusted by the framework is a bug nobody goes looking for.\n */\nexport class UnrepresentableSchedule extends Error {\n\tconstructor(\n\t\treadonly schedule: string,\n\t\treason: string,\n\t) {\n\t\tsuper(\n\t\t\t`\\`${schedule}\\` has no exact cron equivalent: ${reason}.\\n\\n` +\n\t\t\t\t'Cron says *when*, not *how often*, so an interval is only exact when ' +\n\t\t\t\t'it divides its unit evenly.\\n' +\n\t\t\t\t'Write the schedule you mean instead — `cron(0 */6 * * *)` for every ' +\n\t\t\t\t'sixth hour, say — or pick an interval that divides: minutes into 60, ' +\n\t\t\t\t'hours into 24.',\n\t\t);\n\t\tthis.name = 'UnrepresentableSchedule';\n\t}\n}\n\n/** Units `rate(…)` accepts, singular or plural. */\nconst UNITS = ['minute', 'hour', 'day'] as const;\ntype Unit = (typeof UNITS)[number];\n\n/**\n * Standard five-field cron for a schedule expression.\n *\n * @throws {UnrepresentableSchedule} when a `rate(…)` has no exact equivalent.\n */\nexport function toCronExpression(schedule: ScheduleExpression): string {\n\tconst cron = /^cron\\((.+)\\)$/.exec(schedule);\n\tif (cron?.[1]) return cron[1].trim();\n\n\tconst rate = /^rate\\(\\s*(\\d+)\\s+(\\w+?)s?\\s*\\)$/.exec(schedule);\n\tif (!rate) {\n\t\tthrow new UnrepresentableSchedule(\n\t\t\tschedule,\n\t\t\t'it is neither `cron(…)` nor `rate(n unit)`',\n\t\t);\n\t}\n\n\tconst every = Number(rate[1]);\n\tconst unit = rate[2] as Unit;\n\t/* c8 ignore next */ if (!unit)\n\t\tthrow new UnrepresentableSchedule(schedule, 'no unit');\n\n\tif (!UNITS.includes(unit)) {\n\t\tthrow new UnrepresentableSchedule(\n\t\t\tschedule,\n\t\t\t`\\`${unit}\\` is not one of ${UNITS.join(', ')}`,\n\t\t);\n\t}\n\n\tif (every < 1) {\n\t\tthrow new UnrepresentableSchedule(\n\t\t\tschedule,\n\t\t\t'an interval must be at least 1',\n\t\t);\n\t}\n\n\tswitch (unit) {\n\t\tcase 'minute':\n\t\t\tif (every === 1) return '* * * * *';\n\t\t\tif (60 % every !== 0) {\n\t\t\t\tthrow new UnrepresentableSchedule(\n\t\t\t\t\tschedule,\n\t\t\t\t\t`${every} does not divide 60, so the interval would reset at the top of each hour`,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn `*/${every} * * * *`;\n\n\t\tcase 'hour':\n\t\t\tif (every === 1) return '0 * * * *';\n\t\t\tif (24 % every !== 0) {\n\t\t\t\tthrow new UnrepresentableSchedule(\n\t\t\t\t\tschedule,\n\t\t\t\t\t`${every} does not divide 24, so the interval would reset at midnight`,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn `0 */${every} * * *`;\n\n\t\tcase 'day':\n\t\t\tif (every === 1) return '0 0 * * *';\n\t\t\t// `*/n` in day-of-month restarts on the 1st, so a 2-day interval fires\n\t\t\t// on the 1st and 3rd of a 31-day month and then again on the 1st — one\n\t\t\t// day later, not two. No month length makes that come out even.\n\t\t\tthrow new UnrepresentableSchedule(\n\t\t\t\tschedule,\n\t\t\t\t'day-of-month restarts every month, so no multi-day interval is even',\n\t\t\t);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,IAAa,0BAAb,cAA6C,MAAM;CAExC;CADV,YACC,UACA,QACC;EACD,MACC,KAAK,SAAS,mCAAmC,OAAO;0JAMzD;EAVS,KAAA,WAAA;EAWT,KAAK,OAAO;CACb;AACD;;AAGA,MAAM,QAAQ;CAAC;CAAU;CAAQ;AAAK;;;;;;AAQtC,SAAgB,iBAAiB,UAAsC;CACtE,MAAM,OAAO,iBAAiB,KAAK,QAAQ;CAC3C,IAAI,OAAO,IAAI,OAAO,KAAK,EAAE,CAAC,KAAK;CAEnC,MAAM,OAAO,mCAAmC,KAAK,QAAQ;CAC7D,IAAI,CAAC,MACJ,MAAM,IAAI,wBACT,UACA,4CACD;CAGD,MAAM,QAAQ,OAAO,KAAK,EAAE;CAC5B,MAAM,OAAO,KAAK;sBACG,IAAI,CAAC,MACzB,MAAM,IAAI,wBAAwB,UAAU,SAAS;CAEtD,IAAI,CAAC,MAAM,SAAS,IAAI,GACvB,MAAM,IAAI,wBACT,UACA,KAAK,KAAK,mBAAmB,MAAM,KAAK,IAAI,GAC7C;CAGD,IAAI,QAAQ,GACX,MAAM,IAAI,wBACT,UACA,gCACD;CAGD,QAAQ,MAAR;EACC,KAAK;GACJ,IAAI,UAAU,GAAG,OAAO;GACxB,IAAI,KAAK,UAAU,GAClB,MAAM,IAAI,wBACT,UACA,GAAG,MAAM,yEACV;GAED,OAAO,KAAK,MAAM;EAEnB,KAAK;GACJ,IAAI,UAAU,GAAG,OAAO;GACxB,IAAI,KAAK,UAAU,GAClB,MAAM,IAAI,wBACT,UACA,GAAG,MAAM,6DACV;GAED,OAAO,OAAO,MAAM;EAErB,KAAK;GACJ,IAAI,UAAU,GAAG,OAAO;GAIxB,MAAM,IAAI,wBACT,UACA,qEACD;CACF;AACD"}
@@ -1,10 +1,23 @@
1
- const require_chunk = require('../chunk-DWy1uDak.cjs');
2
- const require_cache = require('../cache-3WSvAulx.cjs');
3
- const __geekmidas_manifest = require_chunk.__toESM(require("@geekmidas/manifest"));
4
- const kysely = require_chunk.__toESM(require("kysely"));
5
- const pg = require_chunk.__toESM(require("pg"));
6
-
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_rolldown_runtime = require("../rolldown-runtime-y5ARvAq5.cjs");
3
+ const require_cache = require("../cache.cjs");
4
+ let _geekmidas_manifest = require("@geekmidas/manifest");
5
+ let kysely = require("kysely");
6
+ let pg = require("pg");
7
+ pg = require_rolldown_runtime.__toESM(pg, 1);
7
8
  //#region src/database/kysely.ts
9
+ /**
10
+ * `KyselyDatabase` — a declared Postgres database, typed by its schema.
11
+ *
12
+ * It declares a logical database, a schema, and the roles that reach it, and
13
+ * hands back a Kysely client built from the one URL the adapter supplied. It
14
+ * names no cloud: `--target=aws` fills that URL from RDS, local dev from the
15
+ * Postgres container.
16
+ *
17
+ * Transactions and RLS context are the execution wrapper's job — it opens the
18
+ * transaction and puts it in `ctx.db`. This construct does not resolve
19
+ * connections per request.
20
+ */
8
21
  /** The schema a database uses when it does not say otherwise. */
9
22
  const DEFAULT_SCHEMA = "app";
10
23
  /**
@@ -15,6 +28,7 @@ const DEFAULT_SCHEMA = "app";
15
28
  * through `.database()`, which infers from the service.
16
29
  */
17
30
  var KyselyDatabase = class KyselyDatabase {
31
+ options;
18
32
  id;
19
33
  service;
20
34
  /**
@@ -28,18 +42,18 @@ var KyselyDatabase = class KyselyDatabase {
28
42
  derivedFrom;
29
43
  constructor(id, options = {}, derivedFrom) {
30
44
  this.options = options;
31
- const canonical = (0, __geekmidas_manifest.canonicalId)(id);
45
+ const canonical = (0, _geekmidas_manifest.canonicalId)(id);
32
46
  this.id = canonical;
33
47
  this.config = {
34
- url: (0, __geekmidas_manifest.provideKey)(canonical, "url"),
35
- ownerUrl: (0, __geekmidas_manifest.provideKey)(canonical, "ownerUrl")
48
+ url: (0, _geekmidas_manifest.provideKey)(canonical, "url"),
49
+ ownerUrl: (0, _geekmidas_manifest.provideKey)(canonical, "ownerUrl")
36
50
  };
37
51
  this.schemaName = options.schema ?? DEFAULT_SCHEMA;
38
52
  this.roles = options.roles ?? true;
39
- this.version = options.version ?? __geekmidas_manifest.DEFAULT_POSTGRES_VERSION;
53
+ this.version = options.version ?? _geekmidas_manifest.DEFAULT_POSTGRES_VERSION;
40
54
  this.derivedFrom = derivedFrom;
41
55
  this.service = {
42
- serviceName: (0, __geekmidas_manifest.serviceKey)(canonical),
56
+ serviceName: (0, _geekmidas_manifest.serviceKey)(canonical),
43
57
  register: (registerOptions) => this.connect(registerOptions)
44
58
  };
45
59
  }
@@ -139,18 +153,29 @@ var KyselyDatabase = class KyselyDatabase {
139
153
  */
140
154
  get owner() {
141
155
  return {
142
- serviceName: `${(0, __geekmidas_manifest.serviceKey)(this.id)}Owner`,
156
+ serviceName: `${(0, _geekmidas_manifest.serviceKey)(this.id)}Owner`,
143
157
  register: (options) => this.connect(options, { owner: true })
144
158
  };
145
159
  }
160
+ /**
161
+ * What this database's clients are built with besides a dialect — the
162
+ * plugins and logging it was declared with.
163
+ *
164
+ * Public so that whatever opens a connection to it outside \`connect()\` —
165
+ * a test's transaction — builds the same client. A test that dropped the
166
+ * plugins would write \`createdAt\` where production writes \`created_at\`.
167
+ */
168
+ get clientConfig() {
169
+ const { schema: _schema, roles: _roles, version: _version, ...kysely$1 } = this.options;
170
+ return kysely$1;
171
+ }
146
172
  async connect(options, as = {}) {
147
173
  const { url, ownerUrl } = options.envParser.create((get) => ({
148
174
  url: get(this.config.url).string(),
149
175
  ownerUrl: get(this.config.ownerUrl).string().optional()
150
176
  })).parse();
151
- const { schema: _schema, roles: _roles,...kysely$1 } = this.options;
152
177
  return new kysely.Kysely({
153
- ...kysely$1,
178
+ ...this.clientConfig,
154
179
  dialect: new kysely.PostgresDialect({ pool: pool(as.owner ? ownerUrl ?? url : url) })
155
180
  });
156
181
  }
@@ -175,7 +200,7 @@ function pool(url) {
175
200
  options: `-c search_path=${searchPath}`
176
201
  });
177
202
  }
178
-
179
203
  //#endregion
180
204
  exports.KyselyDatabase = KyselyDatabase;
205
+
181
206
  //# sourceMappingURL=kysely.cjs.map