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,9 +1,9 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { M as Casing, P as ClaimsMeta, T as AccessBucketPolicy, _t as BucketLifecycle, j as BucketPolicyName, ot as SchemaMeta } from "./types-DFdg_4yN.js";
3
- import { D as OwnTablePolicies, E as NamedInstance, I as TablesOf, L as BlockNameRegistry, O as ResolvedBlock, T as InstanceOn, _ as BlockName, a as AuthorizationProvider, d as AccessBlockConfig, g as BlockMode, h as BlockConfigOf, m as BlockConfig, n as AuthorizationMembership, p as AnyBlocksConfig, r as AuthorizationOperation, s as AuthorizationRoleSource, t as AuthorizationFunctions, v as BlockScope, w as InstanceKeys, x as DisabledRow, y as BlocksConfig } from "./authorization-BJV2i8xB.js";
4
- import { Mn as EntityNames, Nn as EntityNoun, Pn as EntityRename, R as PortName, Ut as ActionDescriptor, Xt as BlockSchedule, Zt as DefaultAutomation, _ as BlockProvider, g as BlockEnvKey, i as BlockCategory, y as BlockWorker } from "./define-block-DibVN37N.js";
2
+ import { M as Casing, P as ClaimsMeta, T as AccessBucketPolicy, _t as BucketLifecycle, j as BucketPolicyName, ot as SchemaMeta } from "./types-CPl9uJ0G.js";
3
+ import { D as OwnTablePolicies, E as NamedInstance, I as TablesOf, L as BlockNameRegistry, O as ResolvedBlock, T as InstanceOn, _ as BlockName, a as AuthorizationProvider, d as AccessBlockConfig, g as BlockMode, h as BlockConfigOf, m as BlockConfig, n as AuthorizationMembership, p as AnyBlocksConfig, r as AuthorizationOperation, s as AuthorizationRoleSource, t as AuthorizationFunctions, v as BlockScope, w as InstanceKeys, x as DisabledRow, y as BlocksConfig } from "./authorization-C7nuWMuB.js";
4
+ import { Mn as EntityNames, Nn as EntityNoun, Pn as EntityRename, R as PortName, Ut as ActionDescriptor, Xt as BlockSchedule, Zt as DefaultAutomation, _ as BlockProvider, g as BlockEnvKey, i as BlockCategory, y as BlockWorker } from "./define-block-DWVZSZv1.js";
5
5
  import { a as ScalarKind, i as FieldSpec } from "./table-schema-BlF6k62Q.js";
6
- import { i as SubjectsConfig } from "./subjects-NomQg6Eg.js";
6
+ import { i as SubjectsConfig } from "./subjects-BYCL-6hA.js";
7
7
  import { i as FIELD_FORMAT_NAMES, s as FieldFormatName } from "./field-formats-CAFNkKSN.js";
8
8
  import { t as GuestAction } from "./guest-actions-1T1DeS5Y.js";
9
9
  //#region src/config/names.d.ts
