better-supabase 0.25.0 → 0.29.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 (417) hide show
  1. package/dist/{access-sql-bjWFUWlk.js → access-sql-CTDNuxRv.js} +177 -12
  2. package/dist/{agents-CMIB3802.d.ts → agents-CM_cCtcr.d.ts} +4 -4
  3. package/dist/{ai-cache-2LGgaT7F.d.ts → ai-cache-BTGqckta.d.ts} +4 -4
  4. package/dist/{ai-chat-BCaKsvLW.d.ts → ai-chat-B7_vQvxU.d.ts} +4 -4
  5. package/dist/{ai-schedules-yGZH-vQb.d.ts → ai-schedules-CZEfo-_M.d.ts} +5 -5
  6. package/dist/ai-sdk/agents/index.d.ts +6 -6
  7. package/dist/ai-sdk/batches/index.d.ts +3 -3
  8. package/dist/ai-sdk/cache/index.d.ts +1 -1
  9. package/dist/ai-sdk/chat/index.d.ts +1 -1
  10. package/dist/ai-sdk/embeddings/index.d.ts +2 -2
  11. package/dist/ai-sdk/files/index.d.ts +1 -1
  12. package/dist/ai-sdk/index.d.ts +5 -5
  13. package/dist/ai-sdk/mcp/index.d.ts +3 -3
  14. package/dist/ai-sdk/memory/index.d.ts +3 -3
  15. package/dist/ai-sdk/workflow/index.d.ts +3 -3
  16. package/dist/{api-B1OkIWdx.d.ts → api-59rv5hL6.d.ts} +5 -5
  17. package/dist/{api-keys-ClhKBDcc.d.ts → api-keys-JE-aykZE.d.ts} +4 -4
  18. package/dist/{app-tables-xij_MI5H.d.ts → app-tables-DekyKNQ8.d.ts} +1 -1
  19. package/dist/{approvals-C5fmPLsH.d.ts → approvals-BfEafAzt.d.ts} +5 -5
  20. package/dist/{assistant-ndGdOBax.d.ts → assistant-B49qATbj.d.ts} +2 -2
  21. package/dist/astro/index.d.ts +7 -7
  22. package/dist/{authorization-BJV2i8xB.d.ts → authorization-C7nuWMuB.d.ts} +27 -6
  23. package/dist/{authorization-hooks-DtzreCAq.d.ts → authorization-hooks-BWhkMZfH.d.ts} +2 -2
  24. package/dist/better-result/index.d.ts +3 -3
  25. package/dist/{bind-vKDmdu_4.d.ts → bind-DmUGUsBd.d.ts} +7 -7
  26. package/dist/{block-env-wVLz0KMV.d.ts → block-env-DWtZsqhH.d.ts} +4 -4
  27. package/dist/{block-helpers-CRpAHrp_.d.ts → block-helpers-D5emQ2O6.d.ts} +1 -1
  28. package/dist/{block-hooks-DZN2w69m.d.ts → block-hooks-B8itxzEE.d.ts} +2 -2
  29. package/dist/{block-subjects-CphkQPxp.d.ts → block-subjects-C1_9DkSA.d.ts} +1 -1
  30. package/dist/{block-transport-DWZSJrwN.d.ts → block-transport-9EUA3q_I.d.ts} +2 -2
  31. package/dist/blocks/access-requests/index.d.ts +5 -5
  32. package/dist/blocks/activities/index.d.ts +10 -10
  33. package/dist/blocks/activities/index.js +1 -1
  34. package/dist/blocks/agents/index.d.ts +4 -4
  35. package/dist/blocks/ai-cache/index.d.ts +3 -3
  36. package/dist/blocks/ai-chat/index.d.ts +7 -7
  37. package/dist/blocks/ai-files/index.d.ts +3 -3
  38. package/dist/blocks/ai-keys/index.d.ts +4 -4
  39. package/dist/blocks/ai-schedules/index.d.ts +3 -3
  40. package/dist/blocks/announcements/index.d.ts +8 -8
  41. package/dist/blocks/api-keys/index.d.ts +6 -6
  42. package/dist/blocks/approvals/index.d.ts +4 -4
  43. package/dist/blocks/assets/index.d.ts +6 -6
  44. package/dist/blocks/assignment/index.d.ts +7 -7
  45. package/dist/blocks/attachments/index.d.ts +4 -4
  46. package/dist/blocks/audit/index.d.ts +13 -13
  47. package/dist/blocks/automations/index.d.ts +12 -12
  48. package/dist/blocks/billable-time/index.d.ts +6 -6
  49. package/dist/blocks/billing/index.d.ts +9 -9
  50. package/dist/blocks/bookings/index.d.ts +4 -4
  51. package/dist/blocks/bulk/index.d.ts +4 -4
  52. package/dist/blocks/calendar/index.d.ts +5 -5
  53. package/dist/blocks/catalog/index.d.ts +6 -6
  54. package/dist/blocks/channels/index.d.ts +7 -7
  55. package/dist/blocks/collections/index.d.ts +12 -12
  56. package/dist/blocks/collections/index.js +1 -1
  57. package/dist/blocks/comments/index.d.ts +10 -10
  58. package/dist/blocks/compliance/index.d.ts +5 -5
  59. package/dist/blocks/connectors/index.d.ts +4 -4
  60. package/dist/blocks/contacts/index.d.ts +7 -7
  61. package/dist/blocks/contacts/index.js +1 -1
  62. package/dist/blocks/content/index.d.ts +5 -5
  63. package/dist/blocks/contracts/index.d.ts +6 -6
  64. package/dist/blocks/courses/index.d.ts +5 -5
  65. package/dist/blocks/created-by/index.d.ts +2 -2
  66. package/dist/blocks/custom-fields/index.d.ts +6 -6
  67. package/dist/blocks/custom-fields/index.js +1 -1
  68. package/dist/blocks/data-lifecycle/index.d.ts +8 -8
  69. package/dist/blocks/deals/index.d.ts +6 -6
  70. package/dist/blocks/dispatch/index.d.ts +7 -7
  71. package/dist/blocks/documents/index.d.ts +4 -4
  72. package/dist/blocks/domains/index.d.ts +6 -6
  73. package/dist/blocks/donations/index.d.ts +6 -6
  74. package/dist/blocks/drive/index.d.ts +7 -7
  75. package/dist/blocks/employees/index.d.ts +8 -8
  76. package/dist/blocks/employees/index.js +1 -1
  77. package/dist/blocks/enrichment/index.d.ts +6 -6
  78. package/dist/blocks/enrollments/index.d.ts +6 -6
  79. package/dist/blocks/entitlements/index.d.ts +6 -6
  80. package/dist/blocks/expenses/index.d.ts +5 -5
  81. package/dist/blocks/field-history/index.d.ts +4 -4
  82. package/dist/blocks/flags/index.d.ts +5 -5
  83. package/dist/blocks/forecasts/index.d.ts +6 -6
  84. package/dist/blocks/forms/index.d.ts +6 -6
  85. package/dist/blocks/goals/index.d.ts +4 -4
  86. package/dist/blocks/guests/index.d.ts +6 -6
  87. package/dist/blocks/hiring/index.d.ts +7 -7
  88. package/dist/blocks/identities/index.d.ts +5 -5
  89. package/dist/blocks/imports/index.d.ts +5 -5
  90. package/dist/blocks/inbox/index.d.ts +10 -10
  91. package/dist/blocks/incidents/index.d.ts +5 -5
  92. package/dist/blocks/index.d.ts +9 -9
  93. package/dist/blocks/inventory/index.d.ts +7 -7
  94. package/dist/blocks/invoices/index.d.ts +8 -8
  95. package/dist/blocks/knowledge/index.d.ts +3 -3
  96. package/dist/blocks/lead-scoring/index.d.ts +7 -7
  97. package/dist/blocks/leases/index.d.ts +6 -6
  98. package/dist/blocks/leave/index.d.ts +5 -5
  99. package/dist/blocks/ledger/index.d.ts +6 -6
  100. package/dist/blocks/mail-sync/index.d.ts +5 -5
  101. package/dist/blocks/memberships/index.d.ts +2 -2
  102. package/dist/blocks/memory/index.d.ts +4 -4
  103. package/dist/blocks/messaging/index.d.ts +11 -11
  104. package/dist/blocks/metrics/index.d.ts +6 -6
  105. package/dist/blocks/mfa/index.d.ts +2 -2
  106. package/dist/blocks/moderation/index.d.ts +6 -6
  107. package/dist/blocks/notifications/index.d.ts +12 -12
  108. package/dist/blocks/notifications/index.js +1 -1
  109. package/dist/blocks/numbering/index.d.ts +4 -4
  110. package/dist/blocks/oauth-server/index.d.ts +5 -5
  111. package/dist/blocks/onboarding/index.d.ts +5 -5
  112. package/dist/blocks/orders/index.d.ts +7 -7
  113. package/dist/blocks/organizations/index.d.ts +8 -8
  114. package/dist/blocks/outbox/index.d.ts +4 -4
  115. package/dist/blocks/passes/index.d.ts +8 -8
  116. package/dist/blocks/permissions/index.d.ts +6 -6
  117. package/dist/blocks/pipelines/index.d.ts +6 -6
  118. package/dist/blocks/posts/index.d.ts +5 -5
  119. package/dist/blocks/profiles/index.d.ts +4 -4
  120. package/dist/blocks/promotions/index.d.ts +5 -5
  121. package/dist/blocks/push/index.d.ts +6 -6
  122. package/dist/blocks/queue/index.d.ts +6 -6
  123. package/dist/blocks/quotes/index.d.ts +8 -8
  124. package/dist/blocks/rank/index.d.ts +5 -5
  125. package/dist/blocks/reactions/index.d.ts +9 -9
  126. package/dist/blocks/relations/index.d.ts +7 -7
  127. package/dist/blocks/reminders/index.d.ts +9 -9
  128. package/dist/blocks/reminders/index.js +1 -1
  129. package/dist/blocks/reviews/index.d.ts +5 -5
  130. package/dist/blocks/saved-views/index.d.ts +6 -6
  131. package/dist/blocks/scores/index.d.ts +5 -5
  132. package/dist/blocks/search/index.d.ts +8 -8
  133. package/dist/blocks/security-events/index.d.ts +7 -7
  134. package/dist/blocks/segments/index.d.ts +8 -8
  135. package/dist/blocks/sequences/index.d.ts +6 -6
  136. package/dist/blocks/service-accounts/index.d.ts +5 -5
  137. package/dist/blocks/sessions/index.d.ts +2 -2
  138. package/dist/blocks/settings/index.d.ts +6 -6
  139. package/dist/blocks/share-links/index.d.ts +5 -5
  140. package/dist/blocks/shipments/index.d.ts +6 -6
  141. package/dist/blocks/signatures/index.d.ts +5 -5
  142. package/dist/blocks/signing-keys/index.d.ts +4 -4
  143. package/dist/blocks/sla/index.d.ts +7 -7
  144. package/dist/blocks/sso/index.d.ts +6 -6
  145. package/dist/blocks/state-machine/index.d.ts +5 -5
  146. package/dist/blocks/subjects/index.d.ts +6 -6
  147. package/dist/blocks/tags/index.d.ts +6 -6
  148. package/dist/blocks/tasks/index.d.ts +10 -10
  149. package/dist/blocks/tasks/index.js +1 -1
  150. package/dist/blocks/teams/index.d.ts +4 -4
  151. package/dist/blocks/templates/index.d.ts +7 -7
  152. package/dist/blocks/time-tracking/index.d.ts +7 -7
  153. package/dist/blocks/timeline/index.d.ts +8 -8
  154. package/dist/blocks/trash/index.d.ts +6 -6
  155. package/dist/blocks/undo/index.d.ts +4 -4
  156. package/dist/blocks/updated-at/index.d.ts +2 -2
  157. package/dist/blocks/usage/index.d.ts +4 -4
  158. package/dist/blocks/vercel-marketplace/index.d.ts +5 -5
  159. package/dist/blocks/versions/index.d.ts +6 -6
  160. package/dist/blocks/waitlist/index.d.ts +5 -5
  161. package/dist/blocks/webhooks/index.d.ts +14 -14
  162. package/dist/blocks/webhooks/index.js +1 -1
  163. package/dist/blocks/workflow-editor/index.d.ts +9 -9
  164. package/dist/blocks/workflows/index.d.ts +7 -7
  165. package/dist/{bookings-CVw5-Q0Z.d.ts → bookings-xsmM2TA_.d.ts} +3 -3
  166. package/dist/{bucket-vc-QRrva.d.ts → bucket-SvRQwYS4.d.ts} +1 -1
  167. package/dist/chat-sdk/index.d.ts +6 -6
  168. package/dist/cli/{add-C2pNvVpu.js → add-BKkV99g9.js} +2 -2
  169. package/dist/cli/{add-BTVrOGJF.js → add-CrQ3jS7t.js} +55 -88
  170. package/dist/cli/add-CwhrRJz5.js +1 -0
  171. package/dist/cli/app-table-files-PnPOpuB4.js +346 -0
  172. package/dist/cli/{backfill-BicVPugb.js → backfill-DDDLhinm.js} +4 -4
  173. package/dist/cli/bin.js +1 -1
  174. package/dist/cli/{blocks-sScN-ik-.js → blocks-BCVcjvbm.js} +1 -1
  175. package/dist/cli/{blocks-BmYOH4T-.js → blocks-tRfYx_mh.js} +2 -2
  176. package/dist/cli/{cache-1TfBy2K4.js → cache-DQZ09YOg.js} +1 -1
  177. package/dist/cli/{codemod-ylE6wGLo.js → codemod-HKuwQmi_.js} +5 -5
  178. package/dist/cli/{command-BWEEXmtz.js → command-DIPmo0wh.js} +37 -1
  179. package/dist/cli/{completion-Bt7LMypX.js → completion-DxPxMtyP.js} +2 -2
  180. package/dist/cli/{completion-8EDK21xj.js → completion-DyLMSjOD.js} +1 -1
  181. package/dist/cli/{completion-BfnKI4QZ.js → completion-FUgqm2-N.js} +2 -2
  182. package/dist/cli/{config-WKDixoGK.js → config-BfapErxs.js} +1 -1
  183. package/dist/cli/{config-BVfeG3A5.js → config-Cskysxp-.js} +327 -16
  184. package/dist/cli/{config-CeaQMrvS.js → config-Df5cXWNN.js} +1 -1
  185. package/dist/cli/{config-group-C8tjut39.js → config-group-CP-B9uRt.js} +2 -3
  186. package/dist/cli/{content-mapper-hUW2nb92.js → content-mapper-B0ehR7K-.js} +2 -2
  187. package/dist/cli/{db-DwjyUbAh.js → db-CWvH1_46.js} +38 -14
  188. package/dist/cli/{doctor-D3WKFBSv.js → doctor-CXJOhwLB.js} +36 -33
  189. package/dist/cli/{env-DMgjB_4y.js → env-BK0xKMeU.js} +1 -2
  190. package/dist/cli/{env-BCgVZkcb.js → env-BM242BCV.js} +2 -2
  191. package/dist/cli/{env-C-Bl6Awn.js → env-Bat6ogep.js} +1 -1
  192. package/dist/cli/env-uqfUbUzk.js +1 -0
  193. package/dist/cli/{exec--Q1ZEWUW.js → exec-Ca5s-ygi.js} +1 -1
  194. package/dist/cli/{gen-CqsUdsB2.js → gen-B7rw4j19.js} +16 -16
  195. package/dist/cli/in-stack-diff-Cp-tVPj2.js +186 -0
  196. package/dist/cli/index.d.ts +9 -3
  197. package/dist/cli/index.js +8 -8
  198. package/dist/cli/{init-DryZ5Mp1.js → init-C1bXXB_P.js} +131 -12
  199. package/dist/cli/{keys-CbaL0lnw.js → keys-V-HcO-21.js} +1 -1
  200. package/dist/cli/{live-Di45imoV.js → live-PpAh9pAc.js} +2 -2
  201. package/dist/cli/{mcp-BklC-3eK.js → mcp-BRNAchdH.js} +6 -14
  202. package/dist/cli/{metadata-7PsBF5Xw.js → metadata-dAAKb_kR.js} +3 -3
  203. package/dist/cli/migrate-BWYXFnaW.js +46 -0
  204. package/dist/cli/{migration-safety-Doy9qYO8.js → migration-safety-DGQswWZy.js} +2 -2
  205. package/dist/cli/migrations-Cqk-lJwu.js +117 -0
  206. package/dist/cli/{module-migration-ZIn1NCMi.js → module-migration-8-hMiZtW.js} +2 -2
  207. package/dist/cli/{moved-DVwgE8lV.js → moved-DNOtp9LA.js} +1 -1
  208. package/dist/cli/{parse-B079x40m.js → parse-BPf3kGnc.js} +1 -1
  209. package/dist/cli/{powersync-BRGXOCJ0.js → powersync-BWQ-8T3G.js} +4 -3
  210. package/dist/cli/powersync-CbYxLsjv.js +1 -0
  211. package/dist/cli/{print-Dfqd4DB-.js → print-DSTnq5xz.js} +2 -2
  212. package/dist/cli/{migrations-JtsPYv8g.js → providers-Cjf5iOp5.js} +4 -116
  213. package/dist/cli/{remove-CQzSCYTu.js → remove-CwG8cPv1.js} +7 -7
  214. package/dist/cli/{render-DWRz-uPQ.js → render-B18iAdsT.js} +9 -6
  215. package/dist/cli/{run-DPLedqTF.js → run-C2Yg5MWt.js} +42 -40
  216. package/dist/cli/{run-DmOTMa44.js → run-CvPl8iQd.js} +4 -4
  217. package/dist/cli/{run-j54rk2w-.js → run-Wx_2Acgv.js} +11 -11
  218. package/dist/cli/seed-BOun22-k.js +1 -0
  219. package/dist/cli/{seed-BMynpMPy.js → seed-CDnL4Tnc.js} +3 -3
  220. package/dist/cli/{shared-CslNcs-R.js → shared-BHbtUOvh.js} +1 -1
  221. package/dist/cli/{skills-FXAVPLzp.js → skills-DM3oeIxY.js} +1 -1
  222. package/dist/cli/{snapshot-DdN5GlhH.js → snapshot-CXgsUPGj.js} +3 -3
  223. package/dist/cli/{source-COARbqch.js → source-B6aMAoEK.js} +1 -1
  224. package/dist/cli/{source-args-CDmmFmFG.js → source-args-v8ljFDfc.js} +1 -1
  225. package/dist/cli/{spec-CgLNZc_C.js → spec-BcYic005.js} +3 -3
  226. package/dist/cli/{spec-DIhBQlBF.js → spec-EO0TP84d.js} +1 -1
  227. package/dist/cli/{sql-layout-8jrP5gIa.js → sql-layout-CkxDNVEH.js} +21 -7
  228. package/dist/cli/{stack-DgASZP0K.js → stack-ClESAZYf.js} +3 -3
  229. package/dist/cli/{stack-status-B_Ipd_-z.js → stack-status-BkkYRlXG.js} +1 -1
  230. package/dist/cli/{stacks-BYlQ96WS.js → stacks-CiDBH1dB.js} +1 -1
  231. package/dist/cli/{sync-SqyVHRSJ.js → sync-pq6gmlhG.js} +4 -3
  232. package/dist/cli/table-dyKddjwo.js +89 -0
  233. package/dist/cli/{upgrade-D0aLhluU.js → upgrade-BoHb4h9P.js} +3 -3
  234. package/dist/cli/{upgrade-CY-vj_qh.js → upgrade-Dp9p7A69.js} +5 -4
  235. package/dist/cli/{version-Bhca9D6q.js → version-CQHFm-ak.js} +1 -1
  236. package/dist/client/index.d.ts +6 -6
  237. package/dist/client/native/index.d.ts +5 -5
  238. package/dist/{cloud-event-DcJwder2.d.ts → cloud-event-0pQ9vFNS.d.ts} +1 -1
  239. package/dist/{compiler-D3UmE7ao.d.ts → compiler-BEeVWXPS.d.ts} +2 -2
  240. package/dist/{composite-CWJvZgni.d.ts → composite-BJ9s-IJJ.d.ts} +7 -7
  241. package/dist/config/index.d.ts +5 -5
  242. package/dist/config/index.js +5 -5
  243. package/dist/{config-C19McoGo.js → config-bqKaPjst.js} +7 -28
  244. package/dist/{config-CP-WaboC.js → config-r7njjNgh.js} +3 -3
  245. package/dist/{connectors-CHGiffYH.d.ts → connectors-uC5baoFV.d.ts} +4 -4
  246. package/dist/{context-BJoHD20l.d.ts → context-B4TsE2gY.d.ts} +138 -52
  247. package/dist/{controller-CwGXms17.d.ts → controller-CtwAsnVV.d.ts} +1 -1
  248. package/dist/{conversion-DlfStnln.d.ts → conversion-g8HzH9My.d.ts} +1 -1
  249. package/dist/create/index.d.ts +62 -3
  250. package/dist/create/index.js +67 -4
  251. package/dist/create/lite/index.d.ts +141 -4
  252. package/dist/create/lite/index.js +399 -47
  253. package/dist/credentials/index.d.ts +4 -4
  254. package/dist/{data-engine-BWoz9lED.d.ts → data-engine-rvbR2C4F.d.ts} +1 -1
  255. package/dist/{define-BLP6XtoL.d.ts → define-D8_9X5fZ.d.ts} +5 -5
  256. package/dist/{define-block-DibVN37N.d.ts → define-block-DWVZSZv1.d.ts} +12 -12
  257. package/dist/{documents-Cup1rpjF.d.ts → documents-BbwYyynk.d.ts} +3 -3
  258. package/dist/edge/index.d.ts +9 -9
  259. package/dist/elysia/index.d.ts +1 -1
  260. package/dist/{embeddings-D_RsS6ow.d.ts → embeddings-I3s5sTDt.d.ts} +1 -1
  261. package/dist/{ended-B8RyuUXF.d.ts → ended-EZzN9QTM.d.ts} +2 -2
  262. package/dist/{entitlements-CsZcfllV.d.ts → entitlements-Bw3eYGKJ.d.ts} +2 -2
  263. package/dist/eve/index.d.ts +5 -5
  264. package/dist/{eve-B7jxYPCw.d.ts → eve-BfhVFV33.d.ts} +2 -2
  265. package/dist/events/index.d.ts +3 -3
  266. package/dist/{events-Cc9DDQWH.d.ts → events-B2qbZps6.d.ts} +1 -1
  267. package/dist/{executor-DNPm13a9.d.ts → executor-BfirBzOr.d.ts} +4 -4
  268. package/dist/{executor-C-Ox9eKq.d.ts → executor-BlS0kCrN.d.ts} +1 -1
  269. package/dist/{executor-hGjrop3A.d.ts → executor-DXQIx4sW.d.ts} +1 -1
  270. package/dist/expo/index.d.ts +4 -4
  271. package/dist/{field-errors-6BVg31Yp.d.ts → field-errors-DkzFduux.d.ts} +10 -10
  272. package/dist/{fields-C3q2ypnO.d.ts → fields-snbaZ14h.d.ts} +1 -1
  273. package/dist/{filter-evaluate-CPxeae5X.d.ts → filter-evaluate-BRpNiNPG.d.ts} +1 -1
  274. package/dist/{filter-query-BXLs72G9.d.ts → filter-query-DBt7OKuH.d.ts} +1 -1
  275. package/dist/{flags-C01PLMJ-.d.ts → flags-DDKTThrO.d.ts} +2 -2
  276. package/dist/flags-sdk/index.d.ts +1 -1
  277. package/dist/{framework-GlxXiotm.d.ts → framework-DVYTtQXA.d.ts} +7 -7
  278. package/dist/{gateway-DzI687yd.d.ts → gateway-Ve7cByEr.d.ts} +3 -3
  279. package/dist/h3/index.d.ts +1 -1
  280. package/dist/h3/v1/index.d.ts +1 -1
  281. package/dist/hono/index.d.ts +9 -9
  282. package/dist/{inbox-NDKwSk_H.d.ts → inbox-c8B86Trp.d.ts} +5 -5
  283. package/dist/{index-C_qlBJ3k.d.ts → index-B4wttiLh.d.ts} +4 -4
  284. package/dist/{index-BfYDY6eh.d.ts → index-BM6NmKSc.d.ts} +5 -5
  285. package/dist/{index-CbUCGMqj.d.ts → index-BNgpz_BV.d.ts} +5 -5
  286. package/dist/{index-C0QuN9_P.d.ts → index-BxckmAFc.d.ts} +106 -121
  287. package/dist/{index-Cagz4Z2k.d.ts → index-CB66nl14.d.ts} +4 -3
  288. package/dist/{index-DOHx3JuB.d.ts → index-CBQT_nXf.d.ts} +5 -5
  289. package/dist/{index-D01wHGSN.d.ts → index-Cw5gGSP8.d.ts} +14 -14
  290. package/dist/{index-CQhPHHDF.d.ts → index-Cxsnd-OL.d.ts} +1 -1
  291. package/dist/{index-D1ckLbUM.d.ts → index-pZn6S_iq.d.ts} +1 -1
  292. package/dist/index.d.ts +6 -6
  293. package/dist/{instances-qz2MCMyK.js → instances-C7qUTjhJ.js} +1 -1
  294. package/dist/{kit-Dxx3MT8m.d.ts → kit-B8yWCRN7.d.ts} +3 -3
  295. package/dist/{knowledge-F1IhRI4Q.d.ts → knowledge-CsLPACGJ.d.ts} +5 -5
  296. package/dist/lint/index.d.ts +1 -1
  297. package/dist/list/index.d.ts +3 -3
  298. package/dist/{list-query-XHoYDlRN.d.ts → list-query-BcU8NnNL.d.ts} +3 -3
  299. package/dist/mapper/bin.js +7 -7
  300. package/dist/mcp/index.d.ts +6 -6
  301. package/dist/mcp/sdk/index.d.ts +6 -6
  302. package/dist/{messaging-C_Pr9tGx.d.ts → messaging-DQP09JsY.d.ts} +4 -4
  303. package/dist/nestjs/index.d.ts +2 -2
  304. package/dist/next/client/index.d.ts +1 -1
  305. package/dist/next/index.d.ts +22 -22
  306. package/dist/node/index.d.ts +2 -2
  307. package/dist/{operations-CPhOcuzl.d.ts → operations-CqmQrTKw.d.ts} +1 -1
  308. package/dist/{options-BOGo1qCA.js → options-B5E2MGIz.js} +3 -1
  309. package/dist/{options-D2s7fT1s.js → options-COo7_3MX.js} +2 -1
  310. package/dist/{options-D32-YxnO.js → options-DhoLMknl.js} +3 -1
  311. package/dist/orpc/index.d.ts +8 -8
  312. package/dist/otel/index.d.ts +2 -2
  313. package/dist/otel/index.js +4 -4
  314. package/dist/{outbox-DxZgoKwp.d.ts → outbox-BZ712Z3X.d.ts} +4 -4
  315. package/dist/{pool-wjbAMqc1.d.ts → pool-DDR1ndk7.d.ts} +3 -3
  316. package/dist/{ports-Bw7uxPd_.d.ts → ports-6LBgr1Aa.d.ts} +1 -1
  317. package/dist/postgres/index.d.ts +4 -4
  318. package/dist/{postgrest-z-T0l23T.d.ts → postgrest-AJc8hnJU.d.ts} +1 -1
  319. package/dist/powersync/index.d.ts +6 -6
  320. package/dist/preset/index.d.ts +3 -3
  321. package/dist/preset/index.js +3 -3
  322. package/dist/{preset-BbSWLoXM.js → preset-DCdEnJj9.js} +9 -14
  323. package/dist/{project-TN03XDsA.js → project-C4NA_van.js} +5 -5
  324. package/dist/{provider-ClrIplXa.d.ts → provider-CWjzAIX9.d.ts} +1 -1
  325. package/dist/{push-token-vykw2JXT.d.ts → push-token-BXsrJ7W9.d.ts} +1 -1
  326. package/dist/query/index.d.ts +1 -1
  327. package/dist/react/index.d.ts +8 -8
  328. package/dist/react/native/index.d.ts +1 -1
  329. package/dist/react/server.d.ts +8 -8
  330. package/dist/react/session.d.ts +2 -2
  331. package/dist/react-router/index.d.ts +6 -6
  332. package/dist/realtime/index.d.ts +6 -6
  333. package/dist/realtime/index.js +2 -2
  334. package/dist/{record-form-D2-F4IwS.d.ts → record-form-CubgBrtI.d.ts} +1 -1
  335. package/dist/{recordings-BBSJt_YV.d.ts → recordings-DeZYx-Kv.d.ts} +1 -1
  336. package/dist/records/index.d.ts +9 -9
  337. package/dist/{refresh-CCKB1Wa6.d.ts → refresh-D02Pbf5B.d.ts} +1 -1
  338. package/dist/{refusal-D_tklIEb.d.ts → refusal-B0VmlAxF.d.ts} +2 -2
  339. package/dist/{resolve-Bj1qD7Dy.d.ts → resolve-CtX6T0c0.d.ts} +1 -1
  340. package/dist/{resolved-names-Dsf28_Dr.js → resolved-names-iLBOUaib.js} +2 -2
  341. package/dist/{resource-D8pzB5Qf.d.ts → resource-WxN0IsvB.d.ts} +1 -1
  342. package/dist/{resource-execute-BSTIfp1D.d.ts → resource-execute-BzqR8DdD.d.ts} +2 -2
  343. package/dist/{resource-types-D5WEvYtV.d.ts → resource-types-BVbHgTPg.d.ts} +4 -4
  344. package/dist/{resources-CsZ7RhZC.d.ts → resources-BSbRa0Ab.d.ts} +2 -2
  345. package/dist/{respond-BzRG-0qc.d.ts → respond-Dzu_-EPH.d.ts} +1 -1
  346. package/dist/{sales-lines-KxxStRzU.d.ts → sales-lines-BsmrNHe9.d.ts} +1 -1
  347. package/dist/{scores-B2BiNuVJ.d.ts → scores-Y8TvyJi1.d.ts} +5 -5
  348. package/dist/server/index.d.ts +24 -24
  349. package/dist/server/index.js +1 -1
  350. package/dist/{server-types-BlDiY-ya.d.ts → server-types-BkTIxW_H.d.ts} +11 -11
  351. package/dist/{session-BGP98Rgj.d.ts → session-BOzx2qHC.d.ts} +6 -6
  352. package/dist/{session-status-C4t7kbSn.d.ts → session-status-BP8eYVnA.d.ts} +2 -2
  353. package/dist/{sign-in-CAadgm33.d.ts → sign-in-CfwJAJJL.d.ts} +2 -2
  354. package/dist/{signers-BKgmVh6A.d.ts → signers-ZmxO1I05.d.ts} +4 -4
  355. package/dist/{signing-keys-BNDUxpQL.d.ts → signing-keys-udgP7Aod.d.ts} +2 -2
  356. package/dist/solid/index.d.ts +10 -10
  357. package/dist/solid-start/index.d.ts +6 -6
  358. package/dist/spec/index.d.ts +2 -2
  359. package/dist/sql/index.d.ts +5 -5
  360. package/dist/sql/index.js +5 -5
  361. package/dist/{sql-Dg3W1ENk.js → sql-CoBySj2F.js} +3617 -1285
  362. package/dist/sqlite/index.d.ts +3 -3
  363. package/dist/{sso-B0Txid2-.d.ts → sso-CkU_4mtK.d.ts} +3 -3
  364. package/dist/ssr/index.d.ts +5 -5
  365. package/dist/storage/index.d.ts +3 -3
  366. package/dist/storage/index.js +1 -1
  367. package/dist/streams/index.d.ts +1 -1
  368. package/dist/{subject-readers-DJbzlm8a.d.ts → subject-readers-CB5Te02u.d.ts} +5 -5
  369. package/dist/{subject-readers-CeeJJOQ4.js → subject-readers-VHcrWhmq.js} +2 -2
  370. package/dist/{subjects-NomQg6Eg.d.ts → subjects-BYCL-6hA.d.ts} +15 -1
  371. package/dist/{subjects-BpIEN1MS.d.ts → subjects-CiBNKy2y.d.ts} +4 -4
  372. package/dist/{support-D7CMbhRT.d.ts → support-BxyPOFk4.d.ts} +4 -4
  373. package/dist/{support-view-CIDXF3_H.d.ts → support-view-nqUWKHEs.d.ts} +1 -1
  374. package/dist/svelte/index.d.ts +9 -9
  375. package/dist/sveltekit/index.d.ts +7 -7
  376. package/dist/{tags-Dg4Ywmqp.d.ts → tags-Cm48BsOa.d.ts} +1 -1
  377. package/dist/tanstack-db/index.d.ts +3 -3
  378. package/dist/tanstack-start/index.d.ts +6 -6
  379. package/dist/{tenant-BRmKZ7aq.d.ts → tenant-Ded341Qz.d.ts} +2 -2
  380. package/dist/testing/index.d.ts +25 -25
  381. package/dist/testing/index.js +2 -2
  382. package/dist/{timeline-Cjl-1hiA.d.ts → timeline-DvXtXq5q.d.ts} +5 -5
  383. package/dist/{topic-F0FKzJyQ.js → topic-DnsNG4Kj.js} +1 -1
  384. package/dist/{topic-CpsKVBot.d.ts → topic-XDdKzlrn.d.ts} +5 -5
  385. package/dist/{types-Dp3UCr1e.d.ts → types-B-D6fYx2.d.ts} +1 -1
  386. package/dist/{types-CjRwmCRP.d.ts → types-BFwB-E1j.d.ts} +2 -2
  387. package/dist/{types-Czq9Xtpa.d.ts → types-CK2X2wCB.d.ts} +5 -5
  388. package/dist/{types-DFdg_4yN.d.ts → types-CPl9uJ0G.d.ts} +2 -2
  389. package/dist/{types-DR1MHh7N.d.ts → types-CwQgFo8c.d.ts} +4 -4
  390. package/dist/{types-Dr9wZgNy.d.ts → types-DMihLukJ.d.ts} +3 -3
  391. package/dist/{types-A4yyKEsg.d.ts → types-iCyZ3lMx.d.ts} +4 -4
  392. package/dist/{types-BdaBfYIw.d.ts → types-nspa5I-a.d.ts} +7 -7
  393. package/dist/{undo-B1jwnVyN.d.ts → undo-0HkWXASn.d.ts} +2 -2
  394. package/dist/{usage-Dp45V42p.d.ts → usage-BkWAPkg2.d.ts} +4 -4
  395. package/dist/{vault-BghaujrZ.d.ts → vault-BkdPmL7f.d.ts} +2 -2
  396. package/dist/vercel-connect/index.d.ts +1 -1
  397. package/dist/{verify-CI8LgSpv.d.ts → verify-41mZmspj.d.ts} +2 -2
  398. package/dist/{view-BvNA7EOC.d.ts → view-C8_xvD-j.d.ts} +1 -1
  399. package/dist/vue/index.d.ts +10 -10
  400. package/dist/{watch-topic-BaMZX139.d.ts → watch-topic-DpN_GEoS.d.ts} +1 -1
  401. package/dist/workflow-sdk/builder/index.d.ts +3 -3
  402. package/dist/workflow-sdk/index.d.ts +1 -1
  403. package/dist/workflow-sdk/world/index.d.ts +1 -1
  404. package/dist/workflow-sdk/world/index.js +1 -1
  405. package/dist/{workflow-sdk-CE8sEK57.js → workflow-sdk-CaEw822d.js} +25 -4
  406. package/dist/{workflow-sdk-BNsZrcVg.d.ts → workflow-sdk-rg3IbCZC.d.ts} +3 -3
  407. package/dist/{workflows-B0ZPAQu0.d.ts → workflows-xL6t0TXx.d.ts} +7 -4
  408. package/dist/yjs/index.d.ts +2 -2
  409. package/dist/yjs/index.js +1 -1
  410. package/package.json +11 -2
  411. package/schemas/config-v1.json +45 -351
  412. package/skills/better-supabase/references/ui-recipes.md +5 -5
  413. package/dist/cli/add-Bf1fyCWm.js +0 -1
  414. package/dist/cli/env-xhwXk5Ri.js +0 -1
  415. package/dist/cli/in-stack-diff-DQTW53Vf.js +0 -257
  416. package/dist/cli/powersync-Dq-txa0_.js +0 -1
  417. package/dist/cli/seed-CO3j_bly.js +0 -1
