better-supabase 0.43.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 (547) hide show
  1. package/dist/{access-sql-Dao1C0fz.js → access-sql-8In-gFRf.js} +16 -2
  2. package/dist/{adapter-ddQ9Hzka.js → adapter-t7V4k_rU.js} +158 -6
  3. package/dist/{agents-BAiLeoR-.d.ts → agents-D81UAnah.d.ts} +4 -4
  4. package/dist/{ai-cache-B94R1da7.d.ts → ai-cache-OkvpE7L-.d.ts} +4 -4
  5. package/dist/{ai-chat-rQ7Ftq9W.d.ts → ai-chat-BBJvSano.d.ts} +5 -5
  6. package/dist/{ai-schedules-DIiPmFgn.d.ts → ai-schedules-D9mYwQdO.d.ts} +9 -6
  7. package/dist/ai-sdk/agents/index.d.ts +6 -6
  8. package/dist/ai-sdk/batches/index.d.ts +3 -3
  9. package/dist/ai-sdk/cache/index.d.ts +1 -1
  10. package/dist/ai-sdk/chat/index.d.ts +2 -2
  11. package/dist/ai-sdk/embeddings/index.d.ts +2 -2
  12. package/dist/ai-sdk/files/index.d.ts +1 -1
  13. package/dist/ai-sdk/index.d.ts +5 -5
  14. package/dist/ai-sdk/mcp/index.d.ts +3 -3
  15. package/dist/ai-sdk/memory/index.d.ts +3 -3
  16. package/dist/ai-sdk/memory/index.js +1 -1
  17. package/dist/ai-sdk/workflow/index.d.ts +3 -3
  18. package/dist/{api-CbY2qdzT.d.ts → api-Bxhw2FD2.d.ts} +6 -6
  19. package/dist/{api-wwix_K5c.js → api-DzqXnR6X.js} +1 -1
  20. package/dist/{api-keys-U3JQ8IlM.d.ts → api-keys-ClEIzcc3.d.ts} +4 -4
  21. package/dist/{app-tables-CVMn4c4b.d.ts → app-tables-HqT8E90s.d.ts} +1 -1
  22. package/dist/{approvals-CYbTzQ7v.d.ts → approvals-lmHzZSgF.d.ts} +6 -6
  23. package/dist/{assistant-B1p5mYaM.d.ts → assistant-ewdCgSQn.d.ts} +2 -2
  24. package/dist/astro/index.d.ts +7 -7
  25. package/dist/astro/index.js +4 -5
  26. package/dist/{authorization-hGBtxrnQ.d.ts → authorization-CFs44tM2.d.ts} +225 -39
  27. package/dist/{authorization-hooks-CR8TVvqo.d.ts → authorization-hooks-yUgoV4Q7.d.ts} +2 -2
  28. package/dist/authz-refresh-C_zK-BdX.js +115 -0
  29. package/dist/authz-refresh-DIqPTJZe.d.ts +79 -0
  30. package/dist/{auth-link-BmJsQG4a.js → authz-refresh-DQ0Q_1_V.js} +87 -1
  31. package/dist/authz-refresh-Nc-38Xeh.d.ts +38 -0
  32. package/dist/authz-topic-C7n3kIm_.d.ts +21 -0
  33. package/dist/{automations-K0O3En6E.js → automations-Bk-_P7Zp.js} +2 -1
  34. package/dist/better-result/index.d.ts +3 -3
  35. package/dist/{bind-DWAIKYvJ.d.ts → bind-CUxWEh27.d.ts} +7 -7
  36. package/dist/{block-env-C6OEu9Xk.d.ts → block-env-DddTzDut.d.ts} +4 -4
  37. package/dist/{block-helpers-Sj-efEhC.d.ts → block-helpers-DzIR3Ob8.d.ts} +1 -1
  38. package/dist/{block-hooks-VW4knarE.d.ts → block-hooks-D9NKzUqW.d.ts} +2 -2
  39. package/dist/{block-subjects-Bkieh2Xk.d.ts → block-subjects-hcIVjfyD.d.ts} +1 -1
  40. package/dist/{block-subjects-B1zfhFWC.js → block-subjects-y1RNnlLz.js} +1 -1
  41. package/dist/{block-tables-BIExrL2J.d.ts → block-tables-BNwRNU_D.d.ts} +1 -1
  42. package/dist/{block-transport-CDmOUuLZ.d.ts → block-transport-Do7J4MsA.d.ts} +2 -2
  43. package/dist/blocks/access-requests/index.d.ts +5 -5
  44. package/dist/blocks/activities/index.d.ts +10 -10
  45. package/dist/blocks/activities/index.js +1 -1
  46. package/dist/blocks/agents/index.d.ts +4 -4
  47. package/dist/blocks/ai-cache/index.d.ts +3 -3
  48. package/dist/blocks/ai-chat/index.d.ts +8 -8
  49. package/dist/blocks/ai-files/index.d.ts +3 -3
  50. package/dist/blocks/ai-keys/index.d.ts +4 -4
  51. package/dist/blocks/ai-schedules/index.d.ts +3 -3
  52. package/dist/blocks/announcements/index.d.ts +8 -8
  53. package/dist/blocks/api-keys/index.d.ts +3 -3
  54. package/dist/blocks/approvals/index.d.ts +4 -4
  55. package/dist/blocks/assets/index.d.ts +6 -6
  56. package/dist/blocks/assignment/index.d.ts +7 -7
  57. package/dist/blocks/attachments/index.d.ts +47 -5
  58. package/dist/blocks/attachments/index.js +55 -3
  59. package/dist/blocks/audit/index.d.ts +13 -13
  60. package/dist/blocks/audit/index.js +1 -1
  61. package/dist/blocks/automations/index.d.ts +25 -23
  62. package/dist/blocks/billable-time/index.d.ts +6 -6
  63. package/dist/blocks/billing/index.d.ts +9 -9
  64. package/dist/blocks/bookings/index.d.ts +4 -4
  65. package/dist/blocks/bulk/index.d.ts +4 -4
  66. package/dist/blocks/calendar/index.d.ts +5 -5
  67. package/dist/blocks/catalog/index.d.ts +6 -6
  68. package/dist/blocks/channels/index.d.ts +7 -7
  69. package/dist/blocks/collections/index.d.ts +6 -6
  70. package/dist/blocks/comments/index.d.ts +10 -10
  71. package/dist/blocks/compliance/index.d.ts +35 -19
  72. package/dist/blocks/compliance/index.js +38 -4
  73. package/dist/blocks/connectors/index.d.ts +4 -4
  74. package/dist/blocks/contacts/index.d.ts +53 -10
  75. package/dist/blocks/contacts/index.js +48 -5
  76. package/dist/blocks/content/index.d.ts +5 -5
  77. package/dist/blocks/contracts/index.d.ts +6 -6
  78. package/dist/blocks/courses/index.d.ts +22 -7
  79. package/dist/blocks/courses/index.js +11 -0
  80. package/dist/blocks/created-by/index.d.ts +2 -2
  81. package/dist/blocks/custom-fields/index.d.ts +7 -7
  82. package/dist/blocks/custom-fields/index.js +1 -1
  83. package/dist/blocks/data-lifecycle/index.d.ts +29 -12
  84. package/dist/blocks/data-lifecycle/index.js +16 -2
  85. package/dist/blocks/deals/index.d.ts +6 -6
  86. package/dist/blocks/dispatch/index.d.ts +6 -6
  87. package/dist/blocks/documents/index.d.ts +4 -4
  88. package/dist/blocks/domains/index.d.ts +6 -6
  89. package/dist/blocks/donations/index.d.ts +6 -6
  90. package/dist/blocks/drive/index.d.ts +224 -11
  91. package/dist/blocks/drive/index.js +269 -19
  92. package/dist/blocks/employees/index.d.ts +8 -8
  93. package/dist/blocks/enrichment/index.d.ts +6 -6
  94. package/dist/blocks/enrollments/index.d.ts +6 -6
  95. package/dist/blocks/entitlements/index.d.ts +6 -6
  96. package/dist/blocks/expenses/index.d.ts +5 -5
  97. package/dist/blocks/field-history/index.d.ts +6 -6
  98. package/dist/blocks/flags/index.d.ts +5 -5
  99. package/dist/blocks/forecasts/index.d.ts +6 -6
  100. package/dist/blocks/forms/index.d.ts +6 -6
  101. package/dist/blocks/goals/index.d.ts +5 -5
  102. package/dist/blocks/goals/index.js +1 -1
  103. package/dist/blocks/guests/index.d.ts +6 -6
  104. package/dist/blocks/guests/index.js +2 -2
  105. package/dist/blocks/hiring/index.d.ts +6 -6
  106. package/dist/blocks/identities/index.d.ts +5 -5
  107. package/dist/blocks/imports/index.d.ts +5 -5
  108. package/dist/blocks/inbox/index.d.ts +10 -10
  109. package/dist/blocks/incidents/index.d.ts +5 -5
  110. package/dist/blocks/index.d.ts +160 -10
  111. package/dist/blocks/index.js +19 -1
  112. package/dist/blocks/inventory/index.d.ts +6 -6
  113. package/dist/blocks/invoices/index.d.ts +14 -8
  114. package/dist/blocks/invoices/index.js +5 -3
  115. package/dist/blocks/knowledge/index.d.ts +4 -4
  116. package/dist/blocks/knowledge/index.js +1 -1
  117. package/dist/blocks/lead-scoring/index.d.ts +7 -7
  118. package/dist/blocks/leases/index.d.ts +6 -6
  119. package/dist/blocks/leave/index.d.ts +5 -5
  120. package/dist/blocks/ledger/index.d.ts +6 -6
  121. package/dist/blocks/mail-sync/index.d.ts +5 -5
  122. package/dist/blocks/memberships/index.d.ts +2 -2
  123. package/dist/blocks/memory/index.d.ts +4 -4
  124. package/dist/blocks/memory/index.js +1 -1
  125. package/dist/blocks/messaging/index.d.ts +11 -11
  126. package/dist/blocks/metrics/index.d.ts +6 -6
  127. package/dist/blocks/mfa/index.d.ts +2 -2
  128. package/dist/blocks/moderation/index.d.ts +6 -6
  129. package/dist/blocks/notifications/index.d.ts +17 -13
  130. package/dist/blocks/notifications/index.js +2 -0
  131. package/dist/blocks/numbering/index.d.ts +4 -4
  132. package/dist/blocks/oauth-server/index.d.ts +64 -38
  133. package/dist/blocks/oauth-server/index.js +6 -3
  134. package/dist/blocks/onboarding/index.d.ts +5 -5
  135. package/dist/blocks/orders/index.d.ts +7 -7
  136. package/dist/blocks/organizations/index.d.ts +8 -8
  137. package/dist/blocks/outbox/index.d.ts +4 -4
  138. package/dist/blocks/passes/index.d.ts +8 -8
  139. package/dist/blocks/permissions/index.d.ts +9 -8
  140. package/dist/blocks/permissions/index.js +3 -2
  141. package/dist/blocks/pipelines/index.d.ts +6 -6
  142. package/dist/blocks/posts/index.d.ts +5 -5
  143. package/dist/blocks/profiles/index.d.ts +4 -4
  144. package/dist/blocks/promotions/index.d.ts +5 -5
  145. package/dist/blocks/push/index.d.ts +8 -8
  146. package/dist/blocks/qualifications/index.d.ts +256 -0
  147. package/dist/blocks/qualifications/index.js +303 -0
  148. package/dist/blocks/queue/index.d.ts +14 -109
  149. package/dist/blocks/queue/index.js +13 -7
  150. package/dist/blocks/quotes/index.d.ts +20 -13
  151. package/dist/blocks/quotes/index.js +3 -2
  152. package/dist/blocks/rank/index.d.ts +4 -4
  153. package/dist/blocks/reactions/index.d.ts +9 -9
  154. package/dist/blocks/relations/index.d.ts +7 -7
  155. package/dist/blocks/reminders/index.d.ts +8 -8
  156. package/dist/blocks/reviews/index.d.ts +5 -5
  157. package/dist/blocks/risks/index.d.ts +303 -0
  158. package/dist/blocks/risks/index.js +376 -0
  159. package/dist/blocks/saved-views/index.d.ts +8 -8
  160. package/dist/blocks/scores/index.d.ts +5 -5
  161. package/dist/blocks/search/index.d.ts +7 -7
  162. package/dist/blocks/security-events/index.d.ts +7 -7
  163. package/dist/blocks/segments/index.d.ts +7 -7
  164. package/dist/blocks/sequences/index.d.ts +6 -6
  165. package/dist/blocks/service-accounts/index.d.ts +6 -6
  166. package/dist/blocks/service-accounts/index.js +1 -1
  167. package/dist/blocks/sessions/index.d.ts +2 -2
  168. package/dist/blocks/settings/index.d.ts +6 -6
  169. package/dist/blocks/share-links/index.d.ts +32 -7
  170. package/dist/blocks/share-links/index.js +37 -4
  171. package/dist/blocks/shifts/index.d.ts +334 -0
  172. package/dist/blocks/shifts/index.js +451 -0
  173. package/dist/blocks/shipments/index.d.ts +7 -7
  174. package/dist/blocks/signatures/index.d.ts +14 -6
  175. package/dist/blocks/signatures/index.js +3 -1
  176. package/dist/blocks/signing-keys/index.d.ts +4 -4
  177. package/dist/blocks/sla/index.d.ts +7 -7
  178. package/dist/blocks/sso/index.d.ts +6 -6
  179. package/dist/blocks/state-machine/index.d.ts +5 -5
  180. package/dist/blocks/subjects/index.d.ts +16 -8
  181. package/dist/blocks/subjects/index.js +114 -5
  182. package/dist/blocks/tags/index.d.ts +6 -6
  183. package/dist/blocks/tasks/index.d.ts +9 -9
  184. package/dist/blocks/teams/index.d.ts +4 -4
  185. package/dist/blocks/templates/index.d.ts +9 -9
  186. package/dist/blocks/time-tracking/index.d.ts +7 -7
  187. package/dist/blocks/timeline/index.d.ts +11 -11
  188. package/dist/blocks/timeline/index.js +2 -2
  189. package/dist/blocks/trash/index.d.ts +6 -6
  190. package/dist/blocks/undo/index.d.ts +4 -4
  191. package/dist/blocks/updated-at/index.d.ts +2 -2
  192. package/dist/blocks/usage/index.d.ts +4 -4
  193. package/dist/blocks/vercel-marketplace/index.d.ts +5 -5
  194. package/dist/blocks/versions/index.d.ts +6 -6
  195. package/dist/blocks/waitlist/index.d.ts +5 -5
  196. package/dist/blocks/webhooks/index.d.ts +13 -13
  197. package/dist/blocks/webhooks/index.js +2 -1
  198. package/dist/blocks/workflow-editor/index.d.ts +9 -9
  199. package/dist/blocks/workflow-editor/index.js +1 -1
  200. package/dist/blocks/workflows/index.d.ts +7 -7
  201. package/dist/{bookings-CHUzFwOI.d.ts → bookings-Du1lvUg1.d.ts} +3 -3
  202. package/dist/{bucket-CrsJNHzi.d.ts → bucket-CjIhrluq.d.ts} +1 -1
  203. package/dist/cache-tags-C5Oivuxo.js +27 -0
  204. package/dist/{sign-in-D5Bg7R47.d.ts → cache-tags-DDWP8yDs.d.ts} +16 -2
  205. package/dist/{channel-B_kufDZy.d.ts → channel-DW9iIWgu.d.ts} +3 -1
  206. package/dist/chat-sdk/index.d.ts +6 -6
  207. package/dist/claims/index.d.ts +6 -6
  208. package/dist/claims/index.js +2 -2
  209. package/dist/cli/{add-uwUI80aZ.js → add-B6TTIKos.js} +23 -5
  210. package/dist/cli/{add-fdZAY8C_.js → add-CYH9OE6d.js} +13 -13
  211. package/dist/cli/add-DsgNHrEH.js +1 -0
  212. package/dist/cli/{app-table-files-BR_7lT4u.js → app-table-files-Br1VQgjE.js} +14 -6
  213. package/dist/cli/{app-tables-DoxrhJb1.js → app-tables-FRO1l5rT.js} +2 -2
  214. package/dist/cli/{backfill-BTMgDL6X.js → backfill-BgGBBidH.js} +4 -4
  215. package/dist/cli/bin.js +1 -1
  216. package/dist/cli/{blocks-BgPbXNhB.js → blocks-CX_172Ja.js} +1 -1
  217. package/dist/cli/{blocks-Bj0LS3rF.js → blocks-DZrlz-13.js} +2 -2
  218. package/dist/cli/{cache-CEGpAmXJ.js → cache-BgiLj67N.js} +1 -1
  219. package/dist/cli/{codemod-CaXGpQ10.js → codemod-C86T5p1T.js} +97 -13
  220. package/dist/cli/{command-67WobzTC.js → command-DtQ7P9XP.js} +6 -0
  221. package/dist/cli/{completion-C3nMZgUZ.js → completion-9tK4vX1l.js} +2 -2
  222. package/dist/cli/{completion-Dm0S3ub0.js → completion-DUnYq3GC.js} +2 -2
  223. package/dist/cli/{completion-DSrus7H1.js → completion-djG61QR0.js} +1 -1
  224. package/dist/cli/{config-CrwCec-B.js → config-05wlBDsJ.js} +1 -1
  225. package/dist/cli/{config-DrrkMihk.js → config-Cb4swJ2X.js} +66 -15
  226. package/dist/cli/{config-cbK-wiNs.js → config-CwcsseeT.js} +1 -1
  227. package/dist/cli/{content-mapper-BJRfCnFX.js → content-mapper-DIO-tycM.js} +2 -2
  228. package/dist/cli/{db-bK5eCLaE.js → db-BND9MSu1.js} +3 -3
  229. package/dist/cli/{doctor-CHQDLcwL.js → doctor-BqS2dAI-.js} +354 -234
  230. package/dist/cli/{env-CCT-dMFm.js → env-2zOK0skq.js} +1 -1
  231. package/dist/cli/env-NHlaYmXG.js +1 -0
  232. package/dist/cli/{gen-DSK152A3.js → gen-CygGjwk4.js} +16 -16
  233. package/dist/cli/index.d.ts +1 -1
  234. package/dist/cli/index.js +8 -8
  235. package/dist/cli/{init-CPC1ceqC.js → init-BMDuL671.js} +10 -10
  236. package/dist/cli/{keys-Dj5sJNj7.js → keys-BUl10CEQ.js} +1 -1
  237. package/dist/cli/{live-BFXisTDf.js → live-BRhu6mk8.js} +2 -2
  238. package/dist/cli/{mcp-CrulrTBs.js → mcp-DzfSUgqc.js} +3 -3
  239. package/dist/cli/{metadata-yePOltZY.js → metadata-Ao_uwhbL.js} +3 -3
  240. package/dist/cli/{migrate-kjYx7du-.js → migrate-BySeyvYY.js} +2 -2
  241. package/dist/cli/{migration-safety-DnvCYRsw.js → migration-safety-CtSYqXjZ.js} +2 -2
  242. package/dist/cli/{migrations-ZYHA0gks.js → migrations-Cnf7TlYZ.js} +2 -2
  243. package/dist/cli/{module-migration-Du7UHsO9.js → module-migration-CKKOcrG0.js} +2 -2
  244. package/dist/cli/{moved-CY0yDtAr.js → moved-QZ-btdFz.js} +1 -1
  245. package/dist/cli/{parse-yAC-NFMq.js → parse-Bd_CRjbn.js} +1 -1
  246. package/dist/cli/{powersync-BOxy1_xW.js → powersync-BeeW0i26.js} +184 -67
  247. package/dist/cli/powersync-miOelRmt.js +1 -0
  248. package/dist/cli/{print-B4OqfSML.js → print-Sdb6L0v4.js} +2 -2
  249. package/dist/cli/{providers-KYOKi_jp.js → providers-BlkYmOf-.js} +1 -1
  250. package/dist/cli/{prune-workflows-7JISyAI7.js → prune-workflows-iRTaOxbs.js} +4 -4
  251. package/dist/cli/{remove-DvncDSRp.js → remove-DvzSG08w.js} +6 -6
  252. package/dist/cli/{render-C6dQ0C0Y.js → render-svtBPq7R.js} +118 -18
  253. package/dist/cli/{run-DWDRg4vp.js → run-BHhVGtd_.js} +46 -45
  254. package/dist/cli/{run-BYiApqFR.js → run-CnafzCVh.js} +14 -14
  255. package/dist/cli/{run-DX4X7xqV.js → run-WD6LyrAZ.js} +2 -2
  256. package/dist/cli/{seed-DSC6f0oh.js → seed-Bc_q0nFf.js} +12 -4
  257. package/dist/cli/seed-DT_k-CGR.js +1 -0
  258. package/dist/cli/{shared-DC86fQYk.js → shared-By7_hqFX.js} +1 -1
  259. package/dist/cli/{skills-B5p6bDwe.js → skills-CvEA4xdj.js} +1 -1
  260. package/dist/cli/{snapshot-CwCG_YX2.js → snapshot-T8fVRXqA.js} +3 -3
  261. package/dist/cli/{source-args-Bz5QQne2.js → source-args-BiySywDB.js} +1 -1
  262. package/dist/cli/{source-DDxRHVzk.js → source-xL7qYX0r.js} +1 -1
  263. package/dist/cli/{spec-CvKJ6GpI.js → spec-BH7BDCnA.js} +1 -1
  264. package/dist/cli/{spec-Cnxqc7kC.js → spec-CU_OO1Gq.js} +3 -3
  265. package/dist/cli/{sql-layout-BwbfVSR8.js → sql-layout-C_-LNpAw.js} +32 -13
  266. package/dist/cli/{stack-CQXLe5j0.js → stack-DM3keIfh.js} +1 -1
  267. package/dist/cli/{sync-lpbLqJly.js → sync-Bl4Kf4_T.js} +4 -4
  268. package/dist/cli/{table-BIQA9Hdt.js → table-DocogEpr.js} +2 -2
  269. package/dist/cli/{upgrade-Cq4EFBH7.js → upgrade-BLi83wT-.js} +5 -5
  270. package/dist/cli/{upgrade-34ZODJZj.js → upgrade-kce809Am.js} +3 -3
  271. package/dist/cli/{version-BGN5319Z.js → version-D8HDt2fH.js} +1 -1
  272. package/dist/client/index.d.ts +8 -7
  273. package/dist/client/index.js +2 -1
  274. package/dist/client/native/index.d.ts +8 -31
  275. package/dist/client/native/index.js +3 -2
  276. package/dist/{cloud-event-BjgxkfJJ.d.ts → cloud-event-Dxy5EZVG.d.ts} +1 -1
  277. package/dist/commerce/index.d.ts +1 -1
  278. package/dist/{compiler-BOW4yPcW.d.ts → compiler-CJorTlU7.d.ts} +2 -2
  279. package/dist/{composite-DPN4SFud.d.ts → composite-DNDFvcQc.d.ts} +7 -7
  280. package/dist/{composite-BidYZWZY.js → composite-c7POXFs3.js} +2 -2
  281. package/dist/config/index.d.ts +6 -6
  282. package/dist/config/index.js +5 -5
  283. package/dist/{config-BN17nVp1.js → config--zZjnkYA.js} +1 -1
  284. package/dist/{config-C-eXOuhp.js → config-CAbv8kRz.js} +21 -8
  285. package/dist/{connectors-OMJkoAP6.d.ts → connectors-BQtx-Llh.d.ts} +4 -4
  286. package/dist/{context-Dga2sgyx.d.ts → context-Lhw7PgdA.d.ts} +88 -10
  287. package/dist/contract/index.d.ts +11 -10
  288. package/dist/{controller-BFOCK5AG.d.ts → controller-CouRuczb.d.ts} +1 -1
  289. package/dist/{controller-y1kSMuCU.js → controller-DxzV9X72.js} +1 -1
  290. package/dist/{conversion-BShzA-u-.d.ts → conversion-G2ODS617.d.ts} +1 -1
  291. package/dist/create/index.d.ts +3 -3
  292. package/dist/create/index.js +18 -3
  293. package/dist/create/lite/index.d.ts +4 -4
  294. package/dist/create/lite/index.js +3 -3
  295. package/dist/credentials/index.d.ts +4 -4
  296. package/dist/{data-engine-CX1oYDZl.d.ts → data-engine-ZcGeVz1i.d.ts} +7 -1
  297. package/dist/{data-hooks-BToeAcQ_.js → data-hooks-DDEPFoWv.js} +44 -3
  298. package/dist/{define-C_He1bQO.d.ts → db-blocks-Dgu-HpFb.d.ts} +299 -299
  299. package/dist/{define-block-DBD7yhQg.d.ts → define-block-eiBbZ3mM.d.ts} +363 -363
  300. package/dist/{delegation-C2rLpkHO.js → delegation-C0EQp3ss.js} +1 -1
  301. package/dist/{documents-CNVPrE_0.d.ts → documents-Ciijx56T.d.ts} +3 -3
  302. package/dist/edge/index.d.ts +9 -9
  303. package/dist/edge/index.js +6 -7
  304. package/dist/elysia/index.d.ts +1 -1
  305. package/dist/elysia/index.js +1 -1
  306. package/dist/{email-BRm6wMWQ.d.ts → email-_X1-FD9h.d.ts} +1 -1
  307. package/dist/{embeddings-C2PBJ2Lx.d.ts → embeddings-DJs1UeQt.d.ts} +1 -1
  308. package/dist/{ended-BwpmNC5k.d.ts → ended-XY1q20JM.d.ts} +2 -2
  309. package/dist/{entitlements-C5k_9hHt.d.ts → entitlements-D_vas3Yl.d.ts} +2 -2
  310. package/dist/{envelope-CapD-JtH.js → envelope-CSb4c7xn.js} +1 -1
  311. package/dist/eve/index.d.ts +9 -9
  312. package/dist/eve/index.js +2 -2
  313. package/dist/{eve-CtQd4iaO.d.ts → eve-Ck586Yfh.d.ts} +2 -2
  314. package/dist/events/index.d.ts +3 -3
  315. package/dist/{events-DddDlibJ.d.ts → events-sK2YdMhE.d.ts} +40 -3
  316. package/dist/{executor-CxMHiDp_.d.ts → executor-DAQLygMX.d.ts} +4 -4
  317. package/dist/{executor-DL7cZ-3T.d.ts → executor-h4VT8TNz.d.ts} +1 -1
  318. package/dist/{executor-DoSNec_H.d.ts → executor-rs231gO_.d.ts} +1 -1
  319. package/dist/expo/index.d.ts +51 -8
  320. package/dist/expo/index.js +89 -4
  321. package/dist/{field-errors-LVBXokQN.d.ts → field-errors-BFLehpue.d.ts} +25 -13
  322. package/dist/{field-formats-DVukMbRa.d.ts → field-formats-BJeg-rv8.d.ts} +13 -3
  323. package/dist/{field-formats-Cap-V7UP.js → field-formats-sLYMh1ZK.js} +52 -4
  324. package/dist/{fields-CP46SPNE.d.ts → fields-OVgN0HOy.d.ts} +1 -1
  325. package/dist/{filter-evaluate-Bkbb0nuQ.d.ts → filter-evaluate-BzyMp2LO.d.ts} +1 -1
  326. package/dist/{filter-query-Xj40B5KT.d.ts → filter-query-BcheQ5zK.d.ts} +1 -1
  327. package/dist/{flags-BrXfCmGB.d.ts → flags-D71LTDHR.d.ts} +2 -2
  328. package/dist/flags-sdk/index.d.ts +2 -2
  329. package/dist/{framework-z3KTPRjk.js → framework-DvtET86P.js} +1 -1
  330. package/dist/{framework-B6JAPr1i.d.ts → framework-v4jPUZJ-.d.ts} +8 -8
  331. package/dist/{gateway-DJX-XUWl.d.ts → gateway-BEDpSlLD.d.ts} +3 -3
  332. package/dist/guest-actions-Du1ph4dE.js +11 -0
  333. package/dist/h3/index.d.ts +1 -1
  334. package/dist/h3/index.js +1 -1
  335. package/dist/h3/v1/index.d.ts +1 -1
  336. package/dist/h3/v1/index.js +1 -1
  337. package/dist/hono/index.d.ts +11 -11
  338. package/dist/hono/index.js +6 -7
  339. package/dist/{inbox-DiQ8KhG8.d.ts → inbox-nk8pqL8V.d.ts} +5 -5
  340. package/dist/{index-1uV69AZq.d.ts → index-BKDvrKDl.d.ts} +1 -1
  341. package/dist/{index-1_-lg9Gc.d.ts → index-BRFHDjCG.d.ts} +21 -7
  342. package/dist/{index-D-SIdOiL.d.ts → index-BoVZxiin.d.ts} +15 -15
  343. package/dist/{index-DjJUamhw.d.ts → index-CJfDiWQf.d.ts} +7 -4
  344. package/dist/{index-CjN6kzvL.d.ts → index-Cc2q2eaq.d.ts} +20 -7
  345. package/dist/{index-BA8sPQ49.d.ts → index-D2gezcOV.d.ts} +5 -5
  346. package/dist/{index-CvLTqmdq.d.ts → index-D430cWV7.d.ts} +1 -1
  347. package/dist/{index-DBbdaYAH.d.ts → index-DYSGzEkY.d.ts} +1 -1
  348. package/dist/{index-DwP65vFk.d.ts → index-eZ8oW-DV.d.ts} +5 -5
  349. package/dist/{index-DUmsXPdh.d.ts → index-nfYh7R5C.d.ts} +5 -5
  350. package/dist/{index-BhmjjkMu.d.ts → index-wRn2y3XS.d.ts} +6 -6
  351. package/dist/index.d.ts +9 -8
  352. package/dist/index.js +3 -2
  353. package/dist/{instances-Bx94JGSW.js → instances-BUhbreNT.js} +1606 -181
  354. package/dist/{kit-D5rRAKWJ.js → kit-C-uC7_aG.js} +106 -4
  355. package/dist/{kit-lHFpu2_1.d.ts → kit-CmO46iau.d.ts} +4 -4
  356. package/dist/{knowledge-DtECa_QW.d.ts → knowledge-BnKrvPT6.d.ts} +27 -9
  357. package/dist/{knowledge-CJnZOaix.js → knowledge-BxFkHBTc.js} +14 -3
  358. package/dist/lint/index.d.ts +1 -1
  359. package/dist/list/index.d.ts +3 -3
  360. package/dist/{list-query-BkbLV-Yc.d.ts → list-query-CnD6uNzs.d.ts} +3 -3
  361. package/dist/mapper/bin.js +8 -7
  362. package/dist/mcp/index.d.ts +3 -3
  363. package/dist/mcp/index.js +4 -5
  364. package/dist/mcp/sdk/index.d.ts +19 -8
  365. package/dist/mcp/sdk/index.js +21 -12
  366. package/dist/{messaging-CpQIhkFi.d.ts → messaging-2-SIPAp-.d.ts} +4 -4
  367. package/dist/nestjs/index.d.ts +2 -2
  368. package/dist/nestjs/index.js +1 -1
  369. package/dist/next/client/index.d.ts +1 -1
  370. package/dist/next/index.d.ts +29 -76
  371. package/dist/next/index.js +31 -119
  372. package/dist/node/index.d.ts +2 -2
  373. package/dist/node/index.js +1 -1
  374. package/dist/{operations-J0PkKTaF.d.ts → operations-kNq7cGI7.d.ts} +1 -1
  375. package/dist/{options-CJR59q8s.js → options-B1efbeOv.js} +5 -1
  376. package/dist/options-B3dQnXgp.js +6 -0
  377. package/dist/{options-ByxOMSXu.js → options-BEv5xfPg.js} +3 -1
  378. package/dist/options-BZ5TzeFN.js +12 -0
  379. package/dist/options-CKMLVUel.js +8 -0
  380. package/dist/options-Cdr6Ac4-.d.ts +12 -0
  381. package/dist/options-CgIKw9s6.js +9 -0
  382. package/dist/{options-DUNUGuhM.js → options-CpSqyI8k.js} +4 -1
  383. package/dist/options-D1-2o7kO.d.ts +43 -0
  384. package/dist/{options-CjocPkX1.js → options-EdzV163Y.js} +3 -0
  385. package/dist/orpc/index.d.ts +27 -16
  386. package/dist/orpc/index.js +29 -10
  387. package/dist/otel/index.d.ts +3 -3
  388. package/dist/otel/index.js +5 -5
  389. package/dist/{outbox-Cpxpzcue.d.ts → outbox-CcISFwgE.d.ts} +4 -4
  390. package/dist/{permissions-Cp2qvVJo.d.ts → permissions-XrrAYkXm.d.ts} +1 -1
  391. package/dist/{permissions-controller-B4uI5IPH.js → permissions-controller-DYm6sF8k.js} +6 -2
  392. package/dist/{pool-BJAjQcrJ.d.ts → pool-CQuNr7Nq.d.ts} +3 -3
  393. package/dist/{ports-C61eesjD.d.ts → ports-CvOsUmuD.d.ts} +1 -1
  394. package/dist/postgres/index.d.ts +4 -4
  395. package/dist/{postgrest-Bjain6nf.d.ts → postgrest-CF0ekbC-.d.ts} +1 -1
  396. package/dist/powersync/index.d.ts +95 -19
  397. package/dist/powersync/index.js +136 -15
  398. package/dist/preset/index.d.ts +3 -3
  399. package/dist/preset/index.js +3 -3
  400. package/dist/{preset-yRJgGbn9.js → preset-DFZn_TLi.js} +3 -3
  401. package/dist/{project-ps9mOsLx.js → project-BwmNYaZt.js} +13 -7
  402. package/dist/{provider-CVlXXbda.d.ts → provider-CgYoyX_d.d.ts} +1 -1
  403. package/dist/{push-token-2LRdwl_8.d.ts → push-token-taE-3JNT.d.ts} +1 -1
  404. package/dist/query/index.d.ts +2 -2
  405. package/dist/query/index.js +30 -2
  406. package/dist/rate-limit/index.d.ts +2 -0
  407. package/dist/rate-limit/index.js +1 -0
  408. package/dist/rate-limit-BJyp7iAx.d.ts +109 -0
  409. package/dist/rate-limit-DLZWqcIS.js +94 -0
  410. package/dist/rate-limit-DyQbVEBE.js +123 -0
  411. package/dist/rate-limit-lGysIP9Z.d.ts +79 -0
  412. package/dist/react/index.d.ts +10 -11
  413. package/dist/react/index.js +4 -4
  414. package/dist/react/native/index.d.ts +39 -2
  415. package/dist/react/native/index.js +48 -3
  416. package/dist/react/server.d.ts +9 -10
  417. package/dist/react/server.js +3 -3
  418. package/dist/react/session.d.ts +64 -2
  419. package/dist/react/session.js +1 -1
  420. package/dist/{react-DZ7AW2yf.js → react-AC0iYStn.js} +15 -8
  421. package/dist/react-router/index.d.ts +6 -6
  422. package/dist/react-router/index.js +4 -5
  423. package/dist/realtime/index.d.ts +6 -6
  424. package/dist/realtime/index.js +1 -1
  425. package/dist/{record-form-C-1TPtMG.d.ts → record-form-BAIG-cdw.d.ts} +1 -1
  426. package/dist/{record-type-oQxekQTX.js → record-type-BID6K9Vk.js} +1 -1
  427. package/dist/{recordings-BVuri85k.d.ts → recordings-fWDldPuP.d.ts} +1 -1
  428. package/dist/records/index.d.ts +9 -9
  429. package/dist/records/index.js +5 -5
  430. package/dist/{refusal-CjUUBfhY.d.ts → refusal-D19i-uE3.d.ts} +3 -3
  431. package/dist/{refusal-rnbr6RZD.js → refusal-lgW07wlX.js} +1 -2
  432. package/dist/renames-BPU-FSIn.d.ts +36 -0
  433. package/dist/renames-BoN2IHI7.js +161 -0
  434. package/dist/representatives-DRNDAf0i.js +22 -0
  435. package/dist/{resolve-XlMQRUeG.d.ts → resolve-C_VNGFjz.d.ts} +8 -1
  436. package/dist/{resolve-CZV31iCm.js → resolve-nj0eZ44A.js} +38 -1
  437. package/dist/{resource-COaS9_i8.js → resource--iTRgH4N.js} +1 -1
  438. package/dist/{resource-CaYpB07K.d.ts → resource-C_rLLwNU.d.ts} +1 -1
  439. package/dist/{resource-execute-B7-QaS6R.d.ts → resource-execute-CoadG2g7.d.ts} +2 -2
  440. package/dist/{resource-types-CF3Uc6OW.d.ts → resource-types-e7vzPJ7t.d.ts} +4 -4
  441. package/dist/{resources-DnHSmJIM.d.ts → resources-DSqe-GbC.d.ts} +2 -2
  442. package/dist/{resources-DhiK3yLO.js → resources-DqEg3HBk.js} +1 -1
  443. package/dist/{respond-D7kUatjc.d.ts → respond-C8rBdIBZ.d.ts} +1 -1
  444. package/dist/{sales-lines-wQHuL-pa.d.ts → sales-lines-DFQ9oIO-.d.ts} +1 -1
  445. package/dist/{sandboxes-DKgJZYUZ.d.ts → sandboxes-Xh_uNXU4.d.ts} +1 -1
  446. package/dist/{scores-BXuSVczw.d.ts → scores-DaGD79BY.d.ts} +5 -5
  447. package/dist/server/index.d.ts +29 -38
  448. package/dist/server/index.js +11 -11
  449. package/dist/{server-types-DpI82uNq.d.ts → server-types-Djx3Eb2G.d.ts} +91 -17
  450. package/dist/{session-s-mUZ8RQ.d.ts → session-BgxLbDYu.d.ts} +6 -6
  451. package/dist/{session-BjPYE4dT.js → session-CaoAgv8e.js} +58 -51
  452. package/dist/{session-status-CJjTuFtA.d.ts → session-status-C4g0QoB_.d.ts} +2 -2
  453. package/dist/{sign-in-k2lXELeC.js → sign-in-Cl7vhgRn.js} +1 -1
  454. package/dist/{sign-in-djgvab1X.js → sign-in-Dhd16x_j.js} +1 -1
  455. package/dist/{signers-UANxMfH-.d.ts → signers-CtrTcr3i.d.ts} +4 -4
  456. package/dist/{signing-keys-DhBSWFy_.d.ts → signing-keys-BAyNlJE4.d.ts} +2 -2
  457. package/dist/solid/index.d.ts +12 -12
  458. package/dist/solid/index.js +3 -3
  459. package/dist/solid-start/index.d.ts +6 -6
  460. package/dist/solid-start/index.js +4 -5
  461. package/dist/spec/index.d.ts +3 -3
  462. package/dist/spec/index.js +2 -2
  463. package/dist/{spec-pins-FKUzgF6K.js → spec-pins-C-1kGh8u.js} +2 -1
  464. package/dist/{spec-pins-CuQ2anBw.d.ts → spec-pins-DGbByPMT.d.ts} +6 -1
  465. package/dist/sql/index.d.ts +6 -6
  466. package/dist/sql/index.js +5 -5
  467. package/dist/{sql-CWzlxS6f.js → sql-TpANPmq7.js} +9994 -2373
  468. package/dist/sqlite/index.d.ts +3 -3
  469. package/dist/{sso-Frh3sbJ1.d.ts → sso-BVYSNVmk.d.ts} +3 -3
  470. package/dist/ssr/index.d.ts +4 -4
  471. package/dist/ssr/index.js +1 -1
  472. package/dist/storage/index.d.ts +3 -3
  473. package/dist/storage/index.js +1 -1
  474. package/dist/streams/index.d.ts +1 -1
  475. package/dist/{subject-readers-D1Km_Q42.d.ts → subject-readers-yxQ3r1qw.d.ts} +2 -2
  476. package/dist/{subjects-BGwLJ3IB.d.ts → subjects-BpUQpZhk.d.ts} +30 -2
  477. package/dist/subjects-D3BE9Q8J.d.ts +173 -0
  478. package/dist/{support-Dj5V2WTs.d.ts → support-B1n33r32.d.ts} +4 -4
  479. package/dist/{support-view-DKZkZeM5.d.ts → support-view-CkN2Wr1r.d.ts} +1 -1
  480. package/dist/svelte/index.d.ts +11 -11
  481. package/dist/svelte/index.js +3 -3
  482. package/dist/sveltekit/index.d.ts +7 -7
  483. package/dist/sveltekit/index.js +4 -5
  484. package/dist/{tags-BihwKkTT.d.ts → tags-BCjWVMKO.d.ts} +1 -1
  485. package/dist/tanstack-db/index.d.ts +3 -3
  486. package/dist/tanstack-start/index.d.ts +6 -6
  487. package/dist/tanstack-start/index.js +4 -5
  488. package/dist/{tenant-P7mo0ulH.d.ts → tenant-CBWFqFy0.d.ts} +1 -1
  489. package/dist/testing/index.d.ts +72 -42
  490. package/dist/testing/index.js +61 -9
  491. package/dist/{timeline-Bs-FGMIJ.js → timeline-B3pBRGv9.js} +1 -1
  492. package/dist/{timeline-BB9fKT_r.d.ts → timeline-Cy7XP2pq.d.ts} +5 -5
  493. package/dist/{topic-k17VvXRj.js → topic-BC3p90lS.js} +1 -1
  494. package/dist/{topic-CjKlzHD-.d.ts → topic-BWJAJkF3.d.ts} +5 -5
  495. package/dist/{types-D--4dv5K.d.ts → types-B5qUEVWI.d.ts} +26 -20
  496. package/dist/{types-z31g0-5T.d.ts → types-B_2C7bqG.d.ts} +5 -5
  497. package/dist/{types-DU_nNO7U.d.ts → types-BgvKQUuy.d.ts} +3 -3
  498. package/dist/{types-LLCyr-xs.d.ts → types-ByApBdXv.d.ts} +5 -5
  499. package/dist/{types-BzIYSSWK.d.ts → types-CF5j7kOm.d.ts} +4 -2
  500. package/dist/{types-kq8S5HVE.d.ts → types-CeV22tnf.d.ts} +1 -1
  501. package/dist/{types-VwM7DBvC.d.ts → types-Dlir1n-q.d.ts} +2 -2
  502. package/dist/{types-DCzgSAlU.d.ts → types-sBLcw65Z.d.ts} +5 -5
  503. package/dist/{undo-BCQMqIQN.d.ts → undo-CbLZkEny.d.ts} +2 -2
  504. package/dist/{usage-CJDj5j15.d.ts → usage-BcD0X7qJ.d.ts} +4 -4
  505. package/dist/{vault-CbhvnoVC.d.ts → vault-BVLUu_Ph.d.ts} +2 -2
  506. package/dist/vercel-connect/index.d.ts +1 -1
  507. package/dist/vercel-sandbox/index.d.ts +2 -2
  508. package/dist/{verify-Cpc1upDA.d.ts → verify-DlKjgAEj.d.ts} +2 -2
  509. package/dist/{view-eHgOOyRS.d.ts → view-GSwP0y5o.d.ts} +27 -3
  510. package/dist/vue/index.d.ts +12 -12
  511. package/dist/vue/index.js +3 -3
  512. package/dist/{watch-topic-jqBMNMs3.d.ts → watch-topic-BfaaK5SW.d.ts} +1 -1
  513. package/dist/{rate-limit-BJ4EMdAy.js → webhook-inbox-C94C_zIV.js} +3 -119
  514. package/dist/workflow-sdk/builder/index.d.ts +3 -3
  515. package/dist/workflow-sdk/builder/index.js +1 -1
  516. package/dist/workflow-sdk/index.d.ts +1 -1
  517. package/dist/workflow-sdk/index.js +1 -1
  518. package/dist/workflow-sdk/world/index.d.ts +1 -1
  519. package/dist/workflow-sdk/world/index.js +1 -1
  520. package/dist/{workflow-sdk-q2jnEaAJ.js → workflow-sdk-CZa83j_U.js} +1 -1
  521. package/dist/{workflow-sdk-DzKQo265.d.ts → workflow-sdk-DiDsEArJ.d.ts} +3 -3
  522. package/dist/{workflow-sdk-Bps7tpOv.js → workflow-sdk-DmHaJHUL.js} +170 -115
  523. package/dist/{workflows-D7HvWeNu.d.ts → workflows-D1Ax0qSC.d.ts} +7 -7
  524. package/dist/yjs/index.d.ts +2 -2
  525. package/dist/yjs/index.js +1 -1
  526. package/package.json +17 -1
  527. package/schemas/config-v1.json +225 -3
  528. package/schemas/design-v1.json +7 -1
  529. package/schemas/doctor-report-v1.json +3 -0
  530. package/skills/better-supabase/SKILL.md +3 -1
  531. package/skills/better-supabase/references/ui-recipes.md +1189 -144
  532. package/skills/better-supabase-api/SKILL.md +1 -1
  533. package/skills/better-supabase-auth/SKILL.md +26 -2
  534. package/skills/better-supabase-auth/references/native.md +115 -0
  535. package/dist/cli/add-CjSPssgL.js +0 -1
  536. package/dist/cli/env-AFfMXxWw.js +0 -1
  537. package/dist/cli/powersync-BurpZLJB.js +0 -1
  538. package/dist/cli/seed-CLlvrV8I.js +0 -1
  539. package/dist/guest-actions-CEwttioE.js +0 -8
  540. package/dist/impersonation-BOCJcsmS.d.ts +0 -26
  541. package/dist/options-B7Pl708M.js +0 -8
  542. package/dist/options-B9w_Y08G.d.ts +0 -6
  543. package/dist/rate-limit-C89Yzwd9.d.ts +0 -48
  544. package/dist/rate-limit-DXJbLVg0.js +0 -48
  545. package/dist/respond-8A3EOo61.js +0 -106
  546. package/dist/session-JV1z0kxa.d.ts +0 -77
  547. package/dist/subjects-DNFE2rMl.d.ts +0 -86
