better-supabase 0.15.0 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (284) hide show
  1. package/dist/{adapter-B0b6MXYS.js → adapter-Dyks1lX1.js} +1 -1
  2. package/dist/{agents-5n8DWRfP.d.ts → agents-CMIB3802.d.ts} +1 -1
  3. package/dist/{ai-cache-DyHohbFP.d.ts → ai-cache-2LGgaT7F.d.ts} +1 -1
  4. package/dist/{ai-chat-D1GuRnke.d.ts → ai-chat-BCaKsvLW.d.ts} +1 -1
  5. package/dist/{ai-schedules-CAquecT_.d.ts → ai-schedules-D_Hz-ik5.d.ts} +2 -2
  6. package/dist/ai-sdk/agents/index.d.ts +4 -4
  7. package/dist/ai-sdk/batches/index.d.ts +1 -1
  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/index.d.ts +4 -4
  12. package/dist/ai-sdk/memory/index.d.ts +3 -3
  13. package/dist/ai-sdk/workflow/index.d.ts +3 -3
  14. package/dist/{app-tables-CF2DD-Mu.d.ts → app-tables-CbCFSXLG.d.ts} +1 -1
  15. package/dist/{approvals-Crutd4-o.d.ts → approvals-Dh9dUXrN.d.ts} +1 -1
  16. package/dist/{assistant-CD_h8Vxx.d.ts → assistant-ndGdOBax.d.ts} +2 -2
  17. package/dist/astro/index.d.ts +2 -2
  18. package/dist/astro/index.js +2 -2
  19. package/dist/{authorization-hooks-Cs1vP_ej.d.ts → authorization-hooks-D_pwXlBs.d.ts} +4 -0
  20. package/dist/{bind-CrMBwrPN.d.ts → bind-h5jre2K0.d.ts} +3 -3
  21. package/dist/{block-env-B_uEM2xz.d.ts → block-env-BrfRvPrj.d.ts} +4 -4
  22. package/dist/blocks/access-requests/index.d.ts +1 -1
  23. package/dist/blocks/activities/index.d.ts +2 -2
  24. package/dist/blocks/agents/index.d.ts +2 -2
  25. package/dist/blocks/ai-cache/index.d.ts +2 -2
  26. package/dist/blocks/ai-chat/index.d.ts +5 -5
  27. package/dist/blocks/ai-files/index.d.ts +1 -1
  28. package/dist/blocks/ai-keys/index.d.ts +1 -1
  29. package/dist/blocks/ai-schedules/index.d.ts +2 -2
  30. package/dist/blocks/announcements/index.d.ts +4 -4
  31. package/dist/blocks/api-keys/index.d.ts +2 -2
  32. package/dist/blocks/approvals/index.d.ts +2 -2
  33. package/dist/blocks/assets/index.d.ts +1 -1
  34. package/dist/blocks/assignment/index.d.ts +1 -1
  35. package/dist/blocks/attachments/index.d.ts +2 -2
  36. package/dist/blocks/audit/index.d.ts +3 -3
  37. package/dist/blocks/automations/index.d.ts +4 -4
  38. package/dist/blocks/billable-time/index.d.ts +1 -1
  39. package/dist/blocks/billing/index.d.ts +2 -2
  40. package/dist/blocks/bookings/index.d.ts +3 -3
  41. package/dist/blocks/bulk/index.d.ts +1 -1
  42. package/dist/blocks/calendar/index.d.ts +2 -2
  43. package/dist/blocks/catalog/index.d.ts +1 -1
  44. package/dist/blocks/channels/index.d.ts +1 -1
  45. package/dist/blocks/collections/index.d.ts +1 -1
  46. package/dist/blocks/comments/index.d.ts +4 -4
  47. package/dist/blocks/compliance/index.d.ts +1 -1
  48. package/dist/blocks/connectors/index.d.ts +1 -1
  49. package/dist/blocks/contacts/index.d.ts +1 -1
  50. package/dist/blocks/content/index.d.ts +1 -1
  51. package/dist/blocks/contracts/index.d.ts +1 -1
  52. package/dist/blocks/courses/index.d.ts +1 -1
  53. package/dist/blocks/created-by/index.d.ts +1 -1
  54. package/dist/blocks/custom-fields/index.d.ts +1 -1
  55. package/dist/blocks/data-lifecycle/index.d.ts +2 -2
  56. package/dist/blocks/deals/index.d.ts +1 -1
  57. package/dist/blocks/dispatch/index.d.ts +1 -1
  58. package/dist/blocks/documents/index.d.ts +1 -1
  59. package/dist/blocks/domains/index.d.ts +1 -1
  60. package/dist/blocks/donations/index.d.ts +1 -1
  61. package/dist/blocks/drive/index.d.ts +2 -2
  62. package/dist/blocks/employees/index.d.ts +2 -2
  63. package/dist/blocks/enrichment/index.d.ts +1 -1
  64. package/dist/blocks/enrollments/index.d.ts +1 -1
  65. package/dist/blocks/entitlements/index.d.ts +3 -3
  66. package/dist/blocks/expenses/index.d.ts +1 -1
  67. package/dist/blocks/field-history/index.d.ts +1 -1
  68. package/dist/blocks/flags/index.d.ts +1 -1
  69. package/dist/blocks/forecasts/index.d.ts +1 -1
  70. package/dist/blocks/forms/index.d.ts +2 -2
  71. package/dist/blocks/goals/index.d.ts +1 -1
  72. package/dist/blocks/guests/index.d.ts +1 -1
  73. package/dist/blocks/hiring/index.d.ts +1 -1
  74. package/dist/blocks/identities/index.d.ts +2 -2
  75. package/dist/blocks/imports/index.d.ts +1 -1
  76. package/dist/blocks/inbox/index.d.ts +5 -5
  77. package/dist/blocks/incidents/index.d.ts +1 -1
  78. package/dist/blocks/index.d.ts +2 -2
  79. package/dist/blocks/inventory/index.d.ts +2 -2
  80. package/dist/blocks/invoices/index.d.ts +1 -1
  81. package/dist/blocks/knowledge/index.d.ts +2 -2
  82. package/dist/blocks/lead-scoring/index.d.ts +1 -1
  83. package/dist/blocks/leases/index.d.ts +1 -1
  84. package/dist/blocks/leave/index.d.ts +1 -1
  85. package/dist/blocks/ledger/index.d.ts +1 -1
  86. package/dist/blocks/mail-sync/index.d.ts +1 -1
  87. package/dist/blocks/memberships/index.d.ts +1 -1
  88. package/dist/blocks/memory/index.d.ts +3 -3
  89. package/dist/blocks/messaging/index.d.ts +4 -4
  90. package/dist/blocks/metrics/index.d.ts +2 -2
  91. package/dist/blocks/mfa/index.d.ts +2 -2
  92. package/dist/blocks/moderation/index.d.ts +1 -1
  93. package/dist/blocks/notifications/index.d.ts +5 -5
  94. package/dist/blocks/numbering/index.d.ts +1 -1
  95. package/dist/blocks/oauth-server/index.d.ts +1 -1
  96. package/dist/blocks/onboarding/index.d.ts +2 -2
  97. package/dist/blocks/orders/index.d.ts +3 -3
  98. package/dist/blocks/organizations/index.d.ts +2 -2
  99. package/dist/blocks/outbox/index.d.ts +2 -2
  100. package/dist/blocks/passes/index.d.ts +2 -2
  101. package/dist/blocks/permissions/index.d.ts +3 -3
  102. package/dist/blocks/pipelines/index.d.ts +1 -1
  103. package/dist/blocks/posts/index.d.ts +1 -1
  104. package/dist/blocks/profiles/index.d.ts +1 -1
  105. package/dist/blocks/promotions/index.d.ts +1 -1
  106. package/dist/blocks/push/index.d.ts +2 -2
  107. package/dist/blocks/queue/index.d.ts +2 -2
  108. package/dist/blocks/queue/index.js +1 -1
  109. package/dist/blocks/quotes/index.d.ts +1 -1
  110. package/dist/blocks/rank/index.d.ts +2 -2
  111. package/dist/blocks/reactions/index.d.ts +4 -4
  112. package/dist/blocks/relations/index.d.ts +1 -1
  113. package/dist/blocks/reminders/index.d.ts +3 -3
  114. package/dist/blocks/reviews/index.d.ts +1 -1
  115. package/dist/blocks/saved-views/index.d.ts +2 -2
  116. package/dist/blocks/scores/index.d.ts +1 -1
  117. package/dist/blocks/search/index.d.ts +3 -3
  118. package/dist/blocks/security-events/index.d.ts +1 -1
  119. package/dist/blocks/segments/index.d.ts +1 -1
  120. package/dist/blocks/sequences/index.d.ts +1 -1
  121. package/dist/blocks/service-accounts/index.d.ts +1 -1
  122. package/dist/blocks/sessions/index.d.ts +2 -2
  123. package/dist/blocks/settings/index.d.ts +2 -2
  124. package/dist/blocks/share-links/index.d.ts +1 -1
  125. package/dist/blocks/shipments/index.d.ts +1 -1
  126. package/dist/blocks/signatures/index.d.ts +1 -1
  127. package/dist/blocks/signing-keys/index.d.ts +1 -1
  128. package/dist/blocks/sla/index.d.ts +1 -1
  129. package/dist/blocks/sso/index.d.ts +1 -1
  130. package/dist/blocks/state-machine/index.d.ts +1 -1
  131. package/dist/blocks/subjects/index.d.ts +2 -2
  132. package/dist/blocks/tags/index.d.ts +2 -2
  133. package/dist/blocks/tasks/index.d.ts +2 -2
  134. package/dist/blocks/teams/index.d.ts +1 -1
  135. package/dist/blocks/templates/index.d.ts +3 -3
  136. package/dist/blocks/time-tracking/index.d.ts +1 -1
  137. package/dist/blocks/timeline/index.d.ts +1 -1
  138. package/dist/blocks/trash/index.d.ts +1 -1
  139. package/dist/blocks/undo/index.d.ts +2 -2
  140. package/dist/blocks/updated-at/index.d.ts +1 -1
  141. package/dist/blocks/usage/index.d.ts +3 -3
  142. package/dist/blocks/vercel-marketplace/index.d.ts +1 -1
  143. package/dist/blocks/versions/index.d.ts +1 -1
  144. package/dist/blocks/waitlist/index.d.ts +1 -1
  145. package/dist/blocks/webhooks/index.d.ts +3 -3
  146. package/dist/blocks/workflow-editor/index.d.ts +6 -6
  147. package/dist/blocks/workflow-editor/index.js +12 -1
  148. package/dist/blocks/workflows/index.d.ts +4 -4
  149. package/dist/{bookings-D4dvGXiR.d.ts → bookings-Dox2rced.d.ts} +1 -1
  150. package/dist/chat-sdk/index.d.ts +1 -1
  151. package/dist/cli/{add-DCI5JKjA.js → add-C04vkBk9.js} +2 -2
  152. package/dist/cli/add-CUH0rORo.js +1 -0
  153. package/dist/cli/{add-BgsUjCan.js → add-DNOL9PDu.js} +17 -12
  154. package/dist/cli/{backfill-nxPbcsns.js → backfill-VFzf-TJP.js} +1 -1
  155. package/dist/cli/bin.js +1 -1
  156. package/dist/cli/{blocks-Cr4HGePW.js → blocks-Bn7WUca5.js} +1 -1
  157. package/dist/cli/{blocks-BZHI8mRC.js → blocks-Cb7mILFU.js} +1 -1
  158. package/dist/cli/{cache-CXgR_Ahi.js → cache-DkplpIGe.js} +1 -1
  159. package/dist/cli/{codemod-DSN7iAdg.js → codemod-BbaE5dL_.js} +95 -3
  160. package/dist/cli/{content-mapper-DNs7lTu7.js → content-mapper-Cdx6arxu.js} +2 -2
  161. package/dist/cli/{doctor-DDrEM6S1.js → doctor-C-VO-QQ2.js} +29 -14
  162. package/dist/cli/{gen-MtijJQ9r.js → gen-yRHOHW1b.js} +10 -10
  163. package/dist/cli/index.d.ts +1 -1
  164. package/dist/cli/index.js +6 -6
  165. package/dist/cli/{init-D-aDv9r5.js → init-BOw0SX65.js} +5 -5
  166. package/dist/cli/legacy-prefix-DkTA3Rhx.js +141 -0
  167. package/dist/cli/{live-iEeH15ck.js → live-Lmg-hYyO.js} +2 -2
  168. package/dist/cli/{mcp-BAPyaQ62.js → mcp-DQ1zR2eA.js} +2 -2
  169. package/dist/cli/{metadata-DVx9Zgbj.js → metadata-CZaxkv21.js} +3 -3
  170. package/dist/cli/{migration-safety-D7PhzFxm.js → migration-safety-BbhLu2fo.js} +1 -1
  171. package/dist/cli/{module-migration-aPCckev6.js → module-migration-DOn6EmNz.js} +5 -216
  172. package/dist/cli/{print-BeWO7OJY.js → print-D_xf8PPj.js} +1 -1
  173. package/dist/cli/{remove-B46Dmd2M.js → remove-BY_TOTRj.js} +5 -4
  174. package/dist/cli/{render-ucJmUyuM.js → render-lJmHr0y9.js} +3 -3
  175. package/dist/cli/{run-CvYVAztY.js → run-BJ6IMs_H.js} +20 -7
  176. package/dist/cli/{run-DYhLBcFW.js → run-DkB0fhc9.js} +20 -20
  177. package/dist/cli/{shared-LZroULBe.js → shared-Bh-6IqJS.js} +1 -1
  178. package/dist/cli/{snapshot-C8MVPyO8.js → snapshot-Bzcigm7T.js} +2 -2
  179. package/dist/cli/{source-DANaJJVc.js → source-WoLdcQzN.js} +1 -1
  180. package/dist/cli/{spec-g8_G5K7o.js → spec-BF_dpwzW.js} +1 -1
  181. package/dist/cli/{spec-DGVNMSSB.js → spec-CZMiLhv_.js} +2 -2
  182. package/dist/cli/sql-layout-rFP0oq1N.js +247 -0
  183. package/dist/cli/{sync-btj01bcM.js → sync-mANmYYoL.js} +2 -1
  184. package/dist/cli/{upgrade-B596d4t8.js → upgrade-B0Q9wMs-.js} +4 -137
  185. package/dist/cli/{upgrade-Dw3TMQzn.js → upgrade-BrNLt92u.js} +2 -2
  186. package/dist/cli/{version-Du4CgONY.js → version-CyavsyGA.js} +1 -1
  187. package/dist/client/index.d.ts +5 -5
  188. package/dist/client/native/index.d.ts +4 -4
  189. package/dist/{composite-BARuBEDE.js → composite-B3TIjId4.js} +1 -1
  190. package/dist/{composite-Dsxj7T5K.d.ts → composite-BZYXlVBN.d.ts} +2 -2
  191. package/dist/config/index.d.ts +1 -1
  192. package/dist/{context-CEuTKrkz.d.ts → context-TGX2eDS5.d.ts} +24 -2
  193. package/dist/{controller-BrP0gn47.d.ts → controller-DyPPMFSw.d.ts} +1 -1
  194. package/dist/{conversion-BAbucuXq.d.ts → conversion-O-kyhXcC.d.ts} +1 -1
  195. package/dist/create/index.d.ts +2 -2
  196. package/dist/create/index.js +1 -1
  197. package/dist/{define-block-BVcLQ3DF.d.ts → define-block-DvvcM54N.d.ts} +1 -1
  198. package/dist/delegation-C7eWP2r8.d.ts +14 -0
  199. package/dist/{delegation--93jRsVO.js → delegation-DGOIiT8k.js} +12 -5
  200. package/dist/edge/index.d.ts +1 -1
  201. package/dist/edge/index.js +3 -3
  202. package/dist/{embeddings-kFbRvuic.d.ts → embeddings-D_RsS6ow.d.ts} +1 -1
  203. package/dist/{entitlements-CJpYQXeE.d.ts → entitlements-BnhDBxLW.d.ts} +1 -1
  204. package/dist/{envelope-Bzu0JnY2.js → envelope-DEI2iX-d.js} +1 -1
  205. package/dist/eve/index.d.ts +2 -2
  206. package/dist/{eve-BFSwTu1z.d.ts → eve-B7jxYPCw.d.ts} +2 -2
  207. package/dist/{executor-_2ekNofh.d.ts → executor-Bi056Cnj.d.ts} +1 -1
  208. package/dist/expo/index.d.ts +1 -1
  209. package/dist/expo/index.js +2 -2
  210. package/dist/{field-errors-fsbFktYF.d.ts → field-errors-DYtg1mwv.d.ts} +5 -5
  211. package/dist/{framework-DDdkR7FX.js → framework-BozTXRzt.js} +1 -1
  212. package/dist/{framework-BKyTeS-j.d.ts → framework-h5lP_5yj.d.ts} +3 -3
  213. package/dist/{gateway-TD1pRfTP.d.ts → gateway-DzI687yd.d.ts} +3 -3
  214. package/dist/hono/index.d.ts +1 -1
  215. package/dist/hono/index.js +2 -2
  216. package/dist/{index-BnH4Gomw.d.ts → index-Ab4UeEn_.d.ts} +8 -8
  217. package/dist/{index-BUuVq1co.d.ts → index-B4gcStOz.d.ts} +2 -2
  218. package/dist/{index-C-qpk8EQ.d.ts → index-BAHGLvGD.d.ts} +1 -1
  219. package/dist/{index-CguFm716.d.ts → index-BfK6olKm.d.ts} +31 -3
  220. package/dist/{index-DLq69k3F.d.ts → index-BfkltrGJ.d.ts} +1 -1
  221. package/dist/{index-B938YqY-.d.ts → index-DN9mfmhA.d.ts} +1 -1
  222. package/dist/{knowledge-CtL-Vfgy.d.ts → knowledge-F1IhRI4Q.d.ts} +1 -1
  223. package/dist/mapper/bin.js +5 -5
  224. package/dist/mcp/index.d.ts +1 -1
  225. package/dist/mcp/index.js +1 -1
  226. package/dist/mcp/sdk/index.d.ts +1 -1
  227. package/dist/mcp/sdk/index.js +1 -1
  228. package/dist/next/index.d.ts +8 -8
  229. package/dist/next/index.js +2 -2
  230. package/dist/orpc/index.d.ts +1 -1
  231. package/dist/orpc/index.js +1 -1
  232. package/dist/otel/index.js +4 -4
  233. package/dist/{outbox-HvGAJuBe.d.ts → outbox-HxjZTfF6.d.ts} +1 -1
  234. package/dist/{ports-sx226JUL.d.ts → ports-CpdiQv1D.d.ts} +1 -1
  235. package/dist/powersync/index.d.ts +1 -1
  236. package/dist/preset/index.d.ts +3 -3
  237. package/dist/{push-token-D3Vcf0Pf.d.ts → push-token-B3m3pWAv.d.ts} +1 -1
  238. package/dist/query/index.d.ts +1 -1
  239. package/dist/react/index.d.ts +5 -5
  240. package/dist/react/native/index.d.ts +1 -1
  241. package/dist/react/server.d.ts +5 -5
  242. package/dist/react-router/index.d.ts +2 -2
  243. package/dist/react-router/index.js +2 -2
  244. package/dist/realtime/index.d.ts +4 -4
  245. package/dist/{record-form-BYs9xv_N.d.ts → record-form-DB_5Ue_B.d.ts} +1 -1
  246. package/dist/records/index.d.ts +7 -7
  247. package/dist/server/index.d.ts +7 -6
  248. package/dist/server/index.js +5 -4
  249. package/dist/{server-types-CFtehAsr.d.ts → server-types-7QPzW2bF.d.ts} +1 -1
  250. package/dist/{session-CH0SKgIz.d.ts → session-CfBCJGgc.d.ts} +1 -1
  251. package/dist/{sign-in-DNCdrk05.js → sign-in-B64114O4.js} +1 -1
  252. package/dist/solid/index.d.ts +5 -5
  253. package/dist/solid-start/index.d.ts +2 -2
  254. package/dist/solid-start/index.js +2 -2
  255. package/dist/sql/index.d.ts +4 -4
  256. package/dist/sql/index.js +2 -2
  257. package/dist/{sql-ClHIdgKS.js → sql-OLVW4t08.js} +275 -13
  258. package/dist/ssr/index.d.ts +1 -1
  259. package/dist/{subject-readers-BNSzkqw_.d.ts → subject-readers-8GySC9Z8.d.ts} +1 -1
  260. package/dist/svelte/index.d.ts +5 -5
  261. package/dist/sveltekit/index.d.ts +2 -2
  262. package/dist/sveltekit/index.js +2 -2
  263. package/dist/tanstack-start/index.d.ts +2 -2
  264. package/dist/tanstack-start/index.js +2 -2
  265. package/dist/{tenant-yYg0E2-n.d.ts → tenant-DzFsg0Pc.d.ts} +1 -1
  266. package/dist/testing/index.d.ts +10 -10
  267. package/dist/{timeline-CtG0sehj.d.ts → timeline-WrFMgd3U.d.ts} +2 -2
  268. package/dist/{topic-CJrQZQaa.d.ts → topic-DNFEFGKI.d.ts} +1 -1
  269. package/dist/{types-CAQBmpDx.d.ts → types-A4yyKEsg.d.ts} +1 -1
  270. package/dist/{types-SFRomQF7.d.ts → types-Czq9Xtpa.d.ts} +1 -7
  271. package/dist/{types-BBQLbui9.d.ts → types-DsRfiQ0v.d.ts} +1 -1
  272. package/dist/{usage-D7QkrwzV.d.ts → usage-Dp45V42p.d.ts} +1 -1
  273. package/dist/vue/index.d.ts +5 -5
  274. package/dist/{watch-topic-BcGfvZOE.d.ts → watch-topic-Bo9S2R4P.d.ts} +1 -1
  275. package/dist/workflow-sdk/builder/index.d.ts +3 -3
  276. package/dist/workflow-sdk/builder/index.js +1 -1
  277. package/dist/workflow-sdk/index.d.ts +1 -1
  278. package/dist/workflow-sdk/index.js +1 -1
  279. package/dist/{workflow-sdk-BFHu4sci.d.ts → workflow-sdk-B3Ss55Fy.d.ts} +1 -1
  280. package/dist/{workflow-sdk-BVlFEB5Q.js → workflow-sdk-Cf0LAOFF.js} +2 -2
  281. package/dist/yjs/index.d.ts +1 -1
  282. package/package.json +1 -1
  283. package/schemas/doctor-report-v1.json +1 -0
  284. package/dist/cli/add-DWjlVwvP.js +0 -1
