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
@@ -2,10 +2,10 @@ import { n as CliError } from "./errors-BTe6A15O.js";
2
2
  import { i as readStdin, t as display } from "./io-DH1kcmmP.js";
3
3
  import { t as isRecord } from "./guards-CUlDNYZs.js";
4
4
  import { c as resolve$1, i as extname$1, n as basename$1, o as join$1, r as dirname$1, s as normalize$1, t as resolveModulePath } from "./dist-DuiMMRbJ.js";
5
- import { _ as parse$1, d as readSupabaseToml, g as tomlNumber, s as findUp } from "./supabase-toml-CncmQbO0.js";
6
- import { A as strictObject, C as optional, D as record, E as rawCheck, M as union, N as unknown, O as regex, S as objectWithRest, T as pipe, _ as minLength, a as array, b as number, c as exactOptional, f as lazy, g as maxValue, h as maxLength, j as string, k as safeParse, l as getDotPath, m as literal, o as boolean, p as length, s as custom, u as integer, v as minValue, w as picklist, y as nullable } from "./env-DMgjB_4y.js";
5
+ import { _ as parse$1, d as readSupabaseToml, f as schemaPaths, g as tomlNumber, p as sqlWorkflow, s as findUp } from "./supabase-toml-CncmQbO0.js";
6
+ import { A as strictObject, C as optional, D as record, E as rawCheck, M as union, N as unknown, O as regex, S as objectWithRest, T as pipe, _ as minLength, a as array, b as number, c as exactOptional, f as lazy, g as maxValue, h as maxLength, j as string, k as safeParse, l as getDotPath, m as literal, o as boolean, p as length, s as custom, u as integer, v as minValue, w as picklist, y as nullable } from "./env-BK0xKMeU.js";
7
7
  import { t as importFresh } from "./fresh-import-DzgsGHkX.js";
8
- import { n as readStackStatus } from "./stack-status-B_Ipd_-z.js";
8
+ import { n as readStackStatus } from "./stack-status-BkkYRlXG.js";
9
9
  import * as nodeUtil from "node:util";
10
10
  import { existsSync, readFileSync, statSync } from "node:fs";
11
11
  import { dirname, join, resolve } from "node:path";
@@ -13,8 +13,260 @@ import { readFile, rm } from "node:fs/promises";
13
13
  import { pathToFileURL } from "node:url";
14
14
  import { APP_COLUMN_ACCESS, APP_COLUMN_FORMATS, APP_COLUMN_TYPES, APP_ON_DELETE_ACTIONS, APP_ROLLUP_AGGREGATES, APP_TABLE_EVENT_KINDS, CONFIG_GROUPS, GEN_TASKS, INTEGRATION_NAMES, RENAMED_CONFIG_KEYS, SKILLS_AGENTS, providerApiProblem, resolveConfig } from "better-supabase/config";
15
15
  import { CONVENTION_FIELDS } from "better-supabase/preset";
16
- import { SCOPE_ID_TYPES, scopeProblems } from "better-supabase/sql";
16
+ import { SCOPE_ID_TYPES, parseBsbComment, scopeProblems, tableTagComments } from "better-supabase/sql";
17
17
  import { homedir } from "node:os";
