better-supabase 0.29.0 → 0.31.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 (208) hide show
  1. package/dist/{adapter-D4aNBxhm.js → adapter-BTbj5N9C.js} +2 -52
  2. package/dist/ai-sdk/agents/index.d.ts +2 -2
  3. package/dist/{app-tables-DekyKNQ8.d.ts → app-tables-B2mKMNRQ.d.ts} +1 -1
  4. package/dist/astro/index.js +2 -2
  5. package/dist/{authorization-C7nuWMuB.d.ts → authorization-DfEkyFt_.d.ts} +24 -3
  6. package/dist/{bind-DmUGUsBd.d.ts → bind-DAx0bMSi.d.ts} +2 -2
  7. package/dist/{block-env-DWtZsqhH.d.ts → block-env-Dz7Caxk0.d.ts} +3 -3
  8. package/dist/blocks/ai-chat/index.d.ts +3 -3
  9. package/dist/blocks/announcements/index.d.ts +3 -3
  10. package/dist/blocks/api-keys/index.d.ts +1 -1
  11. package/dist/blocks/attachments/index.d.ts +1 -1
  12. package/dist/blocks/audit/index.d.ts +2 -2
  13. package/dist/blocks/automations/index.d.ts +1 -1
  14. package/dist/blocks/billing/index.d.ts +1 -1
  15. package/dist/blocks/bookings/index.d.ts +1 -1
  16. package/dist/blocks/calendar/index.d.ts +7 -3
  17. package/dist/blocks/calendar/index.js +5 -1
  18. package/dist/blocks/comments/index.d.ts +4 -4
  19. package/dist/blocks/employees/index.js +1 -4
  20. package/dist/blocks/entitlements/index.d.ts +2 -2
  21. package/dist/blocks/forms/index.d.ts +1 -1
  22. package/dist/blocks/inbox/index.d.ts +4 -4
  23. package/dist/blocks/index.d.ts +1 -1
  24. package/dist/blocks/messaging/index.d.ts +4 -4
  25. package/dist/blocks/mfa/index.d.ts +1 -1
  26. package/dist/blocks/notifications/index.d.ts +3 -3
  27. package/dist/blocks/notifications/index.js +5 -43
  28. package/dist/blocks/onboarding/index.d.ts +1 -1
  29. package/dist/blocks/organizations/index.d.ts +34 -21
  30. package/dist/blocks/organizations/index.js +5 -1
  31. package/dist/blocks/permissions/index.d.ts +32 -3
  32. package/dist/blocks/permissions/index.js +23 -2
  33. package/dist/blocks/push/index.d.ts +10 -2
  34. package/dist/blocks/push/index.js +23 -7
  35. package/dist/blocks/reactions/index.d.ts +3 -3
  36. package/dist/blocks/saved-views/index.d.ts +1 -1
  37. package/dist/blocks/search/index.d.ts +2 -2
  38. package/dist/blocks/sessions/index.d.ts +1 -1
  39. package/dist/blocks/settings/index.d.ts +1 -1
  40. package/dist/blocks/subjects/index.d.ts +1 -1
  41. package/dist/blocks/tags/index.d.ts +1 -1
  42. package/dist/blocks/tasks/index.js +1 -1
  43. package/dist/blocks/teams/index.d.ts +7 -1
  44. package/dist/blocks/teams/index.js +8 -7
  45. package/dist/blocks/undo/index.d.ts +1 -1
  46. package/dist/blocks/usage/index.d.ts +1 -1
  47. package/dist/blocks/workflow-editor/index.d.ts +3 -3
  48. package/dist/blocks/workflows/index.d.ts +3 -3
  49. package/dist/cli/{add-BKkV99g9.js → add-B9wP0YGU.js} +2 -2
  50. package/dist/cli/{add-CrQ3jS7t.js → add-DjZXKd7X.js} +10 -10
  51. package/dist/cli/add-ZcEOEK23.js +1 -0
  52. package/dist/cli/{app-table-files-PnPOpuB4.js → app-table-files-mtvjHa48.js} +2 -2
  53. package/dist/cli/{backfill-DDDLhinm.js → backfill-Coshdvh_.js} +2 -2
  54. package/dist/cli/bin.js +1 -1
  55. package/dist/cli/{blocks-tRfYx_mh.js → blocks-BWCuA0nq.js} +2 -2
  56. package/dist/cli/{blocks-BCVcjvbm.js → blocks-hiSazThw.js} +1 -1
  57. package/dist/cli/{cache-DQZ09YOg.js → cache-x2wWAy0h.js} +1 -1
  58. package/dist/cli/{codemod-HKuwQmi_.js → codemod-BnjV7BpC.js} +210 -11
  59. package/dist/cli/{command-DIPmo0wh.js → command-CCAwhiOh.js} +6 -0
  60. package/dist/cli/{completion-DxPxMtyP.js → completion-BJaB84Pe.js} +2 -2
  61. package/dist/cli/{completion-DyLMSjOD.js → completion-BkUhs1ms.js} +1 -1
  62. package/dist/cli/{completion-FUgqm2-N.js → completion-DmUVsUVQ.js} +2 -2
  63. package/dist/cli/{config-BfapErxs.js → config-zId1jkLx.js} +1 -1
  64. package/dist/cli/{content-mapper-B0ehR7K-.js → content-mapper-DvOSOdTE.js} +2 -2
  65. package/dist/cli/{db-CWvH1_46.js → db-DXKyVEDF.js} +1 -1
  66. package/dist/cli/{doctor-CXJOhwLB.js → doctor-Ywy8oJEU.js} +76 -18
  67. package/dist/cli/env-CNjT_uOV.js +1 -0
  68. package/dist/cli/{env-BM242BCV.js → env-XMiKvhtV.js} +2 -2
  69. package/dist/cli/{gen-B7rw4j19.js → gen-B-FbQmG1.js} +14 -14
  70. package/dist/cli/index.d.ts +1 -1
  71. package/dist/cli/index.js +7 -7
  72. package/dist/cli/{init-C1bXXB_P.js → init-fb9e1BKX.js} +9 -9
  73. package/dist/cli/{keys-V-HcO-21.js → keys-ORiPz1sM.js} +1 -1
  74. package/dist/cli/{live-PpAh9pAc.js → live-DIt7TP-N.js} +2 -2
  75. package/dist/cli/{mcp-BRNAchdH.js → mcp-CVWwraga.js} +3 -3
  76. package/dist/cli/{metadata-dAAKb_kR.js → metadata-CannIjel.js} +3 -3
  77. package/dist/cli/{migrate-BWYXFnaW.js → migrate-Ht2TzIQF.js} +2 -2
  78. package/dist/cli/{migration-safety-DGQswWZy.js → migration-safety-nNyB05I-.js} +1 -1
  79. package/dist/cli/{migrations-Cqk-lJwu.js → migrations-bAd7dpk1.js} +2 -2
  80. package/dist/cli/{module-migration-8-hMiZtW.js → module-migration-CkNux8dr.js} +2 -2
  81. package/dist/cli/{moved-DNOtp9LA.js → moved-C3WyRHkA.js} +1 -1
  82. package/dist/cli/{parse-BPf3kGnc.js → parse-DjHbTaFI.js} +1 -1
  83. package/dist/cli/{powersync-BWQ-8T3G.js → powersync-B2v0tDwp.js} +100 -7
  84. package/dist/cli/powersync-D3mAQ6QE.js +1 -0
  85. package/dist/cli/{print-DSTnq5xz.js → print-CxQ0rBKT.js} +2 -2
  86. package/dist/cli/{providers-Cjf5iOp5.js → providers-DtI90lSw.js} +1 -1
  87. package/dist/cli/{remove-CwG8cPv1.js → remove-DYtE4IZ4.js} +6 -6
  88. package/dist/cli/{render-B18iAdsT.js → render-QGWfEoiB.js} +3 -3
  89. package/dist/cli/{run-CvPl8iQd.js → run-B5aMwErM.js} +3 -3
  90. package/dist/cli/{run-C2Yg5MWt.js → run-BNoJKf5I.js} +40 -39
  91. package/dist/cli/{run-Wx_2Acgv.js → run-DiYX1XEa.js} +8 -8
  92. package/dist/cli/{seed-CDnL4Tnc.js → seed-C-Hu2n_E.js} +1 -1
  93. package/dist/cli/seed-Cm-c0BDd.js +1 -0
  94. package/dist/cli/{shared-BHbtUOvh.js → shared-D_CFi5di.js} +1 -1
  95. package/dist/cli/{skills-DM3oeIxY.js → skills-D98y0bSB.js} +1 -1
  96. package/dist/cli/{snapshot-CXgsUPGj.js → snapshot-BlQ4DDcJ.js} +9 -4
  97. package/dist/cli/{source-B6aMAoEK.js → source-CelMBQMj.js} +1 -1
  98. package/dist/cli/{spec-EO0TP84d.js → spec-BxcoGE0h.js} +1 -1
  99. package/dist/cli/{spec-BcYic005.js → spec-iBx1LcYO.js} +3 -3
  100. package/dist/cli/{sql-layout-CkxDNVEH.js → sql-layout-Dp4Rottt.js} +2 -2
  101. package/dist/cli/{stack-ClESAZYf.js → stack-B2slzrYH.js} +1 -1
  102. package/dist/cli/{stack-env-6hS-WEmh.js → stack-env-3ziggrU3.js} +1 -1
  103. package/dist/cli/{sync-pq6gmlhG.js → sync-BnORI43S.js} +4 -4
  104. package/dist/cli/{table-dyKddjwo.js → table-D6HUECKI.js} +1 -1
  105. package/dist/cli/{upgrade-Dp9p7A69.js → upgrade-CR6-WmIc.js} +5 -5
  106. package/dist/cli/{upgrade-BoHb4h9P.js → upgrade-fz92aCnh.js} +3 -3
  107. package/dist/cli/{version-CQHFm-ak.js → version-Dz8ZlOuh.js} +1 -1
  108. package/dist/client/index.d.ts +5 -5
  109. package/dist/client/native/index.d.ts +4 -4
  110. package/dist/{composite-CBRbvn5j.js → composite-B4qB6k31.js} +2 -2
  111. package/dist/config/index.d.ts +2 -2
  112. package/dist/config/index.js +4 -4
  113. package/dist/{config-r7njjNgh.js → config-B7g-HDis.js} +3 -3
  114. package/dist/{config-bqKaPjst.js → config-R0m0fBiD.js} +1 -1
  115. package/dist/{context-B4TsE2gY.d.ts → context-DWWoP1wK.d.ts} +13 -1
  116. package/dist/{controller-CtwAsnVV.d.ts → controller-Br9dGKGe.d.ts} +1 -1
  117. package/dist/{controller-qG-B1eDn.js → controller-W97g2WGG.js} +1 -1
  118. package/dist/create/index.d.ts +3 -3
  119. package/dist/create/index.js +3 -3
  120. package/dist/create/lite/index.d.ts +3 -3
  121. package/dist/create/lite/index.js +3 -3
  122. package/dist/delivery-events-DbL8IHIY.js +53 -0
  123. package/dist/edge/index.js +3 -3
  124. package/dist/{entitlements-Bw3eYGKJ.d.ts → entitlements-CBjm2lvD.d.ts} +1 -1
  125. package/dist/eve/index.js +1 -1
  126. package/dist/expo/index.js +3 -2
  127. package/dist/{field-errors-DkzFduux.d.ts → field-errors-CEjsMAgd.d.ts} +4 -4
  128. package/dist/{framework-DYEUraqt.js → framework-CqiZk89W.js} +1 -1
  129. package/dist/hono/index.js +2 -2
  130. package/dist/{index-CB66nl14.d.ts → index-Clyd2Goi.d.ts} +1 -1
  131. package/dist/{index-Cw5gGSP8.d.ts → index-D98bQs8a.d.ts} +7 -7
  132. package/dist/{index-BNgpz_BV.d.ts → index-DIdPoQtO.d.ts} +2 -2
  133. package/dist/{index-BxckmAFc.d.ts → index-I8YLxKq8.d.ts} +2 -2
  134. package/dist/{index-CBQT_nXf.d.ts → index-eRBuKtMt.d.ts} +2 -2
  135. package/dist/{index-BM6NmKSc.d.ts → index-uIU65iEn.d.ts} +6 -6
  136. package/dist/{instances-C7qUTjhJ.js → instances-DY_ORk5g.js} +2 -0
  137. package/dist/mapper/bin.js +5 -5
  138. package/dist/mcp/index.d.ts +1 -1
  139. package/dist/mcp/index.js +1 -1
  140. package/dist/mcp/sdk/index.js +1 -1
  141. package/dist/next/index.d.ts +155 -13
  142. package/dist/next/index.js +245 -52
  143. package/dist/{operations-CqmQrTKw.d.ts → operations-hm1Isvvs.d.ts} +1 -1
  144. package/dist/{options-C4LuqmdG.js → options-CF6EVF_G.js} +3 -1
  145. package/dist/{options-COo7_3MX.js → options-DSCW40_5.js} +3 -1
  146. package/dist/orpc/index.js +2 -1
  147. package/dist/otel/index.js +4 -4
  148. package/dist/{ports-6LBgr1Aa.d.ts → ports-DOrPTJzl.d.ts} +1 -1
  149. package/dist/powersync/index.d.ts +204 -4
  150. package/dist/powersync/index.js +361 -4
  151. package/dist/preset/index.d.ts +3 -3
  152. package/dist/preset/index.js +3 -3
  153. package/dist/{preset-DCdEnJj9.js → preset-CXhpPmPV.js} +2 -2
  154. package/dist/{project-C4NA_van.js → project-DJ9Uo0sT.js} +5 -5
  155. package/dist/{push-token-BXsrJ7W9.d.ts → push-token-B4vcIU4s.d.ts} +1 -1
  156. package/dist/query/index.d.ts +1 -1
  157. package/dist/query/index.js +1 -1
  158. package/dist/react/index.d.ts +5 -5
  159. package/dist/react/index.js +1 -1
  160. package/dist/react/native/index.d.ts +1 -1
  161. package/dist/react/server.d.ts +5 -5
  162. package/dist/react/server.js +1 -1
  163. package/dist/{react-CcrQQl0_.js → react-mdVjpewL.js} +2 -2
  164. package/dist/react-router/index.js +2 -2
  165. package/dist/realtime/index.d.ts +3 -3
  166. package/dist/{record-type-DRbnlj5q.js → record-type-BEUyEsFx.js} +2 -2
  167. package/dist/records/index.d.ts +5 -5
  168. package/dist/records/index.js +3 -3
  169. package/dist/{replicas-Dyoh3CEg.js → refresh-DLBgnxjL.js} +51 -1
  170. package/dist/{resolved-names-iLBOUaib.js → resolved-names-kMRjmSIy.js} +1 -1
  171. package/dist/{runtime-CoKxZibd.js → runtime-LRJM7UqY.js} +19 -20
  172. package/dist/server/index.d.ts +3 -3
  173. package/dist/server/index.js +4 -4
  174. package/dist/sign-in-BzihC_8k.d.ts +50 -0
  175. package/dist/{sign-in-NO7LWlw4.js → sign-in-CuZ1Ag7O.js} +136 -26
  176. package/dist/solid/index.d.ts +5 -5
  177. package/dist/solid-start/index.js +2 -2
  178. package/dist/spec/index.js +1 -1
  179. package/dist/sql/index.d.ts +4 -4
  180. package/dist/sql/index.js +3 -3
  181. package/dist/{sql-CoBySj2F.js → sql-DHp0L7zK.js} +680 -333
  182. package/dist/ssr/index.d.ts +1 -1
  183. package/dist/svelte/index.d.ts +5 -5
  184. package/dist/sveltekit/index.js +2 -2
  185. package/dist/tanstack-start/index.js +2 -2
  186. package/dist/{tenant-Ded341Qz.d.ts → tenant-FfgNhd5x.d.ts} +1 -1
  187. package/dist/testing/index.d.ts +13 -4
  188. package/dist/testing/index.js +17 -15
  189. package/dist/{timeline-DvXtXq5q.d.ts → timeline-DqEoD8bb.d.ts} +1 -1
  190. package/dist/{timeline--VU3A1e4.js → timeline-Dz3hO2I6.js} +1 -1
  191. package/dist/{topic-XDdKzlrn.d.ts → topic-BaUElNw2.d.ts} +1 -1
  192. package/dist/{types-BFwB-E1j.d.ts → types-CMN0h_Ix.d.ts} +2 -2
  193. package/dist/vue/index.d.ts +5 -5
  194. package/dist/{watch-topic-DpN_GEoS.d.ts → watch-topic-BabDTZ-L.d.ts} +1 -1
  195. package/dist/workflow-sdk/world/index.js +2 -2
  196. package/dist/{workflow-sdk-CaEw822d.js → workflow-sdk-DJJkP0dT.js} +47 -8
  197. package/dist/yjs/index.d.ts +1 -1
  198. package/package.json +1 -1
  199. package/schemas/config-v1.json +10 -1
  200. package/schemas/doctor-report-v1.json +2 -0
  201. package/skills/better-supabase/references/ui-recipes.md +524 -295
  202. package/skills/better-supabase-api/references/powersync.md +16 -0
  203. package/skills/better-supabase-auth/SKILL.md +11 -1
  204. package/dist/cli/add-CwhrRJz5.js +0 -1
  205. package/dist/cli/env-uqfUbUzk.js +0 -1
  206. package/dist/cli/powersync-CbYxLsjv.js +0 -1
  207. package/dist/cli/seed-BOun22-k.js +0 -1
  208. package/dist/sign-in-CfwJAJJL.d.ts +0 -24
