better-supabase 0.45.0 → 0.46.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 (471) hide show
  1. package/dist/{access-sql-BHat-brX.js → access-sql-8In-gFRf.js} +15 -2
  2. package/dist/{adapter-C0C4jIwI.js → adapter-t7V4k_rU.js} +10 -7
  3. package/dist/{agents-DxhGxwDS.d.ts → agents-D81UAnah.d.ts} +1 -1
  4. package/dist/{ai-chat-LHWztFya.d.ts → ai-chat-BBJvSano.d.ts} +1 -1
  5. package/dist/{ai-schedules-BP0PBKhY.d.ts → ai-schedules-D9mYwQdO.d.ts} +5 -2
  6. package/dist/ai-sdk/agents/index.d.ts +6 -6
  7. package/dist/ai-sdk/batches/index.d.ts +1 -1
  8. package/dist/ai-sdk/chat/index.d.ts +2 -2
  9. package/dist/ai-sdk/embeddings/index.d.ts +2 -2
  10. package/dist/ai-sdk/index.d.ts +2 -2
  11. package/dist/ai-sdk/mcp/index.d.ts +3 -3
  12. package/dist/ai-sdk/memory/index.d.ts +2 -2
  13. package/dist/ai-sdk/memory/index.js +1 -1
  14. package/dist/ai-sdk/workflow/index.d.ts +3 -3
  15. package/dist/{api-CgO8Gin7.d.ts → api-Bxhw2FD2.d.ts} +4 -4
  16. package/dist/{api-DXCaMM2S.js → api-DzqXnR6X.js} +1 -1
  17. package/dist/{api-keys-DINjcAaY.d.ts → api-keys-ClEIzcc3.d.ts} +1 -1
  18. package/dist/{app-tables-Dg9lERHb.d.ts → app-tables-HqT8E90s.d.ts} +1 -1
  19. package/dist/{approvals-CoBe9E2b.d.ts → approvals-lmHzZSgF.d.ts} +1 -1
  20. package/dist/{assistant-DMaZZFps.d.ts → assistant-ewdCgSQn.d.ts} +2 -2
  21. package/dist/astro/index.d.ts +5 -5
  22. package/dist/astro/index.js +4 -4
  23. package/dist/{authorization-CcWVJSsN.d.ts → authorization-CFs44tM2.d.ts} +145 -19
  24. package/dist/{authorization-hooks-u2Z18CAM.d.ts → authorization-hooks-yUgoV4Q7.d.ts} +1 -1
  25. package/dist/better-result/index.d.ts +2 -2
  26. package/dist/{bind-BieIoT6r.d.ts → bind-CUxWEh27.d.ts} +4 -4
  27. package/dist/{block-env-YzSHv579.d.ts → block-env-DddTzDut.d.ts} +4 -4
  28. package/dist/{block-subjects-CTIsFATg.js → block-subjects-y1RNnlLz.js} +1 -1
  29. package/dist/{block-tables-D-UjSTXa.d.ts → block-tables-BNwRNU_D.d.ts} +1 -1
  30. package/dist/blocks/access-requests/index.d.ts +2 -2
  31. package/dist/blocks/activities/index.d.ts +3 -3
  32. package/dist/blocks/agents/index.d.ts +3 -3
  33. package/dist/blocks/ai-cache/index.d.ts +1 -1
  34. package/dist/blocks/ai-chat/index.d.ts +6 -6
  35. package/dist/blocks/ai-files/index.d.ts +1 -1
  36. package/dist/blocks/ai-keys/index.d.ts +3 -3
  37. package/dist/blocks/ai-schedules/index.d.ts +2 -2
  38. package/dist/blocks/announcements/index.d.ts +5 -5
  39. package/dist/blocks/api-keys/index.d.ts +2 -2
  40. package/dist/blocks/approvals/index.d.ts +3 -3
  41. package/dist/blocks/assets/index.d.ts +2 -2
  42. package/dist/blocks/assignment/index.d.ts +3 -3
  43. package/dist/blocks/attachments/index.d.ts +46 -4
  44. package/dist/blocks/attachments/index.js +55 -3
  45. package/dist/blocks/audit/index.d.ts +7 -7
  46. package/dist/blocks/audit/index.js +1 -1
  47. package/dist/blocks/automations/index.d.ts +18 -16
  48. package/dist/blocks/billable-time/index.d.ts +2 -2
  49. package/dist/blocks/billing/index.d.ts +5 -5
  50. package/dist/blocks/bookings/index.d.ts +3 -3
  51. package/dist/blocks/bulk/index.d.ts +2 -2
  52. package/dist/blocks/calendar/index.d.ts +3 -3
  53. package/dist/blocks/catalog/index.d.ts +2 -2
  54. package/dist/blocks/channels/index.d.ts +3 -3
  55. package/dist/blocks/collections/index.d.ts +3 -3
  56. package/dist/blocks/comments/index.d.ts +5 -5
  57. package/dist/blocks/compliance/index.d.ts +11 -11
  58. package/dist/blocks/connectors/index.d.ts +3 -3
  59. package/dist/blocks/contacts/index.d.ts +4 -4
  60. package/dist/blocks/content/index.d.ts +2 -2
  61. package/dist/blocks/contracts/index.d.ts +2 -2
  62. package/dist/blocks/courses/index.d.ts +2 -2
  63. package/dist/blocks/created-by/index.d.ts +1 -1
  64. package/dist/blocks/custom-fields/index.d.ts +2 -2
  65. package/dist/blocks/data-lifecycle/index.d.ts +25 -8
  66. package/dist/blocks/data-lifecycle/index.js +16 -2
  67. package/dist/blocks/deals/index.d.ts +3 -3
  68. package/dist/blocks/dispatch/index.d.ts +2 -2
  69. package/dist/blocks/documents/index.d.ts +2 -2
  70. package/dist/blocks/domains/index.d.ts +2 -2
  71. package/dist/blocks/donations/index.d.ts +2 -2
  72. package/dist/blocks/drive/index.d.ts +221 -8
  73. package/dist/blocks/drive/index.js +269 -19
  74. package/dist/blocks/employees/index.d.ts +4 -4
  75. package/dist/blocks/enrichment/index.d.ts +3 -3
  76. package/dist/blocks/enrollments/index.d.ts +2 -2
  77. package/dist/blocks/entitlements/index.d.ts +3 -3
  78. package/dist/blocks/expenses/index.d.ts +2 -2
  79. package/dist/blocks/field-history/index.d.ts +3 -3
  80. package/dist/blocks/flags/index.d.ts +2 -2
  81. package/dist/blocks/forecasts/index.d.ts +3 -3
  82. package/dist/blocks/forms/index.d.ts +3 -3
  83. package/dist/blocks/goals/index.d.ts +1 -1
  84. package/dist/blocks/guests/index.d.ts +2 -2
  85. package/dist/blocks/hiring/index.d.ts +3 -3
  86. package/dist/blocks/identities/index.d.ts +2 -2
  87. package/dist/blocks/imports/index.d.ts +2 -2
  88. package/dist/blocks/inbox/index.d.ts +6 -6
  89. package/dist/blocks/incidents/index.d.ts +2 -2
  90. package/dist/blocks/index.d.ts +155 -5
  91. package/dist/blocks/index.js +19 -1
  92. package/dist/blocks/inventory/index.d.ts +2 -2
  93. package/dist/blocks/invoices/index.d.ts +4 -3
  94. package/dist/blocks/invoices/index.js +3 -2
  95. package/dist/blocks/knowledge/index.d.ts +3 -3
  96. package/dist/blocks/knowledge/index.js +1 -1
  97. package/dist/blocks/lead-scoring/index.d.ts +1 -1
  98. package/dist/blocks/leases/index.d.ts +2 -2
  99. package/dist/blocks/leave/index.d.ts +2 -2
  100. package/dist/blocks/ledger/index.d.ts +2 -2
  101. package/dist/blocks/mail-sync/index.d.ts +3 -3
  102. package/dist/blocks/memberships/index.d.ts +1 -1
  103. package/dist/blocks/memory/index.d.ts +3 -3
  104. package/dist/blocks/memory/index.js +1 -1
  105. package/dist/blocks/messaging/index.d.ts +7 -7
  106. package/dist/blocks/metrics/index.d.ts +2 -2
  107. package/dist/blocks/mfa/index.d.ts +2 -2
  108. package/dist/blocks/moderation/index.d.ts +2 -2
  109. package/dist/blocks/notifications/index.d.ts +13 -9
  110. package/dist/blocks/notifications/index.js +2 -0
  111. package/dist/blocks/numbering/index.d.ts +2 -2
  112. package/dist/blocks/oauth-server/index.d.ts +2 -2
  113. package/dist/blocks/onboarding/index.d.ts +2 -2
  114. package/dist/blocks/orders/index.d.ts +3 -3
  115. package/dist/blocks/organizations/index.d.ts +4 -4
  116. package/dist/blocks/outbox/index.d.ts +2 -2
  117. package/dist/blocks/passes/index.d.ts +2 -2
  118. package/dist/blocks/permissions/index.d.ts +5 -4
  119. package/dist/blocks/permissions/index.js +3 -2
  120. package/dist/blocks/pipelines/index.d.ts +3 -3
  121. package/dist/blocks/posts/index.d.ts +2 -2
  122. package/dist/blocks/profiles/index.d.ts +1 -1
  123. package/dist/blocks/promotions/index.d.ts +2 -2
  124. package/dist/blocks/push/index.d.ts +4 -4
  125. package/dist/blocks/qualifications/index.d.ts +256 -0
  126. package/dist/blocks/qualifications/index.js +303 -0
  127. package/dist/blocks/queue/index.d.ts +8 -103
  128. package/dist/blocks/queue/index.js +9 -3
  129. package/dist/blocks/quotes/index.d.ts +3 -3
  130. package/dist/blocks/rank/index.d.ts +1 -1
  131. package/dist/blocks/reactions/index.d.ts +5 -5
  132. package/dist/blocks/relations/index.d.ts +2 -2
  133. package/dist/blocks/reminders/index.d.ts +3 -3
  134. package/dist/blocks/reviews/index.d.ts +2 -2
  135. package/dist/blocks/risks/index.d.ts +303 -0
  136. package/dist/blocks/risks/index.js +376 -0
  137. package/dist/blocks/saved-views/index.d.ts +6 -6
  138. package/dist/blocks/scores/index.d.ts +2 -2
  139. package/dist/blocks/search/index.d.ts +4 -4
  140. package/dist/blocks/security-events/index.d.ts +3 -3
  141. package/dist/blocks/segments/index.d.ts +4 -4
  142. package/dist/blocks/sequences/index.d.ts +2 -2
  143. package/dist/blocks/service-accounts/index.d.ts +3 -3
  144. package/dist/blocks/sessions/index.d.ts +2 -2
  145. package/dist/blocks/settings/index.d.ts +3 -3
  146. package/dist/blocks/share-links/index.d.ts +29 -4
  147. package/dist/blocks/share-links/index.js +37 -4
  148. package/dist/blocks/shifts/index.d.ts +334 -0
  149. package/dist/blocks/shifts/index.js +451 -0
  150. package/dist/blocks/shipments/index.d.ts +3 -3
  151. package/dist/blocks/signatures/index.d.ts +2 -2
  152. package/dist/blocks/signing-keys/index.d.ts +2 -2
  153. package/dist/blocks/sla/index.d.ts +3 -3
  154. package/dist/blocks/sso/index.d.ts +3 -3
  155. package/dist/blocks/state-machine/index.d.ts +2 -2
  156. package/dist/blocks/subjects/index.d.ts +13 -5
  157. package/dist/blocks/subjects/index.js +114 -5
  158. package/dist/blocks/tags/index.d.ts +3 -3
  159. package/dist/blocks/tasks/index.d.ts +5 -5
  160. package/dist/blocks/teams/index.d.ts +2 -2
  161. package/dist/blocks/templates/index.d.ts +5 -5
  162. package/dist/blocks/time-tracking/index.d.ts +3 -3
  163. package/dist/blocks/timeline/index.d.ts +6 -6
  164. package/dist/blocks/timeline/index.js +1 -1
  165. package/dist/blocks/trash/index.d.ts +2 -2
  166. package/dist/blocks/undo/index.d.ts +2 -2
  167. package/dist/blocks/updated-at/index.d.ts +1 -1
  168. package/dist/blocks/usage/index.d.ts +2 -2
  169. package/dist/blocks/vercel-marketplace/index.d.ts +2 -2
  170. package/dist/blocks/versions/index.d.ts +2 -2
  171. package/dist/blocks/waitlist/index.d.ts +2 -2
  172. package/dist/blocks/webhooks/index.d.ts +6 -6
  173. package/dist/blocks/webhooks/index.js +2 -1
  174. package/dist/blocks/workflow-editor/index.d.ts +8 -8
  175. package/dist/blocks/workflow-editor/index.js +1 -1
  176. package/dist/blocks/workflows/index.d.ts +6 -6
  177. package/dist/{cache-tags-DrywUP3I.d.ts → cache-tags-DDWP8yDs.d.ts} +2 -2
  178. package/dist/{channel-B_kufDZy.d.ts → channel-DW9iIWgu.d.ts} +3 -1
  179. package/dist/chat-sdk/index.d.ts +2 -2
  180. package/dist/claims/index.d.ts +5 -5
  181. package/dist/claims/index.js +1 -1
  182. package/dist/cli/{add-DcLNy2oN.js → add-B6TTIKos.js} +23 -5
  183. package/dist/cli/{add-B5Gq34wX.js → add-CYH9OE6d.js} +13 -13
  184. package/dist/cli/add-DsgNHrEH.js +1 -0
  185. package/dist/cli/{app-table-files-CcGWy0qX.js → app-table-files-Br1VQgjE.js} +3 -3
  186. package/dist/cli/{app-tables-RbPMD2M3.js → app-tables-FRO1l5rT.js} +2 -2
  187. package/dist/cli/{backfill-BJterqcQ.js → backfill-BgGBBidH.js} +4 -4
  188. package/dist/cli/bin.js +1 -1
  189. package/dist/cli/{blocks-DsAwI_4v.js → blocks-CX_172Ja.js} +1 -1
  190. package/dist/cli/{blocks-BBALfFv-.js → blocks-DZrlz-13.js} +2 -2
  191. package/dist/cli/{cache-DRb1xVPh.js → cache-BgiLj67N.js} +1 -1
  192. package/dist/cli/{codemod-Cpd4DnrL.js → codemod-C86T5p1T.js} +97 -13
  193. package/dist/cli/{command-67WobzTC.js → command-DtQ7P9XP.js} +6 -0
  194. package/dist/cli/{completion-C3nMZgUZ.js → completion-9tK4vX1l.js} +2 -2
  195. package/dist/cli/{completion-Dm0S3ub0.js → completion-DUnYq3GC.js} +2 -2
  196. package/dist/cli/{completion-DSrus7H1.js → completion-djG61QR0.js} +1 -1
  197. package/dist/cli/{config-CGVmcEZa.js → config-05wlBDsJ.js} +1 -1
  198. package/dist/cli/{config-Dy-BAGel.js → config-Cb4swJ2X.js} +32 -10
  199. package/dist/cli/{config-cbK-wiNs.js → config-CwcsseeT.js} +1 -1
  200. package/dist/cli/{content-mapper-D0riSMnP.js → content-mapper-DIO-tycM.js} +2 -2
  201. package/dist/cli/{db-BCVXzXDA.js → db-BND9MSu1.js} +3 -3
  202. package/dist/cli/{doctor-CHmX2gau.js → doctor-BqS2dAI-.js} +98 -21
  203. package/dist/cli/{env-CCT-dMFm.js → env-2zOK0skq.js} +1 -1
  204. package/dist/cli/env-NHlaYmXG.js +1 -0
  205. package/dist/cli/{gen-DB0svRc8.js → gen-CygGjwk4.js} +16 -16
  206. package/dist/cli/index.d.ts +1 -1
  207. package/dist/cli/index.js +8 -8
  208. package/dist/cli/{init-B4fQNe4C.js → init-BMDuL671.js} +10 -10
  209. package/dist/cli/{keys-Dj5sJNj7.js → keys-BUl10CEQ.js} +1 -1
  210. package/dist/cli/{live-Bft5EE70.js → live-BRhu6mk8.js} +2 -2
  211. package/dist/cli/{mcp-BKcS-LZw.js → mcp-DzfSUgqc.js} +3 -3
  212. package/dist/cli/{metadata-CgKNmMsc.js → metadata-Ao_uwhbL.js} +3 -3
  213. package/dist/cli/{migrate-ehxT23Gg.js → migrate-BySeyvYY.js} +2 -2
  214. package/dist/cli/{migration-safety-D2gG-dDs.js → migration-safety-CtSYqXjZ.js} +2 -2
  215. package/dist/cli/{migrations-CQ1Sgz_X.js → migrations-Cnf7TlYZ.js} +2 -2
  216. package/dist/cli/{module-migration-BOPJUkIX.js → module-migration-CKKOcrG0.js} +2 -2
  217. package/dist/cli/{moved-CY0yDtAr.js → moved-QZ-btdFz.js} +1 -1
  218. package/dist/cli/{parse-yAC-NFMq.js → parse-Bd_CRjbn.js} +1 -1
  219. package/dist/cli/{powersync-BTari5WF.js → powersync-BeeW0i26.js} +168 -67
  220. package/dist/cli/powersync-miOelRmt.js +1 -0
  221. package/dist/cli/{print-BMJnlJ8k.js → print-Sdb6L0v4.js} +2 -2
  222. package/dist/cli/{providers-BNZ-OqMI.js → providers-BlkYmOf-.js} +1 -1
  223. package/dist/cli/{prune-workflows-BG55npqs.js → prune-workflows-iRTaOxbs.js} +4 -4
  224. package/dist/cli/{remove-BIqGDE0A.js → remove-DvzSG08w.js} +6 -6
  225. package/dist/cli/{render-BIC4Wctz.js → render-svtBPq7R.js} +118 -18
  226. package/dist/cli/{run-C_slJx8m.js → run-BHhVGtd_.js} +46 -45
  227. package/dist/cli/{run-BJ4_rmHy.js → run-CnafzCVh.js} +14 -14
  228. package/dist/cli/{run-DX4X7xqV.js → run-WD6LyrAZ.js} +2 -2
  229. package/dist/cli/{seed-0r_0aD8_.js → seed-Bc_q0nFf.js} +12 -4
  230. package/dist/cli/seed-DT_k-CGR.js +1 -0
  231. package/dist/cli/{shared-DhpBDjRa.js → shared-By7_hqFX.js} +1 -1
  232. package/dist/cli/{skills-B5p6bDwe.js → skills-CvEA4xdj.js} +1 -1
  233. package/dist/cli/{snapshot-CMJksw-t.js → snapshot-T8fVRXqA.js} +3 -3
  234. package/dist/cli/{source-args-CgCX8KUJ.js → source-args-BiySywDB.js} +1 -1
  235. package/dist/cli/{source-CJilfcq-.js → source-xL7qYX0r.js} +1 -1
  236. package/dist/cli/{spec-CnjHA0br.js → spec-BH7BDCnA.js} +1 -1
  237. package/dist/cli/{spec-Br9cWMbU.js → spec-CU_OO1Gq.js} +3 -3
  238. package/dist/cli/{sql-layout-BCiEl_G5.js → sql-layout-C_-LNpAw.js} +2 -2
  239. package/dist/cli/{stack-CQXLe5j0.js → stack-DM3keIfh.js} +1 -1
  240. package/dist/cli/{sync-Bulv1zyy.js → sync-Bl4Kf4_T.js} +4 -4
  241. package/dist/cli/{table-BAR0cLmU.js → table-DocogEpr.js} +1 -1
  242. package/dist/cli/{upgrade-DTBvTAAV.js → upgrade-BLi83wT-.js} +5 -5
  243. package/dist/cli/{upgrade-C8fiTE3r.js → upgrade-kce809Am.js} +3 -3
  244. package/dist/cli/{version-hhuwVLKj.js → version-D8HDt2fH.js} +1 -1
  245. package/dist/client/index.d.ts +7 -6
  246. package/dist/client/index.js +2 -1
  247. package/dist/client/native/index.d.ts +6 -5
  248. package/dist/client/native/index.js +2 -1
  249. package/dist/{cloud-event-LTUGgt6D.d.ts → cloud-event-Dxy5EZVG.d.ts} +1 -1
  250. package/dist/commerce/index.d.ts +1 -1
  251. package/dist/{composite-BCUNxZCd.d.ts → composite-DNDFvcQc.d.ts} +6 -6
  252. package/dist/{composite-C3lLpMys.js → composite-c7POXFs3.js} +2 -2
  253. package/dist/config/index.d.ts +4 -4
  254. package/dist/config/index.js +4 -4
  255. package/dist/{config-HOXkrND2.js → config--zZjnkYA.js} +1 -1
  256. package/dist/{config-DA_R9O_y.js → config-CAbv8kRz.js} +21 -8
  257. package/dist/{connectors-DTxDzUzD.d.ts → connectors-BQtx-Llh.d.ts} +1 -1
  258. package/dist/{context-BJK9_ppk.d.ts → context-Lhw7PgdA.d.ts} +52 -8
  259. package/dist/contract/index.d.ts +8 -8
  260. package/dist/{controller-TplPQG5m.d.ts → controller-CouRuczb.d.ts} +1 -1
  261. package/dist/{controller-y1kSMuCU.js → controller-DxzV9X72.js} +1 -1
  262. package/dist/{conversion-DwDBNeWT.d.ts → conversion-G2ODS617.d.ts} +1 -1
  263. package/dist/create/index.d.ts +3 -3
  264. package/dist/create/index.js +3 -3
  265. package/dist/create/lite/index.d.ts +3 -3
  266. package/dist/create/lite/index.js +3 -3
  267. package/dist/credentials/index.d.ts +3 -3
  268. package/dist/{data-hooks-BToeAcQ_.js → data-hooks-DDEPFoWv.js} +44 -3
  269. package/dist/{define-DXQHQ2Qy.d.ts → db-blocks-Dgu-HpFb.d.ts} +296 -296
  270. package/dist/{define-block-tFQZ8936.d.ts → define-block-eiBbZ3mM.d.ts} +357 -357
  271. package/dist/{delegation-C2rLpkHO.js → delegation-C0EQp3ss.js} +1 -1
  272. package/dist/edge/index.d.ts +8 -8
  273. package/dist/edge/index.js +6 -6
  274. package/dist/elysia/index.d.ts +1 -1
  275. package/dist/elysia/index.js +1 -1
  276. package/dist/{email-BRm6wMWQ.d.ts → email-_X1-FD9h.d.ts} +1 -1
  277. package/dist/{embeddings-LhxY3bUD.d.ts → embeddings-DJs1UeQt.d.ts} +1 -1
  278. package/dist/{ended-CpyW7_0h.d.ts → ended-XY1q20JM.d.ts} +1 -1
  279. package/dist/{entitlements-SqfT4gk_.d.ts → entitlements-D_vas3Yl.d.ts} +2 -2
  280. package/dist/{envelope-CapD-JtH.js → envelope-CSb4c7xn.js} +1 -1
  281. package/dist/eve/index.d.ts +5 -5
  282. package/dist/eve/index.js +1 -1
  283. package/dist/{eve-DmbLji3M.d.ts → eve-Ck586Yfh.d.ts} +2 -2
  284. package/dist/events/index.d.ts +3 -3
  285. package/dist/{events-BrgD2StJ.d.ts → events-sK2YdMhE.d.ts} +37 -2
  286. package/dist/{executor-DlAtlYxY.d.ts → executor-DAQLygMX.d.ts} +2 -2
  287. package/dist/{executor-kfUaLlQr.d.ts → executor-h4VT8TNz.d.ts} +1 -1
  288. package/dist/expo/index.d.ts +5 -5
  289. package/dist/expo/index.js +3 -3
  290. package/dist/{field-errors-DyWpuH1q.d.ts → field-errors-BFLehpue.d.ts} +22 -10
  291. package/dist/flags-sdk/index.d.ts +1 -1
  292. package/dist/{framework-DydnLrMk.js → framework-DvtET86P.js} +1 -1
  293. package/dist/{framework-C8HFM1bX.d.ts → framework-v4jPUZJ-.d.ts} +7 -7
  294. package/dist/{gateway-DQirTFOg.d.ts → gateway-BEDpSlLD.d.ts} +1 -1
  295. package/dist/h3/index.d.ts +1 -1
  296. package/dist/h3/index.js +1 -1
  297. package/dist/h3/v1/index.d.ts +1 -1
  298. package/dist/h3/v1/index.js +1 -1
  299. package/dist/hono/index.d.ts +10 -10
  300. package/dist/hono/index.js +6 -6
  301. package/dist/{index-0erPlzHd.d.ts → index-BRFHDjCG.d.ts} +19 -5
  302. package/dist/{index-vGZZjCW7.d.ts → index-BoVZxiin.d.ts} +12 -12
  303. package/dist/{index-Brzh6XAW.d.ts → index-CJfDiWQf.d.ts} +4 -2
  304. package/dist/{index-BjN_IQQd.d.ts → index-Cc2q2eaq.d.ts} +18 -5
  305. package/dist/{index-DCyNdhEC.d.ts → index-D2gezcOV.d.ts} +3 -3
  306. package/dist/{index-CwDdMCdH.d.ts → index-D430cWV7.d.ts} +1 -1
  307. package/dist/{index-DcmDWojr.d.ts → index-DYSGzEkY.d.ts} +1 -1
  308. package/dist/{index-DkmorC1b.d.ts → index-eZ8oW-DV.d.ts} +4 -4
  309. package/dist/{index-Ddjcn6i7.d.ts → index-nfYh7R5C.d.ts} +5 -5
  310. package/dist/{index-x2YRPbXr.d.ts → index-wRn2y3XS.d.ts} +5 -5
  311. package/dist/index.d.ts +5 -4
  312. package/dist/index.js +3 -2
  313. package/dist/{instances-DGtu3S0m.js → instances-BUhbreNT.js} +1554 -225
  314. package/dist/{kit-C1GVbhtg.d.ts → kit-CmO46iau.d.ts} +3 -3
  315. package/dist/{knowledge-CCOSNGJp.d.ts → knowledge-BnKrvPT6.d.ts} +22 -4
  316. package/dist/{knowledge-CJnZOaix.js → knowledge-BxFkHBTc.js} +14 -3
  317. package/dist/list/index.d.ts +1 -1
  318. package/dist/{list-query-CF-5EUVX.d.ts → list-query-CnD6uNzs.d.ts} +1 -1
  319. package/dist/mapper/bin.js +7 -7
  320. package/dist/mcp/index.d.ts +3 -3
  321. package/dist/mcp/index.js +4 -4
  322. package/dist/mcp/sdk/index.d.ts +18 -7
  323. package/dist/mcp/sdk/index.js +21 -12
  324. package/dist/nestjs/index.d.ts +2 -2
  325. package/dist/nestjs/index.js +1 -1
  326. package/dist/next/client/index.d.ts +1 -1
  327. package/dist/next/index.d.ts +22 -22
  328. package/dist/next/index.js +7 -7
  329. package/dist/node/index.d.ts +2 -2
  330. package/dist/node/index.js +1 -1
  331. package/dist/{operations-CkgwsViz.d.ts → operations-kNq7cGI7.d.ts} +1 -1
  332. package/dist/{options-CJR59q8s.js → options-B1efbeOv.js} +5 -1
  333. package/dist/options-B3dQnXgp.js +6 -0
  334. package/dist/{options-ByxOMSXu.js → options-BEv5xfPg.js} +3 -1
  335. package/dist/options-BZ5TzeFN.js +12 -0
  336. package/dist/options-CKMLVUel.js +8 -0
  337. package/dist/options-CgIKw9s6.js +9 -0
  338. package/dist/options-D1-2o7kO.d.ts +43 -0
  339. package/dist/{options-CjocPkX1.js → options-EdzV163Y.js} +3 -0
  340. package/dist/orpc/index.d.ts +26 -15
  341. package/dist/orpc/index.js +29 -9
  342. package/dist/otel/index.d.ts +2 -2
  343. package/dist/otel/index.js +5 -5
  344. package/dist/{outbox-DL2737I0.d.ts → outbox-CcISFwgE.d.ts} +2 -2
  345. package/dist/{permissions-vbtGrV26.d.ts → permissions-XrrAYkXm.d.ts} +1 -1
  346. package/dist/{permissions-controller-B4uI5IPH.js → permissions-controller-DYm6sF8k.js} +6 -2
  347. package/dist/{pool-DfDolmmm.d.ts → pool-CQuNr7Nq.d.ts} +1 -1
  348. package/dist/{ports-ClyPs0q6.d.ts → ports-CvOsUmuD.d.ts} +1 -1
  349. package/dist/postgres/index.d.ts +1 -1
  350. package/dist/powersync/index.d.ts +55 -13
  351. package/dist/powersync/index.js +85 -11
  352. package/dist/preset/index.d.ts +3 -3
  353. package/dist/preset/index.js +3 -3
  354. package/dist/{preset-His18bto.js → preset-DFZn_TLi.js} +2 -2
  355. package/dist/{project-D81NwLP6.js → project-BwmNYaZt.js} +5 -5
  356. package/dist/{provider-DxJWo8yD.d.ts → provider-CgYoyX_d.d.ts} +1 -1
  357. package/dist/{push-token-DMOeO8cU.d.ts → push-token-taE-3JNT.d.ts} +1 -1
  358. package/dist/query/index.d.ts +2 -2
  359. package/dist/query/index.js +30 -2
  360. package/dist/rate-limit/index.d.ts +2 -0
  361. package/dist/rate-limit/index.js +1 -0
  362. package/dist/rate-limit-BJyp7iAx.d.ts +109 -0
  363. package/dist/rate-limit-DLZWqcIS.js +94 -0
  364. package/dist/rate-limit-DyQbVEBE.js +123 -0
  365. package/dist/rate-limit-lGysIP9Z.d.ts +79 -0
  366. package/dist/react/index.d.ts +8 -8
  367. package/dist/react/index.js +2 -2
  368. package/dist/react/native/index.d.ts +3 -3
  369. package/dist/react/native/index.js +2 -1
  370. package/dist/react/server.d.ts +8 -8
  371. package/dist/react/server.js +2 -2
  372. package/dist/react/session.d.ts +2 -2
  373. package/dist/{react-DkGGh9FE.js → react-AC0iYStn.js} +13 -6
  374. package/dist/react-router/index.d.ts +5 -5
  375. package/dist/react-router/index.js +4 -4
  376. package/dist/realtime/index.d.ts +4 -4
  377. package/dist/realtime/index.js +1 -1
  378. package/dist/{record-form-BRtDkhLZ.d.ts → record-form-BAIG-cdw.d.ts} +1 -1
  379. package/dist/{record-type-oQxekQTX.js → record-type-BID6K9Vk.js} +1 -1
  380. package/dist/records/index.d.ts +8 -8
  381. package/dist/records/index.js +4 -4
  382. package/dist/{refusal-DjCQCcCj.d.ts → refusal-D19i-uE3.d.ts} +2 -2
  383. package/dist/{refusal-B9w5Bapa.js → refusal-lgW07wlX.js} +1 -1
  384. package/dist/renames-BPU-FSIn.d.ts +36 -0
  385. package/dist/renames-BoN2IHI7.js +161 -0
  386. package/dist/{resolve-CKJMUYRc.d.ts → resolve-C_VNGFjz.d.ts} +1 -1
  387. package/dist/{resource-CrmhNagD.js → resource--iTRgH4N.js} +1 -1
  388. package/dist/{resource-execute-DZeWkyIU.d.ts → resource-execute-CoadG2g7.d.ts} +1 -1
  389. package/dist/{resource-types-D3gmBOeY.d.ts → resource-types-e7vzPJ7t.d.ts} +2 -2
  390. package/dist/{resources-CSjwmcFs.d.ts → resources-DSqe-GbC.d.ts} +1 -1
  391. package/dist/{resources-B2i_nIgJ.js → resources-DqEg3HBk.js} +1 -1
  392. package/dist/{respond-DxS_8bzC.d.ts → respond-C8rBdIBZ.d.ts} +1 -1
  393. package/dist/server/index.d.ts +22 -22
  394. package/dist/server/index.js +7 -7
  395. package/dist/{server-types-DCC-dWKF.d.ts → server-types-Djx3Eb2G.d.ts} +9 -9
  396. package/dist/{session-Ca4clB30.d.ts → session-BgxLbDYu.d.ts} +5 -5
  397. package/dist/{session-status-CYtwZBi5.d.ts → session-status-C4g0QoB_.d.ts} +2 -2
  398. package/dist/{sign-in-BUiy6unD.js → sign-in-Cl7vhgRn.js} +1 -1
  399. package/dist/solid/index.d.ts +11 -11
  400. package/dist/solid/index.js +3 -3
  401. package/dist/solid-start/index.d.ts +5 -5
  402. package/dist/solid-start/index.js +4 -4
  403. package/dist/spec/index.d.ts +2 -2
  404. package/dist/spec/index.js +2 -2
  405. package/dist/{spec-pins-Dd1Qj3Sj.js → spec-pins-C-1kGh8u.js} +1 -1
  406. package/dist/{spec-pins-CRJEZYBW.d.ts → spec-pins-DGbByPMT.d.ts} +1 -1
  407. package/dist/sql/index.d.ts +6 -6
  408. package/dist/sql/index.js +5 -5
  409. package/dist/{sql-D3ihagTr.js → sql-TpANPmq7.js} +8961 -2083
  410. package/dist/sqlite/index.d.ts +1 -1
  411. package/dist/ssr/index.d.ts +4 -4
  412. package/dist/storage/index.js +1 -1
  413. package/dist/{subject-readers-nnYmRpv8.d.ts → subject-readers-yxQ3r1qw.d.ts} +1 -1
  414. package/dist/{subjects-BGwLJ3IB.d.ts → subjects-BpUQpZhk.d.ts} +30 -2
  415. package/dist/subjects-D3BE9Q8J.d.ts +173 -0
  416. package/dist/{support-BzXcdRLG.d.ts → support-B1n33r32.d.ts} +4 -4
  417. package/dist/{support-view-DNZh8-wA.d.ts → support-view-CkN2Wr1r.d.ts} +1 -1
  418. package/dist/svelte/index.d.ts +10 -10
  419. package/dist/svelte/index.js +3 -3
  420. package/dist/sveltekit/index.d.ts +6 -6
  421. package/dist/sveltekit/index.js +4 -4
  422. package/dist/{tags-CpFIpRw8.d.ts → tags-BCjWVMKO.d.ts} +1 -1
  423. package/dist/tanstack-db/index.d.ts +1 -1
  424. package/dist/tanstack-start/index.d.ts +5 -5
  425. package/dist/tanstack-start/index.js +4 -4
  426. package/dist/{tenant-DyZZDYmm.d.ts → tenant-CBWFqFy0.d.ts} +1 -1
  427. package/dist/testing/index.d.ts +35 -31
  428. package/dist/testing/index.js +5 -4
  429. package/dist/{timeline-Bs-FGMIJ.js → timeline-B3pBRGv9.js} +1 -1
  430. package/dist/{timeline-Df8GMPkZ.d.ts → timeline-Cy7XP2pq.d.ts} +3 -3
  431. package/dist/{topic-BtoL1fKf.js → topic-BC3p90lS.js} +1 -1
  432. package/dist/{topic-B4fSui6P.d.ts → topic-BWJAJkF3.d.ts} +3 -3
  433. package/dist/{types-mYxPduXR.d.ts → types-B5qUEVWI.d.ts} +22 -16
  434. package/dist/{types-DJfGy-40.d.ts → types-B_2C7bqG.d.ts} +1 -1
  435. package/dist/{types-BeXhugiI.d.ts → types-Dlir1n-q.d.ts} +2 -2
  436. package/dist/{types-D6GlpLD9.d.ts → types-sBLcw65Z.d.ts} +2 -2
  437. package/dist/{vault-nYFV6WUD.d.ts → vault-BVLUu_Ph.d.ts} +1 -1
  438. package/dist/vercel-connect/index.d.ts +1 -1
  439. package/dist/vercel-sandbox/index.d.ts +1 -1
  440. package/dist/{verify-DxTccsBh.d.ts → verify-DlKjgAEj.d.ts} +1 -1
  441. package/dist/{view-DwXy8N6Y.d.ts → view-GSwP0y5o.d.ts} +1 -1
  442. package/dist/vue/index.d.ts +11 -11
  443. package/dist/vue/index.js +3 -3
  444. package/dist/{watch-topic-DShzD8ul.d.ts → watch-topic-BfaaK5SW.d.ts} +1 -1
  445. package/dist/{rate-limit-BJ4EMdAy.js → webhook-inbox-C94C_zIV.js} +3 -119
  446. package/dist/workflow-sdk/builder/index.d.ts +3 -3
  447. package/dist/workflow-sdk/builder/index.js +1 -1
  448. package/dist/workflow-sdk/index.d.ts +1 -1
  449. package/dist/workflow-sdk/index.js +1 -1
  450. package/dist/workflow-sdk/world/index.d.ts +1 -1
  451. package/dist/workflow-sdk/world/index.js +1 -1
  452. package/dist/{workflow-sdk-q2jnEaAJ.js → workflow-sdk-CZa83j_U.js} +1 -1
  453. package/dist/{workflow-sdk-ClwzLwNe.d.ts → workflow-sdk-DiDsEArJ.d.ts} +2 -2
  454. package/dist/{workflow-sdk-Bps7tpOv.js → workflow-sdk-DmHaJHUL.js} +170 -115
  455. package/dist/{workflows-ZGDa9twb.d.ts → workflows-D1Ax0qSC.d.ts} +4 -4
  456. package/dist/yjs/index.d.ts +1 -1
  457. package/dist/yjs/index.js +1 -1
  458. package/package.json +17 -1
  459. package/schemas/config-v1.json +201 -2
  460. package/schemas/doctor-report-v1.json +2 -0
  461. package/skills/better-supabase/SKILL.md +2 -1
  462. package/skills/better-supabase/references/ui-recipes.md +1062 -15
  463. package/skills/better-supabase-api/SKILL.md +1 -1
  464. package/dist/cli/add-D_JV6V6k.js +0 -1
  465. package/dist/cli/env-AFfMXxWw.js +0 -1
  466. package/dist/cli/powersync-B8GWjT_L.js +0 -1
  467. package/dist/cli/seed-DX1NTTOK.js +0 -1
  468. package/dist/rate-limit-C89Yzwd9.d.ts +0 -48
  469. package/dist/rate-limit-DXJbLVg0.js +0 -48
  470. package/dist/subjects-DgP5x73R.d.ts +0 -86
  471. package/dist/{kit-CB3AfM9W.js → kit-C-uC7_aG.js} +1 -1
