better-supabase 0.60.0 → 0.61.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 (742) hide show
  1. package/api/naming.json +1994 -0
  2. package/dist/{account-parts-D-cLYi0Y.d.ts → account-parts-DtC5voD1.d.ts} +3 -3
  3. package/dist/{activities-BkfN6cef.d.ts → activities-BMQuBkrQ.d.ts} +8 -8
  4. package/dist/{adapter-base-BHtxRoRg.js → adapter-base-DGiRWzEo.js} +2 -2
  5. package/dist/{agents-FJk0CNex.d.ts → agents-3wTmHYZr.d.ts} +6 -6
  6. package/dist/{agents-B8kXBfH9.d.ts → agents-NaSREeo_.d.ts} +4 -4
  7. package/dist/{ai-cache-DfbYR_jG.d.ts → ai-cache-CKOJ9cLZ.d.ts} +4 -4
  8. package/dist/{ai-chat-DyffOt16.d.ts → ai-chat-C8FEgeTd.d.ts} +4 -4
  9. package/dist/{ai-guardrails-y6RVvDOH.d.ts → ai-guardrails-fzpJmgzI.d.ts} +3 -3
  10. package/dist/{ai-schedules-wlL3DKqu.d.ts → ai-schedules-CtxaSWA1.d.ts} +5 -5
  11. package/dist/ai-sdk/agents/index.d.ts +2 -2
  12. package/dist/ai-sdk/batches/index.d.ts +3 -3
  13. package/dist/ai-sdk/cache/index.d.ts +1 -1
  14. package/dist/ai-sdk/chat/index.d.ts +2 -2
  15. package/dist/ai-sdk/embeddings/index.d.ts +2 -2
  16. package/dist/ai-sdk/files/index.d.ts +1 -1
  17. package/dist/ai-sdk/index.d.ts +8 -8
  18. package/dist/ai-sdk/mcp/index.d.ts +3 -3
  19. package/dist/ai-sdk/memory/index.d.ts +3 -3
  20. package/dist/ai-sdk/workflow/index.d.ts +4 -4
  21. package/dist/ai-sdk/workflow/index.js +1 -1
  22. package/dist/{api-Clu-XitC.js → api-Q23GAwx1.js} +1 -1
  23. package/dist/{api-keys-BlfwKpXq.d.ts → api-keys-Bfk9mJgz.d.ts} +4 -4
  24. package/dist/{api-CSx2F4zg.d.ts → api-pGkHTqH6.d.ts} +5 -5
  25. package/dist/{app-tables-C_bRG0ek.d.ts → app-tables-BHoeMC9w.d.ts} +1 -1
  26. package/dist/{approvals-Dn_DM4Oi.d.ts → approvals-B1mzlyzk.d.ts} +6 -6
  27. package/dist/{assistant-53zK5w6Q.d.ts → assistant-BQAjAXDe.d.ts} +2 -2
  28. package/dist/astro/index.d.ts +6 -6
  29. package/dist/astro/index.js +4 -4
  30. package/dist/{auth-module-D_RA-X_y.js → auth-module-B19zCsb4.js} +1 -1
  31. package/dist/{authorization-Cn_oEGoA.d.ts → authorization-glyinWcf.d.ts} +9 -3
  32. package/dist/{authorization-hooks-DtuVzDBf.d.ts → authorization-hooks-Oe0WJTn2.d.ts} +2 -2
  33. package/dist/{authz-refresh-CNV_LFEh.js → authz-refresh-27sp45FG.js} +1 -1
  34. package/dist/{banking-reads-4m0_lltt.js → banking-reads-Baaatsuj.js} +1 -1
  35. package/dist/{base64-CEBz6-Jj.js → base64-DgNIlSAS.js} +1 -1
  36. package/dist/better-result/index.d.ts +3 -3
  37. package/dist/{bind-Dopmkg_T.d.ts → bind-B-NW7-Fd.d.ts} +8 -8
  38. package/dist/{block-controller-CHtFwmpj.d.ts → block-controller-Dy-Jyy8A.d.ts} +2 -2
  39. package/dist/{block-env-4tgXDIAX.d.ts → block-env-BN4cyqTj.d.ts} +4 -4
  40. package/dist/{block-event-listener-B1JTV_Ca.d.ts → block-event-listener-CQrt2JR-.d.ts} +1 -1
  41. package/dist/{block-events-records-x6GNmg6M.d.ts → block-events-records-CUCsDp0S.d.ts} +2 -2
  42. package/dist/{block-helpers-D0QSs8ss.d.ts → block-helpers-DDotKGAf.d.ts} +1 -1
  43. package/dist/{block-hooks-StmUvtuT.d.ts → block-hooks-b7-RUIxS.d.ts} +2 -2
  44. package/dist/{block-subjects-DzCWFD-t.d.ts → block-subjects-CG1x9djp.d.ts} +1 -1
  45. package/dist/{block-tables-KnVB7FH0.d.ts → block-tables-CkbJsNys.d.ts} +1 -1
  46. package/dist/{block-transport-BNMvuuyC.d.ts → block-transport-Bqne7_GN.d.ts} +2 -2
  47. package/dist/blocks/access-requests/index.d.ts +3 -3
  48. package/dist/blocks/accounting/index.d.ts +3 -3
  49. package/dist/blocks/acknowledgements/index.d.ts +2 -2
  50. package/dist/blocks/activities/index.d.ts +6 -6
  51. package/dist/blocks/activities/index.js +1 -1
  52. package/dist/blocks/advisories/index.d.ts +5 -5
  53. package/dist/blocks/agent-checkout/index.d.ts +7 -7
  54. package/dist/blocks/agent-checkout/index.js +2 -2
  55. package/dist/blocks/agents/index.d.ts +5 -5
  56. package/dist/blocks/ai-cache/index.d.ts +3 -3
  57. package/dist/blocks/ai-chat/index.d.ts +4 -4
  58. package/dist/blocks/ai-evals/index.d.ts +4 -4
  59. package/dist/blocks/ai-files/index.d.ts +3 -3
  60. package/dist/blocks/ai-guardrails/index.d.ts +4 -4
  61. package/dist/blocks/ai-keys/index.d.ts +4 -4
  62. package/dist/blocks/ai-schedules/index.d.ts +3 -3
  63. package/dist/blocks/announcements/index.d.ts +8 -8
  64. package/dist/blocks/api-keys/index.d.ts +3 -3
  65. package/dist/blocks/appraisals/index.d.ts +5 -5
  66. package/dist/blocks/approvals/index.d.ts +3 -3
  67. package/dist/blocks/assets/index.d.ts +4 -4
  68. package/dist/blocks/assignment/index.d.ts +3 -3
  69. package/dist/blocks/attachments/index.d.ts +10 -10
  70. package/dist/blocks/audit/index.d.ts +4 -4
  71. package/dist/blocks/audit/index.js +1 -1
  72. package/dist/blocks/automations/index.d.ts +12 -12
  73. package/dist/blocks/banking/index.d.ts +3 -3
  74. package/dist/blocks/banking/index.js +1 -1
  75. package/dist/blocks/billable-time/index.d.ts +3 -3
  76. package/dist/blocks/billing/index.d.ts +6 -6
  77. package/dist/blocks/billing/index.js +1 -1
  78. package/dist/blocks/bookings/index.d.ts +3 -3
  79. package/dist/blocks/bulk-actions/index.d.ts +5 -5
  80. package/dist/blocks/calendar/index.d.ts +3 -3
  81. package/dist/blocks/care/index.d.ts +30 -30
  82. package/dist/blocks/care/index.js +7 -7
  83. package/dist/blocks/care-plans/index.d.ts +6 -6
  84. package/dist/blocks/care-plans/index.js +2 -2
  85. package/dist/blocks/cases/index.d.ts +5 -5
  86. package/dist/blocks/catalog/index.d.ts +4 -4
  87. package/dist/blocks/channels/index.d.ts +7 -7
  88. package/dist/blocks/clinical-decision-support/index.d.ts +4 -4
  89. package/dist/blocks/cms/index.d.ts +7 -7
  90. package/dist/blocks/collaboration/index.d.ts +8 -8
  91. package/dist/blocks/collections/index.d.ts +15 -12
  92. package/dist/blocks/collections/index.js +1 -1
  93. package/dist/blocks/comments/index.d.ts +4 -4
  94. package/dist/blocks/commerce/index.d.ts +7 -7
  95. package/dist/blocks/commerce/index.js +1 -1
  96. package/dist/blocks/commissions/index.d.ts +5 -5
  97. package/dist/blocks/compliance/index.d.ts +5 -5
  98. package/dist/blocks/connectors/index.d.ts +4 -4
  99. package/dist/blocks/consents/index.d.ts +5 -5
  100. package/dist/blocks/contacts/index.d.ts +5 -5
  101. package/dist/blocks/contacts/index.js +1 -1
  102. package/dist/blocks/content/index.d.ts +4 -4
  103. package/dist/blocks/contracts/index.d.ts +6 -6
  104. package/dist/blocks/courses/index.d.ts +4 -4
  105. package/dist/blocks/courses/index.js +2 -2
  106. package/dist/blocks/created-by/index.d.ts +3 -3
  107. package/dist/blocks/crm/index.d.ts +18 -18
  108. package/dist/blocks/crm/index.js +4 -4
  109. package/dist/blocks/custom-fields/index.d.ts +2 -2
  110. package/dist/blocks/dam/index.d.ts +6 -6
  111. package/dist/blocks/data-lifecycle/index.d.ts +3 -3
  112. package/dist/blocks/deadlines/index.d.ts +5 -5
  113. package/dist/blocks/deals/index.d.ts +3 -3
  114. package/dist/blocks/dispatch/index.d.ts +4 -4
  115. package/dist/blocks/document-templates/index.d.ts +6 -6
  116. package/dist/blocks/documents/index.d.ts +4 -4
  117. package/dist/blocks/documents/index.js +1 -1
  118. package/dist/blocks/domains/index.d.ts +6 -6
  119. package/dist/blocks/donations/index.d.ts +6 -6
  120. package/dist/blocks/drive/index.d.ts +6 -6
  121. package/dist/blocks/drive/index.js +1 -1
  122. package/dist/blocks/e-prescribing/index.d.ts +4 -4
  123. package/dist/blocks/employees/index.d.ts +3 -3
  124. package/dist/blocks/enrichment/index.d.ts +3 -3
  125. package/dist/blocks/enrollments/index.d.ts +4 -4
  126. package/dist/blocks/entitlements/index.d.ts +4 -4
  127. package/dist/blocks/events/index.d.ts +5 -5
  128. package/dist/blocks/events/index.js +1 -1
  129. package/dist/blocks/expenses/index.d.ts +5 -5
  130. package/dist/blocks/field-history/index.d.ts +3 -3
  131. package/dist/blocks/filespace/index.d.ts +9 -9
  132. package/dist/blocks/filespace/index.js +1 -1
  133. package/dist/blocks/finance/index.d.ts +6 -6
  134. package/dist/blocks/finance/index.js +2 -2
  135. package/dist/blocks/flags/index.d.ts +5 -5
  136. package/dist/blocks/forecasts/index.d.ts +3 -3
  137. package/dist/blocks/forms/index.d.ts +4 -4
  138. package/dist/blocks/funding/index.d.ts +5 -5
  139. package/dist/blocks/funding/index.js +1 -1
  140. package/dist/blocks/goals/index.d.ts +3 -3
  141. package/dist/blocks/governance/index.d.ts +5 -5
  142. package/dist/blocks/guests/index.d.ts +3 -3
  143. package/dist/blocks/hiring/index.d.ts +3 -3
  144. package/dist/blocks/hiring/index.js +1 -1
  145. package/dist/blocks/identities/index.d.ts +5 -5
  146. package/dist/blocks/imports/index.d.ts +6 -6
  147. package/dist/blocks/inbox/index.d.ts +10 -10
  148. package/dist/blocks/incidents/index.d.ts +5 -5
  149. package/dist/blocks/index.d.ts +12 -12
  150. package/dist/blocks/inspections/index.d.ts +6 -6
  151. package/dist/blocks/inventory/index.d.ts +3 -3
  152. package/dist/blocks/invoices/index.d.ts +6 -6
  153. package/dist/blocks/knowledge/index.d.ts +3 -3
  154. package/dist/blocks/lead-scoring/index.d.ts +4 -4
  155. package/dist/blocks/learning/index.d.ts +5 -5
  156. package/dist/blocks/leases/index.d.ts +6 -6
  157. package/dist/blocks/leave/index.d.ts +3 -3
  158. package/dist/blocks/ledger/index.d.ts +6 -6
  159. package/dist/blocks/legal-entities/index.d.ts +6 -6
  160. package/dist/blocks/lims/index.d.ts +6 -6
  161. package/dist/blocks/mail-sync/index.d.ts +5 -5
  162. package/dist/blocks/maintenance/index.d.ts +4 -4
  163. package/dist/blocks/manufacturing/index.d.ts +7 -7
  164. package/dist/blocks/medications/index.d.ts +4 -4
  165. package/dist/blocks/medications/index.js +1 -1
  166. package/dist/blocks/meetings/index.d.ts +5 -5
  167. package/dist/blocks/memberships/index.d.ts +3 -3
  168. package/dist/blocks/memory/index.d.ts +4 -4
  169. package/dist/blocks/messaging/index.d.ts +11 -11
  170. package/dist/blocks/metrics/index.d.ts +6 -6
  171. package/dist/blocks/mfa/index.d.ts +2 -2
  172. package/dist/blocks/moderation/index.d.ts +7 -7
  173. package/dist/blocks/notifications/index.d.ts +10 -10
  174. package/dist/blocks/notifications/index.js +2 -2
  175. package/dist/blocks/numbering/index.d.ts +1 -1
  176. package/dist/blocks/oauth-server/index.d.ts +5 -5
  177. package/dist/blocks/oauth-server/index.js +1 -1
  178. package/dist/blocks/observations/index.d.ts +5 -5
  179. package/dist/blocks/onboarding/index.d.ts +3 -3
  180. package/dist/blocks/option-sets/index.d.ts +6 -6
  181. package/dist/blocks/orders/index.d.ts +4 -4
  182. package/dist/blocks/orders/index.js +1 -1
  183. package/dist/blocks/organizations/index.d.ts +4 -4
  184. package/dist/blocks/outbox/index.d.ts +4 -4
  185. package/dist/blocks/outbox/index.js +1 -1
  186. package/dist/blocks/passes/index.d.ts +4 -4
  187. package/dist/blocks/passes/index.js +1 -1
  188. package/dist/blocks/payroll-export/index.d.ts +4 -4
  189. package/dist/blocks/payroll-export/index.js +1 -1
  190. package/dist/blocks/people/index.d.ts +8 -8
  191. package/dist/blocks/people/index.js +1 -1
  192. package/dist/blocks/periods/index.d.ts +5 -5
  193. package/dist/blocks/permissions/index.d.ts +7 -7
  194. package/dist/blocks/pipelines/index.d.ts +4 -4
  195. package/dist/blocks/posts/index.d.ts +6 -6
  196. package/dist/blocks/procurement/index.d.ts +6 -6
  197. package/dist/blocks/procurement/index.js +1 -1
  198. package/dist/blocks/profiles/index.d.ts +3 -3
  199. package/dist/blocks/projects/index.d.ts +8 -8
  200. package/dist/blocks/promotions/index.d.ts +3 -3
  201. package/dist/blocks/prompts/index.d.ts +4 -4
  202. package/dist/blocks/push/index.d.ts +7 -7
  203. package/dist/blocks/qualifications/index.d.ts +4 -4
  204. package/dist/blocks/queue/index.d.ts +5 -5
  205. package/dist/blocks/queue/index.js +2 -2
  206. package/dist/blocks/quotes/index.d.ts +5 -5
  207. package/dist/blocks/rank/index.d.ts +7 -7
  208. package/dist/blocks/rank/index.js +1 -1
  209. package/dist/blocks/reactions/index.d.ts +6 -6
  210. package/dist/blocks/recruiting/index.d.ts +5 -5
  211. package/dist/blocks/recruiting/index.js +1 -1
  212. package/dist/blocks/referrals/index.d.ts +5 -5
  213. package/dist/blocks/relations/index.d.ts +7 -7
  214. package/dist/blocks/reminders/index.d.ts +1 -1
  215. package/dist/blocks/reminders/index.js +1 -1
  216. package/dist/blocks/reviews/index.d.ts +5 -5
  217. package/dist/blocks/rfqs/index.d.ts +4 -4
  218. package/dist/blocks/risks/index.d.ts +6 -6
  219. package/dist/blocks/saas/index.d.ts +14 -14
  220. package/dist/blocks/saas/index.js +2 -2
  221. package/dist/blocks/sales/index.d.ts +1 -1
  222. package/dist/blocks/sales/index.js +1 -1
  223. package/dist/blocks/saved-views/index.d.ts +6 -6
  224. package/dist/blocks/scheduling/index.d.ts +6 -6
  225. package/dist/blocks/scheduling/index.js +1 -1
  226. package/dist/blocks/scores/index.d.ts +6 -6
  227. package/dist/blocks/search/index.d.ts +5 -5
  228. package/dist/blocks/search/index.js +1 -1
  229. package/dist/blocks/security-events/index.d.ts +7 -7
  230. package/dist/blocks/security-events/index.js +1 -1
  231. package/dist/blocks/segments/index.d.ts +4 -4
  232. package/dist/blocks/sequences/index.d.ts +5 -5
  233. package/dist/blocks/service/index.d.ts +8 -8
  234. package/dist/blocks/service-accounts/index.d.ts +5 -5
  235. package/dist/blocks/sessions/index.d.ts +4 -4
  236. package/dist/blocks/settings/index.d.ts +4 -4
  237. package/dist/blocks/share-links/index.d.ts +1 -1
  238. package/dist/blocks/shifts/index.d.ts +4 -4
  239. package/dist/blocks/shipments/index.d.ts +6 -6
  240. package/dist/blocks/shipments/index.js +1 -1
  241. package/dist/blocks/signatures/index.d.ts +3 -3
  242. package/dist/blocks/signing-keys/index.d.ts +3 -3
  243. package/dist/blocks/signing-keys/index.js +2 -2
  244. package/dist/blocks/sla/index.d.ts +3 -3
  245. package/dist/blocks/sso/index.d.ts +6 -6
  246. package/dist/blocks/state-machine/index.d.ts +2 -2
  247. package/dist/blocks/state-machine/index.js +1 -1
  248. package/dist/blocks/subjects/index.d.ts +7 -7
  249. package/dist/blocks/subjects/index.js +1 -1
  250. package/dist/blocks/support/index.d.ts +6 -6
  251. package/dist/blocks/tags/index.d.ts +3 -3
  252. package/dist/blocks/tasks/index.d.ts +4 -4
  253. package/dist/blocks/tax/index.d.ts +4 -4
  254. package/dist/blocks/tax/index.js +1 -1
  255. package/dist/blocks/teams/index.d.ts +1 -1
  256. package/dist/blocks/templates/index.d.ts +8 -8
  257. package/dist/blocks/tills/index.d.ts +5 -5
  258. package/dist/blocks/time-entries/index.d.ts +3 -3
  259. package/dist/blocks/timeline/index.d.ts +2 -2
  260. package/dist/blocks/trash/index.d.ts +3 -3
  261. package/dist/blocks/undo/index.d.ts +4 -4
  262. package/dist/blocks/updated-at/index.d.ts +3 -3
  263. package/dist/blocks/usage/index.d.ts +4 -4
  264. package/dist/blocks/vercel-marketplace/index.d.ts +5 -5
  265. package/dist/blocks/vercel-marketplace/index.js +3 -3
  266. package/dist/blocks/versions/index.d.ts +2 -2
  267. package/dist/blocks/waitlist/index.d.ts +5 -5
  268. package/dist/blocks/waitlist/index.js +1 -1
  269. package/dist/blocks/warehouse/index.d.ts +5 -5
  270. package/dist/blocks/warranty/index.d.ts +5 -5
  271. package/dist/blocks/webhooks/index.d.ts +15 -15
  272. package/dist/blocks/webhooks/index.js +6 -6
  273. package/dist/blocks/workflow-editor/index.d.ts +9 -9
  274. package/dist/blocks/workflows/index.d.ts +7 -7
  275. package/dist/{blocks-sDhFO8-h.d.ts → blocks-D4ngpPJ_.d.ts} +13 -3
  276. package/dist/{bookings-sBb-GMK8.d.ts → bookings-6dC83XE6.d.ts} +3 -3
  277. package/dist/{bootstrap-permissions-BOkRVEEh.js → bootstrap-permissions-CulW-R_u.js} +2 -2
  278. package/dist/{bucket-CbRyXRp3.d.ts → bucket-BJ03ZblY.d.ts} +1 -1
  279. package/dist/{build-QM0GdQ2B.js → build-CRxrX567.js} +1 -1
  280. package/dist/{cache-tags-FrJaMalu.d.ts → cache-tags-UWvxDMDO.d.ts} +1 -1
  281. package/dist/{care-plans-BR3TkinL.d.ts → care-plans-q3m4ph4G.d.ts} +2 -2
  282. package/dist/{care-plans-sql-DyB5TB6y.js → care-plans-sql-B__5eEaI.js} +1 -1
  283. package/dist/chat-sdk/index.d.ts +6 -6
  284. package/dist/claims/index.d.ts +7 -7
  285. package/dist/{claims-source-CeefCyGV.d.ts → claims-source-D-4CztOl.d.ts} +2 -2
  286. package/dist/cli/{add-djLR310z.js → add-CN5jkEFM.js} +2 -2
  287. package/dist/cli/add-fra98UnY.js +1 -0
  288. package/dist/cli/{add-OllEkXon.js → add-ucxskHiv.js} +11 -11
  289. package/dist/cli/{app-table-files-DnoDAkVJ.js → app-table-files-FcgTfOf9.js} +4 -4
  290. package/dist/cli/{app-tables-C4shCkBv.js → app-tables-DCpSNfJ3.js} +2 -2
  291. package/dist/cli/{backfill-_spwSvnn.js → backfill-DVP_elK_.js} +3 -3
  292. package/dist/cli/bin.js +1 -1
  293. package/dist/cli/{blocks-DFkzCFQi.js → blocks-CFKjKW4s.js} +1 -1
  294. package/dist/cli/{blocks-Cvs0nhC2.js → blocks-iSEepN2Y.js} +1 -1
  295. package/dist/cli/{cache-B0JnXfiY.js → cache-CNa3fjK-.js} +1 -1
  296. package/dist/cli/{codemod-D2Lnca97.js → codemod-DH-VSZps.js} +5 -5
  297. package/dist/cli/{codemod-naming-CHIeOTt5.js → codemod-naming-CuQ0ltfE.js} +1 -1
  298. package/dist/cli/{codes-DNq30BZg.js → codes-D_oa7Aw5.js} +3 -3
  299. package/dist/cli/{column-renames-4OHEvCAj.js → column-renames-CtcG8MR5.js} +2 -2
  300. package/dist/cli/{config-DkjilxeE.js → config-CoW6aoul.js} +1 -1
  301. package/dist/cli/{config-DD_MnPRL.js → config-DX58lDf7.js} +7 -1
  302. package/dist/cli/{content-mapper-DAYxPQ18.js → content-mapper-TATvvrmb.js} +1 -1
  303. package/dist/cli/{db-CEUnv3hK.js → db-CZ9qHsDs.js} +2 -2
  304. package/dist/cli/{dev-Xw7pt3KG.js → dev-BDv1efAy.js} +5 -5
  305. package/dist/cli/{doctor-diSKQp-6.js → doctor-CkO1yd7F.js} +20 -20
  306. package/dist/cli/{emit-CICey-Za.js → emit-OhupwGNp.js} +3 -3
  307. package/dist/cli/{gen-BVuNFeLB.js → gen-1lVJoeH1.js} +5 -5
  308. package/dist/cli/{gen-tasks-C2vwKKTc.js → gen-tasks-BgxoXxuF.js} +11 -11
  309. package/dist/cli/index.d.ts +1 -1
  310. package/dist/cli/index.js +8 -8
  311. package/dist/cli/{init-9BSoBkny.js → init-Defy7VJ0.js} +9 -9
  312. package/dist/cli/{live-Ce8vdcCn.js → live-DmvnAvGV.js} +2 -2
  313. package/dist/cli/{mcp-UW-gEnP_.js → mcp-BGKeD-lo.js} +2 -2
  314. package/dist/cli/{memo-backend-BMdfsihK.js → memo-backend-3u-X51UO.js} +1 -1
  315. package/dist/cli/{metadata-DqrbS0sS.js → metadata-D0UazHyQ.js} +4 -4
  316. package/dist/cli/{migrate-Cn8L_0co.js → migrate-PshyB8a6.js} +1 -1
  317. package/dist/cli/{migration-safety-C1Ysrthi.js → migration-safety-DYgRA8-5.js} +2 -2
  318. package/dist/cli/{module-migration-DXI95fqs.js → module-migration-CRsIlrig.js} +1 -1
  319. package/dist/cli/{partition-CJCrIueu.js → partition-ht8zldUV.js} +3 -3
  320. package/dist/cli/powersync-BztAuUyy.js +1 -0
  321. package/dist/cli/{powersync-CB-7AksZ.js → powersync-r6iL7zEo.js} +4 -4
  322. package/dist/cli/{print-AVVgXsLG.js → print-Ca78W5ZF.js} +2 -2
  323. package/dist/cli/{providers-B3FLmlud.js → providers-DhMSptuy.js} +1 -1
  324. package/dist/cli/{prune-workflows-CrLDmFf1.js → prune-workflows-DyZx-veL.js} +3 -3
  325. package/dist/cli/{remove-00SZWfyi.js → remove-37g_SvZW.js} +6 -6
  326. package/dist/cli/{render-3J7sk_CL.js → render-Bfh2EtMO.js} +5 -5
  327. package/dist/cli/{render-cache-P4gQeivH.js → render-cache-BYkVt264.js} +1 -1
  328. package/dist/cli/{run-D_z9ULO7.js → run-CfWFddfH.js} +8 -8
  329. package/dist/cli/{run-CByEIEng.js → run-DEPt1rAn.js} +37 -36
  330. package/dist/cli/seed-B6_MBFd2.js +1 -0
  331. package/dist/cli/{seed-CvDA1ItH.js → seed-pDWlnzyK.js} +2 -2
  332. package/dist/cli/{shared-d021xfdn.js → shared-BrAtQXmC.js} +1 -1
  333. package/dist/cli/{source-DdqeWoO4.js → source-Bt6UAek-.js} +1 -1
  334. package/dist/cli/{source-args-yU6N6JLm.js → source-args-D5BSEgUG.js} +1 -1
  335. package/dist/cli/{spec-Diudl7hC.js → spec-BJreyth3.js} +1 -1
  336. package/dist/cli/{spec-ClfqDbVv.js → spec-DsNayDt2.js} +2 -2
  337. package/dist/cli/{sql-layout-Bl3iOXMS.js → sql-layout-Bt7NcWXk.js} +3 -3
  338. package/dist/cli/{squash-C07y7CsQ.js → squash-DmbB7Gx9.js} +1 -1
  339. package/dist/cli/{sync-Cw0ke-3h.js → sync-DFAkNjw_.js} +60 -8
  340. package/dist/cli/{upgrade-oc6s5Xoe.js → upgrade-D8GOjXrv.js} +5 -5
  341. package/dist/cli/{upgrade-niwEovfl.js → upgrade-DP-30QID.js} +9 -7
  342. package/dist/cli/{verify-CrFHs8Lr.js → verify-O5zxWWuE.js} +2 -2
  343. package/dist/cli/{version-Bd3kCDzL.js → version-CHVFvh95.js} +1 -1
  344. package/dist/client/index.d.ts +6 -6
  345. package/dist/client/index.js +1 -1
  346. package/dist/client/native/index.d.ts +7 -7
  347. package/dist/client/native/index.js +4 -4
  348. package/dist/{client-D1grRDjj.js → client-CPG7YGP2.js} +1 -1
  349. package/dist/{client-bucket-BLVysX-A.js → client-bucket-DvoYllSB.js} +1 -1
  350. package/dist/{clinical-decision-support-BHRUL6qj.d.ts → clinical-decision-support-D6FWGbEw.d.ts} +3 -3
  351. package/dist/{cloud-event-BtWOKfsx.d.ts → cloud-event-B0AsPtwP.d.ts} +1 -1
  352. package/dist/{codec-BI1mq95W.js → codec-CJaAdLjG.js} +1 -1
  353. package/dist/commerce/index.js +1 -1
  354. package/dist/{compiler-BwJR_BHq.d.ts → compiler-u6lO9V7r.d.ts} +2 -2
  355. package/dist/{composite-Tsm5QFS2.js → composite-Bxpd7oru.js} +2 -2
  356. package/dist/{composite-BVEOyec_.d.ts → composite-CxojRRUF.d.ts} +7 -7
  357. package/dist/{composite-reads-DvN7EgDO.d.ts → composite-reads-CK-Y5b6M.d.ts} +2 -2
  358. package/dist/config/index.d.ts +5 -5
  359. package/dist/{connectors-VX1FIU-t.d.ts → connectors-BCIhimzA.d.ts} +4 -4
  360. package/dist/{consents-OI2OWAfb.d.ts → consents-BuIwU6T3.d.ts} +3 -3
  361. package/dist/{contacts-D9_KMOgs.d.ts → contacts-4xMnNBVk.d.ts} +5 -5
  362. package/dist/{context-C_Rx1QaW.d.ts → context-m-t6Kr9_.d.ts} +24 -10
  363. package/dist/contract/index.d.ts +9 -9
  364. package/dist/{contributions-Bh-HcHoJ.js → contributions-Ba-C1ueE.js} +6 -6
  365. package/dist/{controller-D9N4NKbM.d.ts → controller-zwQFyrOG.d.ts} +1 -1
  366. package/dist/{conversion-CruLbcu8.d.ts → conversion-b6htac73.d.ts} +1 -1
  367. package/dist/create/index.d.ts +4 -4
  368. package/dist/create/index.js +2 -2
  369. package/dist/create/lite/index.d.ts +4 -4
  370. package/dist/create/lite/index.js +5 -3
  371. package/dist/credentials/index.d.ts +4 -4
  372. package/dist/credentials/index.js +1 -1
  373. package/dist/{cron-route-Cg1V2MUq.js → cron-route-spE8XDgv.js} +1 -1
  374. package/dist/{data-engine-CQiEEoNx.d.ts → data-engine-nmeUijzR.d.ts} +1 -1
  375. package/dist/{db-blocks-DB8Ct8Eu.d.ts → db-blocks-_jJICfjp.d.ts} +5 -5
  376. package/dist/{define-BDrm9Vl7.d.ts → define-BVBAeKTi.d.ts} +1 -1
  377. package/dist/{define-block-Cd7dm2o6.d.ts → define-block-DQvTGOGv.d.ts} +14 -14
  378. package/dist/{define-runtime-Ca5NN0gu.js → define-runtime-DsFTahQB.js} +1 -1
  379. package/dist/{define-runtime-full-DeuaXsV7.js → define-runtime-full-B_cMkyCk.js} +2 -2
  380. package/dist/{delete-account-DwGFiIYv.d.ts → delete-account-BQDeafVT.d.ts} +4 -4
  381. package/dist/{documents-BHddH30g.d.ts → documents-B8Q_BKha.d.ts} +3 -3
  382. package/dist/{drive-C6thwExa.d.ts → drive-DaEK5ZxU.d.ts} +5 -5
  383. package/dist/e-invoicing/index.d.ts +2 -2
  384. package/dist/{e-prescribing-DkV1wF9y.d.ts → e-prescribing-CP0lcOje.d.ts} +4 -4
  385. package/dist/edge/index.d.ts +9 -9
  386. package/dist/edge/index.js +5 -5
  387. package/dist/elysia/index.d.ts +1 -1
  388. package/dist/{embeddings-4zY3hhO8.d.ts → embeddings-BriQ4hQ1.d.ts} +2 -2
  389. package/dist/{ended-B1oCwF0v.d.ts → ended-CzWPQkkG.d.ts} +2 -2
  390. package/dist/{entitlements-CR5HRd3S.d.ts → entitlements-D4ob6MfK.d.ts} +3 -3
  391. package/dist/eve/index.d.ts +9 -9
  392. package/dist/eve/index.js +1 -1
  393. package/dist/{eve-BZhRFAWs.d.ts → eve-D-hvUFYE.d.ts} +2 -2
  394. package/dist/events/index.d.ts +5 -5
  395. package/dist/{events-Bk63_mjA.d.ts → events-zz8DwtZi.d.ts} +2 -2
  396. package/dist/{executor-BypvvW56.d.ts → executor-7zo2arIZ.d.ts} +1 -1
  397. package/dist/{executor-BaFzh9pS.d.ts → executor-BLv4T8kT.d.ts} +1 -1
  398. package/dist/{executor-Bot0tkvU.js → executor-D24_D6dr.js} +1 -1
  399. package/dist/{executor-CTuilcgE.d.ts → executor-nx2Q8Xdy.d.ts} +4 -4
  400. package/dist/expo/index.d.ts +6 -6
  401. package/dist/expo/index.js +5 -5
  402. package/dist/{extract-B2My7IhT.d.ts → extract-W4zb3wIh.d.ts} +5 -5
  403. package/dist/{extras-CKwPSpGL.d.ts → extras-ByEPERCR.d.ts} +2 -2
  404. package/dist/fhir/index.d.ts +5 -5
  405. package/dist/fhir/index.js +1 -1
  406. package/dist/{field-errors-CihTLojJ.d.ts → field-errors-pj0uOXSg.d.ts} +9 -9
  407. package/dist/{fields-OBEVi7hN.d.ts → fields-BATxzuhy.d.ts} +1 -1
  408. package/dist/{filter-evaluate-CVwpzMX-.d.ts → filter-evaluate-C2JXrZst.d.ts} +1 -1
  409. package/dist/{filter-query-CI5u0oca.d.ts → filter-query-DwJ1iMQ0.d.ts} +1 -1
  410. package/dist/{flags-Du06K0gA.d.ts → flags-CkMvfo73.d.ts} +2 -2
  411. package/dist/flags-sdk/index.d.ts +2 -2
  412. package/dist/{framework-giXStk8k.d.ts → framework-BYx1ke3r.d.ts} +8 -8
  413. package/dist/{framework-BYZ8c9_g.js → framework-pfJvMQy3.js} +1 -1
  414. package/dist/{funding-DpFfyIiK.d.ts → funding-B4vqlKq2.d.ts} +7 -7
  415. package/dist/{gateway-ChuQD_IL.d.ts → gateway-eFh5pEIu.d.ts} +3 -3
  416. package/dist/generators/factories/index.d.ts +1 -1
  417. package/dist/generators/factories/index.js +1 -1
  418. package/dist/generators/index.d.ts +2 -2
  419. package/dist/generators/json-schema/index.d.ts +2 -2
  420. package/dist/generators/json-schema/index.js +1 -1
  421. package/dist/generators/nuqs/index.d.ts +1 -1
  422. package/dist/generators/nuqs/index.js +1 -1
  423. package/dist/generators/standard-schema/index.d.ts +1 -1
  424. package/dist/generators/standard-schema/index.js +1 -1
  425. package/dist/generators/valibot/index.d.ts +1 -1
  426. package/dist/generators/valibot/index.js +1 -1
  427. package/dist/generators/zod/index.d.ts +1 -1
  428. package/dist/generators/zod/index.js +1 -1
  429. package/dist/h3/index.d.ts +1 -1
  430. package/dist/h3/v1/index.d.ts +1 -1
  431. package/dist/hono/index.d.ts +9 -9
  432. package/dist/hono/index.js +4 -4
  433. package/dist/{inbox-CDGfVOyZ.d.ts → inbox-Cr4WDuhI.d.ts} +5 -5
  434. package/dist/{index-DmoaxGHV.d.ts → index-1FGquKaz.d.ts} +3 -3
  435. package/dist/{index-CiCmlbtu.d.ts → index-46tesKqa.d.ts} +6 -6
  436. package/dist/{index-BAku12tP.d.ts → index-BHkxtS6f.d.ts} +1 -1
  437. package/dist/{index-cgHbN_EA.d.ts → index-BLPzvJ5v.d.ts} +9 -9
  438. package/dist/{index-Bs6OCtxW.d.ts → index-BVuN7_fC.d.ts} +8 -8
  439. package/dist/{index-BqUY2MB-.d.ts → index-BYDpdZxq.d.ts} +5 -5
  440. package/dist/{index-BrnGYShi.d.ts → index-BZCCv04g.d.ts} +4 -4
  441. package/dist/{index-DflyfGR8.d.ts → index-Bb_il0ub.d.ts} +5 -5
  442. package/dist/{index-BvRseRob.d.ts → index-BfnBjZpy.d.ts} +5 -5
  443. package/dist/{index-Bv2kSYet.d.ts → index-BomyYKtC.d.ts} +6 -6
  444. package/dist/{index-DsLMqyB5.d.ts → index-BpQxfGSO.d.ts} +6 -6
  445. package/dist/{index-UQOB8v1I.d.ts → index-Bu4YwWl0.d.ts} +3 -3
  446. package/dist/{index-BvZ3uvj9.d.ts → index-ByCXNZ2j.d.ts} +2 -2
  447. package/dist/{index-C59gKJBx.d.ts → index-C37Wq488.d.ts} +6 -6
  448. package/dist/{index-D50ulqMJ.d.ts → index-CDX9U_CH.d.ts} +4 -4
  449. package/dist/{index-Cnc4wyTo.d.ts → index-CQGi7Jnn.d.ts} +9 -9
  450. package/dist/{index-DpXMVE12.d.ts → index-CWTWbIz_.d.ts} +3 -3
  451. package/dist/{index-C1na2fiY.d.ts → index-CjoB5SrD.d.ts} +5 -5
  452. package/dist/{index-Cpj79WyM.d.ts → index-ClqA-t45.d.ts} +5 -5
  453. package/dist/{index-DMHxmit5.d.ts → index-CriIH7di.d.ts} +5 -5
  454. package/dist/{index-74TASXlD.d.ts → index-Crm9IjfQ.d.ts} +7 -7
  455. package/dist/{index-B0dSXth6.d.ts → index-CxX_Bgfa.d.ts} +6 -6
  456. package/dist/{index-BOuJSOaf.d.ts → index-CxZV8RJE.d.ts} +6 -6
  457. package/dist/{index-d2TijvXV.d.ts → index-D2R8Msu5.d.ts} +1 -1
  458. package/dist/{index-BszN5nLs.d.ts → index-DCqy0ESb.d.ts} +2 -2
  459. package/dist/{index-D6px-XTD.d.ts → index-DW_S9n3h.d.ts} +7 -7
  460. package/dist/{index-CdoTvK2W.d.ts → index-DYh76mE_.d.ts} +2 -2
  461. package/dist/{index-pry9PXpK.d.ts → index-D_0l5hHh.d.ts} +4 -4
  462. package/dist/{index-Hzbfht3Z.d.ts → index-DeI4h1N1.d.ts} +7 -7
  463. package/dist/{index-Sl13L6VB.d.ts → index-Dea13gIz.d.ts} +6 -6
  464. package/dist/{index-CMyUugyW.d.ts → index-DlUd0CTA.d.ts} +9 -9
  465. package/dist/{index-DibtbiIW.d.ts → index-DpoUltRu.d.ts} +2 -2
  466. package/dist/{index-DzUnwtxa.d.ts → index-DsNwQRWG.d.ts} +3 -3
  467. package/dist/{index-_No9Jb9O.d.ts → index-DyV6z0Q_.d.ts} +8 -8
  468. package/dist/{index-69aFw9Id.d.ts → index-Dyhkn8FU.d.ts} +5 -5
  469. package/dist/{index-28PPT5w7.d.ts → index-IrsC8TLH.d.ts} +8 -8
  470. package/dist/{index-wc3-R_cK.d.ts → index-SWDnWdWw.d.ts} +3 -3
  471. package/dist/{index-BnY5lZtT.d.ts → index-SZ8qGIVO.d.ts} +15 -15
  472. package/dist/{index-CGAcXNod.d.ts → index-WoE9Z_V-.d.ts} +5 -5
  473. package/dist/{index-CiLb3DTI.d.ts → index-r_SO6mVm.d.ts} +5 -5
  474. package/dist/index.d.ts +7 -7
  475. package/dist/index.js +1 -1
  476. package/dist/{invoices-BXwG7Jwp.d.ts → invoices-L6khZ9kt.d.ts} +5 -5
  477. package/dist/{json-schema-BveJfXoz.js → json-schema-CU9Mg-_d.js} +1 -1
  478. package/dist/{jwks-cache-C5Bkk8wb.js → jwks-cache-DcfC4DmK.js} +1 -1
  479. package/dist/{jws-D5t4Ylus.js → jws-DChBKezH.js} +1 -1
  480. package/dist/{kit-DN6lGKB6.d.ts → kit-BwlTgitb.d.ts} +4 -4
  481. package/dist/{knowledge-pN-5j-oj.d.ts → knowledge-C7RZqwQu.d.ts} +9 -6
  482. package/dist/lint/index.d.ts +1 -1
  483. package/dist/list/export/index.d.ts +1 -1
  484. package/dist/list/index.d.ts +3 -3
  485. package/dist/list/order/index.d.ts +3 -3
  486. package/dist/{list-query-CBjzZmjx.d.ts → list-query-B6lXbY0T.d.ts} +4 -4
  487. package/dist/{manifest-CgljOcHt.d.ts → manifest-2sJavyD8.d.ts} +6 -6
  488. package/dist/{manifest-BTR978h8.js → manifest-3XKIMZkJ.js} +1 -1
  489. package/dist/{manifest-CGnN_2Yx.d.ts → manifest-4S1YGIS3.d.ts} +6 -6
  490. package/dist/{manifest-CtUKrkx1.d.ts → manifest-5i2UwyQr.d.ts} +4 -4
  491. package/dist/{manifest-DMhuQgOx.d.ts → manifest-B0pan6cS.d.ts} +5 -5
  492. package/dist/{manifest-VbHg6E4F.js → manifest-BBcaI1P8.js} +1 -1
  493. package/dist/{manifest-Dqf2Uw17.d.ts → manifest-BEQWkGmf.d.ts} +5 -5
  494. package/dist/{manifest-2JeNUq8t.d.ts → manifest-BKiaRgiZ.d.ts} +3 -3
  495. package/dist/{manifest-CBdMkxZD.d.ts → manifest-BMilYLsh.d.ts} +3 -3
  496. package/dist/{manifest-dt25CCQA.js → manifest-BNmYcT7b.js} +1 -1
  497. package/dist/{manifest-BVn2Xglt.d.ts → manifest-BRvnB8C0.d.ts} +5 -5
  498. package/dist/{manifest-Ci7NEusH.d.ts → manifest-BZPruG-S.d.ts} +4 -4
  499. package/dist/{manifest-CLG2lmYA.js → manifest-B_qm9fCI.js} +1 -1
  500. package/dist/{manifest-BWKFNoxP.d.ts → manifest-BaIG9QRj.d.ts} +4 -4
  501. package/dist/{manifest-Bo0SCigB.d.ts → manifest-Bf6Rzatq.d.ts} +4 -4
  502. package/dist/{manifest-gl856Z9G.d.ts → manifest-Bfu-Cu0f.d.ts} +7 -7
  503. package/dist/{manifest-DY2KtVcD.d.ts → manifest-Bj8bumDU.d.ts} +6 -6
  504. package/dist/{manifest-WK23vBlH.js → manifest-Bkm_17rp.js} +2 -2
  505. package/dist/{manifest-WpIMAJCT.d.ts → manifest-BpgNJhYN.d.ts} +2 -2
  506. package/dist/{manifest-CjzIpyBP.d.ts → manifest-BxvFH1G_.d.ts} +3 -3
  507. package/dist/{manifest-D43yma-v.d.ts → manifest-BzXqieUD.d.ts} +7 -7
  508. package/dist/{manifest-D1FPczc-.d.ts → manifest-C2hpeEBF.d.ts} +3 -3
  509. package/dist/{manifest-BLFyjEv_.js → manifest-C6bwnO77.js} +1 -1
  510. package/dist/{manifest-3or1oZTo.d.ts → manifest-C95ET4CL.d.ts} +4 -4
  511. package/dist/{manifest-d7vR6coE.d.ts → manifest-CA5EhKZ9.d.ts} +3 -3
  512. package/dist/{manifest-mAxLRfeu.d.ts → manifest-CF3BUmbe.d.ts} +5 -5
  513. package/dist/{manifest-BTgU8Kcf.js → manifest-CG38X6q2.js} +1 -1
  514. package/dist/{manifest-CXNXmH86.js → manifest-CK1J6NE1.js} +1 -1
  515. package/dist/{manifest-B1lOqNaq.js → manifest-CLw7q0PB.js} +1 -1
  516. package/dist/{manifest-AS4QwWdu.d.ts → manifest-CMn61uKN.d.ts} +5 -5
  517. package/dist/{manifest-Bi44m1V3.d.ts → manifest-CS8I2fku.d.ts} +3 -3
  518. package/dist/{manifest-D08Cdndm.js → manifest-CSYLcs5d.js} +2 -2
  519. package/dist/{manifest-iGmnzfGD.d.ts → manifest-CWFhOuFW.d.ts} +4 -4
  520. package/dist/{manifest-DUZUtWBi.d.ts → manifest-CXdJUJjX.d.ts} +8 -8
  521. package/dist/{manifest-3e0zfaQt.d.ts → manifest-CYO44YUb.d.ts} +5 -5
  522. package/dist/{manifest-B9m_UaiY.d.ts → manifest-Ccc0ZZup.d.ts} +6 -6
  523. package/dist/{manifest-CpmJIEt7.d.ts → manifest-CiF1Sb29.d.ts} +6 -6
  524. package/dist/{manifest-C82tY_RD.d.ts → manifest-Cl2U3bic.d.ts} +3 -3
  525. package/dist/{manifest-at0NS8cT.d.ts → manifest-CnVa_nHw.d.ts} +3 -3
  526. package/dist/{manifest-DBT7GiWE.js → manifest-CoR7UHm9.js} +1 -1
  527. package/dist/{manifest-Dxff277Z.js → manifest-CsJhHOcl.js} +2 -2
  528. package/dist/{manifest-Bluupj7R.d.ts → manifest-CtL5JmoY.d.ts} +4 -4
  529. package/dist/{manifest-DHN6WiIJ.d.ts → manifest-CumC7hH5.d.ts} +4 -4
  530. package/dist/{manifest-C20SXAzp.d.ts → manifest-Cv7Mji7w.d.ts} +5 -5
  531. package/dist/{manifest-iMnrzuzj.js → manifest-CwvLYm4x.js} +2 -2
  532. package/dist/{manifest-CUtvLTr3.js → manifest-CzDKrwRf.js} +2 -2
  533. package/dist/{manifest-DaB1w2xo.d.ts → manifest-D48Fi0bR.d.ts} +3 -3
  534. package/dist/{manifest-WJ-UHuEx.d.ts → manifest-DOtSiMt5.d.ts} +4 -4
  535. package/dist/{manifest-Utivc7Qa.d.ts → manifest-DUPKC2rO.d.ts} +5 -5
  536. package/dist/{manifest-CD5D0OWo.d.ts → manifest-DZyxhWcb.d.ts} +3 -3
  537. package/dist/{manifest-CH1MFzXN.d.ts → manifest-DfC1XBrV.d.ts} +4 -4
  538. package/dist/{manifest-CiXl1kUg.d.ts → manifest-DftU8SXo.d.ts} +5 -5
  539. package/dist/{manifest-C40ISJVj.d.ts → manifest-Dg2BCyzg.d.ts} +4 -4
  540. package/dist/{manifest-DJhjOnvk.d.ts → manifest-DiXINLQQ.d.ts} +5 -5
  541. package/dist/{manifest-j4_V-qhA.d.ts → manifest-Dim5U8TQ.d.ts} +3 -3
  542. package/dist/{manifest-CQrTRkRh.js → manifest-DkpKjNGT.js} +1 -1
  543. package/dist/{manifest-qOwMTJHI.js → manifest-DlNcTvH_.js} +1 -1
  544. package/dist/{manifest-C1--UMCz.d.ts → manifest-DoZXpoG_.d.ts} +6 -6
  545. package/dist/{manifest-mBKFNynL.d.ts → manifest-Dp9ZtoFo.d.ts} +7 -7
  546. package/dist/{manifest-BSjzLeb-.d.ts → manifest-DpFy7git.d.ts} +8 -8
  547. package/dist/{manifest-B7xyFqWo.d.ts → manifest-DsINyvTh.d.ts} +6 -6
  548. package/dist/{manifest-C7KPtGTu.d.ts → manifest-DucB6ix_.d.ts} +4 -4
  549. package/dist/{manifest-B9qFGJ_A.d.ts → manifest-DwBFwxFo.d.ts} +6 -6
  550. package/dist/{manifest-Cj6lOdW6.js → manifest-DwZwlGaz.js} +1 -1
  551. package/dist/{manifest-DpXgCZEd.d.ts → manifest-FVkgBS-K.d.ts} +4 -4
  552. package/dist/{manifest-ClDcyCPP.d.ts → manifest-N5wuAzq4.d.ts} +8 -8
  553. package/dist/{manifest-B1lYVfIp.d.ts → manifest-NkuGL5p2.d.ts} +4 -4
  554. package/dist/{manifest-Co0CBReD.d.ts → manifest-NuYSYeQT.d.ts} +5 -5
  555. package/dist/{manifest-CJRob2Ms.d.ts → manifest-TG95ksdH.d.ts} +11 -11
  556. package/dist/{manifest-DAF4J0gk.d.ts → manifest-YtnGn7F9.d.ts} +2 -2
  557. package/dist/{manifest-CCPioFQl.d.ts → manifest-_zu02ImE.d.ts} +5 -5
  558. package/dist/{manifest-ByRLUGaJ.d.ts → manifest-cJ3rQXtl.d.ts} +11 -11
  559. package/dist/{manifest-DQkz9UVy.d.ts → manifest-dOFbx7Iv.d.ts} +2 -2
  560. package/dist/{manifest-wPIH-Oo7.d.ts → manifest-eaGk_4rq.d.ts} +6 -6
  561. package/dist/{manifest-B94f27dU.js → manifest-icEpY96-.js} +1 -1
  562. package/dist/{manifest-DIl_cNua.d.ts → manifest-tP62uJrR.d.ts} +4 -4
  563. package/dist/{manifest-DGoI006V.d.ts → manifest-ubm80xCr.d.ts} +6 -6
  564. package/dist/{manifest-BXWhDMFt.d.ts → manifest-wXk0ZLhO.d.ts} +4 -4
  565. package/dist/{manifest-C94eugvl.d.ts → manifest-x_fSttX7.d.ts} +4 -4
  566. package/dist/{manifest-Cqv6c1KN.d.ts → manifest-xlpYSpLJ.d.ts} +4 -4
  567. package/dist/mapper/bin.js +6 -6
  568. package/dist/mcp/index.d.ts +3 -3
  569. package/dist/mcp/index.js +1 -1
  570. package/dist/mcp/sdk/index.d.ts +6 -6
  571. package/dist/mcp/sdk/index.js +2 -2
  572. package/dist/{mcp-mSD-ic9W.js → mcp-CULIbS-b.js} +5 -5
  573. package/dist/{medications-Cxvrfid3.d.ts → medications-3mcGOelG.d.ts} +5 -5
  574. package/dist/{messaging-C-PJ2LBY.d.ts → messaging-DasXvQj7.d.ts} +4 -4
  575. package/dist/nestjs/index.d.ts +2 -2
  576. package/dist/next/client/index.d.ts +1 -1
  577. package/dist/next/index.d.ts +20 -20
  578. package/dist/next/index.js +7 -7
  579. package/dist/next/offline/index.d.ts +1 -1
  580. package/dist/next/proxy/index.d.ts +5 -5
  581. package/dist/next/proxy/index.js +2 -2
  582. package/dist/node/index.d.ts +2 -2
  583. package/dist/{observations-BBQZWl54.d.ts → observations-8pt9Lflf.d.ts} +3 -3
  584. package/dist/{operations-dIOdHqYz.d.ts → operations-D4zxY2TL.d.ts} +1 -1
  585. package/dist/{orders-ePaBZDl9.d.ts → orders-BCR5H9Tz.d.ts} +3 -3
  586. package/dist/{orders-reads-CWCAZHgZ.js → orders-reads-BGMu5-Ug.js} +2 -2
  587. package/dist/orpc/index.d.ts +8 -8
  588. package/dist/orpc/index.js +3 -3
  589. package/dist/otel/index.d.ts +2 -2
  590. package/dist/otel/index.js +5 -5
  591. package/dist/{outbox-EXHTONFS.d.ts → outbox-DNyzkxyX.d.ts} +4 -4
  592. package/dist/{payroll-export-CIVukFDd.js → payroll-export-kpVJj_Gj.js} +13 -13
  593. package/dist/{permissions-DG0t2lrA.d.ts → permissions-BkUcXwtV.d.ts} +1 -1
  594. package/dist/{permissions-model-CYfIupG0.js → permissions-model-B7E_f7GV.js} +13 -1
  595. package/dist/{pool-tXlDkx18.d.ts → pool-Dzeln5IJ.d.ts} +3 -3
  596. package/dist/{ports-DR88RF0N.js → ports-BBowiGiD.js} +4 -4
  597. package/dist/{ports-CfiOCL2r.d.ts → ports-DD-pDkHu.d.ts} +1 -1
  598. package/dist/postgres/index.d.ts +4 -4
  599. package/dist/{postgrest-gG_GIWFi.d.ts → postgrest-CgAxVpiW.d.ts} +1 -1
  600. package/dist/powersync/index.d.ts +9 -9
  601. package/dist/powersync/index.js +1 -1
  602. package/dist/preset/index.d.ts +4 -4
  603. package/dist/preset/index.js +1 -1
  604. package/dist/{preset-HzYIrxUS.js → preset-ZZ4H2s92.js} +5 -5
  605. package/dist/{preview-3nes4WG4.d.ts → preview-GUvVjUxf.d.ts} +6 -6
  606. package/dist/{project-CXcoauzs.js → project-wJ3jYipI.js} +2 -2
  607. package/dist/{provider-r2RjlARm.d.ts → provider-DSokOaUo.d.ts} +1 -1
  608. package/dist/{push-token-CRBieazN.d.ts → push-token-C8MoiM7E.d.ts} +1 -1
  609. package/dist/query/index.d.ts +1 -1
  610. package/dist/rate-limit/index.d.ts +1 -1
  611. package/dist/{rate-limit-CxN-zbLC.d.ts → rate-limit-Ddv4xmsH.d.ts} +5 -5
  612. package/dist/react/index.d.ts +9 -9
  613. package/dist/react/index.js +2 -2
  614. package/dist/react/native/index.d.ts +1 -1
  615. package/dist/react/native/index.js +3 -3
  616. package/dist/react/server.d.ts +8 -8
  617. package/dist/react/server.js +2 -2
  618. package/dist/react/session.d.ts +2 -2
  619. package/dist/{react-CvgCNgo-.js → react-hb2gg5UV.js} +2 -2
  620. package/dist/react-router/index.d.ts +6 -6
  621. package/dist/react-router/index.js +4 -4
  622. package/dist/realtime/index.d.ts +6 -6
  623. package/dist/realtime/index.js +2 -2
  624. package/dist/{record-form-BggNAKZA.d.ts → record-form-CbFN-AdD.d.ts} +1 -1
  625. package/dist/{recordings-Bdf1OnQS.d.ts → recordings-C1BOyHYu.d.ts} +1 -1
  626. package/dist/records/index.d.ts +9 -9
  627. package/dist/{refusal-DHSRBaS6.d.ts → refusal-6HGi0oY9.d.ts} +3 -3
  628. package/dist/{resolve-oJsHQ9Ib.js → resolve-DP8w5Nl0.js} +2 -2
  629. package/dist/{resolve-Chhtdk4M.d.ts → resolve-Pn7KvQ23.d.ts} +1 -1
  630. package/dist/{resource-BfkM1JZ0.d.ts → resource-DFEtCFTy.d.ts} +1 -1
  631. package/dist/{resource-execute-BIqAzA57.d.ts → resource-execute-BQx_Pmeu.d.ts} +2 -2
  632. package/dist/{resource-types-DcEe07vC.d.ts → resource-types-lBguZ_8J.d.ts} +4 -4
  633. package/dist/{resources-Bb_JRadM.d.ts → resources-CWfoS1er.d.ts} +2 -2
  634. package/dist/{respond-DNcBzi_Y.d.ts → respond-vxhdVf23.d.ts} +1 -1
  635. package/dist/{runs-CTo9cjAz.js → runs-bv1S-1JM.js} +2 -2
  636. package/dist/{sales-CIe7dE4J.js → sales-Br66jZAO.js} +2 -2
  637. package/dist/{sales-lines-CX-xpQQW.d.ts → sales-lines-DWwWHLJj.d.ts} +1 -1
  638. package/dist/{sandboxes-vO9Yb0Bd.d.ts → sandboxes-BjvFi1Wh.d.ts} +1 -1
  639. package/dist/{scores-C8fy3RXF.d.ts → scores-LZaJOHkr.d.ts} +5 -5
  640. package/dist/server/account/index.d.ts +3 -3
  641. package/dist/server/accounts/index.d.ts +6 -6
  642. package/dist/server/accounts/index.js +1 -1
  643. package/dist/server/index.d.ts +27 -27
  644. package/dist/server/index.js +12 -12
  645. package/dist/{server-DA5SRGHQ.js → server-af58-Q51.js} +10 -6
  646. package/dist/{server-types-Cp2en4rP.d.ts → server-types-By5oBsDZ.d.ts} +18 -12
  647. package/dist/{session-Bro3jmnu.d.ts → session-D5IrTUwv.d.ts} +6 -6
  648. package/dist/{session-status-CywvasN_.d.ts → session-status-m5VN1pW1.d.ts} +2 -2
  649. package/dist/{sessions-Dedk1ubX.js → sessions-w6xril_l.js} +1 -1
  650. package/dist/{settings-CMcdSyT4.d.ts → settings-C_zEVfCy.d.ts} +2 -2
  651. package/dist/{sign-in-DgvuMl59.js → sign-in-CxnkReKM.js} +2 -2
  652. package/dist/{sign-in-BwI5DHy5.js → sign-in-DklEPfDI.js} +2 -2
  653. package/dist/{sign-in-R_Ou2FMR.d.ts → sign-in-Dni-tX9B.d.ts} +1 -1
  654. package/dist/{sign-in-Cj7Y0mSU.d.ts → sign-in-TNX4Pj9E.d.ts} +17 -17
  655. package/dist/{signatures-D9_TUapq.js → signatures-BZ10RZbf.js} +1 -1
  656. package/dist/{signers-BnUPoU0u.d.ts → signers-DB0S8YhO.d.ts} +4 -4
  657. package/dist/{signing-keys-DulqHr3n.d.ts → signing-keys-BNwqmUlK.d.ts} +2 -2
  658. package/dist/{signing-keys-BxAcK3ve.js → signing-keys-Cr08qRGc.js} +1 -1
  659. package/dist/solid/index.d.ts +11 -11
  660. package/dist/solid/index.js +1 -1
  661. package/dist/solid-start/index.d.ts +6 -6
  662. package/dist/solid-start/index.js +4 -4
  663. package/dist/spec/index.d.ts +2 -2
  664. package/dist/spec/index.js +2 -2
  665. package/dist/sql/index.d.ts +5 -5
  666. package/dist/sql/index.js +3 -3
  667. package/dist/{sql-BwfPwN8v.js → sql-CP1j2jfo.js} +293 -133
  668. package/dist/sqlite/index.d.ts +3 -3
  669. package/dist/sqlite/index.js +1 -1
  670. package/dist/{sso-DcxycaaP.d.ts → sso-CK6_NPWp.d.ts} +3 -3
  671. package/dist/ssr/index.d.ts +4 -4
  672. package/dist/ssr/index.js +1 -1
  673. package/dist/storage/client/index.d.ts +2 -2
  674. package/dist/storage/client/index.js +1 -1
  675. package/dist/storage/index.d.ts +3 -3
  676. package/dist/storage/index.js +1 -1
  677. package/dist/streams/index.d.ts +1 -1
  678. package/dist/streams/resumable/index.d.ts +1 -1
  679. package/dist/{subject-readers-61Xd5vAQ.js → subject-readers-qnt9P3Tf.js} +2 -2
  680. package/dist/{subject-readers-DNPGHMEg.d.ts → subject-readers-zsCxIZ_1.d.ts} +5 -5
  681. package/dist/{subjects-Bb5-VIcs.d.ts → subjects-Bnhj8AsZ.d.ts} +9 -9
  682. package/dist/{support-N97YzVgD.d.ts → support-8jVUURe-.d.ts} +4 -4
  683. package/dist/{support--EPft3tt.js → support-B9mOOkAy.js} +1 -1
  684. package/dist/{support-view-D0VmaQVg.d.ts → support-view-CfyHFSq4.d.ts} +1 -1
  685. package/dist/{suspend-account-DcQFTDGI.d.ts → suspend-account-Bi-ebizL.d.ts} +2 -2
  686. package/dist/svelte/index.d.ts +10 -10
  687. package/dist/svelte/index.js +1 -1
  688. package/dist/sveltekit/index.d.ts +7 -7
  689. package/dist/sveltekit/index.js +4 -4
  690. package/dist/{tags-C7NyJTdU.d.ts → tags-Csj8VfA7.d.ts} +1 -1
  691. package/dist/tanstack-db/index.d.ts +3 -3
  692. package/dist/tanstack-start/index.d.ts +6 -6
  693. package/dist/tanstack-start/index.js +4 -4
  694. package/dist/{tax-sql-DrR78UUW.js → tax-sql-sSJTtYtF.js} +1 -1
  695. package/dist/{tenant-BFABaxQ5.d.ts → tenant-CVRFoaDM.d.ts} +1 -1
  696. package/dist/testing/index.d.ts +36 -36
  697. package/dist/testing/index.js +37 -18
  698. package/dist/{timeline-0a7kclhg.d.ts → timeline-T1qkzVdR.d.ts} +5 -5
  699. package/dist/{topic-CTqz7oYG.js → topic-CZ8FVS1o.js} +1 -1
  700. package/dist/{topic-BH4L7H8n.d.ts → topic-DytYYyP3.d.ts} +16 -5
  701. package/dist/{types-BQaFrgFr.d.ts → types-BEuYPFta.d.ts} +4 -4
  702. package/dist/{types-BIpCfsXW.d.ts → types-BcBKymdQ.d.ts} +1 -1
  703. package/dist/{types-BME_OjVm.d.ts → types-CID74uQG.d.ts} +5 -5
  704. package/dist/{types-arsKcxoV.d.ts → types-CNE-ybHL.d.ts} +3 -3
  705. package/dist/{types-D9qT7VIV.d.ts → types-CVq6-P5G.d.ts} +7 -7
  706. package/dist/{types-BMLgTFzf.d.ts → types-Cge5o3f5.d.ts} +2 -2
  707. package/dist/{types-BFNVzP1M.d.ts → types-Cikitezb.d.ts} +5 -5
  708. package/dist/{types-BJ4cg51a.d.ts → types-Dizn1liT.d.ts} +12 -2
  709. package/dist/{undo-B_8VpTy2.d.ts → undo-CRejYq21.d.ts} +2 -2
  710. package/dist/{usage-BBR7z7ra.d.ts → usage-CrTrlxoi.d.ts} +4 -4
  711. package/dist/{vault-B2AI88Jz.d.ts → vault-Dyy9I0IE.d.ts} +2 -2
  712. package/dist/vercel-connect/index.d.ts +1 -1
  713. package/dist/vercel-sandbox/index.d.ts +2 -2
  714. package/dist/verifiable-credentials/index.js +2 -2
  715. package/dist/{verify-yUHyGq0u.js → verify-Bu2FKS9o.js} +1 -1
  716. package/dist/{verify-tK2F49Gn.d.ts → verify-dg8Q3iRY.d.ts} +2 -2
  717. package/dist/{version-BHgdHcZN.js → version-B0uw5rOF.js} +1 -1
  718. package/dist/{view-DKo-Koiu.d.ts → view-DwTCw_jZ.d.ts} +1 -1
  719. package/dist/vue/index.d.ts +11 -11
  720. package/dist/vue/index.js +1 -1
  721. package/dist/{watch-topic-BYfSlldk.d.ts → watch-topic-DT31uYqF.d.ts} +1 -1
  722. package/dist/{webhook-inbox-Bn-dV-vF.js → webhook-inbox-DIPjKka6.js} +1 -1
  723. package/dist/webmcp/index.d.ts +2 -2
  724. package/dist/webmcp/index.js +1 -1
  725. package/dist/workflow-sdk/builder/index.d.ts +3 -3
  726. package/dist/workflow-sdk/index.d.ts +1 -1
  727. package/dist/workflow-sdk/index.js +1 -1
  728. package/dist/workflow-sdk/world/index.d.ts +1 -1
  729. package/dist/workflow-sdk/world/index.js +1 -1
  730. package/dist/{workflow-sdk-c025kSHf.js → workflow-sdk-IPsOMGEC.js} +1 -1
  731. package/dist/{workflow-sdk-B_yeWl8N.d.ts → workflow-sdk-Js7efMDi.d.ts} +3 -3
  732. package/dist/{workflows-DR6nJ9vq.d.ts → workflows-CUcK8Axx.d.ts} +4 -4
  733. package/dist/yjs/index.d.ts +2 -2
  734. package/dist/yjs/index.js +2 -2
  735. package/package.json +3 -1
  736. package/schemas/config-v1.json +27 -0
  737. package/schemas/error-codes.json +3 -3
  738. package/skills/better-supabase/SKILL.md +2 -2
  739. package/skills/better-supabase/references/ui-recipes.md +2 -2
  740. package/dist/cli/add-BBZULhs3.js +0 -1
  741. package/dist/cli/powersync-JTdU1Xpy.js +0 -1
  742. package/dist/cli/seed-CucH5loT.js +0 -1
