better-supabase 0.19.0 → 0.21.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 (489) hide show
  1. package/dist/{adapter-CfuBICuG.js → adapter-DZJZTY6g.js} +2 -2
  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-B20M2SIi.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-BiOgjXn5.d.ts → api-Cj4W_pqT.d.ts} +1 -1
  14. package/dist/{app-tables-Q29TR4W9.d.ts → app-tables-C5HjXs2k.d.ts} +1 -1
  15. package/dist/astro/index.d.ts +3 -3
  16. package/dist/astro/index.js +2 -2
  17. package/dist/{attachments-BTIwCuwm.js → attachments-BXbLnNxm.js} +5 -5
  18. package/dist/{authorization-08F77H2w.d.ts → authorization-DhoA7dsD.d.ts} +22 -8
  19. package/dist/{automations-jIIaT9EJ.js → automations-BMuqwZZn.js} +5 -5
  20. package/dist/better-result/index.d.ts +2 -2
  21. package/dist/{bind-wkfp7hgx.d.ts → bind-CFsctoFJ.d.ts} +4 -4
  22. package/dist/{block-authors-D9hyCizs.js → block-authors-Bw3zdzgl.js} +1 -1
  23. package/dist/{block-env-D-zK3_Ta.d.ts → block-env-BrUNeuJ_.d.ts} +4 -4
  24. package/dist/{block-events-pBXPzwnW.js → block-events-IWAyafO3.js} +1 -1
  25. package/dist/{block-fields-DE_FgpOU.js → block-fields-BjXgX_5c.js} +4 -3
  26. package/dist/{block-helpers-DnCtsKtv.js → block-helpers-B0f0ZVb5.js} +169 -4
  27. package/dist/{block-hooks-DbIpkq7a.js → block-hooks-DKtz0HRh.js} +1 -1
  28. package/dist/{block-subjects-BRJO0IqO.js → block-subjects-DFSuFY1a.js} +1 -1
  29. package/dist/blocks/access-requests/index.d.ts +1 -1
  30. package/dist/blocks/access-requests/index.js +4 -5
  31. package/dist/blocks/activities/index.d.ts +1 -1
  32. package/dist/blocks/activities/index.js +4 -5
  33. package/dist/blocks/agents/index.d.ts +1 -1
  34. package/dist/blocks/agents/index.js +3 -4
  35. package/dist/blocks/ai-cache/index.d.ts +1 -1
  36. package/dist/blocks/ai-cache/index.js +2 -2
  37. package/dist/blocks/ai-chat/index.d.ts +4 -4
  38. package/dist/blocks/ai-chat/index.js +3 -4
  39. package/dist/blocks/ai-files/index.d.ts +1 -1
  40. package/dist/blocks/ai-files/index.js +2 -2
  41. package/dist/blocks/ai-keys/index.d.ts +1 -1
  42. package/dist/blocks/ai-keys/index.js +2 -3
  43. package/dist/blocks/ai-schedules/index.d.ts +2 -2
  44. package/dist/blocks/ai-schedules/index.js +5 -6
  45. package/dist/blocks/announcements/index.d.ts +4 -4
  46. package/dist/blocks/announcements/index.js +3 -4
  47. package/dist/blocks/api-keys/index.d.ts +2 -2
  48. package/dist/blocks/api-keys/index.js +4 -5
  49. package/dist/blocks/approvals/index.d.ts +1 -1
  50. package/dist/blocks/approvals/index.js +4 -5
  51. package/dist/blocks/assets/index.d.ts +1 -1
  52. package/dist/blocks/assets/index.js +3 -4
  53. package/dist/blocks/assignment/index.d.ts +1 -1
  54. package/dist/blocks/assignment/index.js +4 -5
  55. package/dist/blocks/attachments/index.d.ts +2 -2
  56. package/dist/blocks/attachments/index.js +4 -5
  57. package/dist/blocks/audit/index.d.ts +5 -5
  58. package/dist/blocks/audit/index.js +7 -8
  59. package/dist/blocks/automations/index.d.ts +3 -3
  60. package/dist/blocks/automations/index.js +5 -5
  61. package/dist/blocks/billable-time/index.d.ts +1 -1
  62. package/dist/blocks/billable-time/index.js +6 -7
  63. package/dist/blocks/billing/index.d.ts +3 -3
  64. package/dist/blocks/billing/index.js +5 -6
  65. package/dist/blocks/bookings/index.d.ts +3 -3
  66. package/dist/blocks/bookings/index.js +6 -6
  67. package/dist/blocks/bulk/index.d.ts +4 -3
  68. package/dist/blocks/bulk/index.js +4 -4
  69. package/dist/blocks/calendar/index.d.ts +2 -2
  70. package/dist/blocks/calendar/index.js +6 -6
  71. package/dist/blocks/catalog/index.d.ts +1 -1
  72. package/dist/blocks/catalog/index.js +5 -6
  73. package/dist/blocks/channels/index.d.ts +1 -1
  74. package/dist/blocks/channels/index.js +3 -4
  75. package/dist/blocks/collections/index.d.ts +1 -1
  76. package/dist/blocks/collections/index.js +3 -4
  77. package/dist/blocks/comments/index.d.ts +5 -5
  78. package/dist/blocks/comments/index.js +8 -9
  79. package/dist/blocks/compliance/index.d.ts +1 -1
  80. package/dist/blocks/compliance/index.js +5 -6
  81. package/dist/blocks/connectors/index.d.ts +1 -1
  82. package/dist/blocks/connectors/index.js +3 -4
  83. package/dist/blocks/contacts/index.d.ts +1 -1
  84. package/dist/blocks/contacts/index.js +4 -5
  85. package/dist/blocks/content/index.d.ts +1 -1
  86. package/dist/blocks/content/index.js +3 -4
  87. package/dist/blocks/contracts/index.d.ts +1 -1
  88. package/dist/blocks/contracts/index.js +8 -9
  89. package/dist/blocks/courses/index.d.ts +1 -1
  90. package/dist/blocks/courses/index.js +5 -6
  91. package/dist/blocks/created-by/index.d.ts +1 -1
  92. package/dist/blocks/custom-fields/index.d.ts +1 -1
  93. package/dist/blocks/custom-fields/index.js +2 -2
  94. package/dist/blocks/data-lifecycle/index.d.ts +1 -1
  95. package/dist/blocks/data-lifecycle/index.js +2 -3
  96. package/dist/blocks/deals/index.d.ts +1 -1
  97. package/dist/blocks/deals/index.js +9 -10
  98. package/dist/blocks/dispatch/index.d.ts +1 -1
  99. package/dist/blocks/dispatch/index.js +7 -8
  100. package/dist/blocks/documents/index.d.ts +1 -1
  101. package/dist/blocks/documents/index.js +2 -3
  102. package/dist/blocks/domains/index.d.ts +1 -1
  103. package/dist/blocks/domains/index.js +3 -4
  104. package/dist/blocks/donations/index.d.ts +1 -1
  105. package/dist/blocks/donations/index.js +7 -8
  106. package/dist/blocks/drive/index.d.ts +5 -1
  107. package/dist/blocks/drive/index.js +6 -7
  108. package/dist/blocks/employees/index.d.ts +2 -2
  109. package/dist/blocks/employees/index.js +7 -8
  110. package/dist/blocks/enrichment/index.d.ts +1 -1
  111. package/dist/blocks/enrichment/index.js +2 -3
  112. package/dist/blocks/enrollments/index.d.ts +1 -1
  113. package/dist/blocks/enrollments/index.js +3 -4
  114. package/dist/blocks/entitlements/index.d.ts +3 -3
  115. package/dist/blocks/entitlements/index.js +2 -2
  116. package/dist/blocks/expenses/index.d.ts +1 -1
  117. package/dist/blocks/expenses/index.js +6 -7
  118. package/dist/blocks/field-history/index.d.ts +1 -1
  119. package/dist/blocks/field-history/index.js +2 -3
  120. package/dist/blocks/flags/index.d.ts +1 -1
  121. package/dist/blocks/flags/index.js +4 -5
  122. package/dist/blocks/forecasts/index.d.ts +1 -1
  123. package/dist/blocks/forecasts/index.js +5 -6
  124. package/dist/blocks/forms/index.d.ts +2 -2
  125. package/dist/blocks/forms/index.js +3 -4
  126. package/dist/blocks/goals/index.d.ts +1 -1
  127. package/dist/blocks/goals/index.js +4 -5
  128. package/dist/blocks/guests/index.d.ts +1 -1
  129. package/dist/blocks/guests/index.js +4 -5
  130. package/dist/blocks/hiring/index.d.ts +1 -1
  131. package/dist/blocks/hiring/index.js +4 -5
  132. package/dist/blocks/identities/index.d.ts +1 -1
  133. package/dist/blocks/identities/index.js +2 -3
  134. package/dist/blocks/imports/index.d.ts +1 -1
  135. package/dist/blocks/imports/index.js +2 -2
  136. package/dist/blocks/inbox/index.d.ts +5 -5
  137. package/dist/blocks/inbox/index.js +3 -4
  138. package/dist/blocks/incidents/index.d.ts +1 -1
  139. package/dist/blocks/incidents/index.js +5 -6
  140. package/dist/blocks/index.d.ts +2 -2
  141. package/dist/blocks/index.js +6 -6
  142. package/dist/blocks/inventory/index.d.ts +1 -1
  143. package/dist/blocks/inventory/index.js +3 -4
  144. package/dist/blocks/invoices/index.d.ts +1 -1
  145. package/dist/blocks/invoices/index.js +6 -7
  146. package/dist/blocks/knowledge/index.d.ts +1 -1
  147. package/dist/blocks/knowledge/index.js +2 -2
  148. package/dist/blocks/lead-scoring/index.d.ts +1 -1
  149. package/dist/blocks/lead-scoring/index.js +4 -5
  150. package/dist/blocks/leases/index.d.ts +1 -1
  151. package/dist/blocks/leases/index.js +7 -8
  152. package/dist/blocks/leave/index.d.ts +1 -1
  153. package/dist/blocks/leave/index.js +4 -5
  154. package/dist/blocks/ledger/index.d.ts +1 -1
  155. package/dist/blocks/ledger/index.js +3 -4
  156. package/dist/blocks/mail-sync/index.d.ts +1 -1
  157. package/dist/blocks/mail-sync/index.js +4 -5
  158. package/dist/blocks/memberships/index.d.ts +1 -1
  159. package/dist/blocks/memory/index.d.ts +1 -1
  160. package/dist/blocks/memory/index.js +3 -4
  161. package/dist/blocks/messaging/index.d.ts +5 -5
  162. package/dist/blocks/messaging/index.js +5 -6
  163. package/dist/blocks/metrics/index.d.ts +1 -1
  164. package/dist/blocks/metrics/index.js +4 -5
  165. package/dist/blocks/mfa/index.d.ts +2 -2
  166. package/dist/blocks/moderation/index.d.ts +1 -1
  167. package/dist/blocks/moderation/index.js +3 -4
  168. package/dist/blocks/notifications/index.d.ts +4 -4
  169. package/dist/blocks/notifications/index.js +7 -8
  170. package/dist/blocks/numbering/index.d.ts +1 -1
  171. package/dist/blocks/numbering/index.js +2 -2
  172. package/dist/blocks/oauth-server/index.d.ts +1 -1
  173. package/dist/blocks/oauth-server/index.js +3 -4
  174. package/dist/blocks/onboarding/index.d.ts +2 -2
  175. package/dist/blocks/onboarding/index.js +2 -3
  176. package/dist/blocks/orders/index.d.ts +9 -2
  177. package/dist/blocks/orders/index.js +7 -8
  178. package/dist/blocks/organizations/index.d.ts +3 -3
  179. package/dist/blocks/organizations/index.js +5 -6
  180. package/dist/blocks/outbox/index.d.ts +1 -1
  181. package/dist/blocks/outbox/index.js +3 -4
  182. package/dist/blocks/passes/index.d.ts +2 -2
  183. package/dist/blocks/passes/index.js +7 -8
  184. package/dist/blocks/permissions/index.d.ts +3 -3
  185. package/dist/blocks/permissions/index.js +2 -3
  186. package/dist/blocks/pipelines/index.d.ts +1 -1
  187. package/dist/blocks/pipelines/index.js +4 -5
  188. package/dist/blocks/posts/index.d.ts +1 -1
  189. package/dist/blocks/posts/index.js +4 -5
  190. package/dist/blocks/profiles/index.d.ts +1 -1
  191. package/dist/blocks/profiles/index.js +3 -4
  192. package/dist/blocks/promotions/index.d.ts +1 -1
  193. package/dist/blocks/promotions/index.js +4 -5
  194. package/dist/blocks/push/index.d.ts +2 -2
  195. package/dist/blocks/push/index.js +4 -5
  196. package/dist/blocks/queue/index.d.ts +1 -1
  197. package/dist/blocks/queue/index.js +7 -8
  198. package/dist/blocks/quotes/index.d.ts +1 -1
  199. package/dist/blocks/quotes/index.js +6 -7
  200. package/dist/blocks/rank/index.d.ts +1 -1
  201. package/dist/blocks/rank/index.js +2 -2
  202. package/dist/blocks/reactions/index.d.ts +4 -4
  203. package/dist/blocks/reactions/index.js +3 -4
  204. package/dist/blocks/relations/index.d.ts +3 -2
  205. package/dist/blocks/relations/index.js +8 -8
  206. package/dist/blocks/reminders/index.d.ts +10 -6
  207. package/dist/blocks/reminders/index.js +13 -12
  208. package/dist/blocks/reviews/index.d.ts +1 -1
  209. package/dist/blocks/reviews/index.js +3 -4
  210. package/dist/blocks/saved-views/index.d.ts +3 -3
  211. package/dist/blocks/saved-views/index.js +3 -3
  212. package/dist/blocks/scores/index.d.ts +1 -1
  213. package/dist/blocks/scores/index.js +4 -4
  214. package/dist/blocks/search/index.d.ts +3 -3
  215. package/dist/blocks/search/index.js +2 -3
  216. package/dist/blocks/security-events/index.d.ts +1 -1
  217. package/dist/blocks/security-events/index.js +2 -3
  218. package/dist/blocks/segments/index.d.ts +1 -1
  219. package/dist/blocks/segments/index.js +4 -5
  220. package/dist/blocks/sequences/index.d.ts +1 -1
  221. package/dist/blocks/sequences/index.js +3 -4
  222. package/dist/blocks/service-accounts/index.d.ts +1 -1
  223. package/dist/blocks/service-accounts/index.js +3 -4
  224. package/dist/blocks/sessions/index.d.ts +2 -2
  225. package/dist/blocks/sessions/index.js +1 -1
  226. package/dist/blocks/settings/index.d.ts +2 -2
  227. package/dist/blocks/settings/index.js +2 -3
  228. package/dist/blocks/share-links/index.d.ts +1 -1
  229. package/dist/blocks/share-links/index.js +6 -6
  230. package/dist/blocks/shipments/index.d.ts +1 -1
  231. package/dist/blocks/shipments/index.js +9 -10
  232. package/dist/blocks/signatures/index.d.ts +1 -1
  233. package/dist/blocks/signatures/index.js +3 -4
  234. package/dist/blocks/signing-keys/index.d.ts +1 -1
  235. package/dist/blocks/signing-keys/index.js +2 -2
  236. package/dist/blocks/sla/index.d.ts +1 -1
  237. package/dist/blocks/sla/index.js +7 -8
  238. package/dist/blocks/sso/index.d.ts +1 -1
  239. package/dist/blocks/sso/index.js +2 -3
  240. package/dist/blocks/state-machine/index.d.ts +1 -1
  241. package/dist/blocks/state-machine/index.js +3 -3
  242. package/dist/blocks/subjects/index.d.ts +2 -2
  243. package/dist/blocks/subjects/index.js +3 -4
  244. package/dist/blocks/tags/index.d.ts +2 -2
  245. package/dist/blocks/tags/index.js +5 -5
  246. package/dist/blocks/tasks/index.d.ts +2 -2
  247. package/dist/blocks/tasks/index.js +7 -8
  248. package/dist/blocks/teams/index.d.ts +1 -1
  249. package/dist/blocks/teams/index.js +3 -3
  250. package/dist/blocks/templates/index.d.ts +3 -3
  251. package/dist/blocks/templates/index.js +3 -4
  252. package/dist/blocks/time-tracking/index.d.ts +8 -1
  253. package/dist/blocks/time-tracking/index.js +9 -10
  254. package/dist/blocks/timeline/index.d.ts +3 -3
  255. package/dist/blocks/timeline/index.js +4 -5
  256. package/dist/blocks/trash/index.d.ts +1 -1
  257. package/dist/blocks/trash/index.js +3 -4
  258. package/dist/blocks/undo/index.d.ts +2 -2
  259. package/dist/blocks/undo/index.js +2 -2
  260. package/dist/blocks/updated-at/index.d.ts +1 -1
  261. package/dist/blocks/usage/index.d.ts +2 -2
  262. package/dist/blocks/usage/index.js +2 -3
  263. package/dist/blocks/vercel-marketplace/index.d.ts +1 -1
  264. package/dist/blocks/vercel-marketplace/index.js +3 -4
  265. package/dist/blocks/versions/index.d.ts +1 -1
  266. package/dist/blocks/versions/index.js +6 -7
  267. package/dist/blocks/waitlist/index.d.ts +1 -1
  268. package/dist/blocks/waitlist/index.js +4 -5
  269. package/dist/blocks/webhooks/index.d.ts +3 -3
  270. package/dist/blocks/webhooks/index.js +11 -12
  271. package/dist/blocks/workflow-editor/index.d.ts +6 -6
  272. package/dist/blocks/workflow-editor/index.js +9 -10
  273. package/dist/blocks/workflows/index.d.ts +4 -4
  274. package/dist/blocks/workflows/index.js +4 -5
  275. package/dist/{bookings-Dox2rced.d.ts → bookings-BpCNphYp.d.ts} +1 -2
  276. package/dist/{build-D9lWi5bk.js → build-CM8PJqwW.js} +1 -1
  277. package/dist/{build-BFC8nFiL.js → build-DbIRFcHQ.js} +3 -65
  278. package/dist/chat-sdk/index.js +2 -3
  279. package/dist/cli/{add-Lr7uTZXQ.js → add-BTDPjVGC.js} +9 -9
  280. package/dist/cli/{add-D5HxanFm.js → add-C0w-mVTQ.js} +2 -2
  281. package/dist/cli/add-CspY9jKT.js +1 -0
  282. package/dist/cli/{backfill-Cl1zEel7.js → backfill-BDdBs6Ne.js} +1 -1
  283. package/dist/cli/bin.js +1 -1
  284. package/dist/cli/{blocks-CsPua74J.js → blocks-Bs-lA-U_.js} +1 -1
  285. package/dist/cli/{blocks-f0obMCxm.js → blocks-CQLME-HQ.js} +1 -1
  286. package/dist/cli/{cache-tvTW5J9K.js → cache-DDKao2Va.js} +1 -1
  287. package/dist/cli/{codemod-CVzRWS3j.js → codemod-Bjl998Do.js} +1 -1
  288. package/dist/cli/{content-mapper-C0LJDmVL.js → content-mapper-DgSTl-DL.js} +2 -2
  289. package/dist/cli/{doctor-q701Qif_.js → doctor-CMLWbt44.js} +57 -55
  290. package/dist/cli/{gen--vu_c2RF.js → gen-D3VX8WdV.js} +11 -11
  291. package/dist/cli/index.d.ts +1 -1
  292. package/dist/cli/index.js +6 -6
  293. package/dist/cli/{init-DGz5Hk9X.js → init-D6D6eWze.js} +5 -5
  294. package/dist/cli/{live-sBPXy0VE.js → live-C_xgTOfD.js} +2 -2
  295. package/dist/cli/{mcp-DY_YK_WV.js → mcp-B0Irjbes.js} +2 -2
  296. package/dist/cli/{metadata-CoPGFRMb.js → metadata-cLXra-XB.js} +3 -3
  297. package/dist/cli/{migration-safety-Cn7OLHJm.js → migration-safety-OUK-Afbb.js} +1 -1
  298. package/dist/cli/{migrations-CUIEmdnS.js → migrations-CHenMvl_.js} +1 -1
  299. package/dist/cli/{module-migration-bWK0xO2_.js → module-migration-6V7vXWUK.js} +2 -2
  300. package/dist/cli/{powersync-DAM5JAmz.js → powersync-D83yAFbl.js} +2 -2
  301. package/dist/cli/powersync-DwhCH0gs.js +1 -0
  302. package/dist/cli/{print-Dnbk8J2y.js → print-C0OmQyTu.js} +2 -2
  303. package/dist/cli/{remove-DAVVPbWw.js → remove-BWlOngNT.js} +5 -5
  304. package/dist/cli/{render-PJdiRcqF.js → render-9m70qveo.js} +22 -5
  305. package/dist/cli/{run-6F72J0AQ.js → run-He3M-ZRq.js} +21 -21
  306. package/dist/cli/{run-D7-FuY6e.js → run-gE4eAazR.js} +8 -8
  307. package/dist/cli/{shared-9O58FYPm.js → shared-Cx2WFVWq.js} +1 -1
  308. package/dist/cli/{snapshot-rTRe56PH.js → snapshot-CZb3uVKE.js} +2 -2
  309. package/dist/cli/{source-EHhEoKBD.js → source-CrYSCdPZ.js} +1 -1
  310. package/dist/cli/{spec-CR4Y9kn8.js → spec-Cn5RhuQc.js} +2 -2
  311. package/dist/cli/{spec-DqSbbTzD.js → spec-D4b9ePuQ.js} +1 -1
  312. package/dist/cli/{sql-layout-BijeFLWv.js → sql-layout-CLJ67h3L.js} +2 -2
  313. package/dist/cli/{sync-BAmWXRDR.js → sync-B8VGiaHk.js} +3 -3
  314. package/dist/cli/{upgrade-BKN6eSx-.js → upgrade-BvBWK3Fo.js} +4 -4
  315. package/dist/cli/{upgrade-oaUd22Il.js → upgrade-DMiYx1C8.js} +2 -2
  316. package/dist/cli/{version-BkEOr4WS.js → version-BVg2Z6yv.js} +1 -1
  317. package/dist/client/index.d.ts +5 -5
  318. package/dist/client/index.js +1 -1
  319. package/dist/client/native/index.d.ts +4 -4
  320. package/dist/client/native/index.js +1 -1
  321. package/dist/{codecs-BfmQSbM6.js → codecs-CSUFGrdP.js} +3 -3
  322. package/dist/commerce/index.js +3 -3
  323. package/dist/{composite-COQJBDmG.d.ts → composite-ChzHhSB0.d.ts} +3 -3
  324. package/dist/{composite-D24L5RIY.js → composite-Dw5ofSF_.js} +1 -1
  325. package/dist/config/index.d.ts +2 -2
  326. package/dist/config/index.js +2 -2
  327. package/dist/{config-D74JT0qL.js → config-BOt5T6Vs.js} +1 -1
  328. package/dist/{context-BI1PPPkw.d.ts → context-sgrUjA3U.d.ts} +4 -4
  329. package/dist/{controller-DhT57SGq.d.ts → controller-B6vWdKSa.d.ts} +1 -1
  330. package/dist/{controller-BNZKd6bJ.js → controller-qG-B1eDn.js} +1 -1
  331. package/dist/{conversion-DAV0hOJQ.d.ts → conversion-DBgMck5U.d.ts} +1 -1
  332. package/dist/create/index.d.ts +2 -2
  333. package/dist/create/index.js +2 -2
  334. package/dist/{create-blocks-B-9HVf7m.js → create-blocks-CUS28FfS.js} +27 -11
  335. package/dist/credentials/index.js +2 -3
  336. package/dist/{cron-CgHTKwYG.js → cron-DdT4ti8a.js} +1 -1
  337. package/dist/{cron-route-UU9i5i9J.js → cron-route-FjKgRvTY.js} +1 -1
  338. package/dist/{deal-forecast-DikouYGj.js → deal-forecast-CKBnRodz.js} +2 -2
  339. package/dist/{define-Dt9DRqV_.js → define-D-dLADd5.js} +17 -20
  340. package/dist/{define-B_pxEy7d.d.ts → define-Lf6rI2QN.d.ts} +16 -10
  341. package/dist/{define-block-D4hZSb2G.d.ts → define-block-DCAiOrNX.d.ts} +30 -8
  342. package/dist/edge/index.d.ts +5 -5
  343. package/dist/edge/index.js +3 -3
  344. package/dist/{entitlements-BhNzAcJR.d.ts → entitlements-BPaPd3MD.d.ts} +1 -1
  345. package/dist/{entitlements-DBir2qwB.js → entitlements-tGL6-69B.js} +2 -2
  346. package/dist/{entity-schema-BDv6w-OQ.js → entity-schema-B1YmMtP8.js} +1 -1
  347. package/dist/events/index.js +2 -2
  348. package/dist/{executor-3qcMhg6R.js → executor-C2Ne-Scm.js} +3 -2
  349. package/dist/{executor-Bi056Cnj.d.ts → executor-DNK401lZ.d.ts} +1 -1
  350. package/dist/{executor-D3gB-9si.js → executor-DqIci3Jb.js} +3 -3
  351. package/dist/{executor-BQ7dYw4E.js → executor-WolvKszH.js} +3 -3
  352. package/dist/{executor-D1UUQEGL.d.ts → executor-aFV7nEBs.d.ts} +2 -2
  353. package/dist/expo/index.d.ts +2 -2
  354. package/dist/expo/index.js +2 -2
  355. package/dist/{field-errors-D7mzrKjR.d.ts → field-errors-DBgDCITw.d.ts} +6 -6
  356. package/dist/{fields--5a88KJe.js → fields-BBm49w-E.js} +1 -1
  357. package/dist/{filter-evaluate-w1XOIUOL.js → filter-evaluate-lCToXzZI.js} +2 -2
  358. package/dist/{filter-query-DMoKo82_.js → filter-query-CQ6d5GnQ.js} +1 -1
  359. package/dist/{flags-ClOQY-p5.js → flags-DF_SCqp5.js} +1 -1
  360. package/dist/flags-sdk/index.js +2 -2
  361. package/dist/{framework-BghlRbea.d.ts → framework-DKA3fTHl.d.ts} +3 -3
  362. package/dist/{framework-CNhTg0th.js → framework-DXM1vNcV.js} +1 -1
  363. package/dist/hono/index.d.ts +4 -4
  364. package/dist/hono/index.js +2 -2
  365. package/dist/{index-DZ5VbYvy.d.ts → index-5JSxY1MG.d.ts} +1 -1
  366. package/dist/{index-Bc-EhTb-.d.ts → index-Bt7_mxn0.d.ts} +9 -5
  367. package/dist/{index-DsB7dy9R.d.ts → index-ByF22_C6.d.ts} +3 -3
  368. package/dist/{index-B8iW3y2w.d.ts → index-C4sjewrr.d.ts} +9 -9
  369. package/dist/{index-BJBwUM9l.d.ts → index-CdMZQCYR.d.ts} +3 -3
  370. package/dist/{index-BSXQlJt2.d.ts → index-ClvuSZEz.d.ts} +2 -2
  371. package/dist/index.d.ts +2 -2
  372. package/dist/index.js +8 -7
  373. package/dist/{json-schema-Ca6gYbEP.js → json-schema-DHJxiizN.js} +1 -1
  374. package/dist/{knowledge-CV6OSirC.js → knowledge-tCrrU99q.js} +2 -2
  375. package/dist/list/index.d.ts +1 -1
  376. package/dist/list/index.js +3 -3
  377. package/dist/{list-query-BKy2zBaT.js → list-query-BnpA2BDg.js} +1 -1
  378. package/dist/{list-query-BIZBVEoF.d.ts → list-query-XYfUZb0j.d.ts} +1 -1
  379. package/dist/mapper/bin.js +5 -5
  380. package/dist/mcp/index.d.ts +4 -4
  381. package/dist/mcp/index.js +2 -2
  382. package/dist/mcp/sdk/index.d.ts +2 -2
  383. package/dist/mcp/sdk/index.js +1 -1
  384. package/dist/{messages-D4XWuRTj.js → messages-ecPW_nOv.js} +1 -1
  385. package/dist/{model-messages-CKG0zwdF.js → model-messages-CkZSDDHP.js} +1 -1
  386. package/dist/{money-codec-uV5WbT60.js → money-codec-BJuS2zEW.js} +1 -1
  387. package/dist/next/index.d.ts +14 -14
  388. package/dist/next/index.js +6 -5
  389. package/dist/{operations-DbNAgo7E.d.ts → operations-DC3wU3Sy.d.ts} +1 -1
  390. package/dist/orpc/index.d.ts +4 -4
  391. package/dist/orpc/index.js +1 -1
  392. package/dist/otel/index.js +5 -5
  393. package/dist/{ports-Dwe0JqBI.d.ts → ports-BbBJVyS0.d.ts} +1 -1
  394. package/dist/{ports-CaVRXjxq.js → ports-DvpNseap.js} +1 -1
  395. package/dist/postgres/index.js +5 -4
  396. package/dist/{postgrest-executor-BFW4oWte.js → postgrest-executor-B_Uezhrm.js} +7 -3
  397. package/dist/powersync/index.d.ts +3 -3
  398. package/dist/powersync/index.js +1 -1
  399. package/dist/preset/index.d.ts +3 -3
  400. package/dist/{push-token-C0dwbMZF.d.ts → push-token-CPJfPFa2.d.ts} +1 -1
  401. package/dist/query/index.d.ts +1 -1
  402. package/dist/query/index.js +1 -1
  403. package/dist/{rate-limit-BPuUWz4U.js → rate-limit-fZ_d8gSE.js} +4 -5
  404. package/dist/react/index.d.ts +5 -5
  405. package/dist/react/index.js +1 -1
  406. package/dist/react/native/index.d.ts +1 -1
  407. package/dist/react/server.d.ts +6 -6
  408. package/dist/react/server.js +1 -1
  409. package/dist/{react-GgLZ66FU.js → react-_D_CeZMk.js} +3 -3
  410. package/dist/react-router/index.d.ts +3 -3
  411. package/dist/react-router/index.js +2 -2
  412. package/dist/{read-set-BnKnofIj.js → read-set-B1sDib5O.js} +1 -1
  413. package/dist/realtime/index.d.ts +3 -3
  414. package/dist/realtime/index.js +2 -2
  415. package/dist/{record-bindings-DkBJpC5A.js → record-bindings-Z51mGfhB.js} +1 -1
  416. package/dist/{record-form-eiqGbx9J.d.ts → record-form-BbZpwsEi.d.ts} +1 -1
  417. package/dist/records/index.d.ts +7 -7
  418. package/dist/records/index.js +3 -3
  419. package/dist/{resource-execute-CWfzJmUd.d.ts → resource-execute-CUG6xUuh.d.ts} +1 -1
  420. package/dist/{resource-types-BdGAUbKw.d.ts → resource-types-DjZ91WKA.d.ts} +1 -1
  421. package/dist/{resources-EeQWFMR8.d.ts → resources-6Ncdt9XT.d.ts} +1 -1
  422. package/dist/{rows-EGAbu7MG.js → rows-BdqXmiB-.js} +2 -2
  423. package/dist/{rows-Bh9QemqN.js → rows-jijHLVE_.js} +1 -1
  424. package/dist/{rrule-79K2c3Nr.js → rrule-C9Ot6ax8.js} +1 -1
  425. package/dist/{sales-lines-CP4Z_LyE.js → sales-lines-DO7oRu1o.js} +3 -3
  426. package/dist/{sales-shared-BKXXA5qV.js → sales-shared-BuTA8JK7.js} +2 -2
  427. package/dist/{schemas-BSTNfGsQ.js → schemas-CLOTvdsC.js} +1 -1
  428. package/dist/{scores-CsgM-dw7.js → scores-bY2Is0kx.js} +2 -2
  429. package/dist/server/index.d.ts +7 -7
  430. package/dist/server/index.js +5 -5
  431. package/dist/{server-types-rmq2QzsD.d.ts → server-types-BH6AjDBN.d.ts} +1 -1
  432. package/dist/{session-CpwxyojG.d.ts → session-Y5SSYO2C.d.ts} +1 -1
  433. package/dist/{shared-C47zAh2A.js → shared-BeHTi8Fu.js} +1 -1
  434. package/dist/{sign-in-BTaRWS-L.js → sign-in-1FJiXXyG.js} +5 -5
  435. package/dist/{signatures-CNcoq392.js → signatures-CX1b4WHa.js} +2 -2
  436. package/dist/{signers-BAEzvTJ0.d.ts → signers-BKgmVh6A.d.ts} +2 -2
  437. package/dist/{signing-keys-DqI-gB_C.js → signing-keys-CWtpMask.js} +3 -3
  438. package/dist/solid/index.d.ts +6 -6
  439. package/dist/solid-start/index.d.ts +3 -3
  440. package/dist/solid-start/index.js +2 -2
  441. package/dist/spec/index.d.ts +1 -1
  442. package/dist/spec/index.js +1 -1
  443. package/dist/{spec-DTWkHzYZ.js → spec-BMvCCNnd.js} +1 -1
  444. package/dist/sql/index.d.ts +4 -4
  445. package/dist/sql/index.js +1 -1
  446. package/dist/{sql-B0wb7XA5.js → sql-BjjgwJKg.js} +9668 -6251
  447. package/dist/{sql-BPbbPzRJ.js → sql-CYt7EhH0.js} +2 -2
  448. package/dist/sqlite/index.d.ts +1 -1
  449. package/dist/sqlite/index.js +1 -1
  450. package/dist/{sso-Co2TbnEy.js → sso-DdDpJQzw.js} +2 -2
  451. package/dist/ssr/index.d.ts +1 -1
  452. package/dist/storage/index.js +4 -9
  453. package/dist/storage-api-Dg78Wqsg.js +10 -0
  454. package/dist/streams/index.js +1 -2
  455. package/dist/{subject-readers-F1xvRY-d.js → subject-readers-CeeJJOQ4.js} +1 -1
  456. package/dist/svelte/index.d.ts +6 -6
  457. package/dist/sveltekit/index.d.ts +4 -4
  458. package/dist/sveltekit/index.js +2 -2
  459. package/dist/{table-schema-CD8cJz_M.js → table-schema-C80xItaV.js} +1 -1
  460. package/dist/{tags-CkO2erRP.d.ts → tags-Cjtcp5cN.d.ts} +1 -1
  461. package/dist/tanstack-db/index.d.ts +1 -1
  462. package/dist/tanstack-start/index.d.ts +3 -3
  463. package/dist/tanstack-start/index.js +2 -2
  464. package/dist/{temporal-DLZlWbOi.js → temporal-Dbo0fLzc.js} +12 -2
  465. package/dist/{temporal-required-Dy0GGD8E.js → temporal-required-DcLhnDhQ.js} +1 -1
  466. package/dist/{tenant-BXNF10H5.d.ts → tenant-BHvMFNXl.d.ts} +1 -1
  467. package/dist/testing/index.d.ts +9 -9
  468. package/dist/testing/index.js +8 -8
  469. package/dist/{timeline-CHtoY7NO.d.ts → timeline-CEzj9v1z.d.ts} +3 -3
  470. package/dist/{topic-BNkdk7qe.d.ts → topic-gTVjLGTk.d.ts} +2 -2
  471. package/dist/{types-DsRfiQ0v.d.ts → types-yj8VF4oY.d.ts} +5 -0
  472. package/dist/{undo-B3FQvuAd.js → undo-BbftL9-4.js} +2 -2
  473. package/dist/vercel-connect/index.js +1 -1
  474. package/dist/{verify-ZLFUdlqE.js → verify-7EucfCnv.js} +3 -3
  475. package/dist/{verify-CJxqZQdd.d.ts → verify-B0KLBb3j.d.ts} +1 -1
  476. package/dist/vue/index.d.ts +6 -6
  477. package/dist/{watch-topic-wl74gws-.d.ts → watch-topic-C6HhbnVz.d.ts} +1 -1
  478. package/dist/wire-ChYn1g21.js +91 -0
  479. package/dist/workflow-sdk/builder/index.d.ts +2 -2
  480. package/dist/workflow-sdk/builder/index.js +1 -1
  481. package/dist/workflow-sdk/world/index.js +1 -1
  482. package/dist/yjs/index.d.ts +1 -1
  483. package/dist/yjs/index.js +1 -1
  484. package/package.json +1 -1
  485. package/skills/better-supabase/references/ui-recipes.md +1 -1
  486. package/dist/block-transport-PNea4lfQ.js +0 -84
  487. package/dist/cli/add-Bcw12jts.js +0 -1
  488. package/dist/cli/powersync-CG3Bp6FD.js +0 -1
  489. package/dist/{topic-DXbA-jwr.js → topic-J9I3yu6f.js} +1 -1
