better-supabase 0.6.1 → 0.7.1
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-CHnPkCPd.js → adapter-iKgjHVPx.js} +34 -4
- package/dist/ai-sdk/batches/index.d.ts +1 -1
- package/dist/ai-sdk/index.d.ts +1 -1
- package/dist/ai-sdk/mcp/index.d.ts +3 -3
- package/dist/{api-keys-rCGtKaZA.d.ts → api-keys-CIjghYjV.d.ts} +1 -1
- package/dist/astro/index.d.ts +4 -4
- package/dist/astro/index.js +2 -2
- package/dist/blocks/ai-providers/index.d.ts +1 -1
- package/dist/blocks/api-keys/index.d.ts +2 -2
- package/dist/blocks/audit/index.js +1 -1
- package/dist/blocks/connectors/index.d.ts +1 -1
- package/dist/blocks/data-lifecycle/index.d.ts +1 -1
- package/dist/blocks/data-lifecycle/index.js +1 -1
- package/dist/blocks/entitlements/index.d.ts +1 -1
- package/dist/blocks/index.d.ts +1 -1
- package/dist/blocks/sso/index.d.ts +1 -1
- package/dist/blocks/workflow-builder/index.d.ts +2 -2
- package/dist/blocks/workflow-builder/react/index.d.ts +1 -1
- package/dist/chat-sdk/index.d.ts +1 -1
- package/dist/cli/bin.js +1 -1
- package/dist/cli/{doctor-BMqBgM3X.js → doctor-DJk0aeBi.js} +66 -14
- package/dist/cli/{gen-DeuDgPxN.js → gen-CCMc39Dx.js} +1 -1
- package/dist/cli/gen-DRmzPI75.js +2 -0
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +3 -3
- package/dist/cli/{init-C7Xd0Kda.js → init-BHuEQrQK.js} +1 -1
- package/dist/cli/{introspect-CSnMJ94U.js → introspect-DzR2nyQb.js} +1 -1
- package/dist/cli/{run-C8tnlHSb.js → run-BqDPh9UH.js} +7 -7
- package/dist/cli/{sql-D0GUtUPp.js → sql-B8csQPyn.js} +13 -54
- package/dist/cli/sql-layout-D6cphHT3.js +69 -0
- package/dist/cli/{version-C_4JwyiM.js → version-59gcepIG.js} +1 -1
- package/dist/{composite-pSfeJNce.d.ts → composite--yqry7uW.d.ts} +3 -3
- package/dist/{composite-CLqs9-OA.js → composite-DXVUibdi.js} +1 -1
- package/dist/{connectors-hkLCwyEz.d.ts → connectors-CrpknU0P.d.ts} +1 -1
- package/dist/credentials/index.d.ts +2 -2
- package/dist/{csv-CPAzEmB6.js → csv-DCK-PT1n.js} +1 -1
- package/dist/edge/index.d.ts +5 -5
- package/dist/edge/index.js +3 -3
- package/dist/elysia/index.d.ts +1 -1
- package/dist/{ended-jLfvw8h-.d.ts → ended-XjeGQ5XW.d.ts} +4 -1
- package/dist/{entitlements-DHrY2UDZ.d.ts → entitlements-BKSVGtrG.d.ts} +1 -1
- package/dist/eve/index.d.ts +2 -2
- package/dist/eve/index.js +1 -1
- package/dist/{executor-D14tGopJ.d.ts → executor-BVBFM86G.d.ts} +1 -1
- package/dist/expo/index.d.ts +2 -2
- package/dist/expo/index.js +3 -3
- package/dist/{framework-CdPDPpFs.d.ts → framework-BmzgK32X.d.ts} +4 -4
- package/dist/{framework-xjTBoyBB.js → framework-a7aRCIqv.js} +1 -1
- package/dist/h3/index.d.ts +1 -1
- package/dist/h3/v1/index.d.ts +1 -1
- package/dist/hono/index.d.ts +6 -6
- package/dist/hono/index.js +2 -2
- package/dist/{index-DDrYaUcq.d.ts → index-CdZKQF98.d.ts} +1 -1
- package/dist/{index-CtuakVRc.d.ts → index-CewnYSpv.d.ts} +1 -1
- package/dist/{kit-B5tid-q5.d.ts → kit-CkNzZUqv.d.ts} +3 -3
- package/dist/mcp/index.d.ts +3 -3
- package/dist/mcp/index.js +1 -1
- package/dist/mcp/sdk/index.d.ts +3 -3
- package/dist/mcp/sdk/index.js +1 -1
- package/dist/nestjs/index.d.ts +2 -2
- package/dist/next/index.d.ts +13 -8
- package/dist/next/index.js +5 -5
- package/dist/node/index.d.ts +2 -2
- package/dist/orpc/index.d.ts +4 -4
- package/dist/orpc/index.js +1 -1
- package/dist/otel/index.js +5 -5
- package/dist/{provider-BH5UWZJ6.d.ts → provider-D-UEMvSD.d.ts} +1 -1
- package/dist/react/index.d.ts +5 -5
- package/dist/react/server.d.ts +5 -5
- package/dist/react/session.d.ts +2 -2
- package/dist/react-router/index.d.ts +4 -4
- package/dist/react-router/index.js +2 -2
- package/dist/{refusal-D1rgbzNq.d.ts → refusal-DhSU2Vvr.d.ts} +1 -1
- package/dist/{resolve-KW8nCeL6.d.ts → resolve-ChTYeTEl.d.ts} +3 -0
- package/dist/{resolve-D_IcnvFd.js → resolve-tJZY3FEa.js} +12 -7
- package/dist/{resource-D6Uc7Sk7.d.ts → resource-IPS5xi9q.d.ts} +1 -1
- package/dist/{respond-DoBijysA.d.ts → respond-DprrgyXX.d.ts} +1 -1
- package/dist/server/index.d.ts +47 -10
- package/dist/server/index.js +27 -5
- package/dist/{server-C6DWVEVG.d.ts → server-Bh0EVSwU.d.ts} +32 -3
- package/dist/solid/index.d.ts +2 -2
- package/dist/solid-start/index.d.ts +4 -4
- package/dist/solid-start/index.js +2 -2
- package/dist/sql/index.d.ts +10 -0
- package/dist/sql/index.js +52 -5
- package/dist/ssr/index.d.ts +4 -4
- package/dist/ssr/index.js +1 -1
- package/dist/{support-zIa1URaN.js → support-ig_K4PvS.js} +1 -1
- package/dist/{support-view-33Oi07TT.d.ts → support-view-CVOJJLpc.d.ts} +1 -1
- package/dist/svelte/index.d.ts +1 -1
- package/dist/sveltekit/index.d.ts +4 -4
- package/dist/sveltekit/index.js +2 -2
- package/dist/tanstack-start/index.d.ts +4 -4
- package/dist/tanstack-start/index.js +2 -2
- package/dist/{tenant-icPeuUBN.d.ts → tenant-BxNFk9bx.d.ts} +1 -1
- package/dist/testing/index.d.ts +5 -5
- package/dist/{types-TaiEeBGA.d.ts → types-6rocye-y.d.ts} +1 -1
- package/dist/{types-BI-0Sl2v.d.ts → types-AYOvcyep.d.ts} +1 -1
- package/dist/{vault-CSO7ss5C.d.ts → vault-wlbBhqm7.d.ts} +1 -1
- package/dist/vercel-connect/index.d.ts +1 -1
- package/dist/{version-CQt77F3T.js → version-C6OfRAIn.js} +1 -1
- package/dist/{view-DbxLNu8L.d.ts → view-CF7ihnkg.d.ts} +1 -1
- package/dist/vue/index.d.ts +2 -2
- package/dist/workflow-sdk/builder/index.d.ts +2 -2
- package/package.json +1 -1
- package/schemas/doctor-report-v1.json +2 -0
- package/skills/better-supabase-auth/SKILL.md +8 -4
- package/dist/cli/gen-4JlOwgWG.js +0 -2
package/dist/orpc/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { b as DbError, f as Result } from "../result-D7y2fT87.js";
|
|
2
2
|
import { a as AnyModels, i as AnyFunctions } from "../types-6BdhkmZe.js";
|
|
3
|
-
import { r as AuthState } from "../resolve-
|
|
3
|
+
import { r as AuthState } from "../resolve-ChTYeTEl.js";
|
|
4
4
|
import { i as ProblemDetails } from "../problem-DD8LZFjc.js";
|
|
5
5
|
import { t as BetterSupabase } from "../define-CJJkkr1-.js";
|
|
6
|
-
import { i as ServerContext, o as ServerOptions, t as BetterServer } from "../server-
|
|
7
|
-
import { i as MiddlewareOptions, r as GuardOptions } from "../respond-
|
|
8
|
-
import { s as BlockRequireOptions } from "../kit-
|
|
6
|
+
import { i as ServerContext, o as ServerOptions, t as BetterServer } from "../server-Bh0EVSwU.js";
|
|
7
|
+
import { i as MiddlewareOptions, r as GuardOptions } from "../respond-DprrgyXX.js";
|
|
8
|
+
import { s as BlockRequireOptions } from "../kit-CkNzZUqv.js";
|
|
9
9
|
import { t as Validated } from "../shared-DDSjEGDR.js";
|
|
10
10
|
import { AnyEntry, Contributions } from "@supabase/middleware";
|
|
11
11
|
import { BuilderWithMiddlewares, DecoratedMiddleware, ORPCError } from "@orpc/server";
|
package/dist/orpc/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { r as dbErrorOf } from "../errors-B11Duf73.js";
|
|
|
2
2
|
import { o as toProblem } from "../problem-BreOl8b8.js";
|
|
3
3
|
import { i as claimsOf } from "../claims-PqzCxaTD.js";
|
|
4
4
|
import { t as tenantOf } from "../tenant-I1TEZ_BX.js";
|
|
5
|
-
import { c as extendServer, n as flushEvents, s as createServer, y as refreshFor } from "../adapter-
|
|
5
|
+
import { c as extendServer, n as flushEvents, s as createServer, y as refreshFor } from "../adapter-iKgjHVPx.js";
|
|
6
6
|
import { n as toSession } from "../view-BeFcRV6G.js";
|
|
7
7
|
import { o as settle, r as guard, t as defaultExpose } from "../respond-BUgsXNgk.js";
|
|
8
8
|
import { t as authorizeCaller } from "../kit-Fm-Fv7q5.js";
|
package/dist/otel/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as definePlugin } from "../plugin-tfXW1-qO.js";
|
|
2
2
|
import { t as SPEC_PINS } from "../spec-pins--j6mTok4.js";
|
|
3
3
|
import { r as blockEventAttributes } from "../block-events-CrT8r7Fe.js";
|
|
4
|
-
import "../version-
|
|
4
|
+
import "../version-C6OfRAIn.js";
|
|
5
5
|
import { SpanKind, SpanStatusCode, context, metrics, propagation, trace } from "@opentelemetry/api";
|
|
6
6
|
//#region src/otel/index.ts
|
|
7
7
|
const INSTRUMENTATION_NAME = "better-supabase";
|
|
@@ -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.7.1");
|
|
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.7.1")).createHistogram("db.client.operation.duration", {
|
|
46
46
|
unit: "s",
|
|
47
47
|
description: "Duration of database client operations.",
|
|
48
48
|
advice: { explicitBucketBoundaries: [
|
|
@@ -181,7 +181,7 @@ function otel(options = {}) {
|
|
|
181
181
|
* Returns a function that stops listening.
|
|
182
182
|
*/
|
|
183
183
|
function traceAuth(betterSupabase, options = {}) {
|
|
184
|
-
const tracer = options.tracer ?? trace.getTracer("better-supabase", "0.
|
|
184
|
+
const tracer = options.tracer ?? trace.getTracer("better-supabase", "0.7.1");
|
|
185
185
|
const offAuth = betterSupabase.events.on("auth", (event) => {
|
|
186
186
|
const span = tracer.startSpan("auth.resolve", {
|
|
187
187
|
kind: SpanKind.INTERNAL,
|
|
@@ -219,7 +219,7 @@ function traceAuth(betterSupabase, options = {}) {
|
|
|
219
219
|
* set an error status. Returns a function that stops listening.
|
|
220
220
|
*/
|
|
221
221
|
function traceBlockEvents(betterSupabase, options = {}) {
|
|
222
|
-
const tracer = options.tracer ?? trace.getTracer("better-supabase", "0.
|
|
222
|
+
const tracer = options.tracer ?? trace.getTracer("better-supabase", "0.7.1");
|
|
223
223
|
return betterSupabase.events.on("block", (event) => {
|
|
224
224
|
const attributes = {
|
|
225
225
|
...options.attributes,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
2
|
import { b as DbError, t as AsyncResult } from "./result-D7y2fT87.js";
|
|
3
|
-
import { r as AuthState } from "./resolve-
|
|
3
|
+
import { r as AuthState } from "./resolve-ChTYeTEl.js";
|
|
4
4
|
//#region src/credentials/provider.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Names a credential without holding it. Tables store this as a
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { t as escapeLike } from "../escape-like-ImTK0ps_.js";
|
|
2
2
|
import { s as Impersonator } from "../mfa-Daak8ukG.js";
|
|
3
|
-
import { t as tenantOf } from "../tenant-
|
|
4
|
-
import { t as AuthSession } from "../view-
|
|
3
|
+
import { t as tenantOf } from "../tenant-BxNFk9bx.js";
|
|
4
|
+
import { t as AuthSession } from "../view-CF7ihnkg.js";
|
|
5
5
|
import { r as LiveCountSeed } from "../index-DunNRdnT.js";
|
|
6
|
-
import { r as MembershipClaim } from "../entitlements-
|
|
7
|
-
import { n as supportOf, t as SupportView } from "../support-view-
|
|
6
|
+
import { r as MembershipClaim } from "../entitlements-BKSVGtrG.js";
|
|
7
|
+
import { n as supportOf, t as SupportView } from "../support-view-CVOJJLpc.js";
|
|
8
8
|
import { a as BroadcastOptions, f as UseActionOptions, l as LiveQueryHookOptions, n as ActionInputOf, o as ClientLike, r as ActionResultOf, s as LiveCountHookOptions, t as fieldErrorsOf } from "../field-errors-BFOa7WhB.js";
|
|
9
|
-
import { A as useLiveCount, C as BetterSupabaseProviderProps, D as createHooks, E as ProfileOf, M as useSupabase, O as useAuth, S as BetterSupabaseProvider, T as LiveCount, _ as ActionHandle, a as UploadTarget, b as useActionForm, c as useUpload, d as useDebouncedSearch, f as Presence, g as ActionForm, h as usePresence, i as UploadStatus, j as useLiveQuery, k as useBroadcast, l as DebouncedSearch, m as PresenceTopic, n as SignedUrlSource, o as UseUploadOptions, p as PresenceHookOptions, r as Upload, s as useSignedUrl, t as SignedUrl, u as DebouncedSearchOptions, v as UseActionFormOptions, w as ClaimsOf, x as BetterHooks, y as useAction } from "../index-
|
|
9
|
+
import { A as useLiveCount, C as BetterSupabaseProviderProps, D as createHooks, E as ProfileOf, M as useSupabase, O as useAuth, S as BetterSupabaseProvider, T as LiveCount, _ as ActionHandle, a as UploadTarget, b as useActionForm, c as useUpload, d as useDebouncedSearch, f as Presence, g as ActionForm, h as usePresence, i as UploadStatus, j as useLiveQuery, k as useBroadcast, l as DebouncedSearch, m as PresenceTopic, n as SignedUrlSource, o as UseUploadOptions, p as PresenceHookOptions, r as Upload, s as useSignedUrl, t as SignedUrl, u as DebouncedSearchOptions, v as UseActionFormOptions, w as ClaimsOf, x as BetterHooks, y as useAction } from "../index-CewnYSpv.js";
|
|
10
10
|
import { SessionProvider, SessionProviderProps, useSession, useSupportSession } from "./session.js";
|
|
11
11
|
import { a as useSignIn, i as SignOut, n as PendingState, o as useSignOut, r as SignIn, t as AuthHookOptions } from "../sign-in-BCV5S2WZ.js";
|
|
12
12
|
export { type ActionForm, type ActionHandle, type ActionInputOf, type ActionResultOf, type AuthHookOptions, type AuthSession, type BetterHooks, BetterSupabaseProvider, type BetterSupabaseProviderProps, type BroadcastOptions, type ClaimsOf, type ClientLike, type DebouncedSearch, type DebouncedSearchOptions, type Impersonator, type LiveCount, type LiveCountHookOptions, type LiveCountSeed, type LiveQueryHookOptions, type MembershipClaim, type PendingState, type Presence, type PresenceHookOptions, type PresenceTopic, type ProfileOf, SessionProvider, type SessionProviderProps, type SignIn, type SignOut, type SignedUrl, type SignedUrlSource, type SupportView, type Upload, type UploadStatus, type UploadTarget, type UseActionFormOptions, type UseActionOptions, type UseUploadOptions, createHooks, escapeLike, fieldErrorsOf, supportOf, tenantOf, useAction, useActionForm, useAuth, useBroadcast, useDebouncedSearch, useLiveCount, useLiveQuery, usePresence, useSession, useSignIn, useSignOut, useSignedUrl, useSupabase, useSupportSession, useUpload };
|
package/dist/react/server.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { t as escapeLike } from "../escape-like-ImTK0ps_.js";
|
|
2
2
|
import { it as QuerySpec } from "../define-CJJkkr1-.js";
|
|
3
3
|
import { s as Impersonator } from "../mfa-Daak8ukG.js";
|
|
4
|
-
import { t as tenantOf } from "../tenant-
|
|
5
|
-
import { t as AuthSession } from "../view-
|
|
4
|
+
import { t as tenantOf } from "../tenant-BxNFk9bx.js";
|
|
5
|
+
import { t as AuthSession } from "../view-CF7ihnkg.js";
|
|
6
6
|
import { r as LiveCountSeed } from "../index-DunNRdnT.js";
|
|
7
|
-
import { r as MembershipClaim } from "../entitlements-
|
|
8
|
-
import { n as supportOf, t as SupportView } from "../support-view-
|
|
7
|
+
import { r as MembershipClaim } from "../entitlements-BKSVGtrG.js";
|
|
8
|
+
import { n as supportOf, t as SupportView } from "../support-view-CVOJJLpc.js";
|
|
9
9
|
import { a as BroadcastOptions, f as UseActionOptions, l as LiveQueryHookOptions, n as ActionInputOf, o as ClientLike, r as ActionResultOf, s as LiveCountHookOptions, t as fieldErrorsOf } from "../field-errors-BFOa7WhB.js";
|
|
10
|
-
import { C as BetterSupabaseProviderProps, E as ProfileOf, M as useSupabase, O as useAuth, S as BetterSupabaseProvider, T as LiveCount, _ as ActionHandle, a as UploadTarget, c as useUpload$1, d as useDebouncedSearch$1, f as Presence, g as ActionForm, h as usePresence$1, i as UploadStatus, j as useLiveQuery, k as useBroadcast, l as DebouncedSearch, m as PresenceTopic, n as SignedUrlSource, o as UseUploadOptions, p as PresenceHookOptions, r as Upload, s as useSignedUrl$1, t as SignedUrl, u as DebouncedSearchOptions, v as UseActionFormOptions, w as ClaimsOf, x as BetterHooks } from "../index-
|
|
10
|
+
import { C as BetterSupabaseProviderProps, E as ProfileOf, M as useSupabase, O as useAuth, S as BetterSupabaseProvider, T as LiveCount, _ as ActionHandle, a as UploadTarget, c as useUpload$1, d as useDebouncedSearch$1, f as Presence, g as ActionForm, h as usePresence$1, i as UploadStatus, j as useLiveQuery, k as useBroadcast, l as DebouncedSearch, m as PresenceTopic, n as SignedUrlSource, o as UseUploadOptions, p as PresenceHookOptions, r as Upload, s as useSignedUrl$1, t as SignedUrl, u as DebouncedSearchOptions, v as UseActionFormOptions, w as ClaimsOf, x as BetterHooks } from "../index-CewnYSpv.js";
|
|
11
11
|
import { SessionProvider, SessionProviderProps } from "./session.js";
|
|
12
12
|
import { a as useSignIn$1, i as SignOut, n as PendingState, o as useSignOut$1, r as SignIn, t as AuthHookOptions } from "../sign-in-BCV5S2WZ.js";
|
|
13
13
|
//#region src/react/server.d.ts
|
package/dist/react/session.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as AuthSession } from "../view-
|
|
2
|
-
import { t as SupportView } from "../support-view-
|
|
1
|
+
import { t as AuthSession } from "../view-CF7ihnkg.js";
|
|
2
|
+
import { t as SupportView } from "../support-view-CVOJJLpc.js";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
4
|
//#region src/react/session.d.ts
|
|
5
5
|
export interface SessionProviderProps {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { a as AnyModels, i as AnyFunctions } from "../types-6BdhkmZe.js";
|
|
2
2
|
import { t as BetterSupabase } from "../define-CJJkkr1-.js";
|
|
3
|
-
import { t as BetterServer } from "../server-
|
|
4
|
-
import { a as AuthorizedContext, c as Unwrapped, i as AuthorizeOptions, n as ActionParsed, o as BlockActionOptions, r as ActionResult, s as BlockRequireOptions } from "../kit-
|
|
5
|
-
import { t as RefusalRedirects } from "../refusal-
|
|
6
|
-
import { n as FrameworkOptions, t as FrameworkLocals } from "../framework-
|
|
3
|
+
import { t as BetterServer } from "../server-Bh0EVSwU.js";
|
|
4
|
+
import { a as AuthorizedContext, c as Unwrapped, i as AuthorizeOptions, n as ActionParsed, o as BlockActionOptions, r as ActionResult, s as BlockRequireOptions } from "../kit-CkNzZUqv.js";
|
|
5
|
+
import { t as RefusalRedirects } from "../refusal-DhSU2Vvr.js";
|
|
6
|
+
import { n as FrameworkOptions, t as FrameworkLocals } from "../framework-BmzgK32X.js";
|
|
7
7
|
import { t as Validated } from "../shared-DDSjEGDR.js";
|
|
8
8
|
import { AnyEntry, Contributions } from "@supabase/middleware";
|
|
9
9
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { a as problemResponse } from "../problem-BreOl8b8.js";
|
|
2
|
-
import { c as extendServer, n as flushEvents, s as createServer } from "../adapter-
|
|
2
|
+
import { c as extendServer, n as flushEvents, s as createServer } from "../adapter-iKgjHVPx.js";
|
|
3
3
|
import { o as settle, t as defaultExpose } from "../respond-BUgsXNgk.js";
|
|
4
4
|
import { i as requireCaller, o as runAction } from "../kit-Fm-Fv7q5.js";
|
|
5
5
|
import { n as bufferInPlace, t as around } from "../shared-CBxosKK3.js";
|
|
6
|
-
import { i as localsOf, n as actionInput, r as frameworkEntry } from "../framework-
|
|
6
|
+
import { i as localsOf, n as actionInput, r as frameworkEntry } from "../framework-a7aRCIqv.js";
|
|
7
7
|
import { r as refusalResponse } from "../refusal-CeJWxmkH.js";
|
|
8
8
|
//#region src/bridges/react-router.ts
|
|
9
9
|
/**
|
|
@@ -147,7 +147,10 @@ interface AuthResolution<C = unknown, P = unknown> {
|
|
|
147
147
|
readonly requestCookies: readonly CookieRecord[];
|
|
148
148
|
/** Adds `cookies` and `headers` to a response. */
|
|
149
149
|
apply(response: Response): Response;
|
|
150
|
+
/** The session was ended server-side (revoked, deleted or banned); the cookies are cleared. */
|
|
150
151
|
readonly sessionEnded?: boolean;
|
|
152
|
+
/** Why `sessionEnded` is set: `banned` when Auth rejected the user as banned. */
|
|
153
|
+
readonly sessionEndedReason?: "ended" | "banned";
|
|
151
154
|
}
|
|
152
155
|
/** The first `x-forwarded-for` hop, the client as your edge saw it. */
|
|
153
156
|
declare function clientIp(request: Request): string | undefined;
|
|
@@ -164,8 +164,8 @@ async function sessionStatus(input, options) {
|
|
|
164
164
|
},
|
|
165
165
|
signal: AbortSignal.timeout(options.timeoutMs ?? DEFAULT_TIMEOUT_MS$1)
|
|
166
166
|
});
|
|
167
|
+
if (response.status === 401 || response.status === 403) return (await response.json().catch(() => null))?.["error_code"] === "user_banned" ? "banned" : "ended";
|
|
167
168
|
await response.body?.cancel();
|
|
168
|
-
if (response.status === 401 || response.status === 403) return "ended";
|
|
169
169
|
return response.ok ? "active" : "unknown";
|
|
170
170
|
} catch {
|
|
171
171
|
return "unknown";
|
|
@@ -237,6 +237,7 @@ async function request(refreshToken, options, now) {
|
|
|
237
237
|
ok: false,
|
|
238
238
|
reason: response.status >= 500 || response.status === 429 ? "network" : "rejected",
|
|
239
239
|
status: response.status,
|
|
240
|
+
...typeof body?.["error_code"] === "string" ? { code: body["error_code"] } : {},
|
|
240
241
|
message
|
|
241
242
|
};
|
|
242
243
|
}
|
|
@@ -502,12 +503,15 @@ async function verifyOnce(credentials, modes, options, source) {
|
|
|
502
503
|
reason: "none"
|
|
503
504
|
};
|
|
504
505
|
}
|
|
505
|
-
function resolution(auth, cookies, writes = [], ended
|
|
506
|
+
function resolution(auth, cookies, writes = [], ended) {
|
|
506
507
|
const headers = writes.length > 0 ? AUTH_CACHE_HEADERS : {};
|
|
507
508
|
let requestCookies;
|
|
508
509
|
return {
|
|
509
510
|
auth,
|
|
510
|
-
...ended ? {
|
|
511
|
+
...ended ? {
|
|
512
|
+
sessionEnded: true,
|
|
513
|
+
sessionEndedReason: ended
|
|
514
|
+
} : {},
|
|
511
515
|
cookies: writes,
|
|
512
516
|
headers,
|
|
513
517
|
/** Parsed on first read: bearer requests rarely need their cookies. */
|
|
@@ -588,16 +592,17 @@ async function resolveAuth(request, options) {
|
|
|
588
592
|
token: session.access_token,
|
|
589
593
|
apikey: null
|
|
590
594
|
}, ["user"], options, "cookie");
|
|
591
|
-
|
|
595
|
+
const status = state.kind === "user" && options.checkSession ? await sessionStatus(state.token, {
|
|
592
596
|
url: options.env.url,
|
|
593
597
|
publishableKey: options.env.publishableKey,
|
|
594
598
|
...options.fetch ? { fetch: options.fetch } : {},
|
|
595
599
|
...options.refreshTimeoutMs === void 0 ? {} : { timeoutMs: options.refreshTimeoutMs },
|
|
596
600
|
...options.now ? { now: options.now } : {}
|
|
597
|
-
})
|
|
601
|
+
}) : void 0;
|
|
602
|
+
if (status === "ended" || status === "banned") return resolution({
|
|
598
603
|
kind: "anon",
|
|
599
604
|
reason: "signed_out"
|
|
600
|
-
}, cookies, options.refresh ? writeSession(cookies(), name, null, options.cookie?.options, encoding) : [],
|
|
605
|
+
}, cookies, options.refresh ? writeSession(cookies(), name, null, options.cookie?.options, encoding) : [], status);
|
|
601
606
|
if (state.kind !== "invalid" || state.reason !== "token" || state.error.kind === "network") return resolution(state, cookies);
|
|
602
607
|
if (!options.refresh) return resolution({
|
|
603
608
|
kind: "anon",
|
|
@@ -643,7 +648,7 @@ async function resolveAuth(request, options) {
|
|
|
643
648
|
return resolution({
|
|
644
649
|
kind: "anon",
|
|
645
650
|
reason: "signed_out"
|
|
646
|
-
}, cookies, writeSession(cookies(), name, null, options.cookie?.options, encoding));
|
|
651
|
+
}, cookies, writeSession(cookies(), name, null, options.cookie?.options, encoding), outcome.code === "user_banned" ? "banned" : void 0);
|
|
647
652
|
}
|
|
648
653
|
const writes = writeSession(cookies(), name, outcome.session, options.cookie?.options, encoding);
|
|
649
654
|
return resolution(await verify({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { E as ValidationIssue, f as Result } from "./result-D7y2fT87.js";
|
|
2
2
|
import { H as Update, L as TableKey, R as TableMeta, a as AnyModels, i as AnyFunctions, x as Insert } from "./types-6BdhkmZe.js";
|
|
3
3
|
import { It as SelectArg, t as BetterSupabase } from "./define-CJJkkr1-.js";
|
|
4
|
-
import { a as RespondOptions } from "./respond-
|
|
4
|
+
import { a as RespondOptions } from "./respond-DprrgyXX.js";
|
|
5
5
|
import { i as ResourceOperation } from "./index-Bxih3l0u.js";
|
|
6
6
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
7
7
|
//#region src/server/resource.d.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { b as DbError } from "./result-D7y2fT87.js";
|
|
2
|
-
import { r as AuthState } from "./resolve-
|
|
2
|
+
import { r as AuthState } from "./resolve-ChTYeTEl.js";
|
|
3
3
|
import { t as Aal } from "./mfa-Daak8ukG.js";
|
|
4
4
|
//#region src/server/refresh.d.ts
|
|
5
5
|
/** A router or browser prefetch, by its request headers. */
|
package/dist/server/index.d.ts
CHANGED
|
@@ -2,24 +2,61 @@ import { b as DbError } from "../result-D7y2fT87.js";
|
|
|
2
2
|
import { a as AnyModels, i as AnyFunctions } from "../types-6BdhkmZe.js";
|
|
3
3
|
import { m as RequestContext } from "../plugin-FGY8UhYm.js";
|
|
4
4
|
import { _ as writeSession, a as CookieWrite, c as StoredSession, h as sessionCookieName, n as CookieOptions, p as readSession, r as CookieRecord, t as AUTH_CACHE_HEADERS } from "../session-ChiXDZdZ.js";
|
|
5
|
-
import { a as ResolveAuthOptions, c as clientIp, i as InvalidReason, l as resolveAuth, n as AuthResolver, o as ResolvedState, r as AuthState, s as authContext, t as AuthResolution } from "../resolve-
|
|
5
|
+
import { a as ResolveAuthOptions, c as clientIp, i as InvalidReason, l as resolveAuth, n as AuthResolver, o as ResolvedState, r as AuthState, s as authContext, t as AuthResolution } from "../resolve-ChTYeTEl.js";
|
|
6
6
|
import { c as fromProblem, d as toProblem, i as ProblemDetails, l as isProblem, n as PROBLEM_CONTENT_TYPE, o as ProblemOptions, r as PROBLEM_TYPE_BASE, s as ProblemResponseOptions, u as problemResponse } from "../problem-DD8LZFjc.js";
|
|
7
7
|
import { B as DbStats, b as Db, t as BetterSupabase } from "../define-CJJkkr1-.js";
|
|
8
|
-
import { A as
|
|
8
|
+
import { A as supportSessions, B as SupportSession, C as ActiveSupport, D as SupportPolicy, E as SupportOptions, F as supportCookieValue, H as SupportStartInput, I as SqlSupportStoreOptions, L as SupportCallerClaims, M as SupportCookieOptions, N as clearSupportCookie, O as SupportSessions, P as supportCookie, R as SupportEndedBy, S as deleteAccount, T as SupportAuthorizeInput, U as sqlSupportStore, V as SupportSessionStore, W as supportClaims, _ as RequestIdOptions, a as ServerDbOptions, b as DeleteAccountOptions, c as createServer, d as LastSignIn, f as SuspendAccountOptions, g as suspendAccount, h as lastSignIns, i as ServerContext, j as SUPPORT_COOKIE, k as SupportStartRequest, l as extendServer, m as endSessions, n as ContextOptions, o as ServerOptions, p as SuspendAccountResult, r as ForContextOptions, s as TENANT_HEADER, t as BetterServer, u as EndSessionsResult, v as PRIMARY_COOKIE, w as SupportApi, x as DeleteAccountResult, y as ReplicaState, z as SupportListFilter } from "../server-Bh0EVSwU.js";
|
|
9
9
|
import { a as checkAal, c as impersonatorOf, i as amrOf, n as AmrEntry, o as ImpersonationOptions, r as aalOf, s as Impersonator, t as Aal } from "../mfa-Daak8ukG.js";
|
|
10
10
|
import { n as SessionActor, r as SessionDelegation, t as ActClaim } from "../actor-CQTlc1Hh.js";
|
|
11
|
-
import { n as toSession, t as AuthSession } from "../view-
|
|
12
|
-
import { a as SessionEntryConfig, c as withGuard, i as withBetterSupabase, l as ServerCore, n as BetterSupabaseContributions, o as withSession, r as BetterSupabaseEntry, s as GuardEntryConfig, t as BetterSupabaseConfig, u as serverCore } from "../composite
|
|
13
|
-
import { a as RespondOptions, c as isResult, d as RefreshPolicy, f as isPrefetch, h as shouldRefresh, i as MiddlewareOptions, l as respond, m as shouldCheckSession, n as AuthKind, o as Settled, p as refreshFor, r as GuardOptions, s as guard, u as settle } from "../respond-
|
|
14
|
-
import { a as AuthorizedContext, i as AuthorizeOptions, l as hasRole, o as BlockActionOptions, r as ActionResult, s as BlockRequireOptions, u as rolesAt } from "../kit-
|
|
15
|
-
import { a as ResourceRouteOptions, i as ResourcePagination, n as ResourceInput, o as defineResource, r as ResourceList, t as ResourceHandler } from "../resource-
|
|
11
|
+
import { n as toSession, t as AuthSession } from "../view-CF7ihnkg.js";
|
|
12
|
+
import { a as SessionEntryConfig, c as withGuard, i as withBetterSupabase, l as ServerCore, n as BetterSupabaseContributions, o as withSession, r as BetterSupabaseEntry, s as GuardEntryConfig, t as BetterSupabaseConfig, u as serverCore } from "../composite--yqry7uW.js";
|
|
13
|
+
import { a as RespondOptions, c as isResult, d as RefreshPolicy, f as isPrefetch, h as shouldRefresh, i as MiddlewareOptions, l as respond, m as shouldCheckSession, n as AuthKind, o as Settled, p as refreshFor, r as GuardOptions, s as guard, u as settle } from "../respond-DprrgyXX.js";
|
|
14
|
+
import { a as AuthorizedContext, i as AuthorizeOptions, l as hasRole, o as BlockActionOptions, r as ActionResult, s as BlockRequireOptions, u as rolesAt } from "../kit-CkNzZUqv.js";
|
|
15
|
+
import { a as ResourceRouteOptions, i as ResourcePagination, n as ResourceInput, o as defineResource, r as ResourceList, t as ResourceHandler } from "../resource-IPS5xi9q.js";
|
|
16
16
|
import { i as tagFor, n as cacheTagsOf, r as tagCache, t as TagOptions } from "../tags-Cx-LnIQP.js";
|
|
17
|
-
import { n as supportOf, t as SupportView } from "../support-view-
|
|
18
|
-
import { a as sessionStatus, c as refreshSession, i as clearSessionCookies, n as SessionStatus, r as SessionStatusOptions, s as RefreshOutcome, t as ClearSessionCookiesOptions } from "../ended-
|
|
17
|
+
import { n as supportOf, t as SupportView } from "../support-view-CVOJJLpc.js";
|
|
18
|
+
import { a as sessionStatus, c as refreshSession, i as clearSessionCookies, n as SessionStatus, r as SessionStatusOptions, s as RefreshOutcome, t as ClearSessionCookiesOptions } from "../ended-XjeGQ5XW.js";
|
|
19
19
|
import { SupabaseClient } from "@supabase/supabase-js";
|
|
20
20
|
import { Middleware, SingleKeyEntry } from "@supabase/middleware";
|
|
21
21
|
import { AuthMode, JWTClaims, UserClaims } from "@supabase/server";
|
|
22
22
|
import { PostgresApi } from "@supabase/server/middleware/postgres";
|
|
23
|
+
//#region src/blocks/csv.d.ts
|
|
24
|
+
interface CsvOptions {
|
|
25
|
+
/**
|
|
26
|
+
* The columns in order. Defaults to every key of the rows, in the order
|
|
27
|
+
* they first appear.
|
|
28
|
+
*/
|
|
29
|
+
readonly columns?: readonly string[];
|
|
30
|
+
/**
|
|
31
|
+
* Prefixes a text cell that starts with `=`, `+`, `-`, `@`, a tab or a
|
|
32
|
+
* carriage return with `'`, so a spreadsheet shows it instead of running
|
|
33
|
+
* it as a formula (CSV injection). Default true.
|
|
34
|
+
*/
|
|
35
|
+
readonly escapeFormulas?: boolean;
|
|
36
|
+
}
|
|
37
|
+
/** The columns of `rows`: every key, in the order it first appears. */
|
|
38
|
+
export declare function csvColumns(rows: readonly Readonly<Record<string, unknown>>[]): string[];
|
|
39
|
+
/**
|
|
40
|
+
* RFC 4180 CSV with a header row and CRLF line ends. Objects and arrays are
|
|
41
|
+
* written as JSON, null and undefined as empty cells.
|
|
42
|
+
*/
|
|
43
|
+
export declare function toCsv(rows: readonly Readonly<Record<string, unknown>>[], options?: CsvOptions): string;
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/server/csv.d.ts
|
|
46
|
+
interface CsvResponseOptions extends CsvOptions {
|
|
47
|
+
/** The download name, such as `invoices.csv`. */
|
|
48
|
+
readonly filename: string;
|
|
49
|
+
/** Extra headers, such as `cache-control`. `content-type` and `content-disposition` win. */
|
|
50
|
+
readonly headers?: ConstructorParameters<typeof Headers>[0];
|
|
51
|
+
readonly status?: number;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* `rows` as a CSV download: `text/csv; charset=utf-8` with an `attachment`
|
|
55
|
+
* `Content-Disposition`. Text cells that start with a formula character are
|
|
56
|
+
* escaped unless `escapeFormulas` is false.
|
|
57
|
+
*/
|
|
58
|
+
export declare function csvResponse(rows: readonly Readonly<Record<string, unknown>>[], options: CsvResponseOptions): Response;
|
|
59
|
+
//#endregion
|
|
23
60
|
//#region src/server/audit.d.ts
|
|
24
61
|
/** The CloudEvents `source` of the events the server sends to its `audit` sink. */
|
|
25
62
|
export declare const SERVER_EVENT_SOURCE = "/better-supabase/server";
|
|
@@ -188,4 +225,4 @@ export declare function withDbStats(options?: {
|
|
|
188
225
|
};
|
|
189
226
|
}, () => DbStats>;
|
|
190
227
|
//#endregion
|
|
191
|
-
export { AUTH_CACHE_HEADERS, type Aal, type AccountEventType, type ActClaim, type ActionResult, type ActiveSupport, type AmrEntry, type AuthKind, type AuthResolution, type AuthResolver, type AuthSession, type AuthState, type AuthorizeOptions, type AuthorizedContext, type BetterServer, type BetterSupabaseConfig, type BetterSupabaseContributions, type BetterSupabaseEntry, type BlockActionOptions, type BlockRequireOptions, type ClearSessionCookiesOptions, type ContextOptions, type CookieOptions, type CookieRecord, type CookieWrite, type DeleteAccountOptions, type DeleteAccountResult, type EndSessionsResult, type ForContextOptions, type GuardEntryConfig, type GuardOptions, type HandleOptions, type ImpersonationOptions, type Impersonator, type InvalidReason, type MiddlewareOptions, PRIMARY_COOKIE, PROBLEM_CONTENT_TYPE, PROBLEM_TYPE_BASE, type ProblemDetails, type ProblemOptions, type ProblemResponseOptions, type RefreshOutcome, type RefreshPolicy, type ReplicaState, type RequestIdOptions, type ResolveAuthOptions, type ResolvedState, type ResourceHandler, type ResourceInput, type ResourceList, type ResourcePagination, type ResourceRouteOptions, type RespondOptions, SUPPORT_COOKIE, type ServerContext, type ServerCore, type ServerDbOptions, type ServerOptions, type ServerTiming, type SessionActor, type SessionDelegation, type SessionEntryConfig, type SessionLookup, type SessionStatus, type SessionStatusOptions, type Settled, type SqlSupportStoreOptions, type StoredSession, type SupabaseAuthContext, type SupportApi, type SupportAuthorizeInput, type SupportCallerClaims, type SupportCookieOptions, type SupportEndedBy, type SupportListFilter, type SupportOptions, type SupportPolicy, type SupportSession, type SupportSessionStore, type SupportSessions, type SupportStartInput, type SupportStartRequest, type SupportView, type SuspendAccountOptions, type SuspendAccountResult, TENANT_HEADER, type TagOptions, aalOf, amrOf, authContext, cacheTagsOf, checkAal, clearSessionCookies, clearSupportCookie, clientIp, createServer, defineResource, deleteAccount, endSessions, extendServer, fromProblem, guard, hasRole, impersonatorOf, isPrefetch, isProblem, isResult, problemResponse, readSession, refreshFor, refreshSession, resolveAuth, respond, rolesAt, serverCore, sessionCookieName, sessionStatus, settle, shouldCheckSession, shouldRefresh, sqlSupportStore, supportClaims, supportCookie, supportCookieValue, supportOf, supportSessions, suspendAccount, tagCache, tagFor, toProblem, toSession, withBetterSupabase, withGuard, withSession, writeSession };
|
|
228
|
+
export { AUTH_CACHE_HEADERS, type Aal, type AccountEventType, type ActClaim, type ActionResult, type ActiveSupport, type AmrEntry, type AuthKind, type AuthResolution, type AuthResolver, type AuthSession, type AuthState, type AuthorizeOptions, type AuthorizedContext, type BetterServer, type BetterSupabaseConfig, type BetterSupabaseContributions, type BetterSupabaseEntry, type BlockActionOptions, type BlockRequireOptions, type ClearSessionCookiesOptions, type ContextOptions, type CookieOptions, type CookieRecord, type CookieWrite, type CsvOptions, type CsvResponseOptions, type DeleteAccountOptions, type DeleteAccountResult, type EndSessionsResult, type ForContextOptions, type GuardEntryConfig, type GuardOptions, type HandleOptions, type ImpersonationOptions, type Impersonator, type InvalidReason, type LastSignIn, type MiddlewareOptions, PRIMARY_COOKIE, PROBLEM_CONTENT_TYPE, PROBLEM_TYPE_BASE, type ProblemDetails, type ProblemOptions, type ProblemResponseOptions, type RefreshOutcome, type RefreshPolicy, type ReplicaState, type RequestIdOptions, type ResolveAuthOptions, type ResolvedState, type ResourceHandler, type ResourceInput, type ResourceList, type ResourcePagination, type ResourceRouteOptions, type RespondOptions, SUPPORT_COOKIE, type ServerContext, type ServerCore, type ServerDbOptions, type ServerOptions, type ServerTiming, type SessionActor, type SessionDelegation, type SessionEntryConfig, type SessionLookup, type SessionStatus, type SessionStatusOptions, type Settled, type SqlSupportStoreOptions, type StoredSession, type SupabaseAuthContext, type SupportApi, type SupportAuthorizeInput, type SupportCallerClaims, type SupportCookieOptions, type SupportEndedBy, type SupportListFilter, type SupportOptions, type SupportPolicy, type SupportSession, type SupportSessionStore, type SupportSessions, type SupportStartInput, type SupportStartRequest, type SupportView, type SuspendAccountOptions, type SuspendAccountResult, TENANT_HEADER, type TagOptions, aalOf, amrOf, authContext, cacheTagsOf, checkAal, clearSessionCookies, clearSupportCookie, clientIp, createServer, defineResource, deleteAccount, endSessions, extendServer, fromProblem, guard, hasRole, impersonatorOf, isPrefetch, isProblem, isResult, lastSignIns, problemResponse, readSession, refreshFor, refreshSession, resolveAuth, respond, rolesAt, serverCore, sessionCookieName, sessionStatus, settle, shouldCheckSession, shouldRefresh, sqlSupportStore, supportClaims, supportCookie, supportCookieValue, supportOf, supportSessions, suspendAccount, tagCache, tagFor, toProblem, toSession, withBetterSupabase, withGuard, withSession, writeSession };
|
package/dist/server/index.js
CHANGED
|
@@ -2,20 +2,42 @@ import { n as dbError } from "../errors-B11Duf73.js";
|
|
|
2
2
|
import { a as problemResponse, i as isProblem, n as PROBLEM_TYPE_BASE, o as toProblem, r as fromProblem, t as PROBLEM_CONTENT_TYPE } from "../problem-BreOl8b8.js";
|
|
3
3
|
import { i as userContext, r as impersonatorOf } from "../impersonation-DcqaTBHx.js";
|
|
4
4
|
import { t as supportOf } from "../support-view-g4YLBeqX.js";
|
|
5
|
+
import { n as toCsv, t as csvColumns } from "../csv-DCK-PT1n.js";
|
|
5
6
|
import { n as postgresExecutor } from "../executor-De1Of3m3.js";
|
|
6
|
-
import { C as serverCore, D as
|
|
7
|
+
import { C as serverCore, D as suspendAccount, E as lastSignIns, O as deleteAccount, T as endSessions, _ as withSession, a as unexpectedResponse, b as shouldCheckSession, c as extendServer, d as clearSupportCookie, f as supportCookie, i as resolveToken, m as supportCookieValue, n as flushEvents, o as TENANT_HEADER, r as handle, s as createServer, u as SUPPORT_COOKIE, v as isPrefetch, w as SERVER_EVENT_SOURCE, x as shouldRefresh, y as refreshFor } from "../adapter-iKgjHVPx.js";
|
|
7
8
|
import { n as PRIMARY_COOKIE } from "../replicas-CwrYp5Zj.js";
|
|
8
|
-
import { _ as writeSession, a as refreshSession, c as AUTH_CACHE_HEADERS, h as sessionCookieName, i as resolveAuth, n as clientIp, o as clearSessionCookies, p as readSession, s as sessionStatus, t as authContext } from "../resolve-
|
|
9
|
+
import { _ as writeSession, a as refreshSession, c as AUTH_CACHE_HEADERS, h as sessionCookieName, i as resolveAuth, n as clientIp, o as clearSessionCookies, p as readSession, s as sessionStatus, t as authContext } from "../resolve-tJZY3FEa.js";
|
|
9
10
|
import { a as checkAal, i as amrOf, n as toSession, r as aalOf } from "../view-BeFcRV6G.js";
|
|
10
11
|
import { a as respond, i as isResult, o as settle, r as guard } from "../respond-BUgsXNgk.js";
|
|
11
|
-
import { n as sqlSupportStore, r as supportClaims, t as supportSessions } from "../support-
|
|
12
|
+
import { n as sqlSupportStore, r as supportClaims, t as supportSessions } from "../support-ig_K4PvS.js";
|
|
12
13
|
import { n as jwtClaimsOf, r as userClaimsOf, t as authModeOf } from "../claims-DDBQT6BK.js";
|
|
13
|
-
import { n as withGuard, t as withBetterSupabase } from "../composite-
|
|
14
|
+
import { n as withGuard, t as withBetterSupabase } from "../composite-DXVUibdi.js";
|
|
14
15
|
import { t as defineResource } from "../resource-BsvzCMlX.js";
|
|
15
16
|
import { i as withServerTiming, n as parseDbStats, r as withDbStats, t as DB_CALLS_HEADER } from "../timing-CyTQPubY.js";
|
|
16
17
|
import { n as tagCache, r as tagFor, t as cacheTagsOf } from "../tags-B99_U9Pp.js";
|
|
17
18
|
import { a as rolesAt, r as hasRole } from "../kit-Fm-Fv7q5.js";
|
|
18
19
|
import { defineMiddleware } from "@supabase/middleware";
|
|
20
|
+
//#region src/server/csv.ts
|
|
21
|
+
function disposition(filename) {
|
|
22
|
+
const safe = filename.replaceAll(/[\r\n]/g, " ");
|
|
23
|
+
return `attachment; filename="${safe.replaceAll(/[^\u0020-\u007E]|["\\]/g, "_")}"; filename*=UTF-8''${encodeURIComponent(safe).replaceAll(/['()*]/g, (char) => `%${char.codePointAt(0).toString(16).toUpperCase()}`)}`;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* `rows` as a CSV download: `text/csv; charset=utf-8` with an `attachment`
|
|
27
|
+
* `Content-Disposition`. Text cells that start with a formula character are
|
|
28
|
+
* escaped unless `escapeFormulas` is false.
|
|
29
|
+
*/
|
|
30
|
+
function csvResponse(rows, options) {
|
|
31
|
+
const { filename, headers, status, ...csv } = options;
|
|
32
|
+
const response = new Response(toCsv(rows, csv), {
|
|
33
|
+
status: status ?? 200,
|
|
34
|
+
...headers ? { headers } : {}
|
|
35
|
+
});
|
|
36
|
+
response.headers.set("content-type", "text/csv; charset=utf-8");
|
|
37
|
+
response.headers.set("content-disposition", disposition(filename));
|
|
38
|
+
return response;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
19
41
|
//#region src/server/entries/upstream.ts
|
|
20
42
|
/** Repository context from a `@supabase/server` context. */
|
|
21
43
|
function contextFromSupabase(ctx) {
|
|
@@ -120,4 +142,4 @@ async function checkSession(sql, auth) {
|
|
|
120
142
|
return row?.active === true ? void 0 : revoked;
|
|
121
143
|
}
|
|
122
144
|
//#endregion
|
|
123
|
-
export { AUTH_CACHE_HEADERS, DB_CALLS_HEADER, PRIMARY_COOKIE, PROBLEM_CONTENT_TYPE, PROBLEM_TYPE_BASE, SERVER_EVENT_SOURCE, SUPPORT_COOKIE, TENANT_HEADER, aalOf, amrOf, authContext, authModeOf, cacheTagsOf, checkAal, checkSession, clearSessionCookies, clearSupportCookie, clientIp, contextFromSupabase, createServer, defineResource, deleteAccount, endSessions, extendServer, flushEvents, fromProblem, guard, handle, hasRole, impersonatorOf, isPrefetch, isProblem, isResult, jwtClaimsOf, parseDbStats, problemResponse, readSession, refreshFor, refreshSession, resolveAuth, resolveToken, respond, rolesAt, serverCore, sessionCookieName, sessionStatus, settle, shouldCheckSession, shouldRefresh, sqlSupportStore, supportClaims, supportCookie, supportCookieValue, supportOf, supportSessions, suspendAccount, tagCache, tagFor, toProblem, toSession, unexpectedResponse, userClaimsOf, withBetterDb, withBetterPostgres, withBetterSupabase, withBlock, withDbStats, withGuard, withServerTiming, withSession, writeSession };
|
|
145
|
+
export { AUTH_CACHE_HEADERS, DB_CALLS_HEADER, PRIMARY_COOKIE, PROBLEM_CONTENT_TYPE, PROBLEM_TYPE_BASE, SERVER_EVENT_SOURCE, SUPPORT_COOKIE, TENANT_HEADER, aalOf, amrOf, authContext, authModeOf, cacheTagsOf, checkAal, checkSession, clearSessionCookies, clearSupportCookie, clientIp, contextFromSupabase, createServer, csvColumns, csvResponse, defineResource, deleteAccount, endSessions, extendServer, flushEvents, fromProblem, guard, handle, hasRole, impersonatorOf, isPrefetch, isProblem, isResult, jwtClaimsOf, lastSignIns, parseDbStats, problemResponse, readSession, refreshFor, refreshSession, resolveAuth, resolveToken, respond, rolesAt, serverCore, sessionCookieName, sessionStatus, settle, shouldCheckSession, shouldRefresh, sqlSupportStore, supportClaims, supportCookie, supportCookieValue, supportOf, supportSessions, suspendAccount, tagCache, tagFor, toCsv, toProblem, toSession, unexpectedResponse, userClaimsOf, withBetterDb, withBetterPostgres, withBetterSupabase, withBlock, withDbStats, withGuard, withServerTiming, withSession, writeSession };
|
|
@@ -6,8 +6,8 @@ import { m as RequestContext } from "./plugin-FGY8UhYm.js";
|
|
|
6
6
|
import { a as EventHub } from "./events-DWDhx77e.js";
|
|
7
7
|
import { t as BetterSupabaseEnv } from "./index-CLg87OBW.js";
|
|
8
8
|
import { a as CookieWrite } from "./session-ChiXDZdZ.js";
|
|
9
|
-
import { a as ResolveAuthOptions, r as AuthState, t as AuthResolution } from "./resolve-
|
|
10
|
-
import { r as CredentialProvider } from "./provider-
|
|
9
|
+
import { a as ResolveAuthOptions, r as AuthState, t as AuthResolution } from "./resolve-ChTYeTEl.js";
|
|
10
|
+
import { r as CredentialProvider } from "./provider-D-UEMvSD.js";
|
|
11
11
|
import { B as DbStats, H as StatsRecorder, b as Db, t as BetterSupabase } from "./define-CJJkkr1-.js";
|
|
12
12
|
import { r as EventSink } from "./cloud-event-C1JCc1bH.js";
|
|
13
13
|
import { s as SqlClaims, t as BetterPostgres } from "./pool-CAu2nLrL.js";
|
|
@@ -293,14 +293,38 @@ interface EndSessionsResult {
|
|
|
293
293
|
}
|
|
294
294
|
interface SuspendAccountOptions {
|
|
295
295
|
readonly suspended: boolean;
|
|
296
|
+
/** A Go duration for the ban, such as `"24h"`. Defaults to 100 years. */
|
|
296
297
|
readonly duration?: string;
|
|
298
|
+
/**
|
|
299
|
+
* Also end the sessions when suspending. Defaults to `false`: the sessions
|
|
300
|
+
* stay, so Auth answers refresh and `/user` with `user_banned` and the app
|
|
301
|
+
* can show why. Without the `sessions` SQL module, an access token keeps
|
|
302
|
+
* working against the Data API until it expires; set this to end the
|
|
303
|
+
* sessions at once instead.
|
|
304
|
+
*/
|
|
305
|
+
readonly endSessions?: boolean;
|
|
297
306
|
}
|
|
298
307
|
interface SuspendAccountResult {
|
|
299
308
|
readonly userId: string;
|
|
300
309
|
readonly suspended: boolean;
|
|
310
|
+
/**
|
|
311
|
+
* The sessions deleted: `0` on a suspension (unless `endSessions` is set),
|
|
312
|
+
* and the user's remaining sessions when the ban is lifted.
|
|
313
|
+
*/
|
|
301
314
|
readonly ended: number;
|
|
302
315
|
}
|
|
303
316
|
declare function endSessions(sql: SqlClient, userId: string): AsyncResult<EndSessionsResult>;
|
|
317
|
+
interface LastSignIn {
|
|
318
|
+
readonly userId: string;
|
|
319
|
+
/** `null` for a user who never signed in. */
|
|
320
|
+
readonly lastSignInAt: Temporal.Instant | null;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* The last sign-in of each user, in one query (`better_supabase.last_sign_ins`
|
|
324
|
+
* from the `sessions` module, which only the service role may call). Users
|
|
325
|
+
* that don't exist are missing from the map.
|
|
326
|
+
*/
|
|
327
|
+
declare function lastSignIns(sql: SqlClient, userIds: readonly string[]): AsyncResult<ReadonlyMap<string, LastSignIn>>;
|
|
304
328
|
declare function suspendAccount(service: SupabaseClient | (() => SupabaseClient), sql: SqlClient, userId: string, options: SuspendAccountOptions): AsyncResult<SuspendAccountResult>;
|
|
305
329
|
//#endregion
|
|
306
330
|
//#region src/server/server.d.ts
|
|
@@ -496,6 +520,11 @@ interface BetterServer<M extends AnyModels, F extends AnyFunctions, E, C = unkno
|
|
|
496
520
|
*/
|
|
497
521
|
deleteAccount(userId: string, options?: DeleteAccountOptions): AsyncResult<DeleteAccountResult>;
|
|
498
522
|
endSessions(userId: string): AsyncResult<EndSessionsResult>;
|
|
523
|
+
/**
|
|
524
|
+
* Bans the user in Auth and keeps their sessions, so Auth answers with
|
|
525
|
+
* `user_banned` (`endSessions: true` deletes them too). Lifting the ban
|
|
526
|
+
* ends the sessions first, so the user signs in again.
|
|
527
|
+
*/
|
|
499
528
|
suspendAccount(userId: string, options: SuspendAccountOptions): AsyncResult<SuspendAccountResult>;
|
|
500
529
|
/**
|
|
501
530
|
* Repositories running as a user, with RLS, over direct Postgres. With
|
|
@@ -526,4 +555,4 @@ declare function extendServer<R extends object>(server: object, extra: Omit<R, S
|
|
|
526
555
|
*/
|
|
527
556
|
declare function createServer<M extends AnyModels, D, F extends AnyFunctions, E, C = unknown, P = unknown>(betterSupabase: BetterSupabase<M, D, F, E, C, P>, options?: ServerOptions): BetterServer<M, F, E, C, P>;
|
|
528
557
|
//#endregion
|
|
529
|
-
export {
|
|
558
|
+
export { supportSessions as A, SupportSession as B, ActiveSupport as C, SupportPolicy as D, SupportOptions as E, supportCookieValue as F, SupportStartInput as H, SqlSupportStoreOptions as I, SupportCallerClaims as L, SupportCookieOptions as M, clearSupportCookie as N, SupportSessions as O, supportCookie as P, SupportEndedBy as R, deleteAccount as S, SupportAuthorizeInput as T, sqlSupportStore as U, SupportSessionStore as V, supportClaims as W, RequestIdOptions as _, ServerDbOptions as a, DeleteAccountOptions as b, createServer as c, LastSignIn as d, SuspendAccountOptions as f, suspendAccount as g, lastSignIns as h, ServerContext as i, SUPPORT_COOKIE as j, SupportStartRequest as k, extendServer as l, endSessions as m, ContextOptions as n, ServerOptions as o, SuspendAccountResult as p, ForContextOptions as r, TENANT_HEADER as s, BetterServer as t, EndSessionsResult as u, PRIMARY_COOKIE as v, SupportApi as w, DeleteAccountResult as x, ReplicaState as y, SupportListFilter as z };
|
package/dist/solid/index.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { b as DbError } from "../result-D7y2fT87.js";
|
|
|
2
2
|
import { it as QuerySpec } from "../define-CJJkkr1-.js";
|
|
3
3
|
import { n as TemplateValues } from "../template-CwO38Do8.js";
|
|
4
4
|
import { t as AuthSnapshot } from "../bind-Bu_ZNa3W.js";
|
|
5
|
-
import { t as AuthSession } from "../view-
|
|
5
|
+
import { t as AuthSession } from "../view-CF7ihnkg.js";
|
|
6
6
|
import { S as Topic, f as PresenceMember, u as EventSchemas, w as TopicHandlers, x as SubscriptionStatus } from "../index-DunNRdnT.js";
|
|
7
|
-
import { t as SupportView } from "../support-view-
|
|
7
|
+
import { t as SupportView } from "../support-view-CVOJJLpc.js";
|
|
8
8
|
import { a as BroadcastOptions, c as LiveCountSource, d as PresenceTopic, f as UseActionOptions, i as ActionState, l as LiveQueryHookOptions, n as ActionInputOf, o as ClientLike, r as ActionResultOf, s as LiveCountHookOptions, t as fieldErrorsOf, u as PresenceHookOptions } from "../field-errors-BFOa7WhB.js";
|
|
9
9
|
import { SupabaseClient } from "@supabase/supabase-js";
|
|
10
10
|
import { Accessor, JSX } from "solid-js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { a as AnyModels, i as AnyFunctions } from "../types-6BdhkmZe.js";
|
|
2
2
|
import { t as BetterSupabase } from "../define-CJJkkr1-.js";
|
|
3
|
-
import { t as BetterServer } from "../server-
|
|
4
|
-
import { a as AuthorizedContext, c as Unwrapped, n as ActionParsed, o as BlockActionOptions, r as ActionResult, s as BlockRequireOptions } from "../kit-
|
|
5
|
-
import { t as RefusalRedirects } from "../refusal-
|
|
6
|
-
import { n as FrameworkOptions, t as FrameworkLocals } from "../framework-
|
|
3
|
+
import { t as BetterServer } from "../server-Bh0EVSwU.js";
|
|
4
|
+
import { a as AuthorizedContext, c as Unwrapped, n as ActionParsed, o as BlockActionOptions, r as ActionResult, s as BlockRequireOptions } from "../kit-CkNzZUqv.js";
|
|
5
|
+
import { t as RefusalRedirects } from "../refusal-DhSU2Vvr.js";
|
|
6
|
+
import { n as FrameworkOptions, t as FrameworkLocals } from "../framework-BmzgK32X.js";
|
|
7
7
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
8
8
|
//#region src/solid-start/index.d.ts
|
|
9
9
|
/** The part of a SolidStart `FetchEvent` the integration reads and writes. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { c as extendServer, n as flushEvents, s as createServer } from "../adapter-
|
|
1
|
+
import { c as extendServer, n as flushEvents, s as createServer } from "../adapter-iKgjHVPx.js";
|
|
2
2
|
import { t as defaultExpose } from "../respond-BUgsXNgk.js";
|
|
3
3
|
import { i as requireCaller, o as runAction } from "../kit-Fm-Fv7q5.js";
|
|
4
|
-
import { i as localsOf, r as frameworkEntry } from "../framework-
|
|
4
|
+
import { i as localsOf, r as frameworkEntry } from "../framework-a7aRCIqv.js";
|
|
5
5
|
import { r as refusalResponse } from "../refusal-CeJWxmkH.js";
|
|
6
6
|
import { t as beforeRoute } from "../before-route-CnR0C0Jr.js";
|
|
7
7
|
//#region src/solid-start/index.ts
|
package/dist/sql/index.d.ts
CHANGED
|
@@ -191,6 +191,8 @@ interface ModuleLayout {
|
|
|
191
191
|
readonly policyGrants?: readonly TableGrant[];
|
|
192
192
|
/** The tables the schema files create, for `sql.modules.sessions.options.policies`. */
|
|
193
193
|
readonly declaredTables?: readonly string[];
|
|
194
|
+
/** The declared tables with row level security on, for tables `fromPolicies` makes service-only. */
|
|
195
|
+
readonly rlsTables?: readonly string[];
|
|
194
196
|
/** `config.readSets`, compiled: the functions the `read-sets` module writes. */
|
|
195
197
|
readonly readSets?: readonly {
|
|
196
198
|
readonly name: string;
|
|
@@ -417,6 +419,14 @@ interface PolicyGrant {
|
|
|
417
419
|
export declare function declaredTables(files: readonly {
|
|
418
420
|
readonly text: string;
|
|
419
421
|
}[], schemas: readonly string[]): string[];
|
|
422
|
+
/**
|
|
423
|
+
* The tables in `schemas` that `files` leave with row level security on:
|
|
424
|
+
* `alter table ... enable row level security`, until a later `disable` or
|
|
425
|
+
* `drop table`.
|
|
426
|
+
*/
|
|
427
|
+
export declare function rlsTables(files: readonly {
|
|
428
|
+
readonly text: string;
|
|
429
|
+
}[], schemas: readonly string[]): string[];
|
|
420
430
|
/**
|
|
421
431
|
* The privileges the permissive policies in `files` imply, per table and
|
|
422
432
|
* role: `for all` gives the four commands, `to public` (or no `to`) counts
|