better-supabase 0.20.0 → 0.22.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 (513) hide show
  1. package/dist/{adapter-CfuBICuG.js → adapter-D4aNBxhm.js} +4 -4
  2. package/dist/{ai-cache-BuNbWEFI.js → ai-cache-BFRKxgZ4.js} +2 -2
  3. package/dist/{ai-files-DeMWQfzs.js → ai-files-m_2z3rH1.js} +3 -3
  4. package/dist/{ai-schedules-Bp-U0cZG.d.ts → ai-schedules-7uQNMXve.d.ts} +1 -1
  5. package/dist/ai-sdk/agents/index.d.ts +2 -2
  6. package/dist/ai-sdk/batches/index.js +3 -3
  7. package/dist/ai-sdk/cache/index.js +1 -1
  8. package/dist/ai-sdk/chat/index.js +1 -1
  9. package/dist/ai-sdk/files/index.js +2 -2
  10. package/dist/ai-sdk/index.js +3 -3
  11. package/dist/ai-sdk/mcp/index.js +2 -2
  12. package/dist/ai-sdk/workflow/index.js +2 -2
  13. package/dist/api-3C0AWFeP.js +696 -0
  14. package/dist/{api-BIw5g_4V.d.ts → api-CHObZL7m.d.ts} +2 -2
  15. package/dist/{app-tables-oYkgtcRM.d.ts → app-tables-BGzdnQm5.d.ts} +1 -1
  16. package/dist/astro/index.d.ts +3 -3
  17. package/dist/astro/index.js +5 -5
  18. package/dist/{attachments-BTIwCuwm.js → attachments-BXbLnNxm.js} +5 -5
  19. package/dist/{authorization-08F77H2w.d.ts → authorization-DhoA7dsD.d.ts} +22 -8
  20. package/dist/{automations-jIIaT9EJ.js → automations-BMuqwZZn.js} +5 -5
  21. package/dist/better-result/index.d.ts +2 -2
  22. package/dist/{bind-BwQGUqdQ.d.ts → bind-CFsctoFJ.d.ts} +4 -4
  23. package/dist/{block-authors-D9hyCizs.js → block-authors-Bw3zdzgl.js} +1 -1
  24. package/dist/{block-env-Dh0Fe-fK.d.ts → block-env-BrUNeuJ_.d.ts} +4 -4
  25. package/dist/{block-events-pBXPzwnW.js → block-events-IWAyafO3.js} +1 -1
  26. package/dist/{block-fields-DE_FgpOU.js → block-fields-BjXgX_5c.js} +4 -3
  27. package/dist/{block-helpers-DnCtsKtv.js → block-helpers-B0f0ZVb5.js} +169 -4
  28. package/dist/{block-hooks-DbIpkq7a.js → block-hooks-DKtz0HRh.js} +1 -1
  29. package/dist/{block-subjects-BRJO0IqO.js → block-subjects-DFSuFY1a.js} +1 -1
  30. package/dist/blocks/access-requests/index.d.ts +1 -1
  31. package/dist/blocks/access-requests/index.js +4 -5
  32. package/dist/blocks/activities/index.d.ts +1 -1
  33. package/dist/blocks/activities/index.js +4 -5
  34. package/dist/blocks/agents/index.d.ts +1 -1
  35. package/dist/blocks/agents/index.js +3 -4
  36. package/dist/blocks/ai-cache/index.d.ts +1 -1
  37. package/dist/blocks/ai-cache/index.js +2 -2
  38. package/dist/blocks/ai-chat/index.d.ts +4 -4
  39. package/dist/blocks/ai-chat/index.js +4 -5
  40. package/dist/blocks/ai-files/index.d.ts +1 -1
  41. package/dist/blocks/ai-files/index.js +2 -2
  42. package/dist/blocks/ai-keys/index.d.ts +1 -1
  43. package/dist/blocks/ai-keys/index.js +3 -4
  44. package/dist/blocks/ai-schedules/index.d.ts +2 -2
  45. package/dist/blocks/ai-schedules/index.js +5 -6
  46. package/dist/blocks/announcements/index.d.ts +4 -4
  47. package/dist/blocks/announcements/index.js +4 -5
  48. package/dist/blocks/api-keys/index.d.ts +2 -2
  49. package/dist/blocks/api-keys/index.js +5 -6
  50. package/dist/blocks/approvals/index.d.ts +1 -1
  51. package/dist/blocks/approvals/index.js +4 -5
  52. package/dist/blocks/assets/index.d.ts +1 -1
  53. package/dist/blocks/assets/index.js +3 -4
  54. package/dist/blocks/assignment/index.d.ts +1 -1
  55. package/dist/blocks/assignment/index.js +4 -5
  56. package/dist/blocks/attachments/index.d.ts +2 -2
  57. package/dist/blocks/attachments/index.js +5 -6
  58. package/dist/blocks/audit/index.d.ts +5 -5
  59. package/dist/blocks/audit/index.js +8 -9
  60. package/dist/blocks/automations/index.d.ts +3 -3
  61. package/dist/blocks/automations/index.js +6 -6
  62. package/dist/blocks/billable-time/index.d.ts +1 -1
  63. package/dist/blocks/billable-time/index.js +6 -7
  64. package/dist/blocks/billing/index.d.ts +3 -3
  65. package/dist/blocks/billing/index.js +6 -7
  66. package/dist/blocks/bookings/index.d.ts +3 -3
  67. package/dist/blocks/bookings/index.js +7 -7
  68. package/dist/blocks/bulk/index.d.ts +4 -3
  69. package/dist/blocks/bulk/index.js +4 -4
  70. package/dist/blocks/calendar/index.d.ts +2 -2
  71. package/dist/blocks/calendar/index.js +7 -7
  72. package/dist/blocks/catalog/index.d.ts +1 -1
  73. package/dist/blocks/catalog/index.js +5 -6
  74. package/dist/blocks/channels/index.d.ts +1 -1
  75. package/dist/blocks/channels/index.js +3 -4
  76. package/dist/blocks/collections/index.d.ts +1 -1
  77. package/dist/blocks/collections/index.js +3 -4
  78. package/dist/blocks/comments/index.d.ts +5 -5
  79. package/dist/blocks/comments/index.js +8 -9
  80. package/dist/blocks/compliance/index.d.ts +1 -1
  81. package/dist/blocks/compliance/index.js +5 -6
  82. package/dist/blocks/connectors/index.d.ts +1 -1
  83. package/dist/blocks/connectors/index.js +3 -4
  84. package/dist/blocks/contacts/index.d.ts +1 -1
  85. package/dist/blocks/contacts/index.js +4 -5
  86. package/dist/blocks/content/index.d.ts +1 -1
  87. package/dist/blocks/content/index.js +3 -4
  88. package/dist/blocks/contracts/index.d.ts +1 -1
  89. package/dist/blocks/contracts/index.js +8 -9
  90. package/dist/blocks/courses/index.d.ts +1 -1
  91. package/dist/blocks/courses/index.js +5 -6
  92. package/dist/blocks/created-by/index.d.ts +1 -1
  93. package/dist/blocks/custom-fields/index.d.ts +1 -1
  94. package/dist/blocks/custom-fields/index.js +2 -2
  95. package/dist/blocks/data-lifecycle/index.d.ts +1 -1
  96. package/dist/blocks/data-lifecycle/index.js +3 -4
  97. package/dist/blocks/deals/index.d.ts +1 -1
  98. package/dist/blocks/deals/index.js +9 -10
  99. package/dist/blocks/dispatch/index.d.ts +1 -1
  100. package/dist/blocks/dispatch/index.js +7 -8
  101. package/dist/blocks/documents/index.d.ts +1 -1
  102. package/dist/blocks/documents/index.js +2 -3
  103. package/dist/blocks/domains/index.d.ts +1 -1
  104. package/dist/blocks/domains/index.js +3 -4
  105. package/dist/blocks/donations/index.d.ts +1 -1
  106. package/dist/blocks/donations/index.js +7 -8
  107. package/dist/blocks/drive/index.d.ts +5 -1
  108. package/dist/blocks/drive/index.js +6 -7
  109. package/dist/blocks/employees/index.d.ts +2 -2
  110. package/dist/blocks/employees/index.js +7 -8
  111. package/dist/blocks/enrichment/index.d.ts +1 -1
  112. package/dist/blocks/enrichment/index.js +2 -3
  113. package/dist/blocks/enrollments/index.d.ts +1 -1
  114. package/dist/blocks/enrollments/index.js +3 -4
  115. package/dist/blocks/entitlements/index.d.ts +3 -3
  116. package/dist/blocks/entitlements/index.js +2 -2
  117. package/dist/blocks/expenses/index.d.ts +1 -1
  118. package/dist/blocks/expenses/index.js +6 -7
  119. package/dist/blocks/field-history/index.d.ts +1 -1
  120. package/dist/blocks/field-history/index.js +2 -3
  121. package/dist/blocks/flags/index.d.ts +1 -1
  122. package/dist/blocks/flags/index.js +4 -5
  123. package/dist/blocks/forecasts/index.d.ts +1 -1
  124. package/dist/blocks/forecasts/index.js +5 -6
  125. package/dist/blocks/forms/index.d.ts +2 -2
  126. package/dist/blocks/forms/index.js +4 -5
  127. package/dist/blocks/goals/index.d.ts +1 -1
  128. package/dist/blocks/goals/index.js +4 -5
  129. package/dist/blocks/guests/index.d.ts +1 -1
  130. package/dist/blocks/guests/index.js +4 -5
  131. package/dist/blocks/hiring/index.d.ts +1 -1
  132. package/dist/blocks/hiring/index.js +4 -5
  133. package/dist/blocks/identities/index.d.ts +1 -1
  134. package/dist/blocks/identities/index.js +2 -3
  135. package/dist/blocks/imports/index.d.ts +1 -1
  136. package/dist/blocks/imports/index.js +3 -3
  137. package/dist/blocks/inbox/index.d.ts +5 -5
  138. package/dist/blocks/inbox/index.js +4 -5
  139. package/dist/blocks/incidents/index.d.ts +1 -1
  140. package/dist/blocks/incidents/index.js +5 -6
  141. package/dist/blocks/index.d.ts +2 -2
  142. package/dist/blocks/index.js +7 -7
  143. package/dist/blocks/inventory/index.d.ts +1 -1
  144. package/dist/blocks/inventory/index.js +3 -4
  145. package/dist/blocks/invoices/index.d.ts +1 -1
  146. package/dist/blocks/invoices/index.js +6 -7
  147. package/dist/blocks/knowledge/index.d.ts +1 -1
  148. package/dist/blocks/knowledge/index.js +2 -2
  149. package/dist/blocks/lead-scoring/index.d.ts +1 -1
  150. package/dist/blocks/lead-scoring/index.js +4 -5
  151. package/dist/blocks/leases/index.d.ts +1 -1
  152. package/dist/blocks/leases/index.js +7 -8
  153. package/dist/blocks/leave/index.d.ts +1 -1
  154. package/dist/blocks/leave/index.js +4 -5
  155. package/dist/blocks/ledger/index.d.ts +1 -1
  156. package/dist/blocks/ledger/index.js +3 -4
  157. package/dist/blocks/mail-sync/index.d.ts +1 -1
  158. package/dist/blocks/mail-sync/index.js +5 -6
  159. package/dist/blocks/memberships/index.d.ts +1 -1
  160. package/dist/blocks/memory/index.d.ts +1 -1
  161. package/dist/blocks/memory/index.js +3 -4
  162. package/dist/blocks/messaging/index.d.ts +5 -5
  163. package/dist/blocks/messaging/index.js +6 -7
  164. package/dist/blocks/metrics/index.d.ts +1 -1
  165. package/dist/blocks/metrics/index.js +4 -5
  166. package/dist/blocks/mfa/index.d.ts +2 -2
  167. package/dist/blocks/moderation/index.d.ts +1 -1
  168. package/dist/blocks/moderation/index.js +3 -4
  169. package/dist/blocks/notifications/index.d.ts +4 -4
  170. package/dist/blocks/notifications/index.js +8 -9
  171. package/dist/blocks/numbering/index.d.ts +1 -1
  172. package/dist/blocks/numbering/index.js +2 -2
  173. package/dist/blocks/oauth-server/index.d.ts +1 -1
  174. package/dist/blocks/oauth-server/index.js +3 -4
  175. package/dist/blocks/onboarding/index.d.ts +2 -2
  176. package/dist/blocks/onboarding/index.js +2 -3
  177. package/dist/blocks/orders/index.d.ts +9 -2
  178. package/dist/blocks/orders/index.js +7 -8
  179. package/dist/blocks/organizations/index.d.ts +3 -3
  180. package/dist/blocks/organizations/index.js +5 -6
  181. package/dist/blocks/outbox/index.d.ts +1 -1
  182. package/dist/blocks/outbox/index.js +3 -4
  183. package/dist/blocks/passes/index.d.ts +2 -2
  184. package/dist/blocks/passes/index.js +7 -8
  185. package/dist/blocks/permissions/index.d.ts +3 -3
  186. package/dist/blocks/permissions/index.js +2 -3
  187. package/dist/blocks/pipelines/index.d.ts +1 -1
  188. package/dist/blocks/pipelines/index.js +4 -5
  189. package/dist/blocks/posts/index.d.ts +1 -1
  190. package/dist/blocks/posts/index.js +4 -5
  191. package/dist/blocks/profiles/index.d.ts +1 -1
  192. package/dist/blocks/profiles/index.js +3 -4
  193. package/dist/blocks/promotions/index.d.ts +1 -1
  194. package/dist/blocks/promotions/index.js +4 -5
  195. package/dist/blocks/push/index.d.ts +2 -2
  196. package/dist/blocks/push/index.js +5 -6
  197. package/dist/blocks/queue/index.d.ts +1 -1
  198. package/dist/blocks/queue/index.js +7 -8
  199. package/dist/blocks/quotes/index.d.ts +1 -1
  200. package/dist/blocks/quotes/index.js +6 -7
  201. package/dist/blocks/rank/index.d.ts +1 -1
  202. package/dist/blocks/rank/index.js +2 -2
  203. package/dist/blocks/reactions/index.d.ts +4 -4
  204. package/dist/blocks/reactions/index.js +4 -5
  205. package/dist/blocks/relations/index.d.ts +3 -2
  206. package/dist/blocks/relations/index.js +8 -8
  207. package/dist/blocks/reminders/index.d.ts +10 -6
  208. package/dist/blocks/reminders/index.js +13 -12
  209. package/dist/blocks/reviews/index.d.ts +1 -1
  210. package/dist/blocks/reviews/index.js +3 -4
  211. package/dist/blocks/saved-views/index.d.ts +3 -3
  212. package/dist/blocks/saved-views/index.js +4 -4
  213. package/dist/blocks/scores/index.d.ts +1 -1
  214. package/dist/blocks/scores/index.js +4 -4
  215. package/dist/blocks/search/index.d.ts +3 -3
  216. package/dist/blocks/search/index.js +3 -4
  217. package/dist/blocks/security-events/index.d.ts +1 -1
  218. package/dist/blocks/security-events/index.js +2 -3
  219. package/dist/blocks/segments/index.d.ts +1 -1
  220. package/dist/blocks/segments/index.js +4 -5
  221. package/dist/blocks/sequences/index.d.ts +1 -1
  222. package/dist/blocks/sequences/index.js +3 -4
  223. package/dist/blocks/service-accounts/index.d.ts +1 -1
  224. package/dist/blocks/service-accounts/index.js +3 -4
  225. package/dist/blocks/sessions/index.d.ts +2 -2
  226. package/dist/blocks/sessions/index.js +1 -1
  227. package/dist/blocks/settings/index.d.ts +2 -2
  228. package/dist/blocks/settings/index.js +3 -4
  229. package/dist/blocks/share-links/index.d.ts +1 -1
  230. package/dist/blocks/share-links/index.js +6 -6
  231. package/dist/blocks/shipments/index.d.ts +1 -1
  232. package/dist/blocks/shipments/index.js +9 -10
  233. package/dist/blocks/signatures/index.d.ts +1 -1
  234. package/dist/blocks/signatures/index.js +3 -4
  235. package/dist/blocks/signing-keys/index.d.ts +1 -1
  236. package/dist/blocks/signing-keys/index.js +2 -2
  237. package/dist/blocks/sla/index.d.ts +1 -1
  238. package/dist/blocks/sla/index.js +7 -8
  239. package/dist/blocks/sso/index.d.ts +1 -1
  240. package/dist/blocks/sso/index.js +2 -3
  241. package/dist/blocks/state-machine/index.d.ts +1 -1
  242. package/dist/blocks/state-machine/index.js +3 -3
  243. package/dist/blocks/subjects/index.d.ts +2 -2
  244. package/dist/blocks/subjects/index.js +3 -4
  245. package/dist/blocks/tags/index.d.ts +2 -2
  246. package/dist/blocks/tags/index.js +6 -6
  247. package/dist/blocks/tasks/index.d.ts +2 -2
  248. package/dist/blocks/tasks/index.js +7 -8
  249. package/dist/blocks/teams/index.d.ts +1 -1
  250. package/dist/blocks/teams/index.js +3 -3
  251. package/dist/blocks/templates/index.d.ts +3 -3
  252. package/dist/blocks/templates/index.js +3 -4
  253. package/dist/blocks/time-tracking/index.d.ts +8 -1
  254. package/dist/blocks/time-tracking/index.js +9 -10
  255. package/dist/blocks/timeline/index.d.ts +3 -3
  256. package/dist/blocks/timeline/index.js +4 -5
  257. package/dist/blocks/trash/index.d.ts +1 -1
  258. package/dist/blocks/trash/index.js +3 -4
  259. package/dist/blocks/undo/index.d.ts +2 -2
  260. package/dist/blocks/undo/index.js +2 -2
  261. package/dist/blocks/updated-at/index.d.ts +1 -1
  262. package/dist/blocks/usage/index.d.ts +2 -2
  263. package/dist/blocks/usage/index.js +2 -3
  264. package/dist/blocks/vercel-marketplace/index.d.ts +1 -1
  265. package/dist/blocks/vercel-marketplace/index.js +3 -4
  266. package/dist/blocks/versions/index.d.ts +1 -1
  267. package/dist/blocks/versions/index.js +6 -7
  268. package/dist/blocks/waitlist/index.d.ts +1 -1
  269. package/dist/blocks/waitlist/index.js +4 -5
  270. package/dist/blocks/webhooks/index.d.ts +3 -3
  271. package/dist/blocks/webhooks/index.js +13 -14
  272. package/dist/blocks/workflow-editor/index.d.ts +6 -6
  273. package/dist/blocks/workflow-editor/index.js +10 -11
  274. package/dist/blocks/workflows/index.d.ts +4 -4
  275. package/dist/blocks/workflows/index.js +5 -6
  276. package/dist/{bookings-Dox2rced.d.ts → bookings-BpCNphYp.d.ts} +1 -2
  277. package/dist/{build-D9lWi5bk.js → build-CH2N3Yf0.js} +4 -4
  278. package/dist/{build-BFC8nFiL.js → build-DbIRFcHQ.js} +3 -65
  279. package/dist/chat-sdk/index.js +2 -3
  280. package/dist/cli/{add-CH7dC6UR.js → add-B6CQOt3A.js} +2 -2
  281. package/dist/cli/{add-CtLjnwds.js → add-BXFzr0Wf.js} +9 -9
  282. package/dist/cli/add-w_HumDPX.js +1 -0
  283. package/dist/cli/{backfill-DBJIMzcy.js → backfill-Dflp6JZk.js} +1 -1
  284. package/dist/cli/bin.js +1 -1
  285. package/dist/cli/{blocks-i1w0EEvs.js → blocks-CBH3N7Fy.js} +1 -1
  286. package/dist/cli/{blocks-CS58-xnw.js → blocks-FtOIcUbu.js} +1 -1
  287. package/dist/cli/{cache-Cn3crN0v.js → cache-61VwYKEv.js} +1 -1
  288. package/dist/cli/{codemod-D6wifOAH.js → codemod-CqPRa25J.js} +1 -1
  289. package/dist/cli/{content-mapper-Q9We297z.js → content-mapper-DGQQY5IA.js} +2 -2
  290. package/dist/cli/{doctor-DmfdE5Ct.js → doctor-BxxSO193.js} +62 -58
  291. package/dist/cli/{gen-D68A0uN8.js → gen-D2cqqqTH.js} +11 -11
  292. package/dist/cli/index.d.ts +1 -1
  293. package/dist/cli/index.js +6 -6
  294. package/dist/cli/{init-N7pkBbJn.js → init-BnG1IE1y.js} +5 -5
  295. package/dist/cli/{live-0xAAlTK_.js → live-D26OWOAb.js} +2 -2
  296. package/dist/cli/{mcp-CbN3ulRF.js → mcp-1l3C_GdB.js} +2 -2
  297. package/dist/cli/{metadata-417ldpf4.js → metadata-DDfPBHwI.js} +3 -3
  298. package/dist/cli/{migration-safety-BC_UI4jC.js → migration-safety-CQbrfZIx.js} +1 -1
  299. package/dist/cli/{migrations-DdBKwrvG.js → migrations-Ch5Uuvyj.js} +1 -1
  300. package/dist/cli/{module-migration-DdxPdqMC.js → module-migration-Dul1uTYX.js} +2 -2
  301. package/dist/cli/{powersync-CJTEz-uY.js → powersync-CfT-tRx1.js} +2 -2
  302. package/dist/cli/powersync-Vmhw5c1N.js +1 -0
  303. package/dist/cli/{print-DyFm91R-.js → print-CbPT4PTL.js} +2 -2
  304. package/dist/cli/{remove-CPY0xsVm.js → remove-kDH1yxKZ.js} +5 -5
  305. package/dist/cli/{render-DE3O1OFq.js → render-0Vd7BaNA.js} +22 -5
  306. package/dist/cli/{run-WtIEFGvP.js → run-Dafms0D2.js} +8 -8
  307. package/dist/cli/{run-CcrNGX9C.js → run-DxTd55Ug.js} +21 -21
  308. package/dist/cli/{shared-SlukBuKn.js → shared-BQAMXvwd.js} +1 -1
  309. package/dist/cli/{snapshot-pyIsJjUV.js → snapshot-B8K6gYjA.js} +2 -2
  310. package/dist/cli/{source-Bclt9D0Y.js → source-CXDyCWz5.js} +1 -1
  311. package/dist/cli/{spec-D7zsEVj_.js → spec-BGsnTkIl.js} +2 -2
  312. package/dist/cli/{spec-BsdLx7tZ.js → spec-CaN7nOqI.js} +1 -1
  313. package/dist/cli/{sql-layout-C6baAM5t.js → sql-layout-BGAlcp1U.js} +2 -2
  314. package/dist/cli/{sync-Cse8VXAU.js → sync-CT_5VG0E.js} +3 -3
  315. package/dist/cli/{upgrade-28ENjIJU.js → upgrade-DA7aO88E.js} +2 -2
  316. package/dist/cli/{upgrade-Cwc1RiAE.js → upgrade-frUtPDDb.js} +4 -4
  317. package/dist/cli/{version-yWIaLG04.js → version-CUdPyV6J.js} +1 -1
  318. package/dist/client/index.d.ts +5 -5
  319. package/dist/client/index.js +1 -1
  320. package/dist/client/native/index.d.ts +4 -4
  321. package/dist/client/native/index.js +1 -1
  322. package/dist/{codecs-BfmQSbM6.js → codecs-CSUFGrdP.js} +3 -3
  323. package/dist/commerce/index.js +3 -3
  324. package/dist/{composite-D24L5RIY.js → composite-CBRbvn5j.js} +2 -2
  325. package/dist/{composite-DbRuu6Jb.d.ts → composite-ChzHhSB0.d.ts} +3 -3
  326. package/dist/config/index.d.ts +2 -2
  327. package/dist/config/index.js +5 -5
  328. package/dist/{config-CD2OGfCG.js → config-C9AOcQ9S.js} +1 -1
  329. package/dist/{config-D74JT0qL.js → config-CH-D2B-4.js} +4 -4
  330. package/dist/{context-CjHXhCck.d.ts → context-DEisra3V.d.ts} +19 -7
  331. package/dist/{controller-BeqcjERs.d.ts → controller-B6vWdKSa.d.ts} +1 -1
  332. package/dist/{controller-BNZKd6bJ.js → controller-qG-B1eDn.js} +1 -1
  333. package/dist/{conversion-BqDvi8ty.d.ts → conversion-DBgMck5U.d.ts} +1 -1
  334. package/dist/create/index.d.ts +72 -451
  335. package/dist/create/index.js +15 -1687
  336. package/dist/create/lite/index.d.ts +250 -13
  337. package/dist/create/lite/index.js +1007 -24
  338. package/dist/{create-blocks-0pWKQ6x4.js → create-blocks-BfrDUSM6.js} +14 -10
  339. package/dist/credentials/index.js +3 -4
  340. package/dist/{cron-CgHTKwYG.js → cron-DdT4ti8a.js} +1 -1
  341. package/dist/{cron-route-UU9i5i9J.js → cron-route-FjKgRvTY.js} +1 -1
  342. package/dist/{deal-forecast-DikouYGj.js → deal-forecast-CKBnRodz.js} +2 -2
  343. package/dist/{define-Djgn3HQQ.js → define-D-dLADd5.js} +16 -19
  344. package/dist/{define-BqaUwrIC.d.ts → define-Lf6rI2QN.d.ts} +14 -8
  345. package/dist/{define-block-CRwHsxZO.d.ts → define-block-DCAiOrNX.d.ts} +12 -3
  346. package/dist/edge/index.d.ts +5 -5
  347. package/dist/edge/index.js +7 -7
  348. package/dist/elysia/index.js +1 -1
  349. package/dist/{entitlements-mDz7GfA_.d.ts → entitlements-BPaPd3MD.d.ts} +1 -1
  350. package/dist/{entitlements-DBir2qwB.js → entitlements-tGL6-69B.js} +2 -2
  351. package/dist/{entity-schema-BDv6w-OQ.js → entity-schema-B1YmMtP8.js} +1 -1
  352. package/dist/events/index.js +3 -3
  353. package/dist/{executor-3qcMhg6R.js → executor-C2Ne-Scm.js} +3 -2
  354. package/dist/{executor-Bi056Cnj.d.ts → executor-DNK401lZ.d.ts} +1 -1
  355. package/dist/{executor-D3gB-9si.js → executor-DqIci3Jb.js} +3 -3
  356. package/dist/{executor-BQ7dYw4E.js → executor-WolvKszH.js} +3 -3
  357. package/dist/{executor-_O-CqCPl.d.ts → executor-aFV7nEBs.d.ts} +2 -2
  358. package/dist/expo/index.d.ts +2 -2
  359. package/dist/expo/index.js +3 -3
  360. package/dist/{field-errors-Cfvcg-C3.d.ts → field-errors-DBgDCITw.d.ts} +6 -6
  361. package/dist/{fields--5a88KJe.js → fields-BBm49w-E.js} +1 -1
  362. package/dist/{filter-evaluate-w1XOIUOL.js → filter-evaluate-lCToXzZI.js} +2 -2
  363. package/dist/{filter-query-DMoKo82_.js → filter-query-CQ6d5GnQ.js} +1 -1
  364. package/dist/{flags-ClOQY-p5.js → flags-DF_SCqp5.js} +1 -1
  365. package/dist/flags-sdk/index.js +2 -2
  366. package/dist/{framework-B-1Ka0GW.d.ts → framework-DKA3fTHl.d.ts} +3 -3
  367. package/dist/{framework-CNhTg0th.js → framework-DYEUraqt.js} +1 -1
  368. package/dist/h3/index.js +1 -1
  369. package/dist/h3/v1/index.js +1 -1
  370. package/dist/hono/index.d.ts +4 -4
  371. package/dist/hono/index.js +6 -6
  372. package/dist/{index-CjnDGAJr.d.ts → index-3p_oWttZ.d.ts} +77 -2
  373. package/dist/{index-BzW1T3oI.d.ts → index-ByF22_C6.d.ts} +3 -3
  374. package/dist/{index-BdzfjFnd.d.ts → index-C4sjewrr.d.ts} +9 -9
  375. package/dist/{index-CYzckGOz.d.ts → index-CM2aGNRo.d.ts} +9 -5
  376. package/dist/{index-DfgP-9eC.d.ts → index-CdMZQCYR.d.ts} +3 -3
  377. package/dist/{index-EieRHooI.d.ts → index-ClvuSZEz.d.ts} +2 -2
  378. package/dist/index.d.ts +2 -2
  379. package/dist/index.js +8 -7
  380. package/dist/{app-tables-DyswUg6J.js → instances-CK0jR3Pc.js} +147 -3
  381. package/dist/{json-schema-Ca6gYbEP.js → json-schema-DHJxiizN.js} +1 -1
  382. package/dist/{kit-DhlB-vv_.js → kit-Bcd9wYCV.js} +1 -1
  383. package/dist/{knowledge-CV6OSirC.js → knowledge-tCrrU99q.js} +2 -2
  384. package/dist/list/index.d.ts +1 -1
  385. package/dist/list/index.js +3 -3
  386. package/dist/{list-query-BKy2zBaT.js → list-query-BnpA2BDg.js} +1 -1
  387. package/dist/{list-query-6vTI1VN6.d.ts → list-query-XYfUZb0j.d.ts} +1 -1
  388. package/dist/mapper/bin.js +5 -5
  389. package/dist/mcp/index.d.ts +4 -4
  390. package/dist/mcp/index.js +7 -7
  391. package/dist/mcp/sdk/index.d.ts +2 -2
  392. package/dist/mcp/sdk/index.js +2 -2
  393. package/dist/{messages-D4XWuRTj.js → messages-ecPW_nOv.js} +1 -1
  394. package/dist/{model-messages-CKG0zwdF.js → model-messages-CkZSDDHP.js} +1 -1
  395. package/dist/{money-codec-uV5WbT60.js → money-codec-BJuS2zEW.js} +1 -1
  396. package/dist/nestjs/index.js +1 -1
  397. package/dist/next/index.d.ts +14 -14
  398. package/dist/next/index.js +8 -8
  399. package/dist/node/index.js +1 -1
  400. package/dist/{operations-DbNAgo7E.d.ts → operations-DC3wU3Sy.d.ts} +1 -1
  401. package/dist/orpc/index.d.ts +4 -4
  402. package/dist/orpc/index.js +5 -5
  403. package/dist/otel/index.js +5 -5
  404. package/dist/{ports-DO3tgLTo.d.ts → ports-BbBJVyS0.d.ts} +1 -1
  405. package/dist/{ports-CaVRXjxq.js → ports-DvpNseap.js} +1 -1
  406. package/dist/postgres/index.js +5 -4
  407. package/dist/{postgrest-executor-BFW4oWte.js → postgrest-executor-B_Uezhrm.js} +7 -3
  408. package/dist/powersync/index.d.ts +3 -3
  409. package/dist/powersync/index.js +1 -1
  410. package/dist/preset/index.d.ts +4 -4
  411. package/dist/preset/index.js +4 -4
  412. package/dist/{preset-B3CukUhu.js → preset-CS490mYJ.js} +179 -7
  413. package/dist/project-NmP1NdLi.js +1760 -0
  414. package/dist/{push-token-IFGi8jvd.d.ts → push-token-CPJfPFa2.d.ts} +1 -1
  415. package/dist/query/index.d.ts +1 -1
  416. package/dist/query/index.js +1 -1
  417. package/dist/{rate-limit-BPuUWz4U.js → rate-limit-fZ_d8gSE.js} +4 -5
  418. package/dist/react/index.d.ts +5 -5
  419. package/dist/react/index.js +2 -2
  420. package/dist/react/native/index.d.ts +1 -1
  421. package/dist/react/server.d.ts +6 -6
  422. package/dist/react/server.js +2 -2
  423. package/dist/{react-D-p70_wL.js → react-CcrQQl0_.js} +4 -4
  424. package/dist/react-router/index.d.ts +3 -3
  425. package/dist/react-router/index.js +5 -5
  426. package/dist/{read-set-BnKnofIj.js → read-set-B1sDib5O.js} +1 -1
  427. package/dist/realtime/index.d.ts +3 -3
  428. package/dist/realtime/index.js +2 -2
  429. package/dist/{record-bindings-DkBJpC5A.js → record-bindings-Z51mGfhB.js} +1 -1
  430. package/dist/{record-form-yMVvkPiQ.d.ts → record-form-BbZpwsEi.d.ts} +1 -1
  431. package/dist/records/index.d.ts +7 -7
  432. package/dist/records/index.js +3 -3
  433. package/dist/{refusal-D48CMqpQ.js → refusal-DDlInPff.js} +2 -2
  434. package/dist/{instances-DDt7NdVl.js → resolved-names-DdlJzoMK.js} +2 -146
  435. package/dist/{resource-R3KToNze.js → resource-BUJcZKiW.js} +2 -2
  436. package/dist/{resource-execute-LR71zWej.d.ts → resource-execute-CUG6xUuh.d.ts} +1 -1
  437. package/dist/{resource-types-eXuFxVt7.d.ts → resource-types-DjZ91WKA.d.ts} +1 -1
  438. package/dist/{resources-Dpz3h8Fe.d.ts → resources-6Ncdt9XT.d.ts} +1 -1
  439. package/dist/{resources-DqIwoQsP.js → resources-jb3R6rEa.js} +1 -1
  440. package/dist/{rows-EGAbu7MG.js → rows-BdqXmiB-.js} +2 -2
  441. package/dist/{rows-Bh9QemqN.js → rows-jijHLVE_.js} +1 -1
  442. package/dist/{rrule-79K2c3Nr.js → rrule-C9Ot6ax8.js} +1 -1
  443. package/dist/{sales-lines-CP4Z_LyE.js → sales-lines-DO7oRu1o.js} +3 -3
  444. package/dist/{sales-shared-BKXXA5qV.js → sales-shared-BuTA8JK7.js} +2 -2
  445. package/dist/{schemas-BSTNfGsQ.js → schemas-CLOTvdsC.js} +1 -1
  446. package/dist/{scores-CsgM-dw7.js → scores-bY2Is0kx.js} +2 -2
  447. package/dist/server/index.d.ts +7 -7
  448. package/dist/server/index.js +9 -9
  449. package/dist/{server-types-BTBzrzOH.d.ts → server-types-BH6AjDBN.d.ts} +1 -1
  450. package/dist/{session-BgYGk_FS.d.ts → session-Y5SSYO2C.d.ts} +1 -1
  451. package/dist/{shared-C47zAh2A.js → shared-BeHTi8Fu.js} +1 -1
  452. package/dist/{sign-in-BTaRWS-L.js → sign-in-NO7LWlw4.js} +5 -5
  453. package/dist/{signatures-CNcoq392.js → signatures-CX1b4WHa.js} +2 -2
  454. package/dist/{signers-BAEzvTJ0.d.ts → signers-BKgmVh6A.d.ts} +2 -2
  455. package/dist/{signing-keys-DqI-gB_C.js → signing-keys-CWtpMask.js} +3 -3
  456. package/dist/solid/index.d.ts +6 -6
  457. package/dist/solid/index.js +1 -1
  458. package/dist/solid-start/index.d.ts +3 -3
  459. package/dist/solid-start/index.js +5 -5
  460. package/dist/spec/index.d.ts +2 -2
  461. package/dist/spec/index.js +2 -693
  462. package/dist/{spec-DTWkHzYZ.js → spec-BMvCCNnd.js} +1 -1
  463. package/dist/sql/index.d.ts +4 -4
  464. package/dist/sql/index.js +2 -2
  465. package/dist/{sql-B0wb7XA5.js → sql-BMXEHTvr.js} +9685 -6254
  466. package/dist/{sql-BPbbPzRJ.js → sql-CYt7EhH0.js} +2 -2
  467. package/dist/sqlite/index.d.ts +1 -1
  468. package/dist/sqlite/index.js +1 -1
  469. package/dist/{sso-Co2TbnEy.js → sso-DdDpJQzw.js} +2 -2
  470. package/dist/ssr/index.d.ts +1 -1
  471. package/dist/storage/index.js +3 -3
  472. package/dist/streams/index.js +1 -2
  473. package/dist/{subject-readers-F1xvRY-d.js → subject-readers-CeeJJOQ4.js} +1 -1
  474. package/dist/svelte/index.d.ts +6 -6
  475. package/dist/svelte/index.js +1 -1
  476. package/dist/sveltekit/index.d.ts +4 -4
  477. package/dist/sveltekit/index.js +5 -5
  478. package/dist/{table-schema-CD8cJz_M.js → table-schema-C80xItaV.js} +1 -1
  479. package/dist/{tags-CXeJu332.d.ts → tags-Cjtcp5cN.d.ts} +1 -1
  480. package/dist/tanstack-db/index.d.ts +1 -1
  481. package/dist/tanstack-start/index.d.ts +3 -3
  482. package/dist/tanstack-start/index.js +5 -5
  483. package/dist/{temporal-DLZlWbOi.js → temporal-Dbo0fLzc.js} +12 -2
  484. package/dist/{temporal-required-Dy0GGD8E.js → temporal-required-DcLhnDhQ.js} +1 -1
  485. package/dist/{tenant-DzymQ9sv.d.ts → tenant-BHvMFNXl.d.ts} +1 -1
  486. package/dist/testing/index.d.ts +10 -10
  487. package/dist/testing/index.js +10 -10
  488. package/dist/{timeline-BMVOKokJ.d.ts → timeline-CEzj9v1z.d.ts} +3 -3
  489. package/dist/{topic-0uK4db_2.d.ts → topic-gTVjLGTk.d.ts} +2 -2
  490. package/dist/types-BC1HLEVx.d.ts +461 -0
  491. package/dist/{types-DsRfiQ0v.d.ts → types-yj8VF4oY.d.ts} +5 -0
  492. package/dist/{undo-B3FQvuAd.js → undo-BbftL9-4.js} +2 -2
  493. package/dist/vercel-connect/index.js +1 -1
  494. package/dist/{verify-ZLFUdlqE.js → verify-7EucfCnv.js} +3 -3
  495. package/dist/{verify-DexkIx4t.d.ts → verify-B0KLBb3j.d.ts} +1 -1
  496. package/dist/vue/index.d.ts +6 -6
  497. package/dist/vue/index.js +1 -1
  498. package/dist/{watch-topic-CG3kOX-D.d.ts → watch-topic-C6HhbnVz.d.ts} +1 -1
  499. package/dist/wire-ChYn1g21.js +91 -0
  500. package/dist/workflow-sdk/builder/index.d.ts +2 -2
  501. package/dist/workflow-sdk/builder/index.js +1 -1
  502. package/dist/workflow-sdk/world/index.js +1 -1
  503. package/dist/yjs/index.d.ts +1 -1
  504. package/dist/yjs/index.js +1 -1
  505. package/package.json +1 -1
  506. package/skills/better-supabase/references/ui-recipes.md +1 -1
  507. package/dist/block-transport-PNea4lfQ.js +0 -84
  508. package/dist/cli/add-DyCrVejx.js +0 -1
  509. package/dist/cli/powersync-CYQ4Ljcz.js +0 -1
  510. package/dist/types-DGHfTW8_.d.ts +0 -9
  511. package/dist/{data-hooks-tgF1Ct0F.js → data-hooks-CdcZfVS1.js} +1 -1
  512. package/dist/{respond-3RKp6VgU.js → respond-CZMWbUs3.js} +1 -1
  513. package/dist/{topic-DXbA-jwr.js → topic-DClSoqY7.js} +2 -2
