better-supabase 0.21.0 → 0.23.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 (306) hide show
  1. package/dist/{access-sql-CNIgUqWf.js → access-sql-bjWFUWlk.js} +11 -0
  2. package/dist/{adapter-DZJZTY6g.js → adapter-D4aNBxhm.js} +2 -2
  3. package/dist/ai-sdk/agents/index.d.ts +2 -2
  4. package/dist/api-3C0AWFeP.js +696 -0
  5. package/dist/{api-Cj4W_pqT.d.ts → api-CHObZL7m.d.ts} +1 -1
  6. package/dist/{app-tables-C5HjXs2k.d.ts → app-tables-CJO6pWwy.d.ts} +1 -1
  7. package/dist/astro/index.js +5 -5
  8. package/dist/{authorization-DhoA7dsD.d.ts → authorization-Dtwpjeuz.d.ts} +91 -13
  9. package/dist/{bind-CFsctoFJ.d.ts → bind-DaoTunvE.d.ts} +1 -1
  10. package/dist/{block-env-BrUNeuJ_.d.ts → block-env-DUyo2I5O.d.ts} +3 -3
  11. package/dist/blocks/access-requests/index.js +1 -1
  12. package/dist/blocks/activities/index.js +1 -1
  13. package/dist/blocks/agents/index.js +1 -1
  14. package/dist/blocks/ai-chat/index.d.ts +3 -3
  15. package/dist/blocks/ai-chat/index.js +1 -1
  16. package/dist/blocks/ai-keys/index.js +1 -1
  17. package/dist/blocks/announcements/index.d.ts +3 -3
  18. package/dist/blocks/announcements/index.js +1 -1
  19. package/dist/blocks/api-keys/index.d.ts +1 -1
  20. package/dist/blocks/api-keys/index.js +1 -1
  21. package/dist/blocks/approvals/index.js +1 -1
  22. package/dist/blocks/assets/index.js +1 -1
  23. package/dist/blocks/assignment/index.js +1 -1
  24. package/dist/blocks/attachments/index.d.ts +1 -1
  25. package/dist/blocks/attachments/index.js +1 -1
  26. package/dist/blocks/audit/index.d.ts +2 -2
  27. package/dist/blocks/audit/index.js +1 -1
  28. package/dist/blocks/automations/index.d.ts +1 -1
  29. package/dist/blocks/automations/index.js +1 -1
  30. package/dist/blocks/billable-time/index.js +1 -1
  31. package/dist/blocks/billing/index.d.ts +1 -1
  32. package/dist/blocks/billing/index.js +2 -2
  33. package/dist/blocks/bookings/index.d.ts +1 -1
  34. package/dist/blocks/bookings/index.js +1 -1
  35. package/dist/blocks/bulk/index.js +1 -1
  36. package/dist/blocks/calendar/index.d.ts +5 -1
  37. package/dist/blocks/calendar/index.js +7 -4
  38. package/dist/blocks/catalog/index.js +1 -1
  39. package/dist/blocks/channels/index.js +1 -1
  40. package/dist/blocks/collections/index.js +1 -1
  41. package/dist/blocks/comments/index.d.ts +4 -4
  42. package/dist/blocks/compliance/index.js +1 -1
  43. package/dist/blocks/connectors/index.js +1 -1
  44. package/dist/blocks/contacts/index.js +1 -1
  45. package/dist/blocks/content/index.js +1 -1
  46. package/dist/blocks/contracts/index.js +1 -1
  47. package/dist/blocks/courses/index.js +1 -1
  48. package/dist/blocks/custom-fields/index.d.ts +43 -1
  49. package/dist/blocks/custom-fields/index.js +41 -2
  50. package/dist/blocks/data-lifecycle/index.js +1 -1
  51. package/dist/blocks/deals/index.js +1 -1
  52. package/dist/blocks/dispatch/index.js +1 -1
  53. package/dist/blocks/documents/index.js +1 -1
  54. package/dist/blocks/domains/index.js +1 -1
  55. package/dist/blocks/donations/index.js +1 -1
  56. package/dist/blocks/drive/index.d.ts +1 -1
  57. package/dist/blocks/drive/index.js +1 -1
  58. package/dist/blocks/employees/index.d.ts +4 -0
  59. package/dist/blocks/employees/index.js +2 -2
  60. package/dist/blocks/enrichment/index.js +1 -1
  61. package/dist/blocks/enrollments/index.js +1 -1
  62. package/dist/blocks/entitlements/index.d.ts +2 -2
  63. package/dist/blocks/expenses/index.js +1 -1
  64. package/dist/blocks/flags/index.js +1 -1
  65. package/dist/blocks/forecasts/index.js +1 -1
  66. package/dist/blocks/forms/index.d.ts +1 -1
  67. package/dist/blocks/forms/index.js +1 -1
  68. package/dist/blocks/guests/index.js +1 -1
  69. package/dist/blocks/hiring/index.js +1 -1
  70. package/dist/blocks/imports/index.js +1 -1
  71. package/dist/blocks/inbox/index.d.ts +4 -4
  72. package/dist/blocks/inbox/index.js +1 -1
  73. package/dist/blocks/incidents/index.js +1 -1
  74. package/dist/blocks/index.d.ts +1 -1
  75. package/dist/blocks/index.js +2 -2
  76. package/dist/blocks/inventory/index.js +1 -1
  77. package/dist/blocks/invoices/index.js +1 -1
  78. package/dist/blocks/leases/index.js +1 -1
  79. package/dist/blocks/leave/index.js +1 -1
  80. package/dist/blocks/ledger/index.js +1 -1
  81. package/dist/blocks/mail-sync/index.js +1 -1
  82. package/dist/blocks/messaging/index.d.ts +4 -4
  83. package/dist/blocks/messaging/index.js +1 -1
  84. package/dist/blocks/metrics/index.js +1 -1
  85. package/dist/blocks/mfa/index.d.ts +1 -1
  86. package/dist/blocks/moderation/index.js +1 -1
  87. package/dist/blocks/notifications/index.d.ts +3 -3
  88. package/dist/blocks/notifications/index.js +3 -3
  89. package/dist/blocks/numbering/index.js +1 -1
  90. package/dist/blocks/oauth-server/index.js +1 -1
  91. package/dist/blocks/onboarding/index.d.ts +1 -1
  92. package/dist/blocks/orders/index.js +1 -1
  93. package/dist/blocks/organizations/index.d.ts +2 -2
  94. package/dist/blocks/organizations/index.js +1 -1
  95. package/dist/blocks/outbox/index.js +1 -1
  96. package/dist/blocks/passes/index.js +1 -1
  97. package/dist/blocks/permissions/index.d.ts +1 -1
  98. package/dist/blocks/pipelines/index.js +1 -1
  99. package/dist/blocks/posts/index.js +1 -1
  100. package/dist/blocks/promotions/index.js +1 -1
  101. package/dist/blocks/push/index.d.ts +1 -1
  102. package/dist/blocks/push/index.js +1 -1
  103. package/dist/blocks/quotes/index.js +1 -1
  104. package/dist/blocks/reactions/index.d.ts +3 -3
  105. package/dist/blocks/reactions/index.js +1 -1
  106. package/dist/blocks/relations/index.js +1 -1
  107. package/dist/blocks/reminders/index.js +1 -1
  108. package/dist/blocks/reviews/index.js +1 -1
  109. package/dist/blocks/saved-views/index.d.ts +1 -1
  110. package/dist/blocks/saved-views/index.js +1 -1
  111. package/dist/blocks/scores/index.js +1 -1
  112. package/dist/blocks/search/index.d.ts +4 -2
  113. package/dist/blocks/search/index.js +3 -1
  114. package/dist/blocks/security-events/index.js +1 -1
  115. package/dist/blocks/segments/index.js +1 -1
  116. package/dist/blocks/sequences/index.js +1 -1
  117. package/dist/blocks/service-accounts/index.js +1 -1
  118. package/dist/blocks/sessions/index.d.ts +1 -1
  119. package/dist/blocks/settings/index.d.ts +1 -1
  120. package/dist/blocks/settings/index.js +1 -1
  121. package/dist/blocks/share-links/index.d.ts +28 -3
  122. package/dist/blocks/share-links/index.js +59 -23
  123. package/dist/blocks/shipments/index.js +1 -1
  124. package/dist/blocks/signatures/index.js +1 -1
  125. package/dist/blocks/signing-keys/index.js +1 -1
  126. package/dist/blocks/sla/index.js +1 -1
  127. package/dist/blocks/sso/index.js +1 -1
  128. package/dist/blocks/state-machine/index.js +1 -1
  129. package/dist/blocks/subjects/index.d.ts +1 -1
  130. package/dist/blocks/tags/index.d.ts +18 -3
  131. package/dist/blocks/tags/index.js +16 -3
  132. package/dist/blocks/tasks/index.js +2 -2
  133. package/dist/blocks/teams/index.d.ts +26 -4
  134. package/dist/blocks/teams/index.js +11 -4
  135. package/dist/blocks/templates/index.js +1 -1
  136. package/dist/blocks/time-tracking/index.d.ts +18 -0
  137. package/dist/blocks/time-tracking/index.js +13 -4
  138. package/dist/blocks/timeline/index.js +1 -1
  139. package/dist/blocks/trash/index.js +1 -1
  140. package/dist/blocks/undo/index.d.ts +1 -1
  141. package/dist/blocks/usage/index.d.ts +1 -1
  142. package/dist/blocks/vercel-marketplace/index.js +1 -1
  143. package/dist/blocks/versions/index.js +1 -1
  144. package/dist/blocks/waitlist/index.js +1 -1
  145. package/dist/blocks/webhooks/index.js +4 -4
  146. package/dist/blocks/workflow-editor/index.d.ts +3 -3
  147. package/dist/blocks/workflow-editor/index.js +1 -1
  148. package/dist/blocks/workflows/index.d.ts +3 -3
  149. package/dist/blocks/workflows/index.js +1 -1
  150. package/dist/cli/{add-BTDPjVGC.js → add-C7lKQNBL.js} +11 -11
  151. package/dist/cli/{add-C0w-mVTQ.js → add-DVHniZOO.js} +2 -2
  152. package/dist/cli/add-vZRn-uH0.js +1 -0
  153. package/dist/cli/{backfill-BDdBs6Ne.js → backfill-Lrn-Qp5X.js} +3 -3
  154. package/dist/cli/bin.js +1 -1
  155. package/dist/cli/{blocks-Bs-lA-U_.js → blocks-2Yw9t-_U.js} +1 -1
  156. package/dist/cli/{blocks-CQLME-HQ.js → blocks-BKNd886C.js} +1 -1
  157. package/dist/cli/{cache-DDKao2Va.js → cache-ByhPVMo-.js} +1 -1
  158. package/dist/cli/{codemod-Bjl998Do.js → codemod-C0eXpzFu.js} +1 -1
  159. package/dist/cli/{config-BH0goim0.js → config-BVfeG3A5.js} +37 -5
  160. package/dist/cli/{config-CTRzkX0H.js → config-CeaQMrvS.js} +1 -1
  161. package/dist/cli/{content-mapper-DgSTl-DL.js → content-mapper-qH-_YQ8H.js} +2 -2
  162. package/dist/cli/{db-DCeyHS1y.js → db-DwjyUbAh.js} +2 -2
  163. package/dist/cli/{doctor-CMLWbt44.js → doctor-BnxkqXGA.js} +21 -19
  164. package/dist/cli/{gen-D3VX8WdV.js → gen-aERmP3Sw.js} +14 -14
  165. package/dist/cli/index.d.ts +1 -1
  166. package/dist/cli/index.js +7 -7
  167. package/dist/cli/{init-D6D6eWze.js → init-DWUqVSVW.js} +6 -6
  168. package/dist/cli/{live-C_xgTOfD.js → live-KcdTBUij.js} +2 -2
  169. package/dist/cli/{mcp-B0Irjbes.js → mcp-Dsjjo-LT.js} +2 -2
  170. package/dist/cli/{metadata-cLXra-XB.js → metadata-DWQSIZ59.js} +3 -3
  171. package/dist/cli/{migration-safety-OUK-Afbb.js → migration-safety-Cy7xlU4G.js} +2 -2
  172. package/dist/cli/{migrations-CHenMvl_.js → migrations-CUjNXokR.js} +1 -1
  173. package/dist/cli/{module-migration-6V7vXWUK.js → module-migration-C6NLY9iZ.js} +2 -2
  174. package/dist/cli/powersync-BOhjVQCb.js +1 -0
  175. package/dist/cli/{powersync-D83yAFbl.js → powersync-CE_hQdgc.js} +2 -2
  176. package/dist/cli/{print-C0OmQyTu.js → print-Cy_ram9N.js} +2 -2
  177. package/dist/cli/{remove-BWlOngNT.js → remove-DmwjzqaW.js} +5 -5
  178. package/dist/cli/{render-9m70qveo.js → render-CF09FCra.js} +7 -4
  179. package/dist/cli/{run-He3M-ZRq.js → run-BYpZ8FjF.js} +25 -25
  180. package/dist/cli/{run-gE4eAazR.js → run-lh-chAJW.js} +8 -8
  181. package/dist/cli/{seed-CdSxunFT.js → seed-BMynpMPy.js} +2 -2
  182. package/dist/cli/seed-CO3j_bly.js +1 -0
  183. package/dist/cli/{shared-Cx2WFVWq.js → shared-D05A6t1e.js} +1 -1
  184. package/dist/cli/{snapshot-CZb3uVKE.js → snapshot-BITNbA5V.js} +3 -3
  185. package/dist/cli/{source-CrYSCdPZ.js → source-GGJHuzpH.js} +1 -1
  186. package/dist/cli/{source-args-z-jkabmO.js → source-args-CDmmFmFG.js} +1 -1
  187. package/dist/cli/{spec-Cn5RhuQc.js → spec-BGcRdlhN.js} +2 -2
  188. package/dist/cli/{spec-D4b9ePuQ.js → spec-BjxXWaNQ.js} +1 -1
  189. package/dist/cli/{sql-layout-CLJ67h3L.js → sql-layout-BoD5ynN9.js} +2 -2
  190. package/dist/cli/{sync-B8VGiaHk.js → sync-_QlsTmqu.js} +3 -3
  191. package/dist/cli/{upgrade-BvBWK3Fo.js → upgrade-Cwhb1M7O.js} +4 -4
  192. package/dist/cli/{upgrade-DMiYx1C8.js → upgrade-n9ar1kc4.js} +2 -2
  193. package/dist/cli/{version-BVg2Z6yv.js → version-RSpJIWDd.js} +1 -1
  194. package/dist/client/index.d.ts +5 -5
  195. package/dist/client/native/index.d.ts +4 -4
  196. package/dist/{composite-Dw5ofSF_.js → composite-CBRbvn5j.js} +2 -2
  197. package/dist/config/index.d.ts +4 -4
  198. package/dist/config/index.js +4 -4
  199. package/dist/{config-BOt5T6Vs.js → config-RwpFcPq8.js} +3 -3
  200. package/dist/{config-CD2OGfCG.js → config-vHLJ8SKf.js} +1 -1
  201. package/dist/{context-sgrUjA3U.d.ts → context-CMf4OKpN.d.ts} +72 -16
  202. package/dist/{controller-B6vWdKSa.d.ts → controller-BGto_kYM.d.ts} +1 -1
  203. package/dist/create/index.d.ts +72 -451
  204. package/dist/create/index.js +15 -1687
  205. package/dist/create/lite/index.d.ts +250 -13
  206. package/dist/create/lite/index.js +1007 -24
  207. package/dist/credentials/index.js +1 -1
  208. package/dist/edge/index.js +7 -7
  209. package/dist/elysia/index.js +1 -1
  210. package/dist/{entitlements-BPaPd3MD.d.ts → entitlements-CIhVQ-0u.d.ts} +1 -1
  211. package/dist/events/index.js +1 -1
  212. package/dist/expo/index.js +3 -3
  213. package/dist/{field-errors-DBgDCITw.d.ts → field-errors-BDhPaO0a.d.ts} +4 -4
  214. package/dist/{framework-DXM1vNcV.js → framework-DYEUraqt.js} +1 -1
  215. package/dist/h3/index.js +1 -1
  216. package/dist/h3/v1/index.js +1 -1
  217. package/dist/hono/index.js +6 -6
  218. package/dist/{index-ByF22_C6.d.ts → index--OhYKouV.d.ts} +2 -2
  219. package/dist/{index-Bt7_mxn0.d.ts → index-4MStWaeF.d.ts} +185 -7
  220. package/dist/{index-5JSxY1MG.d.ts → index-CFWlHuVY.d.ts} +77 -2
  221. package/dist/{index-CdMZQCYR.d.ts → index-lV43eM34.d.ts} +2 -2
  222. package/dist/{index-C4sjewrr.d.ts → index-ujNqgZ6B.d.ts} +6 -6
  223. package/dist/{app-tables-DyswUg6J.js → instances-BPJSESPx.js} +176 -11
  224. package/dist/{kit-DhlB-vv_.js → kit-Bcd9wYCV.js} +1 -1
  225. package/dist/mapper/bin.js +6 -6
  226. package/dist/mcp/index.d.ts +1 -1
  227. package/dist/mcp/index.js +6 -6
  228. package/dist/mcp/sdk/index.js +2 -2
  229. package/dist/nestjs/index.js +1 -1
  230. package/dist/next/index.d.ts +3 -3
  231. package/dist/next/index.js +7 -7
  232. package/dist/node/index.js +1 -1
  233. package/dist/{operations-DC3wU3Sy.d.ts → operations-qSBBV5vl.d.ts} +1 -1
  234. package/dist/{options-fMxhtuVR.js → options-BJtdsK7b.js} +4 -1
  235. package/dist/{options-DhdazgTZ.js → options-BPp2zzsz.js} +3 -1
  236. package/dist/options-BSsYXjhC.js +9 -0
  237. package/dist/{options-ChiL-4ZS.js → options-D4ADKTKo.js} +3 -1
  238. package/dist/{options-C1-pwEqm.js → options-DztCKw_f.js} +4 -1
  239. package/dist/{options-BfFC4iFE.js → options-jsOCvLUz.js} +3 -1
  240. package/dist/orpc/index.d.ts +1 -1
  241. package/dist/orpc/index.js +5 -5
  242. package/dist/otel/index.js +4 -4
  243. package/dist/{ports-BbBJVyS0.d.ts → ports-DbHiNSAa.d.ts} +1 -1
  244. package/dist/powersync/index.d.ts +2 -2
  245. package/dist/preset/index.d.ts +4 -4
  246. package/dist/preset/index.js +4 -4
  247. package/dist/{preset-B3CukUhu.js → preset-B1xXOJ0T.js} +179 -7
  248. package/dist/project-BM6QMtzV.js +1760 -0
  249. package/dist/{push-token-CPJfPFa2.d.ts → push-token-BwF1fyjA.d.ts} +1 -1
  250. package/dist/react/index.d.ts +5 -5
  251. package/dist/react/index.js +2 -2
  252. package/dist/react/native/index.d.ts +1 -1
  253. package/dist/react/server.d.ts +5 -5
  254. package/dist/react/server.js +2 -2
  255. package/dist/{react-_D_CeZMk.js → react-CcrQQl0_.js} +2 -2
  256. package/dist/react-router/index.js +5 -5
  257. package/dist/realtime/index.d.ts +3 -3
  258. package/dist/realtime/index.js +1 -1
  259. package/dist/records/index.d.ts +3 -3
  260. package/dist/{refusal-D48CMqpQ.js → refusal-DDlInPff.js} +2 -2
  261. package/dist/{instances-DDt7NdVl.js → resolved-names-WzRYhUez.js} +2 -146
  262. package/dist/{resource-R3KToNze.js → resource-BUJcZKiW.js} +2 -2
  263. package/dist/{resources-DqIwoQsP.js → resources-jb3R6rEa.js} +1 -1
  264. package/dist/server/index.d.ts +1 -1
  265. package/dist/server/index.js +7 -7
  266. package/dist/{sign-in-1FJiXXyG.js → sign-in-NO7LWlw4.js} +2 -2
  267. package/dist/solid/index.d.ts +5 -5
  268. package/dist/solid/index.js +1 -1
  269. package/dist/solid-start/index.js +5 -5
  270. package/dist/spec/index.d.ts +2 -2
  271. package/dist/spec/index.js +2 -693
  272. package/dist/sql/index.d.ts +5 -5
  273. package/dist/sql/index.js +5 -5
  274. package/dist/{sql-BjjgwJKg.js → sql-CNH8kjLS.js} +2727 -955
  275. package/dist/ssr/index.d.ts +1 -1
  276. package/dist/storage/index.js +1 -1
  277. package/dist/subjects-NomQg6Eg.d.ts +131 -0
  278. package/dist/svelte/index.d.ts +5 -5
  279. package/dist/svelte/index.js +1 -1
  280. package/dist/sveltekit/index.js +5 -5
  281. package/dist/tanstack-start/index.js +5 -5
  282. package/dist/{tenant-BHvMFNXl.d.ts → tenant-D4BA7XQ-.d.ts} +1 -1
  283. package/dist/testing/index.d.ts +4 -4
  284. package/dist/testing/index.js +5 -5
  285. package/dist/{topic-J9I3yu6f.js → topic-F0FKzJyQ.js} +2 -2
  286. package/dist/{topic-gTVjLGTk.d.ts → topic-utZqhw96.d.ts} +1 -1
  287. package/dist/types-DLnBJ3ST.d.ts +461 -0
  288. package/dist/vue/index.d.ts +5 -5
  289. package/dist/vue/index.js +1 -1
  290. package/dist/{watch-topic-C6HhbnVz.d.ts → watch-topic-B1UCoQfz.d.ts} +1 -1
  291. package/dist/workflow-sdk/world/index.js +1 -1
  292. package/dist/{workflow-sdk-DELaQEp3.js → workflow-sdk-CE8sEK57.js} +38 -1
  293. package/dist/yjs/index.d.ts +1 -1
  294. package/dist/yjs/index.js +1 -1
  295. package/package.json +1 -1
  296. package/schemas/config-v1.json +166 -2
  297. package/dist/cli/add-CspY9jKT.js +0 -1
  298. package/dist/cli/powersync-DwhCH0gs.js +0 -1
  299. package/dist/cli/seed-CXJvTU5D.js +0 -1
  300. package/dist/options-CTv-xmbA.js +0 -5
  301. package/dist/subjects-DvmQeF_F.d.ts +0 -79
  302. package/dist/types-DGHfTW8_.d.ts +0 -9
  303. package/dist/{build-CM8PJqwW.js → build-CH2N3Yf0.js} +3 -3
  304. package/dist/{create-blocks-CUS28FfS.js → create-blocks-BfrDUSM6.js} +1 -1
  305. package/dist/{data-hooks-tgF1Ct0F.js → data-hooks-CdcZfVS1.js} +1 -1
  306. package/dist/{respond-3RKp6VgU.js → respond-CZMWbUs3.js} +1 -1