@@ -1162,7 +1162,7 @@ import type { OrganizationMembership } from "better-supabase/blocks/organization
1162
1162
 
1163
1163
  import { ActivityIndicator, Pressable, Text, View } from "react-native";
1164
1164
 
1165
- import type { OrganizationSource } from "../hooks/use-organizations";
1165
+ import type { UseOrganizationsOptions } from "../hooks/use-organizations";
1166
1166
 
1167
1167
  import { useOrganizations } from "../hooks/use-organizations";
1168
1168
  import { API_SCHEMA } from "../lib/blocks";
@@ -1170,19 +1170,17 @@ import { API_SCHEMA } from "../lib/blocks";
1170
1170
  /**
1171
1171
  * The caller's organizations. Pressing one switches to it, refreshes the
1172
1172
  * session so the token carries the new tenant, and loads the list again. `load`
1173
- * reads them elsewhere, such as from the PowerSync database.
1173
+ * reads them elsewhere, such as from the PowerSync database, and `onSwitched`
1174
+ * replaces the refresh, such as one that also reconnects sync.
1174
1175
  */
1175
- export function OrganizationSwitcher({
1176
- load,
1177
- }: {
1178
- readonly load?: OrganizationSource<OrganizationMembership>;
1179
- }) {
1176
+ export function OrganizationSwitcher(
1177
+ props: Pick<
1178
+ UseOrganizationsOptions<OrganizationMembership>,
1179
+ "load" | "onSwitched"
1180
+ >,
1181
+ ) {
1180
1182
  const { organizations, activeId, switching, error, switchTo } =
1181
- useOrganizations(
1182
- load === undefined
1183
- ? { schema: API_SCHEMA }
1184
- : { schema: API_SCHEMA, load },
1185
- );
1183
+ useOrganizations({ ...props, schema: API_SCHEMA });
1186
1184
 
1187
1185
  if (organizations === undefined) {
1188
1186
  return <ActivityIndicator />;
@@ -7037,8 +7035,8 @@ function TaskRows({ tasks }: { tasks: readonly AiTaskRow[] }) {
7037
7035
 
7038
7036
  /**
7039
7037
  * The caller's scheduled AI tasks, read on the server through `aiTasks.list`,
7040
- * with each task's next occurrence and its latest run. An admin with `ai.admin`
7041
- * 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.
7042
7040
  */
7043
7041
  export function AiTaskQueue({ read }: { read: AiTasksRead }) {
7044
7042
  const t = useExtracted("aiTasks");
@@ -10488,6 +10486,129 @@ function SharingPanel({
10488
10486
  }
10489
10487
  ```
10490
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
+
10491
10612
  ## Reactions bar
10492
10613
 
10493
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.
@@ -11585,7 +11706,7 @@ export async function ContactDetail({
11585
11706
  getPermissions(),
11586
11707
  ]);
11587
11708
 
11588
- if (!can(permissions, "parties.read")) {
11709
+ if (!can(permissions, "contacts.read")) {
11589
11710
  forbidden();
11590
11711
  }
11591
11712
 
@@ -11716,7 +11837,7 @@ export async function ContactDetail({
11716
11837
  ))}
11717
11838
  </ul>
11718
11839
  )}
11719
- {can(permissions, "parties.write") ? (
11840
+ {can(permissions, "contacts.write") ? (
11720
11841
  <LinkPersonForm
11721
11842
  companyId={contact.id}
11722
11843
  people={contact.candidates.map((person) => ({
@@ -12059,7 +12180,7 @@ export async function ActivityTimeline({
12059
12180
  getPermissions(),
12060
12181
  ]);
12061
12182
 
12062
- if (!can(permissions, "engagements.read")) {
12183
+ if (!can(permissions, "activities.read")) {
12063
12184
  return null;
12064
12185
  }
12065
12186
 
@@ -12069,7 +12190,7 @@ export async function ActivityTimeline({
12069
12190
  return null;
12070
12191
  }
12071
12192
 
12072
- const canLog = can(permissions, "engagements.write");
12193
+ const canLog = can(permissions, "activities.write");
12073
12194
 
12074
12195
  const types = new Map([
12075
12196
  ["call", t("Call")],
@@ -12353,7 +12474,7 @@ export async function TargetsProgress() {
12353
12474
  getPermissions(),
12354
12475
  ]);
12355
12476
 
12356
- if (!can(permissions, "targets.read")) {
12477
+ if (!can(permissions, "goals.read")) {
12357
12478
  return null;
12358
12479
  }
12359
12480
 
@@ -12363,7 +12484,7 @@ export async function TargetsProgress() {
12363
12484
  return null;
12364
12485
  }
12365
12486
 
12366
- const canManage = can(permissions, "targets.manage");
12487
+ const canManage = can(permissions, "goals.manage");
12367
12488
 
12368
12489
  const amountOf = (target: TargetRow, value: bigint) =>
12369
12490
  target.currency === null
@@ -14529,7 +14650,7 @@ npx shadcn add card empty skeleton
14529
14650
  /**
14530
14651
  * Render inside `<Suspense>`: the employees as an org chart, each manager above
14531
14652
  * their reports, with a search. Private details open in a sheet for callers
14532
- * with `employees.view_sensitive`.
14653
+ * with `employees.read_sensitive`.
14533
14654
  */
14534
14655
  export async function EmployeeDirectory() {
14535
14656
  const [t, permissions] = await Promise.all([
@@ -14548,7 +14669,7 @@ export async function EmployeeDirectory() {
14548
14669
  }
14549
14670
 
14550
14671
  const canWrite = can(permissions, "employees.write");
14551
- const canViewSensitive = can(permissions, "employees.view_sensitive");
14672
+ const canViewSensitive = can(permissions, "employees.read_sensitive");
14552
14673
 
14553
14674
  const managers =
14554
14675
  directory.kind === "ok"
@@ -14606,145 +14727,652 @@ export async function EmployeeDirectory() {
14606
14727
  }
14607
14728
  ```
14608
14729
 
14609
- ## Hiring board
14730
+ ## Qualification matrix
14610
14731
 
14611
- 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.
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.
14612
14733
 
14613
14734
  Web, with shadcn components:
14614
14735
 
14615
14736
  ```bash
14616
- npx shadcn add badge button card empty skeleton
14737
+ npx shadcn add alert badge button card empty skeleton table
14617
14738
  ```
14618
14739
 
14619
- ```tsx title="apps/examples/nextjs/src/features/people/components/hiring-board.tsx"
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
+
14620
14753
  /**
14621
- * Render inside `<Suspense>`: the candidates of one opening as cards in its
14622
- * stage columns. Dragging a card to Hired or Rejected closes the application;
14623
- * to another open stage, moves it. `?job=` picks the opening.
14754
+ * Render inside `<Suspense>` for members with `qualifications.read`: each
14755
+ * required qualification a member lacks, has let lapse or is about to lose.
14624
14756
  */
14625
- export async function HiringBoard({
14626
- searchParams,
14627
- }: {
14628
- searchParams: Promise<Record<string, string | string[] | undefined>>;
14629
- }) {
14630
- const [t, query, permissions] = await Promise.all([
14631
- getExtracted("people"),
14632
- searchParams,
14633
- getPermissions(),
14757
+ export async function QualificationMatrix() {
14758
+ const [state, t, format] = await Promise.all([
14759
+ getMatrix(),
14760
+ getExtracted("qualifications"),
14761
+ getFormatter(),
14634
14762
  ]);
14635
14763
 
14636
- if (!can(permissions, "hiring.read")) {
14637
- forbidden();
14764
+ if (state.kind === "no-organization") {
14765
+ return null;
14638
14766
  }
14639
14767
 
14640
- const board = await settle(loadHiringBoard);
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
+ }
14641
14784
 
14642
- if (board.kind === "no-organization") {
14643
- return null;
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
+ );
14644
14811
  }
14645
14812
 
14646
- const canManage = can(permissions, "hiring.manage");
14647
- const canWrite = can(permissions, "hiring.write");
14648
- const jobs = board.kind === "ok" ? board.data.jobs : [];
14649
- const job = jobs.find((item) => item.id === query["job"]) ?? jobs[0];
14813
+ const label = (status: QualificationGapStatus) => {
14814
+ switch (status) {
14815
+ case "missing": {
14816
+ return t("Missing");
14817
+ }
14650
14818
 
14651
- const cards =
14652
- board.kind === "ok" && job
14653
- ? board.data.cards.filter((card) => card.jobId === job.id)
14654
- : [];
14819
+ case "expired": {
14820
+ return t("Expired");
14821
+ }
14655
14822
 
14656
- const createOpening = canManage ? <CreateOpeningDialog /> : null;
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" });
14657
14837
 
14658
14838
  return (
14659
- <Card data-recipe="hiring-board">
14839
+ <Card data-recipe="qualification-matrix">
14660
14840
  <CardHeader>
14661
- <CardTitle>{job?.title ?? t("Hiring")}</CardTitle>
14841
+ <CardTitle>{t("Qualification gaps")}</CardTitle>
14662
14842
  <CardDescription>
14663
- {t("Drag a candidate to the next stage, or to Hired or Rejected.")}
14843
+ {t(
14844
+ "Members who lack a required qualification, hold an expired one or will lose one soon.",
14845
+ )}
14664
14846
  </CardDescription>
14665
- {jobs.length > 0 || board.kind === "error" ? (
14666
- <CardAction className="flex items-center gap-2">
14667
- {job && canWrite && board.kind === "ok" && cards.length > 0 ? (
14668
- <AddCandidateDialog
14669
- jobId={job.id}
14670
- candidates={board.data.candidates}
14671
- />
14672
- ) : null}
14673
- {createOpening}
14674
- </CardAction>
14675
- ) : null}
14676
14847
  </CardHeader>
14677
- <CardContent className="flex flex-col gap-4">
14678
- {board.kind === "error" ? (
14679
- <PeopleLoadError title={t("The hiring board didn't load")} />
14680
- ) : job === undefined ? (
14681
- <Empty className="border">
14682
- <EmptyHeader>
14683
- <EmptyMedia variant="icon">
14684
- <BriefcaseIcon />
14685
- </EmptyMedia>
14686
- <EmptyTitle>{t("No openings yet")}</EmptyTitle>
14687
- <EmptyDescription>
14688
- {canManage
14689
- ? t("Create an opening, then add candidates to it.")
14690
- : t("Ask a hiring manager to create an opening.")}
14691
- </EmptyDescription>
14692
- </EmptyHeader>
14693
- {createOpening ? (
14694
- <EmptyContent>{createOpening}</EmptyContent>
14695
- ) : null}
14696
- </Empty>
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>
14697
14853
  ) : (
14698
- <>
14699
- {jobs.length > 1 ? (
14700
- <nav
14701
- aria-label={t("Openings")}
14702
- className="flex flex-wrap items-center gap-2"
14703
- >
14704
- {jobs.map((item) => (
14705
- <Link
14706
- key={item.id}
14707
- href={`/people/hiring?job=${item.id}`}
14708
- aria-current={item.id === job.id ? "page" : undefined}
14709
- className={buttonVariants({
14710
- variant: item.id === job.id ? "secondary" : "ghost",
14711
- size: "sm",
14712
- })}
14713
- >
14714
- {item.title}
14715
- {item.status === "open" ? null : (
14716
- <Badge variant="outline">
14717
- {item.status === "draft" ? t("Draft") : t("Closed")}
14718
- </Badge>
14719
- )}
14720
- </Link>
14721
- ))}
14722
- </nav>
14723
- ) : null}
14724
- {cards.length === 0 ? (
14725
- <Empty className="border">
14726
- <EmptyHeader>
14727
- <EmptyMedia variant="icon">
14728
- <UserPlusIcon />
14729
- </EmptyMedia>
14730
- <EmptyTitle>{t("No candidates yet")}</EmptyTitle>
14731
- <EmptyDescription>
14732
- {t("Candidates start in the first stage of the pipeline.")}
14733
- </EmptyDescription>
14734
- </EmptyHeader>
14735
- {canWrite ? (
14736
- <EmptyContent>
14737
- <AddCandidateDialog
14738
- jobId={job.id}
14739
- candidates={board.data.candidates}
14740
- />
14741
- </EmptyContent>
14742
- ) : null}
14743
- </Empty>
14744
- ) : (
14745
- <HiringKanban
14746
- key={cards
14747
- .map((card) => `${card.id}:${card.stageId}`)
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
+
15237
+ ## Hiring board
15238
+
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.
15240
+
15241
+ Web, with shadcn components:
15242
+
15243
+ ```bash
15244
+ npx shadcn add badge button card empty skeleton
15245
+ ```
15246
+
15247
+ ```tsx title="apps/examples/nextjs/src/features/people/components/hiring-board.tsx"
15248
+ /**
15249
+ * Render inside `<Suspense>`: the candidates of one opening as cards in its
15250
+ * stage columns. Dragging a card to Hired or Rejected closes the application;
15251
+ * to another open stage, moves it. `?job=` picks the opening.
15252
+ */
15253
+ export async function HiringBoard({
15254
+ searchParams,
15255
+ }: {
15256
+ searchParams: Promise<Record<string, string | string[] | undefined>>;
15257
+ }) {
15258
+ const [t, query, permissions] = await Promise.all([
15259
+ getExtracted("people"),
15260
+ searchParams,
15261
+ getPermissions(),
15262
+ ]);
15263
+
15264
+ if (!can(permissions, "hiring.read")) {
15265
+ forbidden();
15266
+ }
15267
+
15268
+ const board = await settle(loadHiringBoard);
15269
+
15270
+ if (board.kind === "no-organization") {
15271
+ return null;
15272
+ }
15273
+
15274
+ const canManage = can(permissions, "hiring.manage");
15275
+ const canWrite = can(permissions, "hiring.write");
15276
+ const jobs = board.kind === "ok" ? board.data.jobs : [];
15277
+ const job = jobs.find((item) => item.id === query["job"]) ?? jobs[0];
15278
+
15279
+ const cards =
15280
+ board.kind === "ok" && job
15281
+ ? board.data.cards.filter((card) => card.jobId === job.id)
15282
+ : [];
15283
+
15284
+ const createOpening = canManage ? <CreateOpeningDialog /> : null;
15285
+
15286
+ return (
15287
+ <Card data-recipe="hiring-board">
15288
+ <CardHeader>
15289
+ <CardTitle>{job?.title ?? t("Hiring")}</CardTitle>
15290
+ <CardDescription>
15291
+ {t("Drag a candidate to the next stage, or to Hired or Rejected.")}
15292
+ </CardDescription>
15293
+ {jobs.length > 0 || board.kind === "error" ? (
15294
+ <CardAction className="flex items-center gap-2">
15295
+ {job && canWrite && board.kind === "ok" && cards.length > 0 ? (
15296
+ <AddCandidateDialog
15297
+ jobId={job.id}
15298
+ candidates={board.data.candidates}
15299
+ />
15300
+ ) : null}
15301
+ {createOpening}
15302
+ </CardAction>
15303
+ ) : null}
15304
+ </CardHeader>
15305
+ <CardContent className="flex flex-col gap-4">
15306
+ {board.kind === "error" ? (
15307
+ <PeopleLoadError title={t("The hiring board didn't load")} />
15308
+ ) : job === undefined ? (
15309
+ <Empty className="border">
15310
+ <EmptyHeader>
15311
+ <EmptyMedia variant="icon">
15312
+ <BriefcaseIcon />
15313
+ </EmptyMedia>
15314
+ <EmptyTitle>{t("No openings yet")}</EmptyTitle>
15315
+ <EmptyDescription>
15316
+ {canManage
15317
+ ? t("Create an opening, then add candidates to it.")
15318
+ : t("Ask a hiring manager to create an opening.")}
15319
+ </EmptyDescription>
15320
+ </EmptyHeader>
15321
+ {createOpening ? (
15322
+ <EmptyContent>{createOpening}</EmptyContent>
15323
+ ) : null}
15324
+ </Empty>
15325
+ ) : (
15326
+ <>
15327
+ {jobs.length > 1 ? (
15328
+ <nav
15329
+ aria-label={t("Openings")}
15330
+ className="flex flex-wrap items-center gap-2"
15331
+ >
15332
+ {jobs.map((item) => (
15333
+ <Link
15334
+ key={item.id}
15335
+ href={`/people/hiring?job=${item.id}`}
15336
+ aria-current={item.id === job.id ? "page" : undefined}
15337
+ className={buttonVariants({
15338
+ variant: item.id === job.id ? "secondary" : "ghost",
15339
+ size: "sm",
15340
+ })}
15341
+ >
15342
+ {item.title}
15343
+ {item.status === "open" ? null : (
15344
+ <Badge variant="outline">
15345
+ {item.status === "draft" ? t("Draft") : t("Closed")}
15346
+ </Badge>
15347
+ )}
15348
+ </Link>
15349
+ ))}
15350
+ </nav>
15351
+ ) : null}
15352
+ {cards.length === 0 ? (
15353
+ <Empty className="border">
15354
+ <EmptyHeader>
15355
+ <EmptyMedia variant="icon">
15356
+ <UserPlusIcon />
15357
+ </EmptyMedia>
15358
+ <EmptyTitle>{t("No candidates yet")}</EmptyTitle>
15359
+ <EmptyDescription>
15360
+ {t("Candidates start in the first stage of the pipeline.")}
15361
+ </EmptyDescription>
15362
+ </EmptyHeader>
15363
+ {canWrite ? (
15364
+ <EmptyContent>
15365
+ <AddCandidateDialog
15366
+ jobId={job.id}
15367
+ candidates={board.data.candidates}
15368
+ />
15369
+ </EmptyContent>
15370
+ ) : null}
15371
+ </Empty>
15372
+ ) : (
15373
+ <HiringKanban
15374
+ key={cards
15375
+ .map((card) => `${card.id}:${card.stageId}`)
14748
15376
  .join(",")}
14749
15377
  stages={board.data.stages}
14750
15378
  cards={cards}
@@ -17583,6 +18211,9 @@ export async function DriveExplorer({
17583
18211
  id={item.id}
17584
18212
  kind={item.kind}
17585
18213
  name={item.name}
18214
+ locked={item.locked}
18215
+ downloadBlocked={item.downloadBlocked}
18216
+ downloadable={item.downloadable}
17586
18217
  />
17587
18218
  </TableCell>
17588
18219
  </TableRow>
@@ -20793,9 +21424,9 @@ export function WebhookEndpointsSkeleton() {
20793
21424
  }
20794
21425
  ```
20795
21426
 
20796
- ## Service principals table
21427
+ ## Service accounts table
20797
21428
 
20798
- Machine identities with their scopes, last use and a button to disable one. It loads its data on the server through the block's client; the [service-accounts block](https://bettersupabase.com/blocks/service-accounts) must be installed (`npx better-supabase add service-accounts`). Page: https://bettersupabase.com/recipes/service-principals-table.
21429
+ Machine identities with their scopes, last use and a button to disable one. It loads its data on the server through the block's client; the [service-accounts block](https://bettersupabase.com/blocks/service-accounts) must be installed (`npx better-supabase add service-accounts`). Page: https://bettersupabase.com/recipes/service-accounts-table.
20799
21430
 
20800
21431
  Web, with shadcn components:
20801
21432
 
@@ -20831,8 +21462,8 @@ async function retry() {
20831
21462
 
20832
21463
  /**
20833
21464
  * Render inside `<Suspense>`: the machine identities workflows and webhooks run
20834
- * as, with their role. Members with `service_principals.manage` add and disable
20835
- * 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.
20836
21467
  */
20837
21468
  export async function ServicePrincipalsTable() {
20838
21469
  const [t, format, permissions] = await Promise.all([
@@ -20841,7 +21472,7 @@ export async function ServicePrincipalsTable() {
20841
21472
  getPermissions(),
20842
21473
  ]);
20843
21474
 
20844
- if (!can(permissions, "service_principals.read")) {
21475
+ if (!can(permissions, "service_accounts.read")) {
20845
21476
  return null;
20846
21477
  }
20847
21478
 
@@ -20851,7 +21482,7 @@ export async function ServicePrincipalsTable() {
20851
21482
  return null;
20852
21483
  }
20853
21484
 
20854
- const manage = can(permissions, "service_principals.manage");
21485
+ const manage = can(permissions, "service_accounts.manage");
20855
21486
 
20856
21487
  const roles = new Map([
20857
21488
  ["owner", t("Owner")],
@@ -20860,7 +21491,7 @@ export async function ServicePrincipalsTable() {
20860
21491
  ]);
20861
21492
 
20862
21493
  return (
20863
- <Card data-recipe="service-principals-table">
21494
+ <Card data-recipe="service-accounts-table">
20864
21495
  <CardHeader>
20865
21496
  <CardTitle>{t("Service principals")}</CardTitle>
20866
21497
  <CardDescription>
@@ -21130,7 +21761,7 @@ npx shadcn add alert badge button card empty skeleton
21130
21761
 
21131
21762
  ```tsx title="apps/examples/nextjs/src/features/privacy/components/privacy-settings.tsx"
21132
21763
  /**
21133
- * Data exports for the caller and, with `organization.export`, for the
21764
+ * Data exports for the caller and, with `data_lifecycle.export`, for the
21134
21765
  * organization, each with its status and a download. Owners schedule the
21135
21766
  * organization's deletion here; account deletion stays on the security page.
21136
21767
  */
@@ -24383,3 +25014,417 @@ export function TaskImportDialog({ projectId }: { projectId: string }) {
24383
25014
  );
24384
25015
  }
24385
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
+ ```