gemi 0.224.1 → 0.225.1

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 (258) hide show
  1. package/dist/ai/Agent.d.ts +2 -0
  2. package/dist/ai/Agent.d.ts.map +1 -1
  3. package/dist/ai/index.js +2 -2
  4. package/dist/ai/index.js.map +1 -1
  5. package/dist/ai/providers/anthropicStream.d.ts +6 -0
  6. package/dist/ai/providers/anthropicStream.d.ts.map +1 -1
  7. package/dist/ai/providers/call.d.ts +15 -0
  8. package/dist/ai/providers/call.d.ts.map +1 -1
  9. package/dist/ai/providers/endpoints.d.ts +25 -0
  10. package/dist/ai/providers/endpoints.d.ts.map +1 -1
  11. package/dist/ai/providers/errors.d.ts +12 -0
  12. package/dist/ai/providers/errors.d.ts.map +1 -1
  13. package/dist/ai/providers/stream.d.ts +3 -0
  14. package/dist/ai/providers/stream.d.ts.map +1 -1
  15. package/dist/ai/testing/index.js +2 -2
  16. package/dist/ai/testing/index.js.map +2 -2
  17. package/dist/ai/types.d.ts +6 -0
  18. package/dist/ai/types.d.ts.map +1 -1
  19. package/dist/app/index.js +1 -1
  20. package/dist/bun/plugin.js +1 -1
  21. package/dist/bun/preload.js +1 -1
  22. package/dist/{chunk-p1ern8r4.js → chunk-1jyzg1ex.js} +3 -3
  23. package/dist/{chunk-p1ern8r4.js.map → chunk-1jyzg1ex.js.map} +1 -1
  24. package/dist/{chunk-97tj0d7v.js → chunk-21hhvphe.js} +2 -2
  25. package/dist/{chunk-97tj0d7v.js.map → chunk-21hhvphe.js.map} +1 -1
  26. package/dist/{chunk-zmt5kdpb.js → chunk-2450kxym.js} +2 -2
  27. package/dist/{chunk-zmt5kdpb.js.map → chunk-2450kxym.js.map} +1 -1
  28. package/dist/{chunk-vmmjq9fn.js → chunk-3dkaz47e.js} +2 -2
  29. package/dist/{chunk-vmmjq9fn.js.map → chunk-3dkaz47e.js.map} +1 -1
  30. package/dist/{chunk-bqm79ar0.js → chunk-3e55yw7v.js} +3 -3
  31. package/dist/{chunk-bqm79ar0.js.map → chunk-3e55yw7v.js.map} +1 -1
  32. package/dist/chunk-3vgjrn2r.js +12 -0
  33. package/dist/{chunk-dpmvvwts.js.map → chunk-3vgjrn2r.js.map} +6 -6
  34. package/dist/{chunk-snmyjq03.js → chunk-40yd1n60.js} +2 -2
  35. package/dist/{chunk-snmyjq03.js.map → chunk-40yd1n60.js.map} +1 -1
  36. package/dist/{chunk-6ttbhhnn.js → chunk-421hq1rw.js} +1 -1
  37. package/dist/{chunk-99216y02.js → chunk-444g812v.js} +2 -2
  38. package/dist/{chunk-99216y02.js.map → chunk-444g812v.js.map} +1 -1
  39. package/dist/{chunk-k16phdjv.js → chunk-4qyp7w89.js} +1 -1
  40. package/dist/{chunk-j9abwrkv.js → chunk-5kgqfczk.js} +3 -3
  41. package/dist/{chunk-j9abwrkv.js.map → chunk-5kgqfczk.js.map} +1 -1
  42. package/dist/{chunk-wy82t7mz.js → chunk-64yf0shq.js} +2 -2
  43. package/dist/{chunk-wy82t7mz.js.map → chunk-64yf0shq.js.map} +1 -1
  44. package/dist/{chunk-8a3fqcf0.js → chunk-6et7jwp8.js} +2 -2
  45. package/dist/{chunk-8a3fqcf0.js.map → chunk-6et7jwp8.js.map} +1 -1
  46. package/dist/{chunk-0k2r6bep.js → chunk-6h1hjzj7.js} +2 -2
  47. package/dist/{chunk-0k2r6bep.js.map → chunk-6h1hjzj7.js.map} +1 -1
  48. package/dist/{chunk-nzd7z4s6.js → chunk-70jhw0ft.js} +1 -1
  49. package/dist/{chunk-b87wvmsz.js → chunk-7901z26g.js} +2 -2
  50. package/dist/{chunk-b87wvmsz.js.map → chunk-7901z26g.js.map} +1 -1
  51. package/dist/{chunk-sfrjkysf.js → chunk-7d1f5gyv.js} +2 -2
  52. package/dist/{chunk-sfrjkysf.js.map → chunk-7d1f5gyv.js.map} +1 -1
  53. package/dist/{chunk-50791bmz.js → chunk-7mvfk0q9.js} +2 -2
  54. package/dist/{chunk-50791bmz.js.map → chunk-7mvfk0q9.js.map} +1 -1
  55. package/dist/{chunk-4wh4dfgf.js → chunk-81y96dax.js} +1 -1
  56. package/dist/{chunk-2vv04thj.js → chunk-8pdke84p.js} +2 -2
  57. package/dist/{chunk-2vv04thj.js.map → chunk-8pdke84p.js.map} +1 -1
  58. package/dist/{chunk-h9nt7hm6.js → chunk-8szsd6vy.js} +2 -2
  59. package/dist/{chunk-h9nt7hm6.js.map → chunk-8szsd6vy.js.map} +1 -1
  60. package/dist/{chunk-79v94sa6.js → chunk-8yxjq6cm.js} +2 -2
  61. package/dist/{chunk-79v94sa6.js.map → chunk-8yxjq6cm.js.map} +1 -1
  62. package/dist/{chunk-t8ygf6zj.js → chunk-9xxgj5zk.js} +3 -3
  63. package/dist/{chunk-t8ygf6zj.js.map → chunk-9xxgj5zk.js.map} +1 -1
  64. package/dist/{chunk-8pz8yzax.js → chunk-9znec0we.js} +4 -4
  65. package/dist/{chunk-8pz8yzax.js.map → chunk-9znec0we.js.map} +3 -3
  66. package/dist/{chunk-3dkv4989.js → chunk-ads3c8m0.js} +2 -2
  67. package/dist/{chunk-3dkv4989.js.map → chunk-ads3c8m0.js.map} +1 -1
  68. package/dist/{chunk-fqhkkpq3.js → chunk-awryyak8.js} +2 -2
  69. package/dist/{chunk-fqhkkpq3.js.map → chunk-awryyak8.js.map} +1 -1
  70. package/dist/{chunk-5jvbr0e5.js → chunk-bch7xbsr.js} +2 -2
  71. package/dist/{chunk-5jvbr0e5.js.map → chunk-bch7xbsr.js.map} +1 -1
  72. package/dist/{chunk-3y91vexx.js → chunk-bwjaq694.js} +3 -3
  73. package/dist/{chunk-3y91vexx.js.map → chunk-bwjaq694.js.map} +1 -1
  74. package/dist/chunk-bzrta2sw.js +10 -0
  75. package/dist/{chunk-qs2xvc8g.js.map → chunk-bzrta2sw.js.map} +9 -4
  76. package/dist/{chunk-4v5nwqw6.js → chunk-crk4ddqa.js} +3 -3
  77. package/dist/{chunk-4v5nwqw6.js.map → chunk-crk4ddqa.js.map} +1 -1
  78. package/dist/{chunk-37209psn.js → chunk-d3a29hyg.js} +3 -3
  79. package/dist/{chunk-37209psn.js.map → chunk-d3a29hyg.js.map} +1 -1
  80. package/dist/{chunk-jyyrgb6j.js → chunk-dxesf8bt.js} +2 -2
  81. package/dist/{chunk-jyyrgb6j.js.map → chunk-dxesf8bt.js.map} +1 -1
  82. package/dist/{chunk-yj7pbbnm.js → chunk-enqrjcdk.js} +2 -2
  83. package/dist/{chunk-yj7pbbnm.js.map → chunk-enqrjcdk.js.map} +1 -1
  84. package/dist/{chunk-adw279ge.js → chunk-eydww2nn.js} +2 -2
  85. package/dist/{chunk-adw279ge.js.map → chunk-eydww2nn.js.map} +1 -1
  86. package/dist/{chunk-fxa72ppw.js → chunk-fjnhqbtx.js} +1 -1
  87. package/dist/{chunk-726gd69z.js → chunk-ftc9292d.js} +2 -2
  88. package/dist/{chunk-726gd69z.js.map → chunk-ftc9292d.js.map} +1 -1
  89. package/dist/{chunk-pxjptskr.js → chunk-gj0bwm41.js} +2 -2
  90. package/dist/{chunk-pxjptskr.js.map → chunk-gj0bwm41.js.map} +1 -1
  91. package/dist/{chunk-5mrtgr7q.js → chunk-hvyzp9p6.js} +2 -2
  92. package/dist/{chunk-5mrtgr7q.js.map → chunk-hvyzp9p6.js.map} +1 -1
  93. package/dist/{chunk-8vpe54ek.js → chunk-j0rhz378.js} +2 -2
  94. package/dist/{chunk-8vpe54ek.js.map → chunk-j0rhz378.js.map} +1 -1
  95. package/dist/{chunk-swmf6w3z.js → chunk-j13jmjkr.js} +2 -2
  96. package/dist/{chunk-swmf6w3z.js.map → chunk-j13jmjkr.js.map} +1 -1
  97. package/dist/{chunk-anc5v266.js → chunk-j7pzdvxr.js} +2 -2
  98. package/dist/{chunk-anc5v266.js.map → chunk-j7pzdvxr.js.map} +1 -1
  99. package/dist/{chunk-h1wmpa03.js → chunk-ja3n968b.js} +2 -2
  100. package/dist/{chunk-h1wmpa03.js.map → chunk-ja3n968b.js.map} +1 -1
  101. package/dist/{chunk-vcw98sp6.js → chunk-k657v3ed.js} +3 -3
  102. package/dist/{chunk-vcw98sp6.js.map → chunk-k657v3ed.js.map} +1 -1
  103. package/dist/{chunk-t586p2g2.js → chunk-kxc2mzzr.js} +2 -2
  104. package/dist/{chunk-t586p2g2.js.map → chunk-kxc2mzzr.js.map} +1 -1
  105. package/dist/{chunk-nqqyn3cx.js → chunk-kzz2nfzf.js} +2 -2
  106. package/dist/{chunk-nqqyn3cx.js.map → chunk-kzz2nfzf.js.map} +1 -1
  107. package/dist/{chunk-k6af7qek.js → chunk-m7v4erdg.js} +2 -2
  108. package/dist/{chunk-k6af7qek.js.map → chunk-m7v4erdg.js.map} +1 -1
  109. package/dist/{chunk-p4v71qfx.js → chunk-mca5s0bf.js} +3 -3
  110. package/dist/{chunk-p4v71qfx.js.map → chunk-mca5s0bf.js.map} +1 -1
  111. package/dist/{chunk-79wjkaa4.js → chunk-me70vszk.js} +2 -2
  112. package/dist/{chunk-79wjkaa4.js.map → chunk-me70vszk.js.map} +1 -1
  113. package/dist/{chunk-qy0k2s5f.js → chunk-mvb8m247.js} +2 -2
  114. package/dist/{chunk-qy0k2s5f.js.map → chunk-mvb8m247.js.map} +1 -1
  115. package/dist/{chunk-0av1gyns.js → chunk-mvp6fkg2.js} +3 -3
  116. package/dist/{chunk-0av1gyns.js.map → chunk-mvp6fkg2.js.map} +1 -1
  117. package/dist/{chunk-e4zxacxd.js → chunk-n2c748aw.js} +2 -2
  118. package/dist/{chunk-e4zxacxd.js.map → chunk-n2c748aw.js.map} +1 -1
  119. package/dist/{chunk-nqgeny8m.js → chunk-ng6pbd7f.js} +4 -4
  120. package/dist/{chunk-nqgeny8m.js.map → chunk-ng6pbd7f.js.map} +1 -1
  121. package/dist/{chunk-7xe5vd4w.js → chunk-pdymdjpq.js} +2 -2
  122. package/dist/{chunk-7xe5vd4w.js.map → chunk-pdymdjpq.js.map} +1 -1
  123. package/dist/{chunk-dj0nvj66.js → chunk-pn3egz75.js} +1 -1
  124. package/dist/chunk-qjn6a2ed.js +5 -0
  125. package/dist/{chunk-89egc0h3.js.map → chunk-qjn6a2ed.js.map} +1 -1
  126. package/dist/chunk-qrc2r0ce.js +5 -0
  127. package/dist/{chunk-kp7wcpx7.js.map → chunk-qrc2r0ce.js.map} +3 -3
  128. package/dist/{chunk-gyszenps.js → chunk-qtz4g4kv.js} +3 -3
  129. package/dist/{chunk-gyszenps.js.map → chunk-qtz4g4kv.js.map} +1 -1
  130. package/dist/{chunk-55btq9c7.js → chunk-qx9p15em.js} +2 -2
  131. package/dist/{chunk-55btq9c7.js.map → chunk-qx9p15em.js.map} +1 -1
  132. package/dist/{chunk-fp9yn4k8.js → chunk-rq0dpv7r.js} +2 -2
  133. package/dist/{chunk-fp9yn4k8.js.map → chunk-rq0dpv7r.js.map} +1 -1
  134. package/dist/{chunk-ps5rpy9n.js → chunk-ryh6rfts.js} +2 -2
  135. package/dist/{chunk-ps5rpy9n.js.map → chunk-ryh6rfts.js.map} +1 -1
  136. package/dist/{chunk-7etvj6w2.js → chunk-svrvb47q.js} +2 -2
  137. package/dist/{chunk-7etvj6w2.js.map → chunk-svrvb47q.js.map} +1 -1
  138. package/dist/{chunk-3k4p9agd.js → chunk-t5aft2ra.js} +22 -22
  139. package/dist/{chunk-3k4p9agd.js.map → chunk-t5aft2ra.js.map} +8 -7
  140. package/dist/{chunk-ncnygh0s.js → chunk-t9fh0ptd.js} +2 -2
  141. package/dist/{chunk-ncnygh0s.js.map → chunk-t9fh0ptd.js.map} +1 -1
  142. package/dist/{chunk-jf2dr481.js → chunk-tbvrv4h2.js} +2 -2
  143. package/dist/{chunk-jf2dr481.js.map → chunk-tbvrv4h2.js.map} +1 -1
  144. package/dist/{chunk-6r7956dh.js → chunk-tgy75n24.js} +2 -2
  145. package/dist/{chunk-6r7956dh.js.map → chunk-tgy75n24.js.map} +1 -1
  146. package/dist/{chunk-pxjkxhf9.js → chunk-tp1gxcke.js} +3 -3
  147. package/dist/{chunk-pxjkxhf9.js.map → chunk-tp1gxcke.js.map} +1 -1
  148. package/dist/{chunk-y8cj5cap.js → chunk-v0fqq5z7.js} +2 -2
  149. package/dist/{chunk-y8cj5cap.js.map → chunk-v0fqq5z7.js.map} +1 -1
  150. package/dist/{chunk-cf8bztwq.js → chunk-v4ecxbgd.js} +2 -2
  151. package/dist/{chunk-cf8bztwq.js.map → chunk-v4ecxbgd.js.map} +1 -1
  152. package/dist/{chunk-rat2827k.js → chunk-v5sg62xm.js} +2 -2
  153. package/dist/{chunk-rat2827k.js.map → chunk-v5sg62xm.js.map} +1 -1
  154. package/dist/chunk-v979k0be.js +5 -0
  155. package/dist/{chunk-zcmz311y.js.map → chunk-v979k0be.js.map} +3 -8
  156. package/dist/{chunk-rw45xz3f.js → chunk-we65r9fh.js} +3 -3
  157. package/dist/{chunk-rw45xz3f.js.map → chunk-we65r9fh.js.map} +1 -1
  158. package/dist/{chunk-2y0nr525.js → chunk-wnmpwb4s.js} +3 -3
  159. package/dist/{chunk-2y0nr525.js.map → chunk-wnmpwb4s.js.map} +1 -1
  160. package/dist/{chunk-s3gn68dy.js → chunk-wzr8tzv0.js} +2 -2
  161. package/dist/{chunk-s3gn68dy.js.map → chunk-wzr8tzv0.js.map} +1 -1
  162. package/dist/{chunk-wt4ekzp9.js → chunk-x47kwv2x.js} +2 -2
  163. package/dist/{chunk-wt4ekzp9.js.map → chunk-x47kwv2x.js.map} +1 -1
  164. package/dist/{chunk-8ddt5fa2.js → chunk-x93dpv6e.js} +2 -2
  165. package/dist/{chunk-8ddt5fa2.js.map → chunk-x93dpv6e.js.map} +1 -1
  166. package/dist/{chunk-tac25cnj.js → chunk-xpzdwhjg.js} +3 -3
  167. package/dist/{chunk-tac25cnj.js.map → chunk-xpzdwhjg.js.map} +1 -1
  168. package/dist/{chunk-ax042w6k.js → chunk-z4fhhtjh.js} +2 -2
  169. package/dist/{chunk-ax042w6k.js.map → chunk-z4fhhtjh.js.map} +1 -1
  170. package/dist/{chunk-5h2xj3cx.js → chunk-z6x78wb3.js} +2 -2
  171. package/dist/{chunk-5h2xj3cx.js.map → chunk-z6x78wb3.js.map} +1 -1
  172. package/dist/{chunk-q5xcjm5z.js → chunk-zvg2qsa5.js} +2 -2
  173. package/dist/{chunk-q5xcjm5z.js.map → chunk-zvg2qsa5.js.map} +1 -1
  174. package/dist/{chunk-mt82209n.js → chunk-zy56kaws.js} +2 -2
  175. package/dist/{chunk-mt82209n.js.map → chunk-zy56kaws.js.map} +1 -1
  176. package/dist/chunks/{RealtimeClient-CuTFz0v1.js → RealtimeClient-C5Zh3fD6.js} +2 -2
  177. package/dist/chunks/{RealtimeClient-CuTFz0v1.js.map → RealtimeClient-C5Zh3fD6.js.map} +1 -1
  178. package/dist/chunks/{ThemeProvider-BO3sQkWl.js → ThemeProvider-bbbE-N3t.js} +5 -3
  179. package/dist/chunks/ThemeProvider-bbbE-N3t.js.map +1 -0
  180. package/dist/chunks/{fetchFileRequest-CrKd0rD5.js → fetchFileRequest-JXhnEi-R.js} +2 -2
  181. package/dist/chunks/{fetchFileRequest-CrKd0rD5.js.map → fetchFileRequest-JXhnEi-R.js.map} +1 -1
  182. package/dist/chunks/{live-BCCfTb28.js → live-CApTRvmK.js} +3 -3
  183. package/dist/chunks/{live-BCCfTb28.js.map → live-CApTRvmK.js.map} +1 -1
  184. package/dist/chunks/{mutationExtras-cPXZS6Hf.js → mutationExtras-C2qSSZ2Q.js} +34 -3
  185. package/dist/chunks/mutationExtras-C2qSSZ2Q.js.map +1 -0
  186. package/dist/chunks/{subscriptionStream-CRrAISl8.js → subscriptionStream-DQLW7dTW.js} +2 -2
  187. package/dist/chunks/{subscriptionStream-CRrAISl8.js.map → subscriptionStream-DQLW7dTW.js.map} +1 -1
  188. package/dist/client/QueryManagerContext.d.ts +2 -0
  189. package/dist/client/QueryManagerContext.d.ts.map +1 -1
  190. package/dist/client/index.d.ts +2 -1
  191. package/dist/client/index.d.ts.map +1 -1
  192. package/dist/client/index.js +63 -8
  193. package/dist/client/index.js.map +1 -1
  194. package/dist/client/islands.d.ts.map +1 -1
  195. package/dist/client/mutationExtras.d.ts +1 -1
  196. package/dist/client/mutationExtras.d.ts.map +1 -1
  197. package/dist/client/queryUpdates.d.ts +8 -0
  198. package/dist/client/queryUpdates.d.ts.map +1 -1
  199. package/dist/client/useInvalidate.d.ts +13 -0
  200. package/dist/client/useInvalidate.d.ts.map +1 -0
  201. package/dist/client/useMutation.d.ts +17 -0
  202. package/dist/client/useMutation.d.ts.map +1 -1
  203. package/dist/config/index.js +1 -1
  204. package/dist/console/run.js +2 -2
  205. package/dist/console/run.js.map +1 -1
  206. package/dist/container/index.js +2 -2
  207. package/dist/container/index.js.map +1 -1
  208. package/dist/database/index.js +2 -2
  209. package/dist/database/index.js.map +1 -1
  210. package/dist/email/index.js +2 -2
  211. package/dist/email/index.js.map +1 -1
  212. package/dist/facades/Prefetch.d.ts +22 -0
  213. package/dist/facades/Prefetch.d.ts.map +1 -1
  214. package/dist/facades/index.js +2 -2
  215. package/dist/facades/index.js.map +1 -1
  216. package/dist/foundation/index.js +2 -2
  217. package/dist/foundation/index.js.map +1 -1
  218. package/dist/http/index.js +2 -2
  219. package/dist/http/index.js.map +1 -1
  220. package/dist/i18n/dictionaryRuntime.js +2 -2
  221. package/dist/i18n/dictionaryRuntime.js.map +1 -1
  222. package/dist/i18n/index.js +2 -2
  223. package/dist/i18n/index.js.map +1 -1
  224. package/dist/kernel/index.js +2 -2
  225. package/dist/kernel/index.js.map +1 -1
  226. package/dist/orm/index.js +2 -2
  227. package/dist/orm/index.js.map +1 -1
  228. package/dist/probe/index.js +2 -2
  229. package/dist/probe/index.js.map +1 -1
  230. package/dist/server/index.js +2 -2
  231. package/dist/server/index.js.map +1 -1
  232. package/dist/services/index.js +2 -2
  233. package/dist/services/index.js.map +2 -2
  234. package/dist/services/queue/work.js +2 -2
  235. package/dist/services/queue/work.js.map +1 -1
  236. package/dist/services/router/ServerQueryStore.d.ts +8 -0
  237. package/dist/services/router/ServerQueryStore.d.ts.map +1 -1
  238. package/dist/stats/route-table.js +1 -1
  239. package/dist/support/index.js +2 -2
  240. package/dist/support/index.js.map +1 -1
  241. package/dist/testing/index.js +2 -2
  242. package/dist/utils/invalidation.d.ts +16 -0
  243. package/dist/utils/invalidation.d.ts.map +1 -0
  244. package/dist/vitest/index.js +1 -1
  245. package/package.json +1 -1
  246. package/dist/chunk-89egc0h3.js +0 -5
  247. package/dist/chunk-dpmvvwts.js +0 -11
  248. package/dist/chunk-kp7wcpx7.js +0 -5
  249. package/dist/chunk-qs2xvc8g.js +0 -7
  250. package/dist/chunk-zcmz311y.js +0 -8
  251. package/dist/chunks/ThemeProvider-BO3sQkWl.js.map +0 -1
  252. package/dist/chunks/mutationExtras-cPXZS6Hf.js.map +0 -1
  253. /package/dist/{chunk-6ttbhhnn.js.map → chunk-421hq1rw.js.map} +0 -0
  254. /package/dist/{chunk-k16phdjv.js.map → chunk-4qyp7w89.js.map} +0 -0
  255. /package/dist/{chunk-nzd7z4s6.js.map → chunk-70jhw0ft.js.map} +0 -0
  256. /package/dist/{chunk-4wh4dfgf.js.map → chunk-81y96dax.js.map} +0 -0
  257. /package/dist/{chunk-fxa72ppw.js.map → chunk-fjnhqbtx.js.map} +0 -0
  258. /package/dist/{chunk-dj0nvj66.js.map → chunk-pn3egz75.js.map} +0 -0