@@ -7035,8 +7035,8 @@ function TaskRows({ tasks }: { tasks: readonly AiTaskRow[] }) {
7035
7035
 
7036
7036
  /**
7037
7037
  * The caller's scheduled AI tasks, read on the server through `aiTasks.list`,
7038
- * with each task's next occurrence and its latest run. An admin with `ai.admin`
7039
- * sees every task in the organization.
7038
+ * with each task's next occurrence and its latest run. An admin with
7039
+ * `ai_schedules.manage` sees every task in the organization.
7040
7040
  */
7041
7041
  export function AiTaskQueue({ read }: { read: AiTasksRead }) {
7042
7042
  const t = useExtracted("aiTasks");
@@ -10486,6 +10486,129 @@ function SharingPanel({
10486
10486
  }
10487
10487
  ```
10488
10488
 
10489
+ ## File request upload
10490
+
10491
+ The public page of a file request link, where anyone with the link sends a file into a folder, with the link's password when it has one. It loads its data on the server through the block's client; the [drive](https://bettersupabase.com/blocks/drive), [share-links](https://bettersupabase.com/blocks/share-links) blocks must be installed (`npx better-supabase add drive share-links`). Page: https://bettersupabase.com/recipes/file-request-upload.
10492
+
10493
+ Web, with shadcn components:
10494
+
10495
+ ```bash
10496
+ npx shadcn add badge button card empty field input
10497
+ ```
10498
+
10499
+ ```tsx title="apps/examples/nextjs/src/features/drive/components/file-request-upload.tsx"
10500
+ /**
10501
+ * The public page of a file request link: pick a file and send it into the
10502
+ * folder, with the link's password when it has one. The sender never sees what
10503
+ * the folder holds.
10504
+ */
10505
+ export function FileRequestUpload({ token }: { token: string }) {
10506
+ const t = useExtracted("drive");
10507
+ const fieldId = useId();
10508
+ const errorMessage = useErrorMessage();
10509
+ const [password, setPassword] = useState<"none" | "asked" | "wrong">("none");
10510
+ const [sent, setSent] = useState<string | null>(null);
10511
+
10512
+ const form = useActionForm(sendToFileRequest, {
10513
+ resetOnSuccess: false,
10514
+ onSuccess: (result, element) => {
10515
+ if (result.passwordRequired) {
10516
+ setPassword((current) => (current === "none" ? "asked" : "wrong"));
10517
+
10518
+ return;
10519
+ }
10520
+
10521
+ element.reset();
10522
+ setSent(result.name);
10523
+ },
10524
+ });
10525
+
10526
+ const error = form.error === undefined ? null : errorMessage(form.error);
10527
+ const locked = password !== "none";
10528
+ const wrongPassword = password === "wrong";
10529
+
10530
+ return (
10531
+ <Card data-recipe="file-request-upload">
10532
+ <CardHeader>
10533
+ <CardTitle>{t("Send files")}</CardTitle>
10534
+ <CardDescription>
10535
+ {t("Files you send go straight to the folder's owner.")}
10536
+ </CardDescription>
10537
+ </CardHeader>
10538
+ <CardContent>
10539
+ {sent === null ? (
10540
+ <form {...form.formProps} className="flex flex-col gap-4">
10541
+ <input type="hidden" name="token" value={token} />
10542
+ <FieldGroup>
10543
+ <Field data-invalid={form.fieldErrors["file"] ? true : undefined}>
10544
+ <FieldLabel htmlFor={`${fieldId}-file`}>{t("File")}</FieldLabel>
10545
+ <Input
10546
+ id={`${fieldId}-file`}
10547
+ name="file"
10548
+ type="file"
10549
+ required
10550
+ />
10551
+ <FieldDescription>{t("Up to 1 MB per file.")}</FieldDescription>
10552
+ </Field>
10553
+ {locked ? (
10554
+ <Field data-invalid={wrongPassword ? true : undefined}>
10555
+ <FieldLabel htmlFor={`${fieldId}-password`}>
10556
+ {t("Password")}
10557
+ </FieldLabel>
10558
+ <Input
10559
+ id={`${fieldId}-password`}
10560
+ name="password"
10561
+ type="password"
10562
+ required
10563
+ maxLength={200}
10564
+ autoComplete="off"
10565
+ />
10566
+ {wrongPassword ? (
10567
+ <FieldError>
10568
+ {t(
10569
+ "This link needs its password. Check it and try again.",
10570
+ )}
10571
+ </FieldError>
10572
+ ) : null}
10573
+ </Field>
10574
+ ) : null}
10575
+ {error ? <FieldError>{error}</FieldError> : null}
10576
+ </FieldGroup>
10577
+ <div className="flex justify-end">
10578
+ <Button type="submit" disabled={form.pending}>
10579
+ {t("Send")}
10580
+ </Button>
10581
+ </div>
10582
+ </form>
10583
+ ) : (
10584
+ <Empty className="border">
10585
+ <EmptyHeader>
10586
+ <EmptyMedia variant="icon">
10587
+ <CircleCheckIcon />
10588
+ </EmptyMedia>
10589
+ <EmptyTitle>{t("File sent")}</EmptyTitle>
10590
+ <EmptyDescription>{sent}</EmptyDescription>
10591
+ </EmptyHeader>
10592
+ <EmptyContent>
10593
+ <Badge variant="success-light">{t("Received")}</Badge>
10594
+ <Button
10595
+ variant="outline"
10596
+ onClick={() => {
10597
+ form.reset();
10598
+ setSent(null);
10599
+ }}
10600
+ >
10601
+ {t("Send another file")}
10602
+ </Button>
10603
+ </EmptyContent>
10604
+ </Empty>
10605
+ )}
10606
+ </CardContent>
10607
+ </Card>
10608
+ );
10609
+ }
10610
+ ```
10611
+
10489
10612
  ## Reactions bar
10490
10613
 
10491
10614
  Emoji reactions under a record with counts, which toggle the caller's own reaction. It loads its data on the server through the block's client; the [reactions block](https://bettersupabase.com/blocks/reactions) must be installed (`npx better-supabase add reactions`). Page: https://bettersupabase.com/recipes/reactions-bar.
@@ -11583,7 +11706,7 @@ export async function ContactDetail({
11583
11706
  getPermissions(),
11584
11707
  ]);
11585
11708
 
11586
- if (!can(permissions, "parties.read")) {
11709
+ if (!can(permissions, "contacts.read")) {
11587
11710
  forbidden();
11588
11711
  }
11589
11712
 
@@ -11714,7 +11837,7 @@ export async function ContactDetail({
11714
11837
  ))}
11715
11838
  </ul>
11716
11839
  )}
11717
- {can(permissions, "parties.write") ? (
11840
+ {can(permissions, "contacts.write") ? (
11718
11841
  <LinkPersonForm
11719
11842
  companyId={contact.id}
11720
11843
  people={contact.candidates.map((person) => ({
@@ -12057,7 +12180,7 @@ export async function ActivityTimeline({
12057
12180
  getPermissions(),
12058
12181
  ]);
12059
12182
 
12060
- if (!can(permissions, "engagements.read")) {
12183
+ if (!can(permissions, "activities.read")) {
12061
12184
  return null;
12062
12185
  }
12063
12186
 
@@ -12067,7 +12190,7 @@ export async function ActivityTimeline({
12067
12190
  return null;
12068
12191
  }
12069
12192
 
12070
- const canLog = can(permissions, "engagements.write");
12193
+ const canLog = can(permissions, "activities.write");
12071
12194
 
12072
12195
  const types = new Map([
12073
12196
  ["call", t("Call")],
@@ -12351,7 +12474,7 @@ export async function TargetsProgress() {
12351
12474
  getPermissions(),
12352
12475
  ]);
12353
12476
 
12354
- if (!can(permissions, "targets.read")) {
12477
+ if (!can(permissions, "goals.read")) {
12355
12478
  return null;
12356
12479
  }
12357
12480
 
@@ -12361,7 +12484,7 @@ export async function TargetsProgress() {
12361
12484
  return null;
12362
12485
  }
12363
12486
 
12364
- const canManage = can(permissions, "targets.manage");
12487
+ const canManage = can(permissions, "goals.manage");
12365
12488
 
12366
12489
  const amountOf = (target: TargetRow, value: bigint) =>
12367
12490
  target.currency === null
@@ -14527,7 +14650,7 @@ npx shadcn add card empty skeleton
14527
14650
  /**
14528
14651
  * Render inside `<Suspense>`: the employees as an org chart, each manager above
14529
14652
  * their reports, with a search. Private details open in a sheet for callers
14530
- * with `employees.view_sensitive`.
14653
+ * with `employees.read_sensitive`.
14531
14654
  */
14532
14655
  export async function EmployeeDirectory() {
14533
14656
  const [t, permissions] = await Promise.all([
@@ -14546,7 +14669,7 @@ export async function EmployeeDirectory() {
14546
14669
  }
14547
14670
 
14548
14671
  const canWrite = can(permissions, "employees.write");
14549
- const canViewSensitive = can(permissions, "employees.view_sensitive");
14672
+ const canViewSensitive = can(permissions, "employees.read_sensitive");
14550
14673
 
14551
14674
  const managers =
14552
14675
  directory.kind === "ok"
@@ -14604,6 +14727,513 @@ export async function EmployeeDirectory() {
14604
14727
  }
14605
14728
  ```
14606
14729
 
14730
+ ## Qualification matrix
14731
+
14732
+ A table of the members who lack a required qualification, hold an expired one or will lose one soon. It loads its data on the server through the block's client; the [qualifications block](https://bettersupabase.com/blocks/qualifications) must be installed (`npx better-supabase add qualifications`). Page: https://bettersupabase.com/recipes/qualification-matrix.
14733
+
14734
+ Web, with shadcn components:
14735
+
14736
+ ```bash
14737
+ npx shadcn add alert badge button card empty skeleton table
14738
+ ```
14739
+
14740
+ ```tsx title="apps/examples/nextjs/src/features/qualifications/components/qualification-matrix.tsx"
14741
+ // oxlint-disable-next-line typescript/require-await -- a Server Action must be async, and refresh() returns nothing to await
14742
+ async function retry() {
14743
+ "use server";
14744
+ refresh();
14745
+ }
14746
+
14747
+ const GAP_VARIANT = {
14748
+ missing: "destructive-light",
14749
+ expired: "destructive-light",
14750
+ expiring: "warning-light",
14751
+ } as const satisfies Record<QualificationGapStatus, string>;
14752
+
14753
+ /**
14754
+ * Render inside `<Suspense>` for members with `qualifications.read`: each
14755
+ * required qualification a member lacks, has let lapse or is about to lose.
14756
+ */
14757
+ export async function QualificationMatrix() {
14758
+ const [state, t, format] = await Promise.all([
14759
+ getMatrix(),
14760
+ getExtracted("qualifications"),
14761
+ getFormatter(),
14762
+ ]);
14763
+
14764
+ if (state.kind === "no-organization") {
14765
+ return null;
14766
+ }
14767
+
14768
+ if (state.kind === "error") {
14769
+ return (
14770
+ <Alert variant="destructive" data-recipe="qualification-matrix">
14771
+ <TriangleAlertIcon />
14772
+ <AlertTitle>{t("The qualification gaps didn't load")}</AlertTitle>
14773
+ <AlertDescription>{t("Try again in a moment.")}</AlertDescription>
14774
+ <AlertAction>
14775
+ <form action={retry}>
14776
+ <Button size="sm" variant="outline" type="submit">
14777
+ {t("Retry")}
14778
+ </Button>
14779
+ </form>
14780
+ </AlertAction>
14781
+ </Alert>
14782
+ );
14783
+ }
14784
+
14785
+ const { types, gaps } = state.data;
14786
+
14787
+ if (types === 0) {
14788
+ return (
14789
+ <Empty className="border" data-recipe="qualification-matrix">
14790
+ <EmptyHeader>
14791
+ <EmptyMedia variant="icon">
14792
+ <BadgeCheckIcon />
14793
+ </EmptyMedia>
14794
+ <EmptyTitle>{t("No qualifications yet")}</EmptyTitle>
14795
+ <EmptyDescription>
14796
+ {t(
14797
+ "Add a qualification type such as a forklift licence, then name the roles or teams that must hold it.",
14798
+ )}
14799
+ </EmptyDescription>
14800
+ </EmptyHeader>
14801
+ <EmptyContent>
14802
+ <a
14803
+ className="text-sm underline underline-offset-4"
14804
+ href="https://bettersupabase.com/docs/blocks/qualifications"
14805
+ >
14806
+ {t("Read the qualifications guide")}
14807
+ </a>
14808
+ </EmptyContent>
14809
+ </Empty>
14810
+ );
14811
+ }
14812
+
14813
+ const label = (status: QualificationGapStatus) => {
14814
+ switch (status) {
14815
+ case "missing": {
14816
+ return t("Missing");
14817
+ }
14818
+
14819
+ case "expired": {
14820
+ return t("Expired");
14821
+ }
14822
+
14823
+ case "expiring": {
14824
+ return t("Expiring");
14825
+ }
14826
+
14827
+ default: {
14828
+ const unknown: never = status;
14829
+
14830
+ return unknown;
14831
+ }
14832
+ }
14833
+ };
14834
+
14835
+ const day = (date: string) =>
14836
+ format.dateTime(new Date(date), { dateStyle: "medium", timeZone: "UTC" });
14837
+
14838
+ return (
14839
+ <Card data-recipe="qualification-matrix">
14840
+ <CardHeader>
14841
+ <CardTitle>{t("Qualification gaps")}</CardTitle>
14842
+ <CardDescription>
14843
+ {t(
14844
+ "Members who lack a required qualification, hold an expired one or will lose one soon.",
14845
+ )}
14846
+ </CardDescription>
14847
+ </CardHeader>
14848
+ <CardContent>
14849
+ {gaps.length === 0 ? (
14850
+ <p className="text-sm text-muted-foreground">
14851
+ {t("Every member holds the qualifications their role requires.")}
14852
+ </p>
14853
+ ) : (
14854
+ <Table>
14855
+ <TableHeader>
14856
+ <TableRow>
14857
+ <TableHead>{t("Member")}</TableHead>
14858
+ <TableHead>{t("Qualification")}</TableHead>
14859
+ <TableHead>{t("Status")}</TableHead>
14860
+ <TableHead>{t("Expires")}</TableHead>
14861
+ </TableRow>
14862
+ </TableHeader>
14863
+ <TableBody>
14864
+ {gaps.map((gap) => (
14865
+ <TableRow key={gap.key}>
14866
+ <TableCell className="font-medium">
14867
+ {gap.holderTitle}
14868
+ </TableCell>
14869
+ <TableCell>{gap.typeName}</TableCell>
14870
+ <TableCell>
14871
+ <Badge variant={GAP_VARIANT[gap.status]}>
14872
+ {label(gap.status)}
14873
+ </Badge>
14874
+ </TableCell>
14875
+ <TableCell className="text-muted-foreground">
14876
+ {gap.expiresOn ? day(gap.expiresOn) : "–"}
14877
+ </TableCell>
14878
+ </TableRow>
14879
+ ))}
14880
+ </TableBody>
14881
+ </Table>
14882
+ )}
14883
+ </CardContent>
14884
+ </Card>
14885
+ );
14886
+ }
14887
+
14888
+ export function QualificationMatrixSkeleton() {
14889
+ return <Skeleton className="h-64" aria-busy="true" />;
14890
+ }
14891
+ ```
14892
+
14893
+ ## My qualifications
14894
+
14895
+ The signed-in member's certificates and licences with their expiry, and the required ones they still lack. It loads its data on the server through the block's client; the [qualifications block](https://bettersupabase.com/blocks/qualifications) must be installed (`npx better-supabase add qualifications`). Page: https://bettersupabase.com/recipes/my-qualifications.
14896
+
14897
+ Web, with shadcn components:
14898
+
14899
+ ```bash
14900
+ npx shadcn add alert badge button card empty skeleton
14901
+ ```
14902
+
14903
+ ```tsx title="apps/examples/nextjs/src/features/qualifications/components/my-qualifications.tsx"
14904
+ // oxlint-disable-next-line typescript/require-await -- a Server Action must be async, and refresh() returns nothing to await
14905
+ async function retry() {
14906
+ "use server";
14907
+ refresh();
14908
+ }
14909
+
14910
+ const STATUS_VARIANT = {
14911
+ valid: "success-light",
14912
+ expiring: "warning-light",
14913
+ expired: "destructive-light",
14914
+ revoked: "secondary",
14915
+ } as const satisfies Record<QualificationStatus, string>;
14916
+
14917
+ /**
14918
+ * Render inside `<Suspense>`: the signed-in member's certificates and licences
14919
+ * with their expiry, then the required ones they still lack. Needs no
14920
+ * permission; members read their own holdings and gaps.
14921
+ */
14922
+ export async function MyQualifications() {
14923
+ const [state, t, format] = await Promise.all([
14924
+ getMyQualifications(),
14925
+ getExtracted("qualifications"),
14926
+ getFormatter(),
14927
+ ]);
14928
+
14929
+ if (state.kind === "no-organization") {
14930
+ return null;
14931
+ }
14932
+
14933
+ if (state.kind === "error") {
14934
+ return (
14935
+ <Alert variant="destructive" data-recipe="my-qualifications">
14936
+ <TriangleAlertIcon />
14937
+ <AlertTitle>{t("Your qualifications didn't load")}</AlertTitle>
14938
+ <AlertDescription>{t("Try again in a moment.")}</AlertDescription>
14939
+ <AlertAction>
14940
+ <form action={retry}>
14941
+ <Button size="sm" variant="outline" type="submit">
14942
+ {t("Retry")}
14943
+ </Button>
14944
+ </form>
14945
+ </AlertAction>
14946
+ </Alert>
14947
+ );
14948
+ }
14949
+
14950
+ const { holdings, gaps } = state.data;
14951
+
14952
+ const label = (status: QualificationStatus) => {
14953
+ switch (status) {
14954
+ case "valid": {
14955
+ return t("Valid");
14956
+ }
14957
+
14958
+ case "expiring": {
14959
+ return t("Expiring");
14960
+ }
14961
+
14962
+ case "expired": {
14963
+ return t("Expired");
14964
+ }
14965
+
14966
+ case "revoked": {
14967
+ return t("Revoked");
14968
+ }
14969
+
14970
+ default: {
14971
+ const unknown: never = status;
14972
+
14973
+ return unknown;
14974
+ }
14975
+ }
14976
+ };
14977
+
14978
+ const day = (date: string) =>
14979
+ format.dateTime(new Date(date), { dateStyle: "medium", timeZone: "UTC" });
14980
+
14981
+ return (
14982
+ <Card data-recipe="my-qualifications">
14983
+ <CardHeader>
14984
+ <CardTitle>{t("My qualifications")}</CardTitle>
14985
+ <CardDescription>
14986
+ {t(
14987
+ "The certificates and licences you hold, and the ones your role still requires.",
14988
+ )}
14989
+ </CardDescription>
14990
+ </CardHeader>
14991
+ <CardContent className="flex flex-col gap-4">
14992
+ {holdings.length === 0 && gaps.length === 0 ? (
14993
+ <Empty>
14994
+ <EmptyHeader>
14995
+ <EmptyMedia variant="icon">
14996
+ <IdCardIcon />
14997
+ </EmptyMedia>
14998
+ <EmptyTitle>{t("Nothing to show yet")}</EmptyTitle>
14999
+ <EmptyDescription>
15000
+ {t(
15001
+ "Qualifications appear here once an admin grants one or you complete a course that awards one.",
15002
+ )}
15003
+ </EmptyDescription>
15004
+ </EmptyHeader>
15005
+ </Empty>
15006
+ ) : null}
15007
+ {holdings.length > 0 ? (
15008
+ <ul className="flex flex-col gap-2">
15009
+ {holdings.map((holding) => (
15010
+ <li
15011
+ key={holding.id}
15012
+ className="flex flex-wrap items-center justify-between gap-2"
15013
+ >
15014
+ <div className="flex flex-col gap-1">
15015
+ <span className="text-sm font-medium">
15016
+ {holding.typeName}
15017
+ </span>
15018
+ <span className="text-xs text-muted-foreground">
15019
+ {holding.expiresOn
15020
+ ? t("Expires {date}", { date: day(holding.expiresOn) })
15021
+ : t("Never expires")}
15022
+ </span>
15023
+ </div>
15024
+ <Badge variant={STATUS_VARIANT[holding.status]}>
15025
+ {label(holding.status)}
15026
+ </Badge>
15027
+ </li>
15028
+ ))}
15029
+ </ul>
15030
+ ) : null}
15031
+ {gaps.length > 0 ? (
15032
+ <div className="flex flex-col gap-2">
15033
+ <span className="text-sm font-medium">{t("Still required")}</span>
15034
+ <div className="flex flex-wrap gap-2">
15035
+ {gaps.map((gap) => (
15036
+ <Badge key={gap.key} variant="destructive-light">
15037
+ {gap.typeName}
15038
+ </Badge>
15039
+ ))}
15040
+ </div>
15041
+ </div>
15042
+ ) : null}
15043
+ </CardContent>
15044
+ </Card>
15045
+ );
15046
+ }
15047
+
15048
+ export function MyQualificationsSkeleton() {
15049
+ return <Skeleton className="h-48" aria-busy="true" />;
15050
+ }
15051
+ ```
15052
+
15053
+ ## Roster board
15054
+
15055
+ This week's shifts in a column per day, with their status and how many places are filled. It loads its data on the server through the block's client; the [shifts block](https://bettersupabase.com/blocks/shifts) must be installed (`npx better-supabase add shifts`). Page: https://bettersupabase.com/recipes/roster-board.
15056
+
15057
+ Web, with shadcn components:
15058
+
15059
+ ```bash
15060
+ npx shadcn add alert badge button card empty skeleton
15061
+ ```
15062
+
15063
+ ```tsx title="apps/examples/nextjs/src/features/shifts/components/roster-board.tsx"
15064
+ // oxlint-disable-next-line typescript/require-await -- a Server Action must be async, and refresh() returns nothing to await
15065
+ async function retry() {
15066
+ "use server";
15067
+ refresh();
15068
+ }
15069
+
15070
+ const STATUS_VARIANT = {
15071
+ draft: "secondary",
15072
+ published: "success-light",
15073
+ canceled: "destructive-light",
15074
+ } as const satisfies Record<ShiftStatus, string>;
15075
+
15076
+ /**
15077
+ * Render inside `<Suspense>`: this week's shifts in a column per day, each with
15078
+ * its times, status and how many of its places are filled. Members see the
15079
+ * published shifts; planners with `shifts.write` also the drafts.
15080
+ */
15081
+ export async function RosterBoard() {
15082
+ await connection();
15083
+ const today = Temporal.Now.plainDateISO("UTC");
15084
+ const monday = today.subtract({ days: today.dayOfWeek - 1 });
15085
+
15086
+ const days = Array.from({ length: 7 }, (_, index) =>
15087
+ monday.add({ days: index }).toString(),
15088
+ );
15089
+
15090
+ const [state, t, format] = await Promise.all([
15091
+ getRoster(monday.toString()),
15092
+ getExtracted("shifts"),
15093
+ getFormatter(),
15094
+ ]);
15095
+
15096
+ if (state.kind === "no-organization") {
15097
+ return null;
15098
+ }
15099
+
15100
+ if (state.kind === "error") {
15101
+ return (
15102
+ <Alert variant="destructive" data-recipe="roster-board">
15103
+ <TriangleAlertIcon />
15104
+ <AlertTitle>{t("The roster didn't load")}</AlertTitle>
15105
+ <AlertDescription>{t("Try again in a moment.")}</AlertDescription>
15106
+ <AlertAction>
15107
+ <form action={retry}>
15108
+ <Button size="sm" variant="outline" type="submit">
15109
+ {t("Retry")}
15110
+ </Button>
15111
+ </form>
15112
+ </AlertAction>
15113
+ </Alert>
15114
+ );
15115
+ }
15116
+
15117
+ const shifts = state.data;
15118
+
15119
+ if (shifts.length === 0) {
15120
+ return (
15121
+ <Empty className="border" data-recipe="roster-board">
15122
+ <EmptyHeader>
15123
+ <EmptyMedia variant="icon">
15124
+ <CalendarDaysIcon />
15125
+ </EmptyMedia>
15126
+ <EmptyTitle>{t("No shifts this week")}</EmptyTitle>
15127
+ <EmptyDescription>
15128
+ {t(
15129
+ "Save a shift template, generate the week's shifts from it, then publish them.",
15130
+ )}
15131
+ </EmptyDescription>
15132
+ </EmptyHeader>
15133
+ <EmptyContent>
15134
+ <a
15135
+ className="text-sm underline underline-offset-4"
15136
+ href="https://bettersupabase.com/docs/blocks/shifts"
15137
+ >
15138
+ {t("Read the shifts guide")}
15139
+ </a>
15140
+ </EmptyContent>
15141
+ </Empty>
15142
+ );
15143
+ }
15144
+
15145
+ const label = (status: ShiftStatus) => {
15146
+ switch (status) {
15147
+ case "draft": {
15148
+ return t("Draft");
15149
+ }
15150
+
15151
+ case "published": {
15152
+ return t("Published");
15153
+ }
15154
+
15155
+ case "canceled": {
15156
+ return t("Canceled");
15157
+ }
15158
+
15159
+ default: {
15160
+ const unknown: never = status;
15161
+
15162
+ return unknown;
15163
+ }
15164
+ }
15165
+ };
15166
+
15167
+ const dayLabel = (date: string) =>
15168
+ format.dateTime(new Date(`${date}T12:00:00Z`), {
15169
+ weekday: "short",
15170
+ day: "numeric",
15171
+ timeZone: "UTC",
15172
+ });
15173
+
15174
+ const time = (instant: string) =>
15175
+ format.dateTime(new Date(instant), { timeStyle: "short", timeZone: "UTC" });
15176
+
15177
+ return (
15178
+ <Card data-recipe="roster-board">
15179
+ <CardHeader>
15180
+ <CardTitle>{t("This week's roster")}</CardTitle>
15181
+ <CardDescription>
15182
+ {t("The shifts of each day and how many of their places are filled.")}
15183
+ </CardDescription>
15184
+ </CardHeader>
15185
+ <CardContent className="grid grid-cols-1 gap-4 md:grid-cols-7">
15186
+ {days.map((day) => (
15187
+ <div key={day} className="flex flex-col gap-2">
15188
+ <span className="text-sm font-medium">{dayLabel(day)}</span>
15189
+ {shifts
15190
+ .filter((shift) => shift.day === day)
15191
+ .map((shift) => (
15192
+ <div
15193
+ key={shift.id}
15194
+ className="flex flex-col gap-2 rounded-md border p-2"
15195
+ >
15196
+ <span className="text-sm">
15197
+ {time(shift.startsAt)} – {time(shift.endsAt)}
15198
+ </span>
15199
+ <div className="flex flex-wrap gap-1">
15200
+ <Badge variant={STATUS_VARIANT[shift.status]}>
15201
+ {label(shift.status)}
15202
+ </Badge>
15203
+ <Badge
15204
+ variant={
15205
+ shift.assigned < shift.headcount
15206
+ ? "warning-light"
15207
+ : "secondary"
15208
+ }
15209
+ >
15210
+ {t("{assigned}/{headcount} filled", {
15211
+ assigned: String(shift.assigned),
15212
+ headcount: String(shift.headcount),
15213
+ })}
15214
+ </Badge>
15215
+ </div>
15216
+ {shift.requested > 0 ? (
15217
+ <span className="text-xs text-muted-foreground">
15218
+ {t("{count} requested", {
15219
+ count: String(shift.requested),
15220
+ })}
15221
+ </span>
15222
+ ) : null}
15223
+ </div>
15224
+ ))}
15225
+ </div>
15226
+ ))}
15227
+ </CardContent>
15228
+ </Card>
15229
+ );
15230
+ }
15231
+
15232
+ export function RosterBoardSkeleton() {
15233
+ return <Skeleton className="h-64" aria-busy="true" />;
15234
+ }
15235
+ ```
15236
+
14607
15237
  ## Hiring board
14608
15238
 
14609
15239
  Candidates for an opening as cards in interview stage columns. It loads its data on the server through the block's client; the [hiring block](https://bettersupabase.com/blocks/hiring) must be installed (`npx better-supabase add hiring`). Page: https://bettersupabase.com/recipes/hiring-board.
@@ -17581,6 +18211,9 @@ export async function DriveExplorer({
17581
18211
  id={item.id}
17582
18212
  kind={item.kind}
17583
18213
  name={item.name}
18214
+ locked={item.locked}
18215
+ downloadBlocked={item.downloadBlocked}
18216
+ downloadable={item.downloadable}
17584
18217
  />
17585
18218
  </TableCell>
17586
18219
  </TableRow>
@@ -20829,8 +21462,8 @@ async function retry() {
20829
21462
 
20830
21463
  /**
20831
21464
  * Render inside `<Suspense>`: the machine identities workflows and webhooks run
20832
- * as, with their role. Members with `service_principals.manage` add and disable
20833
- * them. Members without `service_principals.read` see nothing.
21465
+ * as, with their role. Members with `service_accounts.manage` add and disable
21466
+ * them. Members without `service_accounts.read` see nothing.
20834
21467
  */
20835
21468
  export async function ServicePrincipalsTable() {
20836
21469
  const [t, format, permissions] = await Promise.all([
@@ -20839,7 +21472,7 @@ export async function ServicePrincipalsTable() {
20839
21472
  getPermissions(),
20840
21473
  ]);
20841
21474
 
20842
- if (!can(permissions, "service_principals.read")) {
21475
+ if (!can(permissions, "service_accounts.read")) {
20843
21476
  return null;
20844
21477
  }
20845
21478
 
@@ -20849,7 +21482,7 @@ export async function ServicePrincipalsTable() {
20849
21482
  return null;
20850
21483
  }
20851
21484
 
20852
- const manage = can(permissions, "service_principals.manage");
21485
+ const manage = can(permissions, "service_accounts.manage");
20853
21486
 
20854
21487
  const roles = new Map([
20855
21488
  ["owner", t("Owner")],
@@ -21128,7 +21761,7 @@ npx shadcn add alert badge button card empty skeleton
21128
21761
 
21129
21762
  ```tsx title="apps/examples/nextjs/src/features/privacy/components/privacy-settings.tsx"
21130
21763
  /**
21131
- * Data exports for the caller and, with `organization.export`, for the
21764
+ * Data exports for the caller and, with `data_lifecycle.export`, for the
21132
21765
  * organization, each with its status and a download. Owners schedule the
21133
21766
  * organization's deletion here; account deletion stays on the security page.
21134
21767
  */
@@ -24381,3 +25014,417 @@ export function TaskImportDialog({ projectId }: { projectId: string }) {
24381
25014
  );
24382
25015
  }
24383
25016
  ```
25017
+
25018
+ ## Risk register
25019
+
25020
+ The organization's risks in a data grid with their residual band, status and next review date, the highest residual score first. It loads its data on the server through the block's client; the [risks block](https://bettersupabase.com/blocks/risks) must be installed (`npx better-supabase add risks`). Page: https://bettersupabase.com/recipes/risk-register.
25021
+
25022
+ Web, with shadcn components:
25023
+
25024
+ ```bash
25025
+ npx shadcn add alert badge button empty skeleton @reui/data-grid @reui/frame
25026
+ ```
25027
+
25028
+ ```tsx title="apps/examples/nextjs/src/features/risks/components/risk-register.tsx"
25029
+ "use client";
25030
+
25031
+ import type { CellContext, ColumnDef } from "@tanstack/react-table";
25032
+ import type { RiskStatus } from "better-supabase/blocks/risks";
25033
+
25034
+ import { useTable } from "@tanstack/react-table";
25035
+ import { ShieldAlertIcon, TriangleAlertIcon } from "lucide-react";
25036
+ import { useExtracted, useFormatter } from "next-intl";
25037
+ import { useRouter } from "next/navigation";
25038
+ import { useTransition } from "react";
25039
+
25040
+ import type { DataGridFeatures } from "@/components/reui/data-grid/data-grid";
25041
+
25042
+ import {
25043
+ Alert,
25044
+ AlertAction,
25045
+ AlertDescription,
25046
+ AlertTitle,
25047
+ } from "@/components/reui/alert";
25048
+ import { Badge } from "@/components/reui/badge";
25049
+ import {
25050
+ DataGrid,
25051
+ DataGridContainer,
25052
+ dataGridFeatures,
25053
+ } from "@/components/reui/data-grid/data-grid";
25054
+ import { DataGridScrollArea } from "@/components/reui/data-grid/data-grid-scroll-area";
25055
+ import { DataGridTable } from "@/components/reui/data-grid/data-grid-table";
25056
+ import {
25057
+ Frame,
25058
+ FrameDescription,
25059
+ FrameHeader,
25060
+ FramePanel,
25061
+ FrameTitle,
25062
+ } from "@/components/reui/frame";
25063
+ import { Button } from "@/components/ui/button";
25064
+ import {
25065
+ Empty,
25066
+ EmptyContent,
25067
+ EmptyDescription,
25068
+ EmptyHeader,
25069
+ EmptyMedia,
25070
+ EmptyTitle,
25071
+ } from "@/components/ui/empty";
25072
+ import { Skeleton } from "@/components/ui/skeleton";
25073
+
25074
+ import type { BandTone, Loaded, RiskRow } from "../risks-queries";
25075
+
25076
+ const TONE_VARIANT = {
25077
+ low: "success-light",
25078
+ medium: "warning-light",
25079
+ high: "destructive-light",
25080
+ critical: "destructive",
25081
+ } as const satisfies Record<BandTone, string>;
25082
+
25083
+ type RiskCell = CellContext<DataGridFeatures, RiskRow>;
25084
+
25085
+ function NumberCell({ row }: RiskCell) {
25086
+ return (
25087
+ <span className="font-mono text-xs text-muted-foreground">
25088
+ {row.original.number}
25089
+ </span>
25090
+ );
25091
+ }
25092
+
25093
+ function TitleCell({ row }: RiskCell) {
25094
+ return <span className="font-medium">{row.original.title}</span>;
25095
+ }
25096
+
25097
+ function BandCell({ row }: RiskCell) {
25098
+ const t = useExtracted("risks");
25099
+ const { band, tone, score } = row.original;
25100
+
25101
+ return band === null || tone === null ? (
25102
+ <span className="text-muted-foreground">{t("Not assessed")}</span>
25103
+ ) : (
25104
+ <Badge variant={TONE_VARIANT[tone]}>
25105
+ {t("{band} · {score, number}", { band, score: score ?? 0 })}
25106
+ </Badge>
25107
+ );
25108
+ }
25109
+
25110
+ function StatusCell({ row }: RiskCell) {
25111
+ const t = useExtracted("risks");
25112
+ const status: RiskStatus = row.original.status;
25113
+
25114
+ switch (status) {
25115
+ case "identified": {
25116
+ return <Badge variant="secondary">{t("Identified")}</Badge>;
25117
+ }
25118
+
25119
+ case "assessed": {
25120
+ return <Badge variant="info-light">{t("Assessed")}</Badge>;
25121
+ }
25122
+
25123
+ case "treating": {
25124
+ return <Badge variant="warning-light">{t("Treating")}</Badge>;
25125
+ }
25126
+
25127
+ case "accepted": {
25128
+ return <Badge variant="success-light">{t("Accepted")}</Badge>;
25129
+ }
25130
+
25131
+ case "closed": {
25132
+ return <Badge variant="secondary">{t("Closed")}</Badge>;
25133
+ }
25134
+
25135
+ default: {
25136
+ const unknown: never = status;
25137
+
25138
+ return unknown;
25139
+ }
25140
+ }
25141
+ }
25142
+
25143
+ function ReviewCell({ row }: RiskCell) {
25144
+ const format = useFormatter();
25145
+ const { nextReviewOn } = row.original;
25146
+
25147
+ return nextReviewOn === null ? (
25148
+ <span className="text-muted-foreground">–</span>
25149
+ ) : (
25150
+ <span className="tabular-nums">
25151
+ {format.dateTime(new Date(nextReviewOn), {
25152
+ dateStyle: "medium",
25153
+ timeZone: "UTC",
25154
+ })}
25155
+ </span>
25156
+ );
25157
+ }
25158
+
25159
+ function RiskGrid({ risks }: { risks: readonly RiskRow[] }) {
25160
+ const t = useExtracted("risks");
25161
+
25162
+ const columns: ColumnDef<DataGridFeatures, RiskRow>[] = [
25163
+ { accessorKey: "number", header: t("Number"), cell: NumberCell, size: 100 },
25164
+ { accessorKey: "title", header: t("Risk"), cell: TitleCell, size: 260 },
25165
+ { accessorKey: "category", header: t("Category"), size: 140 },
25166
+ { accessorKey: "band", header: t("Residual"), cell: BandCell, size: 150 },
25167
+ { accessorKey: "status", header: t("Status"), cell: StatusCell, size: 120 },
25168
+ {
25169
+ accessorKey: "nextReviewOn",
25170
+ header: t("Next review"),
25171
+ cell: ReviewCell,
25172
+ size: 140,
25173
+ },
25174
+ ];
25175
+
25176
+ const table = useTable({
25177
+ features: dataGridFeatures,
25178
+ columns,
25179
+ data: [...risks],
25180
+ getRowId: (row) => row.id,
25181
+ });
25182
+
25183
+ return (
25184
+ <DataGrid
25185
+ table={table}
25186
+ recordCount={risks.length}
25187
+ tableLayout={{ dense: true }}
25188
+ >
25189
+ <DataGridContainer>
25190
+ <DataGridScrollArea>
25191
+ <DataGridTable />
25192
+ </DataGridScrollArea>
25193
+ </DataGridContainer>
25194
+ </DataGrid>
25195
+ );
25196
+ }
25197
+
25198
+ /**
25199
+ * The organization's risk register: each risk with its residual band and the
25200
+ * date of its next review, the highest residual score first.
25201
+ */
25202
+ export function RiskRegister({ state }: { state: Loaded<readonly RiskRow[]> }) {
25203
+ const t = useExtracted("risks");
25204
+ const router = useRouter();
25205
+ const [retrying, startRetry] = useTransition();
25206
+
25207
+ if (state.kind === "no-organization") {
25208
+ return null;
25209
+ }
25210
+
25211
+ return (
25212
+ <Frame spacing="sm" data-recipe="risk-register">
25213
+ <FrameHeader className="gap-0.5">
25214
+ <FrameTitle>{t("Risk register")}</FrameTitle>
25215
+ <FrameDescription>
25216
+ {t(
25217
+ "Every identified risk with its residual rating after controls. A review moves the next review date ahead by the risk's interval.",
25218
+ )}
25219
+ </FrameDescription>
25220
+ </FrameHeader>
25221
+ <FramePanel>
25222
+ {state.kind === "error" ? (
25223
+ <Alert variant="destructive">
25224
+ <TriangleAlertIcon />
25225
+ <AlertTitle>{t("The risk register didn't load")}</AlertTitle>
25226
+ <AlertDescription>{t("Try again in a moment.")}</AlertDescription>
25227
+ <AlertAction>
25228
+ <Button
25229
+ size="sm"
25230
+ variant="outline"
25231
+ type="button"
25232
+ disabled={retrying}
25233
+ onClick={() => {
25234
+ startRetry(() => {
25235
+ router.refresh();
25236
+ });
25237
+ }}
25238
+ >
25239
+ {t("Retry")}
25240
+ </Button>
25241
+ </AlertAction>
25242
+ </Alert>
25243
+ ) : state.data.length === 0 ? (
25244
+ <Empty>
25245
+ <EmptyHeader>
25246
+ <EmptyMedia variant="icon">
25247
+ <ShieldAlertIcon />
25248
+ </EmptyMedia>
25249
+ <EmptyTitle>{t("No risks yet")}</EmptyTitle>
25250
+ <EmptyDescription>
25251
+ {t(
25252
+ "Register a risk with its cause and consequence, then assess it against the organization's matrix.",
25253
+ )}
25254
+ </EmptyDescription>
25255
+ </EmptyHeader>
25256
+ <EmptyContent>
25257
+ <a
25258
+ className="text-sm underline underline-offset-4"
25259
+ href="https://bettersupabase.com/docs/blocks/risks"
25260
+ >
25261
+ {t("Read the risks guide")}
25262
+ </a>
25263
+ </EmptyContent>
25264
+ </Empty>
25265
+ ) : (
25266
+ <RiskGrid risks={state.data} />
25267
+ )}
25268
+ </FramePanel>
25269
+ </Frame>
25270
+ );
25271
+ }
25272
+
25273
+ export function RiskRegisterSkeleton() {
25274
+ return (
25275
+ <Frame spacing="sm" aria-busy="true">
25276
+ <FrameHeader className="gap-1">
25277
+ <Skeleton className="h-4 w-28" />
25278
+ <Skeleton className="h-4 w-80" />
25279
+ </FrameHeader>
25280
+ <FramePanel>
25281
+ <Skeleton className="h-48" />
25282
+ </FramePanel>
25283
+ </Frame>
25284
+ );
25285
+ }
25286
+ ```
25287
+
25288
+ ## Risk heatmap
25289
+
25290
+ The open risks on the default matrix, one cell per likelihood and impact with the count in the band's color. It loads its data on the server through the block's client; the [risks block](https://bettersupabase.com/blocks/risks) must be installed (`npx better-supabase add risks`). Page: https://bettersupabase.com/recipes/risk-heatmap.
25291
+
25292
+ Web, with shadcn components:
25293
+
25294
+ ```bash
25295
+ npx shadcn add alert badge button empty skeleton table @reui/frame
25296
+ ```
25297
+
25298
+ ```tsx title="apps/examples/nextjs/src/features/risks/components/risk-heatmap.tsx"
25299
+ // oxlint-disable-next-line typescript/require-await -- a Server Action must be async, and refresh() returns nothing to await
25300
+ async function retry() {
25301
+ "use server";
25302
+ refresh();
25303
+ }
25304
+
25305
+ const TONE_VARIANT = {
25306
+ low: "success-light",
25307
+ medium: "warning-light",
25308
+ high: "destructive-light",
25309
+ critical: "destructive",
25310
+ } as const;
25311
+
25312
+ /**
25313
+ * Render inside `<Suspense>`: the open risks on the default matrix, one cell
25314
+ * per likelihood and impact, colored by the cell's band. The highest likelihood
25315
+ * is the top row.
25316
+ */
25317
+ export async function RiskHeatmap() {
25318
+ const [state, t] = await Promise.all([
25319
+ getRiskHeatmap(),
25320
+ getExtracted("risks"),
25321
+ ]);
25322
+
25323
+ if (state.kind === "no-organization") {
25324
+ return null;
25325
+ }
25326
+
25327
+ if (state.kind === "error") {
25328
+ return (
25329
+ <Alert variant="destructive" data-recipe="risk-heatmap">
25330
+ <TriangleAlertIcon />
25331
+ <AlertTitle>{t("The heatmap didn't load")}</AlertTitle>
25332
+ <AlertDescription>{t("Try again in a moment.")}</AlertDescription>
25333
+ <AlertAction>
25334
+ <form action={retry}>
25335
+ <Button size="sm" variant="outline" type="submit">
25336
+ {t("Retry")}
25337
+ </Button>
25338
+ </form>
25339
+ </AlertAction>
25340
+ </Alert>
25341
+ );
25342
+ }
25343
+
25344
+ const { matrixName, likelihoods, impacts, cells, total } = state.data;
25345
+
25346
+ const cellAt = new Map(
25347
+ cells.map((cell) => [`${cell.likelihood}:${cell.impact}`, cell]),
25348
+ );
25349
+
25350
+ return (
25351
+ <Frame spacing="sm" data-recipe="risk-heatmap">
25352
+ <FrameHeader className="gap-0.5">
25353
+ <FrameTitle>{t("Heatmap")}</FrameTitle>
25354
+ <FrameDescription>
25355
+ {t(
25356
+ "{total, plural, =0 {No open risks} one {# open risk} other {# open risks}} on the {matrix} matrix, by residual rating.",
25357
+ { total, matrix: matrixName },
25358
+ )}
25359
+ </FrameDescription>
25360
+ </FrameHeader>
25361
+ <FramePanel>
25362
+ {total === 0 ? (
25363
+ <Empty>
25364
+ <EmptyHeader>
25365
+ <EmptyMedia variant="icon">
25366
+ <GridIcon />
25367
+ </EmptyMedia>
25368
+ <EmptyTitle>{t("Nothing assessed yet")}</EmptyTitle>
25369
+ <EmptyDescription>
25370
+ {t(
25371
+ "Assessed risks appear here in the cell of their residual likelihood and impact.",
25372
+ )}
25373
+ </EmptyDescription>
25374
+ </EmptyHeader>
25375
+ <EmptyContent>
25376
+ <a
25377
+ className="text-sm underline underline-offset-4"
25378
+ href="https://bettersupabase.com/docs/blocks/risks#assess"
25379
+ >
25380
+ {t("Read how assessment works")}
25381
+ </a>
25382
+ </EmptyContent>
25383
+ </Empty>
25384
+ ) : (
25385
+ <Table aria-label={t("Risks by likelihood and impact")}>
25386
+ <TableHeader>
25387
+ <TableRow>
25388
+ <TableHead>{t("Likelihood / impact")}</TableHead>
25389
+ {impacts.map((impact) => (
25390
+ <TableHead key={impact.level} className="text-center">
25391
+ {impact.label}
25392
+ </TableHead>
25393
+ ))}
25394
+ </TableRow>
25395
+ </TableHeader>
25396
+ <TableBody>
25397
+ {likelihoods.toReversed().map((likelihood) => (
25398
+ <TableRow key={likelihood.level}>
25399
+ <TableHead scope="row">{likelihood.label}</TableHead>
25400
+ {impacts.map((impact) => {
25401
+ const cell = cellAt.get(
25402
+ `${likelihood.level}:${impact.level}`,
25403
+ );
25404
+
25405
+ return (
25406
+ <TableCell key={impact.level} className="text-center">
25407
+ {cell ? (
25408
+ <Badge
25409
+ variant={TONE_VARIANT[cell.tone]}
25410
+ aria-label={t(
25411
+ "{band}: {count, plural, one {# risk} other {# risks}}",
25412
+ { band: cell.band, count: cell.count },
25413
+ )}
25414
+ >
25415
+ {cell.count}
25416
+ </Badge>
25417
+ ) : null}
25418
+ </TableCell>
25419
+ );
25420
+ })}
25421
+ </TableRow>
25422
+ ))}
25423
+ </TableBody>
25424
+ </Table>
25425
+ )}
25426
+ </FramePanel>
25427
+ </Frame>
25428
+ );
25429
+ }
25430
+ ```