@@ -0,0 +1,461 @@
1
+ import { ar as AppColumnAccess, cr as AppColumnType, di as Preset, sr as AppColumnFormat, ur as AppOnDeleteAction, yr as AppTableVersions } from "./context-CMf4OKpN.js";
2
+ import { k as DesignErrorCode } from "./index-CFWlHuVY.js";
3
+ //#region src/create/issue.d.ts
4
+ /** Where in the project pipeline an issue came from. */
5
+ type IssueSource = "design" | "rules" | "sql" | "verifier" | "plan";
6
+ type IssueSeverity = "error" | "warning" | "info";
7
+ /**
8
+ * A stable code for an issue: a `DesignErrorCode` from parsing, a rule that
9
+ * needs the preset, `sql_error` for a file Postgres rejected, or a code the
10
+ * verifier or the plan adds (`verify_*`, `plan_*`). The codes are stable; the
11
+ * messages may change.
12
+ */
13
+ type IssueCode = DesignErrorCode | "table_name_taken" | "name_too_long" | "subject_type_taken" | "invalid_default" | "default_required" | "column_clash" | "unknown_column" | "missing_reference" | "set_null_required" | "preset_conflict" | "sql_error" | `verify_${string}` | `plan_${string}`;
14
+ /**
15
+ * The one problem type every surface reports: the canvas, the chat tools, the
16
+ * API, the CLI's doctor and the deploy planner (ADR 0100).
17
+ */
18
+ interface Issue {
19
+ readonly code: IssueCode;
20
+ readonly severity: IssueSeverity;
21
+ readonly source: IssueSource;
22
+ /**
23
+ * A JSON Pointer (RFC 6901) into the design, such as
24
+ * `/appTables/tasks/columns/title`. `""` is the design itself, and the path
25
+ * of an issue with the preset or with SQL.
26
+ */
27
+ readonly path: string;
28
+ /** The app table or block module the issue is on, or `design` or `preset`. */
29
+ readonly table: string;
30
+ readonly message: string;
31
+ /** The file, for an issue found in SQL. */
32
+ readonly file?: string;
33
+ }
34
+ //#endregion
35
+ //#region src/create/design-computed.d.ts
36
+ /** The aggregates a rollup takes (`APP_ROLLUP_AGGREGATES`). */
37
+ declare const ROLLUP_AGGREGATES: readonly ["count", "sum", "min", "max", "avg"];
38
+ type RollupAggregate = (typeof ROLLUP_AGGREGATES)[number];
39
+ /** `tables.<table>.rollups.<name>`; the shape of `AppRollupConfig`. */
40
+ interface AppRollup {
41
+ readonly table: string;
42
+ readonly via: string;
43
+ readonly aggregate: RollupAggregate;
44
+ readonly column?: string;
45
+ readonly where?: {
46
+ readonly column: string;
47
+ readonly equals: string;
48
+ };
49
+ }
50
+ /** `tables.<table>.lookups.<name>`; the shape of `AppLookupConfig`. */
51
+ interface AppLookup {
52
+ readonly via: string;
53
+ readonly column: string;
54
+ }
55
+ /** A rollup or lookup as a table node and the inspector list it. */
56
+ interface ComputedRow {
57
+ readonly name: string;
58
+ readonly kind: "rollup" | "lookup";
59
+ /** What it computes, such as `count of tasks where status = todo`. */
60
+ readonly summary: string;
61
+ /** The short form the node shows next to the name, such as `count`. */
62
+ readonly label: string;
63
+ }
64
+ type Tables = Readonly<Record<string, AppTable>>;
65
+ declare function isRollupAggregate(value: unknown): value is RollupAggregate;
66
+ /** The columns of `table` a rollup or lookup can read, with their types. */
67
+ declare function readableColumns(table: AppTable): readonly (readonly [string, AppColumnType])[];
68
+ /**
69
+ * The columns `aggregate` can read: numbers for sum and avg, ordered types for
70
+ * min and max, none for count.
71
+ */
72
+ declare function rollupColumns(child: AppTable, aggregate: RollupAggregate): readonly string[];
73
+ /** The select columns of `child` (text with options) a rollup can filter on. */
74
+ declare function filterColumns(child: AppTable): readonly (readonly [string, readonly string[]])[];
75
+ /**
76
+ * Each app table column that references `parent`, as `{ table, via }`: what a
77
+ * rollup on `parent` can aggregate.
78
+ */
79
+ declare function rollupSources(tables: Tables, parent: string): readonly {
80
+ readonly table: string;
81
+ readonly via: string;
82
+ }[];
83
+ /**
84
+ * Each column of `name` that references another app table, with that table:
85
+ * what a lookup can follow.
86
+ */
87
+ declare function lookupSources(tables: Tables, name: string): readonly {
88
+ readonly via: string;
89
+ readonly target: string;
90
+ }[];
91
+ type DraftRollup = { -readonly [K in keyof AppRollup]: AppRollup[K]; };
92
+ /**
93
+ * `table` with a rollup or lookup set under `name`, replacing `previous` in its
94
+ * place.
95
+ */
96
+ declare function tableWithComputed(table: AppTable, name: string, computed: {
97
+ readonly rollup: AppRollup;
98
+ } | {
99
+ readonly lookup: AppLookup;
100
+ }, previous: string): AppTable;
101
+ /** `table` without the rollup or lookup `name`. */
102
+ declare function tableWithoutComputed(table: AppTable, name: string): AppTable;
103
+ /**
104
+ * The tables with every rollup and lookup that no longer fits dropped: one
105
+ * whose table, link or column was deleted or retyped, or whose name a column
106
+ * now uses. `upgrade` would refuse them, and the design code would not encode.
107
+ */
108
+ declare function prunedComputed(tables: Tables): Tables;
109
+ /** The rollups that aggregate `from`, pointed at `to`. */
110
+ declare function computedTableRenamed(tables: Tables, from: string, to: string): Tables;
111
+ /**
112
+ * The rollup fitted to a new source or aggregate: a column the aggregate can
113
+ * read, and a filter the child still has.
114
+ */
115
+ declare function fittedRollup(tables: Tables, rollup: AppRollup): AppRollup;
116
+ /**
117
+ * Every rollup and lookup that reads `table.from`, reading `table.to`. The
118
+ * tables already have the column renamed, so a lookup finds its target through
119
+ * the renamed link.
120
+ */
121
+ declare function computedColumnRenamed(tables: Tables, table: string, from: string, to: string): Tables;
122
+ /** The rollups and lookups of an app table, in the view's column order. */
123
+ declare function computedRows(table: AppTable): readonly ComputedRow[];
124
+ //#endregion
125
+ //#region src/create/schema.d.ts
126
+ /** One rendered SQL file, as `/create/migrations` returns it. */
127
+ interface SchemaSource {
128
+ readonly path: string;
129
+ readonly module: string;
130
+ readonly contents: string;
131
+ }
132
+ /**
133
+ * The table a foreign key points at. `columns` is empty when the SQL names
134
+ * none: the target's primary key.
135
+ */
136
+ interface SchemaTarget {
137
+ readonly schema: string;
138
+ readonly table: string;
139
+ readonly columns: readonly string[];
140
+ }
141
+ interface SchemaForeignKey {
142
+ readonly columns: readonly string[];
143
+ readonly target: SchemaTarget;
144
+ /** The `on delete` action, lower case: `cascade`, `set null`, `no action`. */
145
+ readonly onDelete: string;
146
+ }
147
+ interface SchemaColumn {
148
+ readonly name: string;
149
+ readonly type: string;
150
+ readonly nullable: boolean;
151
+ /** The default expression as the SQL writes it, or `null` without one. */
152
+ readonly default: string | null;
153
+ readonly unique: boolean;
154
+ /** What the column is beyond its type (`email`, `select`), when it is more. */
155
+ readonly label?: string;
156
+ }
157
+ interface SchemaTable {
158
+ /** `schema.name`, unquoted. */
159
+ readonly id: string;
160
+ readonly schema: string;
161
+ readonly name: string;
162
+ /** The module whose file creates the table. */
163
+ readonly module: string;
164
+ readonly primaryKey: readonly string[];
165
+ readonly foreignKeys: readonly SchemaForeignKey[];
166
+ readonly tenantColumn: string | null;
167
+ /** Every column, in table order. */
168
+ readonly columns: readonly SchemaColumn[];
169
+ /** The rollups and lookups of an app table, which its `<table>_view` adds. */
170
+ readonly computed?: readonly SchemaComputed[];
171
+ }
172
+ /** A column of an app table's view: a rollup or a lookup. */
173
+ interface SchemaComputed {
174
+ readonly name: string;
175
+ readonly kind: "rollup" | "lookup";
176
+ readonly summary: string;
177
+ readonly label: string;
178
+ }
179
+ /**
180
+ * A column that points at a table without a foreign key: the tenant or user
181
+ * column a block keeps plain so its rows outlive deletes, or a `regclass` that
182
+ * names any table (`to` is `null`).
183
+ */
184
+ interface SchemaSoftRef {
185
+ readonly from: string;
186
+ readonly column: string;
187
+ readonly to: string | null;
188
+ readonly kind: "tenant" | "user" | "any";
189
+ }
190
+ /** What `/create/schema` returns. */
191
+ interface SchemaData {
192
+ readonly tables: readonly SchemaTable[];
193
+ readonly softRefs: readonly SchemaSoftRef[];
194
+ /** Table id to the block manifest that installs it. */
195
+ readonly manifests: Readonly<Record<string, string>>;
196
+ /** The table ids `blocks.<module>.options.extraColumns` adds columns to. */
197
+ readonly extraColumns: readonly string[];
198
+ /**
199
+ * Table id to its module and logical table, the names an app table's
200
+ * reference uses.
201
+ */
202
+ readonly blockTables: Readonly<Record<string, {
203
+ readonly block: string;
204
+ readonly table: string;
205
+ }>>;
206
+ /** The table tenant columns point at, or `null` without tenant foreign keys. */
207
+ readonly tenantTable: string | null;
208
+ }
209
+ /**
210
+ * The columns a diagram shows before a table is expanded: keys, tenant and soft
211
+ * references.
212
+ */
213
+ declare function keyColumnsOf(table: SchemaTable, softColumns?: ReadonlySet<string>): readonly SchemaColumn[];
214
+ interface SchemaOptions {
215
+ /**
216
+ * The tenant column the config names (`organization_id` by default); `null`
217
+ * without tenants.
218
+ */
219
+ readonly tenantColumn?: string | null;
220
+ }
221
+ /**
222
+ * The column the tenant blocks key rows by, from the preset's tenant name;
223
+ * `null` without tenants.
224
+ */
225
+ declare function tenantColumnOf(preset: Preset): string | null;
226
+ /**
227
+ * The tables in rendered module SQL: every `create table`, plus the columns and
228
+ * foreign keys later `alter table ... add` statements give them. A `create
229
+ * table` it can't read throws with the file and line, so a new SQL shape fails
230
+ * the tests instead of dropping a table from the diagram.
231
+ */
232
+ declare function parseSchema(files: readonly SchemaSource[], options?: SchemaOptions): readonly SchemaTable[];
233
+ /**
234
+ * The statements that shape one table, as written: its `create table` and the
235
+ * `alter table` statements after it. Empty when no file creates it.
236
+ */
237
+ declare function tableStatements(files: readonly SchemaSource[], id: string): readonly string[];
238
+ /**
239
+ * The foreign keys between tables, one per pair, with the targets outside the
240
+ * schema named by id.
241
+ */
242
+ declare function schemaRelations(tables: readonly SchemaTable[]): readonly {
243
+ readonly from: string;
244
+ readonly to: string;
245
+ }[];
246
+ //#endregion
247
+ //#region src/create/design-subject.d.ts
248
+ /**
249
+ * Makes the rows a subject (`tables.<table>.subject`); the shape of
250
+ * `AppTableSubject`.
251
+ */
252
+ interface AppSubject {
253
+ readonly type: string;
254
+ readonly title?: string;
255
+ readonly url?: string;
256
+ readonly search?: {
257
+ readonly title?: string;
258
+ readonly body?: readonly string[];
259
+ };
260
+ readonly permissions?: Readonly<Record<string, string>>;
261
+ readonly rank?: true | {
262
+ readonly group?: string;
263
+ };
264
+ readonly softDelete?: boolean;
265
+ readonly versions?: true | AppTableVersions;
266
+ }
267
+ /** Which writes emit an event and the columns its payload carries. */
268
+ interface AppEvents {
269
+ readonly on?: readonly ("created" | "updated" | "deleted")[];
270
+ readonly include?: readonly string[];
271
+ }
272
+ /**
273
+ * The columns `subject` adds: `rank` for manual order and `deleted_at` for
274
+ * trash.
275
+ */
276
+ declare function subjectColumns(subject: AppSubject | undefined): SchemaColumn[];
277
+ /** The subject with the columns it names renamed or dropped by `edit`. */
278
+ declare function subjectColumnsEdited(subject: AppSubject, edit: (columns: readonly string[]) => readonly string[]): AppSubject;
279
+ /**
280
+ * Why `type` can't be the subject type of the app table `table`, or `undefined`
281
+ * when it can.
282
+ */
283
+ declare function subjectTypeError(design: Design, table: string, type: string): string | undefined;
284
+ /**
285
+ * App table events with `edit` applied to the payload columns, dropping an
286
+ * empty list.
287
+ */
288
+ declare function eventsColumnsEdited(events: true | AppEvents, edit: (columns: readonly string[]) => readonly string[]): true | AppEvents;
289
+ //#endregion
290
+ //#region src/create/design.d.ts
291
+ /**
292
+ * Another app table or `auth.users` (`{ table }`), or a block module's logical
293
+ * table (`{ block, table }`).
294
+ */
295
+ interface AppReference {
296
+ readonly table: string;
297
+ readonly block?: string;
298
+ readonly onDelete?: AppOnDeleteAction;
299
+ }
300
+ interface AppColumn {
301
+ readonly type: AppColumnType;
302
+ readonly nullable?: boolean;
303
+ readonly default?: string;
304
+ readonly unique?: boolean;
305
+ readonly references?: AppReference;
306
+ readonly format?: AppColumnFormat;
307
+ readonly options?: readonly string[];
308
+ readonly min?: number;
309
+ readonly max?: number;
310
+ readonly comment?: string;
311
+ readonly identity?: boolean;
312
+ /**
313
+ * Who reads and writes the column: everyone by default, `read`, or `server`
314
+ * (ADR 0051).
315
+ */
316
+ readonly access?: AppColumnAccess;
317
+ /**
318
+ * Stores ciphertext with the tenant's Vault key; read through
319
+ * `<table>_reveal`.
320
+ */
321
+ readonly encrypted?: boolean;
322
+ }
323
+ type AppScope = "inherit" | "user" | "none";
324
+ type AppTableId = "uuid" | "bigint";
325
+ interface AppTable {
326
+ readonly columns?: Readonly<Record<string, AppColumn>>;
327
+ readonly scope?: AppScope;
328
+ readonly timestamps?: boolean;
329
+ readonly id?: AppTableId;
330
+ readonly unique?: readonly (readonly string[])[];
331
+ readonly indexes?: readonly (readonly string[])[];
332
+ readonly comment?: string;
333
+ readonly subject?: AppSubject;
334
+ readonly rollups?: Readonly<Record<string, AppRollup>>;
335
+ readonly lookups?: Readonly<Record<string, AppLookup>>;
336
+ /** Outbox events on insert, update and delete; the shape of `AppTableEvents`. */
337
+ readonly events?: true | AppEvents;
338
+ /** One `read` audit entry per tenant per reveal call. */
339
+ readonly auditReads?: boolean;
340
+ }
341
+ /**
342
+ * What the canvas adds to a preset: app tables, extra columns on block tables
343
+ * (by module) and the positions of moved tables (by table id). It has the shape
344
+ * of `CreateDesign` from `better-supabase/preset`.
345
+ */
346
+ interface Design {
347
+ readonly appTables?: Readonly<Record<string, AppTable>>;
348
+ readonly extraColumns?: Readonly<Record<string, Readonly<Record<string, string>>>>;
349
+ readonly positions?: Readonly<Record<string, readonly [number, number]>>;
350
+ }
351
+ declare const EMPTY_DESIGN: Design;
352
+ /** The module name app tables carry in the diagram. */
353
+ declare const APP_MODULE = "app-tables";
354
+ declare function appTableId(name: string): string;
355
+ declare function isAppTable(table: Pick<SchemaTable, "module">): boolean;
356
+ declare function isEmptyDesign(design: Design): boolean;
357
+ /** Why `name` can't name an app table or column, by the library's rules. */
358
+ declare function identifierError(name: string): string | undefined;
359
+ /** Why a column can't be added to an app table, or `undefined` when it can. */
360
+ declare function columnError(table: AppTable, name: string, preset: Pick<Preset, "scope" | "tenantName" | "idType">): string | undefined;
361
+ /**
362
+ * Why `value` can't be the default of `column` (its type, options and bounds),
363
+ * or `undefined` when it can or is empty.
364
+ */
365
+ declare function defaultError(column: Pick<AppColumn, "type" | "options" | "min" | "max" | "format">, value: string): string | undefined;
366
+ /** A free app table name: `base`, then `base_2`, `base_3` and so on. */
367
+ declare function freeTableName(design: Design, taken: ReadonlySet<string>, base?: string): string;
368
+ /** Adds an app table, placed at `position` when given. */
369
+ declare function addTable(design: Design, name: string, table?: AppTable, position?: readonly [number, number]): Design;
370
+ /**
371
+ * Removes an app table, every app table column that references it (and those
372
+ * columns from key sets), and the rollups and lookups that read it.
373
+ */
374
+ declare function deleteTable(design: Design, name: string): Design;
375
+ /** Renames an app table and the references to it. */
376
+ declare function renameTable(design: Design, from: string, to: string): Design;
377
+ type TablePatch = { readonly [K in "scope" | "timestamps" | "id" | "unique" | "indexes" | "comment" | "subject" | "events"]?: AppTable[K] | undefined; };
378
+ /** Updates an app table's options; a key set to `undefined` is removed. */
379
+ declare function updateTable(design: Design, name: string, patch: TablePatch): Design;
380
+ /**
381
+ * Sets an app table's id type and retypes the app table columns that reference
382
+ * it, since a key has the type of the id it points at.
383
+ */
384
+ declare function setTableId(design: Design, name: string, id: AppTableId): Design;
385
+ /** Sets (adds or replaces) an app table column. */
386
+ declare function setColumn(design: Design, table: string, name: string, column: AppColumn): Design;
387
+ /** Renames an app table column, keeping its place. */
388
+ declare function renameColumn(design: Design, table: string, from: string, to: string): Design;
389
+ /** Replaces an app table with `edit` applied to it, such as `tableWithComputed`. */
390
+ declare function editTable(design: Design, table: string, edit: (current: AppTable) => AppTable): Design;
391
+ declare function deleteColumn(design: Design, table: string, name: string): Design;
392
+ /**
393
+ * Sets an extra column on a block table
394
+ * (`blocks.<module>.options.extraColumns`).
395
+ */
396
+ declare function setExtraColumn(design: Design, module: string, name: string, type: string): Design;
397
+ declare function deleteExtraColumn(design: Design, module: string, name: string): Design;
398
+ /** A design with the name of the table an edit created. */
399
+ interface NamedDesign {
400
+ readonly design: Design;
401
+ readonly name: string;
402
+ }
403
+ /** Copies an app table under a free name, next to the original. */
404
+ declare function duplicateTable(design: Design, name: string, taken: ReadonlySet<string>): NamedDesign;
405
+ /** Moves tables (table id to its new top-left corner). */
406
+ declare function moveTables(design: Design, moves: Readonly<Record<string, readonly [number, number]>>): Design;
407
+ /**
408
+ * The app table column behind a foreign key from `tableId`, when the canvas
409
+ * added it, or `undefined` when a block or the preset owns the key.
410
+ */
411
+ declare function userConnection(design: Design, tableId: string, column: string | null): {
412
+ readonly table: string;
413
+ readonly column: string;
414
+ } | undefined;
415
+ /** Drops every saved position, so the automatic layout places every table again. */
416
+ declare function tidy(design: Design): Design;
417
+ /** A naive English singular for a table name: `organizations` to `organization`. */
418
+ declare function singular(name: string): string;
419
+ interface Connection {
420
+ /** The app table the column goes on. */
421
+ readonly source: string;
422
+ /** The table id it references. */
423
+ readonly target: string;
424
+ }
425
+ type ConnectResult = {
426
+ readonly ok: true;
427
+ readonly design: Design;
428
+ readonly column: string;
429
+ } | {
430
+ readonly ok: false;
431
+ readonly error: string;
432
+ };
433
+ /**
434
+ * Adds a foreign key column from an app table to `target`. Only app tables get
435
+ * new columns. A self reference gets `parent_id`, and a second reference to the
436
+ * same table gets a role name (`owner_id`, `<target>_2_id`) the user can
437
+ * rename. A target without a single-column primary key, and the tenant table
438
+ * the scope column already references, are refused with a message.
439
+ */
440
+ declare function connect(design: Design, data: SchemaData, preset: Pick<Preset, "scope" | "tenantName" | "idType">, connection: Connection): ConnectResult;
441
+ /**
442
+ * Adds a key to `targetId` on the app table `name` in the design, which can be
443
+ * a table the schema doesn't have yet: `<target>_id`, `parent_id` for a self
444
+ * reference, or a free role name when that column is taken.
445
+ */
446
+ declare function referenceFrom(design: Design, data: SchemaData, preset: Pick<Preset, "scope" | "tenantName" | "idType">, name: string, targetId: string): ConnectResult;
447
+ /**
448
+ * The schema with the design applied: app tables added, extra columns appended
449
+ * to the block tables that accept them.
450
+ */
451
+ declare function withDesign(data: SchemaData, design: Design, preset: Pick<Preset, "scope" | "tenantName" | "idType">): SchemaData;
452
+ //#endregion
453
+ //#region src/create/types.d.ts
454
+ /** One rendered file: its path, the SQL module it belongs to and its contents. */
455
+ interface PresetMigrationFile {
456
+ readonly path: string;
457
+ readonly module: string;
458
+ readonly contents: string;
459
+ }
460
+ //#endregion
461
+ export { SchemaTable as $, renameColumn as A, AppEvents as B, editTable as C, tableWithComputed as Ct, isEmptyDesign as D, IssueSeverity as Dt, isAppTable as E, IssueCode as Et, singular as F, subjectTypeError as G, eventsColumnsEdited as H, tidy as I, SchemaData as J, SchemaColumn as K, updateTable as L, setColumn as M, setExtraColumn as N, moveTables as O, IssueSource as Ot, setTableId as P, SchemaSource as Q, userConnection as R, duplicateTable as S, rollupSources as St, identifierError as T, Issue as Tt, subjectColumns as U, AppSubject as V, subjectColumnsEdited as W, SchemaOptions as X, SchemaForeignKey as Y, SchemaSoftRef as Z, connect as _, isRollupAggregate as _t, AppScope as a, tenantColumnOf as at, deleteExtraColumn as b, readableColumns as bt, ConnectResult as c, ComputedRow as ct, EMPTY_DESIGN as d, RollupAggregate as dt, SchemaTarget as et, NamedDesign as f, computedColumnRenamed as ft, columnError as g, fittedRollup as gt, appTableId as h, filterColumns as ht, AppReference as i, tableStatements as it, renameTable as j, referenceFrom as k, Connection as l, DraftRollup as lt, addTable as m, computedTableRenamed as mt, APP_MODULE as n, parseSchema as nt, AppTable as o, AppLookup as ot, TablePatch as p, computedRows as pt, SchemaComputed as q, AppColumn as r, schemaRelations as rt, AppTableId as s, AppRollup as st, PresetMigrationFile as t, keyColumnsOf as tt, Design as u, ROLLUP_AGGREGATES as ut, defaultError as v, lookupSources as vt, freeTableName as w, tableWithoutComputed as wt, deleteTable as x, rollupColumns as xt, deleteColumn as y, prunedComputed as yt, withDesign as z };
@@ -2,12 +2,12 @@ import { b as DbError } from "../result-DZeA5KS6.js";
2
2
  import { Ct as Events, D as BlockEventPattern, T as BlockEvent, bt as EventMap, k as BlockEventsMatching } from "../events-vcqenSYU.js";