@@ -3,7 +3,7 @@ import { A as flattenConfig, n as expandFlatPreset, r as expandPreset } from "./
3
3
  import { t as DEFAULT_CLAIMS } from "./claims-Bp9My7XP.js";
4
4
  import { o as tenantNames } from "./entity-naming-Dtyq5sKE.js";
5
5
  import { A as resolveBlock, E as PRESET_CATALOG, d as appTablesOf, f as withAppTableSubjects, j as tenantNameOf } from "./app-tables-DyswUg6J.js";
6
- import { C as variantsFor, S as variantTitle, _ as schemaName, a as extraSchemas, b as tableEntries, c as resultType, d as fieldSpec, f as fieldsFor, g as rowType, h as propertyKey, i as extraKinds, l as HEADER, m as parseImport, o as fieldMetaLines, p as optionalLine, s as objectType, u as fieldDocs, v as siblingPath, x as temporalGuardImport, y as tableDocs } from "./json-schema-Ca6gYbEP.js";
6
+ import { C as variantsFor, S as variantTitle, _ as schemaName, a as extraSchemas, b as tableEntries, c as resultType, d as fieldSpec, f as fieldsFor, g as rowType, h as propertyKey, i as extraKinds, l as HEADER, m as parseImport, o as fieldMetaLines, p as optionalLine, s as objectType, u as fieldDocs, v as siblingPath, x as temporalGuardImport, y as tableDocs } from "./json-schema-DHJxiizN.js";
7
7
  //#region src/config/authorization.ts