18
+ //#region src/cli/subject-tag.ts
19
+ const PERMISSION_PREFIX = "can-";
20
+ function text$1(value) {
21
+ return typeof value === "string" ? value : void 0;
22
+ }
23
+ function columns(value) {
24
+ return typeof value === "string" ? value.split(",").map((item) => item.trim()).filter((item) => item !== "") : [];
25
+ }
26
+ /**
27
+ * The `subject` entry a tag stands for. `table` is the tagged table. Options
28
+ * the tag has no word for (`search.from`, `search.watch`, row grants) stay in
29
+ * `subjects`.
30
+ */
31
+ function subjectFromTag(args, table) {
32
+ const tenant = text$1(args["tenant"]);
33
+ const searchTitle = text$1(args["search-title"]);
34
+ const searchBody = columns(args["search-body"]);
35
+ const description = text$1(args["search-description"]);
36
+ const exclude = text$1(args["search-exclude"]);
37
+ const versions = columns(args["versions"]);
38
+ const rank = text$1(args["rank"]);
39
+ const permissions = Object.fromEntries(Object.entries(args).flatMap(([key, value]) => key.startsWith(PERMISSION_PREFIX) && typeof value === "string" ? [[key.slice(4), value]] : []));
40
+ const search = searchTitle !== void 0 || searchBody.length > 0 || description !== void 0 || exclude !== void 0 || args["search"] === true;
41
+ const id = text$1(args["id"]);
42
+ const idType = text$1(args["id-type"]);
43
+ const title = text$1(args["title"]);
44
+ const url = text$1(args["url"]);
45
+ const scope = text$1(args["scope"]);
46
+ const deletedAt = text$1(args["deleted-at"]);
47
+ const rankGroup = text$1(args["rank-group"]);
48
+ return {
49
+ table,
50
+ ...id === void 0 ? {} : { id },
51
+ ...idType === void 0 ? {} : { idType },
52
+ ...tenant === void 0 ? {} : { tenant: tenant === "false" ? false : tenant },
53
+ ...title === void 0 ? {} : { title },
54
+ ...url === void 0 ? {} : { url },
55
+ ...scope === void 0 ? {} : { scope },
56
+ ...args["cascade"] === true ? { cascade: true } : {},
57
+ ...deletedAt === void 0 ? {} : { deletedAt },
58
+ ...Object.keys(permissions).length === 0 ? {} : { permissions },
59
+ ...search ? { search: {
60
+ ...searchTitle === void 0 ? {} : { title: searchTitle },
61
+ ...searchBody.length === 0 ? {} : { body: searchBody },
62
+ ...description === void 0 ? {} : { description },
63
+ ...exclude === void 0 ? {} : { exclude }
64
+ } } : {},
65
+ ...rank === void 0 && rankGroup === void 0 ? {} : { rank: {
66
+ column: rank ?? "rank",
67
+ ...rankGroup === void 0 ? {} : { group: rankGroup }
68
+ } },
69
+ ...versions.length === 0 ? {} : { versions: {
70
+ columns: versions,
71
+ auto: args["versions-auto"] !== "false"
72
+ } }
73
+ };
74
+ }
75
+ /**
76
+ * The tag arguments for `subject`, or `undefined` when the entry holds an
77
+ * option a tag can't carry, so it stays in `subjects`.
78
+ */
79
+ function subjectTagArgs(type, subject, table) {
80
+ const permissions = Object.entries(subject.permissions ?? {});
81
+ if (permissions.some(([, value]) => typeof value !== "string") || subject.search?.from !== void 0 || subject.search?.watch !== void 0) return;
82
+ const args = {};
83
+ const set = (key, value) => {
84
+ if (value !== void 0) args[key] = value;
85
+ };
86
+ set("type", type === table ? void 0 : type);
87
+ set("id", subject.id);
88
+ set("id-type", subject.idType);
89
+ set("tenant", subject.tenant === false ? "false" : subject.tenant);
90
+ set("title", subject.title);
91
+ set("url", subject.url);
92
+ set("scope", subject.scope);
93
+ set("cascade", subject.cascade === true ? true : void 0);
94
+ set("deleted-at", subject.deletedAt);
95
+ set("search-title", subject.search?.title);
96
+ set("search-body", subject.search?.body === void 0 ? void 0 : subject.search.body.join(","));
97
+ set("search-description", subject.search?.description);
98
+ set("search-exclude", subject.search?.exclude);
99
+ set("search", subject.search !== void 0 && Object.keys(args).every((key) => !key.startsWith("search-")) ? true : void 0);
100
+ set("rank", subject.rank?.column);
101
+ set("rank-group", subject.rank?.group);
102
+ if (subject.versions !== void 0) {
103
+ set("versions", subject.versions.columns.join(","));
104
+ set("versions-auto", subject.versions.auto ? void 0 : "false");
105
+ }
106
+ for (const [action, key] of permissions) set(`${PERMISSION_PREFIX}${action}`, typeof key === "string" ? key : void 0);
107
+ return args;
108
+ }
109
+ //#endregion
110
+ //#region src/cli/gen/table-tags.ts
111
+ const DISTANCES = /* @__PURE__ */ new Set([
112
+ "cosine",
113
+ "l2",
114
+ "inner_product"
115
+ ]);
116
+ function isDistance(value) {
117
+ return DISTANCES.has(value);
118
+ }
119
+ const IMPORT_PREFIX = "import:";
120
+ function isColumnType(value) {
121
+ return APP_COLUMN_TYPES.some((type) => type === value);
122
+ }
123
+ function isEventKind(value) {
124
+ return APP_TABLE_EVENT_KINDS.some((kind) => kind === value);
125
+ }
126
+ function list(value) {
127
+ return typeof value === "string" ? value.split(",").map((item) => item.trim()).filter((item) => item !== "") : [];
128
+ }
129
+ function text(value) {
130
+ return typeof value === "string" ? value : void 0;
131
+ }
132
+ /**
133
+ * `config` with the per-table features the schema's `@bsb` table comments turn
134
+ * on (ADR 0102): `subject`, `realtime`, `vector-search`, `json` (`column=Type`,
135
+ * or `column=import:module#Name`), `encrypted` (`column=type`, a bare column is
136
+ * text) and `events` (`on`, `include`). `audit`, `audit-reads` and `expose`
137
+ * change the table's SQL only, so `gen` has nothing to read from them. A key
138
+ * the config sets itself wins, so a project can move to tags one table at a
139
+ * time. Tables outside `config.schemas` are ignored.
140
+ */
141
+ function withTableTags(config, tables) {
142
+ const subjects = { ...config.subjects };
143
+ const realtimeTables = [...config.realtime.tables];
144
+ const realtimeGlobal = [...config.realtime.global];
145
+ const realtimeUsers = { ...config.realtime.users };
146
+ const vectorSearch = [...config.vectorSearch];
147
+ const json = { ...config.json };
148
+ const appTables = { ...config.appTables };
149
+ const fromTags = /* @__PURE__ */ new Set();
150
+ const eventTables = /* @__PURE__ */ new Set();
151
+ let changed = false;
152
+ for (const table of tables) {
153
+ if (!config.schemas.includes(table.schema)) continue;
154
+ const { tags } = parseBsbComment(table.comment);
155
+ if (tags.length === 0) continue;
156
+ const qualified = `${table.schema}.${table.name}`;
157
+ const short = table.schema === "public" ? table.name : qualified;
158
+ const names = /* @__PURE__ */ new Set([short, qualified]);
159
+ for (const tag of tags) if (tag.name === "subject") {
160
+ const type = text(tag.args["type"]) ?? table.name;
161
+ if (subjects[type] === void 0) {
162
+ subjects[type] = subjectFromTag(tag.args, short);
163
+ changed = true;
164
+ }
165
+ } else if (tag.name === "realtime" && !realtimeTables.some((each) => names.has(each))) {
166
+ realtimeTables.push(short);
167
+ const user = text(tag.args["user"]);
168
+ if (tag.args["global"] === true) realtimeGlobal.push(short);
169
+ if (user !== void 0) realtimeUsers[short] = user;
170
+ changed = true;
171
+ } else if (tag.name === "json") for (const [column, value] of Object.entries(tag.args)) {
172
+ const key = `${short}.${column}`;
173
+ const taken = [key, `${qualified}.${column}`].some((each) => each in json);
174
+ if (typeof value === "string" && !taken) {
175
+ json[key] = value.startsWith(IMPORT_PREFIX) ? { import: value.slice(7) } : { type: value };
176
+ changed = true;
177
+ }
178
+ }
179
+ else if (tag.name === "encrypted" && table.schema === "public") for (const [column, value] of Object.entries(tag.args)) {
180
+ const type = value === true ? "text" : value;
181
+ const own = appTables[table.name];
182
+ const existing = own?.columns?.[column];
183
+ const key = `${table.name}.${column}`;
184
+ if (isColumnType(type) && (existing === void 0 || fromTags.has(key))) {
185
+ fromTags.add(key);
186
+ const entry = {
187
+ ...existing,
188
+ type,
189
+ encrypted: true
190
+ };
191
+ appTables[table.name] = {
192
+ ...own,
193
+ columns: {
194
+ ...own?.columns,
195
+ [column]: entry
196
+ }
197
+ };
198
+ changed = true;
199
+ }
200
+ }
201
+ else if (tag.name === "server" && table.schema === "public") for (const column of Object.keys(tag.args)) {
202
+ const own = appTables[table.name];
203
+ const existing = own?.columns?.[column];
204
+ const key = `${table.name}.${column}`;
205
+ if (existing === void 0 || fromTags.has(key)) {
206
+ fromTags.add(key);
207
+ const entry = {
208
+ type: "text",
209
+ ...existing,
210
+ access: "server"
211
+ };
212
+ appTables[table.name] = {
213
+ ...own,
214
+ columns: {
215
+ ...own?.columns,
216
+ [column]: entry
217
+ }
218
+ };
219
+ changed = true;
220
+ }
221
+ }
222
+ else if (tag.name === "events" && table.schema === "public" && appTables[table.name]?.events === void 0) {
223
+ const on = list(tag.args["on"]).filter(isEventKind);
224
+ const include = list(tag.args["include"]);
225
+ const events = on.length === 0 && include.length === 0 ? true : {
226
+ ...on.length === 0 ? {} : { on },
227
+ ...include.length === 0 ? {} : { include }
228
+ };
229
+ appTables[table.name] = {
230
+ ...appTables[table.name],
231
+ events
232
+ };
233
+ eventTables.add(table.name);
234
+ changed = true;
235
+ } else if (tag.name === "vector-search" && !vectorSearch.some((each) => names.has(each.table))) {
236
+ const column = text(tag.args["column"]);
237
+ const distance = text(tag.args["distance"]) ?? "cosine";
238
+ if (column !== void 0 && isDistance(distance)) {
239
+ vectorSearch.push({
240
+ table: short,
241
+ column,
242
+ distance
243
+ });
244
+ changed = true;
245
+ }
246
+ }
247
+ }
248
+ for (const name of eventTables) {
249
+ const type = Object.entries(subjects).find(([, subject]) => subject.table === name || subject.table === `public.${name}`)?.[0];
250
+ if (type !== void 0) appTables[name] = {
251
+ ...appTables[name],
252
+ subject: { type }
253
+ };
254
+ }
255
+ return changed ? {
256
+ ...config,
257
+ subjects,
258
+ vectorSearch,
259
+ json,
260
+ appTables,
261
+ realtime: {
262
+ ...config.realtime,
263
+ tables: realtimeTables,
264
+ global: realtimeGlobal,
265
+ users: realtimeUsers
266
+ }
267
+ } : config;
268
+ }
269
+ //#endregion
18
270
  //#region ../../node_modules/.pnpm/rc9@3.1.0/node_modules/rc9/dist/_chunks/libs/flat.mjs
