better-supabase 0.30.0 → 0.32.0

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 (1688) hide show
  1. package/dist/access-sql-Dao1C0fz.js +383 -0
  2. package/dist/actor-B5b0i1Fs.js +149 -0
  3. package/dist/actor-DseNR02I.d.ts +104 -0
  4. package/dist/adapter-CPPN80mx.js +2231 -0
  5. package/dist/agents-BEiBtYmh.d.ts +115 -0
  6. package/dist/ai-cache-D9D36eh4.js +86 -0
  7. package/dist/ai-cache-FMYzw7lW.d.ts +80 -0
  8. package/dist/ai-chat-B_P--Ie2.d.ts +532 -0
  9. package/dist/ai-files-DCMVGSds.js +337 -0
  10. package/dist/ai-message-cnroprVB.js +13 -0
  11. package/dist/ai-schedules-D_q1iclL.d.ts +164 -0
  12. package/dist/ai-sdk/agents/index.d.ts +8 -12
  13. package/dist/ai-sdk/agents/index.js +10 -12
  14. package/dist/ai-sdk/batches/index.d.ts +12 -7
  15. package/dist/ai-sdk/batches/index.js +16 -9
  16. package/dist/ai-sdk/cache/index.d.ts +2 -4
  17. package/dist/ai-sdk/cache/index.js +3 -4
  18. package/dist/ai-sdk/chat/index.d.ts +77 -2
  19. package/dist/ai-sdk/chat/index.js +179 -28
  20. package/dist/ai-sdk/embeddings/index.d.ts +2 -2
  21. package/dist/ai-sdk/embeddings/index.js +1 -1
  22. package/dist/ai-sdk/files/index.d.ts +3 -5
  23. package/dist/ai-sdk/files/index.js +5 -6
  24. package/dist/ai-sdk/index.d.ts +75 -21
  25. package/dist/ai-sdk/index.js +112 -66
  26. package/dist/ai-sdk/mcp/index.d.ts +28 -13
  27. package/dist/ai-sdk/mcp/index.js +56 -17
  28. package/dist/ai-sdk/memory/index.d.ts +3 -5
  29. package/dist/ai-sdk/memory/index.js +3 -4
  30. package/dist/ai-sdk/react/index.d.ts +2 -2
  31. package/dist/ai-sdk/react/index.js +3 -1
  32. package/dist/ai-sdk/react/server.d.ts +7 -4
  33. package/dist/ai-sdk/react/server.js +10 -3
  34. package/dist/ai-sdk/workflow/index.d.ts +12 -13
  35. package/dist/ai-sdk/workflow/index.js +17 -17
  36. package/dist/ai-sdk/workflow/react/index.d.ts +1 -3
  37. package/dist/ai-sdk/workflow/react/index.js +3 -3
  38. package/dist/ai-sdk/workflow/react/server.d.ts +1 -3
  39. package/dist/ai-sdk/workflow/react/server.js +1 -2
  40. package/dist/anchors-sCLvYj-8.d.ts +36 -0
  41. package/dist/api-CwzVbbw4.d.ts +483 -0
  42. package/dist/api-keys-u2sXB-CZ.d.ts +211 -0
  43. package/dist/api-wwix_K5c.js +691 -0
  44. package/dist/app-tables-DomvYx5b.d.ts +26 -0
  45. package/dist/approvals-Da4uAANx.js +166 -0
  46. package/dist/approvals-idpuhILk.d.ts +127 -0
  47. package/dist/assistant-CMKsaeJd.d.ts +209 -0
  48. package/dist/astro/index.d.ts +8 -10
  49. package/dist/astro/index.js +8 -9
  50. package/dist/attachments-BWtUQgsL.js +375 -0
  51. package/dist/attributes-BZNkR2z2.js +51 -0
  52. package/dist/auth-link-BmJsQG4a.js +117 -0
  53. package/dist/auth-link-DRjtI1Ky.d.ts +102 -0
  54. package/dist/auth-module-CVo86UKh.js +50 -0
  55. package/dist/auth-reply-BMPJQssh.d.ts +9 -0
  56. package/dist/auth-reply-Cnwn3I_q.js +30 -0
  57. package/dist/auth-wFlGgwTZ.js +19 -0
  58. package/dist/authorization-CYu_UKX4.d.ts +3723 -0
  59. package/dist/authorization-hooks-CldgvzBZ.d.ts +219 -0
  60. package/dist/authorizer-AswD5q6g.d.ts +116 -0
  61. package/dist/authorizer-D6po_XZA.js +171 -0
  62. package/dist/automation-acq3iK9y.js +74 -0
  63. package/dist/automations-BfH8GJqv.js +27 -0
  64. package/dist/automations-Bw5cX7oj.js +29 -0
  65. package/dist/automations-CCc5RUw-.js +31 -0
  66. package/dist/automations-Dou1t3lt.js +313 -0
  67. package/dist/availability-CebEOfMN.d.ts +236 -0
  68. package/dist/base64-CVyKHBBw.js +41 -0
  69. package/dist/batch-limit-DqQ3d6op.js +4 -0
  70. package/dist/before-route-Ra3OhI2x.js +29 -0
  71. package/dist/better-result/index.d.ts +4 -6
  72. package/dist/better-result/index.js +2 -3
  73. package/dist/bind-8LYVJE5W.d.ts +102 -0
  74. package/dist/block-authors-C5z3tGVu.d.ts +10 -0
  75. package/dist/block-authors-DCQ4zl8e.js +13 -0
  76. package/dist/block-env-BsLgZL2l.d.ts +30 -0
  77. package/dist/block-event-listener-DCi7c89M.js +15 -0
  78. package/dist/block-events-Bp6GPIBN.js +82 -0
  79. package/dist/block-fields-Bjcv6_zc.js +139 -0
  80. package/dist/block-fields-Puv5m5D3.d.ts +56 -0
  81. package/dist/block-helpers-I7UzjNEf.js +435 -0
  82. package/dist/block-helpers-JxiD1iw4.d.ts +56 -0
  83. package/dist/block-hooks-CJP5kGEa.d.ts +115 -0
  84. package/dist/block-hooks-CadxQ9-_.js +129 -0
  85. package/dist/block-method-DIbWG4Mj.js +20 -0
  86. package/dist/block-method-QSaPsL2P.d.ts +12 -0
  87. package/dist/block-subjects-SyJwfgrX.d.ts +4 -0
  88. package/dist/block-subjects-cRlVtKDO.js +54 -0
  89. package/dist/block-tenant-Bun03JuO.js +13 -0
  90. package/dist/block-transport-Bbf1ZZre.d.ts +67 -0
  91. package/dist/blocks/access-requests/index.d.ts +9 -15
  92. package/dist/blocks/access-requests/index.js +11 -14
  93. package/dist/blocks/activities/index.d.ts +13 -21
  94. package/dist/blocks/activities/index.js +16 -21
  95. package/dist/blocks/agents/index.d.ts +4 -8
  96. package/dist/blocks/agents/index.js +11 -14
  97. package/dist/blocks/ai-cache/index.d.ts +3 -5
  98. package/dist/blocks/ai-cache/index.js +5 -6
  99. package/dist/blocks/ai-chat/index.d.ts +10 -19
  100. package/dist/blocks/ai-chat/index.js +20 -28
  101. package/dist/blocks/ai-files/index.d.ts +5 -9
  102. package/dist/blocks/ai-files/index.js +5 -6
  103. package/dist/blocks/ai-keys/index.d.ts +4 -10
  104. package/dist/blocks/ai-keys/index.js +14 -18
  105. package/dist/blocks/ai-schedules/index.d.ts +3 -5
  106. package/dist/blocks/ai-schedules/index.js +14 -16
  107. package/dist/blocks/announcements/index.d.ts +12 -20
  108. package/dist/blocks/announcements/index.js +12 -16
  109. package/dist/blocks/api-keys/index.d.ts +8 -16
  110. package/dist/blocks/api-keys/index.js +17 -22
  111. package/dist/blocks/approvals/index.d.ts +4 -8
  112. package/dist/blocks/approvals/index.js +7 -173
  113. package/dist/blocks/assets/index.d.ts +9 -17
  114. package/dist/blocks/assets/index.js +13 -17
  115. package/dist/blocks/assignment/index.d.ts +9 -17
  116. package/dist/blocks/assignment/index.js +10 -14
  117. package/dist/blocks/attachments/index.d.ts +6 -18
  118. package/dist/blocks/attachments/index.js +19 -24
  119. package/dist/blocks/audit/index.d.ts +15 -31
  120. package/dist/blocks/audit/index.js +27 -35
  121. package/dist/blocks/automations/index.d.ts +14 -26
  122. package/dist/blocks/automations/index.js +18 -23
  123. package/dist/blocks/billable-time/index.d.ts +9 -19
  124. package/dist/blocks/billable-time/index.js +15 -20
  125. package/dist/blocks/billing/index.d.ts +12 -22
  126. package/dist/blocks/billing/index.js +19 -24
  127. package/dist/blocks/bookings/index.d.ts +8 -18
  128. package/dist/blocks/bookings/index.js +17 -23
  129. package/dist/blocks/bulk/index.d.ts +6 -12
  130. package/dist/blocks/bulk/index.js +10 -13
  131. package/dist/blocks/calendar/index.d.ts +18 -24
  132. package/dist/blocks/calendar/index.js +39 -32
  133. package/dist/blocks/catalog/index.d.ts +12 -20
  134. package/dist/blocks/catalog/index.js +17 -21
  135. package/dist/blocks/channels/index.d.ts +9 -17
  136. package/dist/blocks/channels/index.js +11 -15
  137. package/dist/blocks/collections/index.d.ts +11 -17
  138. package/dist/blocks/collections/index.js +13 -16
  139. package/dist/blocks/comments/index.d.ts +16 -26
  140. package/dist/blocks/comments/index.js +21 -26
  141. package/dist/blocks/compliance/index.d.ts +9 -17
  142. package/dist/blocks/compliance/index.js +13 -17
  143. package/dist/blocks/connectors/index.d.ts +4 -8
  144. package/dist/blocks/connectors/index.js +13 -16
  145. package/dist/blocks/contacts/index.d.ts +10 -18
  146. package/dist/blocks/contacts/index.js +12 -16
  147. package/dist/blocks/content/index.d.ts +8 -16
  148. package/dist/blocks/content/index.js +13 -17
  149. package/dist/blocks/contracts/index.d.ts +11 -21
  150. package/dist/blocks/contracts/index.js +17 -22
  151. package/dist/blocks/courses/index.d.ts +11 -21
  152. package/dist/blocks/courses/index.js +17 -22
  153. package/dist/blocks/created-by/index.d.ts +3 -7
  154. package/dist/blocks/created-by/index.js +4 -5
  155. package/dist/blocks/custom-fields/index.d.ts +10 -16
  156. package/dist/blocks/custom-fields/index.js +13 -16
  157. package/dist/blocks/data-lifecycle/index.d.ts +10 -26
  158. package/dist/blocks/data-lifecycle/index.js +17 -23
  159. package/dist/blocks/deals/index.d.ts +12 -20
  160. package/dist/blocks/deals/index.js +18 -22
  161. package/dist/blocks/dispatch/index.d.ts +11 -23
  162. package/dist/blocks/dispatch/index.js +19 -24
  163. package/dist/blocks/documents/index.d.ts +4 -8
  164. package/dist/blocks/documents/index.js +9 -12
  165. package/dist/blocks/domains/index.d.ts +8 -14
  166. package/dist/blocks/domains/index.js +12 -15
  167. package/dist/blocks/donations/index.d.ts +13 -23
  168. package/dist/blocks/donations/index.js +21 -26
  169. package/dist/blocks/drive/index.d.ts +116 -20
  170. package/dist/blocks/drive/index.js +138 -26
  171. package/dist/blocks/employees/index.d.ts +13 -23
  172. package/dist/blocks/employees/index.js +19 -27
  173. package/dist/blocks/enrichment/index.d.ts +8 -16
  174. package/dist/blocks/enrichment/index.js +11 -15
  175. package/dist/blocks/enrollments/index.d.ts +9 -17
  176. package/dist/blocks/enrollments/index.js +13 -17
  177. package/dist/blocks/entitlements/index.d.ts +8 -14
  178. package/dist/blocks/entitlements/index.js +8 -11
  179. package/dist/blocks/expenses/index.d.ts +22 -19
  180. package/dist/blocks/expenses/index.js +25 -23
  181. package/dist/blocks/field-history/index.d.ts +6 -10
  182. package/dist/blocks/field-history/index.js +5 -7
  183. package/dist/blocks/flags/index.d.ts +49 -20
  184. package/dist/blocks/flags/index.js +65 -19
  185. package/dist/blocks/forecasts/index.d.ts +10 -16
  186. package/dist/blocks/forecasts/index.js +11 -14
  187. package/dist/blocks/forms/index.d.ts +11 -25
  188. package/dist/blocks/forms/index.js +17 -24
  189. package/dist/blocks/goals/index.d.ts +8 -12
  190. package/dist/blocks/goals/index.js +9 -11
  191. package/dist/blocks/guests/index.d.ts +9 -19
  192. package/dist/blocks/guests/index.js +14 -19
  193. package/dist/blocks/hiring/index.d.ts +10 -18
  194. package/dist/blocks/hiring/index.js +12 -15
  195. package/dist/blocks/identities/index.d.ts +7 -11
  196. package/dist/blocks/identities/index.js +7 -9
  197. package/dist/blocks/imports/index.d.ts +8 -18
  198. package/dist/blocks/imports/index.js +11 -16
  199. package/dist/blocks/inbox/index.d.ts +11 -21
  200. package/dist/blocks/inbox/index.js +26 -23
  201. package/dist/blocks/incidents/index.d.ts +9 -17
  202. package/dist/blocks/incidents/index.js +14 -18
  203. package/dist/blocks/index.d.ts +14 -20
  204. package/dist/blocks/index.js +17 -20
  205. package/dist/blocks/inventory/index.d.ts +11 -17
  206. package/dist/blocks/inventory/index.js +12 -15
  207. package/dist/blocks/invoices/index.d.ts +34 -21
  208. package/dist/blocks/invoices/index.js +31 -18
  209. package/dist/blocks/knowledge/index.d.ts +3 -5
  210. package/dist/blocks/knowledge/index.js +5 -6
  211. package/dist/blocks/lead-scoring/index.d.ts +10 -14
  212. package/dist/blocks/lead-scoring/index.js +11 -13
  213. package/dist/blocks/leases/index.d.ts +11 -21
  214. package/dist/blocks/leases/index.js +20 -25
  215. package/dist/blocks/leave/index.d.ts +50 -17
  216. package/dist/blocks/leave/index.js +35 -14
  217. package/dist/blocks/ledger/index.d.ts +9 -17
  218. package/dist/blocks/ledger/index.js +13 -17
  219. package/dist/blocks/mail-sync/index.d.ts +6 -12
  220. package/dist/blocks/mail-sync/index.js +26 -25
  221. package/dist/blocks/memberships/index.d.ts +5 -9
  222. package/dist/blocks/memberships/index.js +4 -5
  223. package/dist/blocks/memory/index.d.ts +4 -8
  224. package/dist/blocks/memory/index.js +12 -15
  225. package/dist/blocks/messaging/index.d.ts +14 -24
  226. package/dist/blocks/messaging/index.js +19 -24
  227. package/dist/blocks/metrics/index.d.ts +9 -17
  228. package/dist/blocks/metrics/index.js +14 -18
  229. package/dist/blocks/mfa/index.d.ts +5 -9
  230. package/dist/blocks/mfa/index.js +7 -9
  231. package/dist/blocks/moderation/index.d.ts +9 -17
  232. package/dist/blocks/moderation/index.js +13 -17
  233. package/dist/blocks/notifications/index.d.ts +18 -34
  234. package/dist/blocks/notifications/index.js +36 -84
  235. package/dist/blocks/numbering/index.d.ts +6 -12
  236. package/dist/blocks/numbering/index.js +8 -11
  237. package/dist/blocks/oauth-server/index.d.ts +7 -13
  238. package/dist/blocks/oauth-server/index.js +12 -15
  239. package/dist/blocks/onboarding/index.d.ts +7 -13
  240. package/dist/blocks/onboarding/index.js +8 -11
  241. package/dist/blocks/orders/index.d.ts +17 -29
  242. package/dist/blocks/orders/index.js +22 -28
  243. package/dist/blocks/organizations/index.d.ts +43 -40
  244. package/dist/blocks/organizations/index.js +21 -20
  245. package/dist/blocks/outbox/index.d.ts +4 -6
  246. package/dist/blocks/outbox/index.js +11 -13
  247. package/dist/blocks/passes/index.d.ts +12 -22
  248. package/dist/blocks/passes/index.js +20 -25
  249. package/dist/blocks/permissions/index.d.ts +74 -15
  250. package/dist/blocks/permissions/index.js +119 -18
  251. package/dist/blocks/pipelines/index.d.ts +12 -18
  252. package/dist/blocks/pipelines/index.js +12 -15
  253. package/dist/blocks/posts/index.d.ts +10 -18
  254. package/dist/blocks/posts/index.js +15 -19
  255. package/dist/blocks/profiles/index.d.ts +8 -12
  256. package/dist/blocks/profiles/index.js +9 -11
  257. package/dist/blocks/promotions/index.d.ts +11 -17
  258. package/dist/blocks/promotions/index.js +13 -16
  259. package/dist/blocks/push/index.d.ts +19 -17
  260. package/dist/blocks/push/index.js +33 -20
  261. package/dist/blocks/queue/index.d.ts +187 -39
  262. package/dist/blocks/queue/index.js +226 -60
  263. package/dist/blocks/quotes/index.d.ts +13 -21
  264. package/dist/blocks/quotes/index.js +14 -17
  265. package/dist/blocks/rank/index.d.ts +7 -13
  266. package/dist/blocks/rank/index.js +8 -10
  267. package/dist/blocks/reactions/index.d.ts +11 -19
  268. package/dist/blocks/reactions/index.js +13 -17
  269. package/dist/blocks/relations/index.d.ts +11 -21
  270. package/dist/blocks/relations/index.js +18 -23
  271. package/dist/blocks/reminders/index.d.ts +12 -22
  272. package/dist/blocks/reminders/index.js +21 -25
  273. package/dist/blocks/reviews/index.d.ts +9 -15
  274. package/dist/blocks/reviews/index.js +11 -14
  275. package/dist/blocks/saved-views/index.d.ts +11 -21
  276. package/dist/blocks/saved-views/index.js +16 -21
  277. package/dist/blocks/scores/index.d.ts +6 -12
  278. package/dist/blocks/scores/index.js +10 -13
  279. package/dist/blocks/search/index.d.ts +9 -19
  280. package/dist/blocks/search/index.js +15 -19
  281. package/dist/blocks/security-events/index.d.ts +10 -24
  282. package/dist/blocks/security-events/index.js +17 -23
  283. package/dist/blocks/segments/index.d.ts +10 -18
  284. package/dist/blocks/segments/index.js +11 -15
  285. package/dist/blocks/sequences/index.d.ts +9 -17
  286. package/dist/blocks/sequences/index.js +15 -19
  287. package/dist/blocks/service-accounts/index.d.ts +9 -15
  288. package/dist/blocks/service-accounts/index.js +11 -14
  289. package/dist/blocks/sessions/index.d.ts +4 -8
  290. package/dist/blocks/sessions/index.js +9 -11
  291. package/dist/blocks/settings/index.d.ts +8 -16
  292. package/dist/blocks/settings/index.js +14 -18
  293. package/dist/blocks/share-links/index.d.ts +9 -17
  294. package/dist/blocks/share-links/index.js +16 -20
  295. package/dist/blocks/shipments/index.d.ts +14 -24
  296. package/dist/blocks/shipments/index.js +25 -31
  297. package/dist/blocks/signatures/index.d.ts +10 -16
  298. package/dist/blocks/signatures/index.js +10 -13
  299. package/dist/blocks/signing-keys/index.d.ts +5 -9
  300. package/dist/blocks/signing-keys/index.js +8 -10
  301. package/dist/blocks/sla/index.d.ts +11 -19
  302. package/dist/blocks/sla/index.js +17 -21
  303. package/dist/blocks/sso/index.d.ts +7 -19
  304. package/dist/blocks/sso/index.js +14 -21
  305. package/dist/blocks/state-machine/index.d.ts +7 -13
  306. package/dist/blocks/state-machine/index.js +9 -12
  307. package/dist/blocks/subjects/index.d.ts +7 -11
  308. package/dist/blocks/subjects/index.js +12 -14
  309. package/dist/blocks/tags/index.d.ts +11 -21
  310. package/dist/blocks/tags/index.js +20 -25
  311. package/dist/blocks/tasks/index.d.ts +13 -27
  312. package/dist/blocks/tasks/index.js +22 -29
  313. package/dist/blocks/teams/index.d.ts +15 -15
  314. package/dist/blocks/teams/index.js +17 -19
  315. package/dist/blocks/templates/index.d.ts +12 -22
  316. package/dist/blocks/templates/index.js +16 -21
  317. package/dist/blocks/time-tracking/index.d.ts +31 -25
  318. package/dist/blocks/time-tracking/index.js +29 -29
  319. package/dist/blocks/timeline/index.d.ts +10 -14
  320. package/dist/blocks/timeline/index.js +11 -13
  321. package/dist/blocks/trash/index.d.ts +10 -18
  322. package/dist/blocks/trash/index.js +11 -14
  323. package/dist/blocks/undo/index.d.ts +4 -8
  324. package/dist/blocks/undo/index.js +6 -8
  325. package/dist/blocks/updated-at/index.d.ts +3 -7
  326. package/dist/blocks/updated-at/index.js +4 -5
  327. package/dist/blocks/usage/index.d.ts +6 -10
  328. package/dist/blocks/usage/index.js +10 -13
  329. package/dist/blocks/vercel-marketplace/index.d.ts +9 -17
  330. package/dist/blocks/vercel-marketplace/index.js +17 -21
  331. package/dist/blocks/versions/index.d.ts +10 -20
  332. package/dist/blocks/versions/index.js +17 -22
  333. package/dist/blocks/waitlist/index.d.ts +10 -16
  334. package/dist/blocks/waitlist/index.js +11 -14
  335. package/dist/blocks/webhooks/index.d.ts +16 -34
  336. package/dist/blocks/webhooks/index.js +33 -44
  337. package/dist/blocks/workflow-editor/index.d.ts +13 -21
  338. package/dist/blocks/workflow-editor/index.js +21 -27
  339. package/dist/blocks/workflows/index.d.ts +8 -14
  340. package/dist/blocks/workflows/index.js +14 -18
  341. package/dist/bookings-DG443336.d.ts +285 -0
  342. package/dist/bucket-Clq5xINQ.d.ts +693 -0
  343. package/dist/build-Ckxct2EX.js +2065 -0
  344. package/dist/build-D1-V9dd8.js +732 -0
  345. package/dist/carrier-D2b_028L.d.ts +165 -0
  346. package/dist/casing-DQzG9ANZ.js +15 -0
  347. package/dist/channel-B_kufDZy.d.ts +101 -0
  348. package/dist/channels-BxeTTtCY.js +113 -0
  349. package/dist/chat-sdk/index.d.ts +174 -41
  350. package/dist/chat-sdk/index.js +425 -83
  351. package/dist/claims-DRmafYVK.js +90 -0
  352. package/dist/claims-DouHL7ZL.js +62 -0
  353. package/dist/cli/_format-Ba0DoWjl.js +99 -0
  354. package/dist/cli/add-ChoHyBhz.js +1222 -0
  355. package/dist/cli/add-DlYL-1mF.js +1 -0
  356. package/dist/cli/add-fzRPyIED.js +98 -0
  357. package/dist/cli/agent-59XWXsRi.js +184 -0
  358. package/dist/cli/app-table-files-C0OtdUVu.js +343 -0
  359. package/dist/cli/arazzo-1.0-D3OaSeZw.js +531 -0
  360. package/dist/cli/arazzo-1.1-DaT2KAkP.js +704 -0
  361. package/dist/cli/args-_ZVgRBkx.js +26 -0
  362. package/dist/cli/asyncapi-3.0.0-Ca-UwtUW.js +5592 -0
  363. package/dist/cli/asyncapi-3.1.0-DUxf5zNu.js +5832 -0
  364. package/dist/cli/backfill-Dq2XMXf9.js +292 -0
  365. package/dist/cli/bin.js +5 -5
  366. package/dist/cli/blocks-CCzp0eAH.js +155 -0
  367. package/dist/cli/blocks-DVhJOzFj.js +1 -0
  368. package/dist/cli/cache-CoC-1i1O.js +643 -0
  369. package/dist/cli/codemod-block-renames-Dt3X1Wvg.js +238 -0
  370. package/dist/cli/codemod-pyf6HmS9.js +2883 -0
  371. package/dist/cli/command-BpZ4AuhR.js +1021 -0
  372. package/dist/cli/compare-yl4sSwVn.js +8 -0
  373. package/dist/cli/completion-B08Q0xB3.js +29 -0
  374. package/dist/cli/completion-CwL7e93t.js +210 -0
  375. package/dist/cli/completion-DHTT6rjI.js +1 -0
  376. package/dist/cli/config-D-Upz3jV.js +46 -0
  377. package/dist/cli/config-D0m2rQqk.js +1 -0
  378. package/dist/cli/config-Dyl3iX3u.js +2029 -0
  379. package/dist/cli/config-edit-C6sQ1MqT.js +619 -0
  380. package/dist/cli/config-group-D4JWh4kG.js +388 -0
  381. package/dist/cli/content-mapper-ChSVT9Tq.js +181 -0
  382. package/dist/cli/db-B8zfxjl2.js +77 -0
  383. package/dist/cli/db-dFzhcozO.js +246 -0
  384. package/dist/cli/detect-BcUDaO8I.js +83 -0
  385. package/dist/cli/dist-CYnD1kyT.js +128 -0
  386. package/dist/cli/dist-MKwjiW2w.js +1114 -0
  387. package/dist/cli/doctor-BKZsztFV.js +4647 -0
  388. package/dist/cli/env-BAJn6wCA.js +142 -0
  389. package/dist/cli/env-BCuUsWOh.js +1109 -0
  390. package/dist/cli/env-D70ihdbB.js +1 -0
  391. package/dist/cli/env-UN6PJFX6.js +1 -0
  392. package/dist/cli/errors-DcJ_PayO.js +97 -0
  393. package/dist/cli/exec-CXBufciC.js +461 -0
  394. package/dist/cli/fastest-levenshtein-B_QF6At5.js +119 -0
  395. package/dist/cli/files-DQayErI8.js +999 -0
  396. package/dist/cli/fresh-import-CdO2oQaQ.js +39 -0
  397. package/dist/cli/gen-BN_eh6rE.js +390 -0
  398. package/dist/cli/guards-DxwRG0Uv.js +7 -0
  399. package/dist/cli/in-stack-diff-huI7fGMX.js +185 -0
  400. package/dist/cli/index.d.ts +1 -53
  401. package/dist/cli/index.js +10 -11
  402. package/dist/cli/init-CaDDt8F6.js +556 -0
  403. package/dist/cli/io-CQzy8PEZ.js +36 -0
  404. package/dist/cli/json5-DhsZB2va.js +784 -0
  405. package/dist/cli/jsonc-DU9Clnrz.js +1 -0
  406. package/dist/cli/jsonc-u_UiXFxs.js +43 -0
  407. package/dist/cli/keys-CxajkV_7.js +105 -0
  408. package/dist/cli/legacy-prefix-D8Jfku6I.js +153 -0
  409. package/dist/cli/live-KU41LMGE.js +339 -0
  410. package/dist/cli/mcp-C_m-TpLJ.js +240 -0
  411. package/dist/cli/metadata-Bq4ra7zo.js +149 -0
  412. package/dist/cli/migrate-DHG2Qz_K.js +45 -0
  413. package/dist/cli/migration-safety-STVbiKhz.js +925 -0
  414. package/dist/cli/migrations-O1QZoMiH.js +116 -0
  415. package/dist/cli/module-migration-DB9ntWM-.js +118 -0
  416. package/dist/cli/moved-BAFPdJz_.js +253 -0
  417. package/dist/cli/ohash-imLR_J5Y.js +276 -0
  418. package/dist/cli/openapi-3.0-BJiTNq_x.js +927 -0
  419. package/dist/cli/openapi-3.1-BcWCoii2.js +869 -0
  420. package/dist/cli/openapi-3.2-MXPkeoTk.js +1030 -0
  421. package/dist/cli/orphans-CPcR85QN.js +27 -0
  422. package/dist/cli/parse-BueItuNJ.js +181 -0
  423. package/dist/cli/powersync-CN3QPF2K.js +375 -0
  424. package/dist/cli/powersync-DfeGl5N1.js +1 -0
  425. package/dist/cli/preset-BQnjDCSR.js +100 -0
  426. package/dist/cli/print-DG7TRCi8.js +66 -0
  427. package/dist/cli/prompts-D9b6uf21.js +1133 -0
  428. package/dist/cli/providers-DpfoF3VC.js +298 -0
  429. package/dist/cli/prune-workflows-DcNJUS1m.js +153 -0
  430. package/dist/cli/redact--zOGdWzo.js +37 -0
  431. package/dist/cli/remove-BpfYqP45.js +237 -0
  432. package/dist/cli/render-Q7jnLn_C.js +2213 -0
  433. package/dist/cli/rolldown-runtime-DegdyBIC.js +25 -0
  434. package/dist/cli/run-9NfabanB.js +703 -0
  435. package/dist/cli/run-D6K-qQIX.js +1450 -0
  436. package/dist/cli/run-dY9uOC3W.js +62 -0
  437. package/dist/cli/seed-B4H0Lco9.js +187 -0
  438. package/dist/cli/seed-BIB6-WPa.js +1 -0
  439. package/dist/cli/shared-PrvYREVy.js +150 -0
  440. package/dist/cli/shell-C1U618XA.js +9 -0
  441. package/dist/cli/skills-jZThjL3B.js +120 -0
  442. package/dist/cli/snapshot-UfJsqfys.js +728 -0
  443. package/dist/cli/source-F3YTVvFo.js +317 -0
  444. package/dist/cli/source-args-DJMrW_jW.js +58 -0
  445. package/dist/cli/spec-DsLQuJKp.js +7449 -0
  446. package/dist/cli/spec-HQOBVbEO.js +1 -0
  447. package/dist/cli/sql-layout-CZ66pY8j.js +260 -0
  448. package/dist/cli/stack-147NqctC.js +134 -0
  449. package/dist/cli/stack-env-BQhbUFa7.js +92 -0
  450. package/dist/cli/stack-status-Mxgqb3I4.js +45 -0
  451. package/dist/cli/stacks-C5YL6Un9.js +230 -0
  452. package/dist/cli/style-B5-nByxb.js +34 -0
  453. package/dist/cli/supabase-toml-B6-eEV5p.js +1155 -0
  454. package/dist/cli/sync-B12wbtFd.js +318 -0
  455. package/dist/cli/table-D9FbJS8h.js +88 -0
  456. package/dist/cli/toml-VX0BsvYq.js +422 -0
  457. package/dist/cli/topics-Cdg0V7Tt.js +29 -0
  458. package/dist/cli/trace-D3TNqWBg.js +6 -0
  459. package/dist/cli/upgrade-AgUXFDo6.js +270 -0
  460. package/dist/cli/upgrade-C20z49De.js +40 -0
  461. package/dist/cli/validate-C_WTnX1U.js +7426 -0
  462. package/dist/cli/version-DEUWW8cv.js +3 -0
  463. package/dist/cli/yaml-JsusTbcC.js +2250 -0
  464. package/dist/client/index.d.ts +7 -7
  465. package/dist/client/index.js +9 -12
  466. package/dist/client/native/index.d.ts +7 -23
  467. package/dist/client/native/index.js +15 -22
  468. package/dist/client-BLor58Je.js +290 -0
  469. package/dist/clone-H_gCsL29.js +32 -0
  470. package/dist/cloud-event-CLvsaPqH.js +62 -0
  471. package/dist/cloud-event-bcaMqEbN.d.ts +62 -0
  472. package/dist/codecs-B1VO2BGL.d.ts +220 -0
  473. package/dist/codecs-B9v5Y5HH.js +357 -0
  474. package/dist/commerce/index.d.ts +5 -13
  475. package/dist/commerce/index.js +13 -16
  476. package/dist/compiler-CWishtY2.d.ts +12 -0
  477. package/dist/compose-BRBlPSEY.js +52 -0
  478. package/dist/composite-BZMkWNOQ.js +125 -0
  479. package/dist/composite-ClLWZIwX.d.ts +79 -0
  480. package/dist/config/index.d.ts +6 -6
  481. package/dist/config/index.js +7 -7
  482. package/dist/config-BhExAhNK.js +1102 -0
  483. package/dist/config-MDRA2sre.js +1672 -0
  484. package/dist/connectors-BImAu75R.d.ts +145 -0
  485. package/dist/context-DSevnLrT.js +40 -0
  486. package/dist/context-DcxfrCml.d.ts +4267 -0
  487. package/dist/controller-BJmh7gFm.js +78 -0
  488. package/dist/controller-D_UJBaEU.d.ts +50 -0
  489. package/dist/controller-y1kSMuCU.js +72 -0
  490. package/dist/conversion-7U1WeLxK.d.ts +84 -0
  491. package/dist/conversion-Bj9j3KnG.js +76 -0
  492. package/dist/cookie-DDkqvqe4.d.ts +3 -0
  493. package/dist/cookie-DJI6xXJ9.js +4 -0
  494. package/dist/cors-9SDsndtb.d.ts +13 -0
  495. package/dist/cors-DrDFLMNn.js +23 -0
  496. package/dist/create/index.d.ts +4 -28
  497. package/dist/create/index.js +9 -15
  498. package/dist/create/lite/index.d.ts +5 -25
  499. package/dist/create/lite/index.js +14 -24
  500. package/dist/create/oauth/index.d.ts +1 -1
  501. package/dist/create/oauth/index.js +1 -2
  502. package/dist/create/supabase/index.d.ts +2 -4
  503. package/dist/create/supabase/index.js +3 -6
  504. package/dist/create-blocks-D7q1boXV.js +367 -0
  505. package/dist/credentials/index.d.ts +6 -10
  506. package/dist/credentials/index.js +11 -12
  507. package/dist/cron-BD8VrQQl.js +147 -0
  508. package/dist/cron-route-DSITg1yC.js +23 -0
  509. package/dist/csv-Bwn9insJ.js +88 -0
  510. package/dist/csv-Dd1iKsk-.d.ts +26 -0
  511. package/dist/data-engine-B-D6bdyx.d.ts +269 -0
  512. package/dist/data-engine-BbqQwso_.js +174 -0
  513. package/dist/data-hooks-BToeAcQ_.js +277 -0
  514. package/dist/db-exception-Dv18UZ-I.js +30 -0
  515. package/dist/deal-forecast-CN_BEy9s.d.ts +21 -0
  516. package/dist/deal-forecast-DsVFoMkJ.js +38 -0
  517. package/dist/define-3RbqoF1S.d.ts +1242 -0
  518. package/dist/define-B6D55cO0.js +2073 -0
  519. package/dist/define-block-22Jv4U_-.js +63 -0
  520. package/dist/define-block-B_i9VPcc.d.ts +1669 -0
  521. package/dist/delegation-BRHHXERz.js +152 -0
  522. package/dist/delivery-CWcbh87x.d.ts +69 -0
  523. package/dist/delivery-SmPHu2_H.js +28 -0
  524. package/dist/delivery-events-0mAEuscm.js +52 -0
  525. package/dist/documents-6ov2gWh3.d.ts +150 -0
  526. package/dist/edge/index.d.ts +17 -23
  527. package/dist/edge/index.js +18 -22
  528. package/dist/elysia/index.d.ts +2 -6
  529. package/dist/elysia/index.js +4 -6
  530. package/dist/email-BRm6wMWQ.d.ts +40 -0
  531. package/dist/embeddings--v4BJdUL.js +127 -0
  532. package/dist/embeddings-K0lH--nt.d.ts +76 -0
  533. package/dist/ended-CCoE7XXY.d.ts +22 -0
  534. package/dist/entitlements-XwpuBbKN.d.ts +52 -0
  535. package/dist/entitlements-sLoj3M6Y.js +44 -0
  536. package/dist/entity-naming-BES3pkQI.js +130 -0
  537. package/dist/entity-schema-DEIz0I8i.js +38 -0
  538. package/dist/env/index.d.ts +1 -1
  539. package/dist/env/index.js +1 -2
  540. package/dist/envelope-DAtaFJue.js +89 -0
  541. package/dist/errors-B7tCfCvX.js +327 -0
  542. package/dist/errors-BdjHv5SV.js +43 -0
  543. package/dist/errors-D3-4c-XF.js +102 -0
  544. package/dist/escape-like-CK6L7gkj.d.ts +26 -0
  545. package/dist/escape-like-gxNXs145.js +6 -0
  546. package/dist/eve/index.d.ts +247 -16
  547. package/dist/eve/index.js +334 -26
  548. package/dist/eve-Cf-QRGij.d.ts +213 -0
  549. package/dist/event-calendar-DUtFyRrv.d.ts +63 -0
  550. package/dist/event-map-DxfsFgQT.js +18 -0
  551. package/dist/events/index.d.ts +3 -3
  552. package/dist/events/index.js +7 -8
  553. package/dist/events-BRKIxVQD.js +25 -0
  554. package/dist/events-CfDdOwqg.d.ts +850 -0
  555. package/dist/events-Da482tiF.js +81 -0
  556. package/dist/executor-BDMqPbVU.js +482 -0
  557. package/dist/executor-C0_TT717.js +840 -0
  558. package/dist/executor-CAhykadW.d.ts +168 -0
  559. package/dist/executor-CbDX34I9.d.ts +99 -0
  560. package/dist/executor-Dc4Pl44u.js +207 -0
  561. package/dist/executor-ynEwaUZy.d.ts +35 -0
  562. package/dist/expo/index.d.ts +5 -9
  563. package/dist/expo/index.js +10 -11
  564. package/dist/extension-DQ9-oOVC.js +58 -0
  565. package/dist/extension-LgaDPMJs.js +120 -0
  566. package/dist/extension-WdHd5uqI.js +102 -0
  567. package/dist/extension-rdpYvpyN.js +52 -0
  568. package/dist/extension-shared-DJb_PfD4.js +59 -0
  569. package/dist/extra-Dz9n5y1s.js +9 -0
  570. package/dist/field-errors-tQr-anYL.d.ts +208 -0
  571. package/dist/field-formats-Cap-V7UP.js +101 -0
  572. package/dist/field-formats-DVukMbRa.d.ts +36 -0
  573. package/dist/fields-AKKMirg_.d.ts +76 -0
  574. package/dist/fields-BBcdKD-S.js +107 -0
  575. package/dist/filter-evaluate-Bhq99aEN.d.ts +35 -0
  576. package/dist/filter-evaluate-D_LLfdtE.js +216 -0
  577. package/dist/filter-query-B7A4l2xn.d.ts +131 -0
  578. package/dist/filter-query-Ds7Z6lgZ.js +565 -0
  579. package/dist/flags-B5B4mkZV.d.ts +315 -0
  580. package/dist/flags-D0npSE-5.js +361 -0
  581. package/dist/flags-sdk/index.d.ts +217 -28
  582. package/dist/flags-sdk/index.js +255 -35
  583. package/dist/form-definition-8cCCt5zj.js +362 -0
  584. package/dist/form-definition-BN8shngm.d.ts +117 -0
  585. package/dist/format-BT0Z3V54.d.ts +77 -0
  586. package/dist/framework-B1h-uquj.js +57 -0
  587. package/dist/framework-CyDn_SXR.d.ts +45 -0
  588. package/dist/function-contract-Bf6llTkE.js +7 -0
  589. package/dist/function-contract-DgDBYbXu.d.ts +25 -0
  590. package/dist/gateway-Cg_MgGen.d.ts +120 -0
  591. package/dist/gateway-options-DQGQzdkD.js +26 -0
  592. package/dist/gateway-options-Mut8jih_.d.ts +27 -0
  593. package/dist/guards-CsRa6v57.js +11 -0
  594. package/dist/guest-actions-CEwttioE.js +8 -0
  595. package/dist/guest-actions-DfHHp98H.d.ts +3 -0
  596. package/dist/h3/index.d.ts +2 -6
  597. package/dist/h3/index.js +4 -6
  598. package/dist/h3/v1/index.d.ts +3 -5
  599. package/dist/h3/v1/index.js +4 -5
  600. package/dist/history-6KiVNWdH.js +269 -0
  601. package/dist/hmac-DNcfpmI9.js +22 -0
  602. package/dist/hono/index.d.ts +14 -19
  603. package/dist/hono/index.js +14 -16
  604. package/dist/http-BDC1IvBX.js +27 -0
  605. package/dist/http-BRUI3qim.js +140 -0
  606. package/dist/http-D4lH1xqY.js +39 -0
  607. package/dist/image-url-bsGeybeg.js +83 -0
  608. package/dist/impersonation-BOCJcsmS.d.ts +26 -0
  609. package/dist/impersonation-D-quM36V.js +61 -0
  610. package/dist/inbox-BmSA9K01.d.ts +326 -0
  611. package/dist/index-8w4OB5En.d.ts +102 -0
  612. package/dist/index-B2871MHr.d.ts +234 -0
  613. package/dist/index-B5_J-MaK.d.ts +152 -0
  614. package/dist/index-BWR29Vvw.d.ts +76 -0
  615. package/dist/index-CRrBZtKm.d.ts +326 -0
  616. package/dist/index-CTpEQvIv.d.ts +291 -0
  617. package/dist/index-D2BGCjIz.d.ts +570 -0
  618. package/dist/index-D66_dYVi.d.ts +667 -0
  619. package/dist/index-Dj4VKpYZ.d.ts +49 -0
  620. package/dist/index-DzBFdI9I.d.ts +145 -0
  621. package/dist/index-lazpPVr0.d.ts +402 -0
  622. package/dist/index-xCpjvDVm.d.ts +637 -0
  623. package/dist/index.d.ts +13 -41
  624. package/dist/index.js +29 -34
  625. package/dist/instance-property-BlH7QSDl.js +6 -0
  626. package/dist/instances-D31jrmKh.js +16636 -0
  627. package/dist/invalidate-DAB9CaPm.d.ts +19 -0
  628. package/dist/iso4217-oKsif_hW.js +175 -0
  629. package/dist/json-O5vFw243.js +21 -0
  630. package/dist/json-schema-D9eVL_xi.js +884 -0
  631. package/dist/jwks-cache-IZaiICAV.js +48 -0
  632. package/dist/jws-B8p0ppgh.js +204 -0
  633. package/dist/jws-CxgTsbgG.d.ts +64 -0
  634. package/dist/kit-CJKo0soh.d.ts +92 -0
  635. package/dist/kit-CVZDd1X9.js +132 -0
  636. package/dist/knowledge-BUwbpS8I.d.ts +215 -0
  637. package/dist/knowledge-DdZzUTQ-.js +299 -0
  638. package/dist/lint/index.d.ts +1 -5
  639. package/dist/lint/index.js +8 -10
  640. package/dist/list/index.d.ts +3 -3
  641. package/dist/list/index.js +3 -3
  642. package/dist/list-query-CZ-K5aHX.d.ts +220 -0
  643. package/dist/list-query-D-tgs1eY.js +558 -0
  644. package/dist/live-BVi3q4bX.js +277 -0
  645. package/dist/logger-0LfhvwE4.d.ts +16 -0
  646. package/dist/logger-BkF8ukXV.js +20 -0
  647. package/dist/lookup-upE-e1zw.js +17 -0
  648. package/dist/management-DtX4ic1F.d.ts +55 -0
  649. package/dist/mapper/bin.js +13 -17
  650. package/dist/mcp/index.d.ts +8 -18
  651. package/dist/mcp/index.js +24 -29
  652. package/dist/mcp/sdk/index.d.ts +7 -11
  653. package/dist/mcp/sdk/index.js +12 -14
  654. package/dist/message-Cc4bkdNw.d.ts +97 -0
  655. package/dist/messages-CRk1g6oe.js +512 -0
  656. package/dist/messaging-DMhtGxVv.d.ts +295 -0
  657. package/dist/methods-BjfDv4Gy.js +9 -0
  658. package/dist/metric-definition-2KQYeUZ1.d.ts +67 -0
  659. package/dist/metric-definition-D4H6IQT7.js +116 -0
  660. package/dist/mfa-CM5r904M.d.ts +34 -0
  661. package/dist/model-Lxa_mOzB.d.ts +338 -0
  662. package/dist/model-messages-BcrkjsPE.js +205 -0
  663. package/dist/model-messages-CGSUU450.d.ts +32 -0
  664. package/dist/money-BgpAd7d3.d.ts +89 -0
  665. package/dist/money-DH--bbYr.js +196 -0
  666. package/dist/money-codec-SKPm8FPw.js +40 -0
  667. package/dist/my-work-kinds-DNPq3ccL.js +10 -0
  668. package/dist/nestjs/index.d.ts +3 -5
  669. package/dist/nestjs/index.js +5 -6
  670. package/dist/next/client/index.d.ts +1 -5
  671. package/dist/next/client/index.js +2 -4
  672. package/dist/next/image/index.d.ts +1 -3
  673. package/dist/next/image/index.js +2 -3
  674. package/dist/next/index.d.ts +149 -92
  675. package/dist/next/index.js +167 -114
  676. package/dist/node/index.d.ts +3 -3
  677. package/dist/node/index.js +6 -7
  678. package/dist/node-headers-C3FExlg9.js +54 -0
  679. package/dist/node-headers-TnS4T7V_.d.ts +25 -0
  680. package/dist/nuxt/index.d.ts +0 -2
  681. package/dist/nuxt/index.js +1 -2
  682. package/dist/operations-BNFbWv1t.js +28 -0
  683. package/dist/operations-D51ONRvR.d.ts +4 -0
  684. package/dist/optional-peer-5SOYr3lL.js +31 -0
  685. package/dist/options--rohtkkC.js +4 -0
  686. package/dist/options-1iHDmlZ5.js +8 -0
  687. package/dist/options-2QJXZPPS.js +4 -0
  688. package/dist/options-B-JqrC61.d.ts +8 -0
  689. package/dist/options-B3xH2JvJ.js +8 -0
  690. package/dist/options-B4sTqDrt.js +4 -0
  691. package/dist/options-B56njigZ.js +19 -0
  692. package/dist/options-B5A3UmKY.d.ts +17 -0
  693. package/dist/options-B6m9gYRH.d.ts +11 -0
  694. package/dist/options-B7Pl708M.js +8 -0
  695. package/dist/options-B7YrdiUc.js +11 -0
  696. package/dist/options-B8c2_hIB.js +9 -0
  697. package/dist/options-B9w_Y08G.d.ts +6 -0
  698. package/dist/options-BDF60ouf.js +4 -0
  699. package/dist/options-BDMPjyrI.js +4 -0
  700. package/dist/options-BHdHuY5r.js +14 -0
  701. package/dist/options-BLMeCbtT.js +31 -0
  702. package/dist/options-BLQePOPy.d.ts +8 -0
  703. package/dist/options-BLn1PFyu.js +4 -0
  704. package/dist/options-BMO-FnOT.js +7 -0
  705. package/dist/options-BNRvoEkj.js +4 -0
  706. package/dist/options-BPQOiVx2.js +7 -0
  707. package/dist/options-BSTJmfX4.js +10 -0
  708. package/dist/options-BTRH26MJ.js +9 -0
  709. package/dist/options-BTaQszYn.js +9 -0
  710. package/dist/options-BYo7hMHK.js +10 -0
  711. package/dist/options-B_bxCZYM.js +7 -0
  712. package/dist/options-BaBaVWS-.js +10 -0
  713. package/dist/options-BamaRO-q.d.ts +12 -0
  714. package/dist/options-BcBdiPSZ.js +7 -0
  715. package/dist/options-BfY4pyQE.js +23 -0
  716. package/dist/options-BgCS5ODi.js +9 -0
  717. package/dist/options-Bi96Lzuf.js +9 -0
  718. package/dist/options-BjEsSoFp.js +17 -0
  719. package/dist/options-Bkx8vwip.js +4 -0
  720. package/dist/options-BmFSI07A.js +4 -0
  721. package/dist/options-BmwDdKwE.js +7 -0
  722. package/dist/options-Bn3NjXfn.js +7 -0
  723. package/dist/options-BqK4xV67.js +13 -0
  724. package/dist/options-Bs2dC-at.js +11 -0
  725. package/dist/options-BvttpM1M.js +4 -0
  726. package/dist/options-Bwrwb8do.d.ts +10 -0
  727. package/dist/options-BxdqA2Ex.js +19 -0
  728. package/dist/options-BzxR82Tu.js +9 -0
  729. package/dist/options-C-NFS6e3.js +13 -0
  730. package/dist/options-C13-dVMH.js +7 -0
  731. package/dist/options-C1RIyAe1.js +7 -0
  732. package/dist/options-C1kZ3qLd.js +8 -0
  733. package/dist/options-C2RjdunU.js +27 -0
  734. package/dist/options-C4kpi6HE.js +8 -0
  735. package/dist/options-C5MfwOAO.js +8 -0
  736. package/dist/options-C5fKQ3EJ.d.ts +10 -0
  737. package/dist/options-CJR59q8s.js +17 -0
  738. package/dist/options-CJVYQue3.d.ts +10 -0
  739. package/dist/options-CLy7CcMn.js +8 -0
  740. package/dist/options-COfEYic3.js +8 -0
  741. package/dist/options-CRwTY_q2.d.ts +58 -0
  742. package/dist/options-CcW7h8mv.js +9 -0
  743. package/dist/options-Ceu2j1vv.js +7 -0
  744. package/dist/options-CgBKgmI8.js +7 -0
  745. package/dist/options-CgMiQGOF.js +9 -0
  746. package/dist/options-CptvcSmF.js +11 -0
  747. package/dist/options-CsLUAt04.js +8 -0
  748. package/dist/options-CtyjhSGk.js +15 -0
  749. package/dist/options-CuPWezcV.js +7 -0
  750. package/dist/options-CyDOOWlk.js +7 -0
  751. package/dist/options-CyYZvdSy.js +10 -0
  752. package/dist/options-CzIPn0fF.js +4 -0
  753. package/dist/options-CzWjw2HY.js +10 -0
  754. package/dist/options-CztbWdz9.js +4 -0
  755. package/dist/options-D4LuPM8a.js +4 -0
  756. package/dist/options-D4dxMGHF.js +7 -0
  757. package/dist/options-D5a9CHgP.js +7 -0
  758. package/dist/options-D6tpMRvp.d.ts +13 -0
  759. package/dist/options-D848Os4l.js +10 -0
  760. package/dist/options-DCZPW5gR.d.ts +15 -0
  761. package/dist/options-DFSHZFLN.js +4 -0
  762. package/dist/options-DFemc2im.js +9 -0
  763. package/dist/options-DFgHHwzD.js +12 -0
  764. package/dist/options-DNZ9r_Vo.d.ts +8 -0
  765. package/dist/options-DP7NwQPZ.js +4 -0
  766. package/dist/options-DPQaafyc.js +7 -0
  767. package/dist/options-DQkhhBLy.js +4 -0
  768. package/dist/options-DTTz33na.js +9 -0
  769. package/dist/options-DToWdVqW.js +4 -0
  770. package/dist/options-DUNUGuhM.js +4 -0
  771. package/dist/options-DWgpi5ns.js +7 -0
  772. package/dist/options-DeamnVOY.d.ts +12 -0
  773. package/dist/options-Dg7eK-_J.d.ts +8 -0
  774. package/dist/options-DiIlMZpc.js +8 -0
  775. package/dist/options-DjFbIRgV.js +16 -0
  776. package/dist/options-DjtCYRWb.js +4 -0
  777. package/dist/options-Dk6D88Zx.d.ts +6 -0
  778. package/dist/options-DpwRG4tO.js +8 -0
  779. package/dist/options-DvgKdZ2K.js +9 -0
  780. package/dist/options-DwIoRvic.js +4 -0
  781. package/dist/options-GwwLsKf5.js +8 -0
  782. package/dist/options-I1ZHfDP0.d.ts +58 -0
  783. package/dist/options-Itq7QYoW.js +20 -0
  784. package/dist/options-JnPEVbBJ.js +17 -0
  785. package/dist/options-Jwux4JDX.js +7 -0
  786. package/dist/options-Lg76d-cV.js +7 -0
  787. package/dist/options-Lh6uxepF.d.ts +24 -0
  788. package/dist/options-Oki2W_c3.js +4 -0
  789. package/dist/options-PM7IaIFP.js +10 -0
  790. package/dist/options-PTLBl6QT.js +7 -0
  791. package/dist/options-PheFo4JY.js +10 -0
  792. package/dist/options-SlC_jZ7y.js +4 -0
  793. package/dist/options-Sq4bYbf5.js +13 -0
  794. package/dist/options-XiD_Y3oK.js +14 -0
  795. package/dist/options-Z-bd_H1E.js +88 -0
  796. package/dist/options-ax_ssX_m.js +4 -0
  797. package/dist/options-bNB8_nlW.js +23 -0
  798. package/dist/options-eIEk0vqV.js +4 -0
  799. package/dist/options-eLIedotm.js +7 -0
  800. package/dist/options-jg0FMHA5.js +4 -0
  801. package/dist/options-mypVYaqR.js +9 -0
  802. package/dist/options-ompJjxkV.js +4 -0
  803. package/dist/options-pbc4H8_A.js +7 -0
  804. package/dist/options-uUGi0Phf.d.ts +14 -0
  805. package/dist/options-yRwYr4up.js +4 -0
  806. package/dist/options-z2Zhi97E.js +9 -0
  807. package/dist/options-zYV6M0vr.js +8 -0
  808. package/dist/orpc/index.d.ts +13 -19
  809. package/dist/orpc/index.js +20 -22
  810. package/dist/otel/index.d.ts +4 -6
  811. package/dist/otel/index.js +8 -10
  812. package/dist/outbox-C44Aa94K.d.ts +197 -0
  813. package/dist/payments-B4JchZuJ.js +15 -0
  814. package/dist/payments-BBGSGRQ7.d.ts +112 -0
  815. package/dist/permissions-B9aZZ9LR.js +43 -0
  816. package/dist/permissions-controller-B4uI5IPH.js +33 -0
  817. package/dist/pg-error-D92B6jlF.js +25 -0
  818. package/dist/plugin-Ca2qBiFZ.js +47 -0
  819. package/dist/pool-Bji4lnQM.d.ts +121 -0
  820. package/dist/pool-errors-JrZie6u3.js +26 -0
  821. package/dist/ports-C-hdygkZ.js +150 -0
  822. package/dist/ports-zFqRNXVJ.d.ts +87 -0
  823. package/dist/postgres/index.d.ts +5 -11
  824. package/dist/postgres/index.js +7 -9
  825. package/dist/postgrest-2WjRrtmX.d.ts +51 -0
  826. package/dist/postgrest-executor-lf8Mt4J0.js +1064 -0
  827. package/dist/powersync/index.d.ts +203 -21
  828. package/dist/powersync/index.js +369 -22
  829. package/dist/preset/index.d.ts +3 -3
  830. package/dist/preset/index.js +3 -3
  831. package/dist/preset-om2rbdYw.js +1038 -0
  832. package/dist/problem-C0SVHhd3.js +161 -0
  833. package/dist/problem-NGBjN-TO.d.ts +77 -0
  834. package/dist/project-oNHntJ6T.js +1749 -0
  835. package/dist/provider-B6qpleR9.js +56 -0
  836. package/dist/provider-CH8McX3b.d.ts +142 -0
  837. package/dist/providers-C9sBIBYE.js +62 -0
  838. package/dist/push-token-CO28k46S.js +15 -0
  839. package/dist/push-token-a3Ev1U3L.d.ts +22 -0
  840. package/dist/queries-BLrxg_GL.js +238 -0
  841. package/dist/query/index.d.ts +3 -3
  842. package/dist/query/index.js +11 -15
  843. package/dist/range-BN3kpJAE.d.ts +6 -0
  844. package/dist/range-Nrh_qtb_.js +6 -0
  845. package/dist/rank-keys-CEBzd9Xa.js +59 -0
  846. package/dist/rank-result-B_xLQCBV.d.ts +12 -0
  847. package/dist/rank-result-DzaTKKhH.js +17 -0
  848. package/dist/rate-limit-C89Yzwd9.d.ts +48 -0
  849. package/dist/rate-limit-CRhlLFhP.js +380 -0
  850. package/dist/rate-limit-DXJbLVg0.js +48 -0
  851. package/dist/ratelimit-headers-CpB-cDD6.js +61 -0
  852. package/dist/react/index.d.ts +11 -11
  853. package/dist/react/index.js +6 -6
  854. package/dist/react/native/index.d.ts +3 -5
  855. package/dist/react/native/index.js +5 -5
  856. package/dist/react/server.d.ts +13 -15
  857. package/dist/react/server.js +9 -10
  858. package/dist/react/session.d.ts +4 -6
  859. package/dist/react/session.js +2 -3
  860. package/dist/react-C40oomj7.js +1006 -0
  861. package/dist/react-CqOVutZj.js +80 -0
  862. package/dist/react-router/index.d.ts +8 -12
  863. package/dist/react-router/index.js +9 -11
  864. package/dist/read-set-DEDoIHMM.js +198 -0
  865. package/dist/realtime/index.d.ts +7 -7
  866. package/dist/realtime/index.js +6 -7
  867. package/dist/realtime-status-CocmAOPv.js +10 -0
  868. package/dist/realtime-status-D3oUx3o4.d.ts +6 -0
  869. package/dist/record-bindings-jTZw-GVe.js +25 -0
  870. package/dist/record-form-DCIui2Ol.d.ts +80 -0
  871. package/dist/record-type-oQxekQTX.js +219 -0
  872. package/dist/recordings-Dlpq8jUG.d.ts +117 -0
  873. package/dist/records/index.d.ts +10 -14
  874. package/dist/records/index.js +13 -16
  875. package/dist/refresh-B8t_KE3s.js +142 -0
  876. package/dist/refresh-BK9epzeC.d.ts +52 -0
  877. package/dist/refusal-DEuFVi4s.d.ts +30 -0
  878. package/dist/refusal-DhX7Xpfp.js +63 -0
  879. package/dist/relay-CllqA-lV.js +248 -0
  880. package/dist/resolve-DVOtYTAc.d.ts +287 -0
  881. package/dist/resolve-FW8oeXvh.js +927 -0
  882. package/dist/resolved-names-DYYyh35i.js +130 -0
  883. package/dist/resource-BfsTJnxZ.d.ts +119 -0
  884. package/dist/resource-Cn6Bn-_o.js +517 -0
  885. package/dist/resource-DQ4kIBpa.js +104 -0
  886. package/dist/resource-execute-DQRS7PFt.d.ts +13 -0
  887. package/dist/resource-schemas-Bq0g2RCQ.js +81 -0
  888. package/dist/resource-types-DF6KDAZM.d.ts +155 -0
  889. package/dist/resources-B0Vy7_wv.js +63 -0
  890. package/dist/resources-CeY53FiJ.d.ts +5 -0
  891. package/dist/respond-C2qvP1wv.js +106 -0
  892. package/dist/respond-CkwkvFdZ.d.ts +108 -0
  893. package/dist/result-8xza7w5W.js +145 -0
  894. package/dist/result-DTOQRyGY.d.ts +347 -0
  895. package/dist/rows-Ce8dsmfM.js +79 -0
  896. package/dist/rows-D-RqIsRz.js +38 -0
  897. package/dist/rrule-BLpe2449.js +289 -0
  898. package/dist/run-keys-BnzqxtYc.d.ts +59 -0
  899. package/dist/run-state-D0Tbl-nM.d.ts +11 -0
  900. package/dist/run-state-DGiyDQxH.js +12 -0
  901. package/dist/run-watch-DJk4Q603.js +52 -0
  902. package/dist/runtime-qslVrC9l.js +43 -0
  903. package/dist/sales-lines-Bde9cV5F.d.ts +36 -0
  904. package/dist/sales-lines-axwWhnLk.js +44 -0
  905. package/dist/sales-shared-CY3s_wBx.js +21 -0
  906. package/dist/sandboxes-DDWuD9fh.d.ts +85 -0
  907. package/dist/schemas-CpoEiAeT.js +213 -0
  908. package/dist/scope-dD_OAgRU.js +89 -0
  909. package/dist/scores-Bql-ABl0.d.ts +172 -0
  910. package/dist/scores-Bvk_JgXL.js +176 -0
  911. package/dist/search-DtbkD0h0.js +8 -0
  912. package/dist/server/index.d.ts +35 -69
  913. package/dist/server/index.js +51 -59
  914. package/dist/server-types-C3p3jUqr.d.ts +583 -0
  915. package/dist/session-BOch2y2z.d.ts +96 -0
  916. package/dist/session-status-DRBRnZHx.d.ts +80 -0
  917. package/dist/shared-Bmcnxwie.js +16 -0
  918. package/dist/shared-Ci1g9nl4.js +90 -0
  919. package/dist/shared-DsBcvj6q.d.ts +9 -0
  920. package/dist/sign-in-BmigClRh.js +730 -0
  921. package/dist/sign-in-C9pZE1kM.d.ts +53 -0
  922. package/dist/sign-in-CXOg2Dwb.js +399 -0
  923. package/dist/sign-in-Dxyi4aKu.d.ts +83 -0
  924. package/dist/signatures-CBn7w4VR.js +144 -0
  925. package/dist/signatures-jPr9JXyw.d.ts +41 -0
  926. package/dist/signers-Cz5ZhTHH.d.ts +380 -0
  927. package/dist/signing-keys-BC5_hJN5.js +163 -0
  928. package/dist/signing-keys-DS-rIVzz.d.ts +117 -0
  929. package/dist/simplify-BzThKn5b.js +82 -0
  930. package/dist/solid/index.d.ts +12 -22
  931. package/dist/solid/index.js +10 -16
  932. package/dist/solid-start/index.d.ts +7 -9
  933. package/dist/solid-start/index.js +8 -9
  934. package/dist/spec/index.d.ts +6 -48
  935. package/dist/spec/index.js +23 -39
  936. package/dist/spec-6Vr7sc0Z.js +123 -0
  937. package/dist/spec-pins-CuQ2anBw.d.ts +125 -0
  938. package/dist/spec-pins-FKUzgF6K.js +61 -0
  939. package/dist/sql/index.d.ts +4 -4
  940. package/dist/sql/index.js +4 -4
  941. package/dist/sql-BPV51R3A.js +140626 -0
  942. package/dist/sql-C1K5JALb.js +420 -0
  943. package/dist/sql-type-XWMeZRAl.js +33 -0
  944. package/dist/sqlite/index.d.ts +3 -9
  945. package/dist/sqlite/index.js +5 -8
  946. package/dist/sso-BEvNf1oW.d.ts +159 -0
  947. package/dist/sso-CRnaFJh0.js +216 -0
  948. package/dist/ssr/index.d.ts +5 -5
  949. package/dist/ssr/index.js +3 -3
  950. package/dist/standard-BD2aOUsf.js +24 -0
  951. package/dist/standard-DRX6Ch1j.d.ts +5 -0
  952. package/dist/stats-BTJgRMEp.js +82 -0
  953. package/dist/statuses-BTrQ5H4S.js +27 -0
  954. package/dist/statuses-Bv-0XoYC.js +27 -0
  955. package/dist/storage/index.d.ts +3 -3
  956. package/dist/storage/index.js +27 -40
  957. package/dist/storage-api-COQr77e8.js +9 -0
  958. package/dist/store-CKKzmsWB.js +68 -0
  959. package/dist/store-c7QxUHX-.d.ts +81 -0
  960. package/dist/streams/index.d.ts +3 -7
  961. package/dist/streams/index.js +5 -6
  962. package/dist/streams/redis/index.d.ts +1 -3
  963. package/dist/streams/redis/index.js +6 -7
  964. package/dist/stripe/index.d.ts +1 -3
  965. package/dist/stripe/index.js +3 -4
  966. package/dist/stripe-Bl-sjnl6.d.ts +154 -0
  967. package/dist/stripe-DKRwRWew.js +31 -0
  968. package/dist/subject-readers-BARV5rNp.js +48 -0
  969. package/dist/subject-readers-DWkVSbFr.d.ts +19 -0
  970. package/dist/subject-type-BarjdHZV.js +7 -0
  971. package/dist/subjects-BGwLJ3IB.d.ts +148 -0
  972. package/dist/subjects-vci6Wufh.d.ts +86 -0
  973. package/dist/subscribers-C57054Pc.js +32 -0
  974. package/dist/summaries-CUemsYwV.d.ts +67 -0
  975. package/dist/supabase-mcp-DY32eoax.d.ts +44 -0
  976. package/dist/supabase-mcp-QvebHckf.js +27 -0
  977. package/dist/support-rZbdU35s.d.ts +351 -0
  978. package/dist/support-view-CvDEgyGY.js +17 -0
  979. package/dist/support-view-WY4Y-A40.d.ts +15 -0
  980. package/dist/svelte/index.d.ts +11 -21
  981. package/dist/svelte/index.js +9 -15
  982. package/dist/sveltekit/index.d.ts +10 -14
  983. package/dist/sveltekit/index.js +12 -14
  984. package/dist/table-schema-CwXg7oBz.d.ts +77 -0
  985. package/dist/table-schema-D-ss9ozY.js +291 -0
  986. package/dist/tables-BSiVuKKx.js +72 -0
  987. package/dist/tags-BVLELhOf.d.ts +28 -0
  988. package/dist/tags-CW-KvjdL.js +38 -0
  989. package/dist/tanstack-db/index.d.ts +4 -8
  990. package/dist/tanstack-db/index.js +4 -6
  991. package/dist/tanstack-start/index.d.ts +8 -12
  992. package/dist/tanstack-start/index.js +8 -10
  993. package/dist/tax-BD9dN1rx.d.ts +168 -0
  994. package/dist/tax-BwckP5dv.js +139 -0
  995. package/dist/tee-CVOMhEX-.js +100 -0
  996. package/dist/template-CNq9xcfx.js +125 -0
  997. package/dist/temporal-DKTdGK9i.js +94 -0
  998. package/dist/temporal-required-w_2u4EDp.js +19 -0
  999. package/dist/tenant-BR7fvPj7.js +26 -0
  1000. package/dist/tenant-RKvGBB-U.d.ts +15 -0
  1001. package/dist/tenant-source-46lMuMEn.js +7 -0
  1002. package/dist/testing/index.d.ts +87 -124
  1003. package/dist/testing/index.js +158 -128
  1004. package/dist/timeline-Bs-FGMIJ.js +49 -0
  1005. package/dist/timeline-Ck8OFuAN.d.ts +147 -0
  1006. package/dist/timing-B6yHayKA.js +94 -0
  1007. package/dist/topic-BBBCVLyS.js +640 -0
  1008. package/dist/topic-Dr8VYE4D.d.ts +411 -0
  1009. package/dist/transport-CS4cVH4S.js +30 -0
  1010. package/dist/ttl-cache-C5S0L2wx.js +31 -0
  1011. package/dist/types-BiedVwz_.d.ts +192 -0
  1012. package/dist/types-CCmW3MqI.d.ts +449 -0
  1013. package/dist/types-CL-z0A4K.d.ts +660 -0
  1014. package/dist/types-CvlJNzX4.d.ts +215 -0
  1015. package/dist/types-D9FY9qSJ.d.ts +247 -0
  1016. package/dist/types-DWZubmwk.d.ts +648 -0
  1017. package/dist/types-DnrJ_crV.js +28 -0
  1018. package/dist/types-Pv5WPfIC.d.ts +175 -0
  1019. package/dist/types-WZUVlTXs.d.ts +907 -0
  1020. package/dist/undo-BdoEJ6Ot.d.ts +44 -0
  1021. package/dist/undo-Dki6Ujak.js +43 -0
  1022. package/dist/upload-claim-Bo2mpBz4.js +32 -0
  1023. package/dist/usage-D27Uw426.d.ts +230 -0
  1024. package/dist/user-change-Ngy8z1fZ.js +133 -0
  1025. package/dist/variants-BaMleC56.js +51 -0
  1026. package/dist/vault-Dx0LaNMX.d.ts +60 -0
  1027. package/dist/vercel-connect/index.d.ts +194 -20
  1028. package/dist/vercel-connect/index.js +265 -33
  1029. package/dist/vercel-sandbox/index.d.ts +166 -0
  1030. package/dist/vercel-sandbox/index.js +171 -0
  1031. package/dist/verify-DY_j4GPZ.js +129 -0
  1032. package/dist/verify-DnL0Fgu0.d.ts +144 -0
  1033. package/dist/view-DmEZA1fL.d.ts +95 -0
  1034. package/dist/view-YnesSUEa.js +244 -0
  1035. package/dist/vue/index.d.ts +12 -22
  1036. package/dist/vue/index.js +10 -16
  1037. package/dist/watch-topic-BB7T05sc.d.ts +29 -0
  1038. package/dist/watch-topic-C2KxpeaB.js +56 -0
  1039. package/dist/wire-DIoLA8VL.js +90 -0
  1040. package/dist/wiring-DJBSLdyF.js +12 -0
  1041. package/dist/workflow-sdk/builder/index.d.ts +12 -14
  1042. package/dist/workflow-sdk/builder/index.js +12 -11
  1043. package/dist/workflow-sdk/index.d.ts +62 -6
  1044. package/dist/workflow-sdk/index.js +75 -10
  1045. package/dist/workflow-sdk/world/index.d.ts +13 -20
  1046. package/dist/workflow-sdk/world/index.js +115 -26
  1047. package/dist/workflow-sdk-BL3wzkdp.js +2749 -0
  1048. package/dist/workflow-sdk-D5zRSwxh.js +302 -0
  1049. package/dist/workflow-sdk-DMpVSMB7.d.ts +171 -0
  1050. package/dist/workflows-DKTw2PZo.d.ts +256 -0
  1051. package/dist/yjs/index.d.ts +3 -5
  1052. package/dist/yjs/index.js +6 -7
  1053. package/package.json +45 -31
  1054. package/schemas/config-v1.json +66 -4
  1055. package/schemas/doctor-report-v1.json +1 -0
  1056. package/schemas/snapshot-v2.json +7 -0
  1057. package/skills/better-supabase/SKILL.md +4 -4
  1058. package/skills/better-supabase/references/block-extensions.md +2 -2
  1059. package/skills/better-supabase/references/troubleshooting.md +1 -1
  1060. package/skills/better-supabase/references/ui-recipes.md +591 -325
  1061. package/skills/better-supabase-api/SKILL.md +1 -1
  1062. package/skills/better-supabase-api/references/adapters.md +3 -3
  1063. package/skills/better-supabase-api/references/ai.md +8 -0
  1064. package/skills/better-supabase-api/references/powersync.md +16 -0
  1065. package/skills/better-supabase-auth/SKILL.md +22 -19
  1066. package/skills/better-supabase-auth/references/authorization-providers.md +1 -1
  1067. package/dist/access-sql-CTDNuxRv.js +0 -385
  1068. package/dist/actor-CoveJgya.d.ts +0 -106
  1069. package/dist/actor-go7p9-CJ.js +0 -150
  1070. package/dist/adapter-D4aNBxhm.js +0 -2301
  1071. package/dist/agents-CM_cCtcr.d.ts +0 -117
  1072. package/dist/ai-cache-BFRKxgZ4.js +0 -87
  1073. package/dist/ai-cache-BTGqckta.d.ts +0 -82
  1074. package/dist/ai-chat-B7_vQvxU.d.ts +0 -619
  1075. package/dist/ai-files-m_2z3rH1.js +0 -339
  1076. package/dist/ai-message-DfaP8sis.js +0 -14
  1077. package/dist/ai-schedules-CZEfo-_M.d.ts +0 -166
  1078. package/dist/anchors-7F34QyHa.d.ts +0 -40
  1079. package/dist/api-3C0AWFeP.js +0 -696
  1080. package/dist/api-59rv5hL6.d.ts +0 -495
  1081. package/dist/api-keys-JE-aykZE.d.ts +0 -213
  1082. package/dist/app-tables-yyVncXEt.d.ts +0 -28
  1083. package/dist/approvals-BfEafAzt.d.ts +0 -129
  1084. package/dist/assistant-B49qATbj.d.ts +0 -157
  1085. package/dist/attachments-BXbLnNxm.js +0 -376
  1086. package/dist/attributes-Bzf51_nc.js +0 -47
  1087. package/dist/auth-DyF_LRxd.js +0 -20
  1088. package/dist/auth-link-B4NL84XU.d.ts +0 -104
  1089. package/dist/auth-link-D3-bU6yz.js +0 -118
  1090. package/dist/auth-module-BbmX-N4L.js +0 -52
  1091. package/dist/auth-reply-Dj124sbX.d.ts +0 -11
  1092. package/dist/auth-reply-tlXB2FQ9.js +0 -31
  1093. package/dist/authorization-CDU9tYA_.d.ts +0 -3860
  1094. package/dist/authorization-hooks-BWhkMZfH.d.ts +0 -221
  1095. package/dist/authorizer-B6X09otb.d.ts +0 -118
  1096. package/dist/authorizer-BGhXaDmo.js +0 -172
  1097. package/dist/automation-D41DXyvT.js +0 -75
  1098. package/dist/automations-8L3NEuoq.js +0 -29
  1099. package/dist/automations-BKjJpktQ.js +0 -33
  1100. package/dist/automations-BMuqwZZn.js +0 -314
  1101. package/dist/automations-EzXteupo.js +0 -31
  1102. package/dist/availability-BdeKCHpl.d.ts +0 -236
  1103. package/dist/base64-B9Wlsdj7.js +0 -42
  1104. package/dist/batch-limit-DKVQDz4o.js +0 -5
  1105. package/dist/before-route-B23K2zYU.js +0 -30
  1106. package/dist/bind-p7asfI6H.d.ts +0 -104
  1107. package/dist/block-authors-Bw3zdzgl.js +0 -14
  1108. package/dist/block-authors-DzXLUiIq.d.ts +0 -12
  1109. package/dist/block-env-B8wG3xeh.d.ts +0 -32
  1110. package/dist/block-event-listener-Bu6G0TFH.js +0 -16
  1111. package/dist/block-events-IWAyafO3.js +0 -83
  1112. package/dist/block-fields-BE7pInWZ.d.ts +0 -58
  1113. package/dist/block-fields-BjXgX_5c.js +0 -140
  1114. package/dist/block-helpers-B0f0ZVb5.js +0 -437
  1115. package/dist/block-helpers-D5emQ2O6.d.ts +0 -62
  1116. package/dist/block-hooks-B8itxzEE.d.ts +0 -117
  1117. package/dist/block-hooks-DKtz0HRh.js +0 -130
  1118. package/dist/block-method-C9hWdHom.js +0 -21
  1119. package/dist/block-method-CiVa2G-J.d.ts +0 -14
  1120. package/dist/block-subjects-C1_9DkSA.d.ts +0 -6
  1121. package/dist/block-subjects-DFSuFY1a.js +0 -55
  1122. package/dist/block-tenant-DHp7subc.js +0 -14
  1123. package/dist/block-transport-9EUA3q_I.d.ts +0 -69
  1124. package/dist/bookings-xsmM2TA_.d.ts +0 -289
  1125. package/dist/bucket-SvRQwYS4.d.ts +0 -705
  1126. package/dist/build-CH2N3Yf0.js +0 -2073
  1127. package/dist/build-DbIRFcHQ.js +0 -735
  1128. package/dist/carrier-KzeYXVrW.d.ts +0 -169
  1129. package/dist/casing-DdFWEtqr.js +0 -16
  1130. package/dist/channel-JcMd5lNP.d.ts +0 -105
  1131. package/dist/channels-CfcFPuo_.js +0 -114
  1132. package/dist/claims-Bp9My7XP.js +0 -88
  1133. package/dist/claims-DTy6R6my.js +0 -63
  1134. package/dist/cli/_format-Cax5EsM9.js +0 -101
  1135. package/dist/cli/add-BdhGOwkB.js +0 -1
  1136. package/dist/cli/add-D4w-Axib.js +0 -1231
  1137. package/dist/cli/add-Dggyehsy.js +0 -99
  1138. package/dist/cli/agent-CbuPvI2x.js +0 -185
  1139. package/dist/cli/app-table-files-CiGuwLkO.js +0 -346
  1140. package/dist/cli/arazzo-1.0-BalU61-_.js +0 -532
  1141. package/dist/cli/arazzo-1.1-Bnfasbun.js +0 -705
  1142. package/dist/cli/args-UEwg0l-N.js +0 -27
  1143. package/dist/cli/asyncapi-3.0.0-C78dBjR6.js +0 -5593
  1144. package/dist/cli/asyncapi-3.1.0-g-7aIfV1.js +0 -5833
  1145. package/dist/cli/backfill-DjVjXW_P.js +0 -293
  1146. package/dist/cli/blocks-Bbmb6W_F.js +0 -1
  1147. package/dist/cli/blocks-jRL9K1R8.js +0 -156
  1148. package/dist/cli/cache-BuoIFlUJ.js +0 -607
  1149. package/dist/cli/codemod-DRavXBCb.js +0 -2435
  1150. package/dist/cli/codemod-block-renames-BuSaTE_G.js +0 -239
  1151. package/dist/cli/command-DIPmo0wh.js +0 -997
  1152. package/dist/cli/compare-BmIWVEui.js +0 -9
  1153. package/dist/cli/completion-DxPxMtyP.js +0 -211
  1154. package/dist/cli/completion-DyLMSjOD.js +0 -1
  1155. package/dist/cli/completion-FUgqm2-N.js +0 -30
  1156. package/dist/cli/config-BfapErxs.js +0 -47
  1157. package/dist/cli/config-Cskysxp-.js +0 -2000
  1158. package/dist/cli/config-Df5cXWNN.js +0 -1
  1159. package/dist/cli/config-edit-CrWfk8s3.js +0 -621
  1160. package/dist/cli/config-group-CP-B9uRt.js +0 -390
  1161. package/dist/cli/content-mapper-BCtyfKXl.js +0 -182
  1162. package/dist/cli/db-CQCLx7cx.js +0 -78
  1163. package/dist/cli/db-CWvH1_46.js +0 -247
  1164. package/dist/cli/detect-D9JaAX20.js +0 -84
  1165. package/dist/cli/dist-D_VbPAMR.js +0 -129
  1166. package/dist/cli/dist-DuiMMRbJ.js +0 -1112
  1167. package/dist/cli/doctor-Di2ZekfN.js +0 -4659
  1168. package/dist/cli/env-B2CbnbzD.js +0 -143
  1169. package/dist/cli/env-BK0xKMeU.js +0 -1113
  1170. package/dist/cli/env-Bat6ogep.js +0 -1
  1171. package/dist/cli/env-CynGCICL.js +0 -1
  1172. package/dist/cli/errors-BTe6A15O.js +0 -98
  1173. package/dist/cli/exec-Ca5s-ygi.js +0 -463
  1174. package/dist/cli/fastest-levenshtein-dhRRvrM2.js +0 -120
  1175. package/dist/cli/files-CX71yBm8.js +0 -1010
  1176. package/dist/cli/fresh-import-DzgsGHkX.js +0 -40
  1177. package/dist/cli/gen-STKC9vkK.js +0 -394
  1178. package/dist/cli/guards-CUlDNYZs.js +0 -8
  1179. package/dist/cli/in-stack-diff-Cp-tVPj2.js +0 -186
  1180. package/dist/cli/init-DW6_nIwj.js +0 -559
  1181. package/dist/cli/io-DH1kcmmP.js +0 -37
  1182. package/dist/cli/json5-ChRycquj.js +0 -787
  1183. package/dist/cli/jsonc-C8M0EhHB.js +0 -1
  1184. package/dist/cli/jsonc-D5Fu67jw.js +0 -45
  1185. package/dist/cli/keys-V-HcO-21.js +0 -106
  1186. package/dist/cli/legacy-prefix-R7UChFFl.js +0 -154
  1187. package/dist/cli/live-0G4Plw3K.js +0 -341
  1188. package/dist/cli/mcp-flKS8iU5.js +0 -241
  1189. package/dist/cli/metadata-VARUbXEe.js +0 -150
  1190. package/dist/cli/migrate-Bkq07XcT.js +0 -46
  1191. package/dist/cli/migration-safety-BfVeza5j.js +0 -928
  1192. package/dist/cli/migrations-BCq7Zs2E.js +0 -117
  1193. package/dist/cli/module-migration-lbeUrsYv.js +0 -119
  1194. package/dist/cli/moved-DNOtp9LA.js +0 -254
  1195. package/dist/cli/ohash-BjQY1cBb.js +0 -277
  1196. package/dist/cli/openapi-3.0-t7xwkuRH.js +0 -928
  1197. package/dist/cli/openapi-3.1-CVze7tBS.js +0 -870
  1198. package/dist/cli/openapi-3.2-CFoMYM01.js +0 -1031
  1199. package/dist/cli/orphans-BAboqyVM.js +0 -28
  1200. package/dist/cli/parse-BPf3kGnc.js +0 -182
  1201. package/dist/cli/powersync-B15CfH5Y.js +0 -284
  1202. package/dist/cli/powersync-DnBsDchT.js +0 -1
  1203. package/dist/cli/preset-BwmIfFnh.js +0 -101
  1204. package/dist/cli/print-DjxpBRnv.js +0 -68
  1205. package/dist/cli/prompts-jqnr94b9.js +0 -1140
  1206. package/dist/cli/providers-dyxcHQY3.js +0 -301
  1207. package/dist/cli/redact-KGAk2Ul9.js +0 -38
  1208. package/dist/cli/remove-BLq5gbal.js +0 -239
  1209. package/dist/cli/render-CizUf3RW.js +0 -2225
  1210. package/dist/cli/rolldown-runtime-kJ_i4yPo.js +0 -26
  1211. package/dist/cli/run-ChEjR7yw.js +0 -63
  1212. package/dist/cli/run-ChOY6s4o.js +0 -1459
  1213. package/dist/cli/run-MwM__teL.js +0 -705
  1214. package/dist/cli/seed-BOun22-k.js +0 -1
  1215. package/dist/cli/seed-CDnL4Tnc.js +0 -188
  1216. package/dist/cli/shared-DV5wIv-7.js +0 -151
  1217. package/dist/cli/shell-Btv_4Yhe.js +0 -10
  1218. package/dist/cli/skills-DM3oeIxY.js +0 -121
  1219. package/dist/cli/snapshot-B5LXkVMC.js +0 -729
  1220. package/dist/cli/source-BoLNG_2A.js +0 -320
  1221. package/dist/cli/source-args-v8ljFDfc.js +0 -59
  1222. package/dist/cli/spec-D6QeE2Zx.js +0 -1
  1223. package/dist/cli/spec-Dz-PGCaM.js +0 -7530
  1224. package/dist/cli/sql-layout-zo02f3Dm.js +0 -261
  1225. package/dist/cli/stack-ClESAZYf.js +0 -135
  1226. package/dist/cli/stack-env-3ziggrU3.js +0 -93
  1227. package/dist/cli/stack-status-BkkYRlXG.js +0 -46
  1228. package/dist/cli/stacks-CiDBH1dB.js +0 -232
  1229. package/dist/cli/style-Bm2X5JrN.js +0 -35
  1230. package/dist/cli/supabase-toml-CncmQbO0.js +0 -1164
  1231. package/dist/cli/sync-m-oZ_SyI.js +0 -322
  1232. package/dist/cli/table-dyKddjwo.js +0 -89
  1233. package/dist/cli/toml-DB-MNnFs.js +0 -424
  1234. package/dist/cli/topics-BpdnYmWb.js +0 -30
  1235. package/dist/cli/trace-VbdO6bcN.js +0 -7
  1236. package/dist/cli/upgrade-C9sgVZ5z.js +0 -272
  1237. package/dist/cli/upgrade-WwEJaX3i.js +0 -41
  1238. package/dist/cli/validate-B3lF3-jB.js +0 -7522
  1239. package/dist/cli/version-D2BQuqta.js +0 -4
  1240. package/dist/cli/yaml-CYCbJ6et.js +0 -2252
  1241. package/dist/client-C_mlji5R.js +0 -288
  1242. package/dist/clone-CkG0-hlI.js +0 -33
  1243. package/dist/cloud-event-0pQ9vFNS.d.ts +0 -64
  1244. package/dist/cloud-event-XsM53POL.js +0 -63
  1245. package/dist/codecs-CMWlhHZ0.d.ts +0 -222
  1246. package/dist/codecs-CSUFGrdP.js +0 -358
  1247. package/dist/compiler-BEeVWXPS.d.ts +0 -14
  1248. package/dist/compose-DKW0Tr3e.js +0 -53
  1249. package/dist/composite-BJ9s-IJJ.d.ts +0 -83
  1250. package/dist/composite-CBRbvn5j.js +0 -130
  1251. package/dist/config-bqKaPjst.js +0 -1679
  1252. package/dist/config-r7njjNgh.js +0 -1111
  1253. package/dist/connectors-uC5baoFV.d.ts +0 -147
  1254. package/dist/context-DBicfUNz.js +0 -41
  1255. package/dist/context-nbYYjv7U.d.ts +0 -4344
  1256. package/dist/controller-BEliOBOv.js +0 -79
  1257. package/dist/controller-TRocodqG.d.ts +0 -52
  1258. package/dist/controller-qG-B1eDn.js +0 -73
  1259. package/dist/conversion-Dq1S7xzE.js +0 -77
  1260. package/dist/conversion-g8HzH9My.d.ts +0 -86
  1261. package/dist/cors-h_v7TPxl.js +0 -24
  1262. package/dist/cors-kLq6VM06.d.ts +0 -15
  1263. package/dist/create-blocks-BfrDUSM6.js +0 -370
  1264. package/dist/cron-DdT4ti8a.js +0 -148
  1265. package/dist/cron-route-FjKgRvTY.js +0 -24
  1266. package/dist/csv-2rXGPNtP.js +0 -89
  1267. package/dist/csv-DhHQS2x_.d.ts +0 -28
  1268. package/dist/data-engine-D1BkmBoR.js +0 -173
  1269. package/dist/data-engine-rvbR2C4F.d.ts +0 -273
  1270. package/dist/data-hooks-CdcZfVS1.js +0 -280
  1271. package/dist/db-exception-Lngc1W49.js +0 -31
  1272. package/dist/deal-forecast-CKBnRodz.js +0 -39
  1273. package/dist/deal-forecast-LwO-Z4_C.d.ts +0 -23
  1274. package/dist/define-D-dLADd5.js +0 -2084
  1275. package/dist/define-D8_9X5fZ.d.ts +0 -1263
  1276. package/dist/define-block-BGqOO8B3.js +0 -64
  1277. package/dist/define-block-DWVZSZv1.d.ts +0 -1687
  1278. package/dist/delegation-C7eWP2r8.d.ts +0 -14
  1279. package/dist/delegation-DGOIiT8k.js +0 -153
  1280. package/dist/delivery-Bm0jxmzI.js +0 -29
  1281. package/dist/delivery-n6lZGuGx.d.ts +0 -71
  1282. package/dist/documents-BbwYyynk.d.ts +0 -152
  1283. package/dist/email-B3YxEzwC.d.ts +0 -42
  1284. package/dist/embeddings-I3s5sTDt.d.ts +0 -78
  1285. package/dist/embeddings-vVzseUw0.js +0 -128
  1286. package/dist/ended-EZzN9QTM.d.ts +0 -26
  1287. package/dist/entitlements-B1i1-wfe.d.ts +0 -54
  1288. package/dist/entitlements-tGL6-69B.js +0 -45
  1289. package/dist/entity-naming-Dtyq5sKE.js +0 -131
  1290. package/dist/entity-schema-B1YmMtP8.js +0 -39
  1291. package/dist/envelope-DEI2iX-d.js +0 -90
  1292. package/dist/errors-BVFgt8BZ.js +0 -328
  1293. package/dist/errors-CyxMxzlu.js +0 -44
  1294. package/dist/escape-like-DHfx6jRr.js +0 -7
  1295. package/dist/escape-like-PReMbEEU.d.ts +0 -30
  1296. package/dist/eve-BfhVFV33.d.ts +0 -157
  1297. package/dist/event-calendar-DVLs2wUO.d.ts +0 -65
  1298. package/dist/event-map-CtPFhcOp.js +0 -19
  1299. package/dist/events-B2qbZps6.d.ts +0 -854
  1300. package/dist/events-D6IZ5CE8.js +0 -82
  1301. package/dist/events-DuLhzjP6.js +0 -26
  1302. package/dist/executor-BfirBzOr.d.ts +0 -174
  1303. package/dist/executor-BlS0kCrN.d.ts +0 -104
  1304. package/dist/executor-C2Ne-Scm.js +0 -208
  1305. package/dist/executor-DXQIx4sW.d.ts +0 -37
  1306. package/dist/executor-DqIci3Jb.js +0 -486
  1307. package/dist/executor-WolvKszH.js +0 -843
  1308. package/dist/extension-DTaHjwdc.js +0 -59
  1309. package/dist/extension-DeAd_MqI.js +0 -121
  1310. package/dist/extension-DzCc0IOd.js +0 -103
  1311. package/dist/extension-mGylYROs.js +0 -53
  1312. package/dist/extension-shared-Djm8mGHD.js +0 -60
  1313. package/dist/extra-CGQ2_q3S.js +0 -10
  1314. package/dist/field-errors-tJvehEFc.d.ts +0 -216
  1315. package/dist/field-formats-C6QKA3UR.js +0 -102
  1316. package/dist/field-formats-CAFNkKSN.d.ts +0 -38
  1317. package/dist/fields-BBm49w-E.js +0 -108
  1318. package/dist/fields-snbaZ14h.d.ts +0 -78
  1319. package/dist/filter-evaluate-BRpNiNPG.d.ts +0 -37
  1320. package/dist/filter-evaluate-lCToXzZI.js +0 -217
  1321. package/dist/filter-query-CQ6d5GnQ.js +0 -566
  1322. package/dist/filter-query-DBt7OKuH.d.ts +0 -133
  1323. package/dist/flags-DDKTThrO.d.ts +0 -246
  1324. package/dist/flags-DF_SCqp5.js +0 -279
  1325. package/dist/form-definition-BTpM_tz1.js +0 -363
  1326. package/dist/form-definition-BjEtH8BT.d.ts +0 -119
  1327. package/dist/format-u-65igKI.d.ts +0 -79
  1328. package/dist/framework-DVYTtQXA.d.ts +0 -47
  1329. package/dist/framework-DYEUraqt.js +0 -58
  1330. package/dist/function-contract-DxFNOmsm.d.ts +0 -27
  1331. package/dist/function-contract-pEmsaUIf.js +0 -8
  1332. package/dist/gateway-Ve7cByEr.d.ts +0 -115
  1333. package/dist/gateway-options-BlVCqgb8.d.ts +0 -29
  1334. package/dist/gateway-options-Cl74B7k6.js +0 -27
  1335. package/dist/guards-6F2bCtQR.js +0 -12
  1336. package/dist/guest-actions-1T1DeS5Y.d.ts +0 -5
  1337. package/dist/guest-actions-B7zdhfnh.js +0 -9
  1338. package/dist/history-GH1HJWQV.js +0 -271
  1339. package/dist/hmac-B3CTTlfv.js +0 -23
  1340. package/dist/http-7-UvHjQe.js +0 -28
  1341. package/dist/http-BjjojWg3.js +0 -40
  1342. package/dist/http-DzbloBR-.js +0 -141
  1343. package/dist/image-url-_d7xYsXK.js +0 -84
  1344. package/dist/impersonation-DM3oWNoD.js +0 -62
  1345. package/dist/impersonation-YTa9dZUv.d.ts +0 -28
  1346. package/dist/inbox-c8B86Trp.d.ts +0 -321
  1347. package/dist/index-8US7qlvW.d.ts +0 -158
  1348. package/dist/index-B4wttiLh.d.ts +0 -407
  1349. package/dist/index-BKrxynq9.d.ts +0 -240
  1350. package/dist/index-BM6NmKSc.d.ts +0 -588
  1351. package/dist/index-BkzXwuIN.d.ts +0 -338
  1352. package/dist/index-CWAQRWY8.d.ts +0 -729
  1353. package/dist/index-Cxsnd-OL.d.ts +0 -305
  1354. package/dist/index-DbyDZZlc.d.ts +0 -53
  1355. package/dist/index-NRMMhhEi.d.ts +0 -104
  1356. package/dist/index-X2fkPUwb.d.ts +0 -51
  1357. package/dist/index-pZn6S_iq.d.ts +0 -149
  1358. package/dist/index-zsgNmE8m.d.ts +0 -665
  1359. package/dist/instance-property-hRh88y_s.js +0 -7
  1360. package/dist/instances-C7qUTjhJ.js +0 -16603
  1361. package/dist/invalidate-DMp4eqfF.d.ts +0 -21
  1362. package/dist/iso4217-B-durg_y.js +0 -176
  1363. package/dist/json-DaByVJpw.js +0 -22
  1364. package/dist/json-schema-DHJxiizN.js +0 -888
  1365. package/dist/jwks-cache-DEsKI0hJ.js +0 -49
  1366. package/dist/jws-D0toeQlA.d.ts +0 -66
  1367. package/dist/jws-DOgHJKHb.js +0 -205
  1368. package/dist/kit-B8yWCRN7.d.ts +0 -94
  1369. package/dist/kit-Bcd9wYCV.js +0 -133
  1370. package/dist/knowledge-CsLPACGJ.d.ts +0 -217
  1371. package/dist/knowledge-tCrrU99q.js +0 -300
  1372. package/dist/list-query-BcU8NnNL.d.ts +0 -222
  1373. package/dist/list-query-BnpA2BDg.js +0 -559
  1374. package/dist/live-C21DgbsD.js +0 -275
  1375. package/dist/logger-DWVYUmwi.d.ts +0 -18
  1376. package/dist/logger-glM28NVN.js +0 -21
  1377. package/dist/lookup-BaP5bI27.js +0 -18
  1378. package/dist/management-wtecfrNf.d.ts +0 -57
  1379. package/dist/message-Bg4TKA12.d.ts +0 -99
  1380. package/dist/messages-ecPW_nOv.js +0 -492
  1381. package/dist/messaging-DQP09JsY.d.ts +0 -297
  1382. package/dist/methods-Cund9ZBe.js +0 -11
  1383. package/dist/metric-definition-BjxVn4R5.js +0 -117
  1384. package/dist/metric-definition-EAYI1r2n.d.ts +0 -69
  1385. package/dist/mfa-oIOYTpvc.d.ts +0 -36
  1386. package/dist/model-hwpvole9.d.ts +0 -340
  1387. package/dist/model-messages-CkZSDDHP.js +0 -206
  1388. package/dist/model-messages-DrR4lZ_c.d.ts +0 -34
  1389. package/dist/money-BNRdJQzA.d.ts +0 -91
  1390. package/dist/money-BZl985O-.js +0 -197
  1391. package/dist/money-codec-BJuS2zEW.js +0 -41
  1392. package/dist/my-work-kinds-BU3SlA-6.js +0 -11
  1393. package/dist/node-headers-BPtMP4_V.d.ts +0 -27
  1394. package/dist/node-headers-C71zNQHe.js +0 -55
  1395. package/dist/operations-CB9atU2e.d.ts +0 -6
  1396. package/dist/operations-DVHRHvv6.js +0 -29
  1397. package/dist/optional-peer-C1NbBRJm.js +0 -32
  1398. package/dist/options-3OYOU56e.js +0 -11
  1399. package/dist/options-56zYYXxc.js +0 -10
  1400. package/dist/options-5WvWOkAm.d.ts +0 -26
  1401. package/dist/options-62woPFn3.js +0 -12
  1402. package/dist/options-7ixoOoap.js +0 -10
  1403. package/dist/options-9dSU5RML.js +0 -5
  1404. package/dist/options-B0YZtAkb.d.ts +0 -15
  1405. package/dist/options-B2Kz_tCx.js +0 -10
  1406. package/dist/options-B5E2MGIz.js +0 -15
  1407. package/dist/options-B685YSzQ.js +0 -5
  1408. package/dist/options-B692WoK6.js +0 -9
  1409. package/dist/options-BHU1wc74.js +0 -5
  1410. package/dist/options-BHy0Z5Zd.js +0 -5
  1411. package/dist/options-BJtdsK7b.js +0 -8
  1412. package/dist/options-BKBy5wM_.js +0 -16
  1413. package/dist/options-BKDxrPvE.js +0 -5
  1414. package/dist/options-BLfymS4s.js +0 -5
  1415. package/dist/options-BOCRbzh3.js +0 -5
  1416. package/dist/options-BOqfYsM1.js +0 -13
  1417. package/dist/options-BQWJqwHO.js +0 -9
  1418. package/dist/options-BQunK6_Y.js +0 -8
  1419. package/dist/options-BQyrZjwM.js +0 -28
  1420. package/dist/options-BR9xTHZW.js +0 -5
  1421. package/dist/options-BRUdd5jY.js +0 -8
  1422. package/dist/options-BSsYXjhC.js +0 -9
  1423. package/dist/options-BTmaRzx2.d.ts +0 -60
  1424. package/dist/options-BUCQYAeJ.d.ts +0 -10
  1425. package/dist/options-B_NrjVDt.d.ts +0 -12
  1426. package/dist/options-BawzwlmC.js +0 -11
  1427. package/dist/options-BbLDAp7G.d.ts +0 -10
  1428. package/dist/options-BfPsL7E2.js +0 -9
  1429. package/dist/options-Bfmwwc78.js +0 -8
  1430. package/dist/options-BhsdveDk.js +0 -21
  1431. package/dist/options-BomoTH-8.js +0 -5
  1432. package/dist/options-BtjkzIVh.js +0 -8
  1433. package/dist/options-Bvi9bl4H.js +0 -5
  1434. package/dist/options-BwKNmaJo.js +0 -5
  1435. package/dist/options-BxpLtyk-.js +0 -18
  1436. package/dist/options-BzB2QxL3.js +0 -5
  1437. package/dist/options-C078wBP0.js +0 -5
  1438. package/dist/options-C3AdsFJ6.js +0 -9
  1439. package/dist/options-C7C5OhmL.d.ts +0 -8
  1440. package/dist/options-C87u6eSa.js +0 -10
  1441. package/dist/options-CBAEGxwS.js +0 -8
  1442. package/dist/options-CDSCkYxu.d.ts +0 -14
  1443. package/dist/options-CDUr8zzX.js +0 -8
  1444. package/dist/options-CFjGxfa8.js +0 -5
  1445. package/dist/options-CI6P0xhV.js +0 -10
  1446. package/dist/options-CJFMK9A_.js +0 -8
  1447. package/dist/options-CLpgx7en.js +0 -10
  1448. package/dist/options-COo7_3MX.js +0 -10
  1449. package/dist/options-CSCXNYJO.d.ts +0 -8
  1450. package/dist/options-CTXHj9zr.js +0 -16
  1451. package/dist/options-CTl8T88w.js +0 -11
  1452. package/dist/options-CUIOOv4z.js +0 -15
  1453. package/dist/options-CZDmtsbV.js +0 -8
  1454. package/dist/options-CZTscdPB.js +0 -5
  1455. package/dist/options-CZdKndeo.js +0 -9
  1456. package/dist/options-C_7g9TTq.d.ts +0 -12
  1457. package/dist/options-Cb2FOFj5.js +0 -5
  1458. package/dist/options-CbOstLa7.js +0 -5
  1459. package/dist/options-CcXgWlvm.js +0 -24
  1460. package/dist/options-CfVPctAw.js +0 -89
  1461. package/dist/options-Cjgaf8ub.js +0 -8
  1462. package/dist/options-CoSPgWKy.js +0 -9
  1463. package/dist/options-CpZ2HlSU.js +0 -32
  1464. package/dist/options-CsSe8Nba.js +0 -8
  1465. package/dist/options-CsvJR-r2.js +0 -9
  1466. package/dist/options-Cucv6sWP.js +0 -12
  1467. package/dist/options-CyjL9lTf.js +0 -5
  1468. package/dist/options-D-OOO9V2.d.ts +0 -10
  1469. package/dist/options-D0Y6ZMe8.js +0 -5
  1470. package/dist/options-D0bzZx9a.d.ts +0 -10
  1471. package/dist/options-D0sj5abR.js +0 -9
  1472. package/dist/options-D1hSuf50.d.ts +0 -12
  1473. package/dist/options-D610Fa6T.js +0 -5
  1474. package/dist/options-D96dScev.js +0 -24
  1475. package/dist/options-DFpyP1bg.js +0 -5
  1476. package/dist/options-DJEcS4DX.js +0 -5
  1477. package/dist/options-DJbN3bi9.js +0 -11
  1478. package/dist/options-DKoQoRCy.js +0 -13
  1479. package/dist/options-DM1qaMMQ.js +0 -9
  1480. package/dist/options-DNgSwhsm.js +0 -11
  1481. package/dist/options-DOIwzRXL.js +0 -16
  1482. package/dist/options-DRIgHh4O.d.ts +0 -16
  1483. package/dist/options-DRrZmJyI.js +0 -8
  1484. package/dist/options-DUMUsvml.js +0 -5
  1485. package/dist/options-DWwL5Kaz.js +0 -9
  1486. package/dist/options-DZHZYlpD.js +0 -10
  1487. package/dist/options-DZLkeqWn.js +0 -9
  1488. package/dist/options-DZRpXKQE.js +0 -5
  1489. package/dist/options-DZen3UiC.js +0 -14
  1490. package/dist/options-D_9Vxx7f.js +0 -8
  1491. package/dist/options-DcHl59RC.js +0 -11
  1492. package/dist/options-Dcaql09y.js +0 -11
  1493. package/dist/options-DcnBNYmV.js +0 -8
  1494. package/dist/options-DdpM-fiP.js +0 -9
  1495. package/dist/options-DhoLMknl.js +0 -10
  1496. package/dist/options-DlohRAYd.d.ts +0 -13
  1497. package/dist/options-Dpy-Ruo-.js +0 -14
  1498. package/dist/options-DsVuVRH3.d.ts +0 -17
  1499. package/dist/options-DtAJxfHS.js +0 -8
  1500. package/dist/options-Dz9Yo52Z.js +0 -8
  1501. package/dist/options-HnfETSHr.d.ts +0 -19
  1502. package/dist/options-LqUXTpML.js +0 -8
  1503. package/dist/options-MsloEAIB.js +0 -5
  1504. package/dist/options-P2FxqYpd.js +0 -17
  1505. package/dist/options-_1gAIMq7.d.ts +0 -60
  1506. package/dist/options-aT89JqlB.js +0 -5
  1507. package/dist/options-cVKZu9b0.js +0 -9
  1508. package/dist/options-eTepQ1rZ.js +0 -15
  1509. package/dist/options-fkShrmGQ.js +0 -8
  1510. package/dist/options-gUvfr3no.js +0 -11
  1511. package/dist/options-hynwKWuf.js +0 -20
  1512. package/dist/options-jsOCvLUz.js +0 -10
  1513. package/dist/options-o5wCw8H7.d.ts +0 -14
  1514. package/dist/options-p49DFg3H.js +0 -8
  1515. package/dist/options-pYNpXKcg.js +0 -8
  1516. package/dist/options-qtETCHzW.js +0 -10
  1517. package/dist/options-rnKlqYEr.js +0 -5
  1518. package/dist/options-sU_zGkiV.js +0 -10
  1519. package/dist/options-xq4MXG1M.js +0 -5
  1520. package/dist/options-zzlznRA7.js +0 -10
  1521. package/dist/outbox-BZ712Z3X.d.ts +0 -199
  1522. package/dist/payments-BXvabJOw.js +0 -16
  1523. package/dist/payments-BYcN34Fp.d.ts +0 -114
  1524. package/dist/permissions-controller-BMsqIE5T.js +0 -34
  1525. package/dist/pg-error-B5QLDcbG.js +0 -26
  1526. package/dist/plugin-AKwwe2gF.js +0 -48
  1527. package/dist/pool-DDR1ndk7.d.ts +0 -123
  1528. package/dist/pool-errors-JUBcGrre.js +0 -27
  1529. package/dist/ports-DvpNseap.js +0 -152
  1530. package/dist/ports-hpbyMySO.d.ts +0 -89
  1531. package/dist/postgrest-AJc8hnJU.d.ts +0 -53
  1532. package/dist/postgrest-executor-B_Uezhrm.js +0 -1068
  1533. package/dist/preset-DCdEnJj9.js +0 -1042
  1534. package/dist/problem-Bf0cJ7tk.js +0 -162
  1535. package/dist/problem-DNwN8iGz.d.ts +0 -79
  1536. package/dist/project-B32wb5J6.js +0 -1760
  1537. package/dist/provider-B6g7rBZX.js +0 -57
  1538. package/dist/provider-CWjzAIX9.d.ts +0 -112
  1539. package/dist/push-token-D6REHMMw.js +0 -16
  1540. package/dist/push-token-DQ1ycFPU.d.ts +0 -24
  1541. package/dist/queries-BWYYS9um.js +0 -239
  1542. package/dist/range-DwpWe8e7.js +0 -7
  1543. package/dist/range-p5V4rBhZ.d.ts +0 -8
  1544. package/dist/rank-keys-DcPMt_Jk.js +0 -60
  1545. package/dist/rank-result-BBJIK-k_.js +0 -18
  1546. package/dist/rank-result-Bwe7igy-.d.ts +0 -14
  1547. package/dist/rate-limit-BWKGlhTM.js +0 -49
  1548. package/dist/rate-limit-Bztf32cl.d.ts +0 -50
  1549. package/dist/rate-limit-fZ_d8gSE.js +0 -380
  1550. package/dist/ratelimit-headers-kEcXyO3H.js +0 -62
  1551. package/dist/react-BKCnIuZs.js +0 -79
  1552. package/dist/react-CcrQQl0_.js +0 -1016
  1553. package/dist/read-set-B1sDib5O.js +0 -199
  1554. package/dist/realtime-status-BhNkb-Ow.d.ts +0 -8
  1555. package/dist/realtime-status-asHvhiOh.js +0 -11
  1556. package/dist/record-bindings-Z51mGfhB.js +0 -26
  1557. package/dist/record-form-CubgBrtI.d.ts +0 -82
  1558. package/dist/record-type-DRbnlj5q.js +0 -221
  1559. package/dist/recordings-DeZYx-Kv.d.ts +0 -119
  1560. package/dist/refresh-D02Pbf5B.d.ts +0 -54
  1561. package/dist/refusal-B0VmlAxF.d.ts +0 -32
  1562. package/dist/refusal-DDlInPff.js +0 -64
  1563. package/dist/relay-CIKcAVjf.js +0 -248
  1564. package/dist/replicas-Dyoh3CEg.js +0 -94
  1565. package/dist/resolve-B0mW2m7f.js +0 -932
  1566. package/dist/resolve-CtX6T0c0.d.ts +0 -288
  1567. package/dist/resolved-names-iLBOUaib.js +0 -133
  1568. package/dist/resource-BUJcZKiW.js +0 -520
  1569. package/dist/resource-DvgXqZB_.js +0 -105
  1570. package/dist/resource-WxN0IsvB.d.ts +0 -123
  1571. package/dist/resource-execute-BzqR8DdD.d.ts +0 -15
  1572. package/dist/resource-schemas-up6bKOUi.js +0 -82
  1573. package/dist/resource-types-BVbHgTPg.d.ts +0 -157
  1574. package/dist/resources-BSbRa0Ab.d.ts +0 -7
  1575. package/dist/resources-jb3R6rEa.js +0 -64
  1576. package/dist/respond-CZMWbUs3.js +0 -107
  1577. package/dist/respond-Dzu_-EPH.d.ts +0 -112
  1578. package/dist/result-DZeA5KS6.d.ts +0 -351
  1579. package/dist/result-ntFBW2p2.js +0 -146
  1580. package/dist/rows-BdqXmiB-.js +0 -80
  1581. package/dist/rows-jijHLVE_.js +0 -39
  1582. package/dist/rrule-C9Ot6ax8.js +0 -290
  1583. package/dist/run-state-BMCD_1Lt.d.ts +0 -13
  1584. package/dist/run-state-CgBKzYMW.js +0 -13
  1585. package/dist/run-watch-B-LoK5m1.js +0 -53
  1586. package/dist/runtime-CoKxZibd.js +0 -45
  1587. package/dist/sales-lines-BsmrNHe9.d.ts +0 -38
  1588. package/dist/sales-lines-DO7oRu1o.js +0 -45
  1589. package/dist/sales-shared-BuTA8JK7.js +0 -22
  1590. package/dist/schemas-CLOTvdsC.js +0 -216
  1591. package/dist/scope-DgWjuXUw.js +0 -90
  1592. package/dist/scores-Y8TvyJi1.d.ts +0 -174
  1593. package/dist/scores-bY2Is0kx.js +0 -177
  1594. package/dist/search-Cn_DGluL.js +0 -9
  1595. package/dist/server-types-BkTIxW_H.d.ts +0 -597
  1596. package/dist/session-BOzx2qHC.d.ts +0 -100
  1597. package/dist/session-status-BP8eYVnA.d.ts +0 -82
  1598. package/dist/shared-BeHTi8Fu.js +0 -17
  1599. package/dist/shared-Bf-I13Ht.js +0 -91
  1600. package/dist/shared-CRRfQAKG.d.ts +0 -11
  1601. package/dist/sign-in-BzihC_8k.d.ts +0 -50
  1602. package/dist/sign-in-CmPK1AgM.js +0 -402
  1603. package/dist/sign-in-Cyj3ZlFX.js +0 -703
  1604. package/dist/sign-in-D54FLMQy.d.ts +0 -55
  1605. package/dist/signatures-CX1b4WHa.js +0 -145
  1606. package/dist/signatures-Dkx9OE8j.d.ts +0 -43
  1607. package/dist/signers-ZmxO1I05.d.ts +0 -390
  1608. package/dist/signing-keys-CWtpMask.js +0 -164
  1609. package/dist/signing-keys-udgP7Aod.d.ts +0 -119
  1610. package/dist/simplify-DDO0j0LI.js +0 -83
  1611. package/dist/spec-BMvCCNnd.js +0 -124
  1612. package/dist/spec-pins-BZkKfwY8.d.ts +0 -127
  1613. package/dist/spec-pins-D3zDek-u.js +0 -62
  1614. package/dist/sql-CYt7EhH0.js +0 -421
  1615. package/dist/sql-CyeDg3Yh.js +0 -138146
  1616. package/dist/sql-type-iUSZpaUu.js +0 -34
  1617. package/dist/sso-CkU_4mtK.d.ts +0 -161
  1618. package/dist/sso-DdDpJQzw.js +0 -217
  1619. package/dist/standard-BA3mLh6w.js +0 -25
  1620. package/dist/standard-DBV730sF.d.ts +0 -7
  1621. package/dist/stats-BHl1-zj9.js +0 -83
  1622. package/dist/statuses-Alll5Ip6.js +0 -29
  1623. package/dist/statuses-zRcc2TeZ.js +0 -28
  1624. package/dist/storage-api-Dg78Wqsg.js +0 -10
  1625. package/dist/store-CpheI-lN.d.ts +0 -83
  1626. package/dist/store-McN-2esd.js +0 -69
  1627. package/dist/stripe-BJUfp5jM.js +0 -32
  1628. package/dist/stripe-X22LjuH-.d.ts +0 -156
  1629. package/dist/subject-readers-CB5Te02u.d.ts +0 -21
  1630. package/dist/subject-readers-VHcrWhmq.js +0 -49
  1631. package/dist/subject-type-BRnK7Av3.js +0 -8
  1632. package/dist/subjects-BYCL-6hA.d.ts +0 -145
  1633. package/dist/subjects-CiBNKy2y.d.ts +0 -90
  1634. package/dist/subscribers-BvZxcd63.js +0 -33
  1635. package/dist/summaries-8jQTELIX.d.ts +0 -69
  1636. package/dist/supabase-mcp-Dz9DgrKP.js +0 -28
  1637. package/dist/supabase-mcp-Z4vtsuoO.d.ts +0 -46
  1638. package/dist/support-BxyPOFk4.d.ts +0 -357
  1639. package/dist/support-view-g4YLBeqX.js +0 -18
  1640. package/dist/support-view-nqUWKHEs.d.ts +0 -17
  1641. package/dist/table-schema-BlF6k62Q.d.ts +0 -81
  1642. package/dist/table-schema-C80xItaV.js +0 -293
  1643. package/dist/tables-Cb-3_VWc.js +0 -73
  1644. package/dist/tags-CIZTqtlY.js +0 -39
  1645. package/dist/tags-Cm48BsOa.d.ts +0 -30
  1646. package/dist/tax-BkCNWWMc.js +0 -140
  1647. package/dist/tax-DPShHual.d.ts +0 -170
  1648. package/dist/tee-V97_v1ZS.js +0 -101
  1649. package/dist/template-Drgg3v2J.js +0 -126
  1650. package/dist/temporal-Dbo0fLzc.js +0 -95
  1651. package/dist/temporal-required-DcLhnDhQ.js +0 -20
  1652. package/dist/tenant-BgIiMQpo.js +0 -27
  1653. package/dist/tenant-C9YE_kqK.d.ts +0 -17
  1654. package/dist/tenant-source-bqWpSr86.js +0 -8
  1655. package/dist/timeline--VU3A1e4.js +0 -50
  1656. package/dist/timeline-DvXtXq5q.d.ts +0 -151
  1657. package/dist/timing-dypS0nxW.js +0 -95
  1658. package/dist/topic-DnsNG4Kj.js +0 -643
  1659. package/dist/topic-breZqx_4.d.ts +0 -415
  1660. package/dist/ttl-cache-Bhr9swjT.js +0 -32
  1661. package/dist/types-B-D6fYx2.d.ts +0 -194
  1662. package/dist/types-C3I7S51U.d.ts +0 -461
  1663. package/dist/types-CK2X2wCB.d.ts +0 -618
  1664. package/dist/types-CPl9uJ0G.d.ts +0 -912
  1665. package/dist/types-CwQgFo8c.d.ts +0 -177
  1666. package/dist/types-DMihLukJ.d.ts +0 -251
  1667. package/dist/types-R6syp1el.js +0 -29
  1668. package/dist/types-iCyZ3lMx.d.ts +0 -217
  1669. package/dist/types-nspa5I-a.d.ts +0 -664
  1670. package/dist/undo-0HkWXASn.d.ts +0 -46
  1671. package/dist/undo-BbftL9-4.js +0 -44
  1672. package/dist/upload-claim-B1ZU8ydB.js +0 -33
  1673. package/dist/usage-BkWAPkg2.d.ts +0 -232
  1674. package/dist/user-change-DgWC6RRC.js +0 -135
  1675. package/dist/variants-Cy--Ub-a.js +0 -53
  1676. package/dist/vault-BkdPmL7f.d.ts +0 -62
  1677. package/dist/verify-41mZmspj.d.ts +0 -146
  1678. package/dist/verify-7EucfCnv.js +0 -130
  1679. package/dist/view-C8Ve14ja.js +0 -247
  1680. package/dist/view-C8_xvD-j.d.ts +0 -97
  1681. package/dist/watch-topic-CuaWfCuv.js +0 -57
  1682. package/dist/watch-topic-ItO3dz8m.d.ts +0 -31
  1683. package/dist/wire-ChYn1g21.js +0 -91
  1684. package/dist/wiring-CDNuQoJJ.js +0 -13
  1685. package/dist/workflow-sdk-BWPsdzVK.js +0 -2534
  1686. package/dist/workflow-sdk-Cf0LAOFF.js +0 -242
  1687. package/dist/workflow-sdk-rg3IbCZC.d.ts +0 -163
  1688. package/dist/workflows-xL6t0TXx.d.ts +0 -258