@@ -1100,6 +1100,13 @@ interface AppColumnConfig {
1100
1100
  readonly references?: AppReference;
1101
1101
  /** What the column holds; see `APP_COLUMN_FORMATS`. */
1102
1102
  readonly format?: AppColumnFormat;
1103
+ /**
1104
+ * The schema-qualified domain the column takes as its type, such as
1105
+ * `bsb.email`, in place of the format's inline check. Only `migrate
1106
+ * schema-first` and the preset writers set it (ADR 0102); it isn't a config
1107
+ * key.
1108
+ */
1109
+ readonly domain?: string;
1103
1110
  /**
1104
1111
  * The values a `text` column (single select) or each element of a `text[]`
1105
1112
  * column (multi-select) may take, checked by the database.
@@ -1980,15 +1987,11 @@ interface BetterSupabaseConfig {
1980
1987
  readonly database?: DatabaseConfig;
1981
1988
  readonly auth?: AuthConfig;
1982
1989
  /**
1983
- * The app's record types: the entities blocks attach tags, comments, fields
1984
- * and ranks to, keyed by type name.
1985
- */
1986
- readonly records?: SubjectsConfig;
1987
- /**
1988
- * Tables the app owns, keyed by name, created in `public` by `better-supabase
1989
- * upgrade`. ADR 0040.
1990
+ * The app's subject types: the entities blocks attach tags, comments, fields
1991
+ * and ranks to, keyed by type name. A table the app owns becomes a subject
1992
+ * with an `@bsb subject` tag in its table comment (ADR 0102).
1990
1993
  */
1991
- readonly tables?: AppTablesInput;
1994
+ readonly subjects?: SubjectsConfig;
1992
1995
  /**
1993
1996
  * The blocks to install and keep in sync: a list of names, or an object keyed
1994
1997
  * by block name whose values set each block's ownership, names and options.
@@ -2701,34 +2704,13 @@ declare function expandPreset<const C extends BetterSupabaseConfig>(config: C):
2701
2704
  //#endregion
2702
2705
  //#region src/config/references.d.ts
2703
2706
  /**
2704
- * A logical table of a block the registry knows, as `tables` columns reference
2707
+ * A logical table of a block the registry knows, as a column reference names
2705
2708
  * it: `{ block: "tasks", table: "items" }`.
2706
2709
  */
2707
2710
  type BlockTableReference = { readonly [M in keyof BlockNameRegistry]: {
2708
2711
  readonly block: M;
2709
2712
  readonly table: TablesOf<M>;
2710
2713
  }; }[keyof BlockNameRegistry];
2711
- type AppTablesOf<C> = C extends {
2712
- readonly tables: infer T extends object;
2713
- } ? T : Record<never, never>;
2714
- /** The app tables a literal config declares, or `string` without any. */
2715
- type AppTableNames<C> = [keyof AppTablesOf<C>] extends [never] ? string : (keyof AppTablesOf<C> & string) | "auth.users";
2716
- /** What a column of `C`'s app tables may reference. */
2717
- type TypedReference<C> = ({
2718
- readonly table: AppTableNames<C>;
2719
- } | BlockTableReference) & {
2720
- readonly onDelete?: AppOnDeleteAction;
2721
- };
2722
- type ColumnsOfTable<T> = T extends {
2723
- readonly columns: infer K extends object;
2724
- } ? K : Record<never, never>;
2725
- type AppTableReferences<C> = { readonly [T in keyof AppTablesOf<C>]?: {
2726
- readonly columns?: { readonly [K in keyof ColumnsOfTable<AppTablesOf<C>[T]>]?: ColumnsOfTable<AppTablesOf<C>[T]>[K] extends {
2727
- readonly references: unknown;
2728
- } ? {
2729
- readonly references?: TypedReference<C>;
2730
- } : unknown; };
2731
- }; };
2732
2714
  type RolesOf<C> = C extends {
2733
2715
  readonly blocks: {
2734
2716
  readonly permissions: {
@@ -2784,13 +2766,11 @@ type InstanceReferences<C> = {
2784
2766
  }; };
2785
2767
  };
2786
2768
  /**
2787
- * What `defineConfig` checks a literal config against: block tables in `tables`
2788
- * references, app table names, bucket names in `gen.storagePaths`, the role
2789
- * names other blocks take from `blocks.permissions.roles`, and each named
2790
- * instance's options and `uses`.
2769
+ * What `defineConfig` checks a literal config against: bucket names in
2770
+ * `gen.storagePaths`, the role names other blocks take from
2771
+ * `blocks.permissions.roles`, and each named instance's options and `uses`.
2791
2772
  */
2792
2773
  type ConfigReferences<C> = {
2793
- readonly tables?: AppTableReferences<C>;
2794
2774
  readonly gen?: {
2795
2775
  readonly storagePaths?: Readonly<Record<string, BucketName<C>>>;
2796
2776
  };
@@ -2807,8 +2787,16 @@ declare const CONFIG_SCHEMA_URL = "https://unpkg.com/better-supabase/schemas/con
2807
2787
  * other blocks name.
2808
2788
  */
2809
2789
  declare function defineConfig<const C extends BetterSupabaseConfig>(config: C & NoInfer<ConfigReferences<C>>): ExpandedConfig<C>;
2790
+ /**
2791
+ * The grouped config plus the app tables a Create design and `migrate
2792
+ * schema-first` hand in. Tables are SQL files, so the public config has no key
2793
+ * for them (ADR 0102).
2794
+ */
2795
+ type ResolveInput = BetterSupabaseConfig & {
2796
+ readonly appTables?: AppTablesInput;
2797
+ };
2810
2798
  /** Applies defaults. Paths stay relative to `root`. */
2811
- declare function resolveConfig(input: BetterSupabaseConfig, root: string): ResolvedConfig;
2799
+ declare function resolveConfig(input: ResolveInput, root: string): ResolvedConfig;
2812
2800
  //#endregion
2813
2801
  //#region src/config/groups.d.ts
2814
2802
  type Entries = Record<string, unknown>;
@@ -2823,16 +2811,11 @@ declare const RENAMED_BLOCK_KEYS: Pairs;
2823
2811
  declare function blockEntrySource(entry: object): Entries;
2824
2812
  /**
2825
2813
  * The grouped config in the flat shape `resolveConfig` reads: every group's
2826
- * keys at the top level, `records`, `tables` and `adapters` under their flat
2827
- * names, `auth.organization` as `claims.tenant` and `organization`, and the
2828
- * renamed block and app table keys under their flat names.
2814
+ * keys at the top level, `adapters` under its flat name, `auth.organization` as
2815
+ * `claims.tenant` and `organization`, and the renamed block and app table keys
2816
+ * under their flat names.
2829
2817
  */
2830
2818
  declare function flattenConfig(config: BetterSupabaseConfig): FlatConfig;
2831
- /**
2832
- * Whether a top-level `tables` is the generator overrides of a config written
2833
- * before 0.15 rather than the app tables of a grouped one.
2834
- */
2835
- declare function hasFlatTables(keys: readonly string[]): boolean;
2836
2819
  /** A flat config in the grouped shape: the inverse of `flattenConfig`. */
2837
2820
  declare function groupConfig(config: FlatConfig): BetterSupabaseConfig;
2838
2821
  /**
@@ -3211,6 +3194,97 @@ interface VectorSearchTable {
3211
3194
  readonly order?: string;
3212
3195
  }
3213
3196
  //#endregion
3197
+ //#region src/sql/schema-scan.d.ts
3198
+ /** Privileges one role gets on a table, from the policies that name it. */
3199
+ interface PolicyGrant {
3200
+ /** `schema.table`, unquoted; an unqualified name is in `public`. */
3201
+ readonly table: string;
3202
+ readonly role: "anon" | "authenticated";
3203
+ readonly privileges: readonly ("select" | "insert" | "update" | "delete")[];
3204
+ }
3205
+ /**
3206
+ * The tables `files` create (`create table`), as `schema.table`, in the order
3207
+ * they first appear. Only tables in `schemas` are kept.
3208
+ */
3209
+ declare function declaredTables(files: readonly {
3210
+ readonly text: string;
3211
+ }[], schemas: readonly string[]): string[];
3212
+ /** A view the app's files create. */
3213
+ interface DeclaredView {
3214
+ /** Its columns, or `undefined` when they can't be read (`select *`). */
3215
+ readonly columns: readonly string[] | undefined;
3216
+ /** Whether `insert`, `update` and `delete` reach the table under it. */
3217
+ readonly updatable: boolean;
3218
+ }
3219
+ /**
3220
+ * The views and materialized views `files` create, as `schema.view`, with their
3221
+ * columns and whether they are auto-updatable. A later `drop view` removes one.
3222
+ * Only views in `schemas` are kept.
3223
+ */
3224
+ declare function declaredViews(files: readonly {
3225
+ readonly text: string;
3226
+ }[], schemas: readonly string[]): ReadonlyMap<string, DeclaredView>;
3227
+ /**
3228
+ * The tables in `schemas` that `files` leave with row level security on: `alter
3229
+ * table ... enable row level security`, until a later `disable` or `drop
3230
+ * table`.
3231
+ */
3232
+ declare function rlsTables(files: readonly {
3233
+ readonly text: string;
3234
+ }[], schemas: readonly string[]): string[];
3235
+ /**
3236
+ * Columns each `create table` in `files` declares, as `schema.table` to
3237
+ * unquoted names. `like` and table constraints are skipped. Only tables in
3238
+ * `schemas` are kept.
3239
+ */
3240
+ declare function declaredTableColumns(files: readonly {
3241
+ readonly text: string;
3242
+ }[], schemas: readonly string[]): ReadonlyMap<string, ReadonlySet<string>>;
3243
+ /**
3244
+ * The declared type of each column of each `create table` in `files`, as
3245
+ * `schema.table` to unquoted column name to type. A type is lower-cased with
3246
+ * its spacing normalised, and a quoted part keeps its case without quotes. Only
3247
+ * tables in `schemas` are kept.
3248
+ */
3249
+ declare function declaredColumnTypes(files: readonly {
3250
+ readonly text: string;
3251
+ }[], schemas: readonly string[]): ReadonlyMap<string, ReadonlyMap<string, string>>;
3252
+ /**
3253
+ * The privileges the permissive policies in `files` imply, per table and role:
3254
+ * `for all` gives the four commands, `to public` (or no `to`) counts for
3255
+ * `authenticated` only, so `anon` needs a policy that names it. Restrictive
3256
+ * policies grant nothing. Only tables in `schemas` are kept.
3257
+ */
3258
+ declare function policyGrants(files: readonly {
3259
+ readonly text: string;
3260
+ }[], schemas: readonly string[]): PolicyGrant[];
3261
+ declare function extensionSchema(sources: readonly {
3262
+ readonly text: string;
3263
+ }[], extension: string): string | undefined;
3264
+ /**
3265
+ * The update trigger that keeps `updated_at` current on each table in `schemas`
3266
+ * the files create one on, by `schema.table`: its function is named like one
3267
+ * (`set_updated_at`, `moddatetime`, `touch_*`) or the files define it with
3268
+ * `new.updated_at :=`. Block triggers (`bsb_*`) don't count.
3269
+ */
3270
+ declare function declaredUpdatedAtTriggers(files: readonly {
3271
+ readonly text: string;
3272
+ }[], schemas: readonly string[]): Readonly<Record<string, string>>;
3273
+ /** A full btree index, by its name when it has one, and its leading columns. */
3274
+ interface OwnIndex {
3275
+ readonly name?: string;
3276
+ readonly columns: readonly string[];
3277
+ }
3278
+ /**
3279
+ * The leading columns of every full btree index the files give each table in
3280
+ * `schemas`: `create index` statements, and the primary keys and unique
3281
+ * constraints in `create table`. Partial indexes and other methods are left
3282
+ * out, since they don't answer every lookup.
3283
+ */
3284
+ declare function declaredIndexes(files: readonly {
3285
+ readonly text: string;
3286
+ }[], schemas: readonly string[]): ReadonlyMap<string, readonly OwnIndex[]>;
3287
+ //#endregion
3214
3288
  //#region src/sql/shared.d.ts
3215
3289
  /**
3216
3290
  * The name `addNotNullCheck` gives the check on `column` of `table`, both
@@ -3364,6 +3438,11 @@ interface BlockSql {
3364
3438
  readonly scope: "tenant" | "platform";
3365
3439
  readonly setting: string;
3366
3440
  }[];
3441
+ /**
3442
+ * Actions of the module's `OPERATIONS` this config never checks, so their
3443
+ * keys aren't reported to the authorization provider.
3444
+ */
3445
+ readonly unusedPermissions?: (ctx: BlockSqlContext) => readonly string[];
3367
3446
  /**
3368
3447
  * Functions granted to `anon` or `authenticated` only so the module's
3369
3448
  * policies and triggers can call them as the client. `api` writes no entry
@@ -3515,6 +3594,11 @@ interface BlockSqlLayout {
3515
3594
  readonly ownTables?: Readonly<Record<string, string>>;
3516
3595
  /** The columns of the tables in `ownTables`, where they are known. */
3517
3596
  readonly ownColumns?: Readonly<Record<string, readonly string[]>>;
3597
+ /**
3598
+ * The leading columns of each full btree index on a table in `ownTables`, by
3599
+ * `schema.table`. A block adds no plain index that one of them covers.
3600
+ */
3601
+ readonly ownIndexes?: Readonly<Record<string, readonly OwnIndex[]>>;
3518
3602
  /**
3519
3603
  * The entries of `ownTables` that are views or materialized views, by
3520
3604
  * `schema.view`, and whether Postgres can write through each one. A block
@@ -3577,7 +3661,7 @@ interface BlockSqlLayout {
3577
3661
  /** `sql.scope`: the scope of every block that sets none. Defaults to `tenant`. */
3578
3662
  readonly scope?: BlockScope;
3579
3663
  readonly blockTenantColumn?: string;
3580
- /** `config.records`: the app-wide subject registry (ADR 0020). */
3664
+ /** `config.subjects`: the app-wide subject registry (ADR 0020). */
3581
3665
  readonly subjects?: SubjectsConfig;
3582
3666
  /**
3583
3667
  * `config.appTables`: the tables the app owns, rendered after the blocks (ADR
@@ -3847,7 +3931,7 @@ interface BlockSqlTableLifecycle {
3847
3931
  readonly credentialSubject?: "app" | "user";
3848
3932
  }
3849
3933
  /**
3850
- * What makes an entity a `config.records` entry when the block is installed.
3934
+ * What makes an entity a `config.subjects` entry when the block is installed.
3851
3935
  * Columns are the table's logical columns; permissions are module actions.
3852
3936
  */
3853
3937
  interface BlockSqlEntitySubject {
@@ -4030,8 +4114,10 @@ interface BlockSqlContext extends BlockSqlValueMethods {
4030
4114
  readonly idType: BlockSqlIdType;
4031
4115
  readonly claims: ClaimsMeta;
4032
4116
  readonly modules: AnyBlocksConfig;
4033
- /** The app-wide subject registry (`config.records`). */
4117
+ /** The app-wide subject registry (`config.subjects`). */
4034
4118
  readonly subjects: SubjectsConfig;
4119
+ /** The provider's `rowsWith` template under the `provider` model. */
4120
+ readonly providerRowsWith: string | undefined;
4035
4121
  /**
4036
4122
  * The names of `config.appTables`, created in `public` after every block
4037
4123
  * file, so a block can't put a trigger on one (ADR 0043).
@@ -4243,4 +4329,4 @@ interface ExtraColumn {
4243
4329
  /** The contract's argument list with `{id}` resolved, as Postgres prints it. */
4244
4330
  declare function contractSignature(fn: BlockSqlContractFunction, idType: string): string;
4245
4331
  //#endregion
4246
- export { blockEntrySource as $, APP_COLUMN_ACCESS as $n, RpcTypeReference as $r, ResolvedExtensions as $t, ValibotGeneratorOptions as A, MigrationSafetyConfig as Ai, ExposePrivilege as An, CatalogIndex as Ar, GeneratedFile as At, jsonSchema as B, PRESETS as Bn, ForeignKeyAction as Br, GeneratorInputSchema as Bt, OwnView as C, presetValueLabel as Ci, TopicTriggerPayloadValueConfig as Cn, CatalogColumn as Cr, ResolvedPresetBlock as Ct, ZodFlavor as D, GenTask as Di, VectorSearchConfig as Dn, CatalogFunction as Dr, resolveJsonSchema as Dt, TableGrant as E, GenConfig as Ei, VectorDistance as En, CatalogForeignKey as Er, resolvePreset as Et, nuqs as F, GEN_TASKS as Fi, presetFromSpec as Fn, ExtrasDomain as Fr, GeneratorEntitySchemas as Ft, tenantClaimPaths as G, defaultPreset as Gn, PostgresColumn as Gr, JsonSchemaSource as Gt, ClaimPaths as H, PRESET_NAMES as Hn, SnapshotBucket as Hr, GeneratorModel as Ht, FactoriesGeneratorOptions as I, INTEGRATION_INFO as Ii, presetOfSpec as In, ExtrasFunction as Ir, GeneratorField as It, blockEntityRenames as J, CONFIG_DEFAULTS as Jn, RpcFunction as Jr, SourceConfig as Jt, BlockEntity as K, isPresetName as Kn, PostgresFunction as Kr, JsonTypeConfig as Kt, factories as L, INTEGRATION_NAMES as Li, presetSpec as Ln, ExtrasHook as Lr, GeneratorFunction as Lt, StandardSchemaGeneratorOptions as M, PowerSyncGenConfig as Mi, Privilege as Mn, CatalogTable as Mr, GeneratorBlock as Mt, standardSchema as N, SkillsAgent as Ni, ResolvedExpose as Nn, CatalogTrigger as Nr, GeneratorBlockEntity as Nt, ZodGeneratorOptions as O, IntegrationName as Oi, ColumnPrivilege as On, CatalogFunctionArg as Or, ClaimsConfig as Ot, NuqsGeneratorOptions as P, SkillsConfig as Pi, PresetSpec as Pn, CatalogUnique as Pr, GeneratorColumn as Pt, RENAMED_CONFIG_KEYS as Q, auditRegistrations as Qn, RpcReturnColumn as Qr, ResolvedConfig as Qt, JsonSchemaGeneratorOptions as R, IntegrationInfo as Ri, DEFAULT_PRESET_NAME as Rn, ExtrasHookFunction as Rr, GeneratorFunctionArg as Rt, BlockSqlUpgrade as S, presetField as Si, TopicTriggerLookupConfig as Sn, CatalogCheck as Sr, ResolvedPreset as St, notNullCheckName as T, EnvFileConfig as Ti, TopicTriggerValueConfig as Tn, CatalogEnum as Tr, presetBlockConflict as Tt, DEFAULT_CLAIMS as U, PresetGroup as Un, SnapshotExtras as Ur, GeneratorNoun as Ut, JsonSchemaTarget as V, PRESET_GROUPS as Vn, Snapshot as Vr, GeneratorJsonSchema as Vt, claimPaths as W, PresetName as Wn, GeneratorMetadata as Wr, GeneratorTable as Wt, CONFIG_GROUPS as X, sameTenantLayout as Xn, RpcFunctionOverload as Xr, DataHooksFramework as Xt, blockSubjectTypes as Y, DeclaredForeignKey as Yn, RpcFunctionArg as Yr, TableConfig as Yt, RENAMED_BLOCK_KEYS as Z, AuditedTable as Zn, RpcFunctionReturns as Zr, FlatConfig as Zt, BlockSqlDeprecation as _, PresetFramework as _i, ResolvedSqlConfig as _n, AppTableEvents as _r, expandPreset as _t, BlockSqlContext as a, PresetCatalogManifest as ai, BlockInput as an, AppColumnAccess as ar, defineConfig as at, BlockSqlLayout as b, PresetValueInfo as bi, SqlWorkflow as bn, AppTablesConfig as br, PresetConflict as bt, BlockSqlIdType as c, DEFAULT_CONVENTIONS as ci, EnvironmentConfig as cn, AppColumnType as cr, BlockTableReference as ct, MODULE_ID_TYPES as d, Preset as di, SqlInput as dn, AppReference as dr, RoleNames as dt, CORE_BLOCKS as ei, ApiConfig as en, APP_COLUMN_FORMATS as er, flattenConfig as et, contractSignature as f, PresetAccess as fi, ToolingConfig as fn, AppReferenceTarget as fr, TypedReference as ft, BlockSqlAccessProvider as g, PresetFieldValue as gi, RealtimeConfig as gn, AppTableEventKind as gr, conventionConfig as gt, BlockSql as h, PresetFieldKey as hi, BucketConfig as hn, AppTableConfig as hr, PresetInput as ht, BlockSqlAudit as i, PresetCatalogBlock as ii, BetterSupabaseConfig as in, APP_TABLE_EVENT_KINDS as ir, CONFIG_SCHEMA_URL as it, valibot as j, OpenApiConfig as ji, ExposeRole as jn, CatalogPolicy as jr, Generator as jt, zod as k, KeysConfig as ki, ExposeConfig as kn, CatalogGrant as kr, CodecsConfig as kt, BlockSqlNames as l, PRESET_FRAMEWORKS as li, GenGroupConfig as ln, AppLookupConfig as lr, BucketName as lt, moduleIdType as m, PresetField as mi, EntitlementsConfig as mn, AppRollupConfig as mr, ExpandedConfig as mt, AuditCategory as n, instancePrefix as ni, AppTablesInput as nn, APP_ON_DELETE_ACTIONS as nr, groupEntries as nt, BlockSqlContractFunction as o, PresetGlueItem as oi, BlocksInput as on, AppColumnConfig as or, resolveConfig as ot, isBlockSqlIdType as p, PresetConventions as pi, EntitlementPlansSource as pn, AppRollupAggregate as pr, ConfigConventions as pt, blockEntities as q, namedPreset as qn, PostgresFunctionArg as qr, RelationsConfig as qt, BlockSqlAction as r, PresetCatalog as ri, AuthConfig as rn, APP_ROLLUP_AGGREGATES as rr, hasFlatTables as rt, BlockSqlEmit as s, CONVENTION_FIELDS as si, DatabaseConfig as sn, AppColumnFormat as sr, AppTableNames as st, AUDIT_CATEGORIES as t, INSTANCE_NAME as ti, AppTableInput as tn, APP_COLUMN_TYPES as tr, groupConfig as tt, BlockSqlTableSpec as u, PRESET_TENANT_NAMES as ui, OrganizationConfig as un, AppOnDeleteAction as ur, ConfigReferences as ut, BlockSqlEntitlementsProvider as v, PresetPlatforms as vi, SeedConfig as vn, AppTableSubject as vr, presetConfig as vt, blockSqlVersion as w, DoctorConfig as wi, TopicTriggerTopicConfig as wn, CatalogColumnGrant as wr, listNames as wt, BlockSqlTestFile as x, integrationsForFramework as xi, TopicTriggerConfig as xn, Catalog as xr, PresetIntegration as xt, BlockSqlFile as y, PresetScope as yi, SqlConfig as yn, AppTableVersions as yr, presetOf as yt, buildJsonSchema as z, SKILLS_AGENTS as zi, NamedPreset as zn, ExtrasTable as zr, GeneratorInput as zt };
4332
+ export { JsonSchemaTarget as $, PresetGroup as $n, SnapshotExtras as $r, GeneratorNoun as $t, declaredIndexes as A, PresetValueInfo as Ai, SqlWorkflow as An, AppTablesConfig as Ar, PresetConflict as At, ZodGeneratorOptions as B, MigrationSafetyConfig as Bi, ExposePrivilege as Bn, CatalogIndex as Br, GeneratedFile as Bt, OwnView as C, PresetConventions as Ci, EntitlementPlansSource as Cn, AppRollupAggregate as Cr, ConfigConventions as Ct, OwnIndex as D, PresetFramework as Di, ResolvedSqlConfig as Dn, AppTableEvents as Dr, expandPreset as Dt, DeclaredView as E, PresetFieldValue as Ei, RealtimeConfig as En, AppTableEventKind as Er, conventionConfig as Et, extensionSchema as F, EnvFileConfig as Fi, TopicTriggerValueConfig as Fn, CatalogEnum as Fr, presetBlockConflict as Ft, standardSchema as G, GEN_TASKS as Gi, presetFromSpec as Gn, ExtrasDomain as Gr, GeneratorEntitySchemas as Gt, ValibotGeneratorOptions as H, PowerSyncGenConfig as Hi, Privilege as Hn, CatalogTable as Hr, GeneratorBlock as Ht, policyGrants as I, GenConfig as Ii, VectorDistance as In, CatalogForeignKey as Ir, resolvePreset as It, FactoriesGeneratorOptions as J, IntegrationInfo as Ji, DEFAULT_PRESET_NAME as Jn, ExtrasHookFunction as Jr, GeneratorFunctionArg as Jt, NuqsGeneratorOptions as K, INTEGRATION_INFO as Ki, presetOfSpec as Kn, ExtrasFunction as Kr, GeneratorField as Kt, rlsTables as L, GenTask as Li, VectorSearchConfig as Ln, CatalogFunction as Lr, resolveJsonSchema as Lt, declaredTables as M, presetField as Mi, TopicTriggerLookupConfig as Mn, CatalogCheck as Mr, ResolvedPreset as Mt, declaredUpdatedAtTriggers as N, presetValueLabel as Ni, TopicTriggerPayloadValueConfig as Nn, CatalogColumn as Nr, ResolvedPresetBlock as Nt, PolicyGrant as O, PresetPlatforms as Oi, SeedConfig as On, AppTableSubject as Or, presetConfig as Ot, declaredViews as P, DoctorConfig as Pi, TopicTriggerTopicConfig as Pn, CatalogColumnGrant as Pr, listNames as Pt, jsonSchema as Q, PRESET_NAMES as Qn, SnapshotBucket as Qr, GeneratorModel as Qt, TableGrant as R, IntegrationName as Ri, ColumnPrivilege as Rn, CatalogFunctionArg as Rr, ClaimsConfig as Rt, BlockSqlUpgrade as S, PresetAccess as Si, ToolingConfig as Sn, AppReferenceTarget as Sr, RoleNames as St, notNullCheckName as T, PresetFieldKey as Ti, BucketConfig as Tn, AppTableConfig as Tr, PresetInput as Tt, valibot as U, SkillsAgent as Ui, ResolvedExpose as Un, CatalogTrigger as Ur, GeneratorBlockEntity as Ut, zod as V, OpenApiConfig as Vi, ExposeRole as Vn, CatalogPolicy as Vr, Generator as Vt, StandardSchemaGeneratorOptions as W, SkillsConfig as Wi, PresetSpec as Wn, CatalogUnique as Wr, GeneratorColumn as Wt, JsonSchemaGeneratorOptions as X, PRESETS as Xn, ForeignKeyAction as Xr, GeneratorInputSchema as Xt, factories as Y, SKILLS_AGENTS as Yi, NamedPreset as Yn, ExtrasTable as Yr, GeneratorInput as Yt, buildJsonSchema as Z, PRESET_GROUPS as Zn, Snapshot as Zr, GeneratorJsonSchema as Zt, BlockSqlDeprecation as _, CONVENTION_FIELDS as _i, DatabaseConfig as _n, AppColumnFormat as _r, defineConfig as _t, BlockSqlContext as a, RpcFunctionArg as ai, TableConfig as an, DeclaredForeignKey as ar, blockEntities as at, BlockSqlLayout as b, PRESET_TENANT_NAMES as bi, OrganizationConfig as bn, AppOnDeleteAction as br, BucketName as bt, BlockSqlIdType as c, RpcReturnColumn as ci, ResolvedConfig as cn, auditRegistrations as cr, CONFIG_GROUPS as ct, MODULE_ID_TYPES as d, INSTANCE_NAME as di, AppTableInput as dn, APP_COLUMN_TYPES as dr, blockEntrySource as dt, GeneratorMetadata as ei, GeneratorTable as en, PresetName as er, ClaimPaths as et, contractSignature as f, instancePrefix as fi, AppTablesInput as fn, APP_ON_DELETE_ACTIONS as fr, flattenConfig as ft, BlockSqlAccessProvider as g, PresetGlueItem as gi, BlocksInput as gn, AppColumnConfig as gr, ResolveInput as gt, BlockSql as h, PresetCatalogManifest as hi, BlockInput as hn, AppColumnAccess as hr, CONFIG_SCHEMA_URL as ht, BlockSqlAudit as i, RpcFunction as ii, SourceConfig as in, CONFIG_DEFAULTS as ir, BlockEntity as it, declaredTableColumns as j, integrationsForFramework as ji, TopicTriggerConfig as jn, Catalog as jr, PresetIntegration as jt, declaredColumnTypes as k, PresetScope as ki, SqlConfig as kn, AppTableVersions as kr, presetOf as kt, BlockSqlNames as l, RpcTypeReference as li, ResolvedExtensions as ln, APP_COLUMN_ACCESS as lr, RENAMED_BLOCK_KEYS as lt, moduleIdType as m, PresetCatalogBlock as mi, BetterSupabaseConfig as mn, APP_TABLE_EVENT_KINDS as mr, groupEntries as mt, AuditCategory as n, PostgresFunction as ni, JsonTypeConfig as nn, isPresetName as nr, claimPaths as nt, BlockSqlContractFunction as o, RpcFunctionOverload as oi, DataHooksFramework as on, sameTenantLayout as or, blockEntityRenames as ot, isBlockSqlIdType as p, PresetCatalog as pi, AuthConfig as pn, APP_ROLLUP_AGGREGATES as pr, groupConfig as pt, nuqs as q, INTEGRATION_NAMES as qi, presetSpec as qn, ExtrasHook as qr, GeneratorFunction as qt, BlockSqlAction as r, PostgresFunctionArg as ri, RelationsConfig as rn, namedPreset as rr, tenantClaimPaths as rt, BlockSqlEmit as s, RpcFunctionReturns as si, FlatConfig as sn, AuditedTable as sr, blockSubjectTypes as st, AUDIT_CATEGORIES as t, PostgresColumn as ti, JsonSchemaSource as tn, defaultPreset as tr, DEFAULT_CLAIMS as tt, BlockSqlTableSpec as u, CORE_BLOCKS as ui, ApiConfig as un, APP_COLUMN_FORMATS as ur, RENAMED_CONFIG_KEYS as ut, BlockSqlEntitlementsProvider as v, DEFAULT_CONVENTIONS as vi, EnvironmentConfig as vn, AppColumnType as vr, resolveConfig as vt, blockSqlVersion as w, PresetField as wi, EntitlementsConfig as wn, AppRollupConfig as wr, ExpandedConfig as wt, BlockSqlTestFile as x, Preset as xi, SqlInput as xn, AppReference as xr, ConfigReferences as xt, BlockSqlFile as y, PRESET_FRAMEWORKS as yi, GenGroupConfig as yn, AppLookupConfig as yr, BlockTableReference as yt, ZodFlavor as z, KeysConfig as zi, ExposeConfig as zn, CatalogGrant as zr, CodecsConfig as zt };
@@ -1,4 +1,4 @@
1
- import { a as ClientAuth } from "./bind-vKDmdu_4.js";
1
+ import { a as ClientAuth } from "./bind-DmUGUsBd.js";
2
2
  //#region src/blocks/controller.d.ts
3
3
  /**
4
4
  * A block's client state, framework-agnostic. `subscribe` and `getSnapshot`
@@ -1,5 +1,5 @@
1
1
  import { f as Result } from "./result-DZeA5KS6.js";
2
- import { Bt as Action, Ht as ActionContext, Vt as ActionCall } from "./define-block-DibVN37N.js";
2
+ import { Bt as Action, Ht as ActionContext, Vt as ActionCall } from "./define-block-DWVZSZv1.js";
3
3
  import { StandardSchemaV1 } from "@standard-schema/spec";
4
4
  //#region src/blocks/automations/conversion.d.ts
5
5
  /** A record a conversion reads from or creates: its subject type and id. */
@@ -1,7 +1,7 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { Pn as PresetSpec, Wn as PresetName, ar as AppColumnAccess, cr as AppColumnType, di as Preset, g as BlockSqlAccessProvider, ht as PresetInput, nr as APP_ON_DELETE_ACTIONS, ur as AppOnDeleteAction } from "../context-BJoHD20l.js";
3
- import { E as CreateDesign, b as DesignChange } from "../index-Cagz4Z2k.js";
4
- import { $ as SchemaTable, A as renameColumn, B as AppEvents, C as editTable, Ct as tableWithComputed, D as isEmptyDesign, Dt as IssueSeverity, E as isAppTable, Et as IssueCode, F as singular, G as subjectTypeError, H as eventsColumnsEdited, I as tidy, J as SchemaData, K as SchemaColumn, L as updateTable, M as setColumn, N as setExtraColumn, O as moveTables, Ot as IssueSource, P as setTableId, Q as SchemaSource, R as userConnection, S as duplicateTable, St as rollupSources, T as identifierError, Tt as Issue, U as subjectColumns, V as AppSubject, W as subjectColumnsEdited, X as SchemaOptions, Y as SchemaForeignKey, Z as SchemaSoftRef, _ as connect, _t as isRollupAggregate, a as AppScope, at as tenantColumnOf, b as deleteExtraColumn, bt as readableColumns, c as ConnectResult, ct as ComputedRow, d as EMPTY_DESIGN, dt as RollupAggregate, et as SchemaTarget, f as NamedDesign, ft as computedColumnRenamed, g as columnError, gt as fittedRollup, h as appTableId, ht as filterColumns, i as AppReference, it as tableStatements, j as renameTable, k as referenceFrom, l as Connection, lt as DraftRollup, m as addTable, mt as computedTableRenamed, n as APP_MODULE, nt as parseSchema, o as AppTable, ot as AppLookup, p as TablePatch, pt as computedRows, q as SchemaComputed, r as AppColumn, rt as schemaRelations, s as AppTableId, st as AppRollup, t as PresetMigrationFile, tt as keyColumnsOf, u as Design, ut as ROLLUP_AGGREGATES, v as defaultError, vt as lookupSources, w as freeTableName, wt as tableWithoutComputed, x as deleteTable, xt as rollupColumns, y as deleteColumn, yt as prunedComputed, z as withDesign } from "../types-CjRwmCRP.js";
2
+ import { Tt as PresetInput, Wn as PresetSpec, br as AppOnDeleteAction, er as PresetName, fr as APP_ON_DELETE_ACTIONS, g as BlockSqlAccessProvider, hr as AppColumnAccess, vr as AppColumnType, xi as Preset } from "../context-B4TsE2gY.js";
3
+ import { E as CreateDesign, b as DesignChange } from "../index-CB66nl14.js";
4
+ import { $ as SchemaTable, A as renameColumn, B as AppEvents, C as editTable, Ct as tableWithComputed, D as isEmptyDesign, Dt as IssueSeverity, E as isAppTable, Et as IssueCode, F as singular, G as subjectTypeError, H as eventsColumnsEdited, I as tidy, J as SchemaData, K as SchemaColumn, L as updateTable, M as setColumn, N as setExtraColumn, O as moveTables, Ot as IssueSource, P as setTableId, Q as SchemaSource, R as userConnection, S as duplicateTable, St as rollupSources, T as identifierError, Tt as Issue, U as subjectColumns, V as AppSubject, W as subjectColumnsEdited, X as SchemaOptions, Y as SchemaForeignKey, Z as SchemaSoftRef, _ as connect, _t as isRollupAggregate, a as AppScope, at as tenantColumnOf, b as deleteExtraColumn, bt as readableColumns, c as ConnectResult, ct as ComputedRow, d as EMPTY_DESIGN, dt as RollupAggregate, et as SchemaTarget, f as NamedDesign, ft as computedColumnRenamed, g as columnError, gt as fittedRollup, h as appTableId, ht as filterColumns, i as AppReference, it as tableStatements, j as renameTable, k as referenceFrom, l as Connection, lt as DraftRollup, m as addTable, mt as computedTableRenamed, n as APP_MODULE, nt as parseSchema, o as AppTable, ot as AppLookup, p as TablePatch, pt as computedRows, q as SchemaComputed, r as AppColumn, rt as schemaRelations, s as AppTableId, st as AppRollup, t as PresetMigrationFile, tt as keyColumnsOf, u as Design, ut as ROLLUP_AGGREGATES, v as defaultError, vt as lookupSources, w as freeTableName, wt as tableWithoutComputed, x as deleteTable, xt as rollupColumns, y as deleteColumn, yt as prunedComputed, z as withDesign } from "../types-BFwB-E1j.js";
5
5
  import { a as SupabaseLint, o as SupabaseOrganization, s as SupabaseProject } from "../management-wtecfrNf.js";
6
6
  //#region src/create/check.d.ts
7
7
  /** What `checkDesign` returns. */
@@ -369,4 +369,63 @@ export type MigrationPlan = {
369
369
  */
370
370
  export declare function migrationBetween(preset: PresetInput, base: CreateDesign, next: CreateDesign): MigrationPlan;
371
371
  //#endregion
372
+ //#region src/create/plan-gate.d.ts
373
+ /** The part of a pg-delta `Action` the gate reads. */
374
+ export interface PlanActionLike {
375
+ readonly sql: string;
376
+ readonly verb: "create" | "alter" | "drop";
377
+ readonly dataLoss: "none" | "destructive";
378
+ }
379
+ /** The part of a pg-delta `RenameCandidate` the gate reads. */
380
+ export interface RenameCandidateLike {
381
+ readonly kind: string;
382
+ readonly from: string;
383
+ readonly to: string;
384
+ readonly status: "unambiguous" | "ambiguous" | "nearMiss";
385
+ readonly reason?: string;
386
+ }
387
+ /**
388
+ * The part of a pg-delta `Plan` the gate reads; the real plan fits it
389
+ * structurally.
390
+ */
391
+ export interface PlanLike {
392
+ readonly actions: readonly PlanActionLike[];
393
+ readonly renameCandidates: readonly RenameCandidateLike[];
394
+ }
395
+ /** A rename the user recorded with `-- bsb: rename old -> new`. */
396
+ export interface RenameHint {
397
+ readonly from: string;
398
+ readonly to: string;
399
+ }
400
+ export interface GateOptions {
401
+ /** Let destructive actions through (`--allow-data-loss`). */
402
+ readonly allowDataLoss?: boolean;
403
+ /** Renames recorded in the edit log; see `parseRenameHints`. */
404
+ readonly hints?: readonly RenameHint[];
405
+ }
406
+ export interface PlanGate {
407
+ /** Candidates a hint confirmed: apply these as renames. */
408
+ readonly accepted: readonly RenameCandidateLike[];
409
+ /** Unambiguous candidates nobody confirmed: ask the user. */
410
+ readonly questions: readonly RenameCandidateLike[];
411
+ /**
412
+ * Ambiguous candidates and near misses: never guessed, they plan as drop and
413
+ * create.
414
+ */
415
+ readonly unresolved: readonly RenameCandidateLike[];
416
+ readonly destructive: readonly PlanActionLike[];
417
+ /** `true` when a destructive action is present and `allowDataLoss` is off. */
418
+ readonly blocked: boolean;
419
+ readonly issues: readonly Issue[];
420
+ }
421
+ /** The `-- bsb: rename old -> new` lines of a migration or edit log. */
422
+ export declare function parseRenameHints(text: string): RenameHint[];
423
+ /**
424
+ * Applies the rules of ADR 0106 to a plan: only a recorded rename or a
425
+ * confirmed prompt becomes a rename, an ambiguous candidate never does, and a
426
+ * destructive action is blocked unless data loss is allowed. Returns the
427
+ * decisions and the findings as `Issue`s with `source: "plan"`.
428
+ */
429
+ export declare function gatePlan(plan: PlanLike, options?: GateOptions): PlanGate;
430
+ //#endregion
372
431
  export { APP_MODULE, AppColumn, type AppColumnAccess, type AppColumnType, AppEvents, AppLookup, AppReference, AppRollup, AppScope, AppSubject, AppTable, AppTableId, ComputedRow, ConnectResult, Connection, Design, DraftRollup, EMPTY_DESIGN, type Issue, type IssueCode, type IssueSeverity, type IssueSource, NamedDesign, APP_ON_DELETE_ACTIONS as ON_DELETE_ACTIONS, type AppOnDeleteAction as OnDeleteAction, type PresetMigrationFile, ROLLUP_AGGREGATES, RollupAggregate, SchemaColumn, SchemaComputed, SchemaData, SchemaForeignKey, SchemaOptions, SchemaSoftRef, SchemaSource, SchemaTable, SchemaTarget, TablePatch, addTable, appTableId, columnError, computedColumnRenamed, computedRows, computedTableRenamed, connect, defaultError, deleteColumn, deleteExtraColumn, deleteTable, duplicateTable, editTable, eventsColumnsEdited, filterColumns, fittedRollup, freeTableName, identifierError, isAppTable, isEmptyDesign, isRollupAggregate, keyColumnsOf, lookupSources, moveTables, parseSchema, prunedComputed, readableColumns, referenceFrom, renameColumn, renameTable, rollupColumns, rollupSources, schemaRelations, setColumn, setExtraColumn, setTableId, singular, subjectColumns, subjectColumnsEdited, subjectTypeError, tableStatements, tableWithComputed, tableWithoutComputed, tenantColumnOf, tidy, updateTable, userConnection, withDesign };
@@ -1,6 +1,6 @@
1
- import { k as APP_ON_DELETE_ACTIONS } from "../instances-qz2MCMyK.js";
2
- import { m as diffDesigns } from "../preset-BbSWLoXM.js";
3
- import { $ as tableWithComputed, A as referenceFrom, B as withDesign, C as duplicateTable, D as isAppTable, E as identifierError, F as setTableId, G as filterColumns, H as computedColumnRenamed, I as singular, J as lookupSources, K as fittedRollup, L as tidy, M as renameTable, N as setColumn, O as isEmptyDesign, P as setExtraColumn, Q as rollupSources, R as updateTable, S as deleteTable, T as freeTableName, U as computedRows, V as ROLLUP_AGGREGATES, W as computedTableRenamed, X as readableColumns, Y as prunedComputed, Z as rollupColumns, _ as columnError, a as parseSchema, at as boundError, b as deleteColumn, c as tenantColumnOf, ct as fitted, d as previewFiles, dt as takesBounds, et as tableWithoutComputed, f as designIssues, ft as withBounds, g as appTableId, h as addTable, i as keyColumnsOf, it as subjectTypeError, j as renameColumn, k as moveTables, l as schemaData, lt as lockedWithoutDefault, m as EMPTY_DESIGN, n as loadProject, nt as subjectColumns, o as schemaRelations, ot as columnLabel, p as APP_MODULE, q as isRollupAggregate, r as checkDesign, rt as subjectColumnsEdited, s as tableStatements, st as encryptable, t as checkProject, tt as eventsColumnsEdited, u as previewAccessProvider, ut as optionError, v as connect, w as editTable, x as deleteExtraColumn, y as defaultError, z as userConnection } from "../project-TN03XDsA.js";
1
+ import { k as APP_ON_DELETE_ACTIONS } from "../instances-C7qUTjhJ.js";
2
+ import { m as diffDesigns } from "../preset-DCdEnJj9.js";
3
+ import { $ as tableWithComputed, A as referenceFrom, B as withDesign, C as duplicateTable, D as isAppTable, E as identifierError, F as setTableId, G as filterColumns, H as computedColumnRenamed, I as singular, J as lookupSources, K as fittedRollup, L as tidy, M as renameTable, N as setColumn, O as isEmptyDesign, P as setExtraColumn, Q as rollupSources, R as updateTable, S as deleteTable, T as freeTableName, U as computedRows, V as ROLLUP_AGGREGATES, W as computedTableRenamed, X as readableColumns, Y as prunedComputed, Z as rollupColumns, _ as columnError, a as parseSchema, at as boundError, b as deleteColumn, c as tenantColumnOf, ct as fitted, d as previewFiles, dt as takesBounds, et as tableWithoutComputed, f as designIssues, ft as withBounds, g as appTableId, h as addTable, i as keyColumnsOf, it as subjectTypeError, j as renameColumn, k as moveTables, l as schemaData, lt as lockedWithoutDefault, m as EMPTY_DESIGN, n as loadProject, nt as subjectColumns, o as schemaRelations, ot as columnLabel, p as APP_MODULE, q as isRollupAggregate, r as checkDesign, rt as subjectColumnsEdited, s as tableStatements, st as encryptable, t as checkProject, tt as eventsColumnsEdited, u as previewAccessProvider, ut as optionError, v as connect, w as editTable, x as deleteExtraColumn, y as defaultError, z as userConnection } from "../project-C4NA_van.js";
4
4
  //#region src/create/column-kinds.ts
5
5
  /** The groups of the column type picker, in the order it shows them. */
6
6
  const KIND_GROUPS = [
@@ -602,4 +602,67 @@ function migrationBetween(preset, base, next) {
602
602
  };
603
603
  }
604
604
  //#endregion
605
- export { APP_MODULE, COLUMN_KINDS, EMPTY_DESIGN, HISTORY_LIMIT, KIND_GROUPS, MIGRATION_NAME, APP_ON_DELETE_ACTIONS as ON_DELETE_ACTIONS, ROLLUP_AGGREGATES, SAMPLE_ROW_COUNT, addTable, appTableId, boundError, checkDesign, checkProject, columnError, columnLabel, computedColumnRenamed, computedRows, computedTableRenamed, connect, dashboardUrl, defaultError, deleteColumn, deleteExtraColumn, deleteTable, deployBlocker, deployQuery, designIssues, duplicateTable, editTable, encryptable, eventsColumnsEdited, filterColumns, fitted, fittedRollup, freeTableName, generatePassword, hiddenColumns, identifierError, initialHistory, isAppTable, isEmptyDesign, isRollupAggregate, keyColumnsOf, kindById, kindOf, loadProject, lockedWithoutDefault, lookupSources, migrationBetween, moveTables, newDeployId, optionError, parseSchema, previewAccessProvider, previewFiles, prunedComputed, readableColumns, referenceFrom, renameColumn, renameTable, rollupColumns, rollupSources, sampleRows, schemaData, schemaRelations, setColumn, setColumnKind, setExtraColumn, setTableId, singular, subjectColumns, subjectColumnsEdited, subjectTypeError, suggestedProjectName, tableStatements, tableWithComputed, tableWithoutComputed, takesBounds, tenantColumnOf, tidy, undoHistory, updateTable, userConnection, withBounds, withDesign, withKind };
605
+ //#region src/create/plan-gate.ts
606
+ const HINT = /^--\s*bsb:\s*rename\s+(\S+)\s*->\s*(\S+)\s*$/gmu;
607
+ /** The `-- bsb: rename old -> new` lines of a migration or edit log. */
608
+ function parseRenameHints(text) {
609
+ return [...text.matchAll(HINT)].flatMap((match) => {
610
+ const [, from, to] = match;
611
+ return from === void 0 || to === void 0 ? [] : [{
612
+ from,
613
+ to
614
+ }];
615
+ });
616
+ }
617
+ function bare(name) {
618
+ return name.replaceAll("\"", "").toLowerCase();
619
+ }
620
+ /** `id` names `name`, written as `table` or `schema.table`. */
621
+ function names(id, name) {
622
+ const wanted = bare(name);
623
+ const have = bare(id);
624
+ return have === wanted || have.endsWith(`.${wanted}`) || have.endsWith(`:${wanted}`);
625
+ }
626
+ function confirmed(candidate, hints) {
627
+ return hints.some((hint) => names(candidate.from, hint.from) && names(candidate.to, hint.to));
628
+ }
629
+ function planIssue(code, severity, table, message) {
630
+ return {
631
+ code,
632
+ severity,
633
+ source: "plan",
634
+ path: "",
635
+ table,
636
+ message
637
+ };
638
+ }
639
+ /**
640
+ * Applies the rules of ADR 0106 to a plan: only a recorded rename or a
641
+ * confirmed prompt becomes a rename, an ambiguous candidate never does, and a
642
+ * destructive action is blocked unless data loss is allowed. Returns the
643
+ * decisions and the findings as `Issue`s with `source: "plan"`.
644
+ */
645
+ function gatePlan(plan, options = {}) {
646
+ const hints = options.hints ?? [];
647
+ const accepted = [];
648
+ const questions = [];
649
+ const unresolved = [];
650
+ for (const candidate of plan.renameCandidates) if (candidate.status !== "unambiguous") unresolved.push(candidate);
651
+ else if (confirmed(candidate, hints)) accepted.push(candidate);
652
+ else questions.push(candidate);
653
+ const destructive = plan.actions.filter((action) => action.dataLoss === "destructive");
654
+ return {
655
+ accepted,
656
+ questions,
657
+ unresolved,
658
+ destructive,
659
+ blocked: destructive.length > 0 && options.allowDataLoss !== true,
660
+ issues: [
661
+ ...questions.map((candidate) => planIssue("plan_rename_question", "warning", candidate.to, `Is ${candidate.from} renamed to ${candidate.to}? Record \`-- bsb: rename\` or it plans as drop and create.`)),
662
+ ...unresolved.map((candidate) => planIssue("plan_rename_unresolved", "info", candidate.to, `${candidate.from} to ${candidate.to} is ${candidate.status}${candidate.reason === void 0 ? "" : `: ${candidate.reason}`}; it plans as drop and create.`)),
663
+ ...destructive.map((action) => planIssue("plan_data_loss", options.allowDataLoss === true ? "warning" : "error", "", `Destroys data: ${action.sql.split("\n")[0] ?? ""}`))
664
+ ]
665
+ };
666
+ }
667
+ //#endregion
668
+ export { APP_MODULE, COLUMN_KINDS, EMPTY_DESIGN, HISTORY_LIMIT, KIND_GROUPS, MIGRATION_NAME, APP_ON_DELETE_ACTIONS as ON_DELETE_ACTIONS, ROLLUP_AGGREGATES, SAMPLE_ROW_COUNT, addTable, appTableId, boundError, checkDesign, checkProject, columnError, columnLabel, computedColumnRenamed, computedRows, computedTableRenamed, connect, dashboardUrl, defaultError, deleteColumn, deleteExtraColumn, deleteTable, deployBlocker, deployQuery, designIssues, duplicateTable, editTable, encryptable, eventsColumnsEdited, filterColumns, fitted, fittedRollup, freeTableName, gatePlan, generatePassword, hiddenColumns, identifierError, initialHistory, isAppTable, isEmptyDesign, isRollupAggregate, keyColumnsOf, kindById, kindOf, loadProject, lockedWithoutDefault, lookupSources, migrationBetween, moveTables, newDeployId, optionError, parseRenameHints, parseSchema, previewAccessProvider, previewFiles, prunedComputed, readableColumns, referenceFrom, renameColumn, renameTable, rollupColumns, rollupSources, sampleRows, schemaData, schemaRelations, setColumn, setColumnKind, setExtraColumn, setTableId, singular, subjectColumns, subjectColumnsEdited, subjectTypeError, suggestedProjectName, tableStatements, tableWithComputed, tableWithoutComputed, takesBounds, tenantColumnOf, tidy, undoHistory, updateTable, userConnection, withBounds, withDesign, withKind };