@@ -1,20 +1,95 @@
1
- import { a as list, p as commandMeta, r as defineCliCommand } from "./command-BWEEXmtz.js";
1
+ import { a as list, m as commandMeta, r as defineCliCommand } from "./command-DIPmo0wh.js";
2
2
  import { i as plain } from "./style-Bm2X5JrN.js";
3
3
  import { n as CliError } from "./errors-BTe6A15O.js";
4
4
  import { r as readIfExists } from "./io-DH1kcmmP.js";
5
- import { l as TYPEGEN_VERSION } from "./cache-1TfBy2K4.js";
6
- import { a as findConfig, s as loadConfig } from "./config-BVfeG3A5.js";
7
- import { r as contentMapperFiles } from "./content-mapper-hUW2nb92.js";
8
- import { i as changeLines, n as PLAN_ARGS, r as applyPlan, u as planResult } from "./files-CX71yBm8.js";
9
- import { C as promptConventions, S as hasConventionFlags, _ as templatePlan, b as conventionFlags, c as AUTHZ_NOTE, d as chooseIntegrations, f as integrationFiles, g as templateContextFor, h as parseIntegrations, i as blocksWiringPath, l as createUrlParam, m as packagesFor, o as writeDesign, p as overwrite, r as blockConfigImport, s as readPresetInput, u as CANCELLED, v as CONVENTION_ARGS, w as withConventions, x as defaultConventions, y as CONVENTION_COMPLETIONS } from "./add-BTVrOGJF.js";
10
- import { a as wiringFiles, c as baseFiles, f as needsLib, i as wiringChecklist, m as suggestedIntegrations, n as latestMigrationVersion, o as wiringFor, p as resolveIntegrations, r as configInstances, s as TEMPLATES } from "./migration-safety-Doy9qYO8.js";
5
+ import { l as TYPEGEN_VERSION } from "./cache-DQZ09YOg.js";
6
+ import { a as serializeSnapshot, t as loadSnapshot } from "./snapshot-CXgsUPGj.js";
7
+ import { a as toCatalog } from "./source-B6aMAoEK.js";
8
+ import { a as findConfig, s as loadConfig } from "./config-Cskysxp-.js";
9
+ import { r as contentMapperFiles } from "./content-mapper-B0ehR7K-.js";
10
+ import { c as insideRoot, i as changeLines, n as PLAN_ARGS, r as applyPlan, u as planResult } from "./files-CX71yBm8.js";
11
+ import { C as promptConventions, S as hasConventionFlags, _ as templatePlan, b as conventionFlags, c as AUTHZ_NOTE, d as chooseIntegrations, f as integrationFiles, g as templateContextFor, h as parseIntegrations, i as blocksWiringPath, l as createUrlParam, m as packagesFor, o as writeDesign, p as overwrite, r as blockConfigImport, s as readPresetInput, u as CANCELLED, v as CONVENTION_ARGS, w as withConventions, x as defaultConventions, y as CONVENTION_COMPLETIONS } from "./add-CrQ3jS7t.js";
12
+ import { a as wiringFiles, c as baseFiles, f as needsLib, i as wiringChecklist, m as suggestedIntegrations, n as latestMigrationVersion, o as wiringFor, p as resolveIntegrations, r as configInstances, s as TEMPLATES } from "./migration-safety-DGQswWZy.js";
11
13
  import { n as installCommand, t as detectProject } from "./detect-D9JaAX20.js";