8
8
  /**
9
9
  * The error for a provider built for another API version, or `undefined` for
@@ -1,7 +1,7 @@
1
1
  /// <reference lib="esnext.temporal" />
2
2
  import { M as Casing, P as ClaimsMeta, T as AccessBucketPolicy, _t as BucketLifecycle, j as BucketPolicyName, ot as SchemaMeta } from "./types-DFdg_4yN.js";
3
- import { D as OwnTablePolicies, E as NamedInstance, I as TablesOf, L as BlockNameRegistry, O as ResolvedBlock, T as InstanceOn, _ as BlockName, a as AuthorizationProvider, d as AccessBlockConfig, g as BlockMode, h as BlockConfigOf, m as BlockConfig, n as AuthorizationMembership, p as AnyBlocksConfig, r as AuthorizationOperation, s as AuthorizationRoleSource, t as AuthorizationFunctions, v as BlockScope, w as InstanceKeys, x as DisabledRow, y as BlocksConfig } from "./authorization-08F77H2w.js";
4
- import { Mn as EntityNames, Nn as EntityNoun, Pn as EntityRename, R as PortName, Ut as ActionDescriptor, Xt as BlockSchedule, Zt as DefaultAutomation, _ as BlockProvider, g as BlockEnvKey, i as BlockCategory, y as BlockWorker } from "./define-block-D4hZSb2G.js";
3
+ import { D as OwnTablePolicies, E as NamedInstance, I as TablesOf, L as BlockNameRegistry, O as ResolvedBlock, T as InstanceOn, _ as BlockName, a as AuthorizationProvider, d as AccessBlockConfig, g as BlockMode, h as BlockConfigOf, m as BlockConfig, n as AuthorizationMembership, p as AnyBlocksConfig, r as AuthorizationOperation, s as AuthorizationRoleSource, t as AuthorizationFunctions, v as BlockScope, w as InstanceKeys, x as DisabledRow, y as BlocksConfig } from "./authorization-DhoA7dsD.js";
4
+ import { Mn as EntityNames, Nn as EntityNoun, Pn as EntityRename, R as PortName, Ut as ActionDescriptor, Xt as BlockSchedule, Zt as DefaultAutomation, _ as BlockProvider, g as BlockEnvKey, i as BlockCategory, y as BlockWorker } from "./define-block-DCAiOrNX.js";
5
5
  import { a as ScalarKind, i as FieldSpec } from "./table-schema-BlF6k62Q.js";
6
6
  import { n as SubjectsConfig } from "./subjects-DvmQeF_F.js";
7
7
  import { i as FIELD_FORMAT_NAMES, s as FieldFormatName } from "./field-formats-CAFNkKSN.js";
@@ -490,8 +490,8 @@ interface PipelineContribution {
490
490
  readonly type: string;
491
491
  /** The qualified table its records live in. */