@@ -0,0 +1,2883 @@
1
+ import { m as commandMeta, r as defineCliCommand } from "./command-BpZ4AuhR.js";
2
+ import { i as plain } from "./style-B5-nByxb.js";
3
+ import { n as CliError } from "./errors-DcJ_PayO.js";
4
+ import { t as migrateCliCall } from "./moved-BAFPdJz_.js";
5
+ import { t as isRecord$1 } from "./guards-DxwRG0Uv.js";
6
+ import { a as changedFiles, i as changeLines, r as applyPlan, u as planResult } from "./files-DQayErI8.js";
7
+ import { i as schemasDirOf, n as migrationsDir, o as writtenByBlocks } from "./sql-layout-CZ66pY8j.js";
8
+ import { a as configObject, c as mask, f as setPathInConfig, g as skipSpace, h as setPresetInJson, i as closingIndex, l as properties, m as setPresetInConfig, o as indentAt, p as setPathInJson, t as addBlocksToConfig, v as codeRanges } from "./config-edit-C6sQ1MqT.js";
9
+ import { i as legacyPrefixNames, n as LEGACY_PREFIXES, t as LEGACY_CLAIMS } from "./legacy-prefix-D8Jfku6I.js";
10
+ import { a as REVIEW_0_15, c as renameSubpaths, r as PLUGIN_IMPORT_RENAMES, s as SUBPATH_RENAMES_0_15, t as BLOCK_EXPORT_RENAMES } from "./codemod-block-renames-Dt3X1Wvg.js";
11
+ import { a as RECORD_BINDING_RENAMES, n as groupConfigJson, r as groupConfigSource, t as cutRange } from "./config-group-D4JWh4kG.js";
12
+ import { existsSync } from "node:fs";
13
+ import { extname, join, relative, resolve } from "node:path";
14
+ import { readFile, readdir, stat } from "node:fs/promises";
15
+ import { DEFAULT_CONVENTIONS, presetSpec } from "better-supabase/preset";
16
+ import { currentBlockName, formatBsbComment, parseBsbComment, renamedBlock } from "better-supabase/sql";
17
+ import { BLOCK_EVENT_RENAMES } from "better-supabase/events";
18
+ // src/cli/codemod-calls.ts
19
+ /** `sql add` calls, listed by the 0.9 codemod. */
20
+ const SQL_ADD_HINT = {
21
+ pattern: /(?<![\w.@-])(?:better-supabase|bsb)(?:@[\w.^~-]+)?\s+sql\s+add\b/,
22
+ message: "`sql add` still only writes the block's SQL; `add` also wires its clients and config. Use `add` unless the script needs the SQL alone"
23
+ };
24
+ /** Files whose CLI calls a codemod rewrites. */
25
+ const CLI_CALL_FILE = /(?:^|[\\/])(?:package\.json|\.github[\\/]workflows[\\/][^\\/]+\.ya?ml)$/;
26
+ /** Other files that run shell commands; their CLI calls are listed for review. */
27
+ const SHELL_FILE = /(?:^|[\\/])(?:[^\\/]+\.(?:sh|bash|zsh|ya?ml)|Makefile|justfile|Dockerfile)$/;
28
+ /** The bin, with an optional `@version`, followed by its arguments. */
29
+ const BIN = /(?<![\w.@-])(?:better-supabase|bsb)(?:@[\w.^~-]+)?(?=[ \t])/g;
30
+ /**
31
+ * Where a call's arguments end: a line break, a shell operator, a closing quote
32
+ * or a comment.
33
+ */
34
+ const CALL_END = /\r?\n|&&|\|\||[;|)`]|\\?"|\s#/;
35
+ /** `pnpm --filter better-supabase <script>` names the package, not the bin. */
36
+ const PACKAGE_FILTER = /(?:--filter|-F)[= ]$/;
37
+ function cliCalls(text, migrate) {
38
+ const calls = [];
39
+ for (const match of text.matchAll(BIN)) {
40
+ if (PACKAGE_FILTER.test(text.slice(0, match.index))) continue;
41
+ const start = match.index + match[0].length;
42
+ const tail = text.slice(start);
43
+ const end = start + (CALL_END.exec(tail)?.index ?? tail.length);
44
+ const words = text.slice(start, end).trim().split(/\s+/u);
45
+ const to = words[0] === "" ? void 0 : migrate(words);
46
+ if (to) calls.push({
47
+ start,
48
+ end,
49
+ bin: match[0],
50
+ to
51
+ });
52
+ }
53
+ return calls;
54
+ }
55
+ /**
56
+ * A CLI call followed by `&&` and the same call again. The call starts after a
57
+ * shell operator, a quote, a line break or a YAML `run:`, and the repeat ends
58
+ * at one, so only whole commands match.
59
+ */
60
+ const REPEATED_CALL = /((?:^|&&|\|\||[;:\n"'`(])[ \t]*)([^&|;\n"'`()]*?(?<![\w.@-])(?:better-supabase|bsb)(?:@[\w.^~-]+)?[ \t][^&|;\n"'`()]*?)[ \t]*&&[ \t]*\2(?=[ \t]*(?:&&|\|\||[;\n"'`)]|$))/g;
61
+ /**
62
+ * `text` with each run of identical CLI calls joined by `&&` kept once. Two old
63
+ * commands can move to the same new one (`sql sync` and `sql upgrade` both
64
+ * become `upgrade`), and running it twice in a row does the work twice.
65
+ */
66
+ function collapseRepeatedCalls(text) {
67
+ let out = text;
68
+ let previous;
69
+ while (out !== previous) {
70
+ previous = out;
71
+ out = out.replaceAll(REPEATED_CALL, "$1$2");
72
+ }
73
+ return out;
74
+ }
75
+ /** `text` with every moved CLI call spelled the new way. */
76
+ function rewriteCliCalls(text, migrate) {
77
+ const calls = cliCalls(text, migrate);
78
+ if (calls.length === 0) return text;
79
+ let out = "";
80
+ let cursor = 0;
81
+ for (const call of calls) {
82
+ const original = text.slice(call.start, call.end);
83
+ const trailing = /\s*$/u.exec(original)?.[0] ?? "";
84
+ out += `${text.slice(cursor, call.start)} ${call.to.join(" ")}${trailing}`;
85
+ cursor = call.end;
86
+ }
87
+ return collapseRepeatedCalls(out + text.slice(cursor));
88
+ }
89
+ /** One review line per moved CLI call, with the new spelling. */
90
+ function cliCallHints(text, migrate) {
91
+ return cliCalls(text, migrate).map((call) => ({
92
+ line: text.slice(0, call.start).split("\n").length,
93
+ message: `This call uses a renamed command or flag: run \`${call.bin} ${call.to.join(" ")}\``
94
+ }));
95
+ }
96
+ // src/cli/codemod-preset-code.ts
97
+ /**
98
+ * The 0.14 preset code layout, frozen: the fields in code order with their
99
+ * values and widths, then one bit per block. Codes are no longer written; the
100
+ * 0.15 codemod reads them into a preset object.
101
+ */
102
+ const FIELDS = [
103
+ {
104
+ key: "framework",
105
+ values: [
106
+ "next",
107
+ "vite",
108
+ "tanstack-start",
109
+ "expo",
110
+ "sveltekit",
111
+ "nuxt",
112
+ "hono",
113
+ "astro",
114
+ "react-router"
115
+ ],
116
+ bits: 5
117
+ },
118
+ {
119
+ key: "platforms",
120
+ values: [
121
+ "web",
122
+ "native",
123
+ "both"
124
+ ],
125
+ bits: 2
126
+ },
127
+ {
128
+ key: "casing",
129
+ values: ["snake", "camel"],
130
+ bits: 2
131
+ },
132
+ {
133
+ key: "idType",
134
+ values: [
135
+ "uuid",
136
+ "text",
137
+ "bigint",
138
+ "integer"
139
+ ],
140
+ bits: 3
141
+ },
142
+ {
143
+ key: "scope",
144
+ values: [
145
+ "tenant",
146
+ "user",
147
+ "none"
148
+ ],
149
+ bits: 2
150
+ },
151
+ {
152
+ key: "tenantName",
153
+ values: [
154
+ "organization",
155
+ "workspace",
156
+ "team"
157
+ ],
158
+ bits: 3
159
+ },
160
+ {
161
+ key: "access",
162
+ values: [
163
+ "roles",
164
+ "catalog",
165
+ "provider",
166
+ "custom"
167
+ ],
168
+ bits: 3
169
+ },
170
+ {
171
+ key: "api",
172
+ values: ["none", "api"],
173
+ bits: 2
174
+ },
175
+ {
176
+ key: "integrations",
177
+ values: [
178
+ "next",
179
+ "hono",
180
+ "orpc",
181
+ "edge",
182
+ "expo",
183
+ "mcp",
184
+ "client",
185
+ "react"
186
+ ],
187
+ bits: 16,
188
+ multi: true
189
+ }
190
+ ];
191
+ /** The 0.14 block bits, in order; `null` marks a removed block. */
192
+ const BLOCKS = [
193
+ "updated-at",
194
+ "actor",
195
+ "audit",
196
+ "tenant",
197
+ "invitations",
198
+ "reserved-slugs",
199
+ "jobs",
200
+ "idempotency",
201
+ "webhook-inbox",
202
+ "realtime-tables",
203
+ "jsonb-schemas",
204
+ "pgtap",
205
+ "grants",
206
+ "read-sets",
207
+ "mfa",
208
+ "entitlements",
209
+ "rate-limit",
210
+ "vector-search",
211
+ "access",
212
+ "support-sessions",
213
+ "organizations",
214
+ "profiles",
215
+ "outbox",
216
+ "notifications",
217
+ "webhooks-out",
218
+ "sessions",
219
+ "webhooks-in",
220
+ "api-keys",
221
+ "settings",
222
+ "usage",
223
+ "billing",
224
+ "flags",
225
+ "comments",
226
+ "attachments",
227
+ "data-lifecycle",
228
+ "sso",
229
+ "onboarding",
230
+ "waitlist",
231
+ "announcements",
232
+ "streams",
233
+ "credentials",
234
+ "workflows",
235
+ "workflow-sdk-world",
236
+ "workflow-builder",
237
+ "chat-sdk-state",
238
+ "inbox",
239
+ "ai-chat",
240
+ "ai-files",
241
+ "knowledge",
242
+ "memory",
243
+ "agents",
244
+ "connectors",
245
+ "ai-tasks",
246
+ "push",
247
+ "ai-cache",
248
+ "ai-providers",
249
+ "number-sequences",
250
+ "teams",
251
+ "tags",
252
+ "state-machine",
253
+ "custom-fields",
254
+ "share-links",
255
+ "reminders",
256
+ "imports",
257
+ "subjects",
258
+ "rank",
259
+ "saved-views",
260
+ "relations",
261
+ "bulk",
262
+ "search",
263
+ "metrics",
264
+ "calendar",
265
+ "bookings",
266
+ "versions",
267
+ "trash",
268
+ "reactions",
269
+ "approvals",
270
+ "access-requests",
271
+ "documents",
272
+ "catalog",
273
+ "inventory",
274
+ "drive",
275
+ "drive-files",
276
+ "orders",
277
+ "promotions",
278
+ "forms",
279
+ "signatures",
280
+ "time-tracking",
281
+ "identities",
282
+ "service-principals",
283
+ "templates",
284
+ "pipelines",
285
+ "parties",
286
+ "engagements",
287
+ "deals",
288
+ "work-items",
289
+ "quotes",
290
+ "invoices",
291
+ "sla",
292
+ "targets",
293
+ "hiring",
294
+ "employees",
295
+ "collections",
296
+ "ensure-rls",
297
+ "signing-keys",
298
+ "shared-signals",
299
+ "oauth-server",
300
+ "domains",
301
+ "reviews",
302
+ "leave",
303
+ "rules",
304
+ "vercel-marketplace",
305
+ "ledger",
306
+ "assets",
307
+ "scores",
308
+ "moderation",
309
+ "enrollments",
310
+ "guests",
311
+ "passes",
312
+ "billable-time",
313
+ "leases",
314
+ "expenses",
315
+ "donations",
316
+ "dispatch",
317
+ "shipments",
318
+ "contracts",
319
+ "controls",
320
+ "incidents",
321
+ "courses",
322
+ "messaging",
323
+ "channels",
324
+ "activity",
325
+ "mail-sync",
326
+ "segments",
327
+ "assignment",
328
+ "enrichment",
329
+ "forecasts",
330
+ "field-history",
331
+ "sequences",
332
+ "lead-scoring",
333
+ "posts",
334
+ "field-encryption"
335
+ ];
336
+ const BASE62 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
337
+ /** Whether `value` reads as a 0.14 preset code: `1` and base62 digits. */
338
+ function isLegacyPresetCode(value) {
339
+ return /^1[0-9A-Za-z]+$/.test(value);
340
+ }
341
+ /**
342
+ * The conventions and blocks a 0.14 preset code holds, the blocks under their
343
+ * 0.15 names. Throws a TypeError when `code` isn't one.
344
+ */
345
+ function decodeLegacyPresetCode(code) {
346
+ if (!isLegacyPresetCode(code)) throw new TypeError(`"${code}" is not a 0.14 preset code.`);
347
+ let value = 0n;
348
+ for (const char of code.slice(1)) value = value * 62n + BigInt(BASE62.indexOf(char));
349
+ const preset = {};
350
+ for (const field of FIELDS) {
351
+ const bits = value & (1n << BigInt(field.bits)) - 1n;
352
+ value >>= BigInt(field.bits);
353
+ if (field.multi === true) {
354
+ preset[field.key] = field.values.filter((_, index) => (bits >> BigInt(index) & 1n) === 1n);
355
+ continue;
356
+ }
357
+ const each = field.values[Number(bits)];
358
+ if (each === void 0) throw new TypeError(`Preset code "${code}" has an unknown ${field.key}.`);
359
+ preset[field.key] = each;
360
+ }
361
+ const blocks = [];
362
+ for (let index = 0; value > 0n; index += 1, value >>= 1n) {
363
+ const name = BLOCKS[index];
364
+ if ((value & 1n) === 1n && name !== null && name !== void 0) blocks.push(currentBlockName(name));
365
+ }
366
+ return {
367
+ ...preset,
368
+ blocks
369
+ };
370
+ }
371
+ /** The preset a 0.14 code holds, as the name or object the config takes. */
372
+ function specOfCode(code) {
373
+ const { blocks, ...decoded } = decodeLegacyPresetCode(code);
374
+ return presetSpec({
375
+ ...DEFAULT_CONVENTIONS,
376
+ ...decoded,
377
+ blocks: typeof blocks === "string" ? [blocks] : blocks ?? []
378
+ });
379
+ }
380
+ const PRESET_CODE = /(\bpreset\s*:\s*|"preset"\s*:\s*)(["'])((?:https?:\/\/[^"'?]*\?(?:[^"']*&)?preset=)?)(1[0-9A-Za-z]+)([^"']*)\2/;
381
+ /**
382
+ * `better-supabase.config.*` with a 0.14 preset code (or a Create URL holding
383
+ * one) in `preset` rewritten to the preset object or name it holds.
384
+ */
385
+ function convertConfigPresetCode(source, json) {
386
+ const match = PRESET_CODE.exec(source);
387
+ if (match === null || match[5] !== "") return {
388
+ ok: true,
389
+ text: source
390
+ };
391
+ const spec = specOfCode(match[4] ?? "");
392
+ return json ? setPresetInJson(source, spec) : setPresetInConfig(source, spec);
393
+ }
394
+ /**
395
+ * A 0.14 design file (`{ preset: "<code>", design }`) as a 0.15 one: the design
396
+ * with the preset object inside. Other JSON is returned as it is.
397
+ */
398
+ function convertDesignFile(source) {
399
+ let value;
400
+ try {
401
+ value = JSON.parse(source);
402
+ } catch {
403
+ return {
404
+ ok: false,
405
+ reason: "it isn't valid JSON"
406
+ };
407
+ }
408
+ if (typeof value !== "object" || value === null || !("preset" in value) || !("design" in value) || typeof value.preset !== "string" || typeof value.design !== "object" || value.design === null) return {
409
+ ok: true,
410
+ text: source
411
+ };
412
+ const preset = isLegacyPresetCode(value.preset) ? specOfCode(value.preset) : value.preset;
413
+ return {
414
+ ok: true,
415
+ text: `${JSON.stringify({
416
+ ...value.design,
417
+ preset
418
+ }, null, 2)}\n`
419
+ };
420
+ }
421
+ /** A design file Create downloaded (`better-supabase.design.json`). */
422
+ const DESIGN_FILE_NAME = /(?:^|[\\/])[^\\/]*\.design\.json$/;
423
+ const reviewOf = (edit) => edit.ok && "review" in edit ? edit.review : [];
424
+ /** `edit`, then `convertConfigPresetCode` on its text, with both reviews. */
425
+ function thenConvertPresetCode(edit, json) {
426
+ if (!edit.ok) return edit;
427
+ const converted = convertConfigPresetCode(edit.text, json);
428
+ return converted.ok ? {
429
+ ok: true,
430
+ text: converted.text,
431
+ review: [...reviewOf(edit), ...reviewOf(converted)]
432
+ } : converted;
433
+ }
434
+ /** A codemod's `designFile` rewrite as a result; a refusal is listed for review. */
435
+ function designFileResult(source, rewrite) {
436
+ if (rewrite === void 0) return {
437
+ text: source,
438
+ review: []
439
+ };
440
+ const edit = rewrite(source);
441
+ return edit.ok ? {
442
+ text: edit.text,
443
+ review: reviewOf(edit)
444
+ } : {
445
+ text: source,
446
+ review: [{
447
+ line: 1,
448
+ message: `The design file wasn't rewritten: ${edit.reason}`
449
+ }]
450
+ };
451
+ }
452
+ // src/cli/codemod-sql-names.ts
453
+ /**
454
+ * The 0.15 `bs_` to `bsb_` rename in the app's own SQL. The upgrade migration
455
+ * renames the objects in the database, but SQL the app wrote (pgTAP tests, its
456
+ * schema files, its newest migration) still names them the old way, so the
457
+ * codemod lists those lines. It never rewrites SQL: a pushed migration must not
458
+ * change, and a test may name an object on purpose.
459
+ */
460
+ const LEGACY_NAME = /\bbs_[a-z0-9_]+/g;
461
+ const CURRENT_NAME = /\bbsb_[a-z0-9_]+/g;
462
+ /**
463
+ * The `bs_` names the 0.15 rename covers, from the files better-supabase wrote:
464
+ * their old `bs_` names before `upgrade` rewrites them, or the `bs_` form of
465
+ * their `bsb_` names after.
466
+ */
467
+ function renamedSqlNames(blockFiles) {
468
+ const text = blockFiles.join("\n");
469
+ return /* @__PURE__ */ new Set([...legacyPrefixNames(text), ...[...new Set(text.match(CURRENT_NAME))].map((name) => `bs_${name.slice(4)}`).filter((name) => !LEGACY_CLAIMS.has(name))]);
470
+ }
471
+ const renamed = (name, names) => names.has(name) || LEGACY_PREFIXES.some((prefix) => name.startsWith(prefix));
472
+ /** One hint per line and renamed name in `sources`. */
473
+ function sqlNameHints(sources, names) {
474
+ const hints = [];
475
+ for (const source of sources) for (const [index, line] of source.text.split("\n").entries()) for (const name of new Set(line.match(LEGACY_NAME))) if (renamed(name, names)) hints.push({
476
+ file: source.path,
477
+ line: index + 1,
478
+ message: `${name} is bsb_${name.slice(3)} since 0.15, and the upgrade migration renames it in the database. Rename it here, in SQL that runs after that migration.`
479
+ });
480
+ return hints;
481
+ }
482
+ async function sqlFiles(dir) {
483
+ if (!existsSync(dir)) return [];
484
+ const files = [];
485
+ for (const entry of await readdir(dir, { withFileTypes: true })) {
486
+ const full = join(dir, entry.name);
487
+ if (entry.isDirectory()) files.push(...await sqlFiles(full));
488
+ else if (entry.name.endsWith(".sql")) files.push(full);
489
+ }
490
+ return files.toSorted();
491
+ }
492
+ /**
493
+ * Lines of the app's SQL that name a `bs_` object the 0.15 upgrade renames: the
494
+ * pgTAP tests (`sql.testsDir`), the schema files no block wrote, and the newest
495
+ * migration the app wrote. Older migrations already ran, so they stay as they
496
+ * are.
497
+ */
498
+ async function legacySqlNameHints(config) {
499
+ const read = async (path) => ({
500
+ path: relative(config.root, path).replaceAll("\\", "/"),
501
+ text: await readFile(path, "utf-8")
502
+ });
503
+ const [tests, schemas, migrations] = await Promise.all([
504
+ Promise.all((await sqlFiles(join(config.root, config.sql.testsDir))).map(read)),
505
+ Promise.all((await sqlFiles(join(config.root, await schemasDirOf(config)))).map(read)),
506
+ Promise.all((await sqlFiles(join(config.root, migrationsDir(config)))).map(read))
507
+ ]);
508
+ const names = renamedSqlNames([...schemas, ...migrations].filter(writtenByBlocks).map((file) => file.text));
509
+ const latest = migrations.findLast((file) => !writtenByBlocks(file));
510
+ return sqlNameHints([
511
+ ...tests.filter((file) => !writtenByBlocks(file)),
512
+ ...schemas.filter((file) => !writtenByBlocks(file)),
513
+ ...latest === void 0 ? [] : [latest]
514
+ ], names);
515
+ }
516
+ // src/cli/codemod-0-32.ts
517
+ const ENVIRONMENT_KEY$2 = /^\$(?:development|production|test|ci)$/;
518
+ const lineAt$1 = (source, index) => source.slice(0, index).split("\n").length;
519
+ function applyEdits$4(source, edits) {
520
+ let text = source;
521
+ for (const edit of edits.toSorted((a, b) => b.start - a.start)) text = text.slice(0, edit.start) + edit.text + text.slice(edit.end);
522
+ return text;
523
+ }
524
+ /**
525
+ * Renames `organization` to `tenant` in the `auth` object of the config at
526
+ * `open`.
527
+ */
528
+ function renameIn$1(source, code, open, review) {
529
+ const edits = [];
530
+ for (const prop of properties(source, code, open) ?? []) {
531
+ if (prop.key === void 0 || code[prop.valueStart] !== "{") continue;
532
+ if (prop.key === "auth") {
533
+ const auth = properties(source, code, prop.valueStart) ?? [];
534
+ const organization = auth.find((entry) => entry.key === "organization");
535
+ if (organization === void 0) continue;
536
+ if (auth.some((entry) => entry.key === "tenant")) {
537
+ review.push({
538
+ line: lineAt$1(source, organization.start),
539
+ message: "`auth.organization` and `auth.tenant` are both set: move the `organization` entries into `tenant` by hand"
540
+ });
541
+ continue;
542
+ }
543
+ const keyStart = source.indexOf("organization", organization.start);
544
+ edits.push({
545
+ start: keyStart,
546
+ end: keyStart + 12,
547
+ text: "tenant"
548
+ });
549
+ } else if (ENVIRONMENT_KEY$2.test(prop.key)) edits.push(...renameIn$1(source, code, prop.valueStart, review));
550
+ else if (prop.key === "$env") {
551
+ for (const environment of properties(source, code, prop.valueStart) ?? []) if (code[environment.valueStart] === "{") edits.push(...renameIn$1(source, code, environment.valueStart, review));
552
+ }
553
+ }
554
+ return edits;
555
+ }
556
+ function renameJson$1(value, review) {
557
+ if (!isRecord$1(value)) return value;
558
+ return Object.fromEntries(Object.entries(value).map(([key, entry]) => {
559
+ if (key === "auth" && isRecord$1(entry) && "organization" in entry) {
560
+ if ("tenant" in entry) {
561
+ review.push({
562
+ line: 1,
563
+ message: "`auth.organization` and `auth.tenant` are both set: move the `organization` entries into `tenant` by hand"
564
+ });
565
+ return [key, entry];
566
+ }
567
+ return [key, Object.fromEntries(Object.entries(entry).map(([name, item]) => [name === "organization" ? "tenant" : name, item]))];
568
+ }
569
+ if (ENVIRONMENT_KEY$2.test(key)) return [key, renameJson$1(entry, review)];
570
+ if (key === "$env" && isRecord$1(entry)) return [key, Object.fromEntries(Object.entries(entry).map(([name, block]) => [name, renameJson$1(block, review)]))];
571
+ return [key, entry];
572
+ }));
573
+ }
574
+ /**
575
+ * `better-supabase.config.*` with `auth.organization` renamed to `auth.tenant`,
576
+ * at the top level and in the `$env` and `$<environment>` blocks.
577
+ */
578
+ function organizationToTenant(source, json) {
579
+ const review = [];
580
+ if (json) {
581
+ let parsed;
582
+ try {
583
+ parsed = JSON.parse(source);
584
+ } catch {
585
+ return {
586
+ ok: false,
587
+ reason: "the file is not valid JSON"
588
+ };
589
+ }
590
+ const renamed = renameJson$1(parsed, review);
591
+ return JSON.stringify(renamed) === JSON.stringify(parsed) ? {
592
+ ok: true,
593
+ text: source,
594
+ review
595
+ } : {
596
+ ok: true,
597
+ text: `${JSON.stringify(renamed, null, 2)}\n`,
598
+ review
599
+ };
600
+ }
601
+ const code = mask(source);
602
+ const open = configObject(code);
603
+ if (open === void 0) return /\borganization\s*:/.test(code) ? {
604
+ ok: false,
605
+ reason: "no defineConfig({...}) or exported object literal; rename `auth.organization` to `auth.tenant` by hand"
606
+ } : {
607
+ ok: true,
608
+ text: source,
609
+ review
610
+ };
611
+ return {
612
+ ok: true,
613
+ text: applyEdits$4(source, renameIn$1(source, code, open, review)),
614
+ review
615
+ };
616
+ }
617
+ const KEY_RENAMES = {
618
+ requireOrganization: "requireTenant",
619
+ checkSession: "verifySession",
620
+ endedSession: "verifySession",
621
+ refreshSkewSeconds: "leeway",
622
+ expiredPrefetch: "onExpiredPrefetch"
623
+ };
624
+ /**
625
+ * Option keys renamed in code, outside strings and comments: the route and
626
+ * procedure `requireOrganization`, and the proxy and session-check options.
627
+ */
628
+ function renameKeys$1(text) {
629
+ const ranges = codeRanges(text);
630
+ const names = Object.keys(KEY_RENAMES).join("|");
631
+ const pattern = new RegExp(`(?<![\\w$])(?:${names})(?=\\s*[:,}])`, "g");
632
+ return {
633
+ text: renameAdapterCalls(applyEdits$4(text, [...text.matchAll(pattern)].filter((match) => ranges.some(([start, end]) => match.index >= start && match.index < end)).map((match) => ({
634
+ start: match.index,
635
+ end: match.index + match[0].length,
636
+ text: KEY_RENAMES[match[0]]
637
+ })))),
638
+ review: []
639
+ };
640
+ }
641
+ const FLAGS_IMPORT = /import\s*\{([^}]*)\}\s*from\s*["']better-supabase\/flags-sdk["']/;
642
+ /**
643
+ * `betterSupabaseAdapter(options)` is `createBetterSupabaseAdapter(options)`;
644
+ * `betterSupabaseAdapter` without a call is the adapter from the environment.
645
+ * The import gains the new name, and loses the old one once nothing else uses
646
+ * it.
647
+ */
648
+ function renameAdapterCalls(text) {
649
+ const ranges = codeRanges(text);
650
+ const inCode = (index) => ranges.some(([start, end]) => index >= start && index < end);
651
+ const uses = [...text.matchAll(/(?<![\w$.])betterSupabaseAdapter\b(\s*\()?/g)].filter((match) => inCode(match.index));
652
+ const calls = uses.filter((match) => match[1] !== void 0);
653
+ if (calls.length === 0) return text;
654
+ const edits = calls.map((match) => ({
655
+ start: match.index,
656
+ end: match.index + 21,
657
+ text: "createBetterSupabaseAdapter"
658
+ }));
659
+ const imported = FLAGS_IMPORT.exec(text);
660
+ if (imported) {
661
+ const listStart = imported.index + imported[0].indexOf("{") + 1;
662
+ const list = imported[1];
663
+ const names = list.split(",").map((name) => name.trim());
664
+ const bare = uses.length - calls.length - 1;
665
+ if (!names.includes("createBetterSupabaseAdapter")) {
666
+ const at = list.search(/\bbetterSupabaseAdapter\b/);
667
+ if (at !== -1) edits.push(bare > 0 ? {
668
+ start: listStart + at,
669
+ end: listStart + at,
670
+ text: "createBetterSupabaseAdapter, "
671
+ } : {
672
+ start: listStart + at,
673
+ end: listStart + at + 21,
674
+ text: "createBetterSupabaseAdapter"
675
+ });
676
+ }
677
+ }
678
+ return applyEdits$4(text, edits);
679
+ }
680
+ const CODEMOD_0_32 = {
681
+ name: "0.32",
682
+ description: "Renames auth.organization to auth.tenant in better-supabase.config.* (at the top level and in the $env and $<environment> blocks), the requireOrganization route and procedure option to requireTenant, the createNext session, sign-in and cache methods to the supabase-js names (getClaims, contextFromSession, evictSession, signInWithOAuth, exchangeCodeForSession, tag, tags), the proxy and session-check option keys (verifySession, leeway, onExpiredPrefetch), checkSession to verifySession, betterSupabaseAdapter(options) to createBetterSupabaseAdapter(options), and the matching types",
683
+ imports: {
684
+ OrganizationConfig: "TenantConfig",
685
+ OAuthStart: "SignInWithOAuthParams",
686
+ CodeExchange: "ExchangeCodeParams",
687
+ EndedSessionOptions: "VerifySessionOptions",
688
+ checkSession: "verifySession"
689
+ },
690
+ members: [
691
+ {
692
+ from: "getRequestSession",
693
+ to: "getClaims"
694
+ },
695
+ {
696
+ from: "contextForSession",
697
+ to: "contextFromSession"
698
+ },
699
+ {
700
+ from: "invalidateSession",
701
+ to: "evictSession"
702
+ },
703
+ {
704
+ from: "forgetSession",
705
+ to: "evictSession"
706
+ },
707
+ {
708
+ from: "authorizeUrl",
709
+ to: "signInWithOAuth"
710
+ },
711
+ {
712
+ from: "exchangeCode",
713
+ to: "exchangeCodeForSession"
714
+ },
715
+ {
716
+ from: "cacheTags",
717
+ to: "tags"
718
+ },
719
+ {
720
+ from: "cacheTag",
721
+ to: "tag"
722
+ }
723
+ ],
724
+ review: [
725
+ {
726
+ pattern: /\.session\(\)/,
727
+ message: "`bsb.session()` is `bsb.claims()` now; the returned `AuthSession` is unchanged apart from `profile`, which is `userMetadata`"
728
+ },
729
+ {
730
+ pattern: /\.signIn\(/,
731
+ message: "`bsb.signIn()` is gone: call `bsb.signInWithPassword()` (the same arguments). The React hook and `oauth.signIn` keep their names"
732
+ },
733
+ {
734
+ pattern: /\bkind\s*[!=]==?\s*["'](?:anon|service)["']|case\s+["'](?:anon|service)["']|\bkind:\s*["'](?:anon|service)["']/,
735
+ message: "The caller kinds `anon` and `service` are `none` and `secret` now (`ctx.auth.kind`, `AuthSession.kind`). An actor (`ctx.actor.kind`) and a subscriber keep `anon` and `service`"
736
+ },
737
+ {
738
+ pattern: /\ballow\s*:\s*\[[^\]]*["'](?:anon|service)["']/,
739
+ message: "`allow` takes `none` (no session) and `secret` (the secret key) instead of `anon` and `service`"
740
+ },
741
+ {
742
+ pattern: /\b(?:session|auth)\.profile\b/,
743
+ message: "`AuthState.profile` and `AuthSession.profile` (the parsed `user_metadata`) are `userMetadata` now"
744
+ },
745
+ {
746
+ pattern: /\bsessionEnded(?:Reason)?\b/,
747
+ message: "The resolution carries `sessionVerified: false` and `reason` (`session_not_found` or `user_banned`) instead of `sessionEnded` and `sessionEndedReason` (`ended` or `banned`)"
748
+ },
749
+ {
750
+ pattern: /onExpiredPrefetch\s*:\s*["']protect["']|expiredPrefetch\s*:\s*["']protect["']/,
751
+ message: "`onExpiredPrefetch` takes `redirect` (the default) instead of `protect`"
752
+ },
753
+ {
754
+ pattern: /\b(?:session_ended|account_banned)\b/,
755
+ message: "The `verifySession` redirect sends `reason=session_not_found` or `reason=user_banned` (Auth's error codes) instead of `session_ended` and `account_banned`"
756
+ },
757
+ {
758
+ pattern: /\bcreateIdentify\(\s*\{\s*claims\s*:/,
759
+ message: "`createIdentify` takes `server` (your better-supabase server) instead of reading the claims yourself: `createIdentify({ server: bsb })`. `claims` still works"
760
+ },
761
+ {
762
+ pattern: /\bevictSession\(/,
763
+ message: "`bsb.evictSession()` returns a promise now (it also evicts the session memo and version cache): await it"
764
+ },
765
+ {
766
+ pattern: /["'`]inbox:(?:\$\{|["'`])/,
767
+ message: "Inbox thread ids are `inbox:<inboxId>:<conversationId>` now: build them with `inboxThreadId({ inboxId, conversationId })` and read them with `decodeInboxThreadId` or `conversationIdOf` from `better-supabase/chat-sdk`"
768
+ },
769
+ {
770
+ pattern: /\bhandler\.mirror\(|\.mirror\(\s*thread\b/,
771
+ message: "`handler.mirror` records messages from other bots now and skips only the bot's own (`author.isMe`); filter other bots in your handler if you don't want them in the inbox"
772
+ },
773
+ {
774
+ pattern: /\brolloutVariant\s*:|\brollout_variant\b/,
775
+ message: "A flag's single rollout variant is a weighted split now: `rolloutVariants: [{ variant, weight: 100 }]` (`rollout_variants` in SQL). `better-supabase upgrade` moves stored flags over"
776
+ }
777
+ ],
778
+ configFile: organizationToTenant,
779
+ source: renameKeys$1
780
+ };
781
+ // src/cli/codemod-data-contract.ts
782
+ /** The query guards named after the retired verbs. */
783
+ const DATA_CONTRACT_OPTIONS = [{
784
+ call: "guards",
785
+ from: "noUnboundedFindMany",
786
+ to: "noUnboundedList"
787
+ }, {
788
+ call: "guards",
789
+ from: "noDeleteManyWithoutWhere",
790
+ to: "noDeleteWithoutWhere"
791
+ }];
792
+ /** The lint rules named after the retired verbs. */
793
+ const DATA_CONTRACT_STRINGS = {
794
+ "better-supabase/no-unbounded-find-many": "better-supabase/no-unbounded-list",
795
+ "better-supabase/no-delete-many-without-where": "better-supabase/no-empty-where"
796
+ };
797
+ const RENAMED = {
798
+ findMany: "list",
799
+ paginate: "page",
800
+ findById: "get",
801
+ createMany: "create",
802
+ upsertMany: "upsert"
803
+ };
804
+ const CALL = /\.(findMany|paginate|findById|createMany|upsertMany|updateMany|deleteMany|findUnique|findOnly|findFirst|exists)(\s*)\(/g;
805
+ const REVIEW = "Rewrite this call by hand: its arguments aren't an object literal (see the 0.14 to 0.15 guide's data contract table)";
806
+ /**
807
+ * Rewrites the 0.14 repository methods to the 0.15 data contract. A call nested
808
+ * in another rewritten call's arguments is rewritten on the next pass.
809
+ */
810
+ function rewriteDataContract(source, options = {}) {
811
+ let text = source;
812
+ for (let pass = 0; pass < 4; pass += 1) {
813
+ const next = rewritePass(text, options);
814
+ if (next.text === text) return next;
815
+ text = next.text;
816
+ }
817
+ return rewritePass(text, options);
818
+ }
819
+ function rewritePass(source, options) {
820
+ const code = options.raw === true ? source : mask(source);
821
+ const edits = [];
822
+ const review = [];
823
+ for (const match of code.matchAll(CALL)) {
824
+ const method = match[1];
825
+ const name = match.index + 1;
826
+ const open = match.index + match[0].length - 1;
827
+ const close = closingIndex(code, open);
828
+ if (close === -1) continue;
829
+ const edit = rewrite(source, code, {
830
+ method,
831
+ name,
832
+ open,
833
+ close
834
+ });
835
+ if (edit === void 0) review.push({
836
+ line: source.slice(0, name).split("\n").length,
837
+ message: REVIEW
838
+ });
839
+ else if (edit !== "skip") edits.push(...edit);
840
+ }
841
+ return {
842
+ text: apply(source, edits),
843
+ review
844
+ };
845
+ }
846
+ function rewrite(source, code, call) {
847
+ const { method, name, open, close } = call;
848
+ const renamed = RENAMED[method];
849
+ if (renamed !== void 0) return [{
850
+ start: name,
851
+ end: name + method.length,
852
+ text: renamed
853
+ }];
854
+ const sole = soleArgument(code, open, close);
855
+ if (sole === "several") return method === "exists" ? "skip" : void 0;
856
+ const argument = sole === "none" ? void 0 : sole;
857
+ if (method === "exists") {
858
+ if (argument !== void 0 && (code[argument] !== "{" || !properties(source, code, argument)?.some((prop) => prop.key === "where"))) return "skip";
859
+ return [{
860
+ start: name,
861
+ end: name + method.length,
862
+ text: "count"
863
+ }, {
864
+ start: close + 1,
865
+ end: close + 1,
866
+ text: ".map((n) => n > 0)"
867
+ }];
868
+ }
869
+ if (method === "findFirst") return findFirst(source, code, call, argument);
870
+ if (argument === void 0 || code[argument] !== "{") return;
871
+ const props = properties(source, code, argument);
872
+ if (!props) return;
873
+ const text = (key) => {
874
+ const prop = props.find((entry) => entry.key === key);
875
+ return prop === void 0 ? void 0 : source.slice(prop.valueStart, prop.valueEnd);
876
+ };
877
+ const rest = (...without) => props.filter((prop) => prop.key === void 0 || !without.includes(prop.key)).map((prop) => source.slice(prop.start, prop.valueEnd));
878
+ const value = text("where");
879
+ if (value === void 0) return;
880
+ const where = value === "where" ? "where" : `where: ${value}`;
881
+ const options = (extra) => {
882
+ const items = [...extra];
883
+ return items.length === 0 ? "" : `, { ${items.join(", ")} }`;
884
+ };
885
+ const replace = (verb, args) => [{
886
+ start: name,
887
+ end: close + 1,
888
+ text: `${verb}(${args})`
889
+ }];
890
+ switch (method) {
891
+ case "updateMany": {
892
+ const data = text("data");
893
+ return data === void 0 ? void 0 : replace("update", `{ ${where} }, ${data}${options(rest("where", "data"))}`);
894
+ }
895
+ case "deleteMany": return replace("delete", `{ ${where} }${options(rest("where"))}`);
896
+ case "findUnique": return replace("get", `${value}${options([...rest("where"), "optional: true"])}`);
897
+ case "findOnly": return replace("get", `{ ${where} }${options([...rest("where"), "optional: true"])}`);
898
+ default: return;
899
+ }
900
+ }
901
+ function findFirst(source, code, call, argument) {
902
+ const { name, open, close } = call;
903
+ const first = {
904
+ start: close + 1,
905
+ end: close + 1,
906
+ text: ".map((rows) => rows[0] ?? null)"
907
+ };
908
+ const verb = {
909
+ start: name,
910
+ end: name + 9,
911
+ text: "list"
912
+ };
913
+ if (argument === void 0) return [
914
+ verb,
915
+ {
916
+ start: open + 1,
917
+ end: close,
918
+ text: "{ limit: 1 }"
919
+ },
920
+ first
921
+ ];
922
+ if (code[argument] === "{") {
923
+ const end = closingIndex(code, argument);
924
+ const inner = source.slice(argument + 1, end).trim();
925
+ return [
926
+ verb,
927
+ {
928
+ start: argument,
929
+ end: end + 1,
930
+ text: inner.length === 0 ? "{ limit: 1 }" : `{ ${inner.replace(/,\s*$/, "")}, limit: 1 }`
931
+ },
932
+ first
933
+ ];
934
+ }
935
+ const value = source.slice(argument, close).trim();
936
+ return [
937
+ verb,
938
+ {
939
+ start: open + 1,
940
+ end: close,
941
+ text: `{ ...${value}, limit: 1 }`
942
+ },
943
+ first
944
+ ];
945
+ }
946
+ /** The index where the only argument starts. */
947
+ function soleArgument(code, open, close) {
948
+ const start = open + 1 + (/^\s*/.exec(code.slice(open + 1))?.[0].length ?? 0);
949
+ if (start >= close) return "none";
950
+ let depth = 0;
951
+ for (let index = start; index < close; index += 1) {
952
+ const char = code[index];
953
+ if (char === "\"" || char === "'" || char === "`") index = Math.max(index, code.indexOf(char, index + 1));
954
+ else if ("({[".includes(char)) depth += 1;
955
+ else if (")}]".includes(char)) depth -= 1;
956
+ else if (char === "," && depth === 0 && code.slice(index + 1, close).trim() !== "") return "several";
957
+ }
958
+ return start;
959
+ }
960
+ function apply(text, edits) {
961
+ let out = "";
962
+ let cursor = 0;
963
+ for (const edit of edits.toSorted((a, b) => a.start - b.start)) {
964
+ if (edit.start < cursor) continue;
965
+ out += text.slice(cursor, edit.start) + edit.text;
966
+ cursor = edit.end;
967
+ }
968
+ return out + text.slice(cursor);
969
+ }
970
+ /**
971
+ * The data contract moves. 0.15 also renamed `requireTenant` to
972
+ * `requireTenant`; 0.32 renamed it back, so the rewrite leaves it.
973
+ */
974
+ function rewrite015(text) {
975
+ return rewriteDataContract(text);
976
+ }
977
+ // src/cli/codemod-subjects.ts
978
+ const ENVIRONMENT_KEY$1 = /^\$(?:development|production|test|ci)$/;
979
+ const lineAt = (source, index) => source.slice(0, index).split("\n").length;
980
+ function applyEdits$3(source, edits) {
981
+ let text = source;
982
+ for (const edit of edits.toSorted((a, b) => b.start - a.start)) text = text.slice(0, edit.start) + edit.text + text.slice(edit.end);
983
+ return text;
984
+ }
985
+ /** The range that removes `prop` with its comma and the space after it. */
986
+ function removal$1(code, prop, close) {
987
+ const after = skipSpace(code, prop.valueEnd);
988
+ if (code[after] === ",") return {
989
+ start: prop.start,
990
+ end: skipSpace(code, after + 1),
991
+ text: ""
992
+ };
993
+ return {
994
+ start: prop.start,
995
+ end: after === close ? prop.valueEnd : after,
996
+ text: ""
997
+ };
998
+ }
999
+ /** Text that adds `entries` before the `}` at `close`. */
1000
+ function insertion(source, code, open, close, existing, entries) {
1001
+ const outer = indentAt(source, open);
1002
+ const first = existing[0];
1003
+ const inner = first === void 0 ? `${outer} ` : indentAt(source, first.start);
1004
+ let last = close - 1;
1005
+ while (last > open && /\s/.test(code[last])) last -= 1;
1006
+ const body = entries.map((entry) => `\n${inner}${entry},`).join("");
1007
+ if (last === open) return {
1008
+ start: open + 1,
1009
+ end: close,
1010
+ text: `${body}\n${outer}`
1011
+ };
1012
+ return {
1013
+ start: last + 1,
1014
+ end: last + 1,
1015
+ text: `${code[last] === "," ? "" : ","}${body}`
1016
+ };
1017
+ }
1018
+ /** Moves `records` into `subjects` in the object at `open`. */
1019
+ function renameIn(source, code, open, review) {
1020
+ const props = properties(source, code, open);
1021
+ const close = closingIndex(code, open);
1022
+ if (props === void 0 || close === -1) return [];
1023
+ const edits = [];
1024
+ const records = props.find((prop) => prop.key === "records");
1025
+ const subjects = props.find((prop) => prop.key === "subjects");
1026
+ if (records !== void 0 && subjects === void 0) {
1027
+ const keyEnd = source.indexOf("records", records.start) + 7;
1028
+ edits.push({
1029
+ start: records.start,
1030
+ end: keyEnd,
1031
+ text: "subjects"
1032
+ });
1033
+ } else if (records !== void 0 && subjects !== void 0) {
1034
+ const from = code[records.valueStart] === "{" ? properties(source, code, records.valueStart) : void 0;
1035
+ const into = code[subjects.valueStart] === "{" ? properties(source, code, subjects.valueStart) : void 0;
1036
+ if (from === void 0 || into === void 0) review.push({
1037
+ line: lineAt(source, records.start),
1038
+ message: "`records` and `subjects` are both set and one isn't an object literal: move the `records` entries into `subjects` by hand"
1039
+ });
1040
+ else {
1041
+ const taken = new Set(into.flatMap((prop) => prop.key ?? []));
1042
+ const moved = [];
1043
+ for (const entry of from) if (entry.key !== void 0 && taken.has(entry.key)) review.push({
1044
+ line: lineAt(source, entry.start),
1045
+ message: `\`records.${entry.key}\` is dropped: \`subjects.${entry.key}\` already exists and wins`
1046
+ });
1047
+ else moved.push(source.slice(entry.start, entry.valueEnd));
1048
+ if (moved.length > 0) edits.push(insertion(source, code, subjects.valueStart, closingIndex(code, subjects.valueStart), into, moved));
1049
+ edits.push(removal$1(code, records, close));
1050
+ }
1051
+ }
1052
+ for (const prop of props) {
1053
+ if (prop.key === void 0 || code[prop.valueStart] !== "{") continue;
1054
+ if (ENVIRONMENT_KEY$1.test(prop.key)) edits.push(...renameIn(source, code, prop.valueStart, review));
1055
+ else if (prop.key === "$env") {
1056
+ for (const environment of properties(source, code, prop.valueStart) ?? []) if (code[environment.valueStart] === "{") edits.push(...renameIn(source, code, environment.valueStart, review));
1057
+ }
1058
+ }
1059
+ return edits;
1060
+ }
1061
+ function renameJson(value, review) {
1062
+ if (!isRecord$1(value)) return value;
1063
+ const { records, ...rest } = value;
1064
+ const out = { ...rest };
1065
+ if (records !== void 0) {
1066
+ const subjects = rest["subjects"];
1067
+ if (subjects === void 0) out["subjects"] = records;
1068
+ else if (isRecord$1(records) && isRecord$1(subjects)) {
1069
+ for (const key of Object.keys(records)) if (key in subjects) review.push({
1070
+ line: 1,
1071
+ message: `\`records.${key}\` is dropped: \`subjects.${key}\` already exists and wins`
1072
+ });
1073
+ out["subjects"] = {
1074
+ ...records,
1075
+ ...subjects
1076
+ };
1077
+ } else {
1078
+ out["records"] = records;
1079
+ review.push({
1080
+ line: 1,
1081
+ message: "`records` and `subjects` are both set and one isn't an object: move the `records` entries into `subjects` by hand"
1082
+ });
1083
+ }
1084
+ }
1085
+ for (const [key, entry] of Object.entries(out)) if (ENVIRONMENT_KEY$1.test(key)) out[key] = renameJson(entry, review);
1086
+ else if (key === "$env" && isRecord$1(entry)) out[key] = Object.fromEntries(Object.entries(entry).map(([name, block]) => [name, renameJson(block, review)]));
1087
+ return out;
1088
+ }
1089
+ /**
1090
+ * `better-supabase.config.*` with `records` renamed to `subjects`, at the top
1091
+ * level and in the `$env` and `$<environment>` blocks. Where both keys are set,
1092
+ * the `records` entries move into `subjects` and an existing `subjects` entry
1093
+ * wins, as the 0.29 config loader merges them.
1094
+ */
1095
+ function recordsToSubjects(source, json) {
1096
+ const review = [];
1097
+ if (json) {
1098
+ let parsed;
1099
+ try {
1100
+ parsed = JSON.parse(source);
1101
+ } catch {
1102
+ return {
1103
+ ok: false,
1104
+ reason: "the file is not valid JSON"
1105
+ };
1106
+ }
1107
+ const renamed = renameJson(parsed, review);
1108
+ return JSON.stringify(renamed) === JSON.stringify(parsed) ? {
1109
+ ok: true,
1110
+ text: source,
1111
+ review
1112
+ } : {
1113
+ ok: true,
1114
+ text: `${JSON.stringify(renamed, null, 2)}\n`,
1115
+ review
1116
+ };
1117
+ }
1118
+ const code = mask(source);
1119
+ const open = configObject(code);
1120
+ if (open === void 0) return /\brecords\s*:/.test(code) ? {
1121
+ ok: false,
1122
+ reason: "no defineConfig({...}) or exported object literal; rename `records` to `subjects` by hand"
1123
+ } : {
1124
+ ok: true,
1125
+ text: source,
1126
+ review
1127
+ };
1128
+ return {
1129
+ ok: true,
1130
+ text: applyEdits$3(source, renameIn(source, code, open, review)),
1131
+ review
1132
+ };
1133
+ }
1134
+ const COMMENT = /(comment\s+on\s+table\s+(?:"?[\w$]+"?\.)?"?[\w$]+"?\s+is\s+)'((?:[^']|'')*)'(\s*;)/giu;
1135
+ /**
1136
+ * `sql` with the `@bsb record` tags of its `comment on table` statements
1137
+ * renamed to `subject`. A comment that has both keeps `subject` and drops
1138
+ * `record`, with a review line.
1139
+ */
1140
+ function recordTagsToSubject(sql) {
1141
+ const review = [];
1142
+ return {
1143
+ text: sql.replaceAll(COMMENT, (statement, head, body, tail, offset) => {
1144
+ const parsed = parseBsbComment(body.replaceAll("''", "'"));
1145
+ if (!parsed.tags.some((tag) => tag.name === "record")) return statement;
1146
+ const hasSubject = parsed.tags.some((tag) => tag.name === "subject");
1147
+ if (hasSubject) review.push({
1148
+ line: lineAt(sql, offset),
1149
+ message: "The `record` tag is dropped: the comment already has a `subject` tag, which wins"
1150
+ });
1151
+ return `${head}'${formatBsbComment({
1152
+ text: parsed.text,
1153
+ tags: parsed.tags.flatMap((tag) => tag.name === "record" ? hasSubject ? [] : [{
1154
+ ...tag,
1155
+ name: "subject"
1156
+ }] : [tag])
1157
+ }).replaceAll("'", "''")}'${tail}`;
1158
+ }),
1159
+ review
1160
+ };
1161
+ }
1162
+ const CODEMOD_0_29 = {
1163
+ name: "0.29",
1164
+ description: "Renames records back to subjects in better-supabase.config.*, reversing the 0.15 rename (at the top level and in the $env and $<environment> blocks; where both are set, the records entries move into subjects and an existing subjects entry wins), and renames @bsb record tags to subject in the comment on table statements of supabase/schemas",
1165
+ configFile: recordsToSubjects,
1166
+ sqlFile: recordTagsToSubject
1167
+ };
1168
+ // src/cli/sql/config-adopt.ts
1169
+ const ADOPT = /(?:\bownership|"ownership"|'ownership')\s*:\s*(["'])adopt\1[ \t]*,?/g;
1170
+ const lineOf$1 = (text, index) => text.slice(0, index).split("\n").length;
1171
+ /** `[start, end)` to delete for the property matched at `start..end`. */
1172
+ function span(text, start, end) {
1173
+ const lineStart = text.lastIndexOf("\n", start - 1) + 1;
1174
+ const newline = text.indexOf("\n", end);
1175
+ const lineEnd = newline === -1 ? text.length : newline;
1176
+ if (text.slice(lineStart, start).trim() === "" && text.slice(end, lineEnd).trim() === "") {
1177
+ const after = newline === -1 ? lineEnd : lineEnd + 1;
1178
+ const before = text.slice(0, lineStart).trimEnd();
1179
+ return text[end - 1] !== "," && before.endsWith(",") ? [before.length - 1, lineEnd] : [lineStart, after];
1180
+ }
1181
+ if (text[end - 1] === ",") return [start, end + (/^[ \t]*/.exec(text.slice(end))?.[0].length ?? 0)];
1182
+ const before = text.slice(0, start).trimEnd();
1183
+ return before.endsWith(",") ? [before.length - 1, end] : [start, end];
1184
+ }
1185
+ /** `source` without its `ownership: "adopt"` keys, and a review line each. */
1186
+ function removeAdoptOwnership(source, json) {
1187
+ const code = json ? source : mask(source);
1188
+ const spans = [];
1189
+ const review = [];
1190
+ for (const match of source.matchAll(ADOPT)) {
1191
+ const start = match.index;
1192
+ const value = source.indexOf(match[1], start + 9 + 1);
1193
+ if (!json && (code[start] === " " || code[value] !== match[1])) continue;
1194
+ const removed = span(source, start, start + match[0].length);
1195
+ const linesBefore = spans.map(([from, to]) => source.slice(from, to).split("\n").length - 1).reduce((sum, count) => sum + count, 0);
1196
+ review.push({
1197
+ line: Math.max(lineOf$1(source, removed[0]) - linesBefore, 1),
1198
+ message: "removed ownership: \"adopt\": the block now leaves alone every table your schema already has and keeps its tables and columns mappings. Run `better-supabase upgrade` to write its SQL over them"
1199
+ });
1200
+ spans.push(removed);
1201
+ }
1202
+ let text = source;
1203
+ for (const [start, end] of spans.toReversed()) text = text.slice(0, start) + text.slice(end);
1204
+ return {
1205
+ text,
1206
+ review
1207
+ };
1208
+ }
1209
+ /** `edit` with `ownership: "adopt"` removed from every block. */
1210
+ function withoutAdoptOwnership(edit, json) {
1211
+ if (!edit.ok) return edit;
1212
+ const earlier = "review" in edit ? edit.review : [];
1213
+ const { text, review } = removeAdoptOwnership(edit.text, json);
1214
+ return {
1215
+ ok: true,
1216
+ text,
1217
+ review: [...earlier, ...review]
1218
+ };
1219
+ }
1220
+ // src/cli/sql/config-block-names.ts
1221
+ const ENVIRONMENT_KEY = /^\$(?:development|production|test|ci)$/;
1222
+ const STRING = /(["'`])([a-z0-9-]+)\1/g;
1223
+ const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
1224
+ /** An operation name (`<block>.<action>`) under its block's 0.15 name. */
1225
+ function currentOperationName(name) {
1226
+ const dot = name.indexOf(".");
1227
+ const to = dot === -1 ? void 0 : renamedBlock(name.slice(0, dot));
1228
+ return to === void 0 ? name : `${to}${name.slice(dot)}`;
1229
+ }
1230
+ function applyEdits$2(source, edits) {
1231
+ let text = source;
1232
+ for (const edit of edits.toSorted((a, b) => b.start - a.start)) text = text.slice(0, edit.start) + edit.text + text.slice(edit.end);
1233
+ return text;
1234
+ }
1235
+ /** The key token at `start` renamed to `to`, keeping its quotes. */
1236
+ function keyEdit(source, start, key, to) {
1237
+ const quote = source[start];
1238
+ const quoted = quote === "\"" || quote === "'";
1239
+ const bare = /^[A-Za-z_$][\w$]*$/.test(to);
1240
+ return {
1241
+ start,
1242
+ end: start + key.length + (quoted ? 2 : 0),
1243
+ text: quoted ? `${quote}${to}${quote}` : bare ? to : `"${to}"`
1244
+ };
1245
+ }
1246
+ /** Edits renaming the keys of the object literal at `open` with `rename`. */
1247
+ function keyEdits(source, code, open, rename) {
1248
+ return (properties(source, code, open) ?? []).flatMap((prop) => {
1249
+ if (prop.key === void 0 || prop.valueStart === prop.start) return [];
1250
+ const to = rename(prop.key);
1251
+ return to === prop.key ? [] : [keyEdit(source, prop.start, prop.key, to)];
1252
+ });
1253
+ }
1254
+ /**
1255
+ * Edits renaming the block names among the string literals of the array at
1256
+ * `open`.
1257
+ */
1258
+ function listEdits(source, code, open) {
1259
+ const close = closingIndex(code, open);
1260
+ if (close === -1) return [];
1261
+ return [...source.slice(open, close).matchAll(STRING)].flatMap((match) => {
1262
+ const to = renamedBlock(match[2]);
1263
+ const start = open + match.index + 1;
1264
+ return to === void 0 ? [] : [{
1265
+ start,
1266
+ end: start + match[2].length,
1267
+ text: to
1268
+ }];
1269
+ });
1270
+ }
1271
+ /** The value at `index` when it opens an object or an array. */
1272
+ const opens = (code, index) => code[index] === "{" || code[index] === "[" ? code[index] : void 0;
1273
+ /** The value of `key` in the object literal at `open`, when it is a literal. */
1274
+ function valueOf(source, code, open, key) {
1275
+ const prop = properties(source, code, open)?.find((entry) => entry.key === key);
1276
+ return prop === void 0 || opens(code, prop.valueStart) === void 0 ? void 0 : prop.valueStart;
1277
+ }
1278
+ function objectEdits(source, code, open) {
1279
+ const edits = [];
1280
+ for (const prop of properties(source, code, open) ?? []) {
1281
+ const kind = opens(code, prop.valueStart);
1282
+ if (prop.key === void 0 || kind === void 0) continue;
1283
+ if (prop.key === "blocks") edits.push(...kind === "[" ? listEdits(source, code, prop.valueStart) : keyEdits(source, code, prop.valueStart, (key) => renamedBlock(key) ?? key));
1284
+ else if (prop.key === "preset" && kind === "{") {
1285
+ const blocks = valueOf(source, code, prop.valueStart, "blocks");
1286
+ if (blocks !== void 0 && code[blocks] === "[") edits.push(...listEdits(source, code, blocks));
1287
+ } else if (prop.key === "auth" && kind === "{") {
1288
+ const authorization = valueOf(source, code, prop.valueStart, "authorization");
1289
+ const operations = authorization !== void 0 && code[authorization] === "{" ? valueOf(source, code, authorization, "operations") : void 0;
1290
+ if (operations !== void 0 && code[operations] === "{") edits.push(...keyEdits(source, code, operations, currentOperationName));
1291
+ } else if (prop.key === "$env" && kind === "{") {
1292
+ for (const env of properties(source, code, prop.valueStart) ?? []) if (code[env.valueStart] === "{") edits.push(...objectEdits(source, code, env.valueStart));
1293
+ } else if (ENVIRONMENT_KEY.test(prop.key) && kind === "{") edits.push(...objectEdits(source, code, prop.valueStart));
1294
+ }
1295
+ return edits;
1296
+ }
1297
+ /** `better-supabase.config.ts`, grouped, with the 0.15 block names. */
1298
+ function renameBlocksInSource(source) {
1299
+ const code = mask(source);
1300
+ const open = configObject(code);
1301
+ if (open === void 0) return {
1302
+ ok: false,
1303
+ reason: "no defineConfig({...}) or default export object found"
1304
+ };
1305
+ return {
1306
+ ok: true,
1307
+ text: applyEdits$2(source, objectEdits(source, code, open))
1308
+ };
1309
+ }
1310
+ function renameKeys(value, rename) {
1311
+ return isObject(value) ? Object.fromEntries(Object.entries(value).map(([key, entry]) => [rename(key), entry])) : value;
1312
+ }
1313
+ const renameList = (value) => Array.isArray(value) ? value.map((entry) => typeof entry === "string" ? renamedBlock(entry) ?? entry : entry) : value;
1314
+ /** A parsed config object with the 0.15 block names. */
1315
+ function renameBlocksInConfig(config) {
1316
+ const out = {};
1317
+ for (const [key, value] of Object.entries(config)) if (key === "blocks") out[key] = Array.isArray(value) ? renameList(value) : renameKeys(value, (name) => renamedBlock(name) ?? name);
1318
+ else if (key === "preset" && isObject(value)) out[key] = value["blocks"] === void 0 ? value : {
1319
+ ...value,
1320
+ blocks: renameList(value["blocks"])
1321
+ };
1322
+ else if (key === "auth" && isObject(value)) {
1323
+ const authorization = value["authorization"];
1324
+ out[key] = isObject(authorization) ? {
1325
+ ...value,
1326
+ authorization: authorization["operations"] === void 0 ? authorization : {
1327
+ ...authorization,
1328
+ operations: renameKeys(authorization["operations"], currentOperationName)
1329
+ }
1330
+ } : value;
1331
+ } else if (key === "$env" && isObject(value) || ENVIRONMENT_KEY.test(key) && isObject(value)) out[key] = key === "$env" ? Object.fromEntries(Object.entries(value).map(([name, entry]) => [name, isObject(entry) ? renameBlocksInConfig(entry) : entry])) : renameBlocksInConfig(value);
1332
+ else out[key] = value;
1333
+ return out;
1334
+ }
1335
+ /** `edit`, then the 0.15 block names on its text. */
1336
+ function withBlockNames(edit, json) {
1337
+ if (!edit.ok) return edit;
1338
+ if (!json) return renameBlocksInSource(edit.text);
1339
+ const config = JSON.parse(edit.text);
1340
+ if (!isObject(config)) return edit;
1341
+ const renamed = renameBlocksInConfig(config);
1342
+ return JSON.stringify(renamed) === JSON.stringify(config) ? edit : {
1343
+ ok: true,
1344
+ text: `${JSON.stringify(renamed, null, 2)}\n`
1345
+ };
1346
+ }
1347
+ // src/cli/sql/config-block-on.ts
1348
+ const OPTIONS = /\boptions\s*:\s*\{/g;
1349
+ const KEY_BEFORE = /(?:["']([\w-]+)["']|([A-Za-z_$][\w$-]*))\s*:\s*$/;
1350
+ function applyEdits$1(source, edits) {
1351
+ let text = source;
1352
+ for (const edit of edits.toSorted((a, b) => b.start - a.start)) text = text.slice(0, edit.start) + edit.text + text.slice(edit.end);
1353
+ return text;
1354
+ }
1355
+ /** The `{` of the object literal that holds the code at `index`. */
1356
+ function enclosingObject(code, index) {
1357
+ let depth = 0;
1358
+ for (let at = index - 1; at >= 0; at -= 1) {
1359
+ const char = code[at];
1360
+ if (char === "}" || char === "]" || char === ")") depth += 1;
1361
+ else if (char === "{" || char === "[" || char === "(") {
1362
+ if (depth === 0) return char === "{" ? at : void 0;
1363
+ depth -= 1;
1364
+ }
1365
+ }
1366
+ }
1367
+ /** The block an entry installs: its `block` string, or the key it sits under. */
1368
+ function blockOf(source, open, props) {
1369
+ const block = props.find((prop) => prop.key === "block");
1370
+ if (block !== void 0) return /^["']([\w-]+)["']$/.exec(source.slice(block.valueStart, block.valueEnd))?.[1];
1371
+ const key = KEY_BEFORE.exec(source.slice(0, open));
1372
+ return key?.[1] ?? key?.[2];
1373
+ }
1374
+ /** `{ deal: ["amount"] }` as `{ deal: { fields: ["amount"] } }`. */
1375
+ function wrapFields(source, code, open) {
1376
+ return (properties(source, code, open) ?? []).flatMap((prop) => prop.key !== void 0 && code[prop.valueStart] === "[" ? [{
1377
+ start: prop.valueStart,
1378
+ end: prop.valueEnd,
1379
+ text: `{ fields: ${source.slice(prop.valueStart, prop.valueEnd)} }`
1380
+ }] : []);
1381
+ }
1382
+ /** `text` moved one object level out: two spaces fewer after each newline. */
1383
+ const outdented = (text) => text.replaceAll(/\n {2}/g, "\n");
1384
+ /** The edit that removes `props[index]` from its object literal. */
1385
+ function removal(props, index) {
1386
+ const next = props[index + 1];
1387
+ const previous = props[index - 1];
1388
+ const prop = props[index];
1389
+ if (next !== void 0) return {
1390
+ start: prop.start,
1391
+ end: next.start,
1392
+ text: ""
1393
+ };
1394
+ return {
1395
+ start: previous?.valueEnd ?? prop.start,
1396
+ end: prop.valueEnd,
1397
+ text: ""
1398
+ };
1399
+ }
1400
+ const lineOf = (source, index) => source.slice(0, index).split("\n").length;
1401
+ /**
1402
+ * `source` with every `options.subjects` of a block entry moved to the entry's
1403
+ * `on`. An entry that already sets `on` is left and listed for review.
1404
+ */
1405
+ function moveSubjectsToOnInSource(source) {
1406
+ const code = mask(source);
1407
+ const edits = [];
1408
+ const review = [];
1409
+ for (const match of code.matchAll(OPTIONS)) {
1410
+ const valueOpen = match.index + match[0].length - 1;
1411
+ const entryOpen = enclosingObject(code, match.index);
1412
+ if (entryOpen === void 0) continue;
1413
+ const entry = properties(source, code, entryOpen) ?? [];
1414
+ const options = entry.find((prop) => prop.key === "options" && prop.valueStart === valueOpen);
1415
+ const inner = properties(source, code, valueOpen) ?? [];
1416
+ const index = inner.findIndex((prop) => prop.key === "subjects");
1417
+ if (options === void 0 || index === -1) continue;
1418
+ if (entry.some((prop) => prop.key === "on")) {
1419
+ review.push({
1420
+ line: lineOf(source, match.index),
1421
+ message: "options.subjects moved to on, and this block already sets on: merge them into on"
1422
+ });
1423
+ continue;
1424
+ }
1425
+ const subjects = inner[index];
1426
+ const shorthand = subjects.valueStart === subjects.start;
1427
+ const wrap = !shorthand && code[subjects.valueStart] === "{" && blockOf(source, entryOpen, entry) === "field-history";
1428
+ const slice = source.slice(subjects.valueStart, subjects.valueEnd);
1429
+ const raw = shorthand ? "subjects" : wrap ? applyEdits$1(slice, wrapFields(source, code, subjects.valueStart).map((edit) => ({
1430
+ ...edit,
1431
+ start: edit.start - subjects.valueStart,
1432
+ end: edit.end - subjects.valueStart
1433
+ }))) : slice;
1434
+ const on = `on: ${outdented(raw)}`;
1435
+ if (inner.length === 1) {
1436
+ edits.push({
1437
+ start: options.start,
1438
+ end: options.valueEnd,
1439
+ text: on
1440
+ });
1441
+ continue;
1442
+ }
1443
+ const multiline = code.slice(entryOpen, closingIndex(code, entryOpen)).includes("\n");
1444
+ edits.push({
1445
+ start: options.start,
1446
+ end: options.start,
1447
+ text: `${on},${multiline ? `\n${indentAt(source, options.start)}` : " "}`
1448
+ }, removal(inner, index));
1449
+ }
1450
+ return {
1451
+ text: applyEdits$1(source, edits),
1452
+ review
1453
+ };
1454
+ }
1455
+ function moveInObject(value) {
1456
+ if (Array.isArray(value)) return value.map(moveInObject);
1457
+ if (!isRecord$1(value)) return value;
1458
+ const entries = Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, moveInObject(entry)]));
1459
+ const options = entries["options"];
1460
+ if (!isRecord$1(options) || options["subjects"] === void 0 || entries["on"] !== void 0) return entries;
1461
+ const { subjects, ...rest } = options;
1462
+ const { options: _, ...withoutOptions } = entries;
1463
+ return {
1464
+ ...withoutOptions,
1465
+ on: subjects,
1466
+ ...Object.keys(rest).length > 0 && { options: rest }
1467
+ };
1468
+ }
1469
+ /** Field history's `on`, with each column list as `{ fields }`. */
1470
+ function fieldHistoryOn(config) {
1471
+ if (!isRecord$1(config) || !isRecord$1(config["blocks"])) return config;
1472
+ const history = config["blocks"]["field-history"];
1473
+ if (!isRecord$1(history) || !isRecord$1(history["on"])) return config;
1474
+ const on = Object.fromEntries(Object.entries(history["on"]).map(([type, fields]) => [type, Array.isArray(fields) ? { fields } : fields]));
1475
+ return {
1476
+ ...config,
1477
+ blocks: {
1478
+ ...config["blocks"],
1479
+ "field-history": {
1480
+ ...history,
1481
+ on
1482
+ }
1483
+ }
1484
+ };
1485
+ }
1486
+ /** `edit`, then every `options.subjects` moved to `on`. */
1487
+ function withSubjectsOn(edit, json) {
1488
+ if (!edit.ok) return edit;
1489
+ const before = "review" in edit ? edit.review : [];
1490
+ if (!json) {
1491
+ const moved = moveSubjectsToOnInSource(edit.text);
1492
+ return {
1493
+ ok: true,
1494
+ text: moved.text,
1495
+ review: [...before, ...moved.review]
1496
+ };
1497
+ }
1498
+ const config = JSON.parse(edit.text);
1499
+ const moved = fieldHistoryOn(moveInObject(config));
1500
+ return {
1501
+ ok: true,
1502
+ text: JSON.stringify(moved) === JSON.stringify(config) ? edit.text : `${JSON.stringify(moved, null, 2)}\n`,
1503
+ review: before
1504
+ };
1505
+ }
1506
+ // src/cli/sql/config-move.ts
1507
+ const lineStart = (source, index) => source.lastIndexOf("\n", index - 1) + 1;
1508
+ function propertySpan(source, code, open, props, index) {
1509
+ const prop = props[index];
1510
+ const previous = props[index - 1];
1511
+ if (prop === void 0) throw new Error(`no property at ${index}`);
1512
+ const close = closingIndex(code, open);
1513
+ const multiline = code.slice(open, close).includes("\n");
1514
+ const after = skipSpace(code, prop.valueEnd);
1515
+ const hasComma = code[after] === ",";
1516
+ const tailFrom = hasComma ? after + 1 : prop.valueEnd;
1517
+ if (!multiline) {
1518
+ const value = source.slice(prop.start, prop.valueEnd);
1519
+ if (previous) return {
1520
+ start: previous.valueEnd,
1521
+ end: prop.valueEnd,
1522
+ value,
1523
+ keyAt: 0,
1524
+ trailing: "",
1525
+ hasComma,
1526
+ multiline
1527
+ };
1528
+ return {
1529
+ start: prop.start,
1530
+ end: hasComma ? skipSpace(code, tailFrom) : prop.valueEnd,
1531
+ value,
1532
+ keyAt: 0,
1533
+ trailing: "",
1534
+ hasComma,
1535
+ multiline
1536
+ };
1537
+ }
1538
+ let before = open + 1;
1539
+ if (previous) {
1540
+ const comma = skipSpace(code, previous.valueEnd);
1541
+ before = code[comma] === "," ? comma + 1 : previous.valueEnd;
1542
+ }
1543
+ const newline = source.slice(before, prop.start).indexOf("\n");
1544
+ const start = newline === -1 ? prop.start : before + newline + 1;
1545
+ const lineEnd = source.indexOf("\n", tailFrom);
1546
+ const restIsBlank = lineEnd !== -1 && code.slice(tailFrom, lineEnd).trim() === "";
1547
+ return {
1548
+ start,
1549
+ end: restIsBlank ? lineEnd + 1 : tailFrom,
1550
+ value: source.slice(start, prop.valueEnd),
1551
+ keyAt: prop.start - start,
1552
+ trailing: restIsBlank ? source.slice(tailFrom, lineEnd).trimEnd() : "",
1553
+ hasComma,
1554
+ multiline
1555
+ };
1556
+ }
1557
+ /** `modules: ...` as `blocks: ...`, keeping the key's quotes. */
1558
+ function renameKey(text, keyAt, prop) {
1559
+ const head = text.slice(keyAt);
1560
+ const quoted = /^(["'])modules\1/.exec(head);
1561
+ if (quoted) {
1562
+ const quote = quoted[1] ?? "\"";
1563
+ return `${text.slice(0, keyAt)}${quote}blocks${quote}${head.slice(quoted[0].length)}`;
1564
+ }
1565
+ if (prop.valueStart === prop.start) return `${text.slice(0, keyAt)}blocks: modules${head.slice(7)}`;
1566
+ return `${text.slice(0, keyAt)}blocks${head.slice(7)}`;
1567
+ }
1568
+ function reindent(text, from, to) {
1569
+ return text.split("\n").map((line) => line.startsWith(from) ? to + line.slice(from.length) : line).join("\n");
1570
+ }
1571
+ const sortKey = (key) => (key ?? "").toLowerCase();
1572
+ function keysSorted(keys) {
1573
+ return keys.every((key, index) => index === 0 || key !== void 0 && sortKey(keys[index - 1]) <= sortKey(key));
1574
+ }
1575
+ function rootKeys(source) {
1576
+ const code = mask(source);
1577
+ const root = configObject(code);
1578
+ return (root === void 0 ? void 0 : properties(source, code, root))?.map((prop) => prop.key) ?? [];
1579
+ }
1580
+ function sortBlocksKey(source) {
1581
+ const code = mask(source);
1582
+ const root = configObject(code);
1583
+ if (root === void 0) return source;
1584
+ const props = properties(source, code, root);
1585
+ const blocksIndex = props?.findIndex((prop) => prop.key === "blocks") ?? -1;
1586
+ if (!props || blocksIndex === -1) return source;
1587
+ const targetIndex = props.findIndex((prop, index) => index !== blocksIndex && sortKey(prop.key) > sortKey("blocks"));
1588
+ if (targetIndex === -1 || targetIndex === blocksIndex + 1) return source;
1589
+ const blocks = propertySpan(source, code, root, props, blocksIndex);
1590
+ const target = props[targetIndex];
1591
+ if (target.start > blocks.start) return source;
1592
+ const at = blocks.multiline ? propertySpan(source, code, root, props, targetIndex).start : target.start;
1593
+ const moved = blocks.multiline ? `${blocks.value},${blocks.trailing}\n` : `${blocks.value}, `;
1594
+ return source.slice(0, at) + moved + source.slice(at, blocks.start) + source.slice(blocks.end);
1595
+ }
1596
+ /**
1597
+ * `source` with `sql.modules` moved to a top-level `blocks` key, placed right
1598
+ * after `sql`, or in sorted position when the config's top-level keys are
1599
+ * sorted. `sql` is dropped when nothing else is left in it. A config without
1600
+ * `sql.modules` comes back unchanged; one that also sets `blocks` is refused,
1601
+ * because the two need a merge by hand.
1602
+ */
1603
+ function moveSqlModulesToBlocks(source) {
1604
+ const edit = moveSqlModules(source);
1605
+ return edit.ok && edit.text !== source && keysSorted(rootKeys(source)) ? {
1606
+ ok: true,
1607
+ text: sortBlocksKey(edit.text)
1608
+ } : edit;
1609
+ }
1610
+ function moveSqlModules(source) {
1611
+ const code = mask(source);
1612
+ const root = configObject(code);
1613
+ if (root === void 0) return /\bmodules\b/.test(code) ? {
1614
+ ok: false,
1615
+ reason: "it doesn't pass an object literal to defineConfig()"
1616
+ } : {
1617
+ ok: true,
1618
+ text: source
1619
+ };
1620
+ const rootProps = properties(source, code, root);
1621
+ if (!rootProps) return {
1622
+ ok: false,
1623
+ reason: "its config object can't be read"
1624
+ };
1625
+ const sqlIndex = rootProps.findIndex((prop) => prop.key === "sql");
1626
+ const sql = rootProps[sqlIndex];
1627
+ if (sql === void 0) return {
1628
+ ok: true,
1629
+ text: source
1630
+ };
1631
+ if (code[sql.valueStart] !== "{" || sql.valueStart === sql.start) return /\bmodules\b/.test(code) ? {
1632
+ ok: false,
1633
+ reason: "its `sql` value isn't an object literal; move `sql.modules` to `blocks` by hand"
1634
+ } : {
1635
+ ok: true,
1636
+ text: source
1637
+ };
1638
+ const sqlProps = properties(source, code, sql.valueStart);
1639
+ if (!sqlProps) return {
1640
+ ok: false,
1641
+ reason: "its `sql` object can't be read"
1642
+ };
1643
+ const modulesIndex = sqlProps.findIndex((prop) => prop.key === "modules");
1644
+ const modules = sqlProps[modulesIndex];
1645
+ if (modules === void 0) return {
1646
+ ok: true,
1647
+ text: source
1648
+ };
1649
+ if (rootProps.some((prop) => prop.key === "blocks")) return {
1650
+ ok: false,
1651
+ reason: "it sets both `sql.modules` and `blocks`; merge `sql.modules` into `blocks` by hand"
1652
+ };
1653
+ const cut = propertySpan(source, code, sql.valueStart, sqlProps, modulesIndex);
1654
+ const outer = propertySpan(source, code, root, rootProps, sqlIndex);
1655
+ const renamed = renameKey(cut.value, cut.keyAt, modules);
1656
+ const sqlClose = closingIndex(code, sql.valueStart);
1657
+ const leftover = source.slice(sql.valueStart + 1, cut.start) + source.slice(cut.end, sqlClose);
1658
+ const dropSql = sqlProps.length === 1 && leftover.trim() === "";
1659
+ if (!cut.multiline || !outer.multiline) {
1660
+ const property = renamed.trim();
1661
+ if (dropSql) return {
1662
+ ok: true,
1663
+ text: source.slice(0, sql.start) + property + source.slice(sql.valueEnd)
1664
+ };
1665
+ return {
1666
+ ok: true,
1667
+ text: `${source.slice(0, cut.start)}${source.slice(cut.end, sql.valueEnd)}, ${property}${source.slice(sql.valueEnd)}`
1668
+ };
1669
+ }
1670
+ const sqlIndent = indentAt(source, sql.start);
1671
+ const body = reindent(renamed, indentAt(source, modules.start), sqlIndent);
1672
+ const moved = `${cut.start === modules.start ? sqlIndent + body : body},${cut.trailing}\n`;
1673
+ if (dropSql) return {
1674
+ ok: true,
1675
+ text: source.slice(0, lineStart(source, sql.start)) + moved + source.slice(outer.end)
1676
+ };
1677
+ const atLineStart = source[outer.end - 1] === "\n";
1678
+ return {
1679
+ ok: true,
1680
+ text: source.slice(0, cut.start) + source.slice(cut.end, sql.valueEnd) + (outer.hasComma ? "" : ",") + source.slice(sql.valueEnd, outer.end) + (atLineStart ? "" : "\n") + moved + source.slice(outer.end)
1681
+ };
1682
+ }
1683
+ const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
1684
+ function withBlocksSorted(config) {
1685
+ const entries = Object.entries(config).filter(([key]) => key !== "blocks");
1686
+ const after = entries.findIndex(([key]) => sortKey(key) > "blocks");
1687
+ entries.splice(after === -1 ? entries.length : after, 0, ["blocks", config["blocks"]]);
1688
+ return Object.fromEntries(entries);
1689
+ }
1690
+ /** `moveSqlModulesToBlocks` for `better-supabase.config.json`. */
1691
+ function moveSqlModulesToBlocksJson(source) {
1692
+ let config;
1693
+ try {
1694
+ config = JSON.parse(source);
1695
+ } catch {
1696
+ return {
1697
+ ok: false,
1698
+ reason: "it isn't valid JSON"
1699
+ };
1700
+ }
1701
+ if (!isRecord(config)) return {
1702
+ ok: false,
1703
+ reason: "it isn't a JSON object"
1704
+ };
1705
+ const sql = config["sql"];
1706
+ if (!isRecord(sql) || !("modules" in sql)) return {
1707
+ ok: true,
1708
+ text: source
1709
+ };
1710
+ if ("blocks" in config) return {
1711
+ ok: false,
1712
+ reason: "it sets both `sql.modules` and `blocks`; merge `sql.modules` into `blocks` by hand"
1713
+ };
1714
+ const { modules, ...restSql } = sql;
1715
+ const next = {};
1716
+ for (const [key, value] of Object.entries(config)) {
1717
+ if (key !== "sql") {
1718
+ next[key] = value;
1719
+ continue;
1720
+ }
1721
+ if (Object.keys(restSql).length > 0) next["sql"] = restSql;
1722
+ next["blocks"] = modules;
1723
+ }
1724
+ const sorted = keysSorted(Object.keys(config)) ? withBlocksSorted(next) : next;
1725
+ const indent = /^[ \t]+/m.exec(source)?.[0] ?? " ";
1726
+ return {
1727
+ ok: true,
1728
+ text: `${JSON.stringify(sorted, null, indent)}\n`
1729
+ };
1730
+ }
1731
+ /** Review lines for `sql.modules` left in environment blocks after the move. */
1732
+ function environmentModules(text) {
1733
+ return mask(text).split("\n").flatMap((line, index) => /\bmodules\s*:/.test(line) ? [{
1734
+ line: index + 1,
1735
+ message: "`sql.modules` in an environment block moves to `blocks` too"
1736
+ }] : []);
1737
+ }
1738
+ // src/cli/sql/config-plugins.ts
1739
+ /** The block each plugin flag became, and its column keys as block options. */
1740
+ const PLUGIN_BLOCKS = {
1741
+ timestamps: {
1742
+ block: "updated-at",
1743
+ options: {
1744
+ createdAt: "createdAt",
1745
+ updatedAt: "updatedAt"
1746
+ }
1747
+ },
1748
+ actor: {
1749
+ block: "created-by",
1750
+ options: {
1751
+ createdBy: "createdBy",
1752
+ updatedBy: "updatedBy",
1753
+ impersonatedBy: "impersonatedBy"
1754
+ }
1755
+ },
1756
+ softDelete: {
1757
+ block: "trash",
1758
+ options: { column: "deletedAt" }
1759
+ }
1760
+ };
1761
+ const DEFAULT_ORGANIZATION_COLUMN = "organization_id";
1762
+ function movesOf(flags) {
1763
+ const blocks = [];
1764
+ let tenant = false;
1765
+ for (const [name, flag] of Object.entries(flags)) {
1766
+ if (name === "tenant") {
1767
+ tenant = flag !== false;
1768
+ continue;
1769
+ }
1770
+ const move = PLUGIN_BLOCKS[name];
1771
+ if (move === void 0) return { reason: `plugins.${name} is not a plugin flag 0.14 had` };
1772
+ if (flag === false) continue;
1773
+ const options = {};
1774
+ for (const [key, value] of Object.entries(flag)) {
1775
+ const option = move.options[key];
1776
+ if (option === void 0) return { reason: `plugins.${name}.${key} is not a column it took` };
1777
+ options[option] = value;
1778
+ }
1779
+ blocks.push([move.block, options]);
1780
+ }
1781
+ return {
1782
+ blocks,
1783
+ tenant
1784
+ };
1785
+ }
1786
+ /** A string literal's value, or undefined for any other expression. */
1787
+ function stringValue(text) {
1788
+ return /^(["'])((?:(?!\1)[^\\])*)\1$/.exec(text.trim())?.[2];
1789
+ }
1790
+ function flagsInSource(source, code, open) {
1791
+ const flags = {};
1792
+ for (const prop of properties(source, code, open) ?? []) {
1793
+ const value = source.slice(prop.valueStart, prop.valueEnd).trim();
1794
+ if (prop.key === void 0) return { reason: "plugins has a spread or a computed key" };
1795
+ if (value === "true" || value === "false") {
1796
+ flags[prop.key] = value === "true" ? {} : false;
1797
+ continue;
1798
+ }
1799
+ if (code[prop.valueStart] !== "{") return { reason: `plugins.${prop.key} isn't true, false or an object` };
1800
+ const columns = {};
1801
+ for (const inner of properties(source, code, prop.valueStart) ?? []) {
1802
+ const column = stringValue(source.slice(inner.valueStart, inner.valueEnd));
1803
+ if (inner.key === void 0 || column === void 0) return { reason: `plugins.${prop.key} has a key that isn't a string` };
1804
+ columns[inner.key] = column;
1805
+ }
1806
+ flags[prop.key] = columns;
1807
+ }
1808
+ return flags;
1809
+ }
1810
+ /** Whether the `blocks` value names `memberships`, as a key or a list item. */
1811
+ const MEMBERSHIPS = /["']memberships["']|\bmemberships\s*:/;
1812
+ /** `better-supabase.config.ts` with `plugins` moved into blocks. */
1813
+ function movePluginsInSource(source) {
1814
+ const code = mask(source);
1815
+ const root = configObject(code);
1816
+ if (root === void 0) return {
1817
+ ok: true,
1818
+ text: source
1819
+ };
1820
+ const props = properties(source, code, root) ?? [];
1821
+ const index = props.findIndex((prop) => prop.key === "plugins");
1822
+ const plugins = props[index];
1823
+ if (plugins === void 0) return {
1824
+ ok: true,
1825
+ text: source
1826
+ };
1827
+ if (code[plugins.valueStart] !== "{") return {
1828
+ ok: false,
1829
+ reason: "its plugins key isn't a literal object"
1830
+ };
1831
+ const flags = flagsInSource(source, code, plugins.valueStart);
1832
+ if ("reason" in flags) return {
1833
+ ok: false,
1834
+ reason: String(flags.reason)
1835
+ };
1836
+ const moves = movesOf(flags);
1837
+ if ("reason" in moves) return {
1838
+ ok: false,
1839
+ reason: moves.reason
1840
+ };
1841
+ const multiline = code.slice(root, closingIndex(code, root)).includes("\n");
1842
+ const cut = cutRange(source, code, root, props, index, multiline);
1843
+ let edit = {
1844
+ ok: true,
1845
+ text: source.slice(0, cut.start) + source.slice(cut.end)
1846
+ };
1847
+ const blocks = props.find((prop) => prop.key === "blocks");
1848
+ const memberships = blocks !== void 0 && MEMBERSHIPS.test(source.slice(blocks.valueStart, blocks.valueEnd));
1849
+ const organization = organizationText(source, code, props);
1850
+ const organizationColumn = /\bcolumn\s*:/.test(organization);
1851
+ const onMissing = /\bonMissing\s*:/.test(organization);
1852
+ const steps = [
1853
+ ...moves.blocks.flatMap(([block, options]) => [(text) => addBlocksToConfig(text, [block]), ...Object.entries(options).map(([key, value]) => (text) => setPathInConfig(text, [
1854
+ "blocks",
1855
+ block,
1856
+ "options",
1857
+ key
1858
+ ], value))]),
1859
+ ...moves.tenant && !memberships && !organizationColumn ? [(text) => setPathInConfig(text, [
1860
+ "auth",
1861
+ "tenant",
1862
+ "column"
1863
+ ], DEFAULT_ORGANIZATION_COLUMN)] : [],
1864
+ ...moves.tenant && !onMissing ? [(text) => setPathInConfig(text, [
1865
+ "auth",
1866
+ "tenant",
1867
+ "onMissing"
1868
+ ], "error")] : []
1869
+ ];
1870
+ for (const step of steps) {
1871
+ if (!edit.ok) return edit;
1872
+ edit = step(edit.text);
1873
+ }
1874
+ return edit;
1875
+ }
1876
+ /** The source of `auth.tenant`, or `""` without one. */
1877
+ function organizationText(source, code, props) {
1878
+ const auth = props.find((prop) => prop.key === "auth");
1879
+ if (auth === void 0 || code[auth.valueStart] !== "{") return "";
1880
+ const organization = (properties(source, code, auth.valueStart) ?? []).find((prop) => prop.key === "tenant");
1881
+ return organization === void 0 ? "" : source.slice(organization.valueStart, organization.valueEnd);
1882
+ }
1883
+ const isColumns = (value) => isRecord$1(value) && Object.values(value).every((column) => typeof column === "string");
1884
+ function flagsInJson(plugins) {
1885
+ if (!isRecord$1(plugins)) return { reason: "its plugins key isn't an object" };
1886
+ const flags = {};
1887
+ for (const [name, value] of Object.entries(plugins)) if (typeof value === "boolean") flags[name] = value ? {} : false;
1888
+ else if (isColumns(value)) flags[name] = value;
1889
+ else return { reason: `plugins.${name} isn't true, false or columns` };
1890
+ return flags;
1891
+ }
1892
+ const objectAt$1 = (value) => isRecord$1(value) ? value : {};
1893
+ /** `movePluginsInSource` for `better-supabase.config.json`. */
1894
+ function movePluginsInJson(source) {
1895
+ let config;
1896
+ try {
1897
+ config = JSON.parse(source);
1898
+ } catch {
1899
+ return {
1900
+ ok: true,
1901
+ text: source
1902
+ };
1903
+ }
1904
+ if (!isRecord$1(config) || !("plugins" in config)) return {
1905
+ ok: true,
1906
+ text: source
1907
+ };
1908
+ const { plugins, ...rest } = config;
1909
+ const flags = flagsInJson(plugins);
1910
+ if ("reason" in flags) return {
1911
+ ok: false,
1912
+ reason: String(flags.reason)
1913
+ };
1914
+ const moves = movesOf(flags);
1915
+ if ("reason" in moves) return {
1916
+ ok: false,
1917
+ reason: moves.reason
1918
+ };
1919
+ const listed = rest["blocks"] ?? {};
1920
+ const blocks = Array.isArray(listed) ? Object.fromEntries(listed.map((name) => [String(name), {}])) : { ...objectAt$1(listed) };
1921
+ const memberships = "memberships" in blocks;
1922
+ for (const [block, options] of moves.blocks) {
1923
+ const entry = objectAt$1(blocks[block]);
1924
+ blocks[block] = {
1925
+ ...entry,
1926
+ ...Object.keys(options).length === 0 ? {} : { options: {
1927
+ ...objectAt$1(entry["options"]),
1928
+ ...options
1929
+ } }
1930
+ };
1931
+ }
1932
+ const next = {
1933
+ ...rest,
1934
+ ...moves.blocks.length === 0 && rest["blocks"] === void 0 ? {} : { blocks: moves.blocks.length === 0 ? rest["blocks"] : blocks }
1935
+ };
1936
+ if (moves.tenant) {
1937
+ const auth = objectAt$1(next["auth"]);
1938
+ const tenant = objectAt$1(auth["tenant"]);
1939
+ next["auth"] = {
1940
+ ...auth,
1941
+ tenant: {
1942
+ ...memberships ? {} : { column: DEFAULT_ORGANIZATION_COLUMN },
1943
+ onMissing: "error",
1944
+ ...tenant
1945
+ }
1946
+ };
1947
+ }
1948
+ const indent = /^[ \t]+/m.exec(source)?.[0] ?? " ";
1949
+ return {
1950
+ ok: true,
1951
+ text: `${JSON.stringify(next, null, indent)}\n`
1952
+ };
1953
+ }
1954
+ /** `edit` with `plugins` moved into blocks, after the regrouping. */
1955
+ function withoutPlugins(edit, json) {
1956
+ if (!edit.ok) return edit;
1957
+ return json ? movePluginsInJson(edit.text) : movePluginsInSource(edit.text);
1958
+ }
1959
+ // src/cli/sql/config-webhook-format.ts
1960
+ const PATH = [
1961
+ "blocks",
1962
+ "webhooks-out",
1963
+ "options",
1964
+ "defaultFormat"
1965
+ ];
1966
+ function needsPin(block) {
1967
+ if (!isRecord$1(block) || block["mode"] !== "adopt") return false;
1968
+ const options = block["options"];
1969
+ const columns = block["columns"];
1970
+ const endpoints = isRecord$1(columns) ? columns["endpoints"] : void 0;
1971
+ return !(isRecord$1(options) && options["defaultFormat"] !== void 0) && !(isRecord$1(endpoints) && endpoints["format"] !== void 0);
1972
+ }
1973
+ function pinJson(source, format) {
1974
+ let config;
1975
+ try {
1976
+ config = JSON.parse(source);
1977
+ } catch {
1978
+ return {
1979
+ ok: false,
1980
+ reason: "it isn't valid JSON"
1981
+ };
1982
+ }
1983
+ const blocks = isRecord$1(config) ? config["blocks"] : void 0;
1984
+ return isRecord$1(blocks) && needsPin(blocks["webhooks-out"]) ? setPathInJson(source, PATH, format) : void 0;
1985
+ }
1986
+ /** The object literal at `prop`'s value, or `undefined` when it isn't one. */
1987
+ function objectAt(source, code, prop) {
1988
+ return prop && code[prop.valueStart] === "{" ? properties(source, code, prop.valueStart) : void 0;
1989
+ }
1990
+ function pinTs(source, format) {
1991
+ const code = mask(source);
1992
+ const root = configObject(code);
1993
+ if (root === void 0) return;
1994
+ const find = (props, key) => props?.find((prop) => prop.key === key);
1995
+ const blockProp = find(objectAt(source, code, find(properties(source, code, root), "blocks")), "webhooks-out");
1996
+ if (!blockProp) return;
1997
+ const block = objectAt(source, code, blockProp);
1998
+ if (!block) return {
1999
+ ok: false,
2000
+ reason: "its blocks[\"webhooks-out\"] isn't a literal object"
2001
+ };
2002
+ const mode = find(block, "mode");
2003
+ const modeText = mode ? source.slice(mode.valueStart, mode.valueEnd).trim() : void 0;
2004
+ if (modeText !== "\"adopt\"" && modeText !== "'adopt'") return;
2005
+ const options = find(block, "options");
2006
+ const columns = find(block, "columns");
2007
+ if (options && !objectAt(source, code, options) || columns && !objectAt(source, code, columns)) return {
2008
+ ok: false,
2009
+ reason: "its blocks[\"webhooks-out\"] options or columns aren't literal objects"
2010
+ };
2011
+ const endpoints = find(objectAt(source, code, columns), "endpoints");
2012
+ if (endpoints && !objectAt(source, code, endpoints)) return {
2013
+ ok: false,
2014
+ reason: "its blocks[\"webhooks-out\"].columns.endpoints isn't a literal object"
2015
+ };
2016
+ if (find(objectAt(source, code, options), "defaultFormat") || find(objectAt(source, code, endpoints), "format")) return;
2017
+ return setPathInConfig(source, PATH, format);
2018
+ }
2019
+ /**
2020
+ * Pins `defaultFormat` to `format` where an adopted block leaves it to the
2021
+ * default.
2022
+ */
2023
+ function pinWebhookFormat(source, json, format) {
2024
+ return json ? pinJson(source, format) : pinTs(source, format);
2025
+ }
2026
+ /**
2027
+ * `edit` with `defaultFormat` pinned to `format` where an adopted webhooks-out
2028
+ * block needs it.
2029
+ */
2030
+ function withWebhookFormat(edit, json, format) {
2031
+ if (!edit.ok) return edit;
2032
+ const earlier = "review" in edit ? edit.review : [];
2033
+ const pin = pinWebhookFormat(edit.text, json, format);
2034
+ if (pin === void 0) return {
2035
+ ok: true,
2036
+ text: edit.text,
2037
+ review: earlier
2038
+ };
2039
+ if (!pin.ok) return {
2040
+ ok: true,
2041
+ text: edit.text,
2042
+ review: [...earlier, {
2043
+ line: 1,
2044
+ message: `blocks["webhooks-out"] is adopted and maps no columns.endpoints.format, but defaultFormat wasn't pinned: ${pin.reason}. Set options.defaultFormat to "${format}" to keep the body endpoints get now`
2045
+ }]
2046
+ };
2047
+ const line = pin.text.split("\n").findIndex((text) => text.includes("defaultFormat")) + 1;
2048
+ return {
2049
+ ok: true,
2050
+ text: pin.text,
2051
+ review: [...earlier, {
2052
+ line: Math.max(line, 1),
2053
+ message: `blocks["webhooks-out"] is adopted and maps no columns.endpoints.format, so the codemod set options.defaultFormat to "${format}", the body its endpoints get now. Change it if your receivers expect the other format`
2054
+ }]
2055
+ };
2056
+ }
2057
+ // src/cli/codemod.ts
2058
+ /**
2059
+ * `better-supabase.config.*`, the files a codemod's `configFile` edit applies
2060
+ * to.
2061
+ */
2062
+ const CONFIG_FILE = /(?:^|[\\/])better-supabase\.config\.(?:ts|mts|cts|js|mjs|cjs|json)$/;
2063
+ const OFFSET_PIN = {
2064
+ key: "pagination",
2065
+ value: "\"offset\"",
2066
+ when: /\.page\b(?!\s*\()|\bpageCount\b|\btotalPages\b|\bpage\s*:|[?&]page=|["']page["']/,
2067
+ message: "Lists and resources page by cursor (`after`, `nextCursor`, no total) unless `pagination: \"offset\"` is set. This file shows no page numbers, so the codemod left it: add `pagination: \"offset\"` if a UI elsewhere reads `page` or the total, or the list sorts by a relation"
2068
+ };
2069
+ const BLOCK_SQL_TYPES = "Context ContractFunction Names Layout File IdType AccessProvider EntitlementsProvider TableSpec Upgrade PermissionKey Audit Deprecation Extension Emit UpgradePlan Topic TestFile Action";
2070
+ const ENTITY_FORM_TYPES = " CustomField Field Input Options Result State Values";
2071
+ /** `from` and `to` prefixed to each space-separated suffix in `suffixes`. */
2072
+ function prefixed(from, to, suffixes) {
2073
+ return Object.fromEntries(suffixes.split(" ").map((suffix) => [from + suffix, to + suffix]));
2074
+ }
2075
+ const CODEMODS = {
2076
+ "0.4": {
2077
+ name: "0.4",
2078
+ description: "Renames from 0.3 to 0.4 (the naming page lists them)",
2079
+ imports: {
2080
+ createBrowser: "createClient",
2081
+ BetterBrowser: "BetterClient",
2082
+ BrowserOptions: "ClientOptions",
2083
+ BrowserAuth: "ClientAuth",
2084
+ BetterEnv: "HonoEnv",
2085
+ HandlerOptions: "MiddlewareOptions",
2086
+ Queries: "BetterQueries",
2087
+ CreateQueriesOptions: "QueriesOptions",
2088
+ Postgres: "BetterPostgres",
2089
+ DefineSupabaseOptions: "SupabaseOptions"
2090
+ },
2091
+ members: [
2092
+ {
2093
+ from: "serverFor",
2094
+ to: "contextForSession"
2095
+ },
2096
+ {
2097
+ from: "toORPCError",
2098
+ to: "toOrpcError"
2099
+ },
2100
+ {
2101
+ from: "$table",
2102
+ to: "$tableName",
2103
+ notCalled: true
2104
+ }
2105
+ ],
2106
+ props: [{
2107
+ component: "BetterSupabaseProvider",
2108
+ from: "browser",
2109
+ to: "client"
2110
+ }],
2111
+ review: [
2112
+ {
2113
+ pattern: /\.server\(\)/,
2114
+ message: "`next.server()` is `bsb.context()` on the createNext() instance"
2115
+ },
2116
+ {
2117
+ pattern: /\.handle\(\)/,
2118
+ message: "Hono's `bsb.handle()` is `bsb.handler()`"
2119
+ },
2120
+ {
2121
+ pattern: /\bmcp\.handler\b/,
2122
+ message: "`mcp.handler` is `bsb.endpoint`"
2123
+ },
2124
+ {
2125
+ pattern: /\.sb\b/,
2126
+ message: "`client.sb` is `client.betterSupabase`"
2127
+ },
2128
+ {
2129
+ pattern: /\btestExecutor\(\s*\{[^}]*\bsb\b/,
2130
+ message: "`{ sb }` in testExecutor is `{ betterSupabase }`"
2131
+ }
2132
+ ]
2133
+ },
2134
+ "0.5": {
2135
+ name: "0.5",
2136
+ description: "Renames from 0.4 to 0.5: createMcp's scopes is advertisedScopes",
2137
+ options: [{
2138
+ call: "createMcp",
2139
+ from: "scopes",
2140
+ to: "advertisedScopes"
2141
+ }]
2142
+ },
2143
+ "0.6": {
2144
+ name: "0.6",
2145
+ description: "Changes from 0.5 to 0.6: kits become blocks and modules, org becomes organization (in event types too), $rpc returns table rows and records in the configured casing, and bucket publicUrl() and path() return a Result",
2146
+ strings: {
2147
+ ...BLOCK_EVENT_RENAMES,
2148
+ "org.*": "organization.*"
2149
+ },
2150
+ imports: {
2151
+ KitEvent: "BlockEvent",
2152
+ KitEventMap: "BlockEventMap",
2153
+ KitEventType: "BlockEventType",
2154
+ KitEventMeta: "BlockEventMeta",
2155
+ KitEventPattern: "BlockEventPattern",
2156
+ KitEventsMatching: "BlockEventsMatching",
2157
+ onKitEvent: "onBlockEvent",
2158
+ forwardKitEvents: "forwardBlockEvents",
2159
+ ForwardKitOptions: "ForwardBlockOptions",
2160
+ KIT_ATTRIBUTES: "BLOCK_ATTRIBUTES",
2161
+ kitCloudEvent: "blockCloudEvent",
2162
+ kitEventAttributes: "blockEventAttributes",
2163
+ traceKitEvents: "traceBlockEvents",
2164
+ KitTransport: "BlockTransport",
2165
+ OrgEventData: "OrganizationEventData",
2166
+ createOrgs: "createOrganizations",
2167
+ Orgs: "Organizations",
2168
+ OrgsOptions: "OrganizationsOptions",
2169
+ CreateOrgOptions: "CreateOrganizationOptions",
2170
+ OrgAttributes: "OrganizationAttributes",
2171
+ orgLogoBucket: "organizationLogoBucket",
2172
+ OrgLogoBucketOptions: "OrganizationLogoBucketOptions",
2173
+ KitsConfig: "BlocksConfig",
2174
+ KitModuleConfig: "BlockConfig",
2175
+ KitMode: "BlockMode",
2176
+ AccessKitConfig: "AccessBlockConfig",
2177
+ renderKit: "renderModules",
2178
+ kitLayout: "moduleLayout",
2179
+ kitPermissionKeys: "modulePermissionKeys",
2180
+ kitDeprecations: "moduleDeprecations",
2181
+ kitFilePaths: "moduleFilePaths",
2182
+ kitFileVersion: "moduleFileVersion",
2183
+ sameKitFile: "sameModuleFile",
2184
+ kitIdType: "moduleIdType",
2185
+ isKitIdType: "isModuleIdType",
2186
+ KIT_ID_TYPES: "MODULE_ID_TYPES",
2187
+ KitIdType: "ModuleIdType",
2188
+ KitContext: "ModuleContext",
2189
+ KitLayout: "ModuleLayout",
2190
+ KitFile: "ModuleFile",
2191
+ KitNames: "ModuleNames",
2192
+ KitTableSpec: "ModuleTableSpec",
2193
+ KitContractFunction: "ModuleContractFunction",
2194
+ KitDeprecation: "ModuleDeprecation",
2195
+ KitPermissionKey: "ModulePermissionKey",
2196
+ KitUpgrade: "ModuleUpgrade",
2197
+ KitUpgradePlan: "ModuleUpgradePlan",
2198
+ InstalledKitModule: "InstalledModule"
2199
+ },
2200
+ options: [{
2201
+ call: "defineSupabase",
2202
+ from: "maxUrlLength",
2203
+ to: "urlLengthLimit"
2204
+ }],
2205
+ review: [
2206
+ {
2207
+ pattern: /from\s*["']better-supabase\/(orgs|jobs|notifications|webhooks)["']/,
2208
+ message: "This subpath moved under `better-supabase/blocks/` (`orgs` is `blocks/organizations`; the outbox, entitlements and audit retention left `jobs` for their own blocks); the 0.5 to 0.6 guide maps each export"
2209
+ },
2210
+ {
2211
+ pattern: /\bcreateInbox\b[^\n]*from\s*["']better-supabase\/(blocks\/)?jobs["']/,
2212
+ message: "The webhook inbox is `createWebhookInbox` from `better-supabase/blocks/jobs`; `createInbox` is now the conversation inbox in `blocks/inbox`"
2213
+ },
2214
+ {
2215
+ pattern: /\$rpc\s*(<|\()/,
2216
+ message: "`$rpc` now returns table rows and `returns table (...)` records in the configured casing, with codecs applied: drop a snake-to-camel mapping of the result, or pass `{ raw: true }` to keep database names. Scalar results and `returns table` columns are now `| null` unless `functions.<name>.notNull` says otherwise"
2217
+ },
2218
+ {
2219
+ pattern: /\.publicUrl\s*\(/,
2220
+ message: "A connected bucket's `publicUrl()` returns a `Result` instead of throwing: read `.data` (`null` on an error) or check `.ok`"
2221
+ },
2222
+ {
2223
+ pattern: /\.path\s*\(\s*\{/,
2224
+ message: "A bucket definition's `path(values)` returns a `Result` instead of throwing, like the connected client's `path()`: read `.data` (`null` on an error) or check `.ok`"
2225
+ }
2226
+ ]
2227
+ },
2228
+ "0.9": {
2229
+ name: "0.9",
2230
+ description: "Moves sql.modules to the top-level blocks key in better-supabase.config.*, rewrites CLI calls in package.json scripts and GitHub workflows to the new subcommands and flags (other shell files are listed), renames the config types (ModulesConfig to BlocksConfig, ModuleConfig to BlockConfig, AccessModuleConfig to AccessBlockConfig, ModuleMode to BlockMode), pins pagination: 'offset' on lists and resources in files that read page numbers, and lists behaviour changes for review: support sessions (denied without authorize, approved by a second admin), canApprove (now isApprover), outgoing webhook transforms and receivers (CloudEvents), gatewayOptions callers, generic problem types (about:blank), the delegation cap, role helpers, event and schedule starts (runAs), workflow builders, delivery and realtime fan-out, agent actors, share links, before_promotion_activate and comment subjects",
2231
+ imports: {
2232
+ ModulesConfig: "BlocksConfig",
2233
+ ModuleConfig: "BlockConfig",
2234
+ AccessModuleConfig: "AccessBlockConfig",
2235
+ ModuleMode: "BlockMode"
2236
+ },
2237
+ configFile: (source, json) => {
2238
+ const moved = json ? moveSqlModulesToBlocksJson(source) : moveSqlModulesToBlocks(source);
2239
+ return withWebhookFormat(moved.ok && !json ? {
2240
+ ...moved,
2241
+ review: environmentModules(moved.text)
2242
+ } : moved, json, "standard");
2243
+ },
2244
+ cliCalls: migrateCliCall,
2245
+ cliReview: [SQL_ADD_HINT],
2246
+ pins: [{
2247
+ call: "defineListQuery",
2248
+ argument: 2,
2249
+ ...OFFSET_PIN
2250
+ }, {
2251
+ call: "defineResource",
2252
+ argument: 2,
2253
+ unless: ["list"],
2254
+ ...OFFSET_PIN
2255
+ }],
2256
+ review: [
2257
+ {
2258
+ pattern: /\bresources\s*:\s*\{/,
2259
+ message: "The default list of each `defineApi` resource pages by cursor (`after`, `nextCursor`) unless the table has no primary key; set `pagination: \"offset\"` on a resource whose clients send `page` or read the total"
2260
+ },
2261
+ {
2262
+ pattern: /\bsupportSessions\s*\(/,
2263
+ message: "Support sessions refuse every start without `authorize` (or the server's `authorization.support.authorize`), and a start needs a request approved by a different admin unless `policy.approval` is `\"none\"`. `authorize: \"store\"` keeps the store-only check"
2264
+ },
2265
+ {
2266
+ pattern: /\bcanApprove\b/,
2267
+ message: "`authorization.functions.canApprove` is deprecated: set `isApprover` with `{kind}` (`'ai-tool'`), `{subject}` (the tool name, was `{tool}`) and `{tenant}`"
2268
+ },
2269
+ {
2270
+ pattern: /\bcreateWebhooks\s*\(/,
2271
+ message: "Outgoing webhooks send CloudEvents 1.0 (`application/cloudevents+json`) instead of `{ type, timestamp, data }`; a `transform` now returns only the event's `data`, and receivers read `data` from the CloudEvent. `sql upgrade` keeps existing endpoints on `format = 'standard'` (the 0.8 body) until you set each one to `cloudevents`"
2272
+ },
2273
+ {
2274
+ pattern: /\bgatewayOptions\s*\(/,
2275
+ message: "`gatewayOptions` ignores a `user` in its second argument; pass the caller's id as `context.userId`"
2276
+ },
2277
+ {
2278
+ pattern: /bettersupabase\.com\/problems\/(invalid-request|unauthorized|forbidden|not-found|conflict|rate-limited|unexpected)\b|["'](Invalid request|Not found|Too many requests|Unexpected error)["']/,
2279
+ message: "Generic problems use `type: \"about:blank\"` and the HTTP status phrase as `title` (`Bad Request`, `Not Found`, `Too Many Requests`, `Internal Server Error`); match on `kind` or `code` instead"
2280
+ },
2281
+ {
2282
+ pattern: /\bpublish_webhook_event\s*\(/,
2283
+ message: "`publish_webhook_event` takes `subject` and `read_permission` and delivers only to endpoints whose owner may read the event"
2284
+ },
2285
+ {
2286
+ pattern: /\btoken_scope_allows\s*\(|["']oauth-client["']/,
2287
+ message: "Delegated tokens are narrowed inside `member_can`, `platform_can` and `tenant_ids_with`: a permission passes only when one of the token's scopes maps to it. Map scopes in `blocks.access.scopes` or `authorization.delegation.scopes`; a `token_scope_allows` check in a write policy is now covered by the cap"
2288
+ },
2289
+ {
2290
+ pattern: /\b(has_organization_role|member_organization_ids|organization_member_roles?)\s*\(/,
2291
+ message: "Under the provider model the role helpers take membership from the provider's `memberIds`, and a role name check skips the delegation cap (doctor BS334): check a permission with `tenant_ids_with('<permission>')` or `member_can()`"
2292
+ },
2293
+ {
2294
+ pattern: /\b(workflowStarter|startOnEvent)\s*\(/,
2295
+ message: "Event and schedule starts need `runAs: { publisher, permissions }` (or a function returning it): a schedule start without it throws, and the run's context is the publisher's, capped to `permissions`"
2296
+ },
2297
+ {
2298
+ pattern: /\bcreateBuilder\s*\(/,
2299
+ message: "Published versions run as their publisher (`versions.runAs`), and versions published before 0.9 fail with `WORKFLOW_PUBLISHER_REVOKED` until republished. A version the organization owns runs as its default service principal: create one with `default: true` or set `automation.runAs`"
2300
+ },
2301
+ {
2302
+ pattern: /\b(createNotifications|createReminders)\s*\(|\.fanOut\s*\(/,
2303
+ message: "Under an authorization provider without `delivery.subscribers` or `delivery.audience`, an event about a registered subject reaches only users who may read it (`subjectReaders`), and realtime `fanOut` refuses it (`REALTIME_SUBSCRIBER_POLICY_REQUIRED`) until you pass a `policy`"
2304
+ },
2305
+ {
2306
+ pattern: /\bkind\s*:\s*["']agent["']/,
2307
+ message: "An `act` level `{ kind: \"agent\", sub, tools }` is now valid (build it with `agentClaims`) and writes with the user's rights unless it sets `read_only: true`; `tools` must be a list of names"
2308
+ },
2309
+ {
2310
+ pattern: /\bcreate_share_link\b/,
2311
+ message: "`create_share_link` takes `version_id` and `expires_at` after `role`; grants and revokes on the four-argument signature must name `(uuid, text, text, text, uuid, timestamptz)`"
2312
+ },
2313
+ {
2314
+ pattern: /\bbefore_promotion_activate\b/,
2315
+ message: "`promotions` now calls `before_promotion_activate(promotion uuid)` after every write that leaves a promotion active; a function of that name runs on each such save"
2316
+ },
2317
+ {
2318
+ pattern: /\bcomments\s*:\s*\{/,
2319
+ message: "With `config.subjects` set and no `subjects` option, comments accept only the registered subject types and require read on the subject row"
2320
+ }
2321
+ ]
2322
+ },
2323
+ "0.11": {
2324
+ name: "0.11",
2325
+ description: "Pins blocks[\"webhooks-out\"].options.defaultFormat to \"cloudevents\" in better-supabase.config.* when the block is adopted and maps no columns.endpoints.format, since adopt mode requires it from 0.11; the 0.9 codemod pins \"standard\" instead for configs coming from 0.8",
2326
+ configFile: (source, json) => withWebhookFormat({
2327
+ ok: true,
2328
+ text: source
2329
+ }, json, "cloudevents")
2330
+ },
2331
+ "0.15": {
2332
+ name: "0.15",
2333
+ description: "Regroups better-supabase.config.* into database, auth, gen, api and tooling (subjects to records, appTables to tables, integrations to adapters, a block's mode, scope, entities and hooks to ownership, owner, names and callbacks, and removes ownership: \"adopt\", since a block now leaves alone the tables the schema already has; claims.tenant and the tenant plugin's column to auth.tenant, the 0.32 name); renames the runtime instance bs to bsb (the CLI's short name) where a file creates, imports or destructures it, and the bs key on request contexts (ctx.bs, c.var.bs, locals.bs, context.bs) to bsb; renames imports: SqlModule to BlockSql, ModuleDefinition to BlockSqlDefinition and the other Module* SQL types to BlockSql*, SubjectRef to RecordRef, entityForm to recordForm, ShipmentCarrier to ShippingProvider, QueueBackend to QueueProvider; rewrites CLI calls in package.json scripts and GitHub workflows to the 0.15 commands (apply and adopt to add, sql sync and sql upgrade to upgrade, introspect to gen --save-snapshot, seed to db seed, env, run, keys and stack to dev); renames the blocks 0.15 renamed (work-items to tasks, parties to contacts, engagements to activities, access to permissions, rules to automations, jobs to queue, activity to timeline and the rest of the 0.14 to 0.15 guide's table) in the config's blocks and preset.blocks, in operation names under auth.authorization.operations, in better-supabase/blocks/<name> imports and in the exports named after them; turns a 0.14 preset code in the config's preset into the preset name or object it holds, and a 0.14 design file into a design with its preset inside; moves the plugins key into blocks (timestamps to updated-at, actor to created-by, softDelete to trash, with their columns as the block's options; tenant to auth.tenant.column when memberships is not installed) and the better-supabase/plugins/* imports to the block extensions, better-supabase/lint guards and validation from better-supabase; moves repository calls to the data contract (findMany to list, paginate to page, findById, findUnique and findOnly to get, findFirst to list with limit: 1, exists to count, createMany and upsertMany to create and upsert with an array, updateMany and deleteMany to update and delete with a { where } filter); renames generateFeatures to gen.recordTypes, the record section exports to record bindings (defineSection to defineRecordBinding, commentsSection to commentsBinding, loadSections to loadBindings and the rest) and lists record feature imports, recordServer and sectionAction calls for the move to bsb.record; cache tags, query keys and the debug header and route that start with bs are listed for review, and so are the lines of the app's SQL tests, schema files and newest migration that name a bs_ object the upgrade renames to bsb_",
2334
+ sqlNames: true,
2335
+ bindings: {
2336
+ bs: "bsb",
2337
+ SqlModule: "BlockSql",
2338
+ ModuleDefinition: "BlockSqlDefinition",
2339
+ ...prefixed("Module", "BlockSql", BLOCK_SQL_TYPES),
2340
+ ...prefixed("EntityForm", "RecordForm", ENTITY_FORM_TYPES),
2341
+ renderModules: "renderBlocks",
2342
+ resolveModules: "resolveBlocks",
2343
+ resolveModule: "resolveBlock",
2344
+ isModuleIdType: "isBlockSqlIdType",
2345
+ sameModuleFile: "sameBlockFile",
2346
+ InstalledModule: "InstalledBlock",
2347
+ SkippedModule: "SkippedBlock",
2348
+ SubjectRef: "RecordRef",
2349
+ entityForm: "recordForm",
2350
+ useEntityForm: "useRecordForm",
2351
+ UseEntityFormOptions: "UseRecordFormOptions",
2352
+ ShipmentCarrier: "ShippingProvider",
2353
+ testShipmentCarrier: "testShippingProvider",
2354
+ TestShipmentCarrierOptions: "TestShippingProviderOptions",
2355
+ QueueBackend: "QueueProvider",
2356
+ sqlQueueBackend: "sqlQueueProvider",
2357
+ testQueueBackend: "testQueueProvider",
2358
+ transportQueueBackend: "transportQueueProvider",
2359
+ vercelQueueBackend: "vercelQueueProvider",
2360
+ TestQueueBackendOptions: "TestQueueProviderOptions",
2361
+ TransportQueueBackendOptions: "TransportQueueProviderOptions",
2362
+ VercelQueueBackendOptions: "VercelQueueProviderOptions",
2363
+ ...RECORD_BINDING_RENAMES
2364
+ },
2365
+ imports: BLOCK_EXPORT_RENAMES,
2366
+ subpathImports: PLUGIN_IMPORT_RENAMES,
2367
+ subpaths: SUBPATH_RENAMES_0_15,
2368
+ members: [{
2369
+ from: "bs",
2370
+ to: "bsb"
2371
+ }],
2372
+ options: DATA_CONTRACT_OPTIONS,
2373
+ strings: {
2374
+ ...DATA_CONTRACT_STRINGS,
2375
+ "bs-block": "bsb"
2376
+ },
2377
+ configFile: (source, json) => [
2378
+ withoutPlugins,
2379
+ withBlockNames,
2380
+ withSubjectsOn,
2381
+ thenConvertPresetCode,
2382
+ withoutAdoptOwnership
2383
+ ].reduce((edit, step) => step(edit, json), json ? groupConfigJson(source) : groupConfigSource(source)),
2384
+ designFile: convertDesignFile,
2385
+ cliCalls: migrateCliCall,
2386
+ source: rewrite015,
2387
+ review: REVIEW_0_15
2388
+ },
2389
+ "0.29": CODEMOD_0_29,
2390
+ "0.32": CODEMOD_0_32
2391
+ };
2392
+ const SUPABASE_IMPORT = /\bfrom\s*["'](?:better-supabase(?:\/[\w./-]*)?|[^"']*supabase[^"']*)["']/;
2393
+ /**
2394
+ * Renames bindings a file declares, destructures or imports, in files that
2395
+ * import from `better-supabase` or a `supabase` module.
2396
+ */
2397
+ function renameBindings(text, bindings) {
2398
+ const ranges = codeRanges(text);
2399
+ if (codeMatches(text, new RegExp(SUPABASE_IMPORT, "g"), ranges).length === 0) return text;
2400
+ return renameIdentifiers(text, new Map(Object.entries(bindings).filter(([from]) => {
2401
+ const name = escapeRegExp(from);
2402
+ return codeMatches(text, new RegExp(`\\b(?:const|let|var|function)\\s+${name}(?![\\w$])|[{,]\\s*(?:type\\s+)?${name}\\s*(?:[,}]|as\\b)|\\(\\s*${name}\\s*[:,)]`, "g"), ranges).length > 0;
2403
+ })));
2404
+ }
2405
+ function applyEdits(text, edits) {
2406
+ let out = "";
2407
+ let cursor = 0;
2408
+ for (const edit of edits.toSorted((a, b) => a.start - b.start)) {
2409
+ if (edit.start < cursor) continue;
2410
+ out += text.slice(cursor, edit.start) + edit.text;
2411
+ cursor = edit.end;
2412
+ }
2413
+ return out + text.slice(cursor);
2414
+ }
2415
+ const escapeRegExp = (value) => value.replaceAll(/[.*+?^${}()|[\]\\]/g, "\\$&");
2416
+ function inCode(ranges, index) {
2417
+ let low = 0;
2418
+ let high = ranges.length - 1;
2419
+ while (low <= high) {
2420
+ const middle = Math.floor((low + high) / 2);
2421
+ const [start, end] = ranges[middle];
2422
+ if (index < start) high = middle - 1;
2423
+ else if (index >= end) low = middle + 1;
2424
+ else return true;
2425
+ }
2426
+ return false;
2427
+ }
2428
+ const OPENING = "({[";
2429
+ const CLOSING = ")}]";
2430
+ /** Matches of `pattern` that start in code. */
2431
+ function codeMatches(text, pattern, ranges) {
2432
+ return [...text.matchAll(pattern)].filter((match) => inCode(ranges, match.index));
2433
+ }
2434
+ const IMPORT = /\b(import|export)\s+(type\s+)?\{([^}]*)\}\s*from\s*(["'])better-supabase(?:\/([\w./-]*))?\4/g;
2435
+ /** Renames imported names, from every subpath or only from `subpath`. */
2436
+ function renameImports(text, renames, subpath) {
2437
+ const ranges = codeRanges(text);
2438
+ const locals = /* @__PURE__ */ new Set();
2439
+ const edits = [];
2440
+ for (const match of codeMatches(text, IMPORT, ranges)) {
2441
+ if (subpath !== void 0 && match[5] !== subpath) continue;
2442
+ const list = match[3];
2443
+ const listStart = match.index + match[0].indexOf("{") + 1;
2444
+ const renamed = list.replaceAll(/(\btype\s+)?([\w$]+)(\s+as\s+[\w$]+)?/g, (spec, type, name, alias) => {
2445
+ const to = renames[name];
2446
+ if (to === void 0) return spec;
2447
+ if (alias === void 0 && match[1] === "import") locals.add(name);
2448
+ return `${type ?? ""}${to}${alias ?? ""}`;
2449
+ });
2450
+ if (renamed !== list) edits.push({
2451
+ start: listStart,
2452
+ end: listStart + list.length,
2453
+ text: renamed
2454
+ });
2455
+ }
2456
+ return {
2457
+ text: applyEdits(text, edits),
2458
+ locals
2459
+ };
2460
+ }
2461
+ function renameIdentifiers(text, renames) {
2462
+ if (renames.size === 0) return text;
2463
+ const ranges = codeRanges(text);
2464
+ const names = [...renames.keys()].map(escapeRegExp).join("|");
2465
+ return applyEdits(text, codeMatches(text, new RegExp(`(?<![\\w$.])(?:${names})(?![\\w$])`, "g"), ranges).map((match) => ({
2466
+ start: match.index,
2467
+ end: match.index + match[0].length,
2468
+ text: renames.get(match[0])
2469
+ })));
2470
+ }
2471
+ function renameStrings(text, strings) {
2472
+ const names = Object.keys(strings).map(escapeRegExp).join("|");
2473
+ if (names === "") return text;
2474
+ const ranges = codeRanges(text);
2475
+ const pattern = new RegExp(`(["'\`])(${names})\\1`, "g");
2476
+ return applyEdits(text, [...text.matchAll(pattern)].filter((match) => !inCode(ranges, match.index + 1)).map((match) => ({
2477
+ start: match.index + 1,
2478
+ end: match.index + 1 + match[2].length,
2479
+ text: strings[match[2]]
2480
+ })));
2481
+ }
2482
+ function renameMembers(text, members) {
2483
+ const ranges = codeRanges(text);
2484
+ return applyEdits(text, members.flatMap((member) => codeMatches(text, new RegExp(`\\.${escapeRegExp(member.from)}(?![\\w$])${member.notCalled === true ? "(?!\\s*\\()" : ""}`, "g"), ranges).map((match) => ({
2485
+ start: match.index,
2486
+ end: match.index + match[0].length,
2487
+ text: `.${member.to}`
2488
+ }))));
2489
+ }
2490
+ function renameProps(text, props) {
2491
+ const ranges = codeRanges(text);
2492
+ const edits = [];
2493
+ for (const prop of props) {
2494
+ const tag = new RegExp(`<${escapeRegExp(prop.component)}(?![\\w$.])`, "g");
2495
+ for (const match of codeMatches(text, tag, ranges)) {
2496
+ let depth = 0;
2497
+ for (let index = match.index + match[0].length; index < text.length; index += 1) {
2498
+ if (!inCode(ranges, index)) continue;
2499
+ const char = text[index];
2500
+ if (char === "{") depth += 1;
2501
+ else if (char === "}") depth -= 1;
2502
+ else if (char === ">" && depth === 0) break;
2503
+ if (depth === 0 && /\s/.test(text[index - 1] ?? "") && text.startsWith(`${prop.from}=`, index)) edits.push({
2504
+ start: index,
2505
+ end: index + prop.from.length,
2506
+ text: prop.to
2507
+ });
2508
+ }
2509
+ }
2510
+ }
2511
+ return applyEdits(text, edits);
2512
+ }
2513
+ /** The index after the bracket that closes the one at `open`, in code only. */
2514
+ function closing(text, open, ranges) {
2515
+ let depth = 0;
2516
+ for (let index = open; index < text.length; index += 1) {
2517
+ if (!inCode(ranges, index)) continue;
2518
+ const char = text[index];
2519
+ if (OPENING.includes(char)) depth += 1;
2520
+ else if (CLOSING.includes(char)) {
2521
+ depth -= 1;
2522
+ if (depth === 0) return index + 1;
2523
+ }
2524
+ }
2525
+ return text.length;
2526
+ }
2527
+ /**
2528
+ * Calls `visit(index, depth)` for each code character from `open` to its
2529
+ * closing bracket.
2530
+ */
2531
+ function walkBrackets(text, open, ranges, visit) {
2532
+ const end = closing(text, open, ranges);
2533
+ let depth = 0;
2534
+ for (let index = open; index < end; index += 1) {
2535
+ if (!inCode(ranges, index)) continue;
2536
+ const char = text[index];
2537
+ if (OPENING.includes(char)) depth += 1;
2538
+ else if (CLOSING.includes(char)) depth -= 1;
2539
+ visit(index, depth, char);
2540
+ }
2541
+ }
2542
+ /** Where `key` is a top-level key of the object literal at `open`. */
2543
+ function topLevelKeys(text, open, key, ranges) {
2544
+ const keys = [];
2545
+ let previous = "";
2546
+ walkBrackets(text, open, ranges, (index, depth, char) => {
2547
+ if (depth === 1 && (previous === "{" || previous === ",") && text.startsWith(key, index) && !/[\w$]/.test(text[index + key.length] ?? "")) {
2548
+ const after = /^\s*(\S)/.exec(text.slice(index + key.length))?.[1];
2549
+ if (after === ":") keys.push({
2550
+ index,
2551
+ shorthand: false
2552
+ });
2553
+ else if (after === "," || after === "}") keys.push({
2554
+ index,
2555
+ shorthand: true
2556
+ });
2557
+ }
2558
+ if (depth === 1 && !/\s/.test(char)) previous = char;
2559
+ });
2560
+ return keys;
2561
+ }
2562
+ function renameOptions(text, options) {
2563
+ const ranges = codeRanges(text);
2564
+ const edits = [];
2565
+ for (const option of options) {
2566
+ const call = new RegExp(`(?<![\\w$.])${escapeRegExp(option.call)}\\s*(?:<[^>]*>)?\\s*\\(`, "g");
2567
+ for (const match of codeMatches(text, call, ranges)) {
2568
+ const objects = [];
2569
+ walkBrackets(text, match.index + match[0].length - 1, ranges, (index, depth, char) => {
2570
+ if (depth === 2 && char === "{") objects.push(index);
2571
+ });
2572
+ for (const object of objects) for (const { index, shorthand } of topLevelKeys(text, object, option.from, ranges)) edits.push({
2573
+ start: index,
2574
+ end: index + option.from.length,
2575
+ text: shorthand ? `${option.to}: ${option.from}` : option.to
2576
+ });
2577
+ }
2578
+ }
2579
+ return applyEdits(text, edits);
2580
+ }
2581
+ /** The arguments of the call whose `(` is at `open`: start and end of each. */
2582
+ function callArguments(text, open, ranges) {
2583
+ const args = [];
2584
+ let start = open + 1;
2585
+ const end = closing(text, open, ranges) - 1;
2586
+ walkBrackets(text, open, ranges, (index, depth, char) => {
2587
+ if (depth === 1 && char === ",") {
2588
+ args.push({
2589
+ start,
2590
+ end: index
2591
+ });
2592
+ start = index + 1;
2593
+ }
2594
+ });
2595
+ if (text.slice(start, end).trim() !== "") args.push({
2596
+ start,
2597
+ end
2598
+ });
2599
+ return args;
2600
+ }
2601
+ /**
2602
+ * Calls of `pin.call` whose options object lacks `pin.key`, with the insertion
2603
+ * when one is safe.
2604
+ */
2605
+ function pinTargets(text, pin) {
2606
+ const ranges = codeRanges(text);
2607
+ const call = new RegExp(`(?<![\\w$.])${escapeRegExp(pin.call)}\\s*(?:<[^>]*>)?\\s*\\(`, "g");
2608
+ const targets = [];
2609
+ const entry = `${pin.key}: ${pin.value}`;
2610
+ for (const match of codeMatches(text, call, ranges)) {
2611
+ const open = match.index + match[0].length - 1;
2612
+ const args = callArguments(text, open, ranges);
2613
+ const arg = args[pin.argument];
2614
+ if (arg === void 0) {
2615
+ if (args.length !== pin.argument) {
2616
+ targets.push({
2617
+ call: match.index,
2618
+ edit: void 0
2619
+ });
2620
+ continue;
2621
+ }
2622
+ const last = args.at(-1);
2623
+ const at = last === void 0 ? open + 1 : last.end;
2624
+ const trailing = text[at] === ",";
2625
+ targets.push({
2626
+ call: match.index,
2627
+ edit: trailing ? {
2628
+ start: at + 1,
2629
+ end: at + 1,
2630
+ text: ` { ${entry} }`
2631
+ } : {
2632
+ start: at,
2633
+ end: at,
2634
+ text: `, { ${entry} }`
2635
+ }
2636
+ });
2637
+ continue;
2638
+ }
2639
+ const offset = text.slice(arg.start, arg.end).search(/\S/);
2640
+ const object = arg.start + offset;
2641
+ if (text[object] !== "{") {
2642
+ targets.push({
2643
+ call: match.index,
2644
+ edit: void 0
2645
+ });
2646
+ continue;
2647
+ }
2648
+ if ([pin.key, ...pin.unless ?? []].some((key) => topLevelKeys(text, object, key, ranges).length > 0)) continue;
2649
+ const spreads = [];
2650
+ walkBrackets(text, object, ranges, (index, depth) => {
2651
+ if (depth === 1 && text.startsWith("...", index)) spreads.push(index);
2652
+ });
2653
+ if (spreads.length > 0) {
2654
+ targets.push({
2655
+ call: match.index,
2656
+ edit: void 0
2657
+ });
2658
+ continue;
2659
+ }
2660
+ const body = text.slice(object + 1, closing(text, object, ranges) - 1);
2661
+ const first = /^[ \t]*\n([ \t]*)\S/.exec(body);
2662
+ targets.push({
2663
+ call: match.index,
2664
+ edit: body.trim() === "" ? {
2665
+ start: object,
2666
+ end: object + body.length + 2,
2667
+ text: `{ ${entry} }`
2668
+ } : first ? {
2669
+ start: object + 1,
2670
+ end: object + 1,
2671
+ text: `\n${first[1]}${entry},`
2672
+ } : {
2673
+ start: object + 1,
2674
+ end: object + 1,
2675
+ text: ` ${entry},`
2676
+ }
2677
+ });
2678
+ }
2679
+ return targets;
2680
+ }
2681
+ function pinOptions(text, pins) {
2682
+ let out = text;
2683
+ for (const pin of pins) if (pin.when.test(out)) out = applyEdits(out, pinTargets(out, pin).flatMap((target) => target.edit === void 0 ? [] : [target.edit]));
2684
+ const review = pins.flatMap((pin) => pinTargets(out, pin).map((target) => ({
2685
+ line: out.slice(0, target.call).split("\n").length,
2686
+ message: pin.message
2687
+ })));
2688
+ return {
2689
+ text: out,
2690
+ review
2691
+ };
2692
+ }
2693
+ /** Applies one codemod to a source file. */
2694
+ function applyCodemod(codemod, source, file) {
2695
+ if (file !== void 0 && (CLI_CALL_FILE.test(file) || SHELL_FILE.test(file))) {
2696
+ const hints = linesMatching(source, codemod.cliReview ?? []);
2697
+ if (!codemod.cliCalls) return {
2698
+ text: source,
2699
+ review: hints
2700
+ };
2701
+ return CLI_CALL_FILE.test(file) ? {
2702
+ text: rewriteCliCalls(source, codemod.cliCalls),
2703
+ review: hints
2704
+ } : {
2705
+ text: source,
2706
+ review: [...cliCallHints(source, codemod.cliCalls), ...hints]
2707
+ };
2708
+ }
2709
+ if (file?.endsWith(".sql") === true) return codemod.sqlFile?.(source) ?? {
2710
+ text: source,
2711
+ review: []
2712
+ };
2713
+ if (file !== void 0 && DESIGN_FILE_NAME.test(file)) return designFileResult(source, codemod.designFile);
2714
+ let text = source;
2715
+ const refused = [];
2716
+ if (codemod.configFile && file !== void 0 && CONFIG_FILE.test(file)) {
2717
+ const json = file.endsWith(".json");
2718
+ const edit = codemod.configFile(source, json);
2719
+ if (edit.ok) {
2720
+ text = edit.text;
2721
+ refused.push(..."review" in edit ? edit.review : []);
2722
+ } else refused.push({
2723
+ line: 1,
2724
+ message: `The config wasn't rewritten: ${edit.reason}`
2725
+ });
2726
+ if (json) return {
2727
+ text,
2728
+ review: refused
2729
+ };
2730
+ }
2731
+ for (const [subpath, renames] of Object.entries(codemod.subpathImports ?? {})) {
2732
+ const imported = renameImports(text, renames, subpath);
2733
+ text = renameIdentifiers(imported.text, new Map([...imported.locals].map((name) => [name, renames[name]])));
2734
+ }
2735
+ if (codemod.subpaths) text = renameSubpaths(text, codemod.subpaths);
2736
+ if (codemod.imports) {
2737
+ const imported = renameImports(text, codemod.imports);
2738
+ text = renameIdentifiers(imported.text, new Map([...imported.locals].map((name) => [name, codemod.imports[name]])));
2739
+ }
2740
+ if (codemod.bindings) text = renameBindings(text, codemod.bindings);
2741
+ if (codemod.members) text = renameMembers(text, codemod.members);
2742
+ if (codemod.props) text = renameProps(text, codemod.props);
2743
+ if (codemod.options) text = renameOptions(text, codemod.options);
2744
+ if (codemod.strings) text = renameStrings(text, codemod.strings);
2745
+ if (codemod.source) {
2746
+ const rewritten = codemod.source(text);
2747
+ text = rewritten.text;
2748
+ refused.push(...rewritten.review);
2749
+ }
2750
+ if (codemod.pins) {
2751
+ const pinned = pinOptions(text, codemod.pins);
2752
+ text = pinned.text;
2753
+ refused.push(...pinned.review);
2754
+ }
2755
+ return {
2756
+ text,
2757
+ review: [...refused, ...linesMatching(text, codemod.review ?? [])]
2758
+ };
2759
+ }
2760
+ /** One review line per line of `text` that a hint's pattern matches. */
2761
+ function linesMatching(text, hints) {
2762
+ return hints.flatMap((hint) => text.split("\n").flatMap((line, index) => hint.pattern.test(line) ? [{
2763
+ line: index + 1,
2764
+ message: hint.message
2765
+ }] : []));
2766
+ }
2767
+ // src/cli/commands/codemod.ts
2768
+ const CODEMOD_ARGS = {
2769
+ path: {
2770
+ type: "positional",
2771
+ required: false,
2772
+ variadic: true,
2773
+ description: "Files or directories to rewrite (default: the project)"
2774
+ },
2775
+ "dry-run": {
2776
+ type: "boolean",
2777
+ description: "Show the changes without writing them"
2778
+ },
2779
+ check: {
2780
+ type: "boolean",
2781
+ description: "Write nothing; exit 1 with a diff when a file would change"
2782
+ }
2783
+ };
2784
+ const SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([
2785
+ ".ts",
2786
+ ".tsx",
2787
+ ".mts",
2788
+ ".cts",
2789
+ ".js",
2790
+ ".jsx",
2791
+ ".mjs",
2792
+ ".cjs"
2793
+ ]);
2794
+ const SKIPPED_DIRS = /* @__PURE__ */ new Set([
2795
+ "node_modules",
2796
+ ".git",
2797
+ ".next",
2798
+ ".turbo",
2799
+ ".vercel",
2800
+ "dist",
2801
+ "build",
2802
+ "coverage"
2803
+ ]);
2804
+ const SCHEMA_SQL = /(?:^|[\\/])supabase[\\/]schemas[\\/].*\.sql$/;
2805
+ /**
2806
+ * Source, config and script files under `path`, skipping dependencies, build
2807
+ * output and `.d.ts` files. With `sql`, the `.sql` files under
2808
+ * `supabase/schemas` too; migrations stay as they are.
2809
+ */
2810
+ async function sourceFiles(path, sql) {
2811
+ const info = await stat(path).catch(() => void 0);
2812
+ if (!info) return [];
2813
+ if (info.isFile()) return path.endsWith(".sql") && !sql ? [] : [path];
2814
+ const files = [];
2815
+ for (const entry of await readdir(path, { withFileTypes: true })) {
2816
+ const full = join(path, entry.name);
2817
+ if (entry.isDirectory()) {
2818
+ if (!SKIPPED_DIRS.has(entry.name)) files.push(...await sourceFiles(full, sql));
2819
+ } else if (SOURCE_EXTENSIONS.has(extname(entry.name)) && !entry.name.endsWith(".d.ts") || CONFIG_FILE.test(entry.name) || DESIGN_FILE_NAME.test(entry.name) || CLI_CALL_FILE.test(full) || SHELL_FILE.test(entry.name) || sql && SCHEMA_SQL.test(full)) files.push(full);
2820
+ }
2821
+ return files.toSorted();
2822
+ }
2823
+ async function runCodemod(config, args, paint = plain) {
2824
+ const [name, ...paths] = args._ ?? [];
2825
+ const names = Object.entries(CODEMODS).map(([key, codemod]) => ` ${key.padEnd(5)} ${codemod.description}`).join("\n");
2826
+ if (name === void 0) throw new CliError("usage", `Name a codemod:\n${names}`);
2827
+ const codemod = CODEMODS[name];
2828
+ if (!codemod) throw new CliError("usage", `Unknown codemod "${name}". Codemods:\n${names}`);
2829
+ const roots = (paths.length > 0 ? paths : ["."]).map((path) => resolve(config.root, path));
2830
+ const files = [...new Set((await Promise.all(roots.map((root) => sourceFiles(root, codemod.sqlFile !== void 0)))).flat())];
2831
+ const dryRun = args["dry-run"] === true;
2832
+ const edits = [];
2833
+ const review = [];
2834
+ for (const file of files) {
2835
+ const source = await readFile(file, "utf-8");
2836
+ const result = applyCodemod(codemod, source, file);
2837
+ const path = relative(config.root, file);
2838
+ review.push(...result.review.map((hint) => ({
2839
+ file: path,
2840
+ ...hint
2841
+ })));
2842
+ if (result.text !== source) edits.push({
2843
+ path: file,
2844
+ contents: result.text,
2845
+ policy: "edit"
2846
+ });
2847
+ }
2848
+ if (codemod.sqlNames === true) review.push(...await legacySqlNameHints(config));
2849
+ const plan = {
2850
+ root: config.root,
2851
+ regenerate: `better-supabase codemod ${codemod.name}`,
2852
+ files: edits
2853
+ };
2854
+ const applied = await applyPlan(plan, args, paint);
2855
+ const changed = changedFiles(applied);
2856
+ if (applied.mode === "check" && applied.drift) return planResult(plan, applied, { data: { codemod: codemod.name } });
2857
+ const lines = [...applied.mode === "write" ? [] : applied.diffs, changed.length === 0 ? `Nothing to change in ${String(files.length)} files.` : [...changeLines(applied), `${applied.mode === "write" ? "Updated" : "Would update"} ${String(changed.length)} of ${String(files.length)} files.`].join("\n")];
2858
+ if (review.length > 0) lines.push("", "Check these by hand:", ...review.map((hint) => ` ${hint.file}:${String(hint.line)}: ${hint.message}`));
2859
+ return {
2860
+ code: 0,
2861
+ output: lines.join("\n"),
2862
+ data: {
2863
+ codemod: codemod.name,
2864
+ dryRun,
2865
+ changed,
2866
+ files: applied.changes,
2867
+ review
2868
+ }
2869
+ };
2870
+ }
2871
+ /** The `codemod <name>` subcommand for one codemod in `CODEMODS`. */
2872
+ function codemodCommand(name) {
2873
+ return defineCliCommand({
2874
+ meta: commandMeta(`codemod ${name}`),
2875
+ args: CODEMOD_ARGS,
2876
+ runsWithInvalidConfig: true,
2877
+ run: (args, { config, paint }) => runCodemod(config, {
2878
+ ...args,
2879
+ _: [name, ...args._]
2880
+ }, paint)
2881
+ });
2882
+ }
2883
+ export { codemodCommand };