3
3
  import { mt as QuerySpec } from "../define-Lf6rI2QN.js";
4
4
  import { tt as TemplateValues } from "../bucket-vc-QRrva.js";
5
- import { g as TopicHandlers, m as Topic, p as SubscriptionStatus, r as PresenceMember, t as EventSchemas } from "../topic-gTVjLGTk.js";
6
- import { t as AuthSnapshot } from "../bind-CFsctoFJ.js";
5
+ import { g as TopicHandlers, m as Topic, p as SubscriptionStatus, r as PresenceMember, t as EventSchemas } from "../topic-utZqhw96.js";
6
+ import { t as AuthSnapshot } from "../bind-DaoTunvE.js";
7
7
  import { t as AuthSession } from "../view-DyFdMCqg.js";
8
- import { n as Controller } from "../controller-B6vWdKSa.js";
9
- import { C as LiveCountSource, D as ProfileOf, E as PresenceTopic, O as UseActionOptions, S as LiveCountHookOptions, T as PresenceHookOptions, _ as ActionResultOf, a as DataRows, b as ClaimsOf, c as DataWrites, d as BlockMutationState, f as BlockQueryActions, g as ActionInputOf, h as BlockRefetchOn, i as DataRow, l as BlockEventSource, m as BlockQueryState, n as DataId, o as DataSource, p as BlockQueryOptions, r as DataListArgs, s as DataState, t as fieldErrorsOf, u as BlockMutationActions, v as ActionState, w as LiveQueryHookOptions, x as ClientLike, y as BroadcastOptions } from "../field-errors-DBgDCITw.js";
10
- import { n as BlockOptions } from "../block-env-BrUNeuJ_.js";
8
+ import { n as Controller } from "../controller-BGto_kYM.js";
9
+ import { C as LiveCountSource, D as ProfileOf, E as PresenceTopic, O as UseActionOptions, S as LiveCountHookOptions, T as PresenceHookOptions, _ as ActionResultOf, a as DataRows, b as ClaimsOf, c as DataWrites, d as BlockMutationState, f as BlockQueryActions, g as ActionInputOf, h as BlockRefetchOn, i as DataRow, l as BlockEventSource, m as BlockQueryState, n as DataId, o as DataSource, p as BlockQueryOptions, r as DataListArgs, s as DataState, t as fieldErrorsOf, u as BlockMutationActions, v as ActionState, w as LiveQueryHookOptions, x as ClientLike, y as BroadcastOptions } from "../field-errors-BDhPaO0a.js";
10
+ import { n as BlockOptions } from "../block-env-DUyo2I5O.js";
11
11
  import { n as BlockDataOf, r as BlockMethodName, t as BlockArgsOf } from "../block-method-CiVa2G-J.js";