19
271
  function isBuffer(obj) {
20
272
  return obj && obj.constructor && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);
@@ -693,13 +945,14 @@ function _isDirectory(path) {
693
945
  */
694
946
  const valueMapsSchema = record(string(), record(string(), record(string(), nullable(union([string(), array(string())])))));
695
947
  /**
696
- * `records.<type>.permissions`: action to a key, or to `{ key, rows, owner }`.
697
- * The subject registry checks the names.
948
+ * `records.<type>.permissions`: action to a key, or to `{ key, rows, owner,
949
+ * also }`. The subject registry checks the names.
698
950
  */
699
951
  const subjectPermissionsSchema = record(string(), union([string(), strictObject({
700
952
  key: optional(string()),
701
953
  rows: optional(string()),
702
- owner: optional(string())
954
+ owner: optional(string()),
955
+ also: optional(string())
703
956
  })]));
704
957
  /** `records.<type>.search`. The subject registry checks the names. */
705
958
  const subjectSearchSchema = strictObject({
@@ -714,13 +967,19 @@ const subjectSearchSchema = strictObject({
714
967
  watch: optional(array(strictObject({
715
968
  table: string(),
716
969
  key: string(),
717
- via: optional(string())
970
+ via: optional(string()),
971
+ through: optional(array(strictObject({
972
+ table: string(),
973
+ from: string(),
974
+ to: string()
975
+ })))
718
976
  })))
719
977
  });
720
978
  //#endregion
721
979
  //#region src/cli/config-moved.ts
722
980
  /** Where each top-level key of a 0.14 config moved in 0.15. */
723
981
  const MOVED_KEYS = new Map([...Object.entries(CONFIG_GROUPS).flatMap(([group, keys]) => keys.filter((key) => key !== "tables").map((key) => [key, `${group}.${key}`])), ...RENAMED_CONFIG_KEYS.map(([grouped, flat]) => [flat, grouped])]);
982
+ const TABLES_REMOVED = "removed in 0.28: tables are SQL in `supabase/schemas` with `@bsb` tags in the table comment; run `better-supabase migrate schema-first`";
724
983
  /** `sql` keys that moved before 0.15, with where they went. */
725
984
  const MOVED_SQL_KEYS = [["modules", "moved to the top-level `blocks` key in 0.9; run `better-supabase codemod 0.9`"], ["naming", "`sql.naming.tenant` moved to `blocks.memberships.names.organization`"]];
726
985
  /** Moved `sql` keys in one config block, under `sql` or `database.sql`. */
@@ -731,7 +990,13 @@ function movedSqlIssues(prefix, block) {
731
990
  }
732
991
  const SCAFFOLD_REMOVED = "removed in 0.15 with `better-supabase scaffold api`; delete it. `defineApi` includes every table and block instance, and `createOrpc(betterSupabase).router(api)` serves it: https://bettersupabase.com/docs/frameworks/orpc#serve-the-api";
733
992
  /** Top-level keys 0.15 removed, with what replaces them. */
734
- const REMOVED_KEYS = /* @__PURE__ */ new Map([["plugins", "removed in 0.15: the updated-at, created-by, trash and memberships blocks carry these columns now; run `better-supabase codemod 0.15`"], ["scaffold", SCAFFOLD_REMOVED]]);
993
+ const REMOVED_KEYS = /* @__PURE__ */ new Map([
994
+ ["plugins", "removed in 0.15: the updated-at, created-by, trash and memberships blocks carry these columns now; run `better-supabase codemod 0.15`"],
995
+ ["scaffold", SCAFFOLD_REMOVED],
996
+ ["tables", TABLES_REMOVED],
997
+ ["appTables", TABLES_REMOVED],
998
+ ["records", "renamed to `subjects` in 0.28; rename the key. A table's subject now comes from `@bsb subject` in its comment"]
999
+ ]);
735
1000
  const RECORD_TYPES_MOVED = "renamed to `gen.recordTypes` in 0.15; run `better-supabase codemod 0.15`";
736
1001
  /** Keys of the flat 0.14 config in one config block. */
737
1002
  function movedGroupIssues(prefix, block) {
@@ -1390,8 +1655,7 @@ const ENTRIES = {
1390
1655
  "entitlements"
1391
1656
  ])
1392
1657
  })),