@@ -1,5 +1,5 @@
1
1
  // @bun
2
2
  var z="/api";function v(j){return j==="/api"||j.startsWith("/api/")}function B(j){return v(j)?j.slice(4):j}
3
- export{z as Jm,v as Km,B as Lm};
3
+ export{z as Km,v as Lm,B as Mm};
4
4
 
5
- //# debugId=DCA8DF1DF232F3F264756E2164756E21
5
+ //# debugId=A45485F8B46122B064756E2164756E21
@@ -5,6 +5,6 @@
5
5
  "/**\n * The prefix every api route is served under. The browser adds it when it\n * fetches (`/api${path}`) and the server strips it before matching, so an api\n * router's own paths never carry it.\n */\nexport const API_PREFIX = \"/api\";\n\n/**\n * Whether a request pathname is an api request: `/api` itself or anything\n * under `/api/`. A bare `startsWith(\"/api\")` also claims `/apidocs`,\n * `/api-keys` and `/apiary`, so a view route there would never render — the\n * api dispatcher would answer its 404 JSON instead.\n */\nexport function isApiPath(pathname: string): boolean {\n return pathname === API_PREFIX || pathname.startsWith(`${API_PREFIX}/`);\n}\n\n/**\n * The api router path a request pathname addresses: `/api/users/1` is\n * `/users/1`, `/api/` is `/` and `/api` is `\"\"`. Only the leading prefix is\n * stripped — `replace(\"/api\", \"\")` would also strip an `/api` inside the path\n * of a request that did not start with one (`/files/api` becoming `/files`).\n * A pathname outside `/api` comes back unchanged, so the dispatcher can still\n * be handed a request by its route path directly.\n */\nexport function apiPath(pathname: string): string {\n return isApiPath(pathname) ? pathname.slice(API_PREFIX.length) : pathname;\n}\n"