12
12
  import { t as SupportView } from "../support-view-BYOgwXsJ.js";
13
13
  import { SupabaseClient } from "@supabase/supabase-js";
package/dist/vue/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { t as clearOnUserChange } from "../user-change-DgWC6RRC.js";
2
2
  import { a as createActionRunner, c as liveKey, d as shownCount, f as startBroadcast, i as countSource, l as notJoined, m as startLiveQuery, n as assertInvalidateClient, o as joinPresence, p as startLiveCount, r as callerOf, s as keyed, t as NO_COUNT, u as plainCaller } from "../client-C_mlji5R.js";
3
3
  import { t as supportOf } from "../support-view-g4YLBeqX.js";
4
- import { c as listenToBlockEvents, d as fieldErrorsOf, i as dataTarget, l as blockEnv, n as createDataOne, o as createBlockMutation, s as createBlockQuery, t as createDataList, u as withEnv } from "../data-hooks-tgF1Ct0F.js";
4
+ import { c as listenToBlockEvents, d as fieldErrorsOf, i as dataTarget, l as blockEnv, n as createDataOne, o as createBlockMutation, s as createBlockQuery, t as createDataList, u as withEnv } from "../data-hooks-CdcZfVS1.js";
5
5
  import { computed, getCurrentInstance, getCurrentScope, inject, onMounted, onScopeDispose, provide, readonly, shallowRef, toValue, watch } from "vue";
