better-supabase 0.30.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.
- package/dist/{adapter-D4aNBxhm.js → adapter-BTbj5N9C.js} +2 -52
- package/dist/ai-sdk/agents/index.d.ts +2 -2
- package/dist/{app-tables-yyVncXEt.d.ts → app-tables-B2mKMNRQ.d.ts} +1 -1
- package/dist/astro/index.js +2 -2
- package/dist/{authorization-CDU9tYA_.d.ts → authorization-DfEkyFt_.d.ts} +10 -3
- package/dist/{bind-p7asfI6H.d.ts → bind-DAx0bMSi.d.ts} +2 -2
- package/dist/{block-env-B8wG3xeh.d.ts → block-env-Dz7Caxk0.d.ts} +3 -3
- package/dist/blocks/ai-chat/index.d.ts +3 -3
- package/dist/blocks/announcements/index.d.ts +3 -3
- package/dist/blocks/api-keys/index.d.ts +1 -1
- package/dist/blocks/attachments/index.d.ts +1 -1
- package/dist/blocks/audit/index.d.ts +2 -2
- package/dist/blocks/automations/index.d.ts +1 -1
- package/dist/blocks/billing/index.d.ts +1 -1
- package/dist/blocks/bookings/index.d.ts +1 -1
- package/dist/blocks/calendar/index.d.ts +7 -3
- package/dist/blocks/calendar/index.js +5 -1
- package/dist/blocks/comments/index.d.ts +4 -4
- package/dist/blocks/employees/index.js +1 -4
- package/dist/blocks/entitlements/index.d.ts +2 -2
- package/dist/blocks/forms/index.d.ts +1 -1
- package/dist/blocks/inbox/index.d.ts +4 -4
- package/dist/blocks/index.d.ts +1 -1
- package/dist/blocks/messaging/index.d.ts +4 -4
- package/dist/blocks/mfa/index.d.ts +1 -1
- package/dist/blocks/notifications/index.d.ts +3 -3
- package/dist/blocks/notifications/index.js +5 -43
- package/dist/blocks/onboarding/index.d.ts +1 -1
- package/dist/blocks/organizations/index.d.ts +34 -21
- package/dist/blocks/organizations/index.js +5 -1
- package/dist/blocks/permissions/index.d.ts +32 -3
- package/dist/blocks/permissions/index.js +23 -2
- package/dist/blocks/push/index.d.ts +10 -2
- package/dist/blocks/push/index.js +23 -7
- package/dist/blocks/reactions/index.d.ts +3 -3
- package/dist/blocks/saved-views/index.d.ts +1 -1
- package/dist/blocks/search/index.d.ts +2 -2
- package/dist/blocks/sessions/index.d.ts +1 -1
- package/dist/blocks/settings/index.d.ts +1 -1
- package/dist/blocks/subjects/index.d.ts +1 -1
- package/dist/blocks/tags/index.d.ts +1 -1
- package/dist/blocks/tasks/index.js +1 -1
- package/dist/blocks/teams/index.d.ts +7 -1
- package/dist/blocks/teams/index.js +8 -7
- package/dist/blocks/undo/index.d.ts +1 -1
- package/dist/blocks/usage/index.d.ts +1 -1
- package/dist/blocks/workflow-editor/index.d.ts +3 -3
- package/dist/blocks/workflows/index.d.ts +3 -3
- package/dist/cli/{add-Dggyehsy.js → add-B9wP0YGU.js} +2 -2
- package/dist/cli/{add-D4w-Axib.js → add-DjZXKd7X.js} +10 -10
- package/dist/cli/add-ZcEOEK23.js +1 -0
- package/dist/cli/{app-table-files-CiGuwLkO.js → app-table-files-mtvjHa48.js} +2 -2
- package/dist/cli/{backfill-DjVjXW_P.js → backfill-Coshdvh_.js} +2 -2
- package/dist/cli/bin.js +1 -1
- package/dist/cli/{blocks-jRL9K1R8.js → blocks-BWCuA0nq.js} +2 -2
- package/dist/cli/{blocks-Bbmb6W_F.js → blocks-hiSazThw.js} +1 -1
- package/dist/cli/{cache-BuoIFlUJ.js → cache-x2wWAy0h.js} +1 -1
- package/dist/cli/{codemod-DRavXBCb.js → codemod-BnjV7BpC.js} +210 -11
- package/dist/cli/{command-DIPmo0wh.js → command-CCAwhiOh.js} +6 -0
- package/dist/cli/{completion-DxPxMtyP.js → completion-BJaB84Pe.js} +2 -2
- package/dist/cli/{completion-DyLMSjOD.js → completion-BkUhs1ms.js} +1 -1
- package/dist/cli/{completion-FUgqm2-N.js → completion-DmUVsUVQ.js} +2 -2
- package/dist/cli/{config-BfapErxs.js → config-zId1jkLx.js} +1 -1
- package/dist/cli/{content-mapper-BCtyfKXl.js → content-mapper-DvOSOdTE.js} +2 -2
- package/dist/cli/{db-CWvH1_46.js → db-DXKyVEDF.js} +1 -1
- package/dist/cli/{doctor-Di2ZekfN.js → doctor-Ywy8oJEU.js} +41 -16
- package/dist/cli/env-CNjT_uOV.js +1 -0
- package/dist/cli/{env-B2CbnbzD.js → env-XMiKvhtV.js} +1 -1
- package/dist/cli/{gen-STKC9vkK.js → gen-B-FbQmG1.js} +14 -14
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +7 -7
- package/dist/cli/{init-DW6_nIwj.js → init-fb9e1BKX.js} +9 -9
- package/dist/cli/{keys-V-HcO-21.js → keys-ORiPz1sM.js} +1 -1
- package/dist/cli/{live-0G4Plw3K.js → live-DIt7TP-N.js} +2 -2
- package/dist/cli/{mcp-flKS8iU5.js → mcp-CVWwraga.js} +3 -3
- package/dist/cli/{metadata-VARUbXEe.js → metadata-CannIjel.js} +3 -3
- package/dist/cli/{migrate-Bkq07XcT.js → migrate-Ht2TzIQF.js} +2 -2
- package/dist/cli/{migration-safety-BfVeza5j.js → migration-safety-nNyB05I-.js} +1 -1
- package/dist/cli/{migrations-BCq7Zs2E.js → migrations-bAd7dpk1.js} +2 -2
- package/dist/cli/{module-migration-lbeUrsYv.js → module-migration-CkNux8dr.js} +2 -2
- package/dist/cli/{moved-DNOtp9LA.js → moved-C3WyRHkA.js} +1 -1
- package/dist/cli/{parse-BPf3kGnc.js → parse-DjHbTaFI.js} +1 -1
- package/dist/cli/{powersync-B15CfH5Y.js → powersync-B2v0tDwp.js} +100 -7
- package/dist/cli/powersync-D3mAQ6QE.js +1 -0
- package/dist/cli/{print-DjxpBRnv.js → print-CxQ0rBKT.js} +2 -2
- package/dist/cli/{providers-dyxcHQY3.js → providers-DtI90lSw.js} +1 -1
- package/dist/cli/{remove-BLq5gbal.js → remove-DYtE4IZ4.js} +6 -6
- package/dist/cli/{render-CizUf3RW.js → render-QGWfEoiB.js} +3 -3
- package/dist/cli/{run-ChEjR7yw.js → run-B5aMwErM.js} +2 -2
- package/dist/cli/{run-MwM__teL.js → run-BNoJKf5I.js} +40 -39
- package/dist/cli/{run-ChOY6s4o.js → run-DiYX1XEa.js} +8 -8
- package/dist/cli/{seed-CDnL4Tnc.js → seed-C-Hu2n_E.js} +1 -1
- package/dist/cli/seed-Cm-c0BDd.js +1 -0
- package/dist/cli/{shared-DV5wIv-7.js → shared-D_CFi5di.js} +1 -1
- package/dist/cli/{skills-DM3oeIxY.js → skills-D98y0bSB.js} +1 -1
- package/dist/cli/{snapshot-B5LXkVMC.js → snapshot-BlQ4DDcJ.js} +9 -4
- package/dist/cli/{source-BoLNG_2A.js → source-CelMBQMj.js} +1 -1
- package/dist/cli/{spec-D6QeE2Zx.js → spec-BxcoGE0h.js} +1 -1
- package/dist/cli/{spec-Dz-PGCaM.js → spec-iBx1LcYO.js} +3 -3
- package/dist/cli/{sql-layout-zo02f3Dm.js → sql-layout-Dp4Rottt.js} +2 -2
- package/dist/cli/{stack-ClESAZYf.js → stack-B2slzrYH.js} +1 -1
- package/dist/cli/{sync-m-oZ_SyI.js → sync-BnORI43S.js} +4 -4
- package/dist/cli/{table-dyKddjwo.js → table-D6HUECKI.js} +1 -1
- package/dist/cli/{upgrade-C9sgVZ5z.js → upgrade-CR6-WmIc.js} +5 -5
- package/dist/cli/{upgrade-WwEJaX3i.js → upgrade-fz92aCnh.js} +3 -3
- package/dist/cli/{version-D2BQuqta.js → version-Dz8ZlOuh.js} +1 -1
- package/dist/client/index.d.ts +5 -5
- package/dist/client/native/index.d.ts +4 -4
- package/dist/{composite-CBRbvn5j.js → composite-B4qB6k31.js} +2 -2
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.js +4 -4
- package/dist/{config-r7njjNgh.js → config-B7g-HDis.js} +3 -3
- package/dist/{config-bqKaPjst.js → config-R0m0fBiD.js} +1 -1
- package/dist/{context-nbYYjv7U.d.ts → context-DWWoP1wK.d.ts} +1 -1
- package/dist/{controller-TRocodqG.d.ts → controller-Br9dGKGe.d.ts} +1 -1
- package/dist/{controller-qG-B1eDn.js → controller-W97g2WGG.js} +1 -1
- package/dist/create/index.d.ts +3 -3
- package/dist/create/index.js +3 -3
- package/dist/create/lite/index.d.ts +3 -3
- package/dist/create/lite/index.js +3 -3
- package/dist/delivery-events-DbL8IHIY.js +53 -0
- package/dist/edge/index.js +3 -3
- package/dist/{entitlements-B1i1-wfe.d.ts → entitlements-CBjm2lvD.d.ts} +1 -1
- package/dist/eve/index.js +1 -1
- package/dist/expo/index.js +3 -2
- package/dist/{field-errors-tJvehEFc.d.ts → field-errors-CEjsMAgd.d.ts} +4 -4
- package/dist/{framework-DYEUraqt.js → framework-CqiZk89W.js} +1 -1
- package/dist/hono/index.js +2 -2
- package/dist/{index-BkzXwuIN.d.ts → index-Clyd2Goi.d.ts} +1 -1
- package/dist/{index-zsgNmE8m.d.ts → index-D98bQs8a.d.ts} +7 -7
- package/dist/{index-BKrxynq9.d.ts → index-DIdPoQtO.d.ts} +2 -2
- package/dist/{index-CWAQRWY8.d.ts → index-I8YLxKq8.d.ts} +2 -2
- package/dist/{index-8US7qlvW.d.ts → index-eRBuKtMt.d.ts} +2 -2
- package/dist/{index-BM6NmKSc.d.ts → index-uIU65iEn.d.ts} +6 -6
- package/dist/{instances-C7qUTjhJ.js → instances-DY_ORk5g.js} +2 -0
- package/dist/mapper/bin.js +5 -5
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/mcp/sdk/index.js +1 -1
- package/dist/next/index.d.ts +73 -6
- package/dist/next/index.js +88 -35
- package/dist/{operations-CB9atU2e.d.ts → operations-hm1Isvvs.d.ts} +1 -1
- package/dist/{options-BKBy5wM_.js → options-CF6EVF_G.js} +2 -1
- package/dist/{options-COo7_3MX.js → options-DSCW40_5.js} +3 -1
- package/dist/orpc/index.js +2 -1
- package/dist/otel/index.js +4 -4
- package/dist/{ports-hpbyMySO.d.ts → ports-DOrPTJzl.d.ts} +1 -1
- package/dist/powersync/index.d.ts +204 -4
- package/dist/powersync/index.js +361 -4
- package/dist/preset/index.d.ts +3 -3
- package/dist/preset/index.js +3 -3
- package/dist/{preset-DCdEnJj9.js → preset-CXhpPmPV.js} +2 -2
- package/dist/{project-B32wb5J6.js → project-DJ9Uo0sT.js} +5 -5
- package/dist/{push-token-DQ1ycFPU.d.ts → push-token-B4vcIU4s.d.ts} +1 -1
- package/dist/query/index.d.ts +1 -1
- package/dist/query/index.js +1 -1
- package/dist/react/index.d.ts +5 -5
- package/dist/react/index.js +1 -1
- package/dist/react/native/index.d.ts +1 -1
- package/dist/react/server.d.ts +5 -5
- package/dist/react/server.js +1 -1
- package/dist/{react-CcrQQl0_.js → react-mdVjpewL.js} +2 -2
- package/dist/react-router/index.js +2 -2
- package/dist/realtime/index.d.ts +3 -3
- package/dist/{record-type-DRbnlj5q.js → record-type-BEUyEsFx.js} +2 -2
- package/dist/records/index.d.ts +5 -5
- package/dist/records/index.js +3 -3
- package/dist/{replicas-Dyoh3CEg.js → refresh-DLBgnxjL.js} +51 -1
- package/dist/{resolved-names-iLBOUaib.js → resolved-names-kMRjmSIy.js} +1 -1
- package/dist/{runtime-CoKxZibd.js → runtime-LRJM7UqY.js} +19 -20
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +4 -4
- package/dist/{sign-in-Cyj3ZlFX.js → sign-in-CuZ1Ag7O.js} +17 -2
- package/dist/solid/index.d.ts +5 -5
- package/dist/solid-start/index.js +2 -2
- package/dist/spec/index.js +1 -1
- package/dist/sql/index.d.ts +4 -4
- package/dist/sql/index.js +3 -3
- package/dist/{sql-CyeDg3Yh.js → sql-DHp0L7zK.js} +404 -165
- package/dist/ssr/index.d.ts +1 -1
- package/dist/svelte/index.d.ts +5 -5
- package/dist/sveltekit/index.js +2 -2
- package/dist/tanstack-start/index.js +2 -2
- package/dist/{tenant-C9YE_kqK.d.ts → tenant-FfgNhd5x.d.ts} +1 -1
- package/dist/testing/index.d.ts +13 -4
- package/dist/testing/index.js +17 -15
- package/dist/{timeline-DvXtXq5q.d.ts → timeline-DqEoD8bb.d.ts} +1 -1
- package/dist/{timeline--VU3A1e4.js → timeline-Dz3hO2I6.js} +1 -1
- package/dist/{topic-breZqx_4.d.ts → topic-BaUElNw2.d.ts} +1 -1
- package/dist/{types-C3I7S51U.d.ts → types-CMN0h_Ix.d.ts} +2 -2
- package/dist/vue/index.d.ts +5 -5
- package/dist/{watch-topic-ItO3dz8m.d.ts → watch-topic-BabDTZ-L.d.ts} +1 -1
- package/dist/workflow-sdk/world/index.js +2 -2
- package/dist/{workflow-sdk-BWPsdzVK.js → workflow-sdk-DJJkP0dT.js} +12 -1
- package/dist/yjs/index.d.ts +1 -1
- package/package.json +1 -1
- package/schemas/config-v1.json +9 -1
- package/schemas/doctor-report-v1.json +1 -0
- package/skills/better-supabase/references/ui-recipes.md +524 -295
- package/skills/better-supabase-api/references/powersync.md +16 -0
- package/skills/better-supabase-auth/SKILL.md +4 -1
- package/dist/cli/add-BdhGOwkB.js +0 -1
- package/dist/cli/env-CynGCICL.js +0 -1
- package/dist/cli/powersync-DnBsDchT.js +0 -1
- package/dist/cli/seed-BOun22-k.js +0 -1
package/dist/next/index.d.ts
CHANGED
|
@@ -7,26 +7,27 @@ import { A as isSessionSnapshot, M as sessionCacheKey, O as SessionSnapshot, a a
|
|
|
7
7
|
import { n as Impersonator } from "../impersonation-YTa9dZUv.js";
|
|
8
8
|
import { n as AmrEntry, t as Aal } from "../mfa-oIOYTpvc.js";
|
|
9
9
|
import { S as BlockClientSource, on as RecordBindingOptions } from "../define-block-DWVZSZv1.js";
|
|
10
|
-
import { M as BindingName, N as BindingOf, S as RecordWriteInput, _ as RecordTypeBlocks, b as RecordTypeWriteInput, d as BindingWritesOf, f as Plain, g as RecordType, h as RecordCan, m as PlainBindings, x as RecordTypeWriteOutput } from "../index-
|
|
11
|
-
import { t as tenantOf } from "../tenant-
|
|
10
|
+
import { M as BindingName, N as BindingOf, S as RecordWriteInput, _ as RecordTypeBlocks, b as RecordTypeWriteInput, d as BindingWritesOf, f as Plain, g as RecordType, h as RecordCan, m as PlainBindings, x as RecordTypeWriteOutput } from "../index-uIU65iEn.js";
|
|
11
|
+
import { t as tenantOf } from "../tenant-FfgNhd5x.js";
|
|
12
12
|
import { n as toSession, t as AuthSession } from "../view-C8_xvD-j.js";
|
|
13
13
|
import { a as SupportPolicy, c as supportSessions, i as SupportOptions, o as SupportSessions, s as SupportStartRequest, t as ActiveSupport } from "../support-BxyPOFk4.js";
|
|
14
14
|
import { t as AuthOutageHook } from "../session-BOzx2qHC.js";
|
|
15
15
|
import { n as AuthKind, r as GuardOptions } from "../respond-Dzu_-EPH.js";
|
|
16
16
|
import { a as AuthorizedContext, c as ResourceLoaderContext, i as AuthorizeOptions, l as Unwrapped, n as ActionParsed, r as ActionResult, t as ActionInput } from "../kit-B8yWCRN7.js";
|
|
17
17
|
import { c as ListParseOptions, m as ListSearchParams } from "../list-query-BcU8NnNL.js";
|
|
18
|
-
import { r as LiveCountSeed, t as CountRunner } from "../index-
|
|
19
|
-
import { r as MembershipClaim } from "../entitlements-
|
|
18
|
+
import { r as LiveCountSeed, t as CountRunner } from "../index-DIdPoQtO.js";
|
|
19
|
+
import { r as MembershipClaim } from "../entitlements-CBjm2lvD.js";
|
|
20
20
|
import { i as ResourceContext, l as ResourceRouteOptions, o as ResourceHooks, r as ResourceAction, t as ActionArgs } from "../resource-types-BVbHgTPg.js";
|
|
21
21
|
import { t as ResourceMap } from "../resources-BSbRa0Ab.js";
|
|
22
22
|
import { t as defineAction } from "../resource-execute-BzqR8DdD.js";
|
|
23
23
|
import { a as SignOutScope, n as EmailOtpType, r as OtpParams, s as safeRedirectPath, t as AuthorizeUrlParams } from "../sign-in-BzihC_8k.js";
|
|
24
24
|
import { n as BlockDataOf, r as BlockMethodName, t as BlockArgsOf } from "../block-method-CiVa2G-J.js";
|
|
25
25
|
import { i as tagFor, t as TagOptions } from "../tags-Cm48BsOa.js";
|
|
26
|
-
import { c as RecordListCells, n as Timeline, o as RecordList, u as RecordListPage } from "../timeline-
|
|
26
|
+
import { c as RecordListCells, n as Timeline, o as RecordList, u as RecordListPage } from "../timeline-DqEoD8bb.js";
|
|
27
27
|
import { n as supportOf, t as SupportView } from "../support-view-nqUWKHEs.js";
|
|
28
28
|
import { NextRequest } from "next/server.js";
|
|
29
29
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
30
|
+
import { UserClaims } from "@supabase/server";
|
|
30
31
|
//#region src/next/collector.d.ts
|
|
31
32
|
/** Forwarded by the proxy so every scope of one render shares an id. */
|
|
32
33
|
export declare const REQUEST_ID_HEADER = "x-bsb-request-id";
|
|
@@ -534,6 +535,30 @@ interface BetterNext<M extends AnyModels, F extends AnyFunctions, E, C = unknown
|
|
|
534
535
|
* the same request are signed out.
|
|
535
536
|
*/
|
|
536
537
|
signOut(params?: SignOutParams, options?: SignInOptions): Promise<ActionResult<SignedIn>>;
|
|
538
|
+
/**
|
|
539
|
+
* Emails a magic link and a code. It writes the PKCE verifier cookie like
|
|
540
|
+
* `authorizeUrl`, so the link's `?code=` goes to `exchangeCode`, and the code
|
|
541
|
+
* to `verifyOtp` with `type: "email"`. Returns `null`: nothing is signed in
|
|
542
|
+
* yet.
|
|
543
|
+
*/
|
|
544
|
+
signInWithOtp(params: SignInWithOtpParams): Promise<ActionResult<null>>;
|
|
545
|
+
/**
|
|
546
|
+
* Emails a password reset link with the PKCE verifier cookie. `exchangeCode`
|
|
547
|
+
* on the callback signs the user in; the app then asks for the new password.
|
|
548
|
+
* Auth answers the same whether or not an account has the email.
|
|
549
|
+
*/
|
|
550
|
+
resetPasswordForEmail(params: ResetPasswordParams): Promise<ActionResult<null>>;
|
|
551
|
+
/**
|
|
552
|
+
* Signs up with an email and a password. With email confirmation on, it
|
|
553
|
+
* emails the confirmation link with the PKCE verifier cookie and returns
|
|
554
|
+
* `null`. With it off, Auth returns a session, committed like `signIn`.
|
|
555
|
+
*/
|
|
556
|
+
signUp(params: SignUpParams, options?: SignInOptions): Promise<ActionResult<SignedIn | null>>;
|
|
557
|
+
/**
|
|
558
|
+
* Emails the sign-up confirmation or the email change link again, with a new
|
|
559
|
+
* PKCE verifier cookie.
|
|
560
|
+
*/
|
|
561
|
+
resend(params: ResendParams): Promise<ActionResult<null>>;
|
|
537
562
|
}
|
|
538
563
|
interface SignInCredentials {
|
|
539
564
|
readonly email: string;
|
|
@@ -555,6 +580,43 @@ interface OAuthStart extends AuthorizeUrlParams {
|
|
|
555
580
|
/** Where to go after the callback; checked before use. */
|
|
556
581
|
readonly next?: string | null;
|
|
557
582
|
}
|
|
583
|
+
/**
|
|
584
|
+
* Where an email link lands. The verifier cookie lives 10 minutes and holds one
|
|
585
|
+
* flow: a newer `authorizeUrl` or email flow in the same browser replaces it.
|
|
586
|
+
*/
|
|
587
|
+
interface EmailRedirect {
|
|
588
|
+
/**
|
|
589
|
+
* The absolute URL of the callback route that calls `exchangeCode`. It must
|
|
590
|
+
* be in the project's redirect allow list.
|
|
591
|
+
*/
|
|
592
|
+
readonly redirectTo: string;
|
|
593
|
+
/** Rides on `redirectTo` as `?next=` when it is a same-origin path. */
|
|
594
|
+
readonly next?: string | null;
|
|
595
|
+
}
|
|
596
|
+
/** `signInWithOtp` input. */
|
|
597
|
+
interface SignInWithOtpParams extends EmailRedirect {
|
|
598
|
+
readonly email: string;
|
|
599
|
+
/** Create a user when no account has the email. Defaults to `true`. */
|
|
600
|
+
readonly shouldCreateUser?: boolean;
|
|
601
|
+
/** `user_metadata` for a user this creates. */
|
|
602
|
+
readonly data?: Readonly<Record<string, unknown>>;
|
|
603
|
+
}
|
|
604
|
+
/** `resetPasswordForEmail` input. */
|
|
605
|
+
interface ResetPasswordParams extends EmailRedirect {
|
|
606
|
+
readonly email: string;
|
|
607
|
+
}
|
|
608
|
+
/** `signUp` input. */
|
|
609
|
+
interface SignUpParams extends EmailRedirect {
|
|
610
|
+
readonly email: string;
|
|
611
|
+
readonly password: string;
|
|
612
|
+
/** `user_metadata` for the new user. */
|
|
613
|
+
readonly data?: Readonly<Record<string, unknown>>;
|
|
614
|
+
}
|
|
615
|
+
/** `resend` input. */
|
|
616
|
+
interface ResendParams extends EmailRedirect {
|
|
617
|
+
readonly type: "signup" | "email_change";
|
|
618
|
+
readonly email: string;
|
|
619
|
+
}
|
|
558
620
|
/** `exchangeCode` input: the callback's `?code=` and `?next=`. */
|
|
559
621
|
interface CodeExchange {
|
|
560
622
|
readonly code: string;
|
|
@@ -586,6 +648,11 @@ interface SignedIn {
|
|
|
586
648
|
* `redirectTo`. Advisory: keep the proxy and `action({ aal: 2 })` gates.
|
|
587
649
|
*/
|
|
588
650
|
readonly mfa: boolean;
|
|
651
|
+
/**
|
|
652
|
+
* The signed-in user, read from the verified claims like `AuthSession.user`;
|
|
653
|
+
* `null` once signed out.
|
|
654
|
+
*/
|
|
655
|
+
readonly user: UserClaims | null;
|
|
589
656
|
}
|
|
590
657
|
/** What `startSupport` returns: plain data, safe across the action boundary. */
|
|
591
658
|
interface SupportStarted {
|
|
@@ -760,4 +827,4 @@ export declare function shouldRefresh(request: Request): boolean;
|
|
|
760
827
|
*/
|
|
761
828
|
export declare function requireAal(level: Aal, options?: RequireAalOptions): (auth: AuthState, request: NextRequest) => Response | undefined;
|
|
762
829
|
//#endregion
|
|
763
|
-
export { type Aal, type ActionArgs, type ActionOptions, type ActionResult, type ActiveSupport, type AmrEntry, type AuthKind, type AuthSession, type AuthorizeOptions, type AuthorizeUrlParams, type AuthorizedContext, type BetterNext, type BlockActionArgs, type CachedContext, type CachedOptions, type CodeExchange, type DbBudget, type DbStats, type EmailOtpType, type EndedSessionOptions, type GuardOptions, type Impersonator, type LiveCountSeed, type MembershipClaim, type MfaVerification, type NextCacheOptions, type NextDebugOptions, type NextOptions, type NextResourceHandler, type NextResourceRoutes, type NextResourcesOptions, type OAuthStart, type ProxyOptions, type RecordListServer, type RecordListView, type RecordLoadOptions, type RecordServer, type RecordServerActions, type RecordServerContext, type RecordTagOptions, type RecordTimelineOptions, type RecordView, type RequireAalOptions, type RequireOptions, type ResourceAction, type ResourceContext, type ResourceHooks, type ResourceLoaderContext, type ResourceMap, type ResourceRouteOptions, type RouteOptions, type ScopeOptions, type SessionSnapshot, type SessionStaleOptions, type SignInCredentials, type SignInOptions, type SignOutParams, type SignOutScope, type SignedIn, type SupportOptions, type SupportPolicy, type SupportSessions, type SupportStartRequest, type SupportStarted, type SupportView, type TagOptions, type VerifyOtpParams, authzVersionOf, defineAction, isSessionSnapshot, issuedAtOf, safeRedirectPath, sessionCacheKey, supportOf, supportSessions, tagFor, tenantOf, toSession };
|
|
830
|
+
export { type Aal, type ActionArgs, type ActionOptions, type ActionResult, type ActiveSupport, type AmrEntry, type AuthKind, type AuthSession, type AuthorizeOptions, type AuthorizeUrlParams, type AuthorizedContext, type BetterNext, type BlockActionArgs, type CachedContext, type CachedOptions, type CodeExchange, type DbBudget, type DbStats, type EmailOtpType, type EmailRedirect, type EndedSessionOptions, type GuardOptions, type Impersonator, type LiveCountSeed, type MembershipClaim, type MfaVerification, type NextCacheOptions, type NextDebugOptions, type NextOptions, type NextResourceHandler, type NextResourceRoutes, type NextResourcesOptions, type OAuthStart, type ProxyOptions, type RecordListServer, type RecordListView, type RecordLoadOptions, type RecordServer, type RecordServerActions, type RecordServerContext, type RecordTagOptions, type RecordTimelineOptions, type RecordView, type RequireAalOptions, type RequireOptions, type ResendParams, type ResetPasswordParams, type ResourceAction, type ResourceContext, type ResourceHooks, type ResourceLoaderContext, type ResourceMap, type ResourceRouteOptions, type RouteOptions, type ScopeOptions, type SessionSnapshot, type SessionStaleOptions, type SignInCredentials, type SignInOptions, type SignInWithOtpParams, type SignOutParams, type SignOutScope, type SignUpParams, type SignedIn, type SupportOptions, type SupportPolicy, type SupportSessions, type SupportStartRequest, type SupportStarted, type SupportView, type TagOptions, type VerifyOtpParams, authzVersionOf, defineAction, isSessionSnapshot, issuedAtOf, safeRedirectPath, sessionCacheKey, supportOf, supportSessions, tagFor, tenantOf, toSession };
|
package/dist/next/index.js
CHANGED
|
@@ -10,15 +10,16 @@ import { o as problemResponse } from "../problem-Bf0cJ7tk.js";
|
|
|
10
10
|
import { i as claimsOf } from "../claims-Bp9My7XP.js";
|
|
11
11
|
import { t as supportOf } from "../support-view-g4YLBeqX.js";
|
|
12
12
|
import { n as createBlockClient } from "../create-blocks-BfrDUSM6.js";
|
|
13
|
-
import { a as recordCan, c as recordWriteInput, i as plainData, l as runBindingWrite, o as recordPermissionKeys, p as loadBindings, r as findBindingWrite, s as recordSubject, t as bindingWrites } from "../record-type-
|
|
13
|
+
import { a as recordCan, c as recordWriteInput, i as plainData, l as runBindingWrite, o as recordPermissionKeys, p as loadBindings, r as findBindingWrite, s as recordSubject, t as bindingWrites } from "../record-type-BEUyEsFx.js";
|
|
14
14
|
import { n as methodOf } from "../block-method-C9hWdHom.js";
|
|
15
15
|
import { t as tenantOf } from "../tenant-BgIiMQpo.js";
|
|
16
|
-
import { t as loadTimeline } from "../timeline
|
|
17
|
-
import {
|
|
16
|
+
import { t as loadTimeline } from "../timeline-Dz3hO2I6.js";
|
|
17
|
+
import { c as extendServer, n as flushEvents, p as supportCookieMaxAge, r as handle, s as createServer, t as bearerRequest, v as outageResponse, x as serverCore } from "../adapter-BTbj5N9C.js";
|
|
18
|
+
import { t as isPrefetch } from "../refresh-DLBgnxjL.js";
|
|
18
19
|
import { d as clearSessionAtScopes, g as sessionCookieName, t as clientIp, u as applyCookieWrites, v as writeSession } from "../resolve-B0mW2m7f.js";
|
|
19
|
-
import { a as isSessionSnapshot, f as checkAal, i as authzVersionOf, l as snapshotOf, n as toSession, o as issuedAtOf, s as sessionCacheKey } from "../view-C8Ve14ja.js";
|
|
20
|
+
import { a as isSessionSnapshot, f as checkAal, i as authzVersionOf, l as snapshotOf, n as toSession, o as issuedAtOf, r as authOfSnapshot, s as sessionCacheKey } from "../view-C8Ve14ja.js";
|
|
20
21
|
import { i as guard, n as defaultExpose, s as settle } from "../respond-CZMWbUs3.js";
|
|
21
|
-
import { a as
|
|
22
|
+
import { a as otpGrant, c as pkcePair, d as supportSessions, i as needsMfa, l as revokeSession, n as emailFlow, o as passwordGrant, r as mfaGrant, s as pkceGrant, t as authorizeUrlFor, u as safeRedirectPath } from "../sign-in-CuZ1Ag7O.js";
|
|
22
23
|
import { i as defineAction } from "../resource-BUJcZKiW.js";
|
|
23
24
|
import { r as tagFor, t as cacheTagsOf } from "../tags-CIZTqtlY.js";
|
|
24
25
|
import { i as requireCaller, n as formDataObject, t as authorizeCaller } from "../kit-Bcd9wYCV.js";
|
|
@@ -491,6 +492,44 @@ function authFlows(deps) {
|
|
|
491
492
|
const { auth } = deps;
|
|
492
493
|
const cookieName = () => auth?.cookie?.name ?? sessionCookieName(deps.env().url);
|
|
493
494
|
const verifierName = () => `${cookieName()}-code-verifier`;
|
|
495
|
+
const setVerifier = async (value, maxAge) => {
|
|
496
|
+
(await deps.jar()).set(verifierName(), value, {
|
|
497
|
+
path: "/",
|
|
498
|
+
...auth?.cookie?.options,
|
|
499
|
+
httpOnly: true,
|
|
500
|
+
sameSite: "lax",
|
|
501
|
+
maxAge
|
|
502
|
+
});
|
|
503
|
+
};
|
|
504
|
+
/** Writes a new PKCE verifier cookie and returns its challenge. */
|
|
505
|
+
const startPkce = async () => {
|
|
506
|
+
const { verifier, challenge } = await pkcePair();
|
|
507
|
+
await setVerifier(verifier, VERIFIER_MAX_AGE);
|
|
508
|
+
return challenge;
|
|
509
|
+
};
|
|
510
|
+
/** `redirectTo` with a same-origin `next` as `?next=`. */
|
|
511
|
+
const callbackUrl = (params) => {
|
|
512
|
+
const next = safeRedirectPath(params.next, "");
|
|
513
|
+
const target = new URL(params.redirectTo);
|
|
514
|
+
if (next) target.searchParams.set("next", next);
|
|
515
|
+
return target.href;
|
|
516
|
+
};
|
|
517
|
+
/** Starts an email flow; drops the verifier when Auth refuses it. */
|
|
518
|
+
const sendEmail = async (path, params, body) => {
|
|
519
|
+
const challenge = await startPkce();
|
|
520
|
+
const sent = await emailFlow(path, {
|
|
521
|
+
body,
|
|
522
|
+
redirectTo: callbackUrl(params),
|
|
523
|
+
challenge
|
|
524
|
+
}, await grantOptions());
|
|
525
|
+
if (!sent.ok) await setVerifier("", 0);
|
|
526
|
+
return sent;
|
|
527
|
+
};
|
|
528
|
+
const requested = (sent) => sent.ok ? {
|
|
529
|
+
ok: true,
|
|
530
|
+
data: null,
|
|
531
|
+
error: null
|
|
532
|
+
} : sent;
|
|
494
533
|
const grantOptions = async () => {
|
|
495
534
|
const env = deps.env();
|
|
496
535
|
const secretKey = env.secretKey;
|
|
@@ -523,7 +562,8 @@ function authFlows(deps) {
|
|
|
523
562
|
ok: true,
|
|
524
563
|
data: {
|
|
525
564
|
redirectTo: safeRedirectPath(next, options.fallback ?? "/"),
|
|
526
|
-
mfa: stored !== null && needsMfa(stored) && snapshotOf(resolution.auth)?.claims["aal"] !== "aal2"
|
|
565
|
+
mfa: stored !== null && needsMfa(stored) && snapshotOf(resolution.auth)?.claims["aal"] !== "aal2",
|
|
566
|
+
user: resolution.auth.kind === "user" ? resolution.auth.user : null
|
|
527
567
|
},
|
|
528
568
|
error: null
|
|
529
569
|
};
|
|
@@ -536,32 +576,41 @@ function authFlows(deps) {
|
|
|
536
576
|
signIn,
|
|
537
577
|
verifyOtp: async (params, options = {}) => commit(await otpGrant(params, await grantOptions()), params.next, options),
|
|
538
578
|
async authorizeUrl(params) {
|
|
539
|
-
const
|
|
540
|
-
(await deps.jar()).set(verifierName(), verifier, {
|
|
541
|
-
path: "/",
|
|
542
|
-
...auth?.cookie?.options,
|
|
543
|
-
httpOnly: true,
|
|
544
|
-
sameSite: "lax",
|
|
545
|
-
maxAge: VERIFIER_MAX_AGE
|
|
546
|
-
});
|
|
547
|
-
const next = safeRedirectPath(params.next, "");
|
|
548
|
-
const redirectTo = new URL(params.redirectTo);
|
|
549
|
-
if (next) redirectTo.searchParams.set("next", next);
|
|
579
|
+
const challenge = await startPkce();
|
|
550
580
|
return { url: authorizeUrlFor(deps.env().url, {
|
|
551
581
|
...params,
|
|
552
|
-
redirectTo:
|
|
582
|
+
redirectTo: callbackUrl(params)
|
|
553
583
|
}, challenge) };
|
|
554
584
|
},
|
|
555
|
-
async
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
585
|
+
async signInWithOtp(params) {
|
|
586
|
+
return requested(await sendEmail("otp", params, {
|
|
587
|
+
email: params.email,
|
|
588
|
+
create_user: params.shouldCreateUser ?? true,
|
|
589
|
+
data: params.data ?? {}
|
|
590
|
+
}));
|
|
591
|
+
},
|
|
592
|
+
async resetPasswordForEmail(params) {
|
|
593
|
+
return requested(await sendEmail("recover", params, { email: params.email }));
|
|
594
|
+
},
|
|
595
|
+
async signUp(params, options = {}) {
|
|
596
|
+
const sent = await sendEmail("signup", params, {
|
|
597
|
+
email: params.email,
|
|
598
|
+
password: params.password,
|
|
599
|
+
data: params.data ?? {}
|
|
564
600
|
});
|
|
601
|
+
if (!sent.ok || sent.data === null) return requested(sent);
|
|
602
|
+
await setVerifier("", 0);
|
|
603
|
+
return commit(sent, params.next, options);
|
|
604
|
+
},
|
|
605
|
+
async resend(params) {
|
|
606
|
+
return requested(await sendEmail("resend", params, {
|
|
607
|
+
email: params.email,
|
|
608
|
+
type: params.type
|
|
609
|
+
}));
|
|
610
|
+
},
|
|
611
|
+
async exchangeCode(params, options = {}) {
|
|
612
|
+
const verifier = (await deps.jar()).getAll().find((cookie) => cookie.name === verifierName())?.value;
|
|
613
|
+
await setVerifier("", 0);
|
|
565
614
|
if (!verifier) return {
|
|
566
615
|
ok: false,
|
|
567
616
|
data: null,
|
|
@@ -593,14 +642,18 @@ function authFlows(deps) {
|
|
|
593
642
|
if (!revoked.ok) return revoked;
|
|
594
643
|
}
|
|
595
644
|
if (current) deps.signedOut(current.userId);
|
|
596
|
-
if (scope === "others")
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
645
|
+
if (scope === "others") {
|
|
646
|
+
const kept = current ? authOfSnapshot(current) : void 0;
|
|
647
|
+
return {
|
|
648
|
+
ok: true,
|
|
649
|
+
data: {
|
|
650
|
+
redirectTo: safeRedirectPath(params.next, options.fallback ?? "/"),
|
|
651
|
+
mfa: false,
|
|
652
|
+
user: kept?.kind === "user" ? kept.user : null
|
|
653
|
+
},
|
|
654
|
+
error: null
|
|
655
|
+
};
|
|
656
|
+
}
|
|
604
657
|
return commit(ok(null), params.next, options);
|
|
605
658
|
}
|
|
606
659
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as AuthorizationOperation } from "./authorization-
|
|
1
|
+
import { r as AuthorizationOperation } from "./authorization-DfEkyFt_.js";
|
|
2
2
|
//#region src/core/operations.d.ts
|
|
3
3
|
/** Operations by name, as `authorization.operations` or a module's own defaults. */
|
|
4
4
|
type OperationTable = Readonly<Record<string, AuthorizationOperation>>;
|
|
@@ -10,7 +10,8 @@ const calendarSqlOptions = blockOptions({
|
|
|
10
10
|
rdates: option.boolean({ default: false }),
|
|
11
11
|
attendeeKey: option.string({ default: "email" }),
|
|
12
12
|
calendarDetails: option.boolean({ default: false }),
|
|
13
|
-
ruleDialect: option.unknown()
|
|
13
|
+
ruleDialect: option.unknown(),
|
|
14
|
+
readOnly: option.unknown()
|
|
14
15
|
});
|
|
15
16
|
//#endregion
|
|
16
17
|
export { calendarSqlOptions as t };
|
|
@@ -4,7 +4,9 @@ const tasksSqlOptions = blockOptions({
|
|
|
4
4
|
prefix: option.string({ default: "TASK-" }),
|
|
5
5
|
maxAssignees: option.number({ default: 0 }),
|
|
6
6
|
extraColumns: option.extraColumns(),
|
|
7
|
-
authorCanDelete: option.boolean({ default: true })
|
|
7
|
+
authorCanDelete: option.boolean({ default: true }),
|
|
8
|
+
notify: option.boolean({ default: true }),
|
|
9
|
+
actionPath: option.string()
|
|
8
10
|
});
|
|
9
11
|
//#endregion
|
|
10
12
|
export { tasksSqlOptions as t };
|
package/dist/orpc/index.js
CHANGED
|
@@ -7,7 +7,8 @@ import { i as claimsOf } from "../claims-Bp9My7XP.js";
|
|
|
7
7
|
import { t as TABLE_VERBS } from "../resource-DvgXqZB_.js";
|
|
8
8
|
import { t as callWithInput } from "../block-method-C9hWdHom.js";
|
|
9
9
|
import { t as tenantOf } from "../tenant-BgIiMQpo.js";
|
|
10
|
-
import { c as extendServer, n as flushEvents, s as createServer
|
|
10
|
+
import { c as extendServer, n as flushEvents, s as createServer } from "../adapter-BTbj5N9C.js";
|
|
11
|
+
import { n as refreshFor } from "../refresh-DLBgnxjL.js";
|
|
11
12
|
import { r as checkPermission } from "../authorizer-BGhXaDmo.js";
|
|
12
13
|
import { n as toSession } from "../view-C8Ve14ja.js";
|
|
13
14
|
import { i as guard, n as defaultExpose, s as settle, t as assertCookieRefresh } from "../respond-CZMWbUs3.js";
|
package/dist/otel/index.js
CHANGED
|
@@ -40,9 +40,9 @@ function systemOf(executor) {
|
|
|
40
40
|
* ```
|
|
41
41
|
*/
|
|
42
42
|
function otel(options = {}) {
|
|
43
|
-
const tracer = options.tracer ?? trace.getTracer("better-supabase", "0.
|
|
43
|
+
const tracer = options.tracer ?? trace.getTracer("better-supabase", "0.31.0");
|
|
44
44
|
let histogram;
|
|
45
|
-
if (options.metrics !== false) histogram = (options.meter ?? metrics.getMeter("better-supabase", "0.
|
|
45
|
+
if (options.metrics !== false) histogram = (options.meter ?? metrics.getMeter("better-supabase", "0.31.0")).createHistogram("db.client.operation.duration", {
|
|
46
46
|
unit: "s",
|
|
47
47
|
description: "Duration of database client operations.",
|
|
48
48
|
advice: { explicitBucketBoundaries: [
|
|
@@ -219,7 +219,7 @@ function otel(options = {}) {
|
|
|
219
219
|
* `betterSupabase.events`. Returns a function that stops listening.
|
|
220
220
|
*/
|
|
221
221
|
function traceAuth(betterSupabase, options = {}) {
|
|
222
|
-
const tracer = options.tracer ?? trace.getTracer("better-supabase", "0.
|
|
222
|
+
const tracer = options.tracer ?? trace.getTracer("better-supabase", "0.31.0");
|
|
223
223
|
const offAuth = betterSupabase.events.on("auth", (event) => {
|
|
224
224
|
const span = tracer.startSpan("auth.resolve", {
|
|
225
225
|
kind: SpanKind.INTERNAL,
|
|
@@ -257,7 +257,7 @@ function traceAuth(betterSupabase, options = {}) {
|
|
|
257
257
|
* an error status. Returns a function that stops listening.
|
|
258
258
|
*/
|
|
259
259
|
function traceBlockEvents(betterSupabase, options = {}) {
|
|
260
|
-
const tracer = options.tracer ?? trace.getTracer("better-supabase", "0.
|
|
260
|
+
const tracer = options.tracer ?? trace.getTracer("better-supabase", "0.31.0");
|
|
261
261
|
return betterSupabase.events.on("block", (event) => {
|
|
262
262
|
const attributes = {
|
|
263
263
|
...options.attributes,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as AsyncResult } from "./result-DZeA5KS6.js";
|
|
2
|
-
import { n as TopicPort } from "./watch-topic-
|
|
2
|
+
import { n as TopicPort } from "./watch-topic-BabDTZ-L.js";
|
|
3
3
|
import { SupabaseClient } from "@supabase/supabase-js";
|
|
4
4
|
//#region src/client/ports.d.ts
|
|
5
5
|
/**
|
|
@@ -2,8 +2,8 @@ import { f as Result } from "../result-DZeA5KS6.js";
|
|
|
2
2
|
import { Bt as Executor } from "../types-CPl9uJ0G.js";
|
|
3
3
|
import { t as BlockTransport } from "../block-transport-9EUA3q_I.js";
|
|
4
4
|
import { C as UploadRouteOptions, E as uploadRoute, S as UploadRoute, T as uploadOutcome, _ as UploadConnectorOptions, b as UploadOutcome, c as LocalTablesOption, d as CreateUploadRepository, f as CrudEntryLike, g as UploadConnector, h as RejectedStore, m as RejectedChange, n as DataEngine, p as CrudQueueLike, s as LiveEngineOptions, v as UploadErrorContext, w as createUploadConnector, x as UploadRepository, y as UploadFunction } from "../data-engine-rvbR2C4F.js";
|
|
5
|
-
import { n as TopicPort } from "../watch-topic-
|
|
6
|
-
import { t as AuthSnapshot } from "../bind-
|
|
5
|
+
import { n as TopicPort } from "../watch-topic-BabDTZ-L.js";
|
|
6
|
+
import { t as AuthSnapshot } from "../bind-DAx0bMSi.js";
|
|
7
7
|
import { C as quoteSqliteIdent, S as likeToGlob, _ as SqliteQuery, a as postgrestTimestamp, b as SqliteValue, c as sqliteCompiler, d as SqliteDecode, f as SqliteInsertPlan, g as SqlitePlan, h as SqliteNested, i as fromSqliteError, l as SqliteColumn, m as SqliteKeys, n as SqliteDatabaseLike, o as CheckSqliteOptions, p as SqliteKeyedPlan, r as SqliteExecutorOptions, s as checkSqlite, t as SqliteContextLike, u as SqliteCompilerOptions, v as SqliteReturning, w as sqliteValue, x as compileSqlite, y as SqliteSelectPlan } from "../executor-BfirBzOr.js";
|
|
8
8
|
//#region src/powersync/sync.d.ts
|
|
9
9
|
/** The part of PowerSync's `SyncStatus` the engine reads. */
|
|
@@ -249,7 +249,7 @@ interface NotificationRecipientWrites {
|
|
|
249
249
|
*
|
|
250
250
|
* ```ts
|
|
251
251
|
* createUploadConnector({
|
|
252
|
-
*
|
|
252
|
+
* tables: {
|
|
253
253
|
* notification_recipients: notificationRecipientsRoute(
|
|
254
254
|
* serverNotifications,
|
|
255
255
|
* ),
|
|
@@ -271,4 +271,204 @@ export declare function notificationRecipientsRoute(notifications: NotificationR
|
|
|
271
271
|
*/
|
|
272
272
|
export declare function powersyncTopicPort(database: PowerSyncDatabaseLike, tables?: readonly string[]): TopicPort;
|
|
273
273
|
//#endregion
|
|
274
|
-
|
|
274
|
+
//#region src/powersync/memberships.d.ts
|
|
275
|
+
/** The organization functions the local transport answers from SQLite. */
|
|
276
|
+
type LocalMembershipFunction = "list_my_organizations" | "leave_organization";
|
|
277
|
+
interface PowerSyncMembershipsOptions {
|
|
278
|
+
/** Where every other function goes: `rpcTransport(supabase)`. */
|
|
279
|
+
readonly server: BlockTransport;
|
|
280
|
+
/**
|
|
281
|
+
* The synced table names, as `powersync streams` wrote them into the client
|
|
282
|
+
* schema. Default `memberships` and `organizations`.
|
|
283
|
+
*/
|
|
284
|
+
readonly tables?: {
|
|
285
|
+
readonly memberships?: string;
|
|
286
|
+
readonly organizations?: string;
|
|
287
|
+
};
|
|
288
|
+
/**
|
|
289
|
+
* The tenant column of the memberships table, when `config.tenancy` renames
|
|
290
|
+
* it. Default `organization_id`.
|
|
291
|
+
*/
|
|
292
|
+
readonly tenantColumn?: string;
|
|
293
|
+
/** Function names, when the instance renames them (`blocks.<name>.entities`). */
|
|
294
|
+
readonly functions?: Partial<Record<LocalMembershipFunction, string>>;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* A block transport for the organizations block on PowerSync: the organization
|
|
298
|
+
* switcher's list (`organizations.mine()`) and leaving an organization run on
|
|
299
|
+
* the synced `memberships` and `organizations` tables, so the switcher works
|
|
300
|
+
* offline. A leave goes into PowerSync's upload queue, which `membershipsRoute`
|
|
301
|
+
* replays on the server. Every other function (switching, members, invitations)
|
|
302
|
+
* goes to `server`.
|
|
303
|
+
*
|
|
304
|
+
* ```ts
|
|
305
|
+
* const organizations = createOrganizations({
|
|
306
|
+
* transport: powersyncMembershipsTransport(powersync, {
|
|
307
|
+
* server: rpcTransport(supabase),
|
|
308
|
+
* }),
|
|
309
|
+
* });
|
|
310
|
+
* ```
|
|
311
|
+
*
|
|
312
|
+
* The synced memberships are the signed-in user's only (the `powersync streams`
|
|
313
|
+
* query filters by `auth.user_id()`). A row has its `role`; with
|
|
314
|
+
* `blocks.memberships.options.roles.many` the other roles and the
|
|
315
|
+
* organization's attribute columns come from the server.
|
|
316
|
+
*/
|
|
317
|
+
export declare function powersyncMembershipsTransport(database: PowerSyncDatabaseLike, options: PowerSyncMembershipsOptions): BlockTransport;
|
|
318
|
+
/**
|
|
319
|
+
* The upload route's organizations client: the server one, not the local
|
|
320
|
+
* transport.
|
|
321
|
+
*/
|
|
322
|
+
interface MembershipWrites {
|
|
323
|
+
updateMemberRole(organizationId: string, userId: string, role: string): PromiseLike<Result<unknown>>;
|
|
324
|
+
leave(organizationId: string): PromiseLike<Result<unknown>>;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* The upload route for `memberships`: replays a local leave (a `DELETE`) with
|
|
328
|
+
* `leave` and a role change (a `PATCH` to `role`) with `updateMemberRole`,
|
|
329
|
+
* whose server functions check the caller may make them. A `PUT` is refused: a
|
|
330
|
+
* user joins through an invitation. Pass an organizations client on
|
|
331
|
+
* `rpcTransport(supabase)`; one on `powersyncMembershipsTransport` would write
|
|
332
|
+
* the change locally again.
|
|
333
|
+
*
|
|
334
|
+
* ```ts
|
|
335
|
+
* createUploadConnector({
|
|
336
|
+
* tables: { memberships: membershipsRoute(serverOrganizations) },
|
|
337
|
+
* });
|
|
338
|
+
* ```
|
|
339
|
+
*/
|
|
340
|
+
export declare function membershipsRoute(organizations: MembershipWrites): UploadFunction;
|
|
341
|
+
//#endregion
|
|
342
|
+
//#region src/powersync/teams.d.ts
|
|
343
|
+
/** The team functions the local transport answers from SQLite. */
|
|
344
|
+
type LocalTeamFunction = "list_teams" | "update_team" | "archive_team" | "restore_team" | "add_team_member" | "remove_team_member";
|
|
345
|
+
interface PowerSyncTeamsOptions {
|
|
346
|
+
/** Where every other function goes: `rpcTransport(supabase)`. */
|
|
347
|
+
readonly server: BlockTransport;
|
|
348
|
+
/**
|
|
349
|
+
* The synced table names, as `powersync streams` wrote them into the client
|
|
350
|
+
* schema. Default `teams` and `team_members`.
|
|
351
|
+
*/
|
|
352
|
+
readonly tables?: {
|
|
353
|
+
readonly teams?: string;
|
|
354
|
+
readonly members?: string;
|
|
355
|
+
};
|
|
356
|
+
/**
|
|
357
|
+
* The tenant column of both tables, when `config.tenancy` renames it. Default
|
|
358
|
+
* `tenant_id`.
|
|
359
|
+
*/
|
|
360
|
+
readonly tenantColumn?: string;
|
|
361
|
+
/** Function names, when the instance renames them (`blocks.<name>.entities`). */
|
|
362
|
+
readonly functions?: Partial<Record<LocalTeamFunction, string>>;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* A block transport for the teams block on PowerSync: listing teams, renaming,
|
|
366
|
+
* archiving and restoring them, and adding and removing members run on the
|
|
367
|
+
* synced `teams` and `team_members` tables, so they work offline. The writes go
|
|
368
|
+
* into PowerSync's upload queue, which `teamsRoute` and `teamMembersRoute`
|
|
369
|
+
* replay on the server. Creating and deleting a team go to `server`, which
|
|
370
|
+
* picks the id and slug and checks the permission.
|
|
371
|
+
*
|
|
372
|
+
* ```ts
|
|
373
|
+
* const teams = createTeams({
|
|
374
|
+
* transport: powersyncTeamsTransport(powersync, {
|
|
375
|
+
* server: rpcTransport(supabase),
|
|
376
|
+
* }),
|
|
377
|
+
* });
|
|
378
|
+
* ```
|
|
379
|
+
*
|
|
380
|
+
* The synced teams are the ones the signed-in user belongs to (the `powersync
|
|
381
|
+
* streams` query filters by `auth.user_id()`), so `list` offline returns those,
|
|
382
|
+
* not every team the user may read, and each team's `memberIds` holds only the
|
|
383
|
+
* synced member rows.
|
|
384
|
+
*/
|
|
385
|
+
export declare function powersyncTeamsTransport(database: PowerSyncDatabaseLike, options: PowerSyncTeamsOptions): BlockTransport;
|
|
386
|
+
/** The upload routes' teams client: the server one, not the local transport. */
|
|
387
|
+
interface TeamWrites {
|
|
388
|
+
update(id: string, name: string, description?: string, fields?: never, options?: {
|
|
389
|
+
readonly slug?: string;
|
|
390
|
+
readonly description?: string | null;
|
|
391
|
+
}): PromiseLike<Result<unknown>>;
|
|
392
|
+
archive(id: string): PromiseLike<Result<unknown>>;
|
|
393
|
+
restore(id: string): PromiseLike<Result<unknown>>;
|
|
394
|
+
delete(id: string): PromiseLike<Result<unknown>>;
|
|
395
|
+
addMember(teamId: string, userId: string): PromiseLike<Result<unknown>>;
|
|
396
|
+
removeMember(teamId: string, userId: string): PromiseLike<Result<unknown>>;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* The upload route for `teams`: replays a local rename, slug or description
|
|
400
|
+
* change with `update`, a `status` change with `archive` or `restore`, and a
|
|
401
|
+
* `DELETE` with `delete`. A `PATCH` carries only the changed columns, so the
|
|
402
|
+
* route reads the team's current name from `database` when the name stayed. A
|
|
403
|
+
* `PUT` is refused: create teams on the server.
|
|
404
|
+
*
|
|
405
|
+
* ```ts
|
|
406
|
+
* createUploadConnector({
|
|
407
|
+
* tables: {
|
|
408
|
+
* teams: teamsRoute(serverTeams, powersync),
|
|
409
|
+
* team_members: teamMembersRoute(serverTeams),
|
|
410
|
+
* },
|
|
411
|
+
* });
|
|
412
|
+
* ```
|
|
413
|
+
*/
|
|
414
|
+
export declare function teamsRoute(teams: TeamWrites, database: PowerSyncDatabaseLike, table?: string): UploadFunction;
|
|
415
|
+
/**
|
|
416
|
+
* The upload route for `team_members`: replays a local add (a `PUT`) with
|
|
417
|
+
* `addMember` and a removal (a `DELETE`) with `removeMember`. `powersync
|
|
418
|
+
* streams` keys a row as `<team>:<user>`.
|
|
419
|
+
*/
|
|
420
|
+
export declare function teamMembersRoute(teams: TeamWrites): UploadFunction;
|
|
421
|
+
//#endregion
|
|
422
|
+
//#region src/powersync/profiles.d.ts
|
|
423
|
+
/** The profile functions the local transport answers from SQLite. */
|
|
424
|
+
type LocalProfileFunction = "my_profile" | "update_my_profile";
|
|
425
|
+
interface PowerSyncProfilesOptions {
|
|
426
|
+
/** Where every other function goes: `rpcTransport(supabase)`. */
|
|
427
|
+
readonly server: BlockTransport;
|
|
428
|
+
/**
|
|
429
|
+
* The synced table name, as `powersync streams` wrote it into the client
|
|
430
|
+
* schema. Default `profiles`.
|
|
431
|
+
*/
|
|
432
|
+
readonly table?: string;
|
|
433
|
+
/** Function names, when the instance renames them (`blocks.<name>.entities`). */
|
|
434
|
+
readonly functions?: Partial<Record<LocalProfileFunction, string>>;
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* A block transport for the profiles block on PowerSync: `profiles.mine()` and
|
|
438
|
+
* `profiles.updateMine()` run on the synced `profiles` row, so the user's
|
|
439
|
+
* profile reads and edits work offline. An edit goes into PowerSync's upload
|
|
440
|
+
* queue, which `profilesRoute` replays on the server.
|
|
441
|
+
*
|
|
442
|
+
* ```ts
|
|
443
|
+
* const profiles = createProfiles({
|
|
444
|
+
* transport: powersyncProfilesTransport(powersync, {
|
|
445
|
+
* server: rpcTransport(supabase),
|
|
446
|
+
* }),
|
|
447
|
+
* });
|
|
448
|
+
* ```
|
|
449
|
+
*
|
|
450
|
+
* The synced row is the signed-in user's only (the `powersync streams` query
|
|
451
|
+
* filters by `auth.user_id()`). `updateMine` writes the columns the local row
|
|
452
|
+
* has, except the ones only the server sets (`email`, the active organization
|
|
453
|
+
* and team, and the stamps).
|
|
454
|
+
*/
|
|
455
|
+
export declare function powersyncProfilesTransport(database: PowerSyncDatabaseLike, options: PowerSyncProfilesOptions): BlockTransport;
|
|
456
|
+
/** The upload route's profiles client: the server one, not the local transport. */
|
|
457
|
+
interface ProfileWrites {
|
|
458
|
+
updateMine(attrs: Readonly<Record<string, unknown>>): PromiseLike<Result<unknown>>;
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* The upload route for `profiles`: replays a local edit (a `PATCH`) with
|
|
462
|
+
* `updateMine`, which writes only the columns the profiles block lets a user
|
|
463
|
+
* change. A `PUT` or `DELETE` is refused: the server creates and removes
|
|
464
|
+
* profiles with the user.
|
|
465
|
+
*
|
|
466
|
+
* ```ts
|
|
467
|
+
* createUploadConnector({
|
|
468
|
+
* tables: { profiles: profilesRoute(serverProfiles) },
|
|
469
|
+
* });
|
|
470
|
+
* ```
|
|
471
|
+
*/
|
|
472
|
+
export declare function profilesRoute(profiles: ProfileWrites): UploadFunction;
|
|
473
|
+
//#endregion
|
|
474
|
+
export { type AttachmentPathRow, type AttachmentQueueRoute, type AttachmentQueueRouteOptions, type AuthSourceLike, type CheckSqliteOptions, type CreateUploadRepository, type CrudEntryLike, type CrudQueueLike, type LocalMembershipFunction, type LocalNotificationFunction, type LocalProfileFunction, type LocalTeamFunction, type MembershipWrites, type NotificationRecipientWrites, type PowerSyncDatabaseLike, type PowerSyncEngineOptions, type PowerSyncExecutorOptions, type PowerSyncMembershipsOptions, type PowerSyncNotificationsOptions, type PowerSyncProfilesOptions, type PowerSyncTeamsOptions, type ProfileWrites, type RejectedChange, type RejectedStore, type SqliteColumn, type SqliteCompilerOptions, type SqliteContextLike, type SqliteDecode, type SqliteInsertPlan, type SqliteKeyedPlan, type SqliteKeys, type SqliteNested, type SqlitePlan, type SqliteQuery, type SqliteReturning, type SqliteSelectPlan, type SqliteValue, type SyncStatusLike, type SyncWithAuthOptions, type SyncedDatabaseLike, type TeamWrites, type UploadConnector, type UploadConnectorOptions, type UploadErrorContext, type UploadFunction, type UploadOutcome, type UploadRepository, type UploadRoute, type UploadRouteOptions, checkSqlite, compileSqlite, createUploadConnector, fromSqliteError, likeToGlob, postgrestTimestamp, quoteSqliteIdent, sqliteCompiler, sqliteValue, uploadOutcome, uploadRoute };
|