1393
- records: FLAT.subjects,
1394
- tables: FLAT.appTables,
1658
+ subjects: FLAT.subjects,
1395
1659
  blocks: FLAT.blocks,
1396
1660
  adapters: FLAT.integrations,
1397
1661
  gen: optional(strictObject({
@@ -1508,6 +1772,28 @@ function databaseUrlCredential(config, env, fromStdin) {
1508
1772
  ]);
1509
1773
  }
1510
1774
  //#endregion
1775
+ //#region src/cli/schema-tags.ts
1776
+ /** The `@bsb` table comments in the project's declarative schema files. */
1777
+ async function schemaTagComments(config) {
1778
+ const toml = await readSupabaseToml(config.root);
1779
+ const { files } = await schemaPaths(config.root, toml, sqlWorkflow(config, toml));
1780
+ return (await Promise.all(files.map((path) => readFile(resolve(config.root, path), "utf-8")))).flatMap((sql) => tableTagComments(sql));
1781
+ }
1782
+ /**
1783
+ * `config` with the features the schema files' `@bsb` table comments turn on
1784
+ * (ADR 0102), so the SQL modules, `gen` and doctor read the same config. A key
1785
+ * the config sets itself wins. `appTables` stays as declared: `encrypted` and
1786
+ * `events` tags describe tables whose SQL the files already hold, and `gen`
1787
+ * reads them from the snapshot.
1788
+ */
1789
+ async function withSchemaTags(config) {
1790
+ const tagged = withTableTags(config, await schemaTagComments(config));
1791
+ return tagged === config ? config : {
1792
+ ...tagged,
1793
+ appTables: config.appTables
1794
+ };
1795
+ }
1796
+ //#endregion
1511
1797
  //#region src/cli/config.ts
1512
1798
  const CONFIG_FILES = [
1513
1799
  "better-supabase.config.ts",
@@ -1559,6 +1845,26 @@ function mergeConfig(base, override) {
1559
1845
  return merged;
1560
1846
  }
1561
1847
  /**
1848
+ * A config without the removed top-level `tables` and `records` keys: the
1849
+ * tables as `appTables`, and the records merged into `subjects`. `migrate
1850
+ * schema-first` reads them to write the tables as SQL.
1851
+ */
1852
+ function takeLegacyTables(config) {
1853
+ if (!isPlainObject(config)) return {};
1854
+ const { tables, appTables, records, ...rest } = config;
1855
+ const subjects = isPlainObject(records) ? records : void 0;
1856
+ return {
1857
+ config: subjects === void 0 ? rest : {
1858
+ ...rest,
1859
+ subjects: {
1860
+ ...subjects,
1861
+ ...isPlainObject(rest["subjects"]) ? rest["subjects"] : {}
1862
+ }
1863
+ },
1864
+ appTables: isPlainObject(tables) ? tables : appTables
1865
+ };
1866
+ }
1867
+ /**
1562
1868
  * The config with the `environment` blocks merged in: `$env.<name>`, then the
1563
1869
  * `$development`, `$production`, `$test` or `$ci` shorthand. Every `$` key is
1564
1870
  * dropped from the result.
@@ -1594,7 +1900,7 @@ function defaultConfig(cwd, explicit, environment, path = discoverConfig(cwd, ex
1594
1900
  * `--config` keeps `cwd` as the root. `path` is the file `discoverConfig`
1595
1901
  * found, for callers that already looked it up.
1596
1902
  */
1597
- async function loadConfig(cwd, explicit, environment, path = discoverConfig(cwd, explicit)) {
1903
+ async function loadConfig(cwd, explicit, environment, path = discoverConfig(cwd, explicit), options = {}) {
1598
1904
  const withEnvironment = (resolved) => environment === void 0 ? resolved : {
1599
1905
  ...resolved,
1600
1906
  environment
@@ -1612,11 +1918,16 @@ async function loadConfig(cwd, explicit, environment, path = discoverConfig(cwd,
1612
1918
  extend: false,
1613
1919
  giget: false
1614
1920
  });
1615
- if (!isConfig(config)) {
1616
- const issues = configIssues(config);
1921
+ const legacy = options.legacyTables === true ? takeLegacyTables(config) : {};
1922
+ const current = legacy.config ?? config;
1923
+ if (!isConfig(current)) {
1924
+ const issues = configIssues(current);
1617
1925
  throw new CliError("config_invalid", `${display(cwd, path)} is not a valid config:\n${issues.map((issue) => ` ${issue}`).join("\n")}`, { issues });
1618
1926
  }
1619
- return withEnvironment(resolveConfig(applyEnvironment(config, environment), explicit ? cwd : dirname(path)));
1927
+ return withEnvironment(await withSchemaTags(resolveConfig({
1928
+ ...applyEnvironment(current, environment),
1929
+ ...legacy.appTables === void 0 ? {} : { appTables: legacy.appTables }
1930
+ }, explicit ? cwd : dirname(path))));
1620
1931
  }
1621
1932
  /** `[db] port` or `[api] port` from `supabase/config.toml`. */
1622
1933
  async function readSupabasePort(root, section) {
@@ -1686,4 +1997,4 @@ async function statusDatabaseUrl(root, env, stack, noPort) {
1686
1997
  });
1687
1998
  }
1688
1999
  //#endregion
1689
- export { findConfig as a, readSupabasePort as c, GEN_TASKS as d, INTEGRATIONS as f, discoverConfig as i, stdinDatabaseUrl as l, databaseUrl as n, importExport as o, isGenTask as p, defaultConfig as r, loadConfig as s, applyEnvironment as t, accessToken as u };
2000
+ export { findConfig as a, readSupabasePort as c, GEN_TASKS as d, INTEGRATIONS as f, subjectTagArgs as h, discoverConfig as i, stdinDatabaseUrl as l, withTableTags as m, databaseUrl as n, importExport as o, isGenTask as p, defaultConfig as r, loadConfig as s, applyEnvironment as t, accessToken as u };
@@ -1 +1 @@
1
- export { t as applyEnvironment, n as databaseUrl, r as defaultConfig, i as discoverConfig, a as findConfig, o as importExport, s as loadConfig, c as readSupabasePort, l as stdinDatabaseUrl } from "./config-BVfeG3A5.js";
1
+ export { t as applyEnvironment, n as databaseUrl, r as defaultConfig, i as discoverConfig, a as findConfig, o as importExport, s as loadConfig, c as readSupabasePort, l as stdinDatabaseUrl } from "./config-Cskysxp-.js";
@@ -1,5 +1,5 @@
1
1
  import { a as configObject, c as mask, g as skipSpace, i as closingIndex, l as properties, o as indentAt } from "./config-edit-CrWfk8s3.js";
2
- import { CONFIG_GROUPS, RENAMED_BLOCK_KEYS, RENAMED_CONFIG_KEYS, groupEntries, hasFlatTables } from "better-supabase/config";
2
+ import { CONFIG_GROUPS, RENAMED_BLOCK_KEYS, RENAMED_CONFIG_KEYS, groupEntries } from "better-supabase/config";
3
3
  //#region src/cli/codemod-record-bindings.ts
4
4
  /** Blocks whose record section export became `<block>Binding` in 0.15. */
5
5
  const BLOCK_BINDINGS = [
@@ -276,10 +276,9 @@ function regroup(source, open, organization) {
276
276
  members.set(group, [...members.get(group) ?? [], text]);
277
277
  if (!firstAt.has(group)) firstAt.set(group, at);
278
278
  };
279
- const flatTables = hasFlatTables(props.flatMap((prop) => prop.key ?? []));
280
279
  for (const [index, prop] of props.entries()) {
281
280
  const key = prop.key;
282
- const group = key === "tables" && !flatTables ? void 0 : GROUP_OF.get(key);
281
+ const group = GROUP_OF.get(key);
283
282
  const rename = RENAMED_CONFIG_KEYS.find(([, flat]) => flat === key);
284
283
  const isGroup = GROUP_KEYS.has(key);
285
284
  if (group === void 0 && !isGroup) {
@@ -1,6 +1,6 @@
1
1
  import { r as readIfExists } from "./io-DH1kcmmP.js";
2
- import { t as CACHE_DIR } from "./cache-1TfBy2K4.js";
3
- import { x as installedVersion } from "./snapshot-DdN5GlhH.js";
2
+ import { t as CACHE_DIR } from "./cache-DQZ09YOg.js";
3
+ import { x as installedVersion } from "./snapshot-CXgsUPGj.js";
4
4
  import { t as i } from "./jsonc-D5Fu67jw.js";
5
5
  import { resolve } from "node:path";
6
6
  import { createHash } from "node:crypto";
@@ -1,15 +1,16 @@
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 { n as CliError, r as errorText } from "./errors-BTe6A15O.js";
3
3
  import { i as isLocalDatabaseUrl, r as databaseHost } from "./agent-CbuPvI2x.js";
4
4
  import { t as display } from "./io-DH1kcmmP.js";
5
- import { l as stdinDatabaseUrl, n as databaseUrl } from "./config-BVfeG3A5.js";
5
+ import { l as stdinDatabaseUrl, n as databaseUrl } from "./config-Cskysxp-.js";
6
6
  import { d as readSupabaseToml, f as schemaPaths, n as declarativeSchemasDir, p as sqlWorkflow } from "./supabase-toml-CncmQbO0.js";
7
- import { r as supabaseCli } from "./exec--Q1ZEWUW.js";
7
+ import { r as supabaseCli } from "./exec-Ca5s-ygi.js";
8
8
  import { t as connect } from "./db-CQCLx7cx.js";
9
- import { r as STACK_ARG, t as DB_URL_STDIN_ARG } from "./source-args-CDmmFmFG.js";
10
- import { a as migrationFiles, i as isShadowFailure, o as migrationVersion, r as inStackDiff, t as MIGRATION_HEADER } from "./in-stack-diff-DQTW53Vf.js";
9
+ import { r as STACK_ARG, t as DB_URL_STDIN_ARG } from "./source-args-v8ljFDfc.js";
10
+ import { a as migrationFiles, i as isShadowFailure, o as migrationVersion, r as inStackDiff, t as MIGRATION_HEADER } from "./in-stack-diff-Cp-tVPj2.js";
11
11
  import { dirname, join, resolve } from "node:path";
12
12
  import { mkdir, readFile, writeFile } from "node:fs/promises";
13
+ import { parseRenameHints } from "better-supabase/create";
13
14
  //#region src/cli/commands/db.ts
14
15
  const ARGS = {
15
16
  file: {
@@ -98,15 +99,22 @@ const DIFF_ARGS = {
98
99
  },
99
100
  "in-stack": {
100
101
  type: "boolean",
101
- description: "Diff inside the running stack with pg-delta, without the Supabase CLI's shadow database"
102
+ description: "Diff inside the running stack with pg-delta's library plan, without the Supabase CLI's shadow database"
103
+ },
104
+ "allow-data-loss": {
105
+ type: "boolean",
106
+ description: "Write the migration even when it drops tables or columns, or changes a column type"
102
107
  }
103
108
  };
104
109
  const DEFAULT_DIFF_DEPS = {
105
110
  supabase: (args, root, env) => supabaseCli(args, root, env),
106
111
  inStackDiff,
107
- now: () => /* @__PURE__ */ new Date(),
108
112
  log: () => {}
109
113
  };
114
+ /** The renames recorded as `-- bsb: rename old -> new` in the migrations. */
115
+ async function renameHints(root, migrations) {
116
+ return (await Promise.all(migrations.map((file) => readFile(join(root, file), "utf-8")))).flatMap((text) => parseRenameHints(text));
117
+ }
110
118
  /**
111
119
  * The Supabase CLI's diff for the workflow. pg-delta's `declarative sync`
112
120
  * always writes a migration, so printing a diff under pg-delta runs in the
@@ -146,7 +154,12 @@ async function runDbDiff(config, args, env, deps = DEFAULT_DIFF_DEPS) {
146
154
  if (workflow === "migrations") throw new CliError("usage", "db diff turns declarative schema files into a migration, and this project writes migrations directly (database.sql.workflow = migrations).");
147
155
  let fellBack = false;
148
156
  const command = cliDiffCommand(workflow, name);
149
- if (args["in-stack"] !== true && command !== void 0) {
157
+ const stack = args.stack ?? env.BSB_STACK;
158
+ const url = await databaseUrl(config, env, "", stack).catch((cause) => {
159
+ if (args["in-stack"] === true) throw cause;
160
+ return null;
161
+ });
162
+ if (!(args["in-stack"] === true || workflow === "pg-delta" && url !== null && isLocalDatabaseUrl(url)) && command !== void 0) {
150
163
  const result = await deps.supabase(command, config.root, env);
151
164
  if (result.code === 0) return {
152
165
  code: 0,
@@ -169,22 +182,33 @@ async function runDbDiff(config, args, env, deps = DEFAULT_DIFF_DEPS) {
169
182
  fellBack = true;
170
183
  deps.log("The Supabase CLI could not start its shadow database (no shared memory segment left), so db diff diffs inside the running stack. better-supabase dev stack prune frees segments.");
171
184
  }
172
- const url = await databaseUrl(config, env, void 0, args.stack ?? env.BSB_STACK);
173
- if (!isLocalDatabaseUrl(url)) throw new CliError("usage", `db diff --in-stack works on a local stack, and the database is ${databaseHost(url)}.`);
185
+ if (url === null || !isLocalDatabaseUrl(url)) throw new CliError("usage", `db diff --in-stack works on a local stack, and the database is ${url === null ? "unknown" : databaseHost(url)}.`);
174
186
  const dir = toml?.dir ?? "supabase";
175
- const sql = await deps.inStackDiff({
187
+ const migrations = await migrationFiles(config.root, dir);
188
+ const result = await deps.inStackDiff({
176
189
  url,
177
190
  root: config.root,
178
191
  env,
179
192
  files: (await schemaPaths(config.root, toml, workflow)).files,
180
193
  schemasDir: declarativeSchemasDir(toml, workflow),
181
- migrations: await migrationFiles(config.root, dir),
194
+ migrations,
195
+ allowDataLoss: args["allow-data-loss"] === true,
196
+ hints: await renameHints(config.root, migrations),
182
197
  log: deps.log
183
198
  });
199
+ const { sql } = result;
200
+ for (const issue of result.issues) if (issue.severity !== "error") deps.log(issue.message);
184
201
  const data = {
185
202
  engine: "in-stack",
186
203
  fellBack,
187
- changes: sql !== ""
204
+ changes: sql !== "",
205
+ issues: result.issues
206
+ };
207
+ if (result.gate.blocked) return {
208
+ code: 1,
209
+ errorCode: "check_failed",
210
+ error: `The diff destroys data, so nothing was written:\n${result.gate.destructive.map((action) => ` ${action.sql.split("\n")[0] ?? ""}`).join("\n")}\nRename with \`-- bsb: rename old -> new\` in a migration, or run again with --allow-data-loss.`,
211
+ data
188
212
  };
189
213
  if (sql === "") return {
190
214
  code: 0,
@@ -196,7 +220,7 @@ async function runDbDiff(config, args, env, deps = DEFAULT_DIFF_DEPS) {
196
220
  output: sql,
197
221
  data
198
222
  };
199
- const path = join(config.root, dir, "migrations", `${migrationVersion(deps.now())}_${name}.sql`);
223
+ const path = join(config.root, dir, "migrations", `${migrationVersion(/* @__PURE__ */ new Date())}_${name}.sql`);
200
224
  await mkdir(dirname(path), { recursive: true });
201
225
  await writeFile(path, `${MIGRATION_HEADER}\n${sql}\n`);
202
226
  return {