@@ -46,5 +46,21 @@ Never throw for a kind that can't succeed: it blocks the upload queue.
46
46
  - `uploadRoute(server.db.attachments, { put: "create" })` for write-once tables: a `PUT` calls `create` and a `conflict` counts as applied (the row is already on the server); a `PATCH` is discarded as `unsupported`.
47
47
  - `onError: (error, { phase }) => ...` logs a failed `getSession` (`phase: "credentials"`, kind `unauthorized` or `network`; `fetchCredentials` returns `null`) and uploads that stay queued for a retry (`phase: "upload"`).
48
48
 
49
+ ## Offline blocks
50
+
51
+ `gen.powersync.instances` syncs `notifications`, `attachments`, `memberships`,
52
+ `teams` and `profiles`. Give each block client a local transport with
53
+ `server: rpcTransport(supabase)`, and route its tables through a server client:
54
+
55
+ | Block | Transport | Upload routes |
56
+ | ------------- | --------------------------------- | -------------------------------------------------------------------------------- |
57
+ | notifications | `powersyncNotificationsTransport` | `notification_recipients: notificationRecipientsRoute(remote)` |
58
+ | organizations | `powersyncMembershipsTransport` | `memberships: membershipsRoute(remote)` |
59
+ | teams | `powersyncTeamsTransport` | `teams: teamsRoute(remote, powersync)`, `team_members: teamMembersRoute(remote)` |
60
+ | profiles | `powersyncProfilesTransport` | `profiles: profilesRoute(remote)` |
61
+
62
+ The synced rows are the user's own (memberships, their teams, their profile).
63
+ Switching organizations and creating or deleting a team need the network.
64
+
49
65
  Docs: https://bettersupabase.com/docs/frontend/powersync.md and