@@ -1,453 +1,8 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { Pn as PresetSpec, Wn as PresetName, ar as AppColumnAccess, ci as Preset, cr as AppColumnType, g as BlockSqlAccessProvider, ht as PresetInput, nr as APP_ON_DELETE_ACTIONS, sr as AppColumnFormat, ur as AppOnDeleteAction, yr as AppTableVersions } from "../context-CjHXhCck.js";
3
- import { a as DesignChange, p as DesignErrorCode, u as CreateDesign } from "../index-CjnDGAJr.js";
2
+ import { Pn as PresetSpec, Wn as PresetName, ar as AppColumnAccess, cr as AppColumnType, di as Preset, g as BlockSqlAccessProvider, ht as PresetInput, nr as APP_ON_DELETE_ACTIONS, ur as AppOnDeleteAction } from "../context-DEisra3V.js";
3
+ import { E as CreateDesign, b as DesignChange } from "../index-3p_oWttZ.js";
4
+ import { $ as SchemaTable, A as renameColumn, B as AppEvents, C as editTable, Ct as tableWithComputed, D as isEmptyDesign, Dt as IssueSeverity, E as isAppTable, Et as IssueCode, F as singular, G as subjectTypeError, H as eventsColumnsEdited, I as tidy, J as SchemaData, K as SchemaColumn, L as updateTable, M as setColumn, N as setExtraColumn, O as moveTables, Ot as IssueSource, P as setTableId, Q as SchemaSource, R as userConnection, S as duplicateTable, St as rollupSources, T as identifierError, Tt as Issue, U as subjectColumns, V as AppSubject, W as subjectColumnsEdited, X as SchemaOptions, Y as SchemaForeignKey, Z as SchemaSoftRef, _ as connect, _t as isRollupAggregate, a as AppScope, at as tenantColumnOf, b as deleteExtraColumn, bt as readableColumns, c as ConnectResult, ct as ComputedRow, d as EMPTY_DESIGN, dt as RollupAggregate, et as SchemaTarget, f as NamedDesign, ft as computedColumnRenamed, g as columnError, gt as fittedRollup, h as appTableId, ht as filterColumns, i as AppReference, it as tableStatements, j as renameTable, k as referenceFrom, l as Connection, lt as DraftRollup, m as addTable, mt as computedTableRenamed, n as APP_MODULE, nt as parseSchema, o as AppTable, ot as AppLookup, p as TablePatch, pt as computedRows, q as SchemaComputed, r as AppColumn, rt as schemaRelations, s as AppTableId, st as AppRollup, t as PresetMigrationFile, tt as keyColumnsOf, u as Design, ut as ROLLUP_AGGREGATES, v as defaultError, vt as lookupSources, w as freeTableName, wt as tableWithoutComputed, x as deleteTable, xt as rollupColumns, y as deleteColumn, yt as prunedComputed, z as withDesign } from "../types-BC1HLEVx.js";
4
5
  import { a as SupabaseLint, o as SupabaseOrganization, s as SupabaseProject } from "../management-wtecfrNf.js";