492
492
  readonly table: string;
493
- /** Its tenant column, unquoted; `tenant_id` when left out. */
494
- readonly tenant?: string;
493
+ /** Its tenant column, unquoted, as the block names it. */
494
+ readonly tenant: string;
495
495
  /** The binding; an app's own `on` entry is merged over it. */
496
496
  readonly entry: Readonly<Record<string, unknown>>;
497
497
  }
@@ -1,4 +1,4 @@
1
- import { a as ClientAuth } from "./bind-wkfp7hgx.js";
1
+ import { a as ClientAuth } from "./bind-CFsctoFJ.js";
2
2
  //#region src/blocks/controller.d.ts
3
3
  /**
4
4
  * A block's client state, framework-agnostic. `subscribe` and `getSnapshot`
@@ -1,5 +1,5 @@
1
1
  import { n as whileSignedIn, t as defineController } from "./controller-BEliOBOv.js";
2
- import { r as recordEventMatches } from "./record-bindings-DkBJpC5A.js";
2
+ import { r as recordEventMatches } from "./record-bindings-Z51mGfhB.js";
3
3
  import { f as findBinding, p as loadBindings } from "./record-type-DRbnlj5q.js";
4
4
  //#region src/records/controller.ts
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { f as Result } from "./result-DZeA5KS6.js";
2
- import { Bt as Action, Ht as ActionContext, Vt as ActionCall } from "./define-block-D4hZSb2G.js";
2
+ import { Bt as Action, Ht as ActionContext, Vt as ActionCall } from "./define-block-DCAiOrNX.js";
3
3
  import { StandardSchemaV1 } from "@standard-schema/spec";
4
4
  //#region src/blocks/automations/conversion.d.ts
5
5
  /** A record a conversion reads from or creates: its subject type and id. */