@@ -0,0 +1,247 @@
1
+ import { d as TypegenMissingError, i as parseSnapshot } from "./snapshot-Bzcigm7T.js";
2
+ import { a as toCatalog } from "./source-WoLdcQzN.js";
3
+ import { d as readSupabaseToml, f as schemaPaths, n as declarativeSchemasDir, p as sqlWorkflow } from "./supabase-toml-CncmQbO0.js";
4
+ import { existsSync } from "node:fs";
5
+ import { dirname, join, relative, resolve, sep } from "node:path";
6
+ import { readFile, readdir } from "node:fs/promises";
7
+ import { adoptedColumnProblems, auditRegistrations, declaredPolicies, declaredTableColumns, declaredTables, declaredUpdatedAtTriggers, declaredViews, extensionSchema, moduleLayout, policyGrants, resolveBlocks, resolveExposeColumns, rlsTables, sameTenantLayout } from "better-supabase/sql";
8
+ //#region src/cli/sql-layout.ts
9
+ /** The folder the module data files sit next to, for the project's workflow. */
10
+ async function schemasDirOf(config) {
11
+ const toml = await readSupabaseToml(config.root);
12
+ return declarativeSchemasDir(toml, sqlWorkflow(config, toml));
13
+ }
14
+ /** The declarative schema files, then the migrations oldest first. */
15
+ async function schemaTexts(config) {
16
+ const toml = await readSupabaseToml(config.root);
17
+ const migrations = resolve(config.root, migrationsDir(config));
18
+ const paths = [...(await schemaPaths(config.root, toml, sqlWorkflow(config, toml))).files, ...existsSync(migrations) ? (await readdir(migrations)).filter((name) => name.endsWith(".sql")).toSorted().map((name) => join(migrations, name)) : []];
19
+ return Promise.all(paths.map(async (path) => ({
20
+ path,
21
+ text: await readFile(resolve(config.root, path), "utf-8")
22
+ })));
23
+ }
24
+ async function declarativeTexts(config) {
25
+ const toml = await readSupabaseToml(config.root);
26
+ const { files } = await schemaPaths(config.root, toml, sqlWorkflow(config, toml));
27
+ if (files.length === 0) return schemaTexts(config);
28
+ return Promise.all(files.map(async (path) => ({
29
+ path,
30
+ text: await readFile(resolve(config.root, path), "utf-8")
31
+ })));
32
+ }
33
+ /**
34
+ * The `better_supabase.audit(...)` calls in the declarative schemas, then the
35
+ * migrations oldest first, so a later call or `unaudit` wins.
36
+ */
37
+ async function auditedTables(config) {
38
+ return auditRegistrations(await schemaTexts(config));
39
+ }
40
+ /**
41
+ * The layout `upgrade` and doctor render the module files with, so both see the
42
+ * same grants, session policies, audit triggers and vector schema.
43
+ */
44
+ async function moduleLayoutFor(config, input) {
45
+ const resolved = new Set(resolveBlocks(input.names, input.entitlementsProvider ? { entitlementsProvider: input.entitlementsProvider } : {}).map((module) => module.name));
46
+ const own = await ownLayout(config);
47
+ const adopted = adoptedColumnProblems(config.blocks, await declarativeTexts(config), config.schemas, own.ownTables);
48
+ if (adopted.length > 0) throw new TypeError(adopted.join("\n"));
49
+ const fromPolicies = resolved.has("grants") && config.blocks["grants"]?.options?.["fromPolicies"] === true;
50
+ const sessionPolicies = resolved.has("sessions") && config.blocks["sessions"]?.options?.["policies"] === true;
51
+ const sameTenant = config.blocks["memberships"]?.options?.["sameTenant"];
52
+ const autoSameTenant = resolved.has("memberships") && typeof sameTenant === "object" && sameTenant !== null && "auto" in sameTenant && sameTenant.auto === true;
53
+ const base = moduleLayout(config, input.testsDir, input.readSets ?? [], input.entitlementsProvider, input.accessProvider, input.permissionCatalog);
54
+ const grants = base.grants === void 0 ? void 0 : resolveExposeColumns(base.grants, await declarativeTexts(config), config.schemas);
55
+ return {
56
+ ...base,
57
+ ...grants === void 0 ? {} : { grants },
58
+ schemasDir: await schemasDirOf(config),
59
+ ...resolved.has("audit") ? { auditedTables: await auditedTables(config) } : {},
60
+ ...resolved.has("vector-search") ? vectorSchemaOf(await schemaTexts(config)) : {},
61
+ ...fromPolicies ? { policyGrants: policyGrants(await declarativeTexts(config), config.schemas) } : {},
62
+ ...fromPolicies ? { rlsTables: rlsTables(await declarativeTexts(config), config.schemas) } : {},
63
+ ...autoSameTenant ? sameTenantLayout(await declarativeTexts(config), config.schemas) : {},
64
+ ...fromPolicies || sessionPolicies ? { declaredTables: declaredTables(await declarativeTexts(config), config.schemas) } : {},
65
+ ...own
66
+ };
67
+ }
68
+ /**
69
+ * `ownTables`, `ownViews`, `ownColumns`, `ownUpdatedAtTriggers` and
70
+ * `ownPolicies`: the database's tables and views, then the app's files.
71
+ */
72
+ async function ownLayout(config) {
73
+ const database = await databaseTables(config);
74
+ const own = (await declarativeTexts(config)).filter((source) => !writtenByBlocks(source));
75
+ const columns = Object.fromEntries([...declaredTableColumns(own, config.schemas)].map(([table, names]) => [table, [...names]]));
76
+ const views = ownDeclaredViews(own, config.schemas);
77
+ return {
78
+ ownTables: {
79
+ ...database.tables,
80
+ ...ownDeclaredTables(own, config.schemas),
81
+ ...views.tables
82
+ },
83
+ ownViews: {
84
+ ...database.views,
85
+ ...views.views
86
+ },
87
+ ownColumns: {
88
+ ...database.columns,
89
+ ...columns,
90
+ ...views.columns
91
+ },
92
+ ownUpdatedAtTriggers: {
93
+ ...database.updatedAtTriggers,
94
+ ...declaredUpdatedAtTriggers(own, config.schemas)
95
+ },
96
+ ownPolicies: {
97
+ ...database.policies,
98
+ ...declaredPolicies(own, config.schemas)
99
+ }
100
+ };
101
+ }
102
+ /** A trigger function named like one that keeps `updated_at` current. */
103
+ const UPDATED_AT_FUNCTION = /updated_at|moddatetime|touch/i;
104
+ const BLOCK_MARKER = /^-- @(?:bsb-block|bsb-tables|bs-module|bs-app-tables)\b/m;
105
+ const BLOCK_MIGRATION = /_better_supabase_[a-z_]+\.sql$/;
106
+ /**
107
+ * The `schema.table`s that the files better-supabase wrote create, among
108
+ * `sources`; a table an app table entry enriches is not one of them.
109
+ */
110
+ function blockDeclaredTables(sources, schemas) {
111
+ return new Set(declaredTables(sources.filter(writtenByBlocks), schemas));
112
+ }
113
+ /** A file better-supabase wrote: a block file or a module migration. */
114
+ function writtenByBlocks(source) {
115
+ return BLOCK_MARKER.test(source.text) || BLOCK_MIGRATION.test(source.path);
116
+ }
117
+ /**
118
+ * The tables in the saved snapshot (`source.snapshot`) that no block file or
119
+ * module migration created, mapped to `database`. Without a snapshot, the app's
120
+ * schema files and migrations stand in for it.
121
+ */
122
+ async function databaseTables(config) {
123
+ const none = {
124
+ tables: {},
125
+ views: {},
126
+ columns: {},
127
+ updatedAtTriggers: {},
128
+ policies: {}
129
+ };
130
+ const path = config.source.snapshot;
131
+ if (path === void 0 || !existsSync(resolve(config.root, path))) return none;
132
+ let snapshot;
133
+ try {
134
+ snapshot = await parseSnapshot(JSON.parse(await readFile(resolve(config.root, path), "utf-8")), path);
135
+ } catch (cause) {
136
+ if (cause instanceof TypegenMissingError) return none;
137
+ throw cause;
138
+ }
139
+ const created = blockDeclaredTables(await schemaTexts(config), config.schemas);
140
+ const tables = {};
141
+ const views = {};
142
+ const columns = {};
143
+ const updatedAtTriggers = {};
144
+ const policies = {};
145
+ for (const table of toCatalog(snapshot).tables) {
146
+ const name = `${table.schema}.${table.name}`;
147
+ if (config.schemas.includes(table.schema) && !created.has(name)) {
148
+ tables[name] = "database";
149
+ columns[name] = table.columns.map((column) => column.name);
150
+ if (table.kind === "view") views[name] = { updatable: table.insertable && table.updatable };
151
+ const kept = table.triggers.find((trigger) => !trigger.name.startsWith("bsb_") && trigger.events.includes("update") && UPDATED_AT_FUNCTION.test(trigger.function));
152
+ if (kept !== void 0) updatedAtTriggers[name] = kept.name;
153
+ policies[name] = table.policies.filter((policy) => !policy.name.startsWith("bsb_"));
154
+ }
155
+ }
156
+ return {
157
+ tables,
158
+ views,
159
+ columns,
160
+ updatedAtTriggers,
161
+ policies
162
+ };
163
+ }
164
+ /**
165
+ * `schema.table` to the app's own schema file that creates it: every
166
+ * declarative file, or migration, that better-supabase didn't write.
167
+ */
168
+ function ownDeclaredTables(sources, schemas) {
169
+ const ownTables = {};
170
+ for (const source of sources) for (const table of declaredTables([source], schemas)) ownTables[table] ??= source.path;
171
+ return ownTables;
172
+ }
173
+ /**
174
+ * The views and materialized views the app's own files create, as `ownTables`
175
+ * entries, with their columns where the files name them.
176
+ */
177
+ function ownDeclaredViews(sources, schemas) {
178
+ const tables = {};
179
+ const views = {};
180
+ const columns = {};
181
+ for (const source of sources) for (const [view, declared] of declaredViews([source], schemas)) {
182
+ tables[view] ??= source.path;
183
+ views[view] = { updatable: declared.updatable };
184
+ if (declared.columns !== void 0) columns[view] = declared.columns;
185
+ }
186
+ return {
187
+ tables,
188
+ views,
189
+ columns
190
+ };
191
+ }
192
+ function vectorSchemaOf(sources) {
193
+ const schema = extensionSchema(sources, "vector");
194
+ return schema === void 0 ? {} : { vectorSchema: schema };
195
+ }
196
+ /**
197
+ * The folder that holds both the project root and `sql.dir`: the root, or an
198
+ * ancestor when `sql.dir` points at a shared stack. The `sql` commands write
199
+ * SQL files only inside it.
200
+ */
201
+ function sqlRoot(config) {
202
+ const dir = resolve(config.root, config.sql.dir);
203
+ let stop = resolve(config.root);
204
+ while (dir !== stop && !dir.startsWith(stop + sep) && dirname(stop) !== stop) stop = dirname(stop);
205
+ return stop;
206
+ }
207
+ /**
208
+ * A plan for files under the project root or `sql.dir`, with paths relative to
209
+ * the project root.
210
+ */
211
+ function sqlPlan(config, plan) {
212
+ return {
213
+ ...plan,
214
+ root: sqlRoot(config),
215
+ base: config.root,
216
+ files: plan.files.map((file) => ({
217
+ ...file,
218
+ path: resolve(config.root, file.path)
219
+ })),
220
+ ...plan.remove ? { remove: plan.remove.map((entry) => {
221
+ const path = resolve(config.root, typeof entry === "string" ? entry : entry.path);
222
+ return typeof entry === "string" ? path : {
223
+ ...entry,
224
+ path
225
+ };
226
+ }) } : {}
227
+ };
228
+ }
229
+ /**
230
+ * The migrations folder next to the `config.toml` found walking up from
231
+ * `sql.dir`, relative to the root; `supabase/migrations` without one. The walk
232
+ * stops where `sql.dir` and the root meet, so a `sql.dir` outside the project
233
+ * (a shared stack in a monorepo) finds that stack's folder.
234
+ */
235
+ function migrationsDir(config) {
236
+ const root = resolve(config.root);
237
+ let dir = resolve(root, config.sql.dir);
238
+ const stop = sqlRoot(config);
239
+ for (;;) {
240
+ if (existsSync(join(dir, "config.toml"))) return relative(root, join(dir, "migrations")).replaceAll("\\", "/");
241
+ if (dir === stop || dirname(dir) === dir) break;
242
+ dir = dirname(dir);
243
+ }
244
+ return "supabase/migrations";
245
+ }
246
+ //#endregion
247
+ export { sqlPlan as a, schemasDirOf as i, migrationsDir as n, writtenByBlocks as o, moduleLayoutFor as r, blockDeclaredTables as t };
@@ -1,8 +1,9 @@
1
1
  import { n as CliError } from "./errors-BTe6A15O.js";