5
- import { t as PresetMigrationFile } from "../types-DGHfTW8_.js";
6
- //#region src/create/design-computed.d.ts
7
- /** The aggregates a rollup takes (`APP_ROLLUP_AGGREGATES`). */
8
- export declare const ROLLUP_AGGREGATES: readonly ["count", "sum", "min", "max", "avg"];
9
- export type RollupAggregate = (typeof ROLLUP_AGGREGATES)[number];
10
- /** `tables.<table>.rollups.<name>`; the shape of `AppRollupConfig`. */
11
- export interface AppRollup {
12
- readonly table: string;
13
- readonly via: string;
14
- readonly aggregate: RollupAggregate;
15
- readonly column?: string;
16
- readonly where?: {
17
- readonly column: string;
18
- readonly equals: string;
19
- };
20
- }
21
- /** `tables.<table>.lookups.<name>`; the shape of `AppLookupConfig`. */
22
- export interface AppLookup {
23
- readonly via: string;
24
- readonly column: string;
25
- }
26
- /** A rollup or lookup as a table node and the inspector list it. */
27
- export interface ComputedRow {
28
- readonly name: string;
29
- readonly kind: "rollup" | "lookup";
30
- /** What it computes, such as `count of tasks where status = todo`. */
31
- readonly summary: string;
32
- /** The short form the node shows next to the name, such as `count`. */
33
- readonly label: string;
34
- }
35
- type Tables = Readonly<Record<string, AppTable>>;
36
- export declare function isRollupAggregate(value: unknown): value is RollupAggregate;
37
- /** The columns of `table` a rollup or lookup can read, with their types. */
38
- export declare function readableColumns(table: AppTable): readonly (readonly [string, AppColumnType])[];
39
- /**
40
- * The columns `aggregate` can read: numbers for sum and avg, ordered types for
41
- * min and max, none for count.
42
- */
43
- export declare function rollupColumns(child: AppTable, aggregate: RollupAggregate): readonly string[];
44
- /** The select columns of `child` (text with options) a rollup can filter on. */
45
- export declare function filterColumns(child: AppTable): readonly (readonly [string, readonly string[]])[];
46
- /**
47
- * Each app table column that references `parent`, as `{ table, via }`: what a
48
- * rollup on `parent` can aggregate.
49
- */
50
- export declare function rollupSources(tables: Tables, parent: string): readonly {
51
- readonly table: string;
52
- readonly via: string;
53
- }[];
54
- /**
55
- * Each column of `name` that references another app table, with that table:
56
- * what a lookup can follow.
57
- */
58
- export declare function lookupSources(tables: Tables, name: string): readonly {
59
- readonly via: string;
60
- readonly target: string;
61
- }[];
62
- export type DraftRollup = { -readonly [K in keyof AppRollup]: AppRollup[K]; };
63
- /**
64
- * `table` with a rollup or lookup set under `name`, replacing `previous` in its
65
- * place.
66
- */
67
- export declare function tableWithComputed(table: AppTable, name: string, computed: {
68
- readonly rollup: AppRollup;
69
- } | {
70
- readonly lookup: AppLookup;
71
- }, previous: string): AppTable;
72
- /** `table` without the rollup or lookup `name`. */
73
- export declare function tableWithoutComputed(table: AppTable, name: string): AppTable;
74
- /**
75
- * The tables with every rollup and lookup that no longer fits dropped: one
76
- * whose table, link or column was deleted or retyped, or whose name a column
77
- * now uses. `upgrade` would refuse them, and the design code would not encode.
78
- */
79
- export declare function prunedComputed(tables: Tables): Tables;
80
- /** The rollups that aggregate `from`, pointed at `to`. */
81
- export declare function computedTableRenamed(tables: Tables, from: string, to: string): Tables;
82
- /**
83
- * The rollup fitted to a new source or aggregate: a column the aggregate can
84
- * read, and a filter the child still has.
85
- */
86
- export declare function fittedRollup(tables: Tables, rollup: AppRollup): AppRollup;
87
- /**
88
- * Every rollup and lookup that reads `table.from`, reading `table.to`. The
89
- * tables already have the column renamed, so a lookup finds its target through
90
- * the renamed link.
91
- */
92
- export declare function computedColumnRenamed(tables: Tables, table: string, from: string, to: string): Tables;
93
- /** The rollups and lookups of an app table, in the view's column order. */
94
- export declare function computedRows(table: AppTable): readonly ComputedRow[];
95
- //#endregion
96
- //#region src/create/schema.d.ts
97
- /** One rendered SQL file, as `/create/migrations` returns it. */
98
- export interface SchemaSource {
99
- readonly path: string;
100
- readonly module: string;
101
- readonly contents: string;
102
- }
103
- /**
104
- * The table a foreign key points at. `columns` is empty when the SQL names
105
- * none: the target's primary key.
106
- */
107
- export interface SchemaTarget {
108
- readonly schema: string;
109
- readonly table: string;
110
- readonly columns: readonly string[];
111
- }
112
- export interface SchemaForeignKey {
113
- readonly columns: readonly string[];
114
- readonly target: SchemaTarget;
115
- /** The `on delete` action, lower case: `cascade`, `set null`, `no action`. */
116
- readonly onDelete: string;
117
- }
118
- export interface SchemaColumn {
119
- readonly name: string;
120
- readonly type: string;
121
- readonly nullable: boolean;
122
- /** The default expression as the SQL writes it, or `null` without one. */
123
- readonly default: string | null;
124
- readonly unique: boolean;
125
- /** What the column is beyond its type (`email`, `select`), when it is more. */
126
- readonly label?: string;
127
- }
128
- export interface SchemaTable {
129
- /** `schema.name`, unquoted. */
130
- readonly id: string;
131
- readonly schema: string;
132
- readonly name: string;
133
- /** The module whose file creates the table. */
134
- readonly module: string;
135
- readonly primaryKey: readonly string[];
136
- readonly foreignKeys: readonly SchemaForeignKey[];
137
- readonly tenantColumn: string | null;
138
- /** Every column, in table order. */
139
- readonly columns: readonly SchemaColumn[];
140
- /** The rollups and lookups of an app table, which its `<table>_view` adds. */
141
- readonly computed?: readonly SchemaComputed[];
142
- }
143
- /** A column of an app table's view: a rollup or a lookup. */
144
- export interface SchemaComputed {
145
- readonly name: string;
146
- readonly kind: "rollup" | "lookup";
147
- readonly summary: string;
148
- readonly label: string;
149
- }
150
- /**
151
- * A column that points at a table without a foreign key: the tenant or user
152
- * column a block keeps plain so its rows outlive deletes, or a `regclass` that
153
- * names any table (`to` is `null`).
154
- */
155
- export interface SchemaSoftRef {
156
- readonly from: string;
157
- readonly column: string;
158
- readonly to: string | null;
159
- readonly kind: "tenant" | "user" | "any";
160
- }
161
- /** What `/create/schema` returns. */
162
- export interface SchemaData {
163
- readonly tables: readonly SchemaTable[];
164
- readonly softRefs: readonly SchemaSoftRef[];
165
- /** Table id to the block manifest that installs it. */
166
- readonly manifests: Readonly<Record<string, string>>;
167
- /** The table ids `blocks.<module>.options.extraColumns` adds columns to. */
168
- readonly extraColumns: readonly string[];
169
- /**
170
- * Table id to its module and logical table, the names an app table's
171
- * reference uses.
172
- */
173
- readonly blockTables: Readonly<Record<string, {
174
- readonly block: string;
175
- readonly table: string;
176
- }>>;
177
- /** The table tenant columns point at, or `null` without tenant foreign keys. */
178
- readonly tenantTable: string | null;
179
- }
180
- /**
181
- * The columns a diagram shows before a table is expanded: keys, tenant and soft
182
- * references.
183
- */
184
- export declare function keyColumnsOf(table: SchemaTable, softColumns?: ReadonlySet<string>): readonly SchemaColumn[];
185
- export interface SchemaOptions {
186
- /**
187
- * The tenant column the config names (`organization_id` by default); `null`
188
- * without tenants.
189
- */
190
- readonly tenantColumn?: string | null;
191
- }
192
- /**
193
- * The column the tenant blocks key rows by, from the preset's tenant name;
194
- * `null` without tenants.
195
- */
196
- export declare function tenantColumnOf(preset: Preset): string | null;
197
- /**
198
- * The tables in rendered module SQL: every `create table`, plus the columns and
199
- * foreign keys later `alter table ... add` statements give them. A `create
200
- * table` it can't read throws with the file and line, so a new SQL shape fails
201
- * the tests instead of dropping a table from the diagram.
202
- */
203
- export declare function parseSchema(files: readonly SchemaSource[], options?: SchemaOptions): readonly SchemaTable[];
204
- /**
205
- * The statements that shape one table, as written: its `create table` and the
206
- * `alter table` statements after it. Empty when no file creates it.
207
- */
208
- export declare function tableStatements(files: readonly SchemaSource[], id: string): readonly string[];
209
- /**
210
- * The foreign keys between tables, one per pair, with the targets outside the
211
- * schema named by id.
212
- */
213
- export declare function schemaRelations(tables: readonly SchemaTable[]): readonly {
214
- readonly from: string;
215
- readonly to: string;
216
- }[];
217
- //#endregion
218
- //#region src/create/design-subject.d.ts
219
- /**
220
- * Makes the rows a subject (`tables.<table>.subject`); the shape of
221
- * `AppTableSubject`.
222
- */
223
- export interface AppSubject {
224
- readonly type: string;
225
- readonly title?: string;
226
- readonly url?: string;
227
- readonly search?: {
228
- readonly title?: string;
229
- readonly body?: readonly string[];
230
- };
231
- readonly permissions?: Readonly<Record<string, string>>;
232
- readonly rank?: true | {
233
- readonly group?: string;
234
- };
235
- readonly softDelete?: boolean;
236
- readonly versions?: true | AppTableVersions;
237
- }
238
- /** Which writes emit an event and the columns its payload carries. */
239
- export interface AppEvents {
240
- readonly on?: readonly ("created" | "updated" | "deleted")[];
241
- readonly include?: readonly string[];
242
- }
243
- /**
244
- * The columns `subject` adds: `rank` for manual order and `deleted_at` for
245
- * trash.
246
- */
247
- export declare function subjectColumns(subject: AppSubject | undefined): SchemaColumn[];
248
- /** The subject with the columns it names renamed or dropped by `edit`. */
249
- export declare function subjectColumnsEdited(subject: AppSubject, edit: (columns: readonly string[]) => readonly string[]): AppSubject;
250
- /**
251
- * Why `type` can't be the subject type of the app table `table`, or `undefined`
252
- * when it can.
253
- */
254
- export declare function subjectTypeError(design: Design, table: string, type: string): string | undefined;
255
- /**
256
- * App table events with `edit` applied to the payload columns, dropping an
257
- * empty list.
258
- */
259
- export declare function eventsColumnsEdited(events: true | AppEvents, edit: (columns: readonly string[]) => readonly string[]): true | AppEvents;
260
- //#endregion
261
- //#region src/create/design.d.ts
262
- /**
263
- * Another app table or `auth.users` (`{ table }`), or a block module's logical
264
- * table (`{ block, table }`).
265
- */
266
- export interface AppReference {
267
- readonly table: string;
268
- readonly block?: string;
269
- readonly onDelete?: AppOnDeleteAction;
270
- }
271
- export interface AppColumn {
272
- readonly type: AppColumnType;
273
- readonly nullable?: boolean;
274
- readonly default?: string;
275
- readonly unique?: boolean;
276
- readonly references?: AppReference;
277
- readonly format?: AppColumnFormat;
278
- readonly options?: readonly string[];
279
- readonly min?: number;
280
- readonly max?: number;
281
- readonly comment?: string;
282
- readonly identity?: boolean;
283
- /**
284
- * Who reads and writes the column: everyone by default, `read`, or `server`
285
- * (ADR 0051).
286
- */
287
- readonly access?: AppColumnAccess;
288
- /**
289
- * Stores ciphertext with the tenant's Vault key; read through
290
- * `<table>_reveal`.
291
- */
292
- readonly encrypted?: boolean;
293
- }
294
- export type AppScope = "inherit" | "user" | "none";
295
- export type AppTableId = "uuid" | "bigint";
296
- export interface AppTable {
297
- readonly columns?: Readonly<Record<string, AppColumn>>;
298
- readonly scope?: AppScope;
299
- readonly timestamps?: boolean;
300
- readonly id?: AppTableId;
301
- readonly unique?: readonly (readonly string[])[];
302
- readonly indexes?: readonly (readonly string[])[];
303
- readonly comment?: string;
304
- readonly subject?: AppSubject;
305
- readonly rollups?: Readonly<Record<string, AppRollup>>;
306
- readonly lookups?: Readonly<Record<string, AppLookup>>;
307
- /** Outbox events on insert, update and delete; the shape of `AppTableEvents`. */
308
- readonly events?: true | AppEvents;
309
- /** One `read` audit entry per tenant per reveal call. */
310
- readonly auditReads?: boolean;
311
- }
312
- /**
313
- * What the canvas adds to a preset: app tables, extra columns on block tables
314
- * (by module) and the positions of moved tables (by table id). It has the shape
315
- * of `CreateDesign` from `better-supabase/preset`.
316
- */
317
- export interface Design {
318
- readonly appTables?: Readonly<Record<string, AppTable>>;
319
- readonly extraColumns?: Readonly<Record<string, Readonly<Record<string, string>>>>;
320
- readonly positions?: Readonly<Record<string, readonly [number, number]>>;
321
- }
322
- export declare const EMPTY_DESIGN: Design;
323
- /** The module name app tables carry in the diagram. */
324
- export declare const APP_MODULE = "app-tables";
325
- export declare function appTableId(name: string): string;
326
- export declare function isAppTable(table: Pick<SchemaTable, "module">): boolean;
327
- export declare function isEmptyDesign(design: Design): boolean;
328
- /** Why `name` can't name an app table or column, by the library's rules. */
329
- export declare function identifierError(name: string): string | undefined;
330
- /** Why a column can't be added to an app table, or `undefined` when it can. */
331
- export declare function columnError(table: AppTable, name: string, preset: Pick<Preset, "scope" | "tenantName" | "idType">): string | undefined;
332
- /**
333
- * Why `value` can't be the default of `column` (its type, options and bounds),
334
- * or `undefined` when it can or is empty.
335
- */
336
- export declare function defaultError(column: Pick<AppColumn, "type" | "options" | "min" | "max" | "format">, value: string): string | undefined;
337
- /** A free app table name: `base`, then `base_2`, `base_3` and so on. */
338
- export declare function freeTableName(design: Design, taken: ReadonlySet<string>, base?: string): string;
339
- /** Adds an app table, placed at `position` when given. */
340
- export declare function addTable(design: Design, name: string, table?: AppTable, position?: readonly [number, number]): Design;
341
- /**
342
- * Removes an app table, every app table column that references it (and those
343
- * columns from key sets), and the rollups and lookups that read it.
344
- */
345
- export declare function deleteTable(design: Design, name: string): Design;
346
- /** Renames an app table and the references to it. */
347
- export declare function renameTable(design: Design, from: string, to: string): Design;
348
- export type TablePatch = { readonly [K in "scope" | "timestamps" | "id" | "unique" | "indexes" | "comment" | "subject" | "events"]?: AppTable[K] | undefined; };
349
- /** Updates an app table's options; a key set to `undefined` is removed. */
350
- export declare function updateTable(design: Design, name: string, patch: TablePatch): Design;
351
- /**
352
- * Sets an app table's id type and retypes the app table columns that reference
353
- * it, since a key has the type of the id it points at.
354
- */
355
- export declare function setTableId(design: Design, name: string, id: AppTableId): Design;
356
- /** Sets (adds or replaces) an app table column. */
357
- export declare function setColumn(design: Design, table: string, name: string, column: AppColumn): Design;
358
- /** Renames an app table column, keeping its place. */
359
- export declare function renameColumn(design: Design, table: string, from: string, to: string): Design;
360
- /** Replaces an app table with `edit` applied to it, such as `tableWithComputed`. */
361
- export declare function editTable(design: Design, table: string, edit: (current: AppTable) => AppTable): Design;
362
- export declare function deleteColumn(design: Design, table: string, name: string): Design;
363
- /**
364
- * Sets an extra column on a block table
365
- * (`blocks.<module>.options.extraColumns`).
366
- */
367
- export declare function setExtraColumn(design: Design, module: string, name: string, type: string): Design;
368
- export declare function deleteExtraColumn(design: Design, module: string, name: string): Design;
369
- /** A design with the name of the table an edit created. */
370
- export interface NamedDesign {
371
- readonly design: Design;
372
- readonly name: string;
373
- }
374
- /** Copies an app table under a free name, next to the original. */
375
- export declare function duplicateTable(design: Design, name: string, taken: ReadonlySet<string>): NamedDesign;
376
- /** Moves tables (table id to its new top-left corner). */
377
- export declare function moveTables(design: Design, moves: Readonly<Record<string, readonly [number, number]>>): Design;
378
- /**
379
- * The app table column behind a foreign key from `tableId`, when the canvas
380
- * added it, or `undefined` when a block or the preset owns the key.
381
- */
382
- export declare function userConnection(design: Design, tableId: string, column: string | null): {
383
- readonly table: string;
384
- readonly column: string;
385
- } | undefined;
386
- /** Drops every saved position, so the automatic layout places every table again. */
387
- export declare function tidy(design: Design): Design;
388
- /** A naive English singular for a table name: `organizations` to `organization`. */
389
- export declare function singular(name: string): string;
390
- export interface Connection {
391
- /** The app table the column goes on. */
392
- readonly source: string;
393
- /** The table id it references. */
394
- readonly target: string;
395
- }
396
- export type ConnectResult = {
397
- readonly ok: true;
398
- readonly design: Design;
399
- readonly column: string;
400
- } | {
401
- readonly ok: false;
402
- readonly error: string;
403
- };
404
- /**
405
- * Adds a foreign key column from an app table to `target`. Only app tables get
406
- * new columns. A self reference gets `parent_id`, and a second reference to the
407
- * same table gets a role name (`owner_id`, `<target>_2_id`) the user can
408
- * rename. A target without a single-column primary key, and the tenant table
409
- * the scope column already references, are refused with a message.
410
- */
411
- export declare function connect(design: Design, data: SchemaData, preset: Pick<Preset, "scope" | "tenantName" | "idType">, connection: Connection): ConnectResult;
412
- /**
413
- * Adds a key to `targetId` on the app table `name` in the design, which can be
414
- * a table the schema doesn't have yet: `<target>_id`, `parent_id` for a self
415
- * reference, or a free role name when that column is taken.
416
- */
417
- export declare function referenceFrom(design: Design, data: SchemaData, preset: Pick<Preset, "scope" | "tenantName" | "idType">, name: string, targetId: string): ConnectResult;
418
- /**
419
- * The schema with the design applied: app tables added, extra columns appended
420
- * to the block tables that accept them.
421
- */
422
- export declare function withDesign(data: SchemaData, design: Design, preset: Pick<Preset, "scope" | "tenantName" | "idType">): SchemaData;
423
- //#endregion
424
- //#region src/create/design-issues.d.ts
425
- /**
426
- * Why `checkDesign` rejects a design: a `DesignErrorCode` from parsing, or a
427
- * rule that needs the preset. The codes are stable; the messages may change.
428
- */
429
- export type DesignIssueCode = 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";
430
- export interface DesignIssue {
431
- readonly code: DesignIssueCode;
432
- /**
433
- * A JSON Pointer (RFC 6901) into the design, such as
434
- * `/appTables/tasks/columns/title`. `""` is the design itself, and the path
435
- * of an issue with the preset.
436
- */
437
- readonly path: string;
438
- /** The app table or block module the issue is on, or `design` or `preset`. */
439
- readonly table: string;
440
- readonly message: string;
441
- }
442
- /**
443
- * What would stop `upgrade` from writing the design: a table name a block
444
- * already uses, a reference to a table the preset no longer installs, a
445
- * set-null delete on a required column, a composite key on a column the table
446
- * doesn't have, and extra columns for a block that is gone or no longer takes
447
- * them.
448
- */
449
- export declare function designIssues(design: Design, data: SchemaData, preset: Pick<Preset, "scope" | "tenantName" | "idType">): readonly DesignIssue[];
450
- //#endregion
451
6
  //#region src/create/check.d.ts