@@ -1,6 +1,6 @@
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-BI1PPPkw.js";
3
- import { a as DesignChange, p as DesignErrorCode, u as CreateDesign } from "../index-DZ5VbYvy.js";
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-sgrUjA3U.js";
3
+ import { a as DesignChange, p as DesignErrorCode, u as CreateDesign } from "../index-5JSxY1MG.js";
4
4
  import { a as SupabaseLint, o as SupabaseOrganization, s as SupabaseProject } from "../management-wtecfrNf.js";
5
5
  import { t as PresetMigrationFile } from "../types-DGHfTW8_.js";
6
6
  //#region src/create/design-computed.d.ts
@@ -1,8 +1,8 @@
1
1
  import { a as presetOf, d as resolvePreset } from "../config-CD2OGfCG.js";
2
2
  import { C as APP_ON_DELETE_ACTIONS, E as PRESET_CATALOG, a as appIdentifierError, m as isAppDefault, o as appNameLengthError, p as appDefaultError, s as appReservedColumns } from "../app-tables-DyswUg6J.js";
3
- import { c as resolveConfig } from "../config-D74JT0qL.js";
3
+ import { c as resolveConfig } from "../config-BOt5T6Vs.js";
4
4
  import { _ as jsonPointer, a as DesignParseError, h as encodeDesign, n as diffDesigns, o as DesignTooLongError, p as designOf, u as designConfig, v as parseDesign } from "../preset-B3CukUhu.js";
5
- import { R as SQL_MODULES, _ as renderBlocks, i as moduleLayout } from "../sql-B0wb7XA5.js";
5
+ import { R as SQL_MODULES, _ as renderBlocks, i as moduleLayout } from "../sql-BjjgwJKg.js";
6
6
  //#region src/create/column-keys.ts
7
7
  /** The most options a select takes, and the longest option. */
8
8
  const MAX_OPTIONS = 100;
@@ -1,8 +1,10 @@
1
+ import { n as dbError } from "./errors-BVFgt8BZ.js";
1
2
  import { n as isRecord } from "./guards-6F2bCtQR.js";
2
- import { t as dbTransport } from "./block-transport-PNea4lfQ.js";
3
+ import { t as AsyncResult } from "./result-ntFBW2p2.js";
3
4
  import { i as entityNames, o as tenantNames, r as composeNames } from "./entity-naming-Dtyq5sKE.js";
4
5
  import { t as onBlockEvent } from "./block-event-listener-Bu6G0TFH.js";
5
- import { i as wrapTransport, r as withBlockHooks, t as defineTransportMiddleware } from "./block-hooks-DbIpkq7a.js";
6
+ import { V as dbTransport, o as blockCall } from "./block-helpers-B0f0ZVb5.js";
7
+ import { i as wrapTransport, r as withBlockHooks, t as defineTransportMiddleware } from "./block-hooks-DKtz0HRh.js";
6
8
  import { i as forwardBlockEvents } from "./cloud-event-XsM53POL.js";
7
9
  //#region src/core/block-names.ts
8
10
  const TENANT_COLUMNS = ["organization_id", "active_organization_id"];
@@ -52,10 +54,14 @@ function blockNames(naming) {
52
54
  const renamed = names.rename(fn);
53
55
  return functions[fn] ?? functions[renamed] ?? renamed;
54
56
  };
55
- const columns = new Map(TENANT_COLUMNS.map((column) => [tenant.rename(column), column]));
56
57
  const { tenantColumn } = naming;