6
6
  //#region src/vue/context.ts
7
7
  const CLIENT = Symbol("better-supabase");
@@ -1,4 +1,4 @@
1
- import { c as RealtimeClient, p as SubscriptionStatus } from "./topic-gTVjLGTk.js";
1
+ import { c as RealtimeClient, p as SubscriptionStatus } from "./topic-utZqhw96.js";
2
2
  //#region src/realtime/watch-topic.d.ts
3
3
  interface TopicWatch {
4
4
  readonly onMessage: (event: string, payload: unknown) => void;
@@ -1,7 +1,7 @@
1
1
  import { n as dbError } from "../../errors-BVFgt8BZ.js";
2
2
  import { o as problemResponse } from "../../problem-Bf0cJ7tk.js";
3
3
  import { i as sqlIdent } from "../../template-Drgg3v2J.js";
4
- import { i as WORLD_POSTGRES_VERSION, r as WORKFLOW_VAULT_SECRETS } from "../../workflow-sdk-DELaQEp3.js";
4
+ import { i as WORLD_POSTGRES_VERSION, r as WORKFLOW_VAULT_SECRETS } from "../../workflow-sdk-CE8sEK57.js";
5
5
  import { n as hmacHex, r as timingSafeEqual } from "../../hmac-B3CTTlfv.js";
6
6
  import { t as watchPoolErrors } from "../../pool-errors-JUBcGrre.js";
7
7
  import { n as memoized } from "../../optional-peer-C1NbBRJm.js";
@@ -32,6 +32,20 @@ const writeExtraColumns = (table, extras, source, where, into) => extras.length
32
32
  from jsonb_populate_record(null::${table}, (select coalesce(jsonb_object_agg(e.key, e.value), '{}') from jsonb_each(${source}) e where e.key in (${extras.map((extra) => sqlString(extra.name)).join(", ")}))) r
33
33
  where ${where}${into === void 0 ? "" : `\n returning x.* into ${into}`};`;
34
34
  /**
35
+ * The extra columns an insert sets itself: those whose type is `not null`
36
+ * without a `default`, which the update `writeExtraColumns` runs after the
37
+ * insert would set too late. `columns` and `values` are `, a, b` lists for the
38
+ * insert, reading `source` (a `jsonb` object keyed by column name); both are
39
+ * empty when no extra column needs it, so the insert is unchanged.
40
+ */
41
+ const insertExtraColumns = (table, extras, source) => {
42
+ const required = extras.filter((extra) => /\bnot\s+null\b/iu.test(extra.type) && !/\bdefault\b/iu.test(extra.type));
43
+ return {
44
+ columns: required.map((extra) => `, ${extra.ident}`).join(""),
45
+ values: required.map((extra) => `, (jsonb_populate_record(null::${table}, coalesce(${source}, '{}'::jsonb))).${extra.ident}`).join("")
46
+ };
47
+ };
48
+ /**
35
49
  * `json` (a `jsonb` expression of row `alias`) with the extra columns under
36
50
  * `fields`, or `json` itself without any.
37
51
  */
@@ -1014,6 +1028,29 @@ const DEFAULT_ROLES = {
1014
1028
  ],
1015
1029
  viewer: ["organization.read"]
1016
1030
  };
1031
+ /** Actions a module checks only when `blocks.<module>.permissions` names a key. */
1032
+ const OPTIONAL_MODULE_PERMISSIONS = {
1033
+ organizations: {
1034
+ create: "platform",
1035
+ updatePlatform: "platform",
1036
+ deletePlatform: "platform",
1037
+ updateRolePlatform: "platform",
1038
+ removeMemberPlatform: "platform"
1039
+ },
1040
+ audit: { reveal: "tenant" },
1041
+ "data-lifecycle": { deletePlatform: "platform" },
1042
+ tags: {
1043
+ create: "tenant",
1044
+ update: "tenant",
1045
+ delete: "tenant"
1046
+ },
1047
+ teams: {
1048
+ create: "tenant",
1049
+ update: "tenant",
1050
+ delete: "tenant",
1051
+ members: "tenant"
1052
+ }
1053
+ };
1017
1054
  /**
1018
1055
  * The permission key each operation checks by default, keyed
1019
1056
  * `<module>.<action>`. `blocks.<name>.permissions` renames a key per module,
@@ -2445,4 +2482,4 @@ const WORKFLOW_SDK_WORLD = {
2445
2482
  data
2446
2483
  };
2447
2484
  //#endregion
2448
- export { quotedTable as $, addNotNullCheck as A, extraFieldsArg as B, SCHEMA as C, addCheck as D, activeMembership as E, defaultPartitionName as F, lockTable as G, fail as H, disabledHelpers as I, membershipSuspended as J, memberAddedRecord as K, disabledHelpersNeedLaterTables as L, columnRef as M, columnsObject as N, addExtraColumns as O, defaultPartition as P, pageSize as Q, dropExpiredPartitions as R, PARTITION_VARIABLES as S, accessDefinesDisabledHelpers as T, jsonSchemaChecks as U, extraFieldsJson as V, jwtClaim as W, organizationMissing as X, notNullCheckName as Y, ownRowPolicies as Z, rolesOf as _, DEFAULT_ROLES as a, revokeTable as at, MONTHLY_PARTITIONS as b, accessModel as c, serviceOnly as ct, moduleOperations as d, splitTable as dt, raise as et, modulePermission as f, triggerGrant as ft, roleScopeIs as g, writeExtraColumns as gt, roleNames as h, withExtraFields as ht, WORLD_POSTGRES_VERSION as i, replaceColumnCheck as it, batchFunction as j, addForeignKey as k, hasPlatformRoles as l, sha256Hex as lt, providerPlatformRoles as m, userGrant as mt, WORKFLOW_SDK_WORLD as n, registerPartitions as nt, MODULE_PERMISSION_SCOPES as o, schemaPreamble as ot, modulePermissionKey as p, updatedAt as pt, membershipDisabledAt as q, WORKFLOW_VAULT_SECRETS as r, renameSql as rt, OPERATIONS as s, serviceGrant as st, WORKFLOW_DELIVERY_QUEUE as t, recordTrigger as tt, isOperationModule as u, shortHash as ut, tenantScope as v, SERVICE_CALLER as w, NOTHING as x, EQUIVALENT_TRIGGERS as y, ensureCheck as z };
2485
+ export { ownRowPolicies as $, addForeignKey as A, ensureCheck as B, PARTITION_VARIABLES as C, activeMembership as D, accessDefinesDisabledHelpers as E, defaultPartition as F, jsonSchemaChecks as G, extraFieldsJson as H, defaultPartitionName as I, memberAddedRecord as J, jwtClaim as K, disabledHelpers as L, batchFunction as M, columnRef as N, addCheck as O, columnsObject as P, organizationMissing as Q, disabledHelpersNeedLaterTables as R, NOTHING as S, SERVICE_CALLER as T, fail as U, extraFieldsArg as V, insertExtraColumns as W, membershipSuspended as X, membershipDisabledAt as Y, notNullCheckName as Z, roleScopeIs as _, withExtraFields as _t, DEFAULT_ROLES as a, renameSql as at, EQUIVALENT_TRIGGERS as b, OPTIONAL_MODULE_PERMISSIONS as c, schemaPreamble as ct, isOperationModule as d, sha256Hex as dt, pageSize as et, moduleOperations as f, shortHash as ft, roleNames as g, userGrant as gt, providerPlatformRoles as h, updatedAt as ht, WORLD_POSTGRES_VERSION as i, registerPartitions as it, addNotNullCheck as j, addExtraColumns as k, accessModel as l, serviceGrant as lt, modulePermissionKey as m, triggerGrant as mt, WORKFLOW_SDK_WORLD as n, raise as nt, MODULE_PERMISSION_SCOPES as o, replaceColumnCheck as ot, modulePermission as p, splitTable as pt, lockTable as q, WORKFLOW_VAULT_SECRETS as r, recordTrigger as rt, OPERATIONS as s, revokeTable as st, WORKFLOW_DELIVERY_QUEUE as t, quotedTable as tt, hasPlatformRoles as u, serviceOnly as ut, rolesOf as v, writeExtraColumns as vt, SCHEMA as w, MONTHLY_PARTITIONS as x, tenantScope as y, dropExpiredPartitions as z };
@@ -1,5 +1,5 @@
1
1
  import { t as AsyncResult } from "../result-DZeA5KS6.js";
2
- import { c as RealtimeClient, r as PresenceMember } from "../topic-gTVjLGTk.js";
2
+ import { c as RealtimeClient, r as PresenceMember } from "../topic-utZqhw96.js";
3
3
  import { a as DocumentSuggestion, d as OpenedDocument, l as Documents, r as DocumentRef, t as DecidedSuggestion } from "../documents-Cup1rpjF.js";
4
4
  //#region src/yjs/yjs.d.ts
5
5
  type PresenceState = Readonly<Record<string, unknown>>;
package/dist/yjs/index.js CHANGED
@@ -2,7 +2,7 @@ import { n as isRecord } from "../guards-6F2bCtQR.js";
2
2
  import { a as ok, r as err, t as AsyncResult } from "../result-ntFBW2p2.js";
3
3
  import { i as toBase64, r as fromBase64 } from "../base64-B9Wlsdj7.js";
4
4
  import { t as importOptionalPeer } from "../optional-peer-C1NbBRJm.js";
5
- import { t as defineTopic } from "../topic-J9I3yu6f.js";
5
+ import { t as defineTopic } from "../topic-F0FKzJyQ.js";
6
6
  //#region src/yjs/yjs.ts
7
7
  function isYjs(value) {
8
8
  return isRecord(value) && typeof value["applyUpdate"] === "function" && typeof value["mergeUpdates"] === "function";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-supabase",
3
- "version": "0.21.0",
3
+ "version": "0.23.0",
4
4
  "description": "Strongly typed Supabase: generated schema, typed repositories, plugins, auth glue, framework integrations and the better-supabase CLI.",
5
5
  "keywords": [
6
6
  "cli",