50
66
  https://bettersupabase.com/docs/guides/offline-first.md.
@@ -169,7 +169,16 @@ membership lasts until the next refresh. When that window matters:
169
169
  - `bsb.invalidateSession(userId)` reaches the server caches and the caller's
170
170
  router only; another user's browser keeps its private entries until they
171
171
  go stale.
172
- - After signing in or out: `useSessionChange(sessionChanged)` from
172
+ - Sign in and out from a Server Action with `bsb.signIn`, `verifyOtp`,
173
+ `authorizeUrl` and `exchangeCode`, `verifyMfa` or `signOut`, then
174
+ `redirect(result.data.redirectTo)`. The result is plain data
175
+ (`redirectTo`, `mfa`, `user`); reads later in the action (`bsb.context()`,
176
+ `bsb.getRequestSession()`) see the new session, so build the landing
177
+ context from them.
178
+ - Start email link flows with `bsb.signInWithOtp`, `resetPasswordForEmail`,
179
+ `signUp` or `resend`, not supabase-js: they write the PKCE verifier cookie
180
+ that `exchangeCode` reads on the link's callback.
181
+ - After signing in or out in the browser client: `useSessionChange(sessionChanged)` from
173
182
  `better-supabase/next/client`. After switching the active organization:
174
183
  `useSessionChange(sessionChanged, router, { refreshToken: supabase })`, so