57
- const restore = (key) => key === tenantColumn ? "tenant_id" : columns.get(key) ?? entities.reverse(key);
58
- const restores = names.renamed || tenantColumn !== void 0;
58
+ const columns = new Map([
59
+ ...TENANT_COLUMNS.map((column) => [tenant.rename(column), column]),
60
+ ...tenantColumn === void 0 ? [] : [[tenantColumn, "tenant_id"]],
61
+ ...Object.entries(naming.columns ?? {})
62
+ ]);
63
+ const restores = names.renamed || tenantColumn !== void 0 || Object.keys(naming.columns ?? {}).length > 0;
64
+ const restore = (key) => columns.get(key) ?? entities.reverse(key);
59
65
  return defineTransportMiddleware({
60
66
  name: "block-names",
61
67
  call: async (request, next) => {
@@ -120,10 +126,8 @@ function defineBlocks(config, blocks, ...appEvents) {
120
126
  ...options,
121
127
  config
122
128
  }, blocks),
123
- call: (db, fn, args) => {
124
- if (api === void 0) return Promise.reject(/* @__PURE__ */ new TypeError("better-supabase: no block has an API schema (`sql.api`) to call"));
125
- return dbTransport(db).call(api, fn, args);
126
- },
129
+ api,
130
+ call: (db, fn, args) => api === void 0 ? AsyncResult.err(dbError("unsupported", "No block has an API schema (`sql.api`) to call")) : blockCall(dbTransport(db), api)(fn, args, (value) => value),
127
131
  client: (db, key, options = {}) => blockBuilder(clientContext(db, {
128
132
  config,
129
133
  ...options
@@ -189,8 +193,10 @@ function createBlocks(options, blocks) {
189
193
  /**
190
194
  * One block's client over a `Db`: its calls run through `dbTransport(db)` and
191
195
  * act in the `Db`'s tenant (`db.$context.tenant`) unless `options.tenant` names
192
- * one. Pass `config: blockConfig` so it calls the schema and function names
193
- * `gen` wrote; `BlockSet.client(db, key)` does that for you.
196
+ * one, and it uses `db.$storage` when the `Db` has Storage unless
197
+ * `options.storage` names another. Pass `config: blockConfig` so it calls the
198
+ * schema and function names `gen` wrote; `BlockSet.client(db, key)` does that
199
+ * for you.
194
200
  *
195
201
  * ```ts
196
202
  * const comments = createBlockClient(ctx.db, commentsBlock, {
@@ -208,13 +214,23 @@ function createBlockClient(db, block, options = {}) {
208
214
  }
209
215
  function clientContext(db, options) {
210
216
  const { hooks, instance: _instance, ...rest } = options;
217
+ const storage = rest.storage ?? storageOf(db);
211
218
  return {
212
219
  tenant: () => db.$context?.tenant,
213
220
  ...rest,
214
221
  transport: rest.transport ?? dbTransport(db),
222
+ ...storage === void 0 ? {} : { storage },
215
223
  ...hooks === void 0 ? {} : { hooks }
216
224
  };
217
225
  }
226
+ /** `db.$storage`, or `undefined` when the `Db` was connected without Storage. */
227
+ function storageOf(db) {
228
+ try {
229
+ return db.$storage;
230
+ } catch {
231
+ return;
232
+ }
233
+ }
218
234
  const UNIQUE_PORTS = [
219
235
  "notifier",
220
236
  "files",
@@ -1,11 +1,10 @@
1
1
  import { n as dbError } from "../errors-BVFgt8BZ.js";
2
2
  import { a as ok, r as err, t as AsyncResult } from "../result-ntFBW2p2.js";
3
- import { i as sqlTransport, r as rpcTransport, t as dbTransport } from "../block-transport-PNea4lfQ.js";
4
- import { o as blockCall } from "../block-helpers-DnCtsKtv.js";
3
+ import { U as rpcTransport, V as dbTransport, W as sqlTransport, o as blockCall } from "../block-helpers-B0f0ZVb5.js";
5
4
  import { a as tenantCredentialRef, i as subjectFor, n as credentialRefInTenant, r as foreignCredentialRef } from "../provider-B6g7rBZX.js";
6
5
  import { n as event, t as defineEvents } from "../event-map-CtPFhcOp.js";
7
6
  import { n as hmacHex, r as timingSafeEqual } from "../hmac-B3CTTlfv.js";
8
- import { o as verifySharedSecret, s as verifyWebhook } from "../signatures-CNcoq392.js";
7
+ import { o as verifySharedSecret, s as verifyWebhook } from "../signatures-CX1b4WHa.js";
9
8
  import { n as revokeIfConfigured, t as credentialRouter } from "../compose-DKW0Tr3e.js";
10
9
  //#region src/credentials/vault.ts
11
10
  const MAX_CACHED = 256;
@@ -1,4 +1,4 @@
1
- import { t as temporal } from "./temporal-required-Dy0GGD8E.js";
1
+ import { t as temporal } from "./temporal-required-DcLhnDhQ.js";
2
2
  //#region src/blocks/queue/cron.ts
3
3
  const MACROS = {
4
4
  "@yearly": "0 0 1 1 *",
@@ -1,6 +1,6 @@
1
1
  import { n as dbError } from "./errors-BVFgt8BZ.js";
2
2
  import { a as methodNotAllowed, o as problemResponse } from "./problem-Bf0cJ7tk.js";
3
- import { o as verifySharedSecret } from "./signatures-CNcoq392.js";
3
+ import { o as verifySharedSecret } from "./signatures-CX1b4WHa.js";
4
4
  //#region src/core/cron-route.ts
5
5
  /**
6
6
  * A `GET` or `POST` handler for a cron caller such as Vercel Cron. It throws
@@ -1,5 +1,5 @@
1
- import { C as optionalText, D as recordOf, I as textOf, k as recordsOf } from "./block-helpers-DnCtsKtv.js";
2
- import { i as moneyOf, o as optionalMoneyOf } from "./money-codec-uV5WbT60.js";
1
+ import { A as recordsOf, L as textOf, O as recordOf, w as optionalText } from "./block-helpers-B0f0ZVb5.js";
2
+ import { i as moneyOf, o as optionalMoneyOf } from "./money-codec-BJuS2zEW.js";
3
3
  //#region src/blocks/deal-forecast.ts
4
4
  function sums(row, currency, fn) {
5
5
  const at = (key) => moneyOf(row[key], currency, `${fn} ${key}`);
@@ -1,23 +1,24 @@
1
1
  import { r as isPlainObject, t as cloneValue } from "./clone-CkG0-hlI.js";
2
2
  import { t as DbException } from "./db-exception-Lngc1W49.js";
3
- import { c as mapDbError, n as dbError } from "./errors-BVFgt8BZ.js";
3
+ import { n as dbError } from "./errors-BVFgt8BZ.js";
4
4
  import { n as isRecord, t as isList } from "./guards-6F2bCtQR.js";
5
- import { c as optionalTemporal, l as provideTemporal, s as nowInstant, u as providedTemporal } from "./temporal-DLZlWbOi.js";
6
- import { a as decodeValue, i as decodeScalar, n as invalidRequest, o as encodeValue, t as builderFor } from "./build-BFC8nFiL.js";
5
+ import { c as optionalTemporal, l as provideTemporal, s as nowInstant, u as providedTemporal } from "./temporal-Dbo0fLzc.js";
6
+ import { n as invalidRequest, t as builderFor } from "./build-DbIRFcHQ.js";
7
7
  import { t as lookupOf } from "./lookup-BaP5bI27.js";
8
8
  import { i as or, n as column, r as not, t as and } from "./types-R6syp1el.js";
9
+ import { a as encodeArguments, n as decodeScalar, o as encodeValue, r as decodeValue } from "./wire-ChYn1g21.js";
10
+ import { t as isStorageApi } from "./storage-api-Dg78Wqsg.js";
9
11
  import { a as ok, c as withErrorMapper, r as err, s as toDbError, t as AsyncResult } from "./result-ntFBW2p2.js";
10
12
  import { t as invalidationTargets } from "./tables-Cb-3_VWc.js";
11
- import { n as rawError } from "./block-transport-PNea4lfQ.js";
12
13
  import { t as instanceProperty } from "./instance-property-hRh88y_s.js";
13
14
  import { t as vectorLiteral } from "./search-Cn_DGluL.js";
14
15
  import { t as consoleLogger } from "./logger-glM28NVN.js";
15
16
  import { n as errorEvent, t as EventHub } from "./events-D6IZ5CE8.js";
16
17
  import { i as orderPlugins } from "./plugin-AKwwe2gF.js";
17
18
  import { t as simplify } from "./simplify-DDO0j0LI.js";
18
- import { a as invalidTuning, i as deadline, n as postgrestExecutor, o as tuningOf, r as NO_TUNING } from "./postgrest-executor-BFW4oWte.js";
19
- import { n as isQuerySpec, r as specTables, t as createSpecs } from "./spec-DTWkHzYZ.js";
20
- import { n as checkParams, o as isReadSet, r as containsPlaceholder, t as bindParams } from "./read-set-BnKnofIj.js";
19
+ import { a as invalidTuning, i as deadline, n as postgrestExecutor, o as tuningOf, r as NO_TUNING } from "./postgrest-executor-B_Uezhrm.js";
20
+ import { n as isQuerySpec, r as specTables, t as createSpecs } from "./spec-BMvCCNnd.js";
21
+ import { n as checkParams, o as isReadSet, r as containsPlaceholder, t as bindParams } from "./read-set-B1sDib5O.js";
21
22
  import { a as toBase64Url, t as base64ToText } from "./base64-B9Wlsdj7.js";
22
23
  import { n as validate } from "./standard-BA3mLh6w.js";
23
24
  import { n as StatsRecorder, r as recordStats } from "./stats-BHl1-zj9.js";
@@ -180,23 +181,20 @@ function blocksPrototype(source, parent, tables, events, temporal) {
180
181
  enumerable: false
181
182
  });
182
183
  Object.defineProperty(prototype, "$api", {
183
- value(fn, args) {
184
- return source.call(this, fn, args);
184
+ value(fn, args = {}, options = {}) {
185
+ if (source.api === void 0) return AsyncResult.err(dbError("unsupported", "No block has an API schema (`sql.api`) for $api to call"));
186
+ return this.$rpc(fn, args, {
187
+ ...options,
188
+ schema: source.api
189
+ });
185
190
  },
186
191
  configurable: true,
187
192
  enumerable: false,
188
193
  writable: false
189
194
  });
190
195
  Object.defineProperty(prototype, "$apiResult", {
191
- value(fn, args) {
192
- return AsyncResult.from(async () => {
193
- try {
194
- return ok(await source.call(this, fn, args));
195
- } catch (cause) {
196
- const raw = rawError(cause);
197
- return err(raw === void 0 ? toDbError(cause) : mapDbError(raw));
198
- }
199
- });
196
+ value(fn, args = {}) {
197
+ return this.$api(fn, args);
200
198
  },
201
199
  configurable: true,
202
200
  enumerable: false,
@@ -1496,7 +1494,6 @@ function decodeRpcResult(meta, fn, data) {
1496
1494
  }
1497
1495
  //#endregion
1498
1496
  //#region src/core/define.ts
1499
- const isStorageApi = (value) => isRecord(value) && typeof value["from"] === "function";
1500
1497
  /**
1501
1498
  * A supabase-js client builds a new storage client on each read of `storage`,
1502
1499
  * so it is read once per connection.
@@ -2029,7 +2026,7 @@ function runSpec(db, spec, signal) {
2029
2026
  }
2030
2027
  function rpc(meta, executor, errorMappers, defaults, name, rest) {
2031
2028
  const [given, options] = rest;
2032
- const args = given === void 0 ? void 0 : Object.fromEntries(Object.entries(given).filter(([, value]) => value !== void 0));
2029
+ const args = given === void 0 ? void 0 : encodeArguments(given);
2033
2030
  return AsyncResult.from(async () => {
2034
2031
  if (!executor.rpc) return err(dbError("unsupported", `Executor "${executor.name}" does not support rpc()`));
2035
2032
  const tuning = {
@@ -877,15 +877,15 @@ interface DbBlockSource {
877
877
  /** The keys in `blocks.generated.ts` of the instances that have a client. */
878
878
  readonly instances: readonly string[];
879
879
  /**
880
- * One instance's client over `db`: its calls run through `db`'s executor and
881
- * act in `db.$context.tenant`.
880
+ * One instance's client over `db`: its calls run through `db`'s executor, act
881
+ * in `db.$context.tenant` and use `db.$storage` when `db` has Storage.
882
882
  */
883
883
  client(db: object, key: string, options: {
884
884
  readonly events: EventHub;
885
885
  readonly temporal?: typeof Temporal;
886
886
  }): unknown;
887
- /** Calls a function in the API schema that the blocks are wrapped in. */
888
- call(db: object, fn: string, args: Readonly<Record<string, unknown>>): Promise<unknown>;
887
+ /** The API schema the blocks are wrapped in (`sql.api`), which `$api` calls. */
888
+ readonly api?: string | undefined;
889
889
  /**
890
890
  * What one instance's client serves, for `defineApi`: its methods and the
891
891
  * input schemas of its entities. `undefined` when the client can't be built
@@ -949,12 +949,18 @@ type BlocksHelper<K, T extends PropertyKey = never> = unknown extends K ? unknow
949
949
  readonly $blocks: K;
950
950
  /**
951
951
  * Calls `fn` in the API schema the blocks are wrapped in, as the `Db`'s
952
- * caller. Resolves to the function's result and rejects with the raw
953
- * database error.
954
- */
955
- $api(fn: string, args: Readonly<Record<string, unknown>>): Promise<unknown>;
956
- $apiResult(fn: string, args: Readonly<Record<string, unknown>>): AsyncResult<unknown>;
952
+ * caller, through `$rpc`: the error is a `DbError` in the result, and a
953
+ * `returns` schema validates the value and types it.
954
+ */
955
+ $api<R>(fn: string, args: Readonly<Record<string, unknown>> | undefined, options: ApiOptions & {
956
+ readonly returns: StandardSchemaV1<unknown, R>;
957
+ }): AsyncResult<R>;
958
+ $api(fn: string, args?: Readonly<Record<string, unknown>>, options?: ApiOptions): AsyncResult<unknown>;
959
+ /** @deprecated `$api` returns the same `Result`; call it instead. */
960
+ $apiResult(fn: string, args?: Readonly<Record<string, unknown>>): AsyncResult<unknown>;
957
961
  };
962
+ /** Options for `db.$api`: `$rpc`'s, without `schema`. */
963
+ type ApiOptions = Omit<RpcOptions<unknown>, "schema" | "returns"> | Omit<RawRpcOptions, "schema">;
958
964
  /**
959
965
  * The `Db` a definition connects in the browser: what `bsb.db` holds and what
960
966
  * the generated data hooks read (`DbOf<typeof betterSupabase>`).
@@ -1254,4 +1260,4 @@ declare class BetterSupabase<M extends AnyModels = AnyModels, D = unknown, F ext
1254
1260
  */
1255
1261
  declare function defineSupabase<M extends AnyModels, D, F extends AnyFunctions, E = unknown>(schema: Schema<M, D, F, string, E>, options?: SupabaseOptions): BetterSupabase<M, D, F, E>;
1256
1262
  //#endregion
1257
- export { SearchScore as $, MemoryCache as $t, OffsetRangeArgs as A, IncludeArg as At, RowFilter as B, Payload as Bt, GetKey as C, AggregateRow as Ct, NoArgName as D, CountArgs as Dt, ManyWriteArgs as E, CountArg as Et, PlainName as F, MeasureKey as Ft, UpsertManyArgs as G, SortDirection as Gt, RpcOptions as H, RelationMeasureArg as Ht, RawRpcOptions as I, MutableWhere as It, DbStats as J, WhereInput as Jt, WriteArgs as K, SortSpec as Kt, Repository as L, NumericMeasureArg as Lt, OverloadReturns as M, JsonPathOps as Mt, OverloadedName as N, ListArgs as Nt, OffsetPage as O, FieldFilter as Ot, PageOf as P, MeasureArg as Pt, SearchArgs as Q, CacheTarget as Qt, RepositoryOf as R, OrderByArg as Rt, FindExt as S, AggregateResult as St, ManyResult as T, ColumnOrderByArg as Tt, UpdateArgs as U, RequestArgs as Ut, RpcArgs as V, ReadArgs as Vt, UpsertArgs as W, SelectArg as Wt, StatsRecorder as X, BucketsHelper as Xt, EMPTY_STATS as Y, BucketRegistry as Yt, recordStats as Z, CacheAdapter as Zt, CursorPageArgs as _, isQuerySpec as _t, explainPostgrest as a, ReadSetParamTypes as at, DeleteArgs as b, AggregateOrderBy as bt, RpcDefinition as c, ReadSetResult as ct, BlocksHelper as d, readSetTables as dt, cacheTargetOf as en, InferReadSetParams as et, DbBlockSource as f, InferResult as ft, CursorPage as g, TableSpecs as gt, ConflictTarget as h, Specs as ht, PostgrestExecutorOptions as i, ReadSetParamType as it, OverloadArgs as j, IncludeArgs as jt, OffsetPageArgs as k, GetArgs as kt, SupabaseOptions as l, defineReadSet as lt, DbOf as m, ReadMethod as mt, defineSupabase as n, rowKey as nn, ReadSetAuth as nt, postgrestExecutor as o, ReadSetParamValue as ot, DbExtras as p, QuerySpec as pt, WriteManyArgs as q, WhereArg as qt, PostgrestClientLike as r, rpcCacheTargets as rn, ReadSetOptions as rt, ConnectOptions as s, ReadSetParams as st, BetterSupabase as t, memoryCache as tn, ReadSet as tt, BlockInstanceSurface as u, isReadSet as ut, Db as v, specTables as vt, ManyOutcome as w, ColumnOrderBy as wt, DeleteExt as x, AggregateOrderByArg as xt, DbHelpers as y, AggregateArgs as yt, Returned as z, OrderByInput as zt };
1263
+ export { SearchArgs as $, CacheTarget as $t, OffsetPageArgs as A, GetArgs as At, Returned as B, OrderByInput as Bt, FindExt as C, AggregateResult as Ct, ManyWriteArgs as D, CountArg as Dt, ManyResult as E, ColumnOrderByArg as Et, PageOf as F, MeasureArg as Ft, UpsertArgs as G, SelectArg as Gt, RpcArgs as H, ReadArgs as Ht, PlainName as I, MeasureKey as It, WriteManyArgs as J, WhereArg as Jt, UpsertManyArgs as K, SortDirection as Kt, RawRpcOptions as L, MutableWhere as Lt, OverloadArgs as M, IncludeArgs as Mt, OverloadReturns as N, JsonPathOps as Nt, NoArgName as O, CountArgs as Ot, OverloadedName as P, ListArgs as Pt, recordStats as Q, CacheAdapter as Qt, Repository as R, NumericMeasureArg as Rt, DeleteExt as S, AggregateOrderByArg as St, ManyOutcome as T, ColumnOrderBy as Tt, RpcOptions as U, RelationMeasureArg as Ut, RowFilter as V, Payload as Vt, UpdateArgs as W, RequestArgs as Wt, EMPTY_STATS as X, BucketRegistry as Xt, DbStats as Y, WhereInput as Yt, StatsRecorder as Z, BucketsHelper as Zt, CursorPage as _, TableSpecs as _t, explainPostgrest as a, ReadSetParamType as at, DbHelpers as b, AggregateArgs as bt, RpcDefinition as c, ReadSetParams as ct, BlockInstanceSurface as d, isReadSet as dt, MemoryCache as en, SearchScore as et, BlocksHelper as f, readSetTables as ft, ConflictTarget as g, Specs as gt, DbOf as h, ReadMethod as ht, PostgrestExecutorOptions as i, rpcCacheTargets as in, ReadSetOptions as it, OffsetRangeArgs as j, IncludeArg as jt, OffsetPage as k, FieldFilter as kt, SupabaseOptions as l, ReadSetResult as lt, DbExtras as m, QuerySpec as mt, defineSupabase as n, memoryCache as nn, ReadSet as nt, postgrestExecutor as o, ReadSetParamTypes as ot, DbBlockSource as p, InferResult as pt, WriteArgs as q, SortSpec as qt, PostgrestClientLike as r, rowKey as rn, ReadSetAuth as rt, ConnectOptions as s, ReadSetParamValue as st, BetterSupabase as t, cacheTargetOf as tn, InferReadSetParams as tt, ApiOptions as u, defineReadSet as ut, CursorPageArgs as v, isQuerySpec as vt, GetKey as w, AggregateRow as wt, DeleteArgs as x, AggregateOrderBy as xt, Db as y, specTables as yt, RepositoryOf as z, OrderByArg as zt };
@@ -13,8 +13,8 @@ import { f as AiFiles, y as UploadClaimStorage } from "./types-Dr9wZgNy.js";
13
13
  import { g as JobHandler } from "./types-Czq9Xtpa.js";
14
14
  import { t as BlockOptionsSchema } from "./options-BTmaRzx2.js";
15
15
  import { t as Author } from "./block-authors-DzXLUiIq.js";
16
- import { u as BlockInstanceSurface } from "./define-B_pxEy7d.js";
17
- import { A as TtlPreset, C as TransformOptions, l as ImageTransform } from "./bucket-vc-QRrva.js";
16
+ import { d as BlockInstanceSurface } from "./define-Lf6rI2QN.js";
17
+ import { A as TtlPreset, C as TransformOptions, j as StorageApi, l as ImageTransform } from "./bucket-vc-QRrva.js";
18
18
  import { i as FieldSpec, n as TableSchema, o as TableSchemaSpec } from "./table-schema-BlF6k62Q.js";
19
19
  import { i as EventSink } from "./cloud-event-CzZTJkXv.js";
20
20
  import { g as Workflows } from "./workflows-B0ZPAQu0.js";
@@ -68,6 +68,13 @@ interface BlockNaming {
68
68
  readonly functions?: Readonly<Record<string, string>>;
69
69
  /** The block's own entities the config renames, such as `work_item` to `task`. */
70
70
  readonly entities?: readonly EntityRename[];
71
+ /**
72
+ * The tenant columns `blocks.<name>.columns.<table>.tenant` renames: the
73
+ * column's name in the database to its default name, such as `org_id` to
74
+ * `tenant_id`, so the block's client reads rows by the default name.
75
+ */
76
+ readonly columns?: Readonly<Record<string, string>>;
77
+ /** `database.sql.tenantColumn`, read back as `tenant_id`. */
71
78
  readonly tenantColumn?: string;
72
79
  }
73
80
  /**
@@ -1261,6 +1268,12 @@ interface BlockContext extends BlockOptions {
1261
1268
  readonly credentials?: CredentialProvider;
1262
1269
  /** `betterSupabase.events`, for the block events of the blocks that emit them. */
1263
1270
  readonly events?: EventHub;
1271
+ /**
1272
+ * The caller's Storage, so the bucket policies apply: `db.$storage` for a
1273
+ * client built from a `Db` that has one. Attachments, ai-files, drive and
1274
+ * data-lifecycle read and write files through it.
1275
+ */
1276
+ readonly storage?: StorageApi;
1264
1277
  }
1265
1278
  interface CreateBlocksOptions extends Omit<BlockContext, "schema"> {
1266
1279
  /**
@@ -1290,11 +1303,14 @@ interface BlockClientSource extends DbTransportSource {
1290
1303
  readonly $context?: {
1291
1304
  readonly tenant?: string | undefined;
1292
1305
  };
1306
+ readonly $storage?: StorageApi;
1293
1307
  }
1294
1308
  /** Options for `createBlockClient` and `BlockSet.client`. */
1295
1309
  interface BlockClientOptions extends Omit<CreateBlocksOptions, "transport" | "audit" | "config"> {
1296
1310
  /** Default `dbTransport(db)`. */
1297
1311
  readonly transport?: BlockContext["transport"];
1312
+ /** Default `db.$storage`, when the `Db` has Storage. */
1313
+ readonly storage?: StorageApi;
1298
1314
  /** `blockConfig` from `blocks.generated.ts`; `BlockSet.client` passes it. */
1299
1315
  readonly config?: GeneratedBlocks;
1300
1316
  /**
@@ -1340,6 +1356,8 @@ interface BlockSet<B extends BlockMap, M extends EventMap> {
1340
1356
  readonly $clients?: BlockSetClientMap<B>;
1341
1357
  /** The generated config the blocks are built with. */
1342
1358
  readonly config: GeneratedBlocks;
1359
+ /** The API schema the blocks are wrapped in (`sql.api`), if any has one. */
1360
+ readonly api: string | undefined;
1343
1361
  /** Every block's events and the app's, typed. */
1344
1362
  readonly events: Events<M>;
1345
1363
  /**
@@ -1352,8 +1370,10 @@ interface BlockSet<B extends BlockMap, M extends EventMap> {
1352
1370
  /**
1353
1371
  * One block's client over a `Db`, built with the generated config: its calls
1354
1372
  * run through `dbTransport(db)` and act in the `Db`'s tenant
1355
- * (`db.$context.tenant`) unless `options.tenant` names one. The blocks it
1356
- * consumes ports from are built on demand.
1373
+ * (`db.$context.tenant`) unless `options.tenant` names one, and it reads
1374
+ * files through `db.$storage` when the `Db` has Storage unless
1375
+ * `options.storage` names another. The blocks it consumes ports from are
1376
+ * built on demand.
1357
1377
  *
1358
1378
  * ```ts
1359
1379
  * const comments = blockSet.client(ctx.db, "comments");
@@ -1365,9 +1385,9 @@ interface BlockSet<B extends BlockMap, M extends EventMap> {
1365
1385
  }): ClientOf<B[K]>;
1366
1386
  /**
1367
1387
  * Calls `fn` in the API schema the blocks are wrapped in (`sql.api`), as
1368
- * `db`'s caller. Rejects with the raw database error.
1388
+ * `db`'s caller. The error is a `DbError` in the result.
1369
1389
  */
1370
- call(db: BlockClientSource, fn: string, args: Readonly<Record<string, unknown>>): Promise<unknown>;
1390
+ call(db: BlockClientSource, fn: string, args: Readonly<Record<string, unknown>>): AsyncResult<unknown>;
1371
1391
  /**
1372
1392
  * One instance's methods and input schemas, for `defineApi`; `undefined` when
1373
1393
  * its client can't be built without a database.
@@ -1405,8 +1425,10 @@ declare function createBlocks<const B extends BlockMap>(options: CreateBlocksOpt
1405
1425
  /**
1406
1426
  * One block's client over a `Db`: its calls run through `dbTransport(db)` and
1407
1427
  * act in the `Db`'s tenant (`db.$context.tenant`) unless `options.tenant` names
1408
- * one. Pass `config: blockConfig` so it calls the schema and function names
1409
- * `gen` wrote; `BlockSet.client(db, key)` does that for you.
1428
+ * one, and it uses `db.$storage` when the `Db` has Storage unless
1429
+ * `options.storage` names another. Pass `config: blockConfig` so it calls the
1430
+ * schema and function names `gen` wrote; `BlockSet.client(db, key)` does that
1431
+ * for you.
1410
1432
  *
1411
1433
  * ```ts
1412
1434
  * const comments = createBlockClient(ctx.db, commentsBlock, {
@@ -2,17 +2,17 @@ import { f as Result } from "../result-DZeA5KS6.js";
2
2
  import { t as StandardSchemaV1 } from "../standard-DBV730sF.js";
3
3
  import { O as AnyFunctions, k as AnyModels } from "../types-DFdg_4yN.js";
4
4
  import { l as PermissionRef, t as AnyAuthorizer } from "../authorizer-B6X09otb.js";
5
- import { t as BetterSupabase } from "../define-B_pxEy7d.js";
6
- import { a as ServerContext, c as ServerOptions, n as BetterServer } from "../server-types-rmq2QzsD.js";
5
+ import { t as BetterSupabase } from "../define-Lf6rI2QN.js";
6
+ import { a as ServerContext, c as ServerOptions, n as BetterServer } from "../server-types-BH6AjDBN.js";
7
7
  import { t as AuthSession } from "../view-DyFdMCqg.js";
8
8
  import { i as MiddlewareOptions, r as GuardOptions } from "../respond-oZeJ342J.js";
9
9
  import { c as ResourceLoaderContext, s as BlockRequireOptions } from "../kit-CVgQCIBO.js";
10
10
  import { n as FunctionContract, t as DescribedFunction } from "../function-contract-DxFNOmsm.js";
11
11
  import { t as Validated } from "../shared-CRRfQAKG.js";
12
12
  import { n as SUPABASE_CORS_HEADERS, r as corsConfig, t as CorsOptions } from "../cors-kLq6VM06.js";
13
- import { i as ResourceContext, l as ResourceRouteOptions, o as ResourceHooks, r as ResourceAction, t as ActionArgs } from "../resource-types-BdGAUbKw.js";
14
- import { t as ResourceMap } from "../resources-EeQWFMR8.js";
15
- import { t as defineAction } from "../resource-execute-CWfzJmUd.js";
13
+ import { i as ResourceContext, l as ResourceRouteOptions, o as ResourceHooks, r as ResourceAction, t as ActionArgs } from "../resource-types-DjZ91WKA.js";
14
+ import { t as ResourceMap } from "../resources-6Ncdt9XT.js";
15
+ import { t as defineAction } from "../resource-execute-CUG6xUuh.js";
16
16
  import { AnyEntry, Contributions } from "@supabase/middleware";
17
17
  //#region src/bridges/edge.d.ts
18
18
  /** The platform context Workers pass as the third `fetch` argument. */
@@ -2,15 +2,15 @@ import { n as dbError } from "../errors-BVFgt8BZ.js";
2
2
  import { a as ok, r as err } from "../result-ntFBW2p2.js";
3
3
  import { n as validate } from "../standard-BA3mLh6w.js";
4
4
  import { o as problemResponse } from "../problem-Bf0cJ7tk.js";
5
- import { a as unexpectedResponse, c as extendServer, o as withFlush, s as createServer } from "../adapter-CfuBICuG.js";
5
+ import { a as unexpectedResponse, c as extendServer, o as withFlush, s as createServer } from "../adapter-DZJZTY6g.js";
6
6
  import { n as defaultExpose, o as respond, s as settle } from "../respond-3RKp6VgU.js";
7
- import { t as withBetterSupabase } from "../composite-D24L5RIY.js";
7
+ import { t as withBetterSupabase } from "../composite-Dw5ofSF_.js";
8
8
  import { i as defineAction } from "../resource-R3KToNze.js";
9
9
  import { i as requireCaller } from "../kit-DhlB-vv_.js";
10
10
  import { t as withExtra } from "../extra-CGQ2_q3S.js";
11
11
  import { n as resourceRouter } from "../resources-DqIwoQsP.js";
12
12
  import { n as corsConfig, t as SUPABASE_CORS_HEADERS } from "../cors-h_v7TPxl.js";
13
- import { t as EVERY_CALLER } from "../framework-CNhTg0th.js";
13
+ import { t as EVERY_CALLER } from "../framework-DXM1vNcV.js";
14
14
  import { t as FUNCTION_DESCRIPTOR } from "../function-contract-pEmsaUIf.js";
15
15
  import { bufferRequest, pipeline, seedContext } from "@supabase/middleware";
16
16
  import { withCors } from "@supabase/middleware/cors";
@@ -1,4 +1,4 @@
1
- import { t as AuthSnapshot } from "./bind-wkfp7hgx.js";
1
+ import { t as AuthSnapshot } from "./bind-CFsctoFJ.js";
2
2
  import { t as AuthSession } from "./view-DyFdMCqg.js";
3
3
  //#region src/auth/entitlements.d.ts
4
4
  /**
@@ -1,6 +1,6 @@
1
1
  import { t as AsyncResult } from "./result-ntFBW2p2.js";
2
- import { j as run, o as blockCall } from "./block-helpers-DnCtsKtv.js";
3
- import { r as withBlockHooks } from "./block-hooks-DbIpkq7a.js";
2
+ import { M as run, o as blockCall } from "./block-helpers-B0f0ZVb5.js";
3
+ import { r as withBlockHooks } from "./block-hooks-DKtz0HRh.js";
4
4
  //#region src/blocks/entitlements/entitlements.ts
5
5
  /** The Stripe event sent when a customer's active entitlements change. */
6
6
  const ENTITLEMENTS_UPDATED = "entitlements.active_entitlement_summary.updated";
@@ -1,4 +1,4 @@
1
- import { n as tableSchema } from "./table-schema-CD8cJz_M.js";
1
+ import { n as tableSchema } from "./table-schema-C80xItaV.js";
2
2
  //#region src/blocks/entity-schema.ts
3
3
  /** The keys of `EntitySchemas`. */
4
4
  const ENTITY_SCHEMA_KINDS = [
@@ -1,9 +1,9 @@
1
- import { s as nowInstant } from "../temporal-DLZlWbOi.js";
1
+ import { s as nowInstant } from "../temporal-Dbo0fLzc.js";
2
2
  import { t as onBlockEvent } from "../block-event-listener-Bu6G0TFH.js";
3
3
  import { i as forwardBlockEvents, n as blockCloudEvent, r as dataschemaOf } from "../cloud-event-XsM53POL.js";
4
4
  import { t as jsonReplacer } from "../json-DaByVJpw.js";
5
5
  import { n as event, r as mergeEvents, t as defineEvents } from "../event-map-CtPFhcOp.js";
6
- import { a as emitBlockEvent, i as blockEventAttributes, n as BLOCK_EVENT_RENAMES, t as BLOCK_ATTRIBUTES } from "../block-events-pBXPzwnW.js";
6
+ import { a as emitBlockEvent, i as blockEventAttributes, n as BLOCK_EVENT_RENAMES, t as BLOCK_ATTRIBUTES } from "../block-events-IWAyafO3.js";
7
7
  //#region src/events/index.ts
8
8
  const ROW_EVENT_TYPES = {
9
9
  insert: "dev.better-supabase.row.created",
@@ -1,7 +1,8 @@
1
1
  import { r as isPlainObject } from "./clone-CkG0-hlI.js";
2
2
  import { c as mapDbError, d as withMaxAffected, n as dbError } from "./errors-BVFgt8BZ.js";
3
+ import { i as encodeArgument } from "./wire-ChYn1g21.js";
3
4
  import { a as ok, r as err, s as toDbError } from "./result-ntFBW2p2.js";
4
- import { n as quoteIdent, t as compileSql } from "./sql-BPbbPzRJ.js";
5
+ import { n as quoteIdent, t as compileSql } from "./sql-CYt7EhH0.js";
5
6
  import { t as fromPgError } from "./pg-error-B5QLDcbG.js";
6
7
  //#region src/postgres/executor.ts
7
8
  /**
@@ -186,7 +187,7 @@ async function callFunction(client, name, args, context, cache) {
186
187
  }, context.errorMappers));
187
188
  const params = [];
188
189
  const named = Object.entries(args).filter(([key, value]) => value !== void 0 && !signature.outputOnly.has(key)).map(([key, value]) => {
189
- params.push(argValue(value, signature.json.has(key)));
190
+ params.push(argValue(encodeArgument(value), signature.json.has(key)));
190
191
  return `${quoteIdent(key)} => $${String(params.length)}`;
191
192
  });
192
193
  const call = `${quoteIdent(context.schema)}.${quoteIdent(name)}(${named.join(", ")})`;
@@ -1,4 +1,4 @@
1
- import { L as WorkflowGraph } from "./types-DsRfiQ0v.js";
1
+ import { L as WorkflowGraph } from "./types-yj8VF4oY.js";
2
2
  //#region src/blocks/workflow-editor/executor.d.ts
3
3
  /** The record a run belongs to. */
4
4
  interface GraphSubject {
@@ -1,6 +1,6 @@
1
- import { c as optionalTemporal } from "./temporal-DLZlWbOi.js";
2
- import { i as checkFilterQuery, t as FILTER_OPERATORS } from "./filter-query-DMoKo82_.js";
3
- import { t as evaluateFilterQuery } from "./filter-evaluate-w1XOIUOL.js";
1
+ import { c as optionalTemporal } from "./temporal-Dbo0fLzc.js";
2
+ import { i as checkFilterQuery, t as FILTER_OPERATORS } from "./filter-query-CQ6d5GnQ.js";
3
+ import { t as evaluateFilterQuery } from "./filter-evaluate-lCToXzZI.js";
4
4
  //#region src/blocks/workflow-editor/graph.ts
5
5
  /** Kept local: the static executor runs this file inside the workflow VM. */
6
6
  const isGraphRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
@@ -1,11 +1,11 @@
1
1
  import { t as DbException } from "./db-exception-Lngc1W49.js";
2
2
  import { c as mapDbError, n as dbError } from "./errors-BVFgt8BZ.js";
3
- import { n as invalidRequest } from "./build-BFC8nFiL.js";
3
+ import { n as invalidRequest } from "./build-DbIRFcHQ.js";
4
4
  import { t as lookupOf } from "./lookup-BaP5bI27.js";
5
5
  import { a as ok, r as err, s as toDbError } from "./result-ntFBW2p2.js";
6
6
  import { n as simplifyOrFalse } from "./simplify-DDO0j0LI.js";
7
- import { n as isQuerySpec } from "./spec-DTWkHzYZ.js";
8
- import { n as whereClause, t as integer } from "./shared-C47zAh2A.js";
7
+ import { n as isQuerySpec } from "./spec-BMvCCNnd.js";
8
+ import { n as whereClause, t as integer } from "./shared-BeHTi8Fu.js";
9
9
  //#region src/compile/sqlite.ts
10
10
  /**
11
11
  * The operation needs something the SQLite dialect can't express: full-text
@@ -1,7 +1,7 @@
1
1
  import { E as RawDbError, b as DbError, f as Result } from "./result-DZeA5KS6.js";
2
2
  import { Bt as Executor, O as AnyFunctions, dt as TableMeta, k as AnyModels, m as Operation, ut as TableKey } from "./types-DFdg_4yN.js";
3
- import { pt as QuerySpec, t as BetterSupabase } from "./define-B_pxEy7d.js";
4
- import { i as ListDefinition } from "./list-query-BIZBVEoF.js";
3
+ import { mt as QuerySpec, t as BetterSupabase } from "./define-Lf6rI2QN.js";
4
+ import { i as ListDefinition } from "./list-query-XYfUZb0j.js";
5
5
  import { t as Compiler } from "./compiler-D3UmE7ao.js";
6
6
  //#region src/compile/sqlite.d.ts
7
7
  /** A value SQLite binds: booleans become `0`/`1`, objects JSON text. */
@@ -1,6 +1,6 @@
1
1
  import { O as AnyFunctions, k as AnyModels } from "../types-DFdg_4yN.js";
2
- import { t as BetterSupabase } from "../define-B_pxEy7d.js";
3
- import { a as ServerContext, c as ServerOptions, n as BetterServer, r as ContextOptions } from "../server-types-rmq2QzsD.js";
2
+ import { t as BetterSupabase } from "../define-Lf6rI2QN.js";
3
+ import { a as ServerContext, c as ServerOptions, n as BetterServer, r as ContextOptions } from "../server-types-BH6AjDBN.js";
4
4
  import { i as MiddlewareOptions, r as GuardOptions } from "../respond-oZeJ342J.js";
5
5
  import { t as Validated } from "../shared-CRRfQAKG.js";
6
6
  import { AnyEntry, Contributions } from "@supabase/middleware";