@@ -32,7 +32,7 @@ import { i as billingSqlOptions, n as BILLING_READS, r as billingReads } from ".
32
32
  import { t as bookingsSqlOptions } from "./options-CtPokOpy.js";
33
33
  import { t as bulkActionsSqlOptions } from "./options-Cv8jRbcG.js";
34
34
  import { t as calendarSqlOptions } from "./options-D9fAmLff.js";
35
- import { a as CARE_PLAN_STATUSES, i as CARE_PLAN_PROBLEM_STATUSES, n as CARE_PLAN_ACTION_STATUSES, o as carePlansSql, r as CARE_PLAN_GOAL_STATUSES, s as carePlansSqlOptions, t as CARE_PLAN_ACTION_KINDS } from "./care-plans-sql-DyB5TB6y.js";
35
+ import { a as CARE_PLAN_STATUSES, i as CARE_PLAN_PROBLEM_STATUSES, n as CARE_PLAN_ACTION_STATUSES, o as carePlansSql, r as CARE_PLAN_GOAL_STATUSES, s as carePlansSqlOptions, t as CARE_PLAN_ACTION_KINDS } from "./care-plans-sql-B__5eEaI.js";
36
36
  import { a as casesSqlOptions, i as CASE_STATUSES, r as CASE_STATS_GROUPS, t as CASE_ACTION_TYPES } from "./cases-values-DMWz7VPN.js";