12
- import { s as enablePgDelta, t as syncModules } from "./sync-SqyVHRSJ.js";
14
+ import { s as enablePgDelta, t as syncModules } from "./sync-pq6gmlhG.js";
15
+ import { t as appTablePlan } from "./app-table-files-PnPOpuB4.js";
13
16
  import { existsSync } from "node:fs";
14
17
  import { join, posix, resolve } from "node:path";
15
- import { glob, readFile } from "node:fs/promises";
18
+ import { glob, readFile, readdir } from "node:fs/promises";
16
19
  import { groupConfig, resolveConfig } from "better-supabase/config";
17
20
  import { PRESETS, PRESET_NAMES, conventionConfig, designConfig, glueCommand, integrationsForFramework, isPresetName, presetBlocksSource, presetGlue, presetSpec, resolvePreset } from "better-supabase/preset";
21
+ //#region src/cli/init-existing.ts
22
+ /** Where `init --from <url>` writes the schema it read. */
23
+ const SNAPSHOT_PATH = "supabase/snapshot.json";
24
+ const DATABASE_URL = /^postgres(?:ql)?:\/\//u;
25
+ /** Whether `--from` names a database rather than a preset, design or file. */
26
+ const isDatabaseUrl = (value) => DATABASE_URL.test(value);
27
+ async function sqlFiles(dir) {
28
+ if (!existsSync(dir)) return 0;
29
+ return (await readdir(dir, {
30
+ withFileTypes: true,
31
+ recursive: true
32
+ })).filter((entry) => entry.isFile() && entry.name.endsWith(".sql")).length;
33
+ }
34
+ /** The tables in the project's saved snapshot, or none without one. */
35
+ async function snapshotTables(config, env, root) {
36
+ const path = join(root, SNAPSHOT_PATH);
37
+ if (!existsSync(path)) return [];
38
+ try {
39
+ return toCatalog(await loadSnapshot(config, env, { snapshotPath: path })).tables;
40
+ } catch {
41
+ return [];
42
+ }
43
+ }
44
+ /**
45
+ * The migrations, schema files and snapshot tables of the Supabase folder in
46
+ * `root`, or `undefined` for a project without one.
47
+ */
48
+ async function detectExisting(config, env, root) {
49
+ const supabase = join(root, "supabase");
50
+ if (!existsSync(supabase)) return;
51
+ const [migrations, schemaFiles, tables] = await Promise.all([
52
+ sqlFiles(join(supabase, "migrations")),
53
+ sqlFiles(join(supabase, "schemas")),
54
+ snapshotTables(config, env, root)
55
+ ]);
56
+ return {
57
+ migrations,
58
+ schemaFiles,
59
+ tables: tables.map((table) => `${table.schema}.${table.name}`)
60
+ };
61
+ }
62
+ /** The lines `init` prints for an existing project. */
63
+ function existingLines(found) {
64
+ return [`Found an existing Supabase project: ${[
65
+ `${String(found.migrations)} migration(s)`,
66
+ `${String(found.schemaFiles)} schema file(s)`,
67
+ `${String(found.tables.length)} table(s) in ${SNAPSHOT_PATH}`
68
+ ].join(", ")}.`, "init changed nothing in the database and added no blocks; each step after it is optional."];
69
+ }
70
+ /**
71
+ * Reads the database at `url` and plans a snapshot of its schema, so `gen`,
72
+ * `doctor` and block detection see tables made in the dashboard.
73
+ */
74
+ async function planSnapshotFrom(config, env, root, url) {
75
+ const snapshot = await loadSnapshot(config, env, {
76
+ dbUrl: url,
77
+ live: true
78
+ });
79
+ return {
80
+ tables: snapshot.extras.tables.length,
81
+ plan: {
82
+ root,
83
+ regenerate: "better-supabase init --from",
84
+ files: [{
85
+ path: insideRoot(root, SNAPSHOT_PATH, "--from"),
86
+ contents: serializeSnapshot(snapshot),
87
+ note: `${String(snapshot.extras.tables.length)} tables`
88
+ }]
89
+ }
90
+ };
91
+ }
92
+ //#endregion
18
93
  //#region src/cli/project/workspace.ts