6
6
  ],
7
7
  "mappings": ";AAKO,IAAM,EAAa,OAQnB,SAAS,CAAS,CAAC,EAA2B,CACnD,OAAO,IATiB,QASU,EAAS,WAAW,OAAgB,EAWjE,SAAS,CAAO,CAAC,EAA0B,CAChD,OAAO,EAAU,CAAQ,EAAI,EAAS,MAAM,CAAiB,EAAI",
8
- "debugId": "DCA8DF1DF232F3F264756E2164756E21",
8
+ "debugId": "A45485F8B46122B064756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{W as re}from"./chunk-8ddt5fa2.js";import{Nm as _,Qm as a}from"./chunk-3dkv4989.js";var I=_((b)=>{Object.defineProperty(b,"__esModule",{value:!0});b.getHomeDir=void 0;var W=a("os"),V=a("path"),x={},G=()=>{if(process&&process.geteuid)return`${process.geteuid()}`;return"DEFAULT"},U=()=>{let{HOME:e,USERPROFILE:t,HOMEPATH:r,HOMEDRIVE:o=`C:${V.sep}`}=process.env;if(e)return e;if(t)return t;if(r)return`${o}${r}`;let i=G();if(!x[i])x[i]=(0,W.homedir)();return x[i]};b.getHomeDir=U});var P=_((j)=>{Object.defineProperty(j,"__esModule",{value:!0});j.getSSOTokenFilepath=void 0;var X=a("crypto"),B=a("path"),J=I(),z=(e)=>{let r=(0,X.createHash)("sha1").update(e).digest("hex");return(0,B.join)((0,J.getHomeDir)(),".aws","sso","cache",`${r}.json`)};j.getSSOTokenFilepath=z});var R=_((C)=>{Object.defineProperty(C,"__esModule",{value:!0});C.getSSOTokenFromFile=C.tokenIntercept=void 0;var Q=a("fs/promises"),Y=P();C.tokenIntercept={};var Z=async(e)=>{if(C.tokenIntercept[e])return C.tokenIntercept[e];let t=(0,Y.getSSOTokenFilepath)(e),r=await(0,Q.readFile)(t,"utf8");return JSON.parse(r)};C.getSSOTokenFromFile=Z});var k=_((L)=>{Object.defineProperty(L,"__esModule",{value:!0});L.readFile=L.fileIntercept=L.filePromises=void 0;var ee=a("fs/promises");L.filePromises={};L.fileIntercept={};var te=(e,t)=>{if(L.fileIntercept[e]!==void 0)return L.fileIntercept[e];if(!L.filePromises[e]||t?.ignoreCache)L.filePromises[e]=(0,ee.readFile)(e,"utf8");return L.filePromises[e]};L.readFile=te});var ye=_((c)=>{var l=I(),O=P(),y=R(),g=a("path"),S=re(),f=k(),q="AWS_PROFILE",$="default",oe=(e)=>e.profile||process.env[q]||$,p=".",ie=(e)=>Object.entries(e).filter(([t])=>{let r=t.indexOf(p);if(r===-1)return!1;return Object.values(S.IniSectionType).includes(t.substring(0,r))}).reduce((t,[r,o])=>{let i=r.indexOf(p),n=r.substring(0,i)===S.IniSectionType.PROFILE?r.substring(i+1):r;return t[n]=o,t},{...e.default&&{default:e.default}}),ne="AWS_CONFIG_FILE",M=()=>process.env[ne]||g.join(l.getHomeDir(),".aws","config"),se="AWS_SHARED_CREDENTIALS_FILE",ce=()=>process.env[se]||g.join(l.getHomeDir(),".aws","credentials"),ae=/^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/,le=["__proto__","profile __proto__"],T=(e)=>{let t={},r,o;for(let i of e.split(/\r?\n/)){let n=i.split(/(^|\s)[;#]/)[0].trim();if(n[0]==="["&&n[n.length-1]==="]"){r=void 0,o=void 0;let s=n.substring(1,n.length-1),u=ae.exec(s);if(u){let[,d,,m]=u;if(Object.values(S.IniSectionType).includes(d))r=[d,m].join(p)}else r=s;if(le.includes(s))throw Error(`Found invalid profile name "${s}"`)}else if(r){let s=n.indexOf("=");if(![0,-1].includes(s)){let[u,d]=[n.substring(0,s).trim(),n.substring(s+1).trim()];if(d==="")o=u;else{if(o&&i.trimStart()===i)o=void 0;t[r]=t[r]||{};let m=o?[o,u].join(p):u;t[r][m]=d}}}}return t},A=()=>({}),K=async(e={})=>{let{filepath:t=ce(),configFilepath:r=M()}=e,o=l.getHomeDir(),i="~/",n=t;if(t.startsWith("~/"))n=g.join(o,t.slice(2));let h=r;if(r.startsWith("~/"))h=g.join(o,r.slice(2));let s=await Promise.all([f.readFile(h,{ignoreCache:e.ignoreCache}).then(T).then(ie).catch(A),f.readFile(n,{ignoreCache:e.ignoreCache}).then(T).catch(A)]);return{configFile:s[0],credentialsFile:s[1]}},pe=(e)=>Object.entries(e).filter(([t])=>t.startsWith(S.IniSectionType.SSO_SESSION+p)).reduce((t,[r,o])=>({...t,[r.substring(r.indexOf(p)+1)]:o}),{}),ue=()=>({}),fe=async(e={})=>f.readFile(e.configFilepath??M()).then(T).then(pe).catch(ue),de=(...e)=>{let t={};for(let r of e)for(let[o,i]of Object.entries(r))if(t[o]!==void 0)Object.assign(t[o],i);else t[o]=i;return t},_e=async(e)=>{let t=await K(e);return de(t.configFile,t.credentialsFile)},Fe={getFileRecord(){return f.fileIntercept},interceptFile(e,t){f.fileIntercept[e]=Promise.resolve(t)},getTokenRecord(){return y.tokenIntercept},interceptToken(e,t){y.tokenIntercept[e]=t}};c.getSSOTokenFromFile=y.getSSOTokenFromFile;c.readFile=f.readFile;c.CONFIG_PREFIX_SEPARATOR=p;c.DEFAULT_PROFILE=$;c.ENV_PROFILE=q;c.externalDataInterceptor=Fe;c.getProfileName=oe;c.loadSharedConfigFiles=K;c.loadSsoSessionData=fe;c.parseKnownFiles=_e;Object.prototype.hasOwnProperty.call(l,"__proto__")&&!Object.prototype.hasOwnProperty.call(c,"__proto__")&&Object.defineProperty(c,"__proto__",{enumerable:!0,value:l.__proto__});Object.keys(l).forEach(function(e){if(e!=="default"&&!Object.prototype.hasOwnProperty.call(c,e))c[e]=l[e]});Object.prototype.hasOwnProperty.call(O,"__proto__")&&!Object.prototype.hasOwnProperty.call(c,"__proto__")&&Object.defineProperty(c,"__proto__",{enumerable:!0,value:O.__proto__});Object.keys(O).forEach(function(e){if(e!=="default"&&!Object.prototype.hasOwnProperty.call(c,e))c[e]=O[e]})});
2
+ import{W as re}from"./chunk-x93dpv6e.js";import{Om as _,Rm as a}from"./chunk-ads3c8m0.js";var I=_((b)=>{Object.defineProperty(b,"__esModule",{value:!0});b.getHomeDir=void 0;var W=a("os"),V=a("path"),x={},G=()=>{if(process&&process.geteuid)return`${process.geteuid()}`;return"DEFAULT"},U=()=>{let{HOME:e,USERPROFILE:t,HOMEPATH:r,HOMEDRIVE:o=`C:${V.sep}`}=process.env;if(e)return e;if(t)return t;if(r)return`${o}${r}`;let i=G();if(!x[i])x[i]=(0,W.homedir)();return x[i]};b.getHomeDir=U});var P=_((j)=>{Object.defineProperty(j,"__esModule",{value:!0});j.getSSOTokenFilepath=void 0;var X=a("crypto"),B=a("path"),J=I(),z=(e)=>{let r=(0,X.createHash)("sha1").update(e).digest("hex");return(0,B.join)((0,J.getHomeDir)(),".aws","sso","cache",`${r}.json`)};j.getSSOTokenFilepath=z});var R=_((C)=>{Object.defineProperty(C,"__esModule",{value:!0});C.getSSOTokenFromFile=C.tokenIntercept=void 0;var Q=a("fs/promises"),Y=P();C.tokenIntercept={};var Z=async(e)=>{if(C.tokenIntercept[e])return C.tokenIntercept[e];let t=(0,Y.getSSOTokenFilepath)(e),r=await(0,Q.readFile)(t,"utf8");return JSON.parse(r)};C.getSSOTokenFromFile=Z});var k=_((L)=>{Object.defineProperty(L,"__esModule",{value:!0});L.readFile=L.fileIntercept=L.filePromises=void 0;var ee=a("fs/promises");L.filePromises={};L.fileIntercept={};var te=(e,t)=>{if(L.fileIntercept[e]!==void 0)return L.fileIntercept[e];if(!L.filePromises[e]||t?.ignoreCache)L.filePromises[e]=(0,ee.readFile)(e,"utf8");return L.filePromises[e]};L.readFile=te});var ye=_((c)=>{var l=I(),O=P(),y=R(),g=a("path"),S=re(),f=k(),q="AWS_PROFILE",$="default",oe=(e)=>e.profile||process.env[q]||$,p=".",ie=(e)=>Object.entries(e).filter(([t])=>{let r=t.indexOf(p);if(r===-1)return!1;return Object.values(S.IniSectionType).includes(t.substring(0,r))}).reduce((t,[r,o])=>{let i=r.indexOf(p),n=r.substring(0,i)===S.IniSectionType.PROFILE?r.substring(i+1):r;return t[n]=o,t},{...e.default&&{default:e.default}}),ne="AWS_CONFIG_FILE",M=()=>process.env[ne]||g.join(l.getHomeDir(),".aws","config"),se="AWS_SHARED_CREDENTIALS_FILE",ce=()=>process.env[se]||g.join(l.getHomeDir(),".aws","credentials"),ae=/^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/,le=["__proto__","profile __proto__"],T=(e)=>{let t={},r,o;for(let i of e.split(/\r?\n/)){let n=i.split(/(^|\s)[;#]/)[0].trim();if(n[0]==="["&&n[n.length-1]==="]"){r=void 0,o=void 0;let s=n.substring(1,n.length-1),u=ae.exec(s);if(u){let[,d,,m]=u;if(Object.values(S.IniSectionType).includes(d))r=[d,m].join(p)}else r=s;if(le.includes(s))throw Error(`Found invalid profile name "${s}"`)}else if(r){let s=n.indexOf("=");if(![0,-1].includes(s)){let[u,d]=[n.substring(0,s).trim(),n.substring(s+1).trim()];if(d==="")o=u;else{if(o&&i.trimStart()===i)o=void 0;t[r]=t[r]||{};let m=o?[o,u].join(p):u;t[r][m]=d}}}}return t},A=()=>({}),K=async(e={})=>{let{filepath:t=ce(),configFilepath:r=M()}=e,o=l.getHomeDir(),i="~/",n=t;if(t.startsWith("~/"))n=g.join(o,t.slice(2));let h=r;if(r.startsWith("~/"))h=g.join(o,r.slice(2));let s=await Promise.all([f.readFile(h,{ignoreCache:e.ignoreCache}).then(T).then(ie).catch(A),f.readFile(n,{ignoreCache:e.ignoreCache}).then(T).catch(A)]);return{configFile:s[0],credentialsFile:s[1]}},pe=(e)=>Object.entries(e).filter(([t])=>t.startsWith(S.IniSectionType.SSO_SESSION+p)).reduce((t,[r,o])=>({...t,[r.substring(r.indexOf(p)+1)]:o}),{}),ue=()=>({}),fe=async(e={})=>f.readFile(e.configFilepath??M()).then(T).then(pe).catch(ue),de=(...e)=>{let t={};for(let r of e)for(let[o,i]of Object.entries(r))if(t[o]!==void 0)Object.assign(t[o],i);else t[o]=i;return t},_e=async(e)=>{let t=await K(e);return de(t.configFile,t.credentialsFile)},Fe={getFileRecord(){return f.fileIntercept},interceptFile(e,t){f.fileIntercept[e]=Promise.resolve(t)},getTokenRecord(){return y.tokenIntercept},interceptToken(e,t){y.tokenIntercept[e]=t}};c.getSSOTokenFromFile=y.getSSOTokenFromFile;c.readFile=f.readFile;c.CONFIG_PREFIX_SEPARATOR=p;c.DEFAULT_PROFILE=$;c.ENV_PROFILE=q;c.externalDataInterceptor=Fe;c.getProfileName=oe;c.loadSharedConfigFiles=K;c.loadSsoSessionData=fe;c.parseKnownFiles=_e;Object.prototype.hasOwnProperty.call(l,"__proto__")&&!Object.prototype.hasOwnProperty.call(c,"__proto__")&&Object.defineProperty(c,"__proto__",{enumerable:!0,value:l.__proto__});Object.keys(l).forEach(function(e){if(e!=="default"&&!Object.prototype.hasOwnProperty.call(c,e))c[e]=l[e]});Object.prototype.hasOwnProperty.call(O,"__proto__")&&!Object.prototype.hasOwnProperty.call(c,"__proto__")&&Object.defineProperty(c,"__proto__",{enumerable:!0,value:O.__proto__});Object.keys(O).forEach(function(e){if(e!=="default"&&!Object.prototype.hasOwnProperty.call(c,e))c[e]=O[e]})});
3
3
  export{ye as V};
4
4
 
5
- //# debugId=72A70CEEAD40466964756E2164756E21
5
+ //# debugId=CA740150EA16AEEC64756E2164756E21
@@ -9,6 +9,6 @@
9
9
  "'use strict';\n\nvar getHomeDir = require('./getHomeDir');\nvar getSSOTokenFilepath = require('./getSSOTokenFilepath');\nvar getSSOTokenFromFile = require('./getSSOTokenFromFile');\nvar path = require('path');\nvar types = require('@smithy/types');\nvar readFile = require('./readFile');\n\nconst ENV_PROFILE = \"AWS_PROFILE\";\nconst DEFAULT_PROFILE = \"default\";\nconst getProfileName = (init) => init.profile || process.env[ENV_PROFILE] || DEFAULT_PROFILE;\n\nconst CONFIG_PREFIX_SEPARATOR = \".\";\n\nconst getConfigData = (data) => Object.entries(data)\n .filter(([key]) => {\n const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR);\n if (indexOfSeparator === -1) {\n return false;\n }\n return Object.values(types.IniSectionType).includes(key.substring(0, indexOfSeparator));\n})\n .reduce((acc, [key, value]) => {\n const indexOfSeparator = key.indexOf(CONFIG_PREFIX_SEPARATOR);\n const updatedKey = key.substring(0, indexOfSeparator) === types.IniSectionType.PROFILE ? key.substring(indexOfSeparator + 1) : key;\n acc[updatedKey] = value;\n return acc;\n}, {\n ...(data.default && { default: data.default }),\n});\n\nconst ENV_CONFIG_PATH = \"AWS_CONFIG_FILE\";\nconst getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || path.join(getHomeDir.getHomeDir(), \".aws\", \"config\");\n\nconst ENV_CREDENTIALS_PATH = \"AWS_SHARED_CREDENTIALS_FILE\";\nconst getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || path.join(getHomeDir.getHomeDir(), \".aws\", \"credentials\");\n\nconst prefixKeyRegex = /^([\\w-]+)\\s([\"'])?([\\w-@\\+\\.%:/]+)\\2$/;\nconst profileNameBlockList = [\"__proto__\", \"profile __proto__\"];\nconst parseIni = (iniData) => {\n const map = {};\n let currentSection;\n let currentSubSection;\n for (const iniLine of iniData.split(/\\r?\\n/)) {\n const trimmedLine = iniLine.split(/(^|\\s)[;#]/)[0].trim();\n const isSection = trimmedLine[0] === \"[\" && trimmedLine[trimmedLine.length - 1] === \"]\";\n if (isSection) {\n currentSection = undefined;\n currentSubSection = undefined;\n const sectionName = trimmedLine.substring(1, trimmedLine.length - 1);\n const matches = prefixKeyRegex.exec(sectionName);\n if (matches) {\n const [, prefix, , name] = matches;\n if (Object.values(types.IniSectionType).includes(prefix)) {\n currentSection = [prefix, name].join(CONFIG_PREFIX_SEPARATOR);\n }\n }\n else {\n currentSection = sectionName;\n }\n if (profileNameBlockList.includes(sectionName)) {\n throw new Error(`Found invalid profile name \"${sectionName}\"`);\n }\n }\n else if (currentSection) {\n const indexOfEqualsSign = trimmedLine.indexOf(\"=\");\n if (![0, -1].includes(indexOfEqualsSign)) {\n const [name, value] = [\n trimmedLine.substring(0, indexOfEqualsSign).trim(),\n trimmedLine.substring(indexOfEqualsSign + 1).trim(),\n ];\n if (value === \"\") {\n currentSubSection = name;\n }\n else {\n if (currentSubSection && iniLine.trimStart() === iniLine) {\n currentSubSection = undefined;\n }\n map[currentSection] = map[currentSection] || {};\n const key = currentSubSection ? [currentSubSection, name].join(CONFIG_PREFIX_SEPARATOR) : name;\n map[currentSection][key] = value;\n }\n }\n }\n }\n return map;\n};\n\nconst swallowError$1 = () => ({});\nconst loadSharedConfigFiles = async (init = {}) => {\n const { filepath = getCredentialsFilepath(), configFilepath = getConfigFilepath() } = init;\n const homeDir = getHomeDir.getHomeDir();\n const relativeHomeDirPrefix = \"~/\";\n let resolvedFilepath = filepath;\n if (filepath.startsWith(relativeHomeDirPrefix)) {\n resolvedFilepath = path.join(homeDir, filepath.slice(2));\n }\n let resolvedConfigFilepath = configFilepath;\n if (configFilepath.startsWith(relativeHomeDirPrefix)) {\n resolvedConfigFilepath = path.join(homeDir, configFilepath.slice(2));\n }\n const parsedFiles = await Promise.all([\n readFile.readFile(resolvedConfigFilepath, {\n ignoreCache: init.ignoreCache,\n })\n .then(parseIni)\n .then(getConfigData)\n .catch(swallowError$1),\n readFile.readFile(resolvedFilepath, {\n ignoreCache: init.ignoreCache,\n })\n .then(parseIni)\n .catch(swallowError$1),\n ]);\n return {\n configFile: parsedFiles[0],\n credentialsFile: parsedFiles[1],\n };\n};\n\nconst getSsoSessionData = (data) => Object.entries(data)\n .filter(([key]) => key.startsWith(types.IniSectionType.SSO_SESSION + CONFIG_PREFIX_SEPARATOR))\n .reduce((acc, [key, value]) => ({ ...acc, [key.substring(key.indexOf(CONFIG_PREFIX_SEPARATOR) + 1)]: value }), {});\n\nconst swallowError = () => ({});\nconst loadSsoSessionData = async (init = {}) => readFile.readFile(init.configFilepath ?? getConfigFilepath())\n .then(parseIni)\n .then(getSsoSessionData)\n .catch(swallowError);\n\nconst mergeConfigFiles = (...files) => {\n const merged = {};\n for (const file of files) {\n for (const [key, values] of Object.entries(file)) {\n if (merged[key] !== undefined) {\n Object.assign(merged[key], values);\n }\n else {\n merged[key] = values;\n }\n }\n }\n return merged;\n};\n\nconst parseKnownFiles = async (init) => {\n const parsedFiles = await loadSharedConfigFiles(init);\n return mergeConfigFiles(parsedFiles.configFile, parsedFiles.credentialsFile);\n};\n\nconst externalDataInterceptor = {\n getFileRecord() {\n return readFile.fileIntercept;\n },\n interceptFile(path, contents) {\n readFile.fileIntercept[path] = Promise.resolve(contents);\n },\n getTokenRecord() {\n return getSSOTokenFromFile.tokenIntercept;\n },\n interceptToken(id, contents) {\n getSSOTokenFromFile.tokenIntercept[id] = contents;\n },\n};\n\nexports.getSSOTokenFromFile = getSSOTokenFromFile.getSSOTokenFromFile;\nexports.readFile = readFile.readFile;\nexports.CONFIG_PREFIX_SEPARATOR = CONFIG_PREFIX_SEPARATOR;\nexports.DEFAULT_PROFILE = DEFAULT_PROFILE;\nexports.ENV_PROFILE = ENV_PROFILE;\nexports.externalDataInterceptor = externalDataInterceptor;\nexports.getProfileName = getProfileName;\nexports.loadSharedConfigFiles = loadSharedConfigFiles;\nexports.loadSsoSessionData = loadSsoSessionData;\nexports.parseKnownFiles = parseKnownFiles;\nObject.prototype.hasOwnProperty.call(getHomeDir, '__proto__') &&\n !Object.prototype.hasOwnProperty.call(exports, '__proto__') &&\n Object.defineProperty(exports, '__proto__', {\n enumerable: true,\n value: getHomeDir['__proto__']\n });\n\nObject.keys(getHomeDir).forEach(function (k) {\n if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = getHomeDir[k];\n});\nObject.prototype.hasOwnProperty.call(getSSOTokenFilepath, '__proto__') &&\n !Object.prototype.hasOwnProperty.call(exports, '__proto__') &&\n Object.defineProperty(exports, '__proto__', {\n enumerable: true,\n value: getSSOTokenFilepath['__proto__']\n });\n\nObject.keys(getSSOTokenFilepath).forEach(function (k) {\n if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = getSSOTokenFilepath[k];\n});\n"
10
10
  ],
11
11
  "mappings": ";8GACA,CAAO,eAAe,EAAS,aAAc,CAAE,MAAO,EAAK,CAAC,EACpD,aAAkB,OAC1B,IAAM,UACA,YACA,EAAe,CAAC,EAChB,EAAqB,IAAM,CAC7B,GAAI,SAAW,QAAQ,QACnB,MAAO,GAAG,QAAQ,QAAQ,IAE9B,MAAO,WAEL,EAAa,IAAM,CACrB,IAAQ,OAAM,cAAa,WAAU,YAAY,KAAK,EAAO,OAAU,QAAQ,IAC/E,GAAI,EACA,OAAO,EACX,GAAI,EACA,OAAO,EACX,GAAI,EACA,MAAO,GAAG,IAAY,IAC1B,IAAM,EAAkB,EAAmB,EAC3C,GAAI,CAAC,EAAa,GACd,EAAa,IAAoB,EAAG,EAAK,SAAS,EACtD,OAAO,EAAa,IAEhB,aAAa,kBCxBrB,OAAO,eAAe,EAAS,aAAc,CAAE,MAAO,EAAK,CAAC,EACpD,sBAA2B,OACnC,IAAM,cACA,YACA,MACA,EAAsB,CAAC,IAAO,CAEhC,IAAM,GADU,EAAG,EAAS,YAAY,MAAM,EACrB,OAAO,CAAE,EAAE,OAAO,KAAK,EAChD,OAAQ,EAAG,EAAO,OAAO,EAAG,EAAa,YAAY,EAAG,OAAQ,MAAO,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CAAC,OAAO,UAAU,eAAe,KAAK,EAAS,CAAC,EAAG,EAAQ,GAAK,EAAoB,GAC9G",
12
- "debugId": "72A70CEEAD40466964756E2164756E21",
12
+ "debugId": "CA740150EA16AEEC64756E2164756E21",
13
13
  "names": []
14
14
  }
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{V as F}from"./chunk-fp9yn4k8.js";import{Y as w}from"./chunk-ncnygh0s.js";import{Nm as h}from"./chunk-3dkv4989.js";var P=h((p)=>{var t=w(),l=F();function d(e){try{let o=new Set(Array.from(e.match(/([A-Z_]){3,}/g)??[]));return o.delete("CONFIG"),o.delete("CONFIG_PREFIX_SEPARATOR"),o.delete("ENV"),[...o].join(", ")}catch(o){return e}}var u=(e,o)=>async()=>{try{let r=e(process.env,o);if(r===void 0)throw Error();return r}catch(r){throw new t.CredentialsProviderError(r.message||`Not found in ENV: ${d(e.toString())}`,{logger:o?.logger})}},C=(e,{preferredFile:o="config",...r}={})=>async()=>{let n=l.getProfileName(r),{configFile:i,credentialsFile:c}=await l.loadSharedConfigFiles(r),s=c[n]||{},g=i[n]||{},m=o==="config"?{...s,...g}:{...g,...s};try{let f=e(m,o==="config"?i:c);if(f===void 0)throw Error();return f}catch(a){throw new t.CredentialsProviderError(a.message||`Not found in config files w/ profile [${n}]: ${d(e.toString())}`,{logger:r.logger})}},y=(e)=>typeof e==="function",E=(e)=>y(e)?async()=>await e():t.fromStatic(e),N=({environmentVariableSelector:e,configFileSelector:o,default:r},n={})=>{let{signingName:i,logger:c}=n,s={signingName:i,logger:c};return t.memoize(t.chain(u(e,s),C(o,n),E(r)))};p.loadConfig=N});
2
+ import{V as F}from"./chunk-rq0dpv7r.js";import{Y as w}from"./chunk-t9fh0ptd.js";import{Om as h}from"./chunk-ads3c8m0.js";var P=h((p)=>{var t=w(),l=F();function d(e){try{let o=new Set(Array.from(e.match(/([A-Z_]){3,}/g)??[]));return o.delete("CONFIG"),o.delete("CONFIG_PREFIX_SEPARATOR"),o.delete("ENV"),[...o].join(", ")}catch(o){return e}}var u=(e,o)=>async()=>{try{let r=e(process.env,o);if(r===void 0)throw Error();return r}catch(r){throw new t.CredentialsProviderError(r.message||`Not found in ENV: ${d(e.toString())}`,{logger:o?.logger})}},C=(e,{preferredFile:o="config",...r}={})=>async()=>{let n=l.getProfileName(r),{configFile:i,credentialsFile:c}=await l.loadSharedConfigFiles(r),s=c[n]||{},g=i[n]||{},m=o==="config"?{...s,...g}:{...g,...s};try{let f=e(m,o==="config"?i:c);if(f===void 0)throw Error();return f}catch(a){throw new t.CredentialsProviderError(a.message||`Not found in config files w/ profile [${n}]: ${d(e.toString())}`,{logger:r.logger})}},y=(e)=>typeof e==="function",E=(e)=>y(e)?async()=>await e():t.fromStatic(e),N=({environmentVariableSelector:e,configFileSelector:o,default:r},n={})=>{let{signingName:i,logger:c}=n,s={signingName:i,logger:c};return t.memoize(t.chain(u(e,s),C(o,n),E(r)))};p.loadConfig=N});
3
3
  export{P as D};
4
4
 
5
- //# debugId=3BD938494925171A64756E2164756E21
5
+ //# debugId=BAF3582D8190221064756E2164756E21
@@ -5,6 +5,6 @@
5
5
  "'use strict';\n\nvar propertyProvider = require('@smithy/property-provider');\nvar sharedIniFileLoader = require('@smithy/shared-ini-file-loader');\n\nfunction getSelectorName(functionString) {\n try {\n const constants = new Set(Array.from(functionString.match(/([A-Z_]){3,}/g) ?? []));\n constants.delete(\"CONFIG\");\n constants.delete(\"CONFIG_PREFIX_SEPARATOR\");\n constants.delete(\"ENV\");\n return [...constants].join(\", \");\n }\n catch (e) {\n return functionString;\n }\n}\n\nconst fromEnv = (envVarSelector, options) => async () => {\n try {\n const config = envVarSelector(process.env, options);\n if (config === undefined) {\n throw new Error();\n }\n return config;\n }\n catch (e) {\n throw new propertyProvider.CredentialsProviderError(e.message || `Not found in ENV: ${getSelectorName(envVarSelector.toString())}`, { logger: options?.logger });\n }\n};\n\nconst fromSharedConfigFiles = (configSelector, { preferredFile = \"config\", ...init } = {}) => async () => {\n const profile = sharedIniFileLoader.getProfileName(init);\n const { configFile, credentialsFile } = await sharedIniFileLoader.loadSharedConfigFiles(init);\n const profileFromCredentials = credentialsFile[profile] || {};\n const profileFromConfig = configFile[profile] || {};\n const mergedProfile = preferredFile === \"config\"\n ? { ...profileFromCredentials, ...profileFromConfig }\n : { ...profileFromConfig, ...profileFromCredentials };\n try {\n const cfgFile = preferredFile === \"config\" ? configFile : credentialsFile;\n const configValue = configSelector(mergedProfile, cfgFile);\n if (configValue === undefined) {\n throw new Error();\n }\n return configValue;\n }\n catch (e) {\n throw new propertyProvider.CredentialsProviderError(e.message || `Not found in config files w/ profile [${profile}]: ${getSelectorName(configSelector.toString())}`, { logger: init.logger });\n }\n};\n\nconst isFunction = (func) => typeof func === \"function\";\nconst fromStatic = (defaultValue) => isFunction(defaultValue) ? async () => await defaultValue() : propertyProvider.fromStatic(defaultValue);\n\nconst loadConfig = ({ environmentVariableSelector, configFileSelector, default: defaultValue }, configuration = {}) => {\n const { signingName, logger } = configuration;\n const envOptions = { signingName, logger };\n return propertyProvider.memoize(propertyProvider.chain(fromEnv(environmentVariableSelector, envOptions), fromSharedConfigFiles(configFileSelector, configuration), fromStatic(defaultValue)));\n};\n\nexports.loadConfig = loadConfig;\n"
6
6
  ],
7
7
  "mappings": ";mJAEA,FAAI,AACA,MAEJ,SAAS,CAAe,CAAC,EAAgB,CACrC,GAAI,CACA,IAAM,EAAY,IAAI,IAAI,MAAM,KAAK,EAAe,MAAM,eAAe,GAAK,CAAC,CAAC,CAAC,EAIjF,OAHA,EAAU,OAAO,QAAQ,EACzB,EAAU,OAAO,yBAAyB,EAC1C,EAAU,OAAO,KAAK,EACf,CAAC,GAAG,CAAS,EAAE,KAAK,IAAI,EAEnC,MAAO,EAAG,CACN,OAAO,GAIf,IAAM,EAAU,CAAC,EAAgB,IAAY,SAAY,CACrD,GAAI,CACA,IAAM,EAAS,EAAe,QAAQ,IAAK,CAAO,EAClD,GAAI,IAAW,OACX,MAAU,MAAM,EAEpB,OA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";import{pl as A,rl as B}from"./chunk-0av1gyns.js";async function K(O,L={}){let P=typeof O==="string"?$(O):O,C=P.$schema,M=[...F(C)];if(M.length===0)throw Error(`${C.name} has no encrypted columns (mark a String field /// @gemi.encrypted).`);let D=C.primaryKey;if(D.length===0)throw Error(`${C.name} has no primary key, so its rows cannot be rewritten one by one.`);let N=R(),V=Math.max(1,Math.floor(L.batchSize??500)),j={model:C.name,fields:M,scanned:0,rotated:0,skipped:0,plaintext:0},X=T({}),W=Object.fromEntries([...D,...M].map((q)=>[q,!0])),k=D.map((q)=>({[q]:"asc"})),J=D.length===1?D[0]:void 0;return await A(()=>B(C.name,"with",async()=>{let q=void 0,Y=0;for(;;){let G=await P.$exec("findMany",{select:W,orderBy:k,take:V,...J!==void 0&&q!==void 0?{where:{[J]:{gt:q}}}:{},...J===void 0?{skip:Y}:{}},X);if(G.length===0)break;for(let Z of G){j.scanned+=1;let Q={},U={};for(let H of D)U[H]=Z[H];for(let H of M){let I=Z[H];if(typeof I!=="string"||!N.needsReencryption(I))continue;let _=N.isEncrypted(I);if(!_&&!L.encryptPlaintext){j.plaintext+=1;continue}let z=_?N.decrypt(I):I;Q[H]=N.encrypt(z),U[H]=I}if(Object.keys(Q).length===0)continue;if(L.dryRun){j.rotated+=1;continue}let{count:x}=await P.$exec("updateMany",{where:U,data:Q},X);if(x===1)j.rotated+=1;else j.skipped+=1}if(L.onBatch?.({...j}),G.length<V)break;if(J!==void 0)q=G[G.length-1][J];else Y+=G.length}})),j}
2
+ import{$j as $,fk as F,hk as R,ik as T}from"./chunk-mca5s0bf.js";import{ql as A,sl as B}from"./chunk-mvp6fkg2.js";async function K(O,L={}){let P=typeof O==="string"?$(O):O,C=P.$schema,M=[...F(C)];if(M.length===0)throw Error(`${C.name} has no encrypted columns (mark a String field /// @gemi.encrypted).`);let D=C.primaryKey;if(D.length===0)throw Error(`${C.name} has no primary key, so its rows cannot be rewritten one by one.`);let N=R(),V=Math.max(1,Math.floor(L.batchSize??500)),j={model:C.name,fields:M,scanned:0,rotated:0,skipped:0,plaintext:0},X=T({}),W=Object.fromEntries([...D,...M].map((q)=>[q,!0])),k=D.map((q)=>({[q]:"asc"})),J=D.length===1?D[0]:void 0;return await A(()=>B(C.name,"with",async()=>{let q=void 0,Y=0;for(;;){let G=await P.$exec("findMany",{select:W,orderBy:k,take:V,...J!==void 0&&q!==void 0?{where:{[J]:{gt:q}}}:{},...J===void 0?{skip:Y}:{}},X);if(G.length===0)break;for(let Z of G){j.scanned+=1;let Q={},U={};for(let H of D)U[H]=Z[H];for(let H of M){let I=Z[H];if(typeof I!=="string"||!N.needsReencryption(I))continue;let _=N.isEncrypted(I);if(!_&&!L.encryptPlaintext){j.plaintext+=1;continue}let z=_?N.decrypt(I):I;Q[H]=N.encrypt(z),U[H]=I}if(Object.keys(Q).length===0)continue;if(L.dryRun){j.rotated+=1;continue}let{count:x}=await P.$exec("updateMany",{where:U,data:Q},X);if(x===1)j.rotated+=1;else j.skipped+=1}if(L.onBatch?.({...j}),G.length<V)break;if(J!==void 0)q=G[G.length-1][J];else Y+=G.length}})),j}
3
3
  export{K as qa};
4
4
 
5
- //# debugId=EAA4D70C2AF6A71664756E2164756E21
5
+ //# debugId=BE337976A8EE055764756E2164756E21
@@ -5,6 +5,6 @@
5
5
  "import { runAsSystem, runWithTrashed } from \"./context\";\nimport { currentEncrypter, encryptedFields, markEncryptionRaw } from \"./encryption\";\nimport type { Model } from \"./Model\";\nimport * as registry from \"./registry\";\nimport type { ModelSchema } from \"./schema\";\n\nexport interface RotateEncryptionOptions {\n /** Rows read and rewritten per round trip. Default 500. */\n batchSize?: number;\n /** Count what would be re-encrypted, and write nothing. */\n dryRun?: boolean;\n /**\n * Also encrypt values that are not encrypted at all — the rows a column held\n * before it was marked `@gemi.encrypted`. Off by default, so a value that is\n * not an envelope is reported rather than silently treated as plaintext.\n */\n encryptPlaintext?: boolean;\n /** Called after each batch, for progress output. */\n onBatch?: (report: RotateEncryptionReport) => void;\n}\n\nexport interface RotateEncryptionReport {\n model: string;\n fields: string[];\n /** Rows read. */\n scanned: number;\n /** Rows rewritten (or, on a dry run, that would be). */\n rotated: number;\n /** Rows a concurrent write changed between the read and the rewrite; already current. */\n skipped: number;\n /** Values that are not envelopes, left alone because `encryptPlaintext` is off. */\n plaintext: number;\n}\n\n/**\n * Re-encrypts `model`'s encrypted columns under the current key: every value\n * still under an older key and, with `encryptPlaintext`, every value not\n * encrypted yet. What `gemi run encryption:rotate` runs.\n *\n * Walks the table in primary-key order in batches, so it can run against a\n * live database and be re-run safely: each row is rewritten with a\n * compare-and-swap on the values it read, so a row written concurrently (and\n * therefore already under the current key) is skipped rather than\n * overwritten. Runs as the system (no policies) and includes soft-deleted\n * rows — they are still encrypted with the old key.\n *\n * Remove the old key from `encryption.keys` only after this reports nothing\n * left to rotate.\n */\nexport async function rotateEncryptedColumns(\n model: string | typeof Model,\n options: RotateEncryptionOptions = {},\n): Promise<RotateEncryptionReport> {\n const target = (typeof model === \"string\" ? registry.get<typeof Model>(model) : model) as typeof Model & {\n $exec: typeof Model.$exec;\n };\n const schema: ModelSchema = target.$schema;\n const fields = [...encryptedFields(schema)];\n if (fields.length === 0) {\n throw new Error(`${schema.name} has no encrypted columns (mark a String field /// @gemi.encrypted).`);\n }\n const primaryKey = schema.primaryKey;\n if (primaryKey.length === 0) {\n throw new Error(`${schema.name} has no primary key, so its rows cannot be rewritten one by one.`);\n }\n\n const encrypter = currentEncrypter();\n const batchSize = Math.max(1, Math.floor(options.batchSize ?? 500));\n const report: RotateEncryptionReport = {\n model: schema.name,\n fields,\n scanned: 0,\n rotated: 0,\n skipped: 0,\n plaintext: 0,\n };\n\n const raw = markEncryptionRaw({});\n const select = Object.fromEntries([...primaryKey, ...fields].map((name) => [name, true]));\n const orderBy = primaryKey.map((name) => ({ [name]: \"asc\" }));\n const single = primaryKey.length === 1 ? primaryKey[0] : undefined;\n\n await runAsSystem(() =>\n runWithTrashed(schema.name, \"with\", async () => {\n let after: unknown = undefined;\n let offset = 0;\n\n for (;;) {\n // Keyset pagination on a single-column key, so a rewrite never moves a\n // row across a page boundary. A compound key pages by offset, which is\n // stable here because rewriting a column does not change the key.\n const rows = (await target.$exec(\n \"findMany\",\n {\n select,\n orderBy,\n take: batchSize,\n ...(single !== undefined && after !== undefined ? { where: { [single]: { gt: after } } } : {}),\n ...(single === undefined ? { skip: offset } : {}),\n },\n raw,\n )) as Record<string, unknown>[];\n if (rows.length === 0) break;\n\n for (const row of rows) {\n report.scanned += 1;\n const data: Record<string, string> = {};\n const where: Record<string, unknown> = {};\n for (const name of primaryKey) where[name] = row[name];\n\n for (const field of fields) {\n const value = row[field];\n if (typeof value !== \"string\" || !encrypter.needsReencryption(value)) continue;\n const isEnvelope = encrypter.isEncrypted(value);\n if (!isEnvelope && !options.encryptPlaintext) {\n report.plaintext += 1;\n continue;\n }\n const plaintext = isEnvelope ? encrypter.decrypt(value) : value;\n data[field] = encrypter.encrypt(plaintext);\n where[field] = value;\n }\n\n if (Object.keys(data).length === 0) continue;\n if (options.dryRun) {\n report.rotated += 1;\n continue;\n }\n const { count } = (await target.$exec(\"updateMany\", { where, data }, raw)) as {\n count: number;\n };\n if (count === 1) report.rotated += 1;\n else report.skipped += 1;\n }\n\n options.onBatch?.({ ...report });\n if (rows.length < batchSize) break;\n if (single !== undefined) after = rows[rows.length - 1][single];\n else offset += rows.length;\n }\n }),\n );\n\n return report;\n}\n\n"
6
6
  ],
7
7
  "mappings": ";wHAiDA,SAAsB,CAAsB,CAC1C,EACA,EAAmC,CAAC,EACH,CACjC,IAAM,EAAU,OAAO,IAAU,SAAoB,EAAkB,CAAK,EAAI,EAG1E,EAAsB,EAAO,QAC7B,EAAS,CAAC,GAAG,EAAgB,CAAM,CAAC,EAC1C,GAAI,EAAO,SAAW,EACpB,MAAU,MAAM,GAAG,EAAO,0EAA0E,EAEtG,IAAM,EAAa,EAAO,WAC1B,GAAI,EAAW,SAAW,EACxB,MAAU,MAAM,GAAG,EAAO,sEAAsE,EAGl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