37
37
  import { t as catalogSqlOptions } from "./options-BD2yc6ZW.js";
38
38
  import { t as commentsSqlOptions } from "./options-D2E1rdl1.js";
@@ -86,11 +86,11 @@ import { t as oauthServerSqlOptions } from "./options-BiSW8oLm.js";
86
86
  import { t as observationsSqlOptions } from "./options-BNRQevXM.js";
87
87
  import { t as onboardingSqlOptions } from "./options-BKLYKPxy.js";
88
88
  import { t as optionSetsSqlOptions } from "./options-CggBzOJ5.js";
89
- import { A as assignWhen, B as templateColumnSql, C as storefrontOption, D as uniqueViolationOn, E as columnDefaults, F as sequenceEntry, G as rankAfter, H as templateRowsOf, I as sequences, K as rankBackfill, L as excludeTemplates, M as scopeSql, N as sequenceFormatOf, O as withColumnDefault, P as withFixedNumber, R as liveRowsIndex, S as productSettingTypes, T as catalogRank, U as templateTriggerReturn, V as templateGuardSql, W as RANK_KEY_PATTERN, _ as categoryExtras, a as asService, b as productExtras, c as guard$12, d as orderTemplatesOn, f as paymentWindow, g as amountOf, h as SLUG$7, i as amountOf$1, j as hasLegalEntityColumn, k as assignNumberSql, l as orderFields, m as transitionFunction, o as assignNumber$1, p as serviceOnlyGuard, q as ordersSqlOptions, r as orderReads, s as columns, t as ORDER_READS, u as orderPayload, v as guard$11, w as variantExtras, x as productFunctions$1, y as optionFunctions, z as sourceTemplateColumnSql } from "./orders-reads-CWCAZHgZ.js";
89
+ import { A as assignWhen, B as templateColumnSql, C as storefrontOption, D as uniqueViolationOn, E as columnDefaults, F as sequenceEntry, G as rankAfter, H as templateRowsOf, I as sequences, K as rankBackfill, L as excludeTemplates, M as scopeSql, N as sequenceFormatOf, O as withColumnDefault, P as withFixedNumber, R as liveRowsIndex, S as productSettingTypes, T as catalogRank, U as templateTriggerReturn, V as templateGuardSql, W as RANK_KEY_PATTERN, _ as categoryExtras, a as asService, b as productExtras, c as guard$12, d as orderTemplatesOn, f as paymentWindow, g as amountOf, h as SLUG$7, i as amountOf$1, j as hasLegalEntityColumn, k as assignNumberSql, l as orderFields, m as transitionFunction, o as assignNumber$1, p as serviceOnlyGuard, q as ordersSqlOptions, r as orderReads, s as columns, t as ORDER_READS, u as orderPayload, v as guard$11, w as variantExtras, x as productFunctions$1, y as optionFunctions, z as sourceTemplateColumnSql } from "./orders-reads-BGMu5-Ug.js";
90
90
  import { a as organizationsSqlOptions, i as invitationsSqlOptions, n as ORGANIZATION_READS, r as organizationOverview } from "./organizations-overview-P_-d0K-l.js";