19
94
  const unquote = (value) => value.replace(/\s+#.*$/, "").trim().replace(/^(["'])(.*)\1$/, "$2");
20
95
  /** The `packages` globs of `pnpm-workspace.yaml`, in block or flow style. */
@@ -121,6 +196,11 @@ const INIT_ARGS = {
121
196
  description: "How the SQL modules reach the database: pg-delta (the default), migra or migrations",
122
197
  valueHint: "pg-delta|migra|migrations"
123
198
  },
199
+ from: {
200
+ type: "string",
201
+ description: "Where the project starts: a postgres:// URL (reads its schema into supabase/snapshot.json), or a preset, design code, URL or file like --preset",
202
+ valueHint: "url|name|code|file"
203
+ },
124
204
  preset: {
125
205
  type: "string",
126
206
  description: "A named preset, a design code from /create, its URL or a downloaded design file: the config starts from it, and init writes its modules and lib/blocks.ts",
@@ -232,7 +312,14 @@ function withDesign(files, design) {
232
312
  }
233
313
  return out;
234
314
  }
235
- async function runInit(config, args, prompts, now = () => /* @__PURE__ */ new Date()) {
315
+ async function runInit(config, given, prompts, now = () => /* @__PURE__ */ new Date(), env = {}) {
316
+ const databaseFrom = given.from !== void 0 && isDatabaseUrl(given.from) ? given.from : void 0;
317
+ if (given.from !== void 0 && given.preset !== void 0) throw new CliError("usage", "Pass --from or --preset, not both.");
318
+ const withPreset = {
319
+ ...given,
320
+ preset: given.from
321
+ };
322
+ const args = given.from === void 0 || databaseFrom !== void 0 ? given : withPreset;
236
323
  const flags = conventionFlags(args);
237
324
  const chosen = await chosenPreset(args, flags, prompts, config.root);
238
325
  if (chosen !== null && "code" in chosen) return chosen;
@@ -307,8 +394,10 @@ async function runInit(config, args, prompts, now = () => /* @__PURE__ */ new Da
307
394
  force
308
395
  });
309
396
  if (applied.mode === "check" && applied.drift) return planResult(templatePlan(root, files, "better-supabase init", config.root), applied);
397
+ const existing = await detectExisting(config, env, config.root);
310
398
  const lines = [
311
399
  project.frameworks.length > 0 ? `Found ${project.frameworks.join(", ")}${where}.` : `No framework found${where}.`,
400
+ ...existing === void 0 ? [] : ["", ...existingLines(existing)],
312
401
  "",
313
402
  ...changeLines(applied),
314
403
  ...workflow === "pg-delta" ? await enablePgDelta(root, args["dry-run"] === true, config.root) : []
@@ -328,6 +417,16 @@ async function runInit(config, args, prompts, now = () => /* @__PURE__ */ new Da
328
417
  });
329
418
  lines.push(...changeLines(wrote));
330
419
  }
420
+ let snapshotTables;
421
+ if (databaseFrom !== void 0) {
422
+ const read = await planSnapshotFrom(config, env, config.root, databaseFrom);
423
+ const wrote = await applyPlan(read.plan, {
424
+ ...args,
425
+ force: true
426
+ });
427
+ snapshotTables = read.tables;
428
+ lines.push("", ...changeLines(wrote));
429
+ }
331
430
  if (createUrlParam(args.preset, "authz") !== void 0) lines.push("", AUTHZ_NOTE);
332
431
  if (chosen !== null) {
333
432
  const presetConfig = resolveConfig(groupConfig({
@@ -337,8 +436,19 @@ async function runInit(config, args, prompts, now = () => /* @__PURE__ */ new Da
337
436
  ...designKeys(chosen.resolved, chosen.design),
338
437
  ...workflow === "pg-delta" ? {} : { sql: { workflow } }
339
438
  }), root);
340
- const synced = await syncModules(presetConfig, { "dry-run": args["dry-run"] === true }, plain, now);
439
+ const synced = await syncModules({
440
+ ...presetConfig,
441
+ appTables: {}
442
+ }, { "dry-run": args["dry-run"] === true }, plain, now);
341
443
  lines.push("", synced.output ?? synced.error ?? "");
444
+ const tables = await appTablePlan(presetConfig, "better-supabase init");
445
+ if (tables !== void 0) {
446
+ const wrote = await applyPlan(tables.plan, {
447
+ ...args,
448
+ force: true
449
+ });
450
+ lines.push("", ...changeLines(wrote));
451
+ }
342
452
  const glue = presetGlue(chosen.resolved);
343
453
  const glueLine = glue.length > 0 ? glueCommand(glue) : void 0;
344
454
  const wiring = wiringFor(configInstances(presetConfig));
@@ -388,6 +498,13 @@ async function runInit(config, args, prompts, now = () => /* @__PURE__ */ new Da
388
498
  command: `better-supabase gen${cwdFlag}`,
389
499
  when: "generates the typed client"
390
500
  },
501
+ ...existing === void 0 ? [] : [{
502
+ command: `better-supabase doctor${cwdFlag}`,
503
+ when: "reports which tables each rung covers"
504
+ }, {
505
+ command: `better-supabase table <table> enable <feature>${cwdFlag}`,
506
+ when: "turns on a feature for one of your tables"
507
+ }],
391
508
  {
392
509
  command: "better-supabase skills install",
393
510
  when: "installs the agent skills"
@@ -407,6 +524,8 @@ async function runInit(config, args, prompts, now = () => /* @__PURE__ */ new Da
407
524
  ...inPackage ? { package: target.dir } : {},
408
525
  integrations,
409
526
  ...chosen === null ? {} : { preset: chosen.value },
527
+ ...existing === void 0 ? {} : { existing },
528
+ ...snapshotTables === void 0 ? {} : { snapshotTables },
410
529
  files: applied.changes,
411
530
  hints
412
531
  },
@@ -425,7 +544,7 @@ const initCommand = defineCliCommand({
425
544
  ...CONVENTION_COMPLETIONS,
426
545
  preset: () => PRESET_NAMES
427
546
  },
428
- run: (args, { config, io }) => runInit(config, args, io.prompts)
547
+ run: (args, { config, io, env }) => runInit(config, args, io.prompts, void 0, env)
429
548
  });
430
549
  /** The `blocks` and `appTables` keys a design adds to the preset's config. */
431
550
  function designKeys(resolved, design) {
@@ -1,4 +1,4 @@
1
- import { p as commandMeta, r as defineCliCommand } from "./command-BWEEXmtz.js";
1
+ import { m as commandMeta, r as defineCliCommand } from "./command-DIPmo0wh.js";
2
2
  import { t as display } from "./io-DH1kcmmP.js";
3
3
  import { m as supabaseDir } from "./supabase-toml-CncmQbO0.js";
4
4
  import { i as changeLines, r as applyPlan } from "./files-CX71yBm8.js";
@@ -1,6 +1,6 @@
1
1
  import { r as errorText } from "./errors-BTe6A15O.js";
2
- import "./source-COARbqch.js";
3
- import { l as tableObject, n as exposed, s as qualified, t as catalogOf } from "./shared-CslNcs-R.js";
2
+ import "./source-B6aMAoEK.js";
3
+ import { l as tableObject, n as exposed, s as qualified, t as catalogOf } from "./shared-BHbtUOvh.js";
4
4
  //#region src/cli/doctor/reserved-roles.ts
5
5
  /**
6
6
  * Supautils' `reserved_roles` on Supabase. Nobody but a superuser may alter,
@@ -1,9 +1,9 @@
1
- import { p as commandMeta, r as defineCliCommand } from "./command-BWEEXmtz.js";
2
- import { a as envelope, i as run } from "./run-DPLedqTF.js";
3
- import { t as VERSION } from "./version-Bhca9D6q.js";
1
+ import { m as commandMeta, r as defineCliCommand } from "./command-DIPmo0wh.js";
2
+ import { a as envelope, i as run } from "./run-C2Yg5MWt.js";
3
+ import { t as VERSION } from "./version-CQHFm-ak.js";
4
4
  import { n as CliError } from "./errors-BTe6A15O.js";
5
5
  import { n as consentToken } from "./agent-CbuPvI2x.js";
6
- import { C as optional, D as record, N as unknown, a as array, d as is, j as string$1, k as safeParse, o as boolean, t as PROCESS_ENV, x as object } from "./env-DMgjB_4y.js";
6
+ import { C as optional, D as record, N as unknown, a as array, d as is, j as string$1, k as safeParse, t as PROCESS_ENV, x as object } from "./env-BK0xKMeU.js";
7
7
  import { createInterface } from "node:readline";
8
8
  import { answerLine } from "better-supabase/mcp";
9
9
  //#region src/cli/mcp/server.ts
@@ -19,7 +19,6 @@ const Input = object({
19
19
  blocks: optional(array(string$1())),
20
20
  text: optional(string$1()),
21
21
  preset: optional(string$1()),
22
- allow_breaking: optional(boolean()),
23
22
  confirm: optional(string$1())
24
23
  });
25
24
  const string = (description) => ({
@@ -97,17 +96,10 @@ const TOOLS = [
97
96
  ]),
98
97
  write("gen", "Regenerates the typed client and every other generated file.", {}, [], () => ["gen"]),
99
98
  write("upgrade", "Writes the upgrade steps of blocks behind their current version, then the SQL files of every block the config lists.", {}, [], () => ["upgrade"]),
100
- write("add_preset", "Applies a preset or Create URL: edits the config and writes the blocks' SQL.", {
101
- preset: PRESET,
102
- allow_breaking: {
103
- type: "boolean",
104
- description: "Write breaking app table changes such as a rename"
105
- }
106
- }, ["preset"], ({ preset, allow_breaking: allowBreaking }) => [
99
+ write("add_preset", "Applies a preset or Create URL: edits the config and writes the blocks' SQL.", { preset: PRESET }, ["preset"], ({ preset }) => [
107
100
  "add",
108
101
  "--preset",
109
- preset ?? "",
110
- ...allowBreaking === true ? ["--allow-breaking"] : []
102
+ preset ?? ""
111
103
  ]),
112
104
  write("add", "Adds blocks with the blocks they require.", { blocks: {
113
105
  type: "array",
@@ -1,8 +1,8 @@
1
1
  import { n as CliError, r as errorText } from "./errors-BTe6A15O.js";
2
2
  import { i as readStdin } from "./io-DH1kcmmP.js";
3
- import { m as parseMetadataDocument, u as MetadataRejectedError } from "./snapshot-DdN5GlhH.js";
4
- import { c as metaPaths, n as render } from "./render-DWRz-uPQ.js";
5
- import { i as generationNotices, n as runGen, o as fromMetadata, r as UNFORMATTED, t as refuseRowConditionedBuckets } from "./run-j54rk2w-.js";
3
+ import { m as parseMetadataDocument, u as MetadataRejectedError } from "./snapshot-CXgsUPGj.js";
4
+ import { c as metaPaths, n as render } from "./render-B18iAdsT.js";
5
+ import { i as generationNotices, n as runGen, o as fromMetadata, r as UNFORMATTED, t as refuseRowConditionedBuckets } from "./run-Wx_2Acgv.js";
6
6
  import { basename, join, relative, resolve, sep } from "node:path";
7
7
  import { readFile } from "node:fs/promises";
8
8
  import { jsonSchema, standardSchema, valibot, zod } from "better-supabase/config";
@@ -0,0 +1,46 @@
1
+ import { m as commandMeta, r as defineCliCommand } from "./command-DIPmo0wh.js";
2
+ import { i as plain } from "./style-Bm2X5JrN.js";
3
+ import { n as PLAN_ARGS, r as applyPlan, u as planResult } from "./files-CX71yBm8.js";
4
+ import { t as appTablePlan } from "./app-table-files-PnPOpuB4.js";
5
+ //#region src/cli/commands/migrate.ts
6
+ const MIGRATE_ARGS = {};
7
+ /**
8
+ * Writes the tables that `appTables` renders as files you own under
9
+ * `supabase/schemas` (ADR 0102), with the config's per-table features as `@bsb`
10
+ * tags in each table's comment. It reads a config that still has `tables` (the
11
+ * loader accepts it for this command only), so run `upgrade` after removing
12
+ * it.
13
+ */
14
+ async function runMigrateSchemaFirst(config, args, deps = {}) {
15
+ const built = await appTablePlan(config, "better-supabase migrate schema-first");
16
+ if (built === void 0) return {
17
+ code: 0,
18
+ output: "The config has no app tables; there are no tables to move.",
19
+ data: {
20
+ tables: [],
21
+ files: []
22
+ }
23
+ };
24
+ const { plan, tables, files } = built;
25
+ const applied = await applyPlan(plan, args, deps.paint ?? plain);
26
+ const summary = applied.mode === "write" && applied.drift ? `Wrote ${String(files.length)} files for ${String(tables.length)} tables. Delete \`tables\` from the config and rename \`records\` to \`subjects\`, run \`better-supabase upgrade\` to remove the old app tables file, then \`better-supabase db diff\` to check that the schema is unchanged.` : void 0;
27
+ return planResult(plan, applied, {
28
+ data: {
29
+ tables,
30
+ files
31
+ },
32
+ ...summary === void 0 ? {} : { summary }
33
+ });
34
+ }
35
+ const migrateSchemaFirstCommand = defineCliCommand({
36
+ meta: commandMeta("migrate schema-first"),
37
+ readsLegacyTables: true,
38
+ args: {
39
+ ...MIGRATE_ARGS,
40
+ "dry-run": PLAN_ARGS["dry-run"],
41
+ check: PLAN_ARGS.check
42
+ },
43
+ run: (args, { config, paint }) => runMigrateSchemaFirst(config, args, { paint })
44
+ });
45
+ //#endregion
46
+ export { migrateSchemaFirstCommand };
@@ -1,5 +1,5 @@
1
- import { f as INTEGRATIONS } from "./config-BVfeG3A5.js";
2
- import { c as splitStatements } from "./shared-CslNcs-R.js";
1
+ import { f as INTEGRATIONS } from "./config-Cskysxp-.js";
2
+ import { c as splitStatements } from "./shared-BHbtUOvh.js";
3
3
  import { dirname, join, posix } from "node:path";
4
4
  import { readdir } from "node:fs/promises";
5
5
  import { INTEGRATION_INFO, groupEntries } from "better-supabase/config";
@@ -0,0 +1,117 @@
1
+ import { r as layoutFor } from "./providers-Cjf5iOp5.js";
2
+ import { d as readSupabaseToml, p as sqlWorkflow } from "./supabase-toml-CncmQbO0.js";
3
+ import { i as changeLines, r as applyPlan } from "./files-CX71yBm8.js";
4
+ import { a as sqlPlan, n as migrationsDir } from "./sql-layout-CkxDNVEH.js";
5
+ import { resolve } from "node:path";
6
+ import { readFile, readdir } from "node:fs/promises";
7
+ import { moduleSchemaExtensions, renderBlocks } from "better-supabase/sql";
8
+ //#region src/cli/sql/migrations.ts
9
+ /** `YYYYMMDDHHMMSS` in UTC, the Supabase CLI's migration prefix. */
10
+ const migrationStamp = (now) => now.toISOString().replaceAll(/[-:T]/g, "").slice(0, 14);
11
+ /**
12
+ * A stamp for `now`, or one second after the newest migration when that one has
13
+ * the same stamp or a later one: the Supabase CLI keys migrations by stamp, and
14
+ * the data has to run after the schema.
15
+ */
16
+ function stampAfter(migrations, now) {
17
+ const newest = migrations.map((name) => /^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(?!\d)/.exec(name)).filter((match) => match !== null).map((match) => Date.UTC(Number(match[1]), Number(match[2]) - 1, Number(match[3]), Number(match[4]), Number(match[5]), Number(match[6]))).reduce((max, time) => Math.max(max, time), Number.NEGATIVE_INFINITY);
18
+ const at = Math.floor(now.getTime() / 1e3) * 1e3;
19
+ return migrationStamp(new Date(Math.max(at, newest + 1e3)));
20
+ }
21
+ const EXTENSIONS_SUFFIX = "_better_supabase_extensions.sql";
22
+ const MIGRATION_EXTENSION = /^\s*create\s+extension\s+(?:if\s+not\s+exists\s+)?"?([a-z_][a-z0-9_]*)"?/gim;
23
+ async function unmigratedExtensions(config, files) {
24
+ const dir = migrationsDir(config);
25
+ const existing = await readdir(resolve(config.root, dir)).catch(() => []);
26
+ const created = /* @__PURE__ */ new Set();
27
+ for (const name of existing) {
28
+ if (!name.endsWith(".sql") || name.endsWith(DATA_SUFFIX)) continue;
29
+ const text = await readFile(resolve(config.root, dir, name), "utf-8");
30
+ for (const match of text.matchAll(MIGRATION_EXTENSION)) created.add(match[1].toLowerCase());
31
+ }
32
+ return {
33
+ dir,
34
+ existing,
35
+ missing: moduleSchemaExtensions(files).filter((extension) => !created.has(extension.name))
36
+ };
37
+ }
38
+ async function writeExtensionsMigration(config, files, dryRun, now) {
39
+ const { dir, existing, missing } = await unmigratedExtensions(config, files);
40
+ if (missing.length === 0) return [];
41
+ const path = `${dir}/${stampAfter(existing, /* @__PURE__ */ new Date(now().getTime() - 1e3))}${EXTENSIONS_SUFFIX}`;
42
+ const applied = await applyPlan(sqlPlan(config, {
43
+ regenerate: "better-supabase upgrade",
44
+ files: [{
45
+ path,
46
+ contents: `-- better-supabase sql: the extensions of ${missing.map((extension) => extension.name).join(", ")}, created before the schema migration that needs them.\n\n${missing.map((extension) => extension.statement).join("\n")}\n`
47
+ }]
48
+ }), { "dry-run": dryRun });
49
+ return [...changeLines(applied), ...dryRun ? [] : ["It creates the extensions the module schemas need, so create the schema migration after it."]];
50
+ }
51
+ const DATA_NEXT = "The better-supabase-data files hold rows and settings a schema diff skips: after the schema migration, run `better-supabase add --adopt`.";
52
+ const DATA_SUFFIX = "_better_supabase_module_data.sql";
53
+ /**
54
+ * A migration without its comment lines, so a reworded comment needs no new
55
+ * one.
56
+ */
57
+ const statements = (sql) => sql.split("\n").filter((line) => !line.trimStart().startsWith("--")).join("\n").replaceAll(/\n{2,}/g, "\n").trim();
58
+ /**
59
+ * Writes the data files of `blocks` into one migration, meant to run after the
60
+ * schema migration that creates their tables. Every statement is idempotent, so
61
+ * the migration carries all of them, not only the changes.
62
+ */
63
+ async function dataMigration(config, args, now) {
64
+ if (config.blockNames.length === 0) return {
65
+ code: 0,
66
+ output: "blocks is empty; nothing to write.",
67
+ data: { wrote: false }
68
+ };
69
+ if (sqlWorkflow(config, await readSupabaseToml(config.root)) === "migrations") return {
70
+ code: 0,
71
+ output: "database.sql.workflow is 'migrations', so `better-supabase upgrade` already writes the rows into the module migration; nothing to write.",
72
+ data: { wrote: false }
73
+ };
74
+ const rendered = renderBlocks(config.blockNames, await layoutFor(config, args, config.blockNames));
75
+ const { missing } = await unmigratedExtensions(config, rendered);
76
+ if (missing.length > 0) return {
77
+ code: 1,
78
+ error: [`No migration before the data migration creates ${missing.map((extension) => extension.name).join(", ")}, and the schema migration needs ${missing.length === 1 ? "it" : "them"} while it applies.`, "Run `better-supabase upgrade` to write the extensions migration, then create the schema migration again after it."].join("\n")
79
+ };
80
+ const files = rendered.filter((file) => file.kind === "data");
81
+ const contents = `-- better-supabase add --adopt: the rows and settings of ${files.map((file) => file.module).join(", ")}, which a schema diff skips.\n\nset lock_timeout = '5s';\n\n${files.map((file) => file.contents.trim()).join("\n\n")}\n`;
82
+ const dir = migrationsDir(config);
83
+ const existing = await readdir(resolve(config.root, dir)).catch(() => []);
84
+ const latest = existing.toSorted().findLast((name) => name.endsWith(DATA_SUFFIX));
85
+ if (latest !== void 0 && statements(await readFile(resolve(config.root, dir, latest), "utf-8")) === statements(contents)) return {
86
+ code: 0,
87
+ output: `${dir}/${latest} already has these rows; nothing to write.`,
88
+ data: {
89
+ file: `${dir}/${latest}`,
90
+ wrote: false
91
+ }
92
+ };
93
+ if (args.check === true) return {
94
+ code: 1,
95
+ error: `${latest === void 0 ? "No data migration holds" : `${dir}/${latest} doesn't hold`} the current rows and settings of the blocks. Run \`better-supabase add --adopt\` after the schema migration.`,
96
+ data: { wrote: false }
97
+ };
98
+ const path = `${dir}/${stampAfter(existing, now())}${DATA_SUFFIX}`;
99
+ const applied = await applyPlan(sqlPlan(config, {
100
+ regenerate: "better-supabase add --adopt",
101
+ files: [{
102
+ path,
103
+ contents
104
+ }]
105
+ }), { "dry-run": args["dry-run"] });
106
+ return {
107
+ code: 0,
108
+ output: changeLines(applied).join("\n"),
109
+ data: {
110
+ file: path,
111
+ wrote: applied.mode === "write",
112
+ files: applied.changes
113
+ }
114
+ };
115
+ }
116
+ //#endregion
117
+ export { writeExtensionsMigration as a, stampAfter as i, dataMigration as n, migrationStamp as r, DATA_NEXT as t };
@@ -1,7 +1,7 @@
1
- import { i as stampAfter } from "./migrations-JtsPYv8g.js";
2
1
  import { d as readSupabaseToml, p as sqlWorkflow } from "./supabase-toml-CncmQbO0.js";
3
2
  import { i as changeLines, r as applyPlan } from "./files-CX71yBm8.js";
4
- import { a as sqlPlan, n as migrationsDir } from "./sql-layout-8jrP5gIa.js";
3
+ import { a as sqlPlan, n as migrationsDir } from "./sql-layout-CkxDNVEH.js";
4
+ import { i as stampAfter } from "./migrations-Cqk-lJwu.js";
5
5
  import { resolve } from "node:path";
6
6
  import { readFile, readdir } from "node:fs/promises";
7
7
  import { moduleSchemaExtensions } from "better-supabase/sql";
@@ -1,5 +1,5 @@
1
1
  import { n as CliError } from "./errors-BTe6A15O.js";
2
- import { s as positionalIndex } from "./parse-B079x40m.js";
2
+ import { s as positionalIndex } from "./parse-BPf3kGnc.js";
3
3
  //#region src/cli/core/moved.ts
4
4
  const API_REPLACEMENT = "defineApi includes every table and block instance, and createOrpc(betterSupabase).router(api) serves it: https://bettersupabase.com/docs/frameworks/orpc#serve-the-api";
5
5
  /** Commands removed in 0.15, with what replaces them, longest path first. */
@@ -1,5 +1,5 @@
1
1
  import { r as __toESM } from "./rolldown-runtime-kJ_i4yPo.js";
2
- import { t as GLOBAL_ARGS } from "./command-BWEEXmtz.js";
2
+ import { t as GLOBAL_ARGS } from "./command-DIPmo0wh.js";
3
3
  import { n as CliError } from "./errors-BTe6A15O.js";
4
4
  //#region src/cli/core/parse.ts
5
5
  /**
@@ -1,7 +1,8 @@
1
- import { p as commandMeta, r as defineCliCommand } from "./command-BWEEXmtz.js";
2
- import { c as layoutFor, i as stampAfter } from "./migrations-JtsPYv8g.js";
1
+ import { m as commandMeta, r as defineCliCommand } from "./command-DIPmo0wh.js";
2
+ import { r as layoutFor } from "./providers-Cjf5iOp5.js";
3
3
  import { n as PLAN_ARGS, r as applyPlan, u as planResult } from "./files-CX71yBm8.js";
4
- import { n as migrationsDir } from "./sql-layout-8jrP5gIa.js";
4
+ import { n as migrationsDir } from "./sql-layout-CkxDNVEH.js";
5
+ import { i as stampAfter } from "./migrations-Cqk-lJwu.js";
5
6
  import { existsSync } from "node:fs";
6
7
  import { join, resolve } from "node:path";
7
8
  import { readFile, readdir } from "node:fs/promises";
@@ -0,0 +1 @@
1
+ export { t as powersyncStreamsCommand } from "./powersync-BWQ-8T3G.js";
@@ -1,6 +1,6 @@
1
1
  import { n as CliError } from "./errors-BTe6A15O.js";
2
- import { s as layout } from "./migrations-JtsPYv8g.js";
3
- import { o as migrationModules, r as latestMigration, u as writesMigrations } from "./module-migration-ZIn1NCMi.js";
2
+ import { n as layout } from "./providers-Cjf5iOp5.js";
3
+ import { o as migrationModules, r as latestMigration, u as writesMigrations } from "./module-migration-8-hMiZtW.js";
4
4
  import { existsSync } from "node:fs";
5
5
  import { resolve } from "node:path";
6
6
  import { SQL_MODULES, contractSignature, customContracts, moduleBody, moduleFilePaths } from "better-supabase/sql";