452
7
  /** What `checkDesign` returns. */
453
8
  export type DesignCheck = {
@@ -467,7 +22,7 @@ export type DesignCheck = {
467
22
  * Each problem, with a stable `code` and a JSON Pointer `path` into the
468
23
  * design; `table` is `design` or `preset` for one outside a table.
469
24
  */
470
- readonly issues: readonly DesignIssue[];
25
+ readonly issues: readonly Issue[];
471
26
  };
472
27
  /**
473
28
  * Checks a design against a preset with every rule the canvas and `upgrade`
@@ -671,6 +226,16 @@ export declare function initialHistory<T>(value: T): History<T>;
671
226
  */
672
227
  export declare function undoHistory<T>(current: History<T>, action: HistoryAction<T>): History<T>;
673
228
  //#endregion
229
+ //#region src/create/design-issues.d.ts
230
+ /**
231
+ * What would stop `upgrade` from writing the design: a table name a block
232
+ * already uses, a reference to a table the preset no longer installs, a
233
+ * set-null delete on a required column, a composite key on a column the table
234
+ * doesn't have, and extra columns for a block that is gone or no longer takes
235
+ * them.
236
+ */
237
+ export declare function designIssues(design: Design, data: SchemaData, preset: Pick<Preset, "scope" | "tenantName" | "idType">): readonly Issue[];
238
+ //#endregion
674
239
  //#region src/create/preview-provider.d.ts
675
240
  /**
676
241
  * A stand-in for the app's authorization provider, so `/create` can render the
@@ -679,12 +244,68 @@ export declare function undoHistory<T>(current: History<T>, action: HistoryActio
679
244
  * output.
680
245
  */
681
246
  export declare function previewAccessProvider(preset: Preset): BlockSqlAccessProvider;
247
+ /**
248
+ * The tables the project already has, as the CLI reads them from the catalog,
249
+ * so the preview shows what a block does over them (ADR 0100).
250
+ */
251
+ export interface PreviewOptions {
252
+ /** `schema.table` to the file that creates it, or `database`. */
253
+ readonly ownTables?: Readonly<Record<string, string>>;
254
+ /** The columns of the tables in `ownTables`. */
255
+ readonly ownColumns?: Readonly<Record<string, readonly string[]>>;
256
+ }
682
257
  /**
683
258
  * The files `upgrade` writes for a config with only this preset and its
684
259
  * `/create` design (app tables and extra columns). With `access: "provider"`
685
260
  * the access functions come from `previewAccessProvider`.
686
261
  */
687
- export declare function previewFiles(input: PresetInput, design?: CreateDesign): readonly PresetMigrationFile[];
262
+ export declare function previewFiles(input: PresetInput, design?: CreateDesign, options?: PreviewOptions): readonly PresetMigrationFile[];
263
+ //#endregion
264
+ //#region src/create/project.d.ts
265
+ /**
266
+ * A project: the preset and design that say which blocks and app tables it has,
267
+ * and the files they render to over the tables it already owns (ADR 0100). The
268
+ * CLI, Create and the cloud read and check the same shape.
269
+ */
270
+ export interface Project {
271
+ readonly preset: Preset;
272
+ /** The design, with its empty parts dropped. */
273
+ readonly design: CreateDesign;
274
+ /** The files `upgrade` would write. */
275
+ readonly files: readonly PresetMigrationFile[];
276
+ /** The tables the files were rendered over, when the project had any. */
277
+ readonly ownTables?: PreviewOptions["ownTables"];
278
+ }
279
+ export type ProjectLoad = {
280
+ readonly ok: true;
281
+ readonly project: Project;
282
+ } | {
283
+ readonly ok: false;
284
+ readonly issues: readonly Issue[];
285
+ };
286
+ export interface LoadProjectOptions extends PreviewOptions {
287
+ /** The preset, when `input` is a design without one. */
288
+ readonly preset?: PresetInput;
289
+ }
290
+ /**
291
+ * Reads a project from a design object, a design code or a `/create` URL with
292
+ * `&design=`, with the preset inside the design or in `options.preset`. It
293
+ * never throws for a bad project: each problem is an `Issue`.
294
+ */
295
+ export declare function loadProject(input: unknown, options?: LoadProjectOptions): Promise<ProjectLoad>;
296
+ export interface CheckProjectOptions {
297
+ /**
298
+ * Applies the files in Postgres and returns what it rejects, such as
299
+ * `sqlIssues` from `better-supabase/create/lite`. Left out, no SQL runs.
300
+ */
301
+ readonly sql?: (files: readonly PresetMigrationFile[]) => Promise<readonly Issue[]>;
302
+ }
303
+ /**
304
+ * Every problem in a project, as one list of `Issue`: the design rules (names,
305
+ * references, keys, defaults), then the SQL Postgres rejects when `options.sql`
306
+ * runs it. An empty list means the project can be written.
307
+ */
308
+ export declare function checkProject(project: Project, options?: CheckProjectOptions): Promise<readonly Issue[]>;
688
309
  //#endregion
689
310
  //#region src/create/sample-rows.d.ts
690
311
  /** One sample row: column name to the text the grid shows, or `null`. */
@@ -748,4 +369,4 @@ export type MigrationPlan = {
748
369
  */
749
370
  export declare function migrationBetween(preset: PresetInput, base: CreateDesign, next: CreateDesign): MigrationPlan;
750
371
  //#endregion
751
- export { type AppColumnAccess, type AppColumnType, APP_ON_DELETE_ACTIONS as ON_DELETE_ACTIONS, type AppOnDeleteAction as OnDeleteAction, type PresetMigrationFile };
372
+ export { APP_MODULE, AppColumn, type AppColumnAccess, type AppColumnType, AppEvents, AppLookup, AppReference, AppRollup, AppScope, AppSubject, AppTable, AppTableId, ComputedRow, ConnectResult, Connection, Design, DraftRollup, EMPTY_DESIGN, type Issue, type IssueCode, type IssueSeverity, type IssueSource, NamedDesign, APP_ON_DELETE_ACTIONS as ON_DELETE_ACTIONS, type AppOnDeleteAction as OnDeleteAction, type PresetMigrationFile, ROLLUP_AGGREGATES, RollupAggregate, SchemaColumn, SchemaComputed, SchemaData, SchemaForeignKey, SchemaOptions, SchemaSoftRef, SchemaSource, SchemaTable, SchemaTarget, TablePatch, addTable, appTableId, columnError, computedColumnRenamed, computedRows, computedTableRenamed, connect, defaultError, deleteColumn, deleteExtraColumn, deleteTable, duplicateTable, editTable, eventsColumnsEdited, filterColumns, fittedRollup, freeTableName, identifierError, isAppTable, isEmptyDesign, isRollupAggregate, keyColumnsOf, lookupSources, moveTables, parseSchema, prunedComputed, readableColumns, referenceFrom, renameColumn, renameTable, rollupColumns, rollupSources, schemaRelations, setColumn, setExtraColumn, setTableId, singular, subjectColumns, subjectColumnsEdited, subjectTypeError, tableStatements, tableWithComputed, tableWithoutComputed, tenantColumnOf, tidy, updateTable, userConnection, withDesign };