91
91
  import { t as outboxSqlOptions } from "./options-BBRvZUrV.js";
92
92
  import { t as passesSqlOptions } from "./options-MlhPEf5z.js";
93
- import { $ as qualifiedTable$2, A as editableContracts, B as entryEnded, C as leaveOwner, D as recordOwner, E as ownerIsEmployee, F as splitName, G as boundSubjectMatch, H as lockedColumns, I as feedOptions, J as liveShareLink, K as boundSubjects$1, L as feedWindow, M as majorSalary, N as overlappingContracts, O as FLAT_DETAILS, P as reportsMoveUp, Q as onSettings, R as byEmployee, S as leaveConfidentialReader, T as leavePartsMapped, U as timeOwner, V as entrySubjects, W as boundRowSubject, X as touchShareLink, Y as shareLinkRow, Z as andSubjectAction, _ as leaveBalancesTable, a as leaveEndPart, at as subjectTableBindings, b as leaveConfidentialFilter, c as leavePartial, ct as tableCascades, d as leaveTeamFeedSubject, dt as tryColumnType, et as subjectAccess, f as leaveTypeKey, ft as payrollExportSqlOptions, g as leaveAutoApproveMapped, h as leaveAutoApprove, it as subjectReadable, j as flatDetails, k as denyOverlaps, l as leaveRequestUser, lt as asColumnType, m as halfDays, nt as subjectCascades, o as leaveFeed, ot as subjectTypeGuard, p as dropSignatures, q as SHARE_LINKS, rt as subjectIdMatches, s as leaveFeedSubject, st as subjectsOption, t as PAYROLL_EXPORT, tt as subjectActionCheck, u as leaveStartPart, ut as columnTypeFunctions, v as leaveByEmployee, w as leaveParts, x as leaveConfidentialKey, y as leaveConfidential, z as durationEntries } from "./payroll-export-CIVukFDd.js";
93
+ import { $ as qualifiedTable$2, A as editableContracts, B as entryEnded, C as leaveOwner, D as recordOwner, E as ownerIsEmployee, F as splitName, G as boundSubjectMatch, H as lockedColumns, I as feedOptions, J as liveShareLink, K as boundSubjects$1, L as feedWindow, M as majorSalary, N as overlappingContracts, O as FLAT_DETAILS, P as reportsMoveUp, Q as onSettings, R as byEmployee, S as leaveConfidentialReader, T as leavePartsMapped, U as timeOwner, V as entrySubjects, W as boundRowSubject, X as touchShareLink, Y as shareLinkRow, Z as andSubjectAction, _ as leaveBalancesTable, a as leaveEndPart, at as subjectTableBindings, b as leaveConfidentialFilter, c as leavePartial, ct as tableCascades, d as leaveTeamFeedSubject, dt as tryColumnType, et as subjectAccess, f as leaveTypeKey, ft as payrollExportSqlOptions, g as leaveAutoApproveMapped, h as leaveAutoApprove, it as subjectReadable, j as flatDetails, k as denyOverlaps, l as leaveRequestUser, lt as asColumnType, m as halfDays, nt as subjectCascades, o as leaveFeed, ot as subjectTypeGuard, p as dropSignatures, q as SHARE_LINKS, rt as subjectIdMatches, s as leaveFeedSubject, st as subjectsOption, t as PAYROLL_EXPORT, tt as subjectActionCheck, u as leaveStartPart, ut as columnTypeFunctions, v as leaveByEmployee, w as leaveParts, x as leaveConfidentialKey, y as leaveConfidential, z as durationEntries } from "./payroll-export-kpVJj_Gj.js";
94
94
  import { t as permissionsSqlOptions } from "./options-B3DU_tjC.js";