2
2
  import { t as display } from "./io-DH1kcmmP.js";
3
- import { C as sqlPlan, _ as layoutFor, c as sameModuleMigration, d as DATA_NEXT, l as writeLatestMigration, m as writeExtensionsMigration, r as latestMigration, s as renderModuleMigration, t as MODULES_SUFFIX, u as writesMigrations, x as migrationsDir } from "./module-migration-aPCckev6.js";
3
+ import { _ as layoutFor, c as sameModuleMigration, d as DATA_NEXT, l as writeLatestMigration, m as writeExtensionsMigration, r as latestMigration, s as renderModuleMigration, t as MODULES_SUFFIX, u as writesMigrations } from "./module-migration-DOn6EmNz.js";
4
4
  import { d as readSupabaseToml, f as schemaPaths, h as tomlGet, i as diffEngine, l as migrationCommand, o as findSupabaseRoot, p as sqlWorkflow, t as PGDELTA_TABLE } from "./supabase-toml-CncmQbO0.js";
5
5
  import { d as fileDiff, i as changeLines, l as keepHandEdit, o as handEditedError, r as applyPlan, t as HAND_EDITED, u as planResult } from "./files-CX71yBm8.js";
6
+ import { a as sqlPlan, n as migrationsDir } from "./sql-layout-rFP0oq1N.js";
6
7
  import { t as loadTopics } from "./topics-BpdnYmWb.js";