175
184
  the new token reaches the server before it renders.
@@ -206,6 +215,7 @@ before touching the hook, claims, tenant or entitlements.
206
215
 
207
216
  https://bettersupabase.com/docs/auth.md,
208
217
  https://bettersupabase.com/docs/frameworks/next.md (bearer callers),
218
+ https://bettersupabase.com/docs/frameworks/next-auth.md (sign-in and sign-out),
209
219
  https://bettersupabase.com/docs/auth/account-deletion.md,
210
220
  https://bettersupabase.com/docs/frameworks/next-cache-components.md and
211
221
  https://bettersupabase.com/docs/extending/authorization-providers.md.
@@ -1 +0,0 @@
1
- export { t as addCommand } from "./add-CrQ3jS7t.js";
@@ -1 +0,0 @@
1
- export { n as envCommand } from "./env-BM242BCV.js";
@@ -1 +0,0 @@
1
- export { t as powersyncStreamsCommand } from "./powersync-BWQ-8T3G.js";
@@ -1 +0,0 @@
1
- export { n as seedCommand } from "./seed-CDnL4Tnc.js";
@@ -1,24 +0,0 @@
1
- import { f as Result } from "./result-DZeA5KS6.js";
2
- import { _ as StoredSession } from "./resolve-CtX6T0c0.js";
3
- import { t as RefreshOptions } from "./refresh-D02Pbf5B.js";
4
- //#region src/auth/sign-in.d.ts
5
- /**
6
- * `next` when it is a same-origin path (`/dashboard?tab=1`), else `fallback`.
7
- * Use it on any `?next=` or `redirectTo` value a request carries, so the value
8
- * can't send the user to another origin.
9
- */
10
- declare function safeRedirectPath(next: string | null | undefined, fallback: string): string;
11
- type PasswordGrantOptions = Omit<RefreshOptions, "now"> & {
12
- readonly now?: () => number;
13
- };
14
- /**
15
- * Signs in with an email and a password against the Auth server's password
16
- * grant, without a supabase-js client. Returns the session to write as
17
- * cookies.
18
- */
19
- declare function passwordGrant(credentials: {
20
- readonly email: string;
21
- readonly password: string;
22
- }, options: PasswordGrantOptions): Promise<Result<StoredSession>>;
23
- //#endregion
24
- export { passwordGrant as n, safeRedirectPath as r, PasswordGrantOptions as t };