95
95
  import { t as pipelinesSqlOptions } from "./options-t8W7XEHD.js";
96
96
  import { t as postsSqlOptions } from "./options-BfnSHM0_.js";
@@ -134,40 +134,40 @@ import { t as waitlistSqlOptions } from "./options-CzP_V8dF.js";
134
134
  import { n as webhooksOutSqlOptions, t as webhooksInSqlOptions } from "./options-BKrQcqTf.js";
135
135
  import { t as MAX_BATCH$1 } from "./batch-limit-DqQ3d6op.js";
136
136
  import { $ as userGrant, A as notNullCheckName, B as replaceColumnCheck, C as insertExtraColumns, D as memberAddedRecord, E as lockTable, F as raise$1, G as sha256HexSql, H as schemaPreamble, I as readLine, J as transitionActorSql, K as shortHash, L as recordTrigger, M as ownRowPolicies, N as pageSize, O as membershipDisabledAt, P as quotedTable, Q as updatedAt, R as registerPartitions, S as fail, T as jwtClaim, U as serviceGrant, V as revokeTable, W as serviceOnly$1, X as triggerGrant, Y as transitionReasonSql, Z as updateExtraColumns, _ as disabledHelpersNeedLaterTables, a as SERVICE_CALLER$1, at as grantTable, b as extraFieldsArg, c as addCheck, d as batchFunction, et as withExtraFields, f as columnRef, g as disabledHelpers, h as defaultPartitionName, i as PARTITION_VARIABLES, j as organizationMissing, k as membershipSuspended, l as addForeignKey, m as defaultPartition, n as MONTHLY_PARTITIONS, nt as createTable$1, o as accessDefinesDisabledHelpers, p as columnsObject, q as splitTable$1, r as NOTHING, rt as enableRowSecurity, s as activeMembership, t as EQUIVALENT_TRIGGERS, tt as writeExtraColumns, u as addNotNullCheck, v as dropExpiredPartitions, w as jsonSchemaChecks, x as extraFieldsJson, y as ensureCheck, z as renameSql } from "./shared-D-qwk29i.js";
137
- import { a as registeredIdMatches, c as teamActions, d as subjectPermissionKey, f as subjectPermissionOf, i as logsSubjectReads, l as tenantColumnOf, n as auditedSubjects, o as registeredSubjects, r as checkCall, t as uniqueContributions, u as urlExpression } from "./contributions-Bh-HcHoJ.js";
137
+ import { a as registeredIdMatches, c as teamActions, d as subjectPermissionKey, f as subjectPermissionOf, i as logsSubjectReads, l as tenantColumnOf, n as auditedSubjects, o as registeredSubjects, r as checkCall, t as uniqueContributions, u as urlExpression } from "./contributions-Ba-C1ueE.js";
138
138
  import { n as SUBJECT_TYPE_SQL_PATTERN, r as subjectTypeIdent } from "./subject-type-BarjdHZV.js";
139
139
  import { d as templatePlaceholders, i as fillTemplate } from "./access-sql-Dvl7BRy0.js";
140
- import { a as moduleOperations, c as roleNames, d as tenantScope, i as isOperationModule$1, l as roleScopeIs, n as OPERATIONS$1, o as modulePermission, r as accessModel, s as modulePermissionKey, u as rolesOf } from "./permissions-model-CYfIupG0.js";
140
+ import { a as isOperationModule$1, c as modulePermissionKey, d as rolesOf, f as tenantScope, i as accessModel, l as roleNames, n as INTERACTIVE_ONLY_OPERATIONS, o as moduleOperations, r as OPERATIONS$1, s as modulePermission, u as roleScopeIs } from "./permissions-model-B7E_f7GV.js";
141
141
  import { a as readGrants, c as renderPolicy, i as policy$1, n as closingParen$1, o as readPolicies, r as maskSql, s as readPolicy$6, t as catalogPolicy } from "./policy-Buem9L_M.js";
142
142
  import { i as CHECKOUT_SESSION_STATUSES, n as AGENT_MANDATE_TYPES, r as CHECKOUT_PROTOCOLS, t as AGENT_MANDATE_STATUSES } from "./agent-checkout-values-Cn6rZgn4.js";
143
143
  import { t as AI_MESSAGE_PART_TYPES } from "./ai-message-cnroprVB.js";
144
144
  import { t as FINAL_RUN_STATES$1 } from "./run-state-DGiyDQxH.js";
145
145
  import { a as rankKeys, n as RANK_REBALANCE_QUEUE, t as RANK_ALPHABET } from "./rank-keys-CEBzd9Xa.js";
146
+ import { r as operationPermission, t as OPERATION_PREFIXES } from "./operations-BNFbWv1t.js";
146
147
  import { i as APPRAISAL_STATUSES, n as APPRAISAL_CYCLE_STATUSES, r as APPRAISAL_REVIEW_KINDS, t as APPRAISAL_ANONYMITY } from "./appraisals-values-Cf2GBgyC.js";
147
148
  import { t as declareRead } from "./reads-CWVqw2JB.js";
148
149
  import { r as NEGATIVE, t as FILTER_OPERATORS } from "./filter-query-Cm2fvkE9.js";
149
- import { _ as UNMATCH_REFERENCE, a as BATCH_ITEMS_TABLE, c as batchContract, d as batchTablesSql, f as hasBatches, g as TRANSACTION_STATUSES, h as STATEMENT_FORMATS, i as BATCHES_TABLE, l as batchFunctions, m as MATCH_TARGETS, p as MATCH_REFERENCE, r as bankingReads, t as BANK_READS, u as batchSettle, v as bankingSql, y as linked$8 } from "./banking-reads-4m0_lltt.js";
150
+ import { _ as UNMATCH_REFERENCE, a as BATCH_ITEMS_TABLE, c as batchContract, d as batchTablesSql, f as hasBatches, g as TRANSACTION_STATUSES, h as STATEMENT_FORMATS, i as BATCHES_TABLE, l as batchFunctions, m as MATCH_TARGETS, p as MATCH_REFERENCE, r as bankingReads, t as BANK_READS, u as batchSettle, v as bankingSql, y as linked$8 } from "./banking-reads-Baaatsuj.js";
150
151
  import { t as ISO_4217_MINOR_UNITS } from "./iso4217-oKsif_hW.js";
151
152
  import { a as moveStock, c as stockHistory, d as variantTracked, i as locationsOf, l as strict, n as guard$13, o as reservationFunctions, r as locationFunctions, s as stockFunctions, t as columns$1, u as threshold } from "./inventory-stock-D7rVAss1.js";
152
153
  import { a as CARE_BUILT_IN_SOURCE, i as CARE_ALERT_STATUSES, n as CARE_ALERT_KINDS, o as CARE_RULE_KINDS, r as CARE_ALERT_SEVERITIES, t as CARE_ALERT_DECISIONS } from "./clinical-decision-support-values-Bk1AzL7L.js";
153
154
  import { t as DAM_RENDITION_STATUSES } from "./dam-values-C1SGxSoe.js";
154
155
  import { a as EXCEPTION_RESULTS, c as LAST_FURNISHING_FACT, d as OBSERVED_FALLS_ON, f as OBSERVED_MOVES, g as ROLL_DAYS, h as PART_STATUSES, i as DEADLINE_STATES, l as META_LIMIT, m as OFFSET_UNITS, o as FIRST_FURNISHING_FACT, p as OFFSET_LIMIT, r as DEADLINE_RESULTS, t as DEADLINE_ADJUSTMENTS, u as NOTE_LIMIT, v as RULE_VERSION_STATUSES, y as WEEKDAYS } from "./deadlines-values-vmaCCdGl.js";
155
156
  import { i as FORM_SCHEMA_DIALECT, o as UNSCORED_FIELD_TYPES, r as FORM_MAX_LENGTH, t as FORM_DEFINITION_SCHEMA } from "./form-definition-DbyY2DKZ.js";
156
- import { r as operationPermission, t as OPERATION_PREFIXES } from "./operations-BNFbWv1t.js";
157
157
  import { i as MAINTENANCE_PRIORITIES, n as MAINTENANCE_PLAN_KINDS, r as MAINTENANCE_PLAN_STATUSES, t as MAINTENANCE_CALIBRATION_RESULTS } from "./maintenance-values-DlqhkGvQ.js";
158
158
  import { a as metricsOf, i as grainDivides, t as METRIC_GRAINS } from "./metric-definition-D4H6IQT7.js";
159
159
  import { t as PERIOD_STATUSES } from "./periods-values-DeeudWL4.js";
160
160
  import { n as RFQ_STATUSES, r as RFQ_SUPPLIER_STATUSES, t as RFQ_QUOTE_STATUSES } from "./rfqs-values-BgIYOeVa.js";
161
161
  import { n as AUTHZ_TOPIC, t as AUTHZ_EVENT } from "./authz-topic-D7fPUY4P.js";
162
162
  import { a as TRACKING_STATUSES, i as SHIPMENT_STATUSES, n as LINE_DIRECTIONS, r as RETURN_DISPOSITIONS, t as LABEL_FORMATS } from "./statuses-Qqpzda35.js";
163
- import { a as taxSql, n as EU_SALES_KINDS, r as RETURN_STATUSES, t as EPOCH } from "./tax-sql-DrR78UUW.js";
163
+ import { a as taxSql, n as EU_SALES_KINDS, r as RETURN_STATUSES, t as EPOCH } from "./tax-sql-sSJTtYtF.js";
164
164
  import { i as TILL_SESSION_STATUSES, n as TILL_MOVEMENT_INFLOWS, r as TILL_MOVEMENT_KINDS, t as TILL_DEPOSIT_STATUSES } from "./tills-values-DoUJ0B__.js";
165
165
  import { n as PICK_LIST_STATUSES, r as PICK_WAVE_STATUSES, t as PICK_LINE_STATUSES } from "./warehouse-values-CyoqvWRp.js";
166
166
  import { n as WARRANTY_STATUSES } from "./warranty-values-BJo_g1F1.js";
167
- import { n as WORKFLOW_SDK_WORLD } from "./workflow-sdk-c025kSHf.js";
167
+ import { n as WORKFLOW_SDK_WORLD } from "./workflow-sdk-IPsOMGEC.js";
168
168
  import { s as permissionMatches$1 } from "./delegation-CnCIKysL.js";
169
169
  import { n as quoteIdent, t as compileSql } from "./sql-DqCwJ2qB.js";
170
- import { t as provideConnectionRuntime } from "./define-runtime-full-DeuaXsV7.js";
170
+ import { t as provideConnectionRuntime } from "./define-runtime-full-B_cMkyCk.js";
171
171
  // src/sql/api-schema.ts
172
172
  /** The roles PostgREST runs a request as. */
173
173
  const API_ROLES = /* @__PURE__ */ new Set([
@@ -12271,7 +12271,7 @@ const readIfAny = (statement, rows, when) => statement === "" ? "" : `\n if jso
12271
12271
  // src/sql/subject-check-sql.ts
12272
12272
  /**
12273
12273
  * SQL that is true when `type`/`id` (text expressions) names a record in
12274
- * `config.subjects` that belongs to tenant `tenant` and that the caller can
12274
+ * `config.recordTypes` that belongs to tenant `tenant` and that the caller can
12275
12275
  * read through `can_subject`. Types without a tenant column never match. The
12276
12276
  * module must require `subjects`.
12277
12277
  */
@@ -12285,8 +12285,8 @@ ${subjects.map((subject) => ` when ${sqlString(subject.type)} then exists (
12285
12285
  end and ${canSubject}(${type}, ${id}, 'read'))`;
12286
12286
  }
12287
12287
  /**
12288
- * SQL for the tenant (as text) of record `type`/`id` in `config.subjects`, or
12289
- * null for an unknown record or type. Reads the table directly, so use it in
12288
+ * SQL for the tenant (as text) of record `type`/`id` in `config.recordTypes`,
12289
+ * or null for an unknown record or type. Reads the table directly, so use it in
12290
12290
  * security definer code after checking the caller.
12291
12291
  */
12292
12292
  function subjectTenant(ctx, type, id) {
@@ -12298,9 +12298,9 @@ ${subjects.map((subject) => ` when ${sqlString(subject.type)} then (select
12298
12298
  end)`;
12299
12299
  }
12300
12300
  /**
12301
- * SQL for the title (as text) of record `type`/`id` in `config.subjects`, from
12302
- * the entry's `title` column, or null for an unknown record or a type without
12303
- * one. Reads the table directly, so check the caller first.
12301
+ * SQL for the title (as text) of record `type`/`id` in `config.recordTypes`,
12302
+ * from the entry's `title` column, or null for an unknown record or a type
12303
+ * without one. Reads the table directly, so check the caller first.
12304
12304
  */
12305
12305
  function subjectTitle(ctx, type, id) {
12306
12306
  const subjects = registeredSubjects(ctx.subjects, ctx.naming).filter((subject) => subject.config.title !== void 0);
@@ -20190,17 +20190,35 @@ function providerRowCheck(ctx, where, rows, key) {
20190
20190
  }))} else false end)`;
20191
20191
  };
20192
20192
  }
20193
+ /**
20194
+ * `providerRowCheck` for a set reader: one `rowsWith` call answers every
20195
+ * candidate id of a statement (ADR 0434), where the check calls it once per
20196
+ * row. It runs as the caller, so only `authorization.functions.rowsWith`
20197
+ * applies.
20198
+ */
20199
+ function providerRowSet(ctx, where, rows, key) {
20200
+ const rowsWith = ctx.providerRowsWith;
20201
+ if (rowsWith === void 0) throw new TypeError(`${where}.rows needs blocks.permissions.model "provider" and an authorization provider with functions.rowsWith`);
20202
+ const permission = sqlString(key);
20203
+ return (ids) => `select r.id::text from ${fillTemplate("authorization.functions.rowsWith", rowsWith, {
20204
+ resource: rows,
20205
+ permission,
20206
+ ids
20207
+ })} as r(id)`;
20208
+ }
20193
20209
  // src/sql/modules/drive-roles.ts
20194
20210
  const QUALIFIED$3 = /^[A-Za-z_][\w$]*\.[A-Za-z_][\w$]*$/;
20195
20211
  function providerRoles(ctx, all, at, rows, map) {
20196
20212
  if (!isResourceName(rows) || !isRecord$1(map) || Object.keys(map).length === 0 || !Object.entries(map).every(([role, key]) => all.includes(role) && typeof key === "string" && key !== "")) throw new TypeError(`${at} takes { rows, roles }: the provider's resource name and a permission key for each of options.roles it grants`);
20197
20213
  const checks = all.filter((role) => map[role] !== void 0).toReversed().map((role) => ({
20198
20214
  role,
20199
- check: providerRowCheck(ctx, at, rows, String(map[role]))
20215
+ check: providerRowCheck(ctx, at, rows, String(map[role])),
20216
+ set: providerRowSet(ctx, at, rows, String(map[role]))
20200
20217
  }));
20201
20218
  return {
20202
20219
  label: `the authorization provider's grants on ${rows}`,
20203
- role: (id, user) => `case ${checks.map(({ role, check }) => `when ${check(id, user)} then ${sqlString(role)}`).join(" ")} end`
20220
+ role: (id, user) => `case ${checks.map(({ role, check }) => `when ${check(id, user)} then ${sqlString(role)}`).join(" ")} end`,
20221
+ readable: (candidates) => checks.map(({ set }) => set(candidates)).join("\n union\n ")
20204
20222
  };
20205
20223
  }
20206
20224
  /** `options.roleFunctions`: app functions that return the caller's role. */