7
8
  import { t as orphanedBlockFiles } from "./orphans-BAboqyVM.js";
8
9
  import { dirname, join, resolve } from "node:path";
@@ -1,145 +1,12 @@
1
1
  import { t as display } from "./io-DH1kcmmP.js";
2
- import { C as sqlPlan, _ as layoutFor, a as migrationInstances, c as sameModuleMigration, o as migrationModules, p as migrationStamp, r as latestMigration, s as renderModuleMigration, t as MODULES_SUFFIX, u as writesMigrations, x as migrationsDir } from "./module-migration-aPCckev6.js";
2
+ import { _ as layoutFor, a as migrationInstances, c as sameModuleMigration, o as migrationModules, p as migrationStamp, r as latestMigration, s as renderModuleMigration, t as MODULES_SUFFIX, u as writesMigrations } from "./module-migration-DOn6EmNz.js";
3
3
  import { d as fileDiff, i as changeLines, r as applyPlan } from "./files-CX71yBm8.js";
4
- import { a as write, o as topicPolicyFile, r as nextStep } from "./sync-btj01bcM.js";
4
+ import { a as sqlPlan, n as migrationsDir } from "./sql-layout-rFP0oq1N.js";
5
+ import { a as write, o as topicPolicyFile, r as nextStep } from "./sync-mANmYYoL.js";
6
+ import { a as legacyPrefixSql, i as legacyPrefixNames, r as legacyBlocksTableSql } from "./legacy-prefix-DkTA3Rhx.js";
5
7
  import { resolve } from "node:path";
6
8
  import { readFile } from "node:fs/promises";
7
9
  import { BLOCK_RENAMES, SQL_MODULES, currentBlockName, entityRenamePlan, formerBlockName, moduleFileVersion, moduleTopics, renderBlocks, sameBlockFile, upgradePlan } from "better-supabase/sql";
8
- //#region src/cli/sql/legacy-prefix.ts
9
- /**
10
- * Prefixes of the names the library builds outside the module files (realtime
11
- * broadcast triggers, tenant checks, state transitions, JSON Schema checks).
12
- */
13
- const LEGACY_PREFIXES = [
14
- "bs_broadcast_",
15
- "bs_same_tenant_",
16
- "bs_transition_",
17
- "bs_json_"
18
- ];
19
- const LEGACY_NAME = /\bbs_[a-z0-9_]+/g;
20
- /** The `bs_` object names in installed module SQL, before 0.15 renamed them. */
21
- function legacyPrefixNames(text) {
22
- return [...new Set(text.match(LEGACY_NAME))].toSorted();
23
- }
24
- const array = (values) => `array[${values.map((value) => `'${value.replaceAll("'", "''")}'`).join(", ")}]::text[]`;
25
- /**
26
- * Renames the installed `bs_` triggers, policies, constraints, indexes and
27
- * functions to `bsb_`, so the module files' `drop ... if exists bsb_x` replace
28
- * them instead of adding a second copy. Only the names in `names` and the
29
- * runtime prefixes are renamed, and only while the new name is free, so the
30
- * step can run again.
31
- */
32
- function legacyPrefixSql(names) {
33
- return `do $bsb_rename$
34
- declare
35
- v_names constant text[] := ${array(names)};
36
- v_prefixes constant text[] := ${array(LEGACY_PREFIXES)};
37
- r record;
38
- begin
39
- for r in
40
- select t.tgname as name, t.tgrelid::regclass::text as rel
41
- from pg_trigger t
42
- where not t.tgisinternal
43
- and (t.tgname = any (v_names) or exists (select 1 from unnest(v_prefixes) x where starts_with(t.tgname, x)))
44
- and not exists (select 1 from pg_trigger u where u.tgrelid = t.tgrelid and u.tgname = 'bsb_' || substr(t.tgname, 4))
45
- loop
46
- begin
47
- execute format('alter trigger %I on %s rename to %I', r.name, r.rel, 'bsb_' || substr(r.name, 4));
48
- exception when insufficient_privilege then
49
- raise warning 'better-supabase: rename % to bsb_% by hand; the migration role does not own it', r.name, substr(r.name, 4);
50
- end;
51
- end loop;
52
-
53
- for r in
54
- select p.polname as name, p.polrelid::regclass::text as rel
55
- from pg_policy p
56
- where (p.polname = any (v_names) or exists (select 1 from unnest(v_prefixes) x where starts_with(p.polname, x)))
57
- and not exists (select 1 from pg_policy q where q.polrelid = p.polrelid and q.polname = 'bsb_' || substr(p.polname, 4))
58
- loop
59
- begin
60
- execute format('alter policy %I on %s rename to %I', r.name, r.rel, 'bsb_' || substr(r.name, 4));
61
- exception when insufficient_privilege then
62
- raise warning 'better-supabase: rename % to bsb_% by hand; the migration role does not own it', r.name, substr(r.name, 4);
63
- end;
64
- end loop;
65
-
66
- for r in
67
- select c.conname as name, c.conrelid::regclass::text as rel
68
- from pg_constraint c
69
- where c.conrelid <> 0
70
- and (c.conname = any (v_names) or exists (select 1 from unnest(v_prefixes) x where starts_with(c.conname, x)))
71
- and not exists (select 1 from pg_constraint d where d.conrelid = c.conrelid and d.conname = 'bsb_' || substr(c.conname, 4))
72
- loop
73
- begin
74
- execute format('alter table %s rename constraint %I to %I', r.rel, r.name, 'bsb_' || substr(r.name, 4));
75
- exception when insufficient_privilege then
76
- raise warning 'better-supabase: rename % to bsb_% by hand; the migration role does not own it', r.name, substr(r.name, 4);
77
- end;
78
- end loop;
79
-
80
- for r in
81
- select n.nspname as schema, i.relname as name
82
- from pg_class i
83
- join pg_namespace n on n.oid = i.relnamespace
84
- where i.relkind in ('i', 'I')
85
- and (i.relname = any (v_names) or exists (select 1 from unnest(v_prefixes) x where starts_with(i.relname, x)))
86
- and not exists (select 1 from pg_constraint c where c.conindid = i.oid)
87
- and to_regclass(format('%I.%I', n.nspname, 'bsb_' || substr(i.relname, 4))) is null
88
- loop
89
- begin
90
- execute format('alter index %I.%I rename to %I', r.schema, r.name, 'bsb_' || substr(r.name, 4));
91
- exception when insufficient_privilege then
92
- raise warning 'better-supabase: rename % to bsb_% by hand; the migration role does not own it', r.name, substr(r.name, 4);
93
- end;
94
- end loop;
95
-
96
- for r in
97
- select f.oid::regprocedure::text as fn, f.proname as name
98
- from pg_proc f
99
- join pg_namespace n on n.oid = f.pronamespace
100
- where n.nspname not in ('pg_catalog', 'information_schema')
101
- and (f.proname = any (v_names) or exists (select 1 from unnest(v_prefixes) x where starts_with(f.proname, x)))
102
- and not exists (
103
- select 1 from pg_proc g
104
- where g.pronamespace = f.pronamespace and g.proname = 'bsb_' || substr(f.proname, 4)
105
- and g.proargtypes = f.proargtypes
106
- )
107
- loop
108
- begin
109
- execute format('alter function %s rename to %I', r.fn, 'bsb_' || substr(r.name, 4));
110
- exception when insufficient_privilege then
111
- raise warning 'better-supabase: rename % to bsb_% by hand; the migration role does not own it', r.name, substr(r.name, 4);
112
- end;
113
- end loop;
114
- end
115
- $bsb_rename$;`;
116
- }
117
- /**
118
- * Creates `better_supabase.blocks` and copies the rows of the 0.14
119
- * `better_supabase.modules` table into it, so the schema diff that drops the
120
- * old table loses no installed versions.
121
- */
122
- const legacyBlocksTableSql = `create schema if not exists better_supabase;
123
- create table if not exists better_supabase.blocks (
124
- name text primary key,
125
- version integer not null,
126
- mode text not null,
127
- installed_at timestamptz not null default now(),
128
- updated_at timestamptz not null default now()
129
- );
130
- alter table better_supabase.blocks enable row level security;
131
- revoke all on better_supabase.blocks from anon, authenticated;
132
- grant select on better_supabase.blocks to service_role;
133
- do $bsb_blocks$
134
- begin
135
- if to_regclass('better_supabase.modules') is not null then
136
- insert into better_supabase.blocks (name, version, mode, installed_at, updated_at)
137
- select name, version, mode, installed_at, updated_at from better_supabase.modules
138
- on conflict (name) do nothing;
139
- end if;
140
- end
141
- $bsb_blocks$;`;
142
- //#endregion
143
10
  //#region src/cli/sql/renamed-blocks.ts
144
11
  /** Block names match `[a-z0-9-]+`, so quoting needs no escaping. */
145
12
  const literal = (name) => `'${name}'`;
@@ -1,8 +1,8 @@
1
1
  import { p as commandMeta, r as defineCliCommand } from "./command-CQ61x6gN.js";
2
2
  import { i as plain } from "./style-Bm2X5JrN.js";
3
- import { t as syncModules } from "./sync-btj01bcM.js";
3
+ import { t as syncModules } from "./sync-mANmYYoL.js";
4
4
  import { t as SQL_ARGS } from "./args-UEwg0l-N.js";
5
- import { t as upgrade } from "./upgrade-B596d4t8.js";
5
+ import { t as upgrade } from "./upgrade-B0Q9wMs-.js";
6
6
  //#region src/cli/commands/upgrade.ts
7
7
  const UPGRADE_ARGS = {
8
8
  check: {
@@ -1,4 +1,4 @@
1
1
  //#region src/cli/version.ts
2
- const VERSION = "0.15.0";
2
+ const VERSION = "0.15.1";
3
3
  //#endregion
4
4
  export { VERSION as t };
@@ -1,8 +1,8 @@
1
1
  import { a as DataSync, c as LocalTablesOption, i as DataEntry, l as liveEngine, n as DataEngine, o as DataSyncState, r as DataEngineOptions, s as LiveEngineOptions, t as DataChanges, u as memoryEngine } from "../data-engine-BWoz9lED.js";
2
- import { n as TopicPort, r as TopicWatch, t as TopicHandle } from "../watch-topic-BcGfvZOE.js";
3
- import { a as PickFilesOptions, c as Shortcut, d as UploadPort, f as memoryStorage, i as KeyboardPort, l as StoragePort, n as DeepLinkPort, o as PickedFile, p as storageUpload, r as FilePickerPort, s as PushTokenPort, t as ClientPorts, u as UploadDestination } from "../ports-sx226JUL.js";
4
- import { a as ClientAuth, i as BindClientOptions, n as AuthUser, o as bindClient, r as BetterClient, t as AuthSnapshot } from "../bind-CrMBwrPN.js";
5
- import { a as defineController, i as ControllerState, n as Controller, o as whileSignedIn, r as ControllerParts, t as AuthPort } from "../controller-BrP0gn47.js";
2
+ import { n as TopicPort, r as TopicWatch, t as TopicHandle } from "../watch-topic-Bo9S2R4P.js";
3
+ import { a as PickFilesOptions, c as Shortcut, d as UploadPort, f as memoryStorage, i as KeyboardPort, l as StoragePort, n as DeepLinkPort, o as PickedFile, p as storageUpload, r as FilePickerPort, s as PushTokenPort, t as ClientPorts, u as UploadDestination } from "../ports-CpdiQv1D.js";
4
+ import { a as ClientAuth, i as BindClientOptions, n as AuthUser, o as bindClient, r as BetterClient, t as AuthSnapshot } from "../bind-h5jre2K0.js";
5
+ import { a as defineController, i as ControllerState, n as Controller, o as whileSignedIn, r as ControllerParts, t as AuthPort } from "../controller-DyPPMFSw.js";
6
6
  import { n as FunctionContract } from "../function-contract-DxFNOmsm.js";
7
- import { a as webDeepLinks, c as webPorts, d as FunctionContracts, f as FunctionsHost, h as functions, i as WebPushTokenOptions, l as webPushToken, m as TypedFunctions, n as createClient, o as webFilePicker, p as InvokeOptions, r as PushRegistrationLike, s as webKeyboard, t as ClientOptions, u as webStorage } from "../index-BUuVq1co.js";
7
+ import { a as webDeepLinks, c as webPorts, d as FunctionContracts, f as FunctionsHost, h as functions, i as WebPushTokenOptions, l as webPushToken, m as TypedFunctions, n as createClient, o as webFilePicker, p as InvokeOptions, r as PushRegistrationLike, s as webKeyboard, t as ClientOptions, u as webStorage } from "../index-B4gcStOz.js";
8
8
  export { type AuthPort, type AuthSnapshot, type AuthUser, type BetterClient, type BindClientOptions, type ClientAuth, ClientOptions, type ClientPorts, type Controller, type ControllerParts, type ControllerState, type DataChanges, type DataEngine, type DataEngineOptions, type DataEntry, type DataSync, type DataSyncState, type DeepLinkPort, type FilePickerPort, type FunctionContract, type FunctionContracts, type FunctionsHost, type InvokeOptions, type KeyboardPort, type LiveEngineOptions, type LocalTablesOption, type PickFilesOptions, type PickedFile, type PushRegistrationLike, type PushTokenPort, type Shortcut, type StoragePort, type TopicHandle, type TopicPort, type TopicWatch, type TypedFunctions, type UploadDestination, type UploadPort, type WebPushTokenOptions, bindClient, createClient, defineController, functions, liveEngine, memoryEngine, memoryStorage, storageUpload, webDeepLinks, webFilePicker, webKeyboard, webPorts, webPushToken, webStorage, whileSignedIn };
@@ -1,9 +1,9 @@
1
1
  import { t as AsyncResult } from "../../result-DZeA5KS6.js";
2
2
  import { C as UploadOptions, S as UploadBody } from "../../bucket-CiNi8sIw.js";
3
- import { n as TopicPort, r as TopicWatch, t as TopicHandle } from "../../watch-topic-BcGfvZOE.js";
4
- import { a as PickFilesOptions, c as Shortcut, d as UploadPort, f as memoryStorage, i as KeyboardPort, l as StoragePort, n as DeepLinkPort, o as PickedFile, p as storageUpload, r as FilePickerPort, s as PushTokenPort, t as ClientPorts, u as UploadDestination } from "../../ports-sx226JUL.js";
5
- import { a as ClientAuth, i as BindClientOptions, n as AuthUser, o as bindClient, r as BetterClient, t as AuthSnapshot } from "../../bind-CrMBwrPN.js";
6
- import { n as ExpoPushTokenOptions, r as expoPushToken, t as ExpoNotificationsLike } from "../../push-token-D3Vcf0Pf.js";
3
+ import { n as TopicPort, r as TopicWatch, t as TopicHandle } from "../../watch-topic-Bo9S2R4P.js";
4
+ import { a as PickFilesOptions, c as Shortcut, d as UploadPort, f as memoryStorage, i as KeyboardPort, l as StoragePort, n as DeepLinkPort, o as PickedFile, p as storageUpload, r as FilePickerPort, s as PushTokenPort, t as ClientPorts, u as UploadDestination } from "../../ports-CpdiQv1D.js";
5
+ import { a as ClientAuth, i as BindClientOptions, n as AuthUser, o as bindClient, r as BetterClient, t as AuthSnapshot } from "../../bind-h5jre2K0.js";
6
+ import { n as ExpoPushTokenOptions, r as expoPushToken, t as ExpoNotificationsLike } from "../../push-token-B3m3pWAv.js";
7
7
  import { a as OAuthSignInOptions, c as linkParams, i as OAuthClient, l as signInWithOAuthBrowser, n as AuthLinkClient, o as WebBrowserLike, r as AuthLinkResult, s as handleAuthDeepLink, t as AuthFailure } from "../../auth-link-B4NL84XU.js";
8
8
  import { SupabaseClient } from "@supabase/supabase-js";
9
9
  //#region src/client/native/auto-refresh.d.ts
@@ -1,5 +1,5 @@
1
1
  import { o as problemResponse } from "./problem-Bf0cJ7tk.js";
2
- import { T as serverCore, _ as withSupport, g as withTenant, s as createServer, w as withServerContext, y as withSession } from "./adapter-B0b6MXYS.js";
2
+ import { T as serverCore, _ as withSupport, g as withTenant, s as createServer, w as withServerContext, y as withSession } from "./adapter-Dyks1lX1.js";
3
3
  import { s as withPrimaryPin } from "./replicas-Dyoh3CEg.js";
4
4
  import { r as guard, t as defaultExpose } from "./respond-C3CcOZlA.js";
5
5
  import { a as withAuthMode, i as withAuth, o as withJwtClaims, s as withUserClaims } from "./claims-DTy6R6my.js";
@@ -1,8 +1,8 @@
1
1
  import { O as AnyFunctions, k as AnyModels } from "./types-DFdg_4yN.js";
2
2
  import { r as AuthState } from "./resolve-CXX6DHv3.js";
3
3
  import { t as BetterSupabase, v as Db } from "./define-DFBnQyYg.js";
4
- import { K as ReplicaState, a as ServerContext, c as ServerOptions, n as BetterServer, v as ActiveSupport } from "./server-types-CFtehAsr.js";
5
- import { n as SessionEntryConfig } from "./session-CH0SKgIz.js";
4
+ import { K as ReplicaState, a as ServerContext, c as ServerOptions, n as BetterServer, v as ActiveSupport } from "./server-types-7QPzW2bF.js";
5
+ import { n as SessionEntryConfig } from "./session-CfBCJGgc.js";
6
6
  import { r as GuardOptions } from "./respond-Dn1_YhC1.js";
7
7
  import { SupabaseClient } from "@supabase/supabase-js";
8
8
  import { Entry, SingleKeyEntry } from "@supabase/middleware";
@@ -1,6 +1,6 @@
1
1
  import { M as Casing } from "../types-DFdg_4yN.js";
2
2
  import { C as EntityConfig, S as EntitiesConfig, a as AuthorizationProvider, b as DEFAULT_ACTIVE_TENANT, c as AuthorizationScope, d as AccessBlockConfig, f as ActiveTenantSource, g as BlockMode, i as AuthorizationPermission, k as tenantNameOf, l as AuthorizationTokenHook, m as BlockConfig, n as AuthorizationMembership, o as AuthorizationRequirement, p as AnyBlocksConfig, r as AuthorizationOperation, s as AuthorizationRoleSource, t as AuthorizationFunctions, u as providerApiProblem, v as BlockScope, x as DisabledRow, y as BlocksConfig } from "../authorization-HZdJCaVm.js";
3
- import { $ as flattenConfig, $n as APP_COLUMN_FORMATS, $t as ApiConfig, A as valibot, Ai as GEN_TASKS, An as ExposeRole, Ar as CatalogPolicy, At as Generator, B as JsonSchemaTarget, Br as Snapshot, Bt as GeneratorJsonSchema, Ci as GenTask, Cn as TopicTriggerTopicConfig, Cr as CatalogColumnGrant, D as ZodGeneratorOptions, Di as OpenApiConfig, Dn as ColumnPrivilege, Dr as CatalogFunctionArg, Dt as ClaimsConfig, E as ZodFlavor, Ei as MigrationSafetyConfig, En as VectorSearchConfig, Er as CatalogFunction, Et as resolveJsonSchema, F as FactoriesGeneratorOptions, Fr as ExtrasFunction, Ft as GeneratorField, G as BlockEntity, Gr as PostgresFunction, Gt as JsonTypeConfig, H as DEFAULT_CLAIMS, Hr as SnapshotExtras, Ht as GeneratorNoun, I as factories, Ir as ExtrasHook, It as GeneratorFunction, J as blockSubjectTypes, Jr as RpcFunctionArg, Jt as TableConfig, K as blockEntities, Kr as PostgresFunctionArg, Kt as RelationsConfig, L as JsonSchemaGeneratorOptions, Lr as ExtrasHookFunction, Lt as GeneratorFunctionArg, M as standardSchema, Mi as INTEGRATION_NAMES, Mn as ResolvedExpose, Mr as CatalogTrigger, Mt as GeneratorBlockEntity, N as NuqsGeneratorOptions, Ni as IntegrationInfo, Nr as CatalogUnique, Nt as GeneratorColumn, O as zod, Oi as SkillsAgent, On as ExposeConfig, Or as CatalogGrant, Ot as CodecsConfig, P as nuqs, Pi as SKILLS_AGENTS, Pr as ExtrasDomain, Pt as GeneratorEntitySchemas, Q as blockEntrySource, Qn as APP_COLUMN_ACCESS, Qr as RpcTypeReference, Qt as ResolvedExtensions, R as buildJsonSchema, Rr as ExtrasTable, Rt as GeneratorInput, Si as GenConfig, Sn as TopicTriggerPayloadValueConfig, Sr as CatalogColumn, Ti as KeysConfig, Tn as VectorDistance, Tr as CatalogForeignKey, U as claimPaths, Ur as GeneratorMetadata, Ut as GeneratorTable, V as ClaimPaths, Vr as SnapshotBucket, Vt as GeneratorModel, W as tenantClaimPaths, Wr as PostgresColumn, Wt as JsonSchemaSource, X as RENAMED_BLOCK_KEYS, Xr as RpcFunctionReturns, Xt as FlatConfig, Y as CONFIG_GROUPS, Yr as RpcFunctionOverload, Yt as DataHooksFramework, Z as RENAMED_CONFIG_KEYS, Zr as RpcReturnColumn, Zt as ResolvedConfig, _n as SeedConfig, _r as AppTableSubject, an as BlocksInput, ar as AppColumnConfig, at as resolveConfig, bi as DoctorConfig, bn as TopicTriggerConfig, br as Catalog, cn as GenGroupConfig, cr as AppLookupConfig, ct as BucketName, dn as ToolingConfig, dr as AppReferenceTarget, dt as TypedReference, en as AppTableInput, er as APP_COLUMN_TYPES, et as groupConfig, fn as EntitlementPlansSource, fr as AppRollupAggregate, gn as ResolvedSqlConfig, gr as AppTableEvents, hn as RealtimeConfig, hr as AppTableEventKind, in as BlockInput, ir as AppColumnAccess, it as defineConfig, j as StandardSchemaGeneratorOptions, ji as INTEGRATION_INFO, jn as Privilege, jr as CatalogTable, jt as GeneratorBlock, k as ValibotGeneratorOptions, ki as SkillsConfig, kn as ExposePrivilege, kr as CatalogIndex, kt as GeneratedFile, ln as OrganizationConfig, lr as AppOnDeleteAction, lt as ConfigReferences, mn as BucketConfig, mr as AppTableConfig, nn as AuthConfig, nr as APP_ROLLUP_AGGREGATES, nt as hasFlatTables, on as DatabaseConfig, or as AppColumnFormat, ot as AppTableNames, pn as EntitlementsConfig, pr as AppRollupConfig, pt as ExpandedConfig, q as blockEntityRenames, qn as CONFIG_DEFAULTS, qr as RpcFunction, qt as SourceConfig, rn as BetterSupabaseConfig, rr as APP_TABLE_EVENT_KINDS, rt as CONFIG_SCHEMA_URL, sn as EnvironmentConfig, sr as AppColumnType, st as BlockTableReference, tn as AppTablesInput, tr as APP_ON_DELETE_ACTIONS, tt as groupEntries, un as SqlInput, ur as AppReference, ut as RoleNames, vn as SqlConfig, vr as AppTableVersions, wi as IntegrationName, wn as TopicTriggerValueConfig, wr as CatalogEnum, xi as EnvFileConfig, xn as TopicTriggerLookupConfig, xr as CatalogCheck, yn as SqlWorkflow, yr as AppTablesConfig, z as jsonSchema, zr as ForeignKeyAction, zt as GeneratorInputSchema } from "../context-CEuTKrkz.js";
3
+ import { $ as blockEntrySource, $n as APP_COLUMN_ACCESS, $r as RpcTypeReference, $t as ResolvedExtensions, A as ValibotGeneratorOptions, Ai as SkillsConfig, An as ExposePrivilege, Ar as CatalogIndex, At as GeneratedFile, B as jsonSchema, Br as ForeignKeyAction, Bt as GeneratorInputSchema, Ci as GenConfig, Cn as TopicTriggerPayloadValueConfig, Cr as CatalogColumn, D as ZodFlavor, Di as MigrationSafetyConfig, Dn as VectorSearchConfig, Dr as CatalogFunction, Dt as resolveJsonSchema, Ei as KeysConfig, En as VectorDistance, Er as CatalogForeignKey, F as nuqs, Fi as SKILLS_AGENTS, Fr as ExtrasDomain, Ft as GeneratorEntitySchemas, G as tenantClaimPaths, Gr as PostgresColumn, Gt as JsonSchemaSource, H as ClaimPaths, Hr as SnapshotBucket, Ht as GeneratorModel, I as FactoriesGeneratorOptions, Ir as ExtrasFunction, It as GeneratorField, J as blockEntityRenames, Jn as CONFIG_DEFAULTS, Jr as RpcFunction, Jt as SourceConfig, K as BlockEntity, Kr as PostgresFunction, Kt as JsonTypeConfig, L as factories, Lr as ExtrasHook, Lt as GeneratorFunction, M as StandardSchemaGeneratorOptions, Mi as INTEGRATION_INFO, Mn as Privilege, Mr as CatalogTable, Mt as GeneratorBlock, N as standardSchema, Ni as INTEGRATION_NAMES, Nn as ResolvedExpose, Nr as CatalogTrigger, Nt as GeneratorBlockEntity, O as ZodGeneratorOptions, Oi as OpenApiConfig, On as ColumnPrivilege, Or as CatalogFunctionArg, Ot as ClaimsConfig, P as NuqsGeneratorOptions, Pi as IntegrationInfo, Pr as CatalogUnique, Pt as GeneratorColumn, Q as RENAMED_CONFIG_KEYS, Qr as RpcReturnColumn, Qt as ResolvedConfig, R as JsonSchemaGeneratorOptions, Rr as ExtrasHookFunction, Rt as GeneratorFunctionArg, Si as EnvFileConfig, Sn as TopicTriggerLookupConfig, Sr as CatalogCheck, Ti as IntegrationName, Tn as TopicTriggerValueConfig, Tr as CatalogEnum, U as DEFAULT_CLAIMS, Ur as SnapshotExtras, Ut as GeneratorNoun, V as JsonSchemaTarget, Vr as Snapshot, Vt as GeneratorJsonSchema, W as claimPaths, Wr as GeneratorMetadata, Wt as GeneratorTable, X as CONFIG_GROUPS, Xr as RpcFunctionOverload, Xt as DataHooksFramework, Y as blockSubjectTypes, Yr as RpcFunctionArg, Yt as TableConfig, Z as RENAMED_BLOCK_KEYS, Zr as RpcFunctionReturns, Zt as FlatConfig, _n as ResolvedSqlConfig, _r as AppTableEvents, an as BlockInput, ar as AppColumnAccess, at as defineConfig, bn as SqlWorkflow, br as AppTablesConfig, cn as EnvironmentConfig, cr as AppColumnType, ct as BlockTableReference, dn as SqlInput, dr as AppReference, dt as RoleNames, en as ApiConfig, er as APP_COLUMN_FORMATS, et as flattenConfig, fn as ToolingConfig, fr as AppReferenceTarget, ft as TypedReference, gn as RealtimeConfig, gr as AppTableEventKind, hn as BucketConfig, hr as AppTableConfig, in as BetterSupabaseConfig, ir as APP_TABLE_EVENT_KINDS, it as CONFIG_SCHEMA_URL, j as valibot, ji as GEN_TASKS, jn as ExposeRole, jr as CatalogPolicy, jt as Generator, k as zod, ki as SkillsAgent, kn as ExposeConfig, kr as CatalogGrant, kt as CodecsConfig, ln as GenGroupConfig, lr as AppLookupConfig, lt as BucketName, mn as EntitlementsConfig, mr as AppRollupConfig, mt as ExpandedConfig, nn as AppTablesInput, nr as APP_ON_DELETE_ACTIONS, nt as groupEntries, on as BlocksInput, or as AppColumnConfig, ot as resolveConfig, pn as EntitlementPlansSource, pr as AppRollupAggregate, q as blockEntities, qr as PostgresFunctionArg, qt as RelationsConfig, rn as AuthConfig, rr as APP_ROLLUP_AGGREGATES, rt as hasFlatTables, sn as DatabaseConfig, sr as AppColumnFormat, st as AppTableNames, tn as AppTableInput, tr as APP_COLUMN_TYPES, tt as groupConfig, un as OrganizationConfig, ur as AppOnDeleteAction, ut as ConfigReferences, vn as SeedConfig, vr as AppTableSubject, wi as GenTask, wn as TopicTriggerTopicConfig, wr as CatalogColumnGrant, xi as DoctorConfig, xn as TopicTriggerConfig, xr as Catalog, yn as SqlConfig, yr as AppTableVersions, z as buildJsonSchema, zr as ExtrasTable, zt as GeneratorInput } from "../context-TGX2eDS5.js";
4
4
  import { n as SubjectsConfig, t as SubjectConfig } from "../subjects-DvmQeF_F.js";
5
5
  import { a as FieldFormat, o as FieldFormatInput, r as FIELD_FORMATS } from "../field-formats-CAFNkKSN.js";
6
6
  export { APP_COLUMN_ACCESS, APP_COLUMN_FORMATS, APP_COLUMN_TYPES, APP_ON_DELETE_ACTIONS, APP_ROLLUP_AGGREGATES, APP_TABLE_EVENT_KINDS, type AccessBlockConfig, type ActiveTenantSource, type AnyBlocksConfig, type ApiConfig, type AppColumnAccess, type AppColumnConfig, type AppColumnFormat, type AppColumnType, type AppLookupConfig, type AppOnDeleteAction, type AppReference, type AppReferenceTarget, type AppRollupAggregate, type AppRollupConfig, type AppTableConfig, type AppTableEventKind, type AppTableEvents, type AppTableInput, type AppTableNames, type AppTableSubject, type AppTableVersions, type AppTablesConfig, type AppTablesInput, type AuthConfig, type AuthorizationFunctions, type AuthorizationMembership, type AuthorizationOperation, type AuthorizationPermission, type AuthorizationProvider, type AuthorizationRequirement, type AuthorizationRoleSource, type AuthorizationScope, type AuthorizationTokenHook, type BetterSupabaseConfig, type BlockConfig, type BlockEntity, type BlockInput, type BlockMode, type BlockScope, type BlockTableReference, type BlocksConfig, type BlocksInput, type BucketConfig, type BucketName, CONFIG_DEFAULTS, CONFIG_GROUPS, CONFIG_SCHEMA_URL, type Casing, type Catalog, type CatalogCheck, type CatalogColumn, type CatalogColumnGrant, type CatalogEnum, type CatalogForeignKey, type CatalogFunction, type CatalogFunctionArg, type CatalogGrant, type CatalogIndex, type CatalogPolicy, type CatalogTable, type CatalogTrigger, type CatalogUnique, type ClaimPaths, type ClaimsConfig, type CodecsConfig, type ColumnPrivilege, type ConfigReferences, DEFAULT_ACTIVE_TENANT, DEFAULT_CLAIMS, type DataHooksFramework, type DatabaseConfig, type DisabledRow, type DoctorConfig, type EntitiesConfig, type EntitlementPlansSource, type EntitlementsConfig, type EntityConfig, type EnvFileConfig, type EnvironmentConfig, type ExpandedConfig, type ExposeConfig, type ExposePrivilege, type ExposeRole, type ExtrasDomain, type ExtrasFunction, type ExtrasHook, type ExtrasHookFunction, type ExtrasTable, FIELD_FORMATS, type FactoriesGeneratorOptions, type FieldFormat, type FieldFormatInput, type FlatConfig, type ForeignKeyAction, GEN_TASKS, type GenConfig, type GenGroupConfig, type GenTask, type GeneratedFile, type Generator, type GeneratorBlock, type GeneratorBlockEntity, type GeneratorColumn, type GeneratorEntitySchemas, type GeneratorField, type GeneratorFunction, type GeneratorFunctionArg, type GeneratorInput, type GeneratorInputSchema, type GeneratorJsonSchema, type GeneratorMetadata, type GeneratorModel, type GeneratorNoun, type GeneratorTable, INTEGRATION_INFO, INTEGRATION_NAMES, type IntegrationInfo, type IntegrationName, type JsonSchemaGeneratorOptions, type JsonSchemaSource, type JsonSchemaTarget, type JsonTypeConfig, type KeysConfig, type MigrationSafetyConfig, type NuqsGeneratorOptions, type OpenApiConfig, type OrganizationConfig, type PostgresColumn, type PostgresFunction, type PostgresFunctionArg, type Privilege, RENAMED_BLOCK_KEYS, RENAMED_CONFIG_KEYS, type RealtimeConfig, type RelationsConfig, type ResolvedConfig, type ResolvedExpose, type ResolvedExtensions, type ResolvedSqlConfig, type RoleNames, type RpcFunction, type RpcFunctionArg, type RpcFunctionOverload, type RpcFunctionReturns, type RpcReturnColumn, type RpcTypeReference, SKILLS_AGENTS, type SeedConfig, type SkillsAgent, type SkillsConfig, type Snapshot, type SnapshotBucket, type SnapshotExtras, type SourceConfig, type SqlConfig, type SqlInput, type SqlWorkflow, type StandardSchemaGeneratorOptions, type SubjectConfig, type SubjectsConfig, type TableConfig, type ToolingConfig, type TopicTriggerConfig, type TopicTriggerLookupConfig, type TopicTriggerPayloadValueConfig, type TopicTriggerTopicConfig, type TopicTriggerValueConfig, type TypedReference, type ValibotGeneratorOptions, type VectorDistance, type VectorSearchConfig, type ZodFlavor, type ZodGeneratorOptions, blockEntities, blockEntityRenames, blockEntrySource, blockSubjectTypes, buildJsonSchema, claimPaths, defineConfig, factories, flattenConfig, groupConfig, groupEntries, hasFlatTables, jsonSchema, nuqs, providerApiProblem, resolveConfig, resolveJsonSchema, standardSchema, tenantClaimPaths, tenantNameOf, valibot, zod };
@@ -1,7 +1,7 @@
1
1
  /// <reference lib="esnext.temporal" />
2
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
3
  import { D as ResolvedBlock, E as NamedInstance, F as BlockNameRegistry, P as TablesOf, 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-HZdJCaVm.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-BVcLQ3DF.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-DvvcM54N.js";
5
5
  import { a as ScalarKind, i as FieldSpec } from "./table-schema-BlF6k62Q.js";
6
6
  import { n as SubjectsConfig } from "./subjects-DvmQeF_F.js";
7
7
  import { i as FIELD_FORMAT_NAMES, s as FieldFormatName } from "./field-formats-CAFNkKSN.js";
@@ -3364,6 +3364,17 @@ interface BlockSqlAppTable {
3364
3364
  * when secrets live in Vault. They are neither required nor checked.
3365
3365
  */
3366
3366
  readonly unused?: (ctx: BlockSqlContext) => readonly string[];
3367
+ /**
3368
+ * Whether the block's TypeScript API inserts, updates or deletes rows of the
3369
+ * table. Defaults to `true`. Doctor (BS349) reports such a table mapped to a
3370
+ * view Postgres can't write through.
3371
+ */
3372
+ readonly writes?: boolean;
3373
+ }
3374
+ /** A view of the app's at a block table's name. */
3375
+ interface OwnView {
3376
+ /** Whether `insert`, `update` and `delete` reach the table under the view. */
3377
+ readonly updatable: boolean;
3367
3378
  }
3368
3379
  /**
3369
3380
  * A table of the app's outside `names.tables` that a module writes columns of,
@@ -3458,6 +3469,12 @@ interface BlockSqlLayout {
3458
3469
  readonly ownTables?: Readonly<Record<string, string>>;
3459
3470
  /** The columns of the tables in `ownTables`, where they are known. */
3460
3471
  readonly ownColumns?: Readonly<Record<string, readonly string[]>>;
3472
+ /**
3473
+ * The entries of `ownTables` that are views or materialized views, by
3474
+ * `schema.view`, and whether Postgres can write through each one. A block
3475
+ * writes no DDL over a view, only the functions that read it.
3476
+ */
3477
+ readonly ownViews?: Readonly<Record<string, OwnView>>;
3461
3478
  /**
3462
3479
  * The trigger that already keeps `updated_at` current on a table in
3463
3480
  * `ownTables`, by `schema.table`. A block adds no `updated_at` trigger
@@ -3984,6 +4001,11 @@ interface BlockSqlContext {
3984
4001
  owns(table: string): boolean;
3985
4002
  /** The logical tables the app has; the module only adds their columns. */
3986
4003
  readonly appOwned: readonly string[];
4004
+ /**
4005
+ * The entries of `appOwned` that are views: the module writes no DDL on them,
4006
+ * only the functions that read them.
4007
+ */
4008
+ readonly appViews: readonly string[];
3987
4009
  readonly names: BlockSqlNames;
3988
4010
  readonly installedModules: readonly string[];
3989
4011
  /** The permission key for a module action, as a SQL literal. */
@@ -4126,4 +4148,4 @@ interface ExtraColumn {
4126
4148
  /** The contract's argument list with `{id}` resolved, as Postgres prints it. */
4127
4149
  declare function contractSignature(fn: BlockSqlContractFunction, idType: string): string;
4128
4150
  //#endregion
4129
- export { flattenConfig as $, APP_COLUMN_FORMATS as $n, PresetCatalog as $r, ApiConfig as $t, valibot as A, GEN_TASKS as Ai, ExposeRole as An, CatalogPolicy as Ar, Generator as At, JsonSchemaTarget as B, PRESET_GROUPS as Bn, Snapshot as Br, GeneratorJsonSchema as Bt, blockSqlVersion as C, GenTask as Ci, TopicTriggerTopicConfig as Cn, CatalogColumnGrant as Cr, listNames as Ct, ZodGeneratorOptions as D, OpenApiConfig as Di, ColumnPrivilege as Dn, CatalogFunctionArg as Dr, ClaimsConfig as Dt, ZodFlavor as E, MigrationSafetyConfig as Ei, VectorSearchConfig as En, CatalogFunction as Er, resolveJsonSchema as Et, FactoriesGeneratorOptions as F, presetOfSpec as Fn, ExtrasFunction as Fr, GeneratorField as Ft, BlockEntity as G, isPresetName as Gn, PostgresFunction as Gr, JsonTypeConfig as Gt, DEFAULT_CLAIMS as H, PresetGroup as Hn, SnapshotExtras as Hr, GeneratorNoun as Ht, factories as I, presetSpec as In, ExtrasHook as Ir, GeneratorFunction as It, blockSubjectTypes as J, DeclaredForeignKey as Jn, RpcFunctionArg as Jr, TableConfig as Jt, blockEntities as K, namedPreset as Kn, PostgresFunctionArg as Kr, RelationsConfig as Kt, JsonSchemaGeneratorOptions as L, DEFAULT_PRESET_NAME as Ln, ExtrasHookFunction as Lr, GeneratorFunctionArg as Lt, standardSchema as M, INTEGRATION_NAMES as Mi, ResolvedExpose as Mn, CatalogTrigger as Mr, GeneratorBlockEntity as Mt, NuqsGeneratorOptions as N, IntegrationInfo as Ni, PresetSpec as Nn, CatalogUnique as Nr, GeneratorColumn as Nt, zod as O, SkillsAgent as Oi, ExposeConfig as On, CatalogGrant as Or, CodecsConfig as Ot, nuqs as P, SKILLS_AGENTS as Pi, presetFromSpec as Pn, ExtrasDomain as Pr, GeneratorEntitySchemas as Pt, blockEntrySource as Q, APP_COLUMN_ACCESS as Qn, RpcTypeReference as Qr, ResolvedExtensions as Qt, buildJsonSchema as R, NamedPreset as Rn, ExtrasTable as Rr, GeneratorInput as Rt, BlockSqlUpgrade as S, GenConfig as Si, TopicTriggerPayloadValueConfig as Sn, CatalogColumn as Sr, ResolvedPresetBlock as St, TableGrant as T, KeysConfig as Ti, VectorDistance as Tn, CatalogForeignKey as Tr, resolvePreset as Tt, claimPaths as U, PresetName as Un, GeneratorMetadata as Ur, GeneratorTable as Ut, ClaimPaths as V, PRESET_NAMES as Vn, SnapshotBucket as Vr, GeneratorModel as Vt, tenantClaimPaths as W, defaultPreset as Wn, PostgresColumn as Wr, JsonSchemaSource as Wt, RENAMED_BLOCK_KEYS as X, AuditedTable as Xn, RpcFunctionReturns as Xr, FlatConfig as Xt, CONFIG_GROUPS as Y, sameTenantLayout as Yn, RpcFunctionOverload as Yr, DataHooksFramework as Yt, RENAMED_CONFIG_KEYS as Z, auditRegistrations as Zn, RpcReturnColumn as Zr, ResolvedConfig as Zt, BlockSqlDeprecation as _, integrationsForFramework as _i, SeedConfig as _n, AppTableSubject as _r, presetConfig as _t, BlockSqlContext as a, PRESET_FRAMEWORKS as ai, BlocksInput as an, AppColumnConfig as ar, resolveConfig as at, BlockSqlLayout as b, DoctorConfig as bi, TopicTriggerConfig as bn, Catalog as br, PresetIntegration as bt, BlockSqlIdType as c, PresetAccess as ci, GenGroupConfig as cn, AppLookupConfig as cr, BucketName as ct, MODULE_ID_TYPES as d, PresetFieldKey as di, ToolingConfig as dn, AppReferenceTarget as dr, TypedReference as dt, PresetCatalogBlock as ei, AppTableInput as en, APP_COLUMN_TYPES as er, groupConfig as et, contractSignature as f, PresetFieldValue as fi, EntitlementPlansSource as fn, AppRollupAggregate as fr, ConfigConventions as ft, BlockSqlAccessProvider as g, PresetValueInfo as gi, ResolvedSqlConfig as gn, AppTableEvents as gr, expandPreset as gt, BlockSql as h, PresetScope as hi, RealtimeConfig as hn, AppTableEventKind as hr, conventionConfig as ht, BlockSqlAudit as i, DEFAULT_CONVENTIONS as ii, BlockInput as in, AppColumnAccess as ir, defineConfig as it, StandardSchemaGeneratorOptions as j, INTEGRATION_INFO as ji, Privilege as jn, CatalogTable as jr, GeneratorBlock as jt, ValibotGeneratorOptions as k, SkillsConfig as ki, ExposePrivilege as kn, CatalogIndex as kr, GeneratedFile as kt, BlockSqlNames as l, PresetConventions as li, OrganizationConfig as ln, AppOnDeleteAction as lr, ConfigReferences as lt, moduleIdType as m, PresetPlatforms as mi, BucketConfig as mn, AppTableConfig as mr, PresetInput as mt, AuditCategory as n, PresetGlueItem as ni, AuthConfig as nn, APP_ROLLUP_AGGREGATES as nr, hasFlatTables as nt, BlockSqlContractFunction as o, PRESET_TENANT_NAMES as oi, DatabaseConfig as on, AppColumnFormat as or, AppTableNames as ot, isBlockSqlIdType as p, PresetFramework as pi, EntitlementsConfig as pn, AppRollupConfig as pr, ExpandedConfig as pt, blockEntityRenames as q, CONFIG_DEFAULTS as qn, RpcFunction as qr, SourceConfig as qt, BlockSqlAction as r, CONVENTION_FIELDS as ri, BetterSupabaseConfig as rn, APP_TABLE_EVENT_KINDS as rr, CONFIG_SCHEMA_URL as rt, BlockSqlEmit as s, Preset as si, EnvironmentConfig as sn, AppColumnType as sr, BlockTableReference as st, AUDIT_CATEGORIES as t, PresetCatalogManifest as ti, AppTablesInput as tn, APP_ON_DELETE_ACTIONS as tr, groupEntries as tt, BlockSqlTableSpec as u, PresetField as ui, SqlInput as un, AppReference as ur, RoleNames as ut, BlockSqlEntitlementsProvider as v, presetField as vi, SqlConfig as vn, AppTableVersions as vr, presetOf as vt, notNullCheckName as w, IntegrationName as wi, TopicTriggerValueConfig as wn, CatalogEnum as wr, presetBlockConflict as wt, BlockSqlTestFile as x, EnvFileConfig as xi, TopicTriggerLookupConfig as xn, CatalogCheck as xr, ResolvedPreset as xt, BlockSqlFile as y, presetValueLabel as yi, SqlWorkflow as yn, AppTablesConfig as yr, PresetConflict as yt, jsonSchema as z, PRESETS as zn, ForeignKeyAction as zr, GeneratorInputSchema as zt };
4151
+ export { blockEntrySource as $, APP_COLUMN_ACCESS as $n, RpcTypeReference as $r, ResolvedExtensions as $t, ValibotGeneratorOptions as A, SkillsConfig 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, GenConfig as Ci, TopicTriggerPayloadValueConfig as Cn, CatalogColumn as Cr, ResolvedPresetBlock as Ct, ZodFlavor as D, MigrationSafetyConfig as Di, VectorSearchConfig as Dn, CatalogFunction as Dr, resolveJsonSchema as Dt, TableGrant as E, KeysConfig as Ei, VectorDistance as En, CatalogForeignKey as Er, resolvePreset as Et, nuqs as F, SKILLS_AGENTS 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, 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, presetSpec as Ln, ExtrasHook as Lr, GeneratorFunction as Lt, StandardSchemaGeneratorOptions as M, INTEGRATION_INFO as Mi, Privilege as Mn, CatalogTable as Mr, GeneratorBlock as Mt, standardSchema as N, INTEGRATION_NAMES as Ni, ResolvedExpose as Nn, CatalogTrigger as Nr, GeneratorBlockEntity as Nt, ZodGeneratorOptions as O, OpenApiConfig as Oi, ColumnPrivilege as On, CatalogFunctionArg as Or, ClaimsConfig as Ot, NuqsGeneratorOptions as P, IntegrationInfo 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, DEFAULT_PRESET_NAME as Rn, ExtrasHookFunction as Rr, GeneratorFunctionArg as Rt, BlockSqlUpgrade as S, EnvFileConfig as Si, TopicTriggerLookupConfig as Sn, CatalogCheck as Sr, ResolvedPreset as St, notNullCheckName as T, IntegrationName 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 _, PresetValueInfo as _i, ResolvedSqlConfig as _n, AppTableEvents as _r, expandPreset as _t, BlockSqlContext as a, DEFAULT_CONVENTIONS as ai, BlockInput as an, AppColumnAccess as ar, defineConfig as at, BlockSqlLayout as b, presetValueLabel as bi, SqlWorkflow as bn, AppTablesConfig as br, PresetConflict as bt, BlockSqlIdType as c, Preset as ci, EnvironmentConfig as cn, AppColumnType as cr, BlockTableReference as ct, MODULE_ID_TYPES as d, PresetField as di, SqlInput as dn, AppReference as dr, RoleNames as dt, PresetCatalog as ei, ApiConfig as en, APP_COLUMN_FORMATS as er, flattenConfig as et, contractSignature as f, PresetFieldKey as fi, ToolingConfig as fn, AppReferenceTarget as fr, TypedReference as ft, BlockSqlAccessProvider as g, PresetScope as gi, RealtimeConfig as gn, AppTableEventKind as gr, conventionConfig as gt, BlockSql as h, PresetPlatforms as hi, BucketConfig as hn, AppTableConfig as hr, PresetInput as ht, BlockSqlAudit as i, CONVENTION_FIELDS as ii, BetterSupabaseConfig as in, APP_TABLE_EVENT_KINDS as ir, CONFIG_SCHEMA_URL as it, valibot as j, GEN_TASKS as ji, ExposeRole as jn, CatalogPolicy as jr, Generator as jt, zod as k, SkillsAgent as ki, ExposeConfig as kn, CatalogGrant as kr, CodecsConfig as kt, BlockSqlNames as l, PresetAccess as li, GenGroupConfig as ln, AppLookupConfig as lr, BucketName as lt, moduleIdType as m, PresetFramework as mi, EntitlementsConfig as mn, AppRollupConfig as mr, ExpandedConfig as mt, AuditCategory as n, PresetCatalogManifest as ni, AppTablesInput as nn, APP_ON_DELETE_ACTIONS as nr, groupEntries as nt, BlockSqlContractFunction as o, PRESET_FRAMEWORKS as oi, BlocksInput as on, AppColumnConfig as or, resolveConfig as ot, isBlockSqlIdType as p, PresetFieldValue 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, PresetGlueItem as ri, AuthConfig as rn, APP_ROLLUP_AGGREGATES as rr, hasFlatTables as rt, BlockSqlEmit as s, PRESET_TENANT_NAMES as si, DatabaseConfig as sn, AppColumnFormat as sr, AppTableNames as st, AUDIT_CATEGORIES as t, PresetCatalogBlock as ti, AppTableInput as tn, APP_COLUMN_TYPES as tr, groupConfig as tt, BlockSqlTableSpec as u, PresetConventions as ui, OrganizationConfig as un, AppOnDeleteAction as ur, ConfigReferences as ut, BlockSqlEntitlementsProvider as v, integrationsForFramework as vi, SeedConfig as vn, AppTableSubject as vr, presetConfig as vt, blockSqlVersion as w, GenTask as wi, TopicTriggerTopicConfig as wn, CatalogColumnGrant as wr, listNames as wt, BlockSqlTestFile as x, DoctorConfig as xi, TopicTriggerConfig as xn, Catalog as xr, PresetIntegration as xt, BlockSqlFile as y, presetField as yi, SqlConfig as yn, AppTableVersions as yr, presetOf as yt, buildJsonSchema as z, NamedPreset as zn, ExtrasTable as zr, GeneratorInput as zt };
@@ -1,4 +1,4 @@
1
- import { a as ClientAuth } from "./bind-CrMBwrPN.js";
1
+ import { a as ClientAuth } from "./bind-h5jre2K0.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-BVcLQ3DF.js";
2
+ import { Bt as Action, Ht as ActionContext, Vt as ActionCall } from "./define-block-DvvcM54N.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. */