@@ -20231,7 +20249,7 @@ function driveRoleFunctions(ctx, all) {
20231
20249
  // src/sql/subject-write.ts
20232
20250
  /**
20233
20251
  * Whether the caller holds the `write` key a registered subject type names
20234
- * (`config.subjects.<type>.permissions.write`) in `tenant`. `true` for types
20252
+ * (`config.recordTypes.<type>.permissions.write`) in `tenant`. `true` for types
20235
20253
  * without one, so a module's own check decides.
20236
20254
  */
20237
20255
  function subjectWritable(ctx, subjects, args) {
@@ -23442,7 +23460,7 @@ function build$148(ctx, layout) {
23442
23460
  const provider = accessModel(ctx) === "provider" ? layout.accessProvider : void 0;
23443
23461
  const fn = (name) => ctx.fn(name);
23444
23462
  return `${schemaPreamble(ctx)}${recordTeamTable(ctx)}
23445
- -- The app's subject registry (config.subjects, ADR 0020). Each function runs
23463
+ -- The app's subject registry (config.recordTypes, ADR 0020). Each function runs
23446
23464
  -- as the caller, so the subject table's own policies decide what is visible.
23447
23465
  create or replace function ${fn("subject_types")}()
23448
23466
  returns text[]
@@ -23522,7 +23540,7 @@ $$;
23522
23540
  ${userGrant(`${fn("subject_titles")}(jsonb)`)}
23523
23541
 
23524
23542
  -- True when the caller can see the subject row and, for an action with a
23525
- -- key in config.subjects.<type>.permissions, holds that key in the
23543
+ -- key in config.recordTypes.<type>.permissions, holds that key in the
23526
23544
  -- subject's tenant (or on the record, through the subject's scope), and the
23527
23545
  -- action's check function, when it names one, returns true for the row.
23528
23546
  create or replace function ${fn("can_subject")}(subject_type text, subject_id text, action text)
@@ -23587,7 +23605,7 @@ ${userGrant(`${fn("record_summary")}(text, text, text[], timestamptz)`)}
23587
23605
 
23588
23606
  -- can_subject for another user, for server code that decides who receives
23589
23607
  -- an event. It reads the row past its policies and asks can_user for the
23590
- -- action's key in config.subjects.<type>.permissions, so an action without
23608
+ -- action's key in config.recordTypes.<type>.permissions, so an action without
23591
23609
  -- a key is false and a share-link grant never counts. A provider that
23592
23610
  -- can't answer for others (no idsWithFor) gives false.
23593
23611
  create or replace function ${fn("can_subject_for")}(member uuid, subject_type text, subject_id text, action text)
@@ -23744,7 +23762,7 @@ const SUBJECTS = {
23744
23762
  name: "subjects",
23745
23763
  scopes: ["tenant"],
23746
23764
  title: "Subjects",
23747
- description: "The app-wide subject registry from config.subjects: subject_title, subject_url, subject_titles, can_subject, can_subject_for and record_summary for every registered type, my_work across the installed blocks, record teams (subject_members, add_subject_member, end_subject_member, list_subject_members, my_subjects) that grant subjects.<type>.team actions, read logging for types with subjects.<type>.auditReads (record_subject_read, subject_access_log), and Realtime presence on presence:<type>:<id> for readers of the subject.",
23765
+ description: "The app-wide subject registry from config.recordTypes: subject_title, subject_url, subject_titles, can_subject, can_subject_for and record_summary for every registered type, my_work across the installed blocks, record teams (subject_members, add_subject_member, end_subject_member, list_subject_members, my_subjects) that grant subjects.<type>.team actions, read logging for types with subjects.<type>.auditReads (record_subject_read, subject_access_log), and Realtime presence on presence:<type>:<id> for readers of the subject.",
23748
23766
  requires: ["permissions"],
23749
23767
  integrates: [
23750
23768
  "teams",
@@ -33603,6 +33621,63 @@ const ANNOUNCEMENTS = {
33603
33621
  build: build$138,
33604
33622
  topics: (ctx) => [ctx.text("topic", "announcements")]
33605
33623
  };
33624
+ // src/sql/modules/permissions-operations.ts
33625
+ const isOperationModule = (name) => Object.hasOwn(MODULE_PERMISSION_SCOPES, name);
33626
+ /**
33627
+ * The permission key of every operation the layout knows: each installed
33628
+ * module's `OPERATIONS` after `blocks.<name>.permissions` renames, with the
33629
+ * provider's `authorization.operations` over them.
33630
+ */
33631
+ function operationKeys(ctx, layout) {
33632
+ const keys = /* @__PURE__ */ new Map();
33633
+ for (const module of ctx.installedModules) {
33634
+ if (!isOperationModule(module)) continue;
33635
+ const of = moduleContext(module, layout, ctx.installedModules);
33636
+ if (of.mode === "custom") continue;
33637
+ for (const [action, fallback] of Object.entries(moduleOperations(module))) keys.set(`${module}.${action}`, modulePermissionKey(of, action, fallback));
33638
+ }
33639
+ const operations = layout.accessProvider?.operations;
33640
+ for (const name of Object.keys(operations ?? {})) {
33641
+ const key = operationPermission(operations, name, keys.get(name));
33642
+ if (key !== void 0) keys.set(name, key);
33643
+ }
33644
+ return keys;
33645
+ }
33646
+ /**
33647
+ * The permission keys only a signed-in user gets: the installed
33648
+ * `INTERACTIVE_ONLY_OPERATIONS` after renames, with
33649
+ * `authorization.delegation.interactiveOnly` and
33650
+ * `blocks.permissions.interactiveOnly`.
33651
+ */
33652
+ function interactiveOnlyKeys(ctx, layout) {
33653
+ const keys = operationKeys(ctx, layout);
33654
+ return [.../* @__PURE__ */ new Set([
33655
+ ...INTERACTIVE_ONLY_OPERATIONS.flatMap((op) => keys.get(op) ?? []),
33656
+ ...layout.delegationInteractiveOnly ?? [],
33657
+ ...ctx.modules.permissions?.interactiveOnly ?? []
33658
+ ])].toSorted();
33659
+ }
33660
+ /**
33661
+ * `operation_permission(op)`: the key an operation checks, `null` for one
33662
+ * nobody declared.
33663
+ */
33664
+ function operationsSql(ctx, layout) {
33665
+ const keys = [...operationKeys(ctx, layout)].toSorted(([a], [b]) => a.localeCompare(b));
33666
+ return `
33667
+ -- The permission key an operation (<module>.<action>, or a name in
33668
+ -- authorization.operations) checks, after renames and the provider's table.
33669
+ -- Null for an operation nobody declared, which callers refuse.
33670
+ create or replace function better_supabase.operation_permission(op text)
33671
+ returns text
33672
+ language sql
33673
+ immutable
33674
+ set search_path = ''
33675
+ as $$
33676
+ select ${keys.length === 0 ? "null::text" : `case op
33677
+ ${keys.map(([name, key]) => `when ${sqlString(name)} then ${sqlString(key)}`).join("\n ")}
33678
+ end`}
33679
+ $$;`;
33680
+ }
33606
33681
  // src/sql/modules/api-keys.ts
33607
33682
  const EVENTS$33 = {
33608
33683
  "api_key.created": {
@@ -33772,6 +33847,9 @@ function build$137(ctx, layout) {
33772
33847
  if exists (select 1 from unnest(coalesce(scopes, '{}')) s where s <> all (${sqlString(`{${allowed.join(",")}}`)}::text[])) then
33773
33848
  ${fail("API_KEY_SCOPE_UNKNOWN", "A scope is not one of blocks.api-keys.options.scopes", "22023")}
33774
33849
  end if;` : "";
33850
+ const interactiveCheck = interactiveScopeCheck(interactiveOnlyKeys(ctx, layout));
33851
+ const mapsScopes = ctx.of("permissions").mode !== "custom";
33852
+ const withinToken = (scopes) => tokenScopeCheck(scopes, mapsScopes);
33775
33853
  const state = (alias) => `case
33776
33854
  when ${alias}.${c("revokedAt")} is not null and ${alias}.${c("revokedAt")} <= now() then 'revoked'
33777
33855
  when ${alias}.${c("expiresAt")} is not null and ${alias}.${c("expiresAt")} <= now() then 'expired'
@@ -33908,7 +33986,7 @@ begin
33908
33986
  ) then
33909
33987
  ${fail("API_KEY_FORBIDDEN", "Not allowed to create API keys for every tenant")}
33910
33988
  end if;
33911
- end if;${scopeCheck}${wildcard}
33989
+ end if;${scopeCheck}${interactiveCheck}${withinToken("scopes")}${wildcard}
33912
33990
  if expires_at is not null and expires_at <= now() then
33913
33991
  ${fail("API_KEY_EXPIRED", "expires_at is in the past", "22023")}
33914
33992
  end if;
@@ -33983,7 +34061,7 @@ begin
33983
34061
  select * into old from ${t} k where k.${c("id")} = rotate_api_key.key for update;
33984
34062
  if old.${c("id")} is null or not ${mayChange("old")} then
33985
34063
  ${fail("API_KEY_NOT_FOUND", "API key not found", "P0002")}
33986
- end if;
34064
+ end if;${withinToken(`old.${c("scopes")}`)}
33987
34065
  if old.${c("revokedAt")} is not null and old.${c("revokedAt")} <= now() then
33988
34066
  ${fail("API_KEY_REVOKED", "A revoked API key cannot be rotated", "22023")}
33989
34067
  end if;
@@ -34162,6 +34240,44 @@ const API_KEYS = {
34162
34240
  ],
34163
34241
  build: build$137
34164
34242
  };
34243
+ /** Refuses an interactive-only permission key as a key scope. */
34244
+ function interactiveScopeCheck(interactive) {
34245
+ return interactive.length === 0 ? "" : `
34246
+ if exists (select 1 from unnest(coalesce(scopes, '{}')) s where s = any (${sqlString(`{${interactive.join(",")}}`)}::text[])) then
34247
+ ${fail("API_KEY_FORBIDDEN", "Only a signed-in user may use this permission, so an API key cannot carry it")}
34248
+ end if;`;
34249
+ }
34250
+ /**
34251
+ * An API key, OAuth client or agent hands on at most its own scopes: a key's
34252
+ * scopes (or *), or the keys the token's OAuth scopes map to.
34253
+ */
34254
+ function tokenScopeCheck(scopes, mapsScopes) {
34255
+ return `
34256
+ if (auth.jwt() -> 'api_key' is not null
34257
+ or coalesce(auth.jwt() ->> 'client_id', '') <> ''
34258
+ or auth.jwt() -> 'act' is not null) and exists (
34259
+ select 1 from unnest(coalesce(${scopes}, '{}')) s
34260
+ where not case
34261
+ when auth.jwt() -> 'api_key' is not null then
34262
+ coalesce(auth.jwt() -> 'api_key' -> 'scopes', '[]'::jsonb) ?| array['*', s]
34263
+ else exists (
34264
+ select 1
34265
+ from unnest(case jsonb_typeof(auth.jwt() -> 'scope')
34266
+ when 'string' then regexp_split_to_array(btrim(auth.jwt() ->> 'scope'), '\\s+')
34267
+ when 'array' then array(select jsonb_array_elements_text(auth.jwt() -> 'scope'))
34268
+ else '{}'::text[]
34269
+ end) t(scope)
34270
+ where t.scope <> ''
34271
+ and (t.scope = s${mapsScopes ? ` or exists (
34272
+ select 1 from unnest(better_supabase.scope_permissions(t.scope)) k(key)
34273
+ where better_supabase.permission_matches(k.key, s)
34274
+ )` : ""})
34275
+ )
34276
+ end
34277
+ ) then
34278
+ ${fail("API_KEY_FORBIDDEN", "A token may only give a key the scopes it holds itself")}
34279
+ end if;`;
34280
+ }
34165
34281
  // src/sql/modules/appraisals-rubrics.ts
34166
34282
  /**
34167
34283
  * Whether the caller must not learn who wrote a review. Only peer reviews are
@@ -70629,7 +70745,7 @@ begin
70629
70745
  ${fail("COLLECTION_INVALID", "scope must be user, team or tenant", "22023")}
70630
70746
  end if;
70631
70747
  if create_collection.subject_type is null or not (create_collection.subject_type = any (${names.subjectTypes})) then
70632
- ${fail("COLLECTION_SUBJECT_TYPE_UNKNOWN", "not a subject type in config.subjects", "22023")}
70748
+ ${fail("COLLECTION_SUBJECT_TYPE_UNKNOWN", "not a subject type in config.recordTypes", "22023")}
70633
70749
  end if;
70634
70750
  if v_name is null then
70635
70751
  ${fail("COLLECTION_NAME_REQUIRED", "a name is required", "23502")}
@@ -71505,7 +71621,7 @@ function build$117(ctx, layout) {
71505
71621
  return `${schemaPreamble(ctx)}
71506
71622
  -- Favorites (a member's starred records, ranked for a sidebar), lists (named,
71507
71623
  -- static collections of one subject type) and saved items (a member's records
71508
- -- to come back to, with a reminder) on config.subjects records.
71624
+ -- to come back to, with a reminder) on config.recordTypes records.
71509
71625
  ${tables$49(ctx, names)}${ctx.manages ? policies(ctx, names) : ""}${collectionFunctions(ctx, names)}${starFunctions(ctx, names)}${savedItemFunctions(ctx, names)}${subjectCascades(ctx, cascading(ctx), `delete from ${ctx.table("entries")} where ${en("subjectType")} = v_type and ${en("subjectId")} = v_id;
71510
71626
  delete from ${ctx.table("favorites")} where ${fa("subjectType")} = v_type and ${fa("subjectId")} = v_id;
71511
71627
  delete from ${ctx.table("savedItems")} where ${sv("subjectType")} = v_type and ${sv("subjectId")} = v_id;`)}`;
@@ -84959,7 +85075,7 @@ function keyCheck(ctx, perType, fallback, kind, at) {
84959
85075
  }
84960
85076
  /**
84961
85077
  * The subjects whose field values follow record reads: `readAccess` on the
84962
- * record type (`config.subjects.<type>` or `on.<type>`), else the module's
85078
+ * record type (`config.recordTypes.<type>` or `on.<type>`), else the module's
84963
85079
  * `options.readAccess`.
84964
85080
  */
84965
85081
  function recordReadSubjects(subjects, fallback) {
@@ -85310,8 +85426,8 @@ const FIELD_VALUE_IMPORT_ENTITY = "field_value";
85310
85426
  const zeroUuid = "'00000000-0000-0000-0000-000000000000'::uuid";
85311
85427
  /**
85312
85428
  * The subject types field definitions can name: `blocks.custom-fields.on`, else
85313
- * `config.subjects` with the entities of the installed blocks. Empty when the
85314
- * app registers none, and then an entity stays free text.
85429
+ * `config.recordTypes` with the entities of the installed blocks. Empty when
85430
+ * the app registers none, and then an entity stays free text.
85315
85431
  */
85316
85432
  function registeredEntities(ctx) {
85317
85433
  return fieldSubjects(ctx).map(([type]) => type);
@@ -86017,7 +86133,7 @@ ${keyedFields(ctx, {
86017
86133
  const recordSubjects = recordReadSubjects(subjects, readAccess);
86018
86134
  const keyed = subjects.find(([, subject]) => subject.extra["keys"] !== void 0);
86019
86135
  if (keyed !== void 0) throw new TypeError(`blocks.custom-fields.on.${keyed[0]}.keys applies only to layout "keyed"`);
86020
- if (readAccess === "record" && subjects.length === 0) throw new TypeError("blocks.custom-fields.options.readAccess \"record\" needs record types in config.subjects or blocks.custom-fields.on");
86136
+ if (readAccess === "record" && subjects.length === 0) throw new TypeError("blocks.custom-fields.options.readAccess \"record\" needs record types in config.recordTypes or blocks.custom-fields.on");
86021
86137
  const subjectWrite = subjectActionCheck(ctx, subjects, {
86022
86138
  type: "set_field_value.subject_type",
86023
86139
  id: "set_field_value.subject_id"
@@ -88940,7 +89056,7 @@ grant execute on function ${ctx.fn("request_subject_export")}(text, text, text)
88940
89056
  const lookup = types.length === 0 ? fail("DATA_EXPORT_SUBJECT", "No record type can be exported", "22023") : `case request_subject_export.subject_type
88941
89057
  ${types.map((type) => recordBranch(ctx, type, omits)).join("\n ")}
88942
89058
  else
88943
- ${fail("DATA_EXPORT_SUBJECT", "subject_type is not a record type in config.subjects", "22023")}
89059
+ ${fail("DATA_EXPORT_SUBJECT", "subject_type is not a record type in config.recordTypes", "22023")}
88944
89060
  end case;`;
88945
89061
  const managed = ctx.installed("subjects") ? types.filter((type) => Object.hasOwn(ctx.subjects[type]?.permissions ?? {}, "manage")) : [];
88946
89062
  const manage = managed.length === 0 ? "" : ` or (request_subject_export.subject_type in (${managed.map((type) => sqlString(type)).join(", ")}) and coalesce(${ctx.of("subjects").fn("can_subject")}(request_subject_export.subject_type, request_subject_export.subject_id, 'manage'), false))`;
@@ -89889,7 +90005,7 @@ const DATA_LIFECYCLE = {
89889
90005
  },
89890
90006
  {
89891
90007
  from: 6,
89892
- description: "request_subject_export exports one config.subjects record (subject 'record'): its row decrypted through its reveal function and every module's rows attached to it, held in data_export_contents until the export job writes them. data_exports gains subject_type, subject_id and format, one named subject check replaces the generated ones, and the data_export events carry subjectType and subjectId.",
90008
+ description: "request_subject_export exports one config.recordTypes record (subject 'record'): its row decrypted through its reveal function and every module's rows attached to it, held in data_export_contents until the export job writes them. data_exports gains subject_type, subject_id and format, one named subject check replaces the generated ones, and the data_export events carry subjectType and subjectId.",
89893
90009
  sql: () => ""
89894
90010
  },
89895
90011
  {
@@ -91474,7 +91590,7 @@ ${lockTable(deadlines, { read: true })}
91474
91590
 
91475
91591
  -- Whether the caller may read the subject a deadline belongs to: its row is
91476
91592
  -- visible to them (the subject table's own policies apply) and they hold its
91477
- -- read permission, as blocks.deadlines.on or config.subjects declares it.
91593
+ -- read permission, as blocks.deadlines.on or config.recordTypes declares it.
91478
91594
  -- Without subjects every subject passes; with them an unlisted type fails.
91479
91595
  -- plpgsql, so a subject table a later module creates binds late.
91480
91596
  create or replace function ${fn("deadline_subject_readable")}(subject_type text, subject_id text, tenant ${idType})
@@ -102851,11 +102967,22 @@ ${driveRole === void 0 ? ` select d.${d("id")} from ${D} d
102851
102967
  and ${rank(`dg.${dg("role")}`)} >= ${rank(sqlString(roles.read))}
102852
102968
  and ${rank(sqlString(roles.read))} > 0
102853
102969
  and d.${d("tenant")} in (select ${ctx.scope.ids(read)})
102854
- and ${drivePrincipalMatch("dg", "auth.uid()", `d.${d("tenant")}`)}` : ` select d.${d("id")} from ${D} d
102970
+ and ${drivePrincipalMatch("dg", "auth.uid()", `d.${d("tenant")}`)}` : driveRole.readable === void 0 ? ` select d.${d("id")} from ${D} d
102971
+ where ${SERVICE_CALLER$1}
102972
+ or (auth.uid() is not null
102973
+ and d.${d("tenant")} in (select ${ctx.scope.ids(read)})
102974
+ and (${driveRole.role(`d.${d("id")}`, "auth.uid()")}) = any (${rolesArray}))` : ` with candidates as materialized (
102975
+ select coalesce(array_agg(d.${d("id")}::text), '{}'::text[]) as ids from ${D} d
102976
+ where auth.uid() is not null
102977
+ and d.${d("tenant")} in (select ${ctx.scope.ids(read)})
102978
+ )
102979
+ select d.${d("id")} from ${D} d
102855
102980
  where ${SERVICE_CALLER$1}
102856
102981
  or (auth.uid() is not null
102857
102982
  and d.${d("tenant")} in (select ${ctx.scope.ids(read)})
102858
- and (${driveRole.role(`d.${d("id")}`, "auth.uid()")}) = any (${rolesArray}))`}
102983
+ and d.${d("id")}::text in (
102984
+ ${driveRole.readable("(select c.ids from candidates c)")}
102985
+ ))`}
102859
102986
  $$;
102860
102987
  ${userGrant(`${fn("drive_drive_readable_ids")}()`)}
102861
102988
  ` : ""}
@@ -102911,7 +103038,7 @@ $$;
102911
103038
  ${userGrant(`${fn("drive_can")}(uuid, text)`)}
102912
103039
 
102913
103040
  -- Whether the caller may read the node: the read role on it, so a check
102914
- -- function in config.subjects can follow drive grants.
103041
+ -- function in config.recordTypes can follow drive grants.
102915
103042
  create or replace function ${fn("drive_node_readable")}(node uuid)
102916
103043
  returns boolean
102917
103044
  language sql
@@ -102976,11 +103103,22 @@ ${nodeRole === void 0 ? ` select x.${n("id")} from ${T} x
102976
103103
  and ${rank(`dg.${dg("role")}`)} >= ${rank(sqlString(roles.read))}
102977
103104
  and ${rank(sqlString(roles.read))} > 0
102978
103105
  and x.${n("tenant")} in (select ${ctx.scope.ids(read)})
102979
- and ${drivePrincipalMatch("dg", "auth.uid()", `x.${n("tenant")}`)}` : ""}` : ` select x.${n("id")} from ${T} x
103106
+ and ${drivePrincipalMatch("dg", "auth.uid()", `x.${n("tenant")}`)}` : ""}` : nodeRole.readable === void 0 ? ` select x.${n("id")} from ${T} x
103107
+ where ${SERVICE_CALLER$1}
103108
+ or (auth.uid() is not null
103109
+ and x.${n("tenant")} in (select ${ctx.scope.ids(read)})
103110
+ and (${nodeRole.role(`x.${n("id")}`, "auth.uid()")}) = any (${rolesArray}))` : ` with candidates as materialized (
103111
+ select coalesce(array_agg(x.${n("id")}::text), '{}'::text[]) as ids from ${T} x
103112
+ where auth.uid() is not null
103113
+ and x.${n("tenant")} in (select ${ctx.scope.ids(read)})
103114
+ )
103115
+ select x.${n("id")} from ${T} x
102980
103116
  where ${SERVICE_CALLER$1}
102981
103117
  or (auth.uid() is not null
102982
103118
  and x.${n("tenant")} in (select ${ctx.scope.ids(read)})
102983
- and (${nodeRole.role(`x.${n("id")}`, "auth.uid()")}) = any (${rolesArray}))`}
103119
+ and x.${n("id")}::text in (
103120
+ ${nodeRole.readable("(select c.ids from candidates c)")}
103121
+ ))`}
102984
103122
  $$;
102985
103123
  ${userGrant(`${fn("drive_readable_ids")}()`)}
102986
103124
 
@@ -105064,9 +105202,9 @@ const INTEGRATES$1 = [
105064
105202
  * of them; `drive-files` adds what needs those modules.
105065
105203
  */
105066
105204
  /**
105067
- * Access requests on nodes, when config.subjects gives the node type a team: an
105068
- * approved request becomes a node grant, and the members who may share the node
105069
- * approve it.
105205
+ * Access requests on nodes, when config.recordTypes gives the node type a team:
105206
+ * an approved request becomes a node grant, and the members who may share the
105207
+ * node approve it.
105070
105208
  */
105071
105209
  function accessRequests(own, target) {
105072
105210
  if (own.mode === "custom" || !target.installed("subjects")) return [];
@@ -106358,7 +106496,7 @@ function fromApplication(ctx, n) {
106358
106496
  const jobType = asText$3(hiring, "jobs", hiring.label("jobs", "employmentType", `v_job.${j("employmentType")}`));
106359
106497
  return `
106360
106498
  -- The employee for a hired application, in preboarding: the name comes from
106361
- -- the candidate's record in config.subjects, and the job title, team and
106499
+ -- the candidate's record in config.recordTypes, and the job title, team and
106362
106500
  -- employment type from the job. attrs overrides any of them. Calling it
106363
106501
  -- again returns the same employee, and with the relations module the
106364
106502
  -- employee is created_from the application.
@@ -111501,7 +111639,7 @@ const NAMES$88 = {
111501
111639
  const COLUMN$9 = /^[a-z_][a-z0-9_]{0,62}$/u;
111502
111640
  /**
111503
111641
  * `blocks.field-history.on`, record type to `{ fields }`, checked against
111504
- * `config.subjects`.
111642
+ * `config.recordTypes`.
111505
111643
  */
111506
111644
  function historyBindings(ctx) {
111507
111645
  const registry = registeredSubjects(ctx.subjects, ctx.naming);
@@ -111512,7 +111650,7 @@ function historyBindings(ctx) {
111512
111650
  const listed = Object.entries(onSettings(ctx)).map(([type, settings]) => {
111513
111651
  const where = `blocks.field-history.on.${type}`;
111514
111652
  const subject = registry.find((item) => item.type === type);
111515
- if (subject?.tenant === void 0) throw new TypeError(`${where}: register "${type}" with a tenant column in config.subjects first`);
111653
+ if (subject?.tenant === void 0) throw new TypeError(`${where}: register "${type}" with a tenant column in config.recordTypes first`);
111516
111654
  const fields = isRecord$1(settings) ? settings["fields"] : void 0;
111517
111655
  if (!Array.isArray(fields) || fields.length === 0 || fields.some((field) => typeof field !== "string" || !COLUMN$9.test(field))) throw new TypeError(`${where}.fields must be a non-empty list of column names`);
111518
111656
  return {
@@ -116413,7 +116551,7 @@ ${readPolicy("products", ctx.scope.check(p("tenant"), read))}
116413
116551
  create table if not exists ${awards} (
116414
116552
  ${w("id")} uuid primary key default gen_random_uuid(),
116415
116553
  ${w("tenant")} ${ctx.idType} not null,
116416
- -- The record the award is for, a type in config.subjects.
116554
+ -- The record the award is for, a type in config.recordTypes.
116417
116555
  ${w("subjectType")} text not null,
116418
116556
  ${w("subjectId")} text not null,
116419
116557
  -- The contacts company or person that pays, holding the funder role.
@@ -119873,7 +120011,7 @@ end;
119873
120011
  $$;
119874
120012
  ${userGrant(`${fn("save_job")}(${ctx.idType}, uuid, jsonb)`)}
119875
120013
 
119876
- -- An application of a candidate (a record in config.subjects, a person by
120014
+ -- An application of a candidate (a record in config.recordTypes, a person by
119877
120015
  -- default) to an open job. Applying again returns the same application.${appExtras.length > 0 ? "\n-- fields sets the applicationExtraColumns by name." : ""}
119878
120016
  ${appFields.drop(fn("apply_to_job"), "uuid, jsonb, text, uuid")}
119879
120017
  create or replace function ${fn("apply_to_job")}(job uuid, candidate jsonb, source text, owner uuid${appFields.param})
@@ -120253,7 +120391,7 @@ const HIRING = {
120253
120391
  name: "hiring",
120254
120392
  scopes: ["tenant"],
120255
120393
  title: "Hiring",
120256
- description: "Jobs and applications on a pipeline per job, candidates from config.subjects, scorecards per stage, interviews, and hire, reject and withdraw events for the app to act on.",
120394
+ description: "Jobs and applications on a pipeline per job, candidates from config.recordTypes, scorecards per stage, interviews, and hire, reject and withdraw events for the app to act on.",
120257
120395
  requires: [
120258
120396
  "memberships",
120259
120397
  "permissions",
@@ -134382,7 +134520,7 @@ ${userGrant(`${fn("purchase_order_tax_lines")}(uuid)`)}
134382
134520
  -- Creates a draft purchase order (purchase_order null) or replaces a draft's
134383
134521
  -- fields and lines. lines: [{ "variantId": uuid, "quantity": n, "unitCost": "minor units"
134384
134522
  -- }], and per line "taxRateBps" and "taxCode" when the order keeps tax lines.
134385
- -- supplier_type and supplier_id name a config.subjects record, or are both null.
134523
+ -- supplier_type and supplier_id name a config.recordTypes record, or are both null.
134386
134524
  ${numbered ? `drop function if exists ${fn("save_purchase_order")}(${ctx.idType}, uuid, uuid, text, text, text, timestamptz, jsonb, text);\n` : ""}create or replace function ${fn("save_purchase_order")}(tenant ${ctx.idType}, purchase_order uuid, location uuid, supplier_type text, supplier_id text, currency text, expected_at timestamptz, lines jsonb, note text${numbered ? ", number text default null" : ""})
134387
134525
  returns jsonb
134388
134526
  language plpgsql
@@ -136346,11 +136484,11 @@ ${addForeignKey({
136346
136484
  */
136347
136485
  const capFor = (member, permission) => `(${member} is distinct from auth.uid() or better_supabase.cap_allows(${permission}))`;
136348
136486
  /**
136349
- * `scope_permissions` and `cap_allows`: a delegated token (a `client_id`, or an
136350
- * `act` chain that is not a support or impersonation level) holds only the keys
136351
- * its scopes map to, and a `forContext({ permissions })` cap holds only its
136352
- * keys. The access functions apply both, so every policy and module that asks
136353
- * them is narrowed without calling `token_scope_allows`.
136487
+ * `scope_permissions` and `cap_allows`: an API key or a delegated token (a
136488
+ * `client_id`, or an `act` chain that is not a support or impersonation level)
136489
+ * holds only the keys its scopes map to, and a `forContext({ permissions })`
136490
+ * cap holds only its keys. The access functions apply both, so every policy and
136491
+ * module that asks them is narrowed without calling `token_scope_allows`.
136354
136492
  */
136355
136493
  function delegationSql(ctx, layout) {
136356
136494
  const scopes = {
@@ -136358,7 +136496,52 @@ function delegationSql(ctx, layout) {
136358
136496
  ...ctx.modules.permissions?.scopes
136359
136497
  };
136360
136498
  const entries = Object.entries(scopes);
136499
+ const body = entries.length === 0 ? "array[scope]" : `case scope
136500
+ ${entries.map(([scope, keys]) => `when ${sqlString(scope)} then array[${keys.map(sqlString).join(", ")}]::text[]`).join("\n ")}
136501
+ else array[scope]
136502
+ end`;
136503
+ const interactive = interactiveOnlyKeys(ctx, layout);
136504
+ const owner = ctx.installedModules.includes("organizations") ? ctx.of("organizations").text("ownerRole", "owner") : void 0;
136361
136505
  return `
136506
+ -- True for a user's own session and for no token at all. False for an API
136507
+ -- key (api_key), an OAuth client (client_id) and an act chain (an agent, a
136508
+ -- delegation, support or impersonation).
136509
+ create or replace function better_supabase.interactive_session()
136510
+ returns boolean
136511
+ language sql
136512
+ stable
136513
+ set search_path = ''
136514
+ as $$
136515
+ select auth.jwt() is null
136516
+ or (auth.jwt() -> 'api_key' is null
136517
+ and coalesce(auth.jwt() ->> 'client_id', '') = ''
136518
+ and auth.jwt() -> 'act' is null)
136519
+ $$;
136520
+
136521
+ -- The permission keys only a signed-in user gets (the built-in
136522
+ -- interactive-only operations, authorization.delegation.interactiveOnly and
136523
+ -- blocks.permissions.interactiveOnly): cap_allows refuses them to every
136524
+ -- other session, whatever its scopes.
136525
+ create or replace function better_supabase.interactive_only(permission text)
136526
+ returns boolean
136527
+ language sql
136528
+ immutable
136529
+ set search_path = ''
136530
+ as $$
136531
+ select ${interactive.length === 0 ? "false" : `coalesce(permission = any (array[${interactive.map(sqlString).join(", ")}]::text[]), false)`}
136532
+ $$;
136533
+
136534
+ -- The roles only a signed-in user grants or takes away: the organization
136535
+ -- owner role. can_assign refuses them to every other session.
136536
+ create or replace function better_supabase.interactive_only_role(role text)
136537
+ returns boolean
136538
+ language sql
136539
+ immutable
136540
+ set search_path = ''
136541
+ as $$
136542
+ select ${owner === void 0 ? "false" : `coalesce(role = ${sqlString(owner)}, false)`}
136543
+ $$;
136544
+
136362
136545
  -- The permission keys an OAuth scope grants a delegated token
136363
136546
  -- (authorization.delegation.scopes, blocks.permissions.scopes). A scope
136364
136547
  -- without an entry grants the key with its own name.
@@ -136368,15 +136551,14 @@ language sql
136368
136551
  immutable
136369
136552
  set search_path = ''
136370
136553
  as $$
136371
- select ${entries.length === 0 ? "array[scope]" : `case scope
136372
- ${entries.map(([scope, keys]) => `when ${sqlString(scope)} then array[${keys.map(sqlString).join(", ")}]::text[]`).join("\n ")}
136373
- else array[scope]
136374
- end`}
136554
+ select ${body}
136375
136555
  $$;
136376
136556
 
136377
- -- False when the token is narrower than the permission: a permission cap
136378
- -- (bsb_permission_cap) without the key, or a delegated token whose scopes
136379
- -- don't map to it. True for every other token, the service role included.
136557
+ -- False when the token is narrower than the permission: an interactive-only
136558
+ -- key outside a user's own session, a permission cap (bsb_permission_cap)
136559
+ -- without the key, an API key (api_key) or a delegated token whose scopes
136560
+ -- don't map to it. An API key without scopes holds no permission. True
136561
+ -- for every other token, the service role included.
136380
136562
  -- 0.14 named the cap bs_permission_cap; 0.15 still reads it when the new
136381
136563
  -- claim is missing, so a cap from an older runAs keeps narrowing.
136382
136564
  create or replace function better_supabase.cap_allows(permission text)
@@ -136388,11 +136570,22 @@ set search_path = ''
136388
136570
  as $$
136389
136571
  select case
136390
136572
  when jwt is null then true
136573
+ when better_supabase.interactive_only(cap_allows.permission)
136574
+ and not better_supabase.interactive_session() then false
136391
136575
  when jsonb_typeof(cap) = 'array'
136392
136576
  and not exists (
136393
136577
  select 1 from jsonb_array_elements_text(cap) c(key)
136394
136578
  where better_supabase.permission_matches(c.key, cap_allows.permission)
136395
136579
  ) then false
136580
+ when jsonb_typeof(jwt -> 'api_key') = 'object' then exists (
136581
+ select 1
136582
+ from jsonb_array_elements_text(case jsonb_typeof(jwt -> 'api_key' -> 'scopes')
136583
+ when 'array' then jwt -> 'api_key' -> 'scopes'
136584
+ else '[]'::jsonb
136585
+ end) s(scope)
136586
+ cross join lateral unnest(better_supabase.scope_permissions(s.scope)) k(key)
136587
+ where better_supabase.permission_matches(k.key, cap_allows.permission)
136588
+ )
136396
136589
  when coalesce(jwt ->> 'client_id', '') = ''
136397
136590
  and (jwt -> 'act' is null
136398
136591
  or (jsonb_typeof(jwt -> 'act') = 'object'
@@ -136611,49 +136804,6 @@ as $$
136611
136804
  }[wildcards]}
136612
136805
  $$;`;
136613
136806
  }
136614
- // src/sql/modules/permissions-operations.ts
136615
- const isOperationModule = (name) => Object.hasOwn(MODULE_PERMISSION_SCOPES, name);
136616
- /**
136617
- * The permission key of every operation the layout knows: each installed
136618
- * module's `OPERATIONS` after `blocks.<name>.permissions` renames, with the
136619
- * provider's `authorization.operations` over them.
136620
- */
136621
- function operationKeys(ctx, layout) {
136622
- const keys = /* @__PURE__ */ new Map();
136623
- for (const module of ctx.installedModules) {
136624
- if (!isOperationModule(module)) continue;
136625
- const of = moduleContext(module, layout, ctx.installedModules);
136626
- if (of.mode === "custom") continue;
136627
- for (const [action, fallback] of Object.entries(moduleOperations(module))) keys.set(`${module}.${action}`, modulePermissionKey(of, action, fallback));
136628
- }
136629
- const operations = layout.accessProvider?.operations;
136630
- for (const name of Object.keys(operations ?? {})) {
136631
- const key = operationPermission(operations, name, keys.get(name));
136632
- if (key !== void 0) keys.set(name, key);
136633
- }
136634
- return keys;
136635
- }
136636
- /**
136637
- * `operation_permission(op)`: the key an operation checks, `null` for one
136638
- * nobody declared.
136639
- */
136640
- function operationsSql(ctx, layout) {
136641
- const keys = [...operationKeys(ctx, layout)].toSorted(([a], [b]) => a.localeCompare(b));
136642
- return `
136643
- -- The permission key an operation (<module>.<action>, or a name in
136644
- -- authorization.operations) checks, after renames and the provider's table.
136645
- -- Null for an operation nobody declared, which callers refuse.
136646
- create or replace function better_supabase.operation_permission(op text)
136647
- returns text
136648
- language sql
136649
- immutable
136650
- set search_path = ''
136651
- as $$
136652
- select ${keys.length === 0 ? "null::text" : `case op
136653
- ${keys.map(([name, key]) => `when ${sqlString(name)} then ${sqlString(key)}`).join("\n ")}
136654
- end`}
136655
- $$;`;
136656
- }
136657
136807
  // src/sql/modules/permissions-roles.ts
136658
136808
  /**
136659
136809
  * `list_roles` and `set_permission_override`: the catalog's tenant roles with
@@ -136796,6 +136946,7 @@ ${userGrant(`${ctx.fn("set_permission_override")}(${id}, text, text, boolean)`)}
136796
136946
  }
136797
136947
  // src/sql/modules/permissions.ts
136798
136948
  const SERVICE = `coalesce(auth.jwt() ->> 'role', '') = 'service_role'`;
136949
+ const ROLE_GATE = "(better_supabase.interactive_session() or not better_supabase.interactive_only_role(can_assign.role))";
136799
136950
  const NOT_ACTING = `(platform_can.member is distinct from auth.uid() or auth.jwt() -> 'act' is null)`;
136800
136951
  /** Fills `{name}` placeholders of a `blocks.permissions.functions` template. */
136801
136952
  function fill(template, values) {
@@ -137070,7 +137221,7 @@ stable
137070
137221
  security definer
137071
137222
  set search_path = ''
137072
137223
  as $$
137073
- select ${SERVICE} or better_supabase.can_assign_as(auth.uid(), can_assign.tenant, can_assign.role)
137224
+ select ${SERVICE} or (${ROLE_GATE} and better_supabase.can_assign_as(auth.uid(), can_assign.tenant, can_assign.role))
137074
137225
  $$;
137075
137226
  ${platformCanAssign(ctx)}
137076
137227
 
@@ -137351,7 +137502,7 @@ stable
137351
137502
  security definer
137352
137503
  set search_path = ''
137353
137504
  as $$
137354
- select ${SERVICE} or coalesce((${providerCanAssign(ctx, layout)}), false)
137505
+ select ${SERVICE} or (${ROLE_GATE} and coalesce((${providerCanAssign(ctx, layout)}), false))
137355
137506
  $$;`;
137356
137507
  }
137357
137508
  function customFunctions(ctx) {
@@ -137440,11 +137591,11 @@ stable
137440
137591
  security definer
137441
137592
  set search_path = ''
137442
137593
  as $$
137443
- select ${SERVICE} or coalesce((${fill(functions.canAssign, {
137594
+ select ${SERVICE} or (${ROLE_GATE} and coalesce((${fill(functions.canAssign, {
137444
137595
  tenant: "can_assign.tenant",
137445
137596
  role: "can_assign.role",
137446
137597
  roles: "array[can_assign.role]::text[]"
137447
- })}), false)
137598
+ })}), false))
137448
137599
  $$;
137449
137600
 
137450
137601
  create or replace function better_supabase.permission_claims(user_id uuid)
@@ -137551,6 +137702,9 @@ ${[
137551
137702
  "permission_matches(text, text)",
137552
137703
  "scope_permissions(text)",
137553
137704
  "cap_allows(text)",
137705
+ "interactive_session()",
137706
+ "interactive_only(text)",
137707
+ "interactive_only_role(text)",
137554
137708
  "operation_permission(text)",
137555
137709
  `can(text, ${id}, text)`,
137556
137710
  "tenant_ids_with(text)",
@@ -157569,7 +157723,7 @@ ${lockModuleTable(ctx, "medications", { read: true })}
157569
157723
  create table if not exists ${orders} (
157570
157724
  ${o("id")} uuid primary key default gen_random_uuid(),
157571
157725
  ${o("tenant")} ${ctx.idType} not null,
157572
- -- The record the order is for, a type in config.subjects.
157726
+ -- The record the order is for, a type in config.recordTypes.
157573
157727
  ${o("subjectType")} text not null,
157574
157728
  ${o("subjectId")} text not null,
157575
157729
  ${o("medication")} uuid not null,
@@ -170709,8 +170863,8 @@ function optionBindings(ctx) {
170709
170863
  }, ctx.naming);
170710
170864
  return Object.entries(raw).flatMap(([type, fields]) => {
170711
170865
  const subject = registry.find((item) => item.type === type);
170712
- if (subject === void 0) throw new TypeError(`blocks.${ctx.instance}.on.${type}: register "${type}" in config.subjects first`);
170713
- if (subject.tenant === void 0) throw new TypeError(`blocks.${ctx.instance}.on.${type}: config.subjects.${type} needs a tenant column`);
170866
+ if (subject === void 0) throw new TypeError(`blocks.${ctx.instance}.on.${type}: register "${type}" in config.recordTypes first`);
170867
+ if (subject.tenant === void 0) throw new TypeError(`blocks.${ctx.instance}.on.${type}: config.recordTypes.${type} needs a tenant column`);
170714
170868
  return Object.entries(fields).map(([field, entry]) => {
170715
170869
  const where = `blocks.${ctx.instance}.on.${type}.${field}`;
170716
170870
  if (!FIELD$1.test(field) || !isRecord$1(entry)) throw new TypeError(`${where} must be an object under a field name`);
@@ -172834,7 +172988,7 @@ function dropShipFunctions(ctx, names) {
172834
172988
  return `
172835
172989
  -- A draft purchase order for an order's lines, shipped by the supplier
172836
172990
  -- straight to the order's shipping address (drop ship): the supplier is a
172837
- -- config.subjects record (a contacts company by default), the location the
172991
+ -- config.recordTypes record (a contacts company by default), the location the
172838
172992
  -- one the order's lines were reserved at or the first active one, the unit
172839
172993
  -- cost the variant's average cost in the order's currency (0 without one;
172840
172994
  -- edit the draft before placing it). Needs inventory.purchase.
@@ -179461,12 +179615,14 @@ $$;
179461
179615
 
179462
179616
  create or replace function tests.age_import_run(run uuid, age interval)
179463
179617
  returns void
179464
- language sql
179618
+ language plpgsql
179465
179619
  set search_path = ''
179466
179620
  as $$
179621
+ begin
179467
179622
  update better_supabase.import_runs
179468
179623
  set lease_expires_at = now() - age, heartbeat_at = now() - age
179469
- where id = run
179624
+ where id = run;
179625
+ end;
179470
179626
  $$;
179471
179627
 
179472
179628
  -- Moves the stored import stamp into the past so a current subject looks edited.
@@ -179642,8 +179798,8 @@ function pipelineBindings(ctx) {
179642
179798
  return Object.entries(raw).map(([type, entry]) => {
179643
179799
  const where = `blocks.${ctx.instance}.on.${type}`;
179644
179800
  const subject = registry.find((item) => item.type === type);
179645
- if (subject === void 0) throw new TypeError(`${where}: register "${type}" in config.subjects first`);
179646
- if (subject.tenant === void 0) throw new TypeError(`${where}: config.subjects.${type} needs a tenant column`);
179801
+ if (subject === void 0) throw new TypeError(`${where}: register "${type}" in config.recordTypes first`);
179802
+ if (subject.tenant === void 0) throw new TypeError(`${where}: config.recordTypes.${type} needs a tenant column`);
179647
179803
  if (!isRecord$1(entry)) throw new TypeError(`${where} must be an object`);
179648
179804
  const categories = categoriesOf(where, entry["categories"]);
179649
179805
  const optional = (key) => columnOf$1(`${where}.${key}`, entry[key]);
@@ -188241,7 +188397,7 @@ function build$41(ctx) {
188241
188397
  if (ctx.mode === "custom") return "";
188242
188398
  const subjects = ranked(ctx);
188243
188399
  const fn = (name) => ctx.fn(name);
188244
- const unknown = fail("RANK_SUBJECT_UNKNOWN", "this subject type has no rank column in config.subjects", "22023");
188400
+ const unknown = fail("RANK_SUBJECT_UNKNOWN", "this subject type has no rank column in config.recordTypes", "22023");
188245
188401
  const invalid = (arg) => `if ${arg} is not null and ${arg} !~ '^[0-9A-Za-z]*[1-9A-Za-z]$' then
188246
188402
  ${fail("RANK_KEY_INVALID", "not a rank key", "22023")}
188247
188403
  end if;`;
@@ -188408,7 +188564,7 @@ const RANK = {
188408
188564
  name: "rank",
188409
188565
  scopes: ["tenant"],
188410
188566
  title: "Rank",
188411
- description: "Fractional rank keys: rank_between, move() for every config.subjects entry with a rank column (through the caller's policies and any state-machine trigger), and a rebalance job.",
188567
+ description: "Fractional rank keys: rank_between, move() for every config.recordTypes entry with a rank column (through the caller's policies and any state-machine trigger), and a rebalance job.",
188412
188568
  requires: ["permissions", "subjects"],
188413
188569
  integrates: ["queue"],
188414
188570
  target: "schema",
@@ -194011,7 +194167,7 @@ ${lockTable(sql.lines, { read: true })}
194011
194167
  ${readPolicy("lines", l("tenant"))}
194012
194168
 
194013
194169
  -- A supplier invited to quote. supplier_type and supplier_id name a contacts
194014
- -- party (or another config.subjects record without the contacts block).
194170
+ -- party (or another config.recordTypes record without the contacts block).
194015
194171
  create table if not exists ${sql.suppliers} (
194016
194172
  ${s("id")} uuid primary key default gen_random_uuid(),
194017
194173
  ${s("tenant")} ${ctx.idType} not null,
@@ -197736,7 +197892,7 @@ as $$
197736
197892
  $$;
197737
197893
  ${userGrant(`${fn("search_normalize")}(text)`)}
197738
197894
 
197739
- -- Reads one registered subject row (config.subjects.<type>.search) into the
197895
+ -- Reads one registered subject row (config.recordTypes.<type>.search) into the
197740
197896
  -- index, or drops it when the row is gone or soft-deleted (deletedAt).
197741
197897
  create or replace function ${fn("search_refresh")}(subject_type text, subject_id text)
197742
197898
  returns boolean
@@ -197757,7 +197913,7 @@ begin
197757
197913
  case search_refresh.subject_type
197758
197914
  ${cases}
197759
197915
  else
197760
- ${fail("SEARCH_SUBJECT_UNKNOWN", "this subject type has no search entry in config.subjects", "22023")}
197916
+ ${fail("SEARCH_SUBJECT_UNKNOWN", "this subject type has no search entry in config.recordTypes", "22023")}
197761
197917
  end case;
197762
197918
  if not v_found then
197763
197919
  delete from ${docs}
@@ -197983,7 +198139,7 @@ const SEARCH = {
197983
198139
  name: "search",
197984
198140
  scopes: ["tenant"],
197985
198141
  title: "Search",
197986
- description: "A search_documents index kept up by triggers from each config.subjects search entry, with search(q) as the caller (websearch, trigram prefixes, can_subject, hybrid with embeddings), and recents and favorites from the share-links user state.",
198142
+ description: "A search_documents index kept up by triggers from each config.recordTypes search entry, with search(q) as the caller (websearch, trigram prefixes, can_subject, hybrid with embeddings), and recents and favorites from the share-links user state.",
197987
198143
  requires: [
197988
198144
  "memberships",
197989
198145
  "permissions",
@@ -198853,7 +199009,7 @@ function matchingIds(ctx, n) {
198853
199009
  limit ${String(n.maxMembers + 1)}
198854
199010
  ) x;`;
198855
199011
  };
198856
- const unknown = fail("SEGMENT_SUBJECT_UNKNOWN", "The segment's subject type is not registered in config.subjects", "22023");
199012
+ const unknown = fail("SEGMENT_SUBJECT_UNKNOWN", "The segment's subject type is not registered in config.recordTypes", "22023");
198857
199013
  if (n.subjects.length === 0) return unknown;
198858
199014
  return `${n.subjects.map(branch).join("\n els")}
198859
199015
  else
@@ -198930,7 +199086,7 @@ begin
198930
199086
  end if;
198931
199087
  v_type := coalesce(v_old.${s("subjectType")}, segment ->> 'subjectType');
198932
199088
  if v_type is null or v_type not in ${knownList} then
198933
- ${fail("SEGMENT_SUBJECT_UNKNOWN", "subjectType must be a type in config.subjects", "22023")}
199089
+ ${fail("SEGMENT_SUBJECT_UNKNOWN", "subjectType must be a type in config.recordTypes", "22023")}
198934
199090
  end if;
198935
199091
  v_name := coalesce(nullif(trim(segment ->> 'name'), ''), v_old.${s("name")});
198936
199092
  if v_name is null or length(v_name) > 200 then
@@ -201110,11 +201266,12 @@ function hasVersionSource(ctx, layout) {
201110
201266
  /**
201111
201267
  * The `'subject'` pair of a wrapper. With `subjectForTenant` a call that names
201112
201268
  * a tenant gets the subject restricted to it, and a call without one the whole
201113
- * subject.
201269
+ * subject. `subject_tenant` names the tenant the subject is restricted to, so a
201270
+ * seed that a cache keys by user and version says what it covers.
201114
201271
  */
201115
201272
  function subjectSql(subject, subjectForTenant) {
201116
201273
  if (!subject) return "";
201117
- return subjectForTenant === void 0 ? `,\n 'subject', to_jsonb(${subject}())` : `,\n 'subject', case when nullif(args ->> 'tenant', '') is null then to_jsonb(${subject}()) else to_jsonb(${subjectForTenant}) end`;
201274
+ return subjectForTenant === void 0 ? `,\n 'subject', to_jsonb(${subject}())` : `,\n 'subject', case when nullif(args ->> 'tenant', '') is null then to_jsonb(${subject}()) else to_jsonb(${subjectForTenant}) end,\n 'subject_tenant', nullif(args ->> 'tenant', '')`;
201118
201275
  }
201119
201276
  /**
201120
201277
  * One wrapper per `bootstrap` entry: the session check, the authorization
@@ -206868,7 +207025,7 @@ function bindings(ctx) {
206868
207025
  return Object.entries(onSettings(ctx)).map(([type, entry]) => {
206869
207026
  const where = `blocks.${ctx.instance}.on.${type}`;
206870
207027
  const subject = registry.find((item) => item.type === type);
206871
- if (subject?.tenant === void 0) throw new TypeError(`${where}: register "${type}" with a tenant column in config.subjects first`);
207028
+ if (subject?.tenant === void 0) throw new TypeError(`${where}: register "${type}" with a tenant column in config.recordTypes first`);
206872
207029
  if (!isRecord$1(entry)) throw new TypeError(`${where} must be an object`);
206873
207030
  const status = entry["status"];
206874
207031
  const priority = entry["priority"];
@@ -209263,13 +209420,13 @@ function machines(ctx) {
209263
209420
  return [...configured, ...contributed];
209264
209421
  }
209265
209422
  /**
209266
- * The table keys of `config.subjects.<name>`, used when the machine names no
209423
+ * The table keys of `config.recordTypes.<name>`, used when the machine names no
209267
209424
  * table.
209268
209425
  */
209269
209426
  function registered(name, registry, where, naming) {
209270
209427
  const entry = Object.hasOwn(registry, name) ? registry[name] : void 0;
209271
209428
  if (entry === void 0) return {};
209272
- if (entry.tenant === false) throw new TypeError(`${where}: config.subjects.${name} has no tenant column, which a machine needs`);
209429
+ if (entry.tenant === false) throw new TypeError(`${where}: config.recordTypes.${name} has no tenant column, which a machine needs`);
209273
209430
  return {
209274
209431
  table: entry.table,
209275
209432
  ...entry.id !== void 0 && { id: entry.id },
@@ -209324,7 +209481,7 @@ function machine(name, entry, registry, naming) {
209324
209481
  const order = statusList(record["order"], `${where}.order`);
209325
209482
  for (const status of order) if (!statuses.has(status)) throw new TypeError(`${where}.order: ${status} is not a status`);
209326
209483
  const tenantColumn = typeof record["tenant"] === "string" ? record["tenant"] : tenantColumnOf(table, registry, naming);
209327
- if (tenantColumn === void 0) throw new TypeError(`${where}: ${table} has no tenant column in config.subjects, which a machine needs`);
209484
+ if (tenantColumn === void 0) throw new TypeError(`${where}: ${table} has no tenant column in config.recordTypes, which a machine needs`);
209328
209485
  const history = historyOf(record["history"], where, tenantColumn);
209329
209486
  return {
209330
209487
  name,
@@ -210288,7 +210445,7 @@ const STATE_MACHINE = {
210288
210445
  name: "state-machine",
210289
210446
  scopes: ["tenant"],
210290
210447
  title: "State machine",
210291
- description: "Allowed status transitions as the caller, a history row and a status.changed event. A machine can also write a stages timeline and keep a lifecycle row (pause, flags, pinned version). Each machine is a subject table named in options.machines, or a config.subjects type.",
210448
+ description: "Allowed status transitions as the caller, a history row and a status.changed event. A machine can also write a stages timeline and keep a lifecycle row (pause, flags, pinned version). Each machine is a subject table named in options.machines, or a config.recordTypes type.",
210292
210449
  requires: ["memberships", "permissions"],
210293
210450
  integrates: [
210294
210451
  "outbox",
@@ -235516,6 +235673,8 @@ const DESCRIPTION = "Event triggers and triggers on auth tables. They belong to
235516
235673
  * comment lines just above it.
235517
235674
  */
235518
235675
  const UNSCOPED = /(?:^--[^\n]*\n)*(?:^drop event trigger [^;]*;[ \t]*\n)*^create (?:event trigger [^;]*|(?:or replace )?(?:constraint )?trigger [^;]*?\bon\s+"?auth"?\.[^;]*);[ \t]*\n?/gim;
235676
+ /** The `drop event trigger` lines a declarative file must not carry. */
235677
+ const DROP_EVENT_TRIGGER = /^drop event trigger [^;]*;[ \t]*\n/gim;
235519
235678
  /** `contents` without its unscoped statements, and those statements. */
235520
235679
  function takeUnscoped(contents) {
235521
235680
  const statements = [...contents.matchAll(UNSCOPED)].map((match) => match[0].trim());
@@ -235535,7 +235694,7 @@ function withUnscopedFile(files, layout) {
235535
235694
  const rest = files.map((file) => {
235536
235695
  if (file.kind !== "schema") return file;
235537
235696
  const taken = takeUnscoped(file.contents);
235538
- found.push(...taken.statements);
235697
+ found.push(...taken.statements.map((statement) => statement.replaceAll(DROP_EVENT_TRIGGER, "").trim()));
235539
235698
  return taken.statements.length === 0 ? file : {
235540
235699
  ...file,
235541
235700
  contents: taken.rest
@@ -235556,7 +235715,7 @@ function withUnscopedFile(files, layout) {
235556
235715
  module: UNSCOPED_MODULE,
235557
235716
  kind: "schema",
235558
235717
  path: `${dir}/${prefix}_999_${UNSCOPED_MODULE}.sql`,
235559
- contents: `${header}\n\n${found.join("\n\n")}\n`
235718
+ contents: `${header}\n\n${[...new Set(found)].join("\n\n")}\n`
235560
235719
  }];
235561
235720
  }
235562
235721
  // src/sql/policy-names.ts
@@ -236866,6 +237025,7 @@ function moduleLayout(config, testsDir = config.sql.testsDir, readSets = [], ent
236866
237025
  function: config.authorization.versions.function
236867
237026
  } } : {},
236868
237027
  ...config.authorization?.delegation?.scopes ? { delegationScopes: config.authorization.delegation.scopes } : {},
237028
+ ...config.authorization?.delegation?.interactiveOnly ? { delegationInteractiveOnly: config.authorization.delegation.interactiveOnly } : {},
236869
237029
  seedDefaults: config.seed.defaults,
236870
237030
  dir: config.sql.dir,
236871
237031
  prefix: config.sql.prefix,