From 5c2b8126b79643474986e89e2b457f7e84f97e31 Mon Sep 17 00:00:00 2001 From: Shawn Erquhart Date: Thu, 23 Oct 2025 14:16:51 -0400 Subject: [PATCH 1/3] upgrade to @convex-dev/auth@0.8 --- convex/_generated/api.d.ts | 2252 +++++++++++++++++++++++++++--------- convex/auth.ts | 110 +- convex/http.ts | 6 +- package.json | 4 +- pnpm-lock.yaml | 17 +- src/routes/api/auth/$.ts | 2 +- src/server/auth.server.ts | 39 - 7 files changed, 1793 insertions(+), 637 deletions(-) delete mode 100644 src/server/auth.server.ts diff --git a/convex/_generated/api.d.ts b/convex/_generated/api.d.ts index 1c6f029a4..860f0d8ae 100644 --- a/convex/_generated/api.d.ts +++ b/convex/_generated/api.d.ts @@ -257,18 +257,7 @@ export declare const components: { }; }; betterAuth: { - adapterTest: { - count: FunctionReference<"query", "internal", any, any>; - create: FunctionReference<"mutation", "internal", any, any>; - delete: FunctionReference<"mutation", "internal", any, any>; - deleteMany: FunctionReference<"mutation", "internal", any, any>; - findMany: FunctionReference<"query", "internal", any, any>; - findOne: FunctionReference<"query", "internal", any, any>; - isAuthenticated: FunctionReference<"query", "internal", {}, any>; - update: FunctionReference<"mutation", "internal", any, any>; - updateMany: FunctionReference<"mutation", "internal", any, any>; - }; - lib: { + adapter: { create: FunctionReference< "mutation", "internal", @@ -276,9 +265,6 @@ export declare const components: { input: | { data: { - banExpires?: null | number; - banReason?: null | string; - banned?: null | boolean; createdAt: number; displayUsername?: null | string; email: string; @@ -288,9 +274,6 @@ export declare const components: { name: string; phoneNumber?: null | string; phoneNumberVerified?: null | boolean; - role?: null | string; - stripeCustomerId?: null | string; - teamId?: null | string; twoFactorEnabled?: null | boolean; updatedAt: number; userId?: null | string; @@ -300,11 +283,8 @@ export declare const components: { } | { data: { - activeOrganizationId?: null | string; - activeTeamId?: null | string; createdAt: number; expiresAt: number; - impersonatedBy?: null | string; ipAddress?: null | string; token: string; updatedAt: number; @@ -359,31 +339,6 @@ export declare const components: { }; model: "passkey"; } - | { - data: { - createdAt: number; - enabled?: null | boolean; - expiresAt?: null | number; - key: string; - lastRefillAt?: null | number; - lastRequest?: null | number; - metadata?: null | string; - name?: null | string; - permissions?: null | string; - prefix?: null | string; - rateLimitEnabled?: null | boolean; - rateLimitMax?: null | number; - rateLimitTimeWindow?: null | number; - refillAmount?: null | number; - refillInterval?: null | number; - remaining?: null | number; - requestCount?: null | number; - start?: null | string; - updatedAt: number; - userId: string; - }; - model: "apikey"; - } | { data: { clientId?: null | string; @@ -526,85 +481,1301 @@ export declare const components: { lastRequest?: null | number; }; model: "rateLimit"; + } + | { + data: { count: number; key: string; lastRequest: number }; + model: "ratelimit"; + }; + onCreateHandle?: string; + select?: Array; + }, + any + >; + deleteMany: FunctionReference< + "mutation", + "internal", + { + input: + | { + model: "user"; + where?: Array<{ + connector?: "AND" | "OR"; + field: + | "name" + | "email" + | "emailVerified" + | "image" + | "createdAt" + | "updatedAt" + | "twoFactorEnabled" + | "isAnonymous" + | "username" + | "displayUsername" + | "phoneNumber" + | "phoneNumberVerified" + | "userId" + | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "session"; + where?: Array<{ + connector?: "AND" | "OR"; + field: + | "expiresAt" + | "token" + | "createdAt" + | "updatedAt" + | "ipAddress" + | "userAgent" + | "userId" + | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "account"; + where?: Array<{ + connector?: "AND" | "OR"; + field: + | "accountId" + | "providerId" + | "userId" + | "accessToken" + | "refreshToken" + | "idToken" + | "accessTokenExpiresAt" + | "refreshTokenExpiresAt" + | "scope" + | "password" + | "createdAt" + | "updatedAt" + | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "verification"; + where?: Array<{ + connector?: "AND" | "OR"; + field: + | "identifier" + | "value" + | "expiresAt" + | "createdAt" + | "updatedAt" + | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "twoFactor"; + where?: Array<{ + connector?: "AND" | "OR"; + field: "secret" | "backupCodes" | "userId" | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "passkey"; + where?: Array<{ + connector?: "AND" | "OR"; + field: + | "name" + | "publicKey" + | "userId" + | "credentialID" + | "counter" + | "deviceType" + | "backedUp" + | "transports" + | "createdAt" + | "aaguid" + | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "oauthApplication"; + where?: Array<{ + connector?: "AND" | "OR"; + field: + | "name" + | "icon" + | "metadata" + | "clientId" + | "clientSecret" + | "redirectURLs" + | "type" + | "disabled" + | "userId" + | "createdAt" + | "updatedAt" + | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "oauthAccessToken"; + where?: Array<{ + connector?: "AND" | "OR"; + field: + | "accessToken" + | "refreshToken" + | "accessTokenExpiresAt" + | "refreshTokenExpiresAt" + | "clientId" + | "userId" + | "scopes" + | "createdAt" + | "updatedAt" + | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "oauthConsent"; + where?: Array<{ + connector?: "AND" | "OR"; + field: + | "clientId" + | "userId" + | "scopes" + | "createdAt" + | "updatedAt" + | "consentGiven" + | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "team"; + where?: Array<{ + connector?: "AND" | "OR"; + field: + | "name" + | "organizationId" + | "createdAt" + | "updatedAt" + | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "teamMember"; + where?: Array<{ + connector?: "AND" | "OR"; + field: "teamId" | "userId" | "createdAt" | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "organization"; + where?: Array<{ + connector?: "AND" | "OR"; + field: + | "name" + | "slug" + | "logo" + | "createdAt" + | "metadata" + | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "member"; + where?: Array<{ + connector?: "AND" | "OR"; + field: + | "organizationId" + | "userId" + | "role" + | "createdAt" + | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "invitation"; + where?: Array<{ + connector?: "AND" | "OR"; + field: + | "organizationId" + | "email" + | "role" + | "teamId" + | "status" + | "expiresAt" + | "inviterId" + | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "ssoProvider"; + where?: Array<{ + connector?: "AND" | "OR"; + field: + | "issuer" + | "oidcConfig" + | "samlConfig" + | "userId" + | "providerId" + | "organizationId" + | "domain" + | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "jwks"; + where?: Array<{ + connector?: "AND" | "OR"; + field: "publicKey" | "privateKey" | "createdAt" | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "subscription"; + where?: Array<{ + connector?: "AND" | "OR"; + field: + | "plan" + | "referenceId" + | "stripeCustomerId" + | "stripeSubscriptionId" + | "status" + | "periodStart" + | "periodEnd" + | "trialStart" + | "trialEnd" + | "cancelAtPeriodEnd" + | "seats" + | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "walletAddress"; + where?: Array<{ + connector?: "AND" | "OR"; + field: + | "userId" + | "address" + | "chainId" + | "isPrimary" + | "createdAt" + | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "rateLimit"; + where?: Array<{ + connector?: "AND" | "OR"; + field: "key" | "count" | "lastRequest" | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "ratelimit"; + where?: Array<{ + connector?: "AND" | "OR"; + field: "key" | "count" | "lastRequest" | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + }; + onDeleteHandle?: string; + paginationOpts: { + cursor: string | null; + endCursor?: string | null; + id?: number; + maximumBytesRead?: number; + maximumRowsRead?: number; + numItems: number; + }; + }, + any + >; + deleteOne: FunctionReference< + "mutation", + "internal", + { + input: + | { + model: "user"; + where?: Array<{ + connector?: "AND" | "OR"; + field: + | "name" + | "email" + | "emailVerified" + | "image" + | "createdAt" + | "updatedAt" + | "twoFactorEnabled" + | "isAnonymous" + | "username" + | "displayUsername" + | "phoneNumber" + | "phoneNumberVerified" + | "userId" + | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "session"; + where?: Array<{ + connector?: "AND" | "OR"; + field: + | "expiresAt" + | "token" + | "createdAt" + | "updatedAt" + | "ipAddress" + | "userAgent" + | "userId" + | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "account"; + where?: Array<{ + connector?: "AND" | "OR"; + field: + | "accountId" + | "providerId" + | "userId" + | "accessToken" + | "refreshToken" + | "idToken" + | "accessTokenExpiresAt" + | "refreshTokenExpiresAt" + | "scope" + | "password" + | "createdAt" + | "updatedAt" + | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "verification"; + where?: Array<{ + connector?: "AND" | "OR"; + field: + | "identifier" + | "value" + | "expiresAt" + | "createdAt" + | "updatedAt" + | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "twoFactor"; + where?: Array<{ + connector?: "AND" | "OR"; + field: "secret" | "backupCodes" | "userId" | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "passkey"; + where?: Array<{ + connector?: "AND" | "OR"; + field: + | "name" + | "publicKey" + | "userId" + | "credentialID" + | "counter" + | "deviceType" + | "backedUp" + | "transports" + | "createdAt" + | "aaguid" + | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "oauthApplication"; + where?: Array<{ + connector?: "AND" | "OR"; + field: + | "name" + | "icon" + | "metadata" + | "clientId" + | "clientSecret" + | "redirectURLs" + | "type" + | "disabled" + | "userId" + | "createdAt" + | "updatedAt" + | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "oauthAccessToken"; + where?: Array<{ + connector?: "AND" | "OR"; + field: + | "accessToken" + | "refreshToken" + | "accessTokenExpiresAt" + | "refreshTokenExpiresAt" + | "clientId" + | "userId" + | "scopes" + | "createdAt" + | "updatedAt" + | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "oauthConsent"; + where?: Array<{ + connector?: "AND" | "OR"; + field: + | "clientId" + | "userId" + | "scopes" + | "createdAt" + | "updatedAt" + | "consentGiven" + | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "team"; + where?: Array<{ + connector?: "AND" | "OR"; + field: + | "name" + | "organizationId" + | "createdAt" + | "updatedAt" + | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "teamMember"; + where?: Array<{ + connector?: "AND" | "OR"; + field: "teamId" | "userId" | "createdAt" | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "organization"; + where?: Array<{ + connector?: "AND" | "OR"; + field: + | "name" + | "slug" + | "logo" + | "createdAt" + | "metadata" + | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "member"; + where?: Array<{ + connector?: "AND" | "OR"; + field: + | "organizationId" + | "userId" + | "role" + | "createdAt" + | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "invitation"; + where?: Array<{ + connector?: "AND" | "OR"; + field: + | "organizationId" + | "email" + | "role" + | "teamId" + | "status" + | "expiresAt" + | "inviterId" + | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "ssoProvider"; + where?: Array<{ + connector?: "AND" | "OR"; + field: + | "issuer" + | "oidcConfig" + | "samlConfig" + | "userId" + | "providerId" + | "organizationId" + | "domain" + | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "jwks"; + where?: Array<{ + connector?: "AND" | "OR"; + field: "publicKey" | "privateKey" | "createdAt" | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "subscription"; + where?: Array<{ + connector?: "AND" | "OR"; + field: + | "plan" + | "referenceId" + | "stripeCustomerId" + | "stripeSubscriptionId" + | "status" + | "periodStart" + | "periodEnd" + | "trialStart" + | "trialEnd" + | "cancelAtPeriodEnd" + | "seats" + | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "walletAddress"; + where?: Array<{ + connector?: "AND" | "OR"; + field: + | "userId" + | "address" + | "chainId" + | "isPrimary" + | "createdAt" + | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "rateLimit"; + where?: Array<{ + connector?: "AND" | "OR"; + field: "key" | "count" | "lastRequest" | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "ratelimit"; + where?: Array<{ + connector?: "AND" | "OR"; + field: "key" | "count" | "lastRequest" | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; }; - }, - any - >; - deleteMany: FunctionReference< - "mutation", - "internal", - { - limit?: number; - model: string; - offset?: number; - paginationOpts: { - cursor: string | null; - endCursor?: string | null; - id?: number; - maximumBytesRead?: number; - maximumRowsRead?: number; - numItems: number; - }; - select?: Array; - sortBy?: { direction: "asc" | "desc"; field: string }; - unique?: boolean; - where?: Array<{ - connector?: "AND" | "OR"; - field: string; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - }, - any - >; - deleteOne: FunctionReference< - "mutation", - "internal", - { - limit?: number; - model: string; - offset?: number; - select?: Array; - sortBy?: { direction: "asc" | "desc"; field: string }; - unique?: boolean; - where?: Array<{ - connector?: "AND" | "OR"; - field: string; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; + onDeleteHandle?: string; }, any >; @@ -613,7 +1784,27 @@ export declare const components: { "internal", { limit?: number; - model: string; + model: + | "user" + | "session" + | "account" + | "verification" + | "twoFactor" + | "passkey" + | "oauthApplication" + | "oauthAccessToken" + | "oauthConsent" + | "team" + | "teamMember" + | "organization" + | "member" + | "invitation" + | "ssoProvider" + | "jwks" + | "subscription" + | "walletAddress" + | "rateLimit" + | "ratelimit"; offset?: number; paginationOpts: { cursor: string | null; @@ -623,9 +1814,7 @@ export declare const components: { maximumRowsRead?: number; numItems: number; }; - select?: Array; sortBy?: { direction: "asc" | "desc"; field: string }; - unique?: boolean; where?: Array<{ connector?: "AND" | "OR"; field: string; @@ -655,12 +1844,28 @@ export declare const components: { "query", "internal", { - limit?: number; - model: string; - offset?: number; + model: + | "user" + | "session" + | "account" + | "verification" + | "twoFactor" + | "passkey" + | "oauthApplication" + | "oauthAccessToken" + | "oauthConsent" + | "team" + | "teamMember" + | "organization" + | "member" + | "invitation" + | "ssoProvider" + | "jwks" + | "subscription" + | "walletAddress" + | "rateLimit" + | "ratelimit"; select?: Array; - sortBy?: { direction: "asc" | "desc"; field: string }; - unique?: boolean; where?: Array<{ connector?: "AND" | "OR"; field: string; @@ -686,31 +1891,14 @@ export declare const components: { }, any >; - getCurrentSession: FunctionReference<"query", "internal", {}, any>; updateMany: FunctionReference< "mutation", "internal", { input: | { - limit?: number; model: "user"; - offset?: number; - paginationOpts: { - cursor: string | null; - endCursor?: string | null; - id?: number; - maximumBytesRead?: number; - maximumRowsRead?: number; - numItems: number; - }; - select?: Array; - sortBy?: { direction: "asc" | "desc"; field: string }; - unique?: boolean; update: { - banExpires?: null | number; - banReason?: null | string; - banned?: null | boolean; createdAt?: number; displayUsername?: null | string; email?: string; @@ -720,9 +1908,6 @@ export declare const components: { name?: string; phoneNumber?: null | string; phoneNumberVerified?: null | boolean; - role?: null | string; - stripeCustomerId?: null | string; - teamId?: null | string; twoFactorEnabled?: null | boolean; updatedAt?: number; userId?: null | string; @@ -730,7 +1915,21 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "name" + | "email" + | "emailVerified" + | "image" + | "createdAt" + | "updatedAt" + | "twoFactorEnabled" + | "isAnonymous" + | "username" + | "displayUsername" + | "phoneNumber" + | "phoneNumberVerified" + | "userId" + | "id"; operator?: | "lt" | "lte" @@ -752,26 +1951,10 @@ export declare const components: { }>; } | { - limit?: number; model: "session"; - offset?: number; - paginationOpts: { - cursor: string | null; - endCursor?: string | null; - id?: number; - maximumBytesRead?: number; - maximumRowsRead?: number; - numItems: number; - }; - select?: Array; - sortBy?: { direction: "asc" | "desc"; field: string }; - unique?: boolean; update: { - activeOrganizationId?: null | string; - activeTeamId?: null | string; createdAt?: number; expiresAt?: number; - impersonatedBy?: null | string; ipAddress?: null | string; token?: string; updatedAt?: number; @@ -780,7 +1963,15 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "expiresAt" + | "token" + | "createdAt" + | "updatedAt" + | "ipAddress" + | "userAgent" + | "userId" + | "id"; operator?: | "lt" | "lte" @@ -802,20 +1993,7 @@ export declare const components: { }>; } | { - limit?: number; model: "account"; - offset?: number; - paginationOpts: { - cursor: string | null; - endCursor?: string | null; - id?: number; - maximumBytesRead?: number; - maximumRowsRead?: number; - numItems: number; - }; - select?: Array; - sortBy?: { direction: "asc" | "desc"; field: string }; - unique?: boolean; update: { accessToken?: null | string; accessTokenExpiresAt?: null | number; @@ -832,7 +2010,20 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "accountId" + | "providerId" + | "userId" + | "accessToken" + | "refreshToken" + | "idToken" + | "accessTokenExpiresAt" + | "refreshTokenExpiresAt" + | "scope" + | "password" + | "createdAt" + | "updatedAt" + | "id"; operator?: | "lt" | "lte" @@ -854,20 +2045,7 @@ export declare const components: { }>; } | { - limit?: number; model: "verification"; - offset?: number; - paginationOpts: { - cursor: string | null; - endCursor?: string | null; - id?: number; - maximumBytesRead?: number; - maximumRowsRead?: number; - numItems: number; - }; - select?: Array; - sortBy?: { direction: "asc" | "desc"; field: string }; - unique?: boolean; update: { createdAt?: number; expiresAt?: number; @@ -877,7 +2055,13 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "identifier" + | "value" + | "expiresAt" + | "createdAt" + | "updatedAt" + | "id"; operator?: | "lt" | "lte" @@ -899,20 +2083,7 @@ export declare const components: { }>; } | { - limit?: number; model: "twoFactor"; - offset?: number; - paginationOpts: { - cursor: string | null; - endCursor?: string | null; - id?: number; - maximumBytesRead?: number; - maximumRowsRead?: number; - numItems: number; - }; - select?: Array; - sortBy?: { direction: "asc" | "desc"; field: string }; - unique?: boolean; update: { backupCodes?: string; secret?: string; @@ -920,7 +2091,7 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: "secret" | "backupCodes" | "userId" | "id"; operator?: | "lt" | "lte" @@ -942,20 +2113,7 @@ export declare const components: { }>; } | { - limit?: number; model: "passkey"; - offset?: number; - paginationOpts: { - cursor: string | null; - endCursor?: string | null; - id?: number; - maximumBytesRead?: number; - maximumRowsRead?: number; - numItems: number; - }; - select?: Array; - sortBy?: { direction: "asc" | "desc"; field: string }; - unique?: boolean; update: { aaguid?: null | string; backedUp?: boolean; @@ -970,67 +2128,18 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - limit?: number; - model: "apikey"; - offset?: number; - paginationOpts: { - cursor: string | null; - endCursor?: string | null; - id?: number; - maximumBytesRead?: number; - maximumRowsRead?: number; - numItems: number; - }; - select?: Array; - sortBy?: { direction: "asc" | "desc"; field: string }; - unique?: boolean; - update: { - createdAt?: number; - enabled?: null | boolean; - expiresAt?: null | number; - key?: string; - lastRefillAt?: null | number; - lastRequest?: null | number; - metadata?: null | string; - name?: null | string; - permissions?: null | string; - prefix?: null | string; - rateLimitEnabled?: null | boolean; - rateLimitMax?: null | number; - rateLimitTimeWindow?: null | number; - refillAmount?: null | number; - refillInterval?: null | number; - remaining?: null | number; - requestCount?: null | number; - start?: null | string; - updatedAt?: number; - userId?: string; - }; - where?: Array<{ - connector?: "AND" | "OR"; - field: string; + field: + | "name" + | "publicKey" + | "userId" + | "credentialID" + | "counter" + | "deviceType" + | "backedUp" + | "transports" + | "createdAt" + | "aaguid" + | "id"; operator?: | "lt" | "lte" @@ -1052,20 +2161,7 @@ export declare const components: { }>; } | { - limit?: number; model: "oauthApplication"; - offset?: number; - paginationOpts: { - cursor: string | null; - endCursor?: string | null; - id?: number; - maximumBytesRead?: number; - maximumRowsRead?: number; - numItems: number; - }; - select?: Array; - sortBy?: { direction: "asc" | "desc"; field: string }; - unique?: boolean; update: { clientId?: null | string; clientSecret?: null | string; @@ -1081,7 +2177,19 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "name" + | "icon" + | "metadata" + | "clientId" + | "clientSecret" + | "redirectURLs" + | "type" + | "disabled" + | "userId" + | "createdAt" + | "updatedAt" + | "id"; operator?: | "lt" | "lte" @@ -1103,20 +2211,7 @@ export declare const components: { }>; } | { - limit?: number; model: "oauthAccessToken"; - offset?: number; - paginationOpts: { - cursor: string | null; - endCursor?: string | null; - id?: number; - maximumBytesRead?: number; - maximumRowsRead?: number; - numItems: number; - }; - select?: Array; - sortBy?: { direction: "asc" | "desc"; field: string }; - unique?: boolean; update: { accessToken?: null | string; accessTokenExpiresAt?: null | number; @@ -1130,7 +2225,17 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "accessToken" + | "refreshToken" + | "accessTokenExpiresAt" + | "refreshTokenExpiresAt" + | "clientId" + | "userId" + | "scopes" + | "createdAt" + | "updatedAt" + | "id"; operator?: | "lt" | "lte" @@ -1152,20 +2257,7 @@ export declare const components: { }>; } | { - limit?: number; model: "oauthConsent"; - offset?: number; - paginationOpts: { - cursor: string | null; - endCursor?: string | null; - id?: number; - maximumBytesRead?: number; - maximumRowsRead?: number; - numItems: number; - }; - select?: Array; - sortBy?: { direction: "asc" | "desc"; field: string }; - unique?: boolean; update: { clientId?: null | string; consentGiven?: null | boolean; @@ -1176,7 +2268,14 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "clientId" + | "userId" + | "scopes" + | "createdAt" + | "updatedAt" + | "consentGiven" + | "id"; operator?: | "lt" | "lte" @@ -1198,20 +2297,7 @@ export declare const components: { }>; } | { - limit?: number; model: "team"; - offset?: number; - paginationOpts: { - cursor: string | null; - endCursor?: string | null; - id?: number; - maximumBytesRead?: number; - maximumRowsRead?: number; - numItems: number; - }; - select?: Array; - sortBy?: { direction: "asc" | "desc"; field: string }; - unique?: boolean; update: { createdAt?: number; name?: string; @@ -1220,7 +2306,12 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "name" + | "organizationId" + | "createdAt" + | "updatedAt" + | "id"; operator?: | "lt" | "lte" @@ -1242,20 +2333,7 @@ export declare const components: { }>; } | { - limit?: number; model: "teamMember"; - offset?: number; - paginationOpts: { - cursor: string | null; - endCursor?: string | null; - id?: number; - maximumBytesRead?: number; - maximumRowsRead?: number; - numItems: number; - }; - select?: Array; - sortBy?: { direction: "asc" | "desc"; field: string }; - unique?: boolean; update: { createdAt?: null | number; teamId?: string; @@ -1263,7 +2341,7 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: "teamId" | "userId" | "createdAt" | "id"; operator?: | "lt" | "lte" @@ -1285,20 +2363,7 @@ export declare const components: { }>; } | { - limit?: number; model: "organization"; - offset?: number; - paginationOpts: { - cursor: string | null; - endCursor?: string | null; - id?: number; - maximumBytesRead?: number; - maximumRowsRead?: number; - numItems: number; - }; - select?: Array; - sortBy?: { direction: "asc" | "desc"; field: string }; - unique?: boolean; update: { createdAt?: number; logo?: null | string; @@ -1308,7 +2373,13 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "name" + | "slug" + | "logo" + | "createdAt" + | "metadata" + | "id"; operator?: | "lt" | "lte" @@ -1330,20 +2401,7 @@ export declare const components: { }>; } | { - limit?: number; model: "member"; - offset?: number; - paginationOpts: { - cursor: string | null; - endCursor?: string | null; - id?: number; - maximumBytesRead?: number; - maximumRowsRead?: number; - numItems: number; - }; - select?: Array; - sortBy?: { direction: "asc" | "desc"; field: string }; - unique?: boolean; update: { createdAt?: number; organizationId?: string; @@ -1352,7 +2410,12 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "organizationId" + | "userId" + | "role" + | "createdAt" + | "id"; operator?: | "lt" | "lte" @@ -1374,20 +2437,7 @@ export declare const components: { }>; } | { - limit?: number; model: "invitation"; - offset?: number; - paginationOpts: { - cursor: string | null; - endCursor?: string | null; - id?: number; - maximumBytesRead?: number; - maximumRowsRead?: number; - numItems: number; - }; - select?: Array; - sortBy?: { direction: "asc" | "desc"; field: string }; - unique?: boolean; update: { email?: string; expiresAt?: number; @@ -1399,7 +2449,15 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "organizationId" + | "email" + | "role" + | "teamId" + | "status" + | "expiresAt" + | "inviterId" + | "id"; operator?: | "lt" | "lte" @@ -1421,20 +2479,7 @@ export declare const components: { }>; } | { - limit?: number; model: "ssoProvider"; - offset?: number; - paginationOpts: { - cursor: string | null; - endCursor?: string | null; - id?: number; - maximumBytesRead?: number; - maximumRowsRead?: number; - numItems: number; - }; - select?: Array; - sortBy?: { direction: "asc" | "desc"; field: string }; - unique?: boolean; update: { domain?: string; issuer?: string; @@ -1446,7 +2491,15 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "issuer" + | "oidcConfig" + | "samlConfig" + | "userId" + | "providerId" + | "organizationId" + | "domain" + | "id"; operator?: | "lt" | "lte" @@ -1468,20 +2521,7 @@ export declare const components: { }>; } | { - limit?: number; model: "jwks"; - offset?: number; - paginationOpts: { - cursor: string | null; - endCursor?: string | null; - id?: number; - maximumBytesRead?: number; - maximumRowsRead?: number; - numItems: number; - }; - select?: Array; - sortBy?: { direction: "asc" | "desc"; field: string }; - unique?: boolean; update: { createdAt?: number; privateKey?: string; @@ -1489,7 +2529,7 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: "publicKey" | "privateKey" | "createdAt" | "id"; operator?: | "lt" | "lte" @@ -1511,20 +2551,7 @@ export declare const components: { }>; } | { - limit?: number; model: "subscription"; - offset?: number; - paginationOpts: { - cursor: string | null; - endCursor?: string | null; - id?: number; - maximumBytesRead?: number; - maximumRowsRead?: number; - numItems: number; - }; - select?: Array; - sortBy?: { direction: "asc" | "desc"; field: string }; - unique?: boolean; update: { cancelAtPeriodEnd?: null | boolean; periodEnd?: null | number; @@ -1540,7 +2567,19 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "plan" + | "referenceId" + | "stripeCustomerId" + | "stripeSubscriptionId" + | "status" + | "periodStart" + | "periodEnd" + | "trialStart" + | "trialEnd" + | "cancelAtPeriodEnd" + | "seats" + | "id"; operator?: | "lt" | "lte" @@ -1562,20 +2601,7 @@ export declare const components: { }>; } | { - limit?: number; model: "walletAddress"; - offset?: number; - paginationOpts: { - cursor: string | null; - endCursor?: string | null; - id?: number; - maximumBytesRead?: number; - maximumRowsRead?: number; - numItems: number; - }; - select?: Array; - sortBy?: { direction: "asc" | "desc"; field: string }; - unique?: boolean; update: { address?: string; chainId?: number; @@ -1585,7 +2611,13 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "userId" + | "address" + | "chainId" + | "isPrimary" + | "createdAt" + | "id"; operator?: | "lt" | "lte" @@ -1607,20 +2639,7 @@ export declare const components: { }>; } | { - limit?: number; model: "rateLimit"; - offset?: number; - paginationOpts: { - cursor: string | null; - endCursor?: string | null; - id?: number; - maximumBytesRead?: number; - maximumRowsRead?: number; - numItems: number; - }; - select?: Array; - sortBy?: { direction: "asc" | "desc"; field: string }; - unique?: boolean; update: { count?: null | number; key?: null | string; @@ -1628,7 +2647,33 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: "key" | "count" | "lastRequest" | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "ratelimit"; + update: { count?: number; key?: string; lastRequest?: number }; + where?: Array<{ + connector?: "AND" | "OR"; + field: "key" | "count" | "lastRequest" | "id"; operator?: | "lt" | "lte" @@ -1649,6 +2694,15 @@ export declare const components: { | null; }>; }; + onUpdateHandle?: string; + paginationOpts: { + cursor: string | null; + endCursor?: string | null; + id?: number; + maximumBytesRead?: number; + maximumRowsRead?: number; + numItems: number; + }; }, any >; @@ -1660,9 +2714,6 @@ export declare const components: { | { model: "user"; update: { - banExpires?: null | number; - banReason?: null | string; - banned?: null | boolean; createdAt?: number; displayUsername?: null | string; email?: string; @@ -1672,9 +2723,6 @@ export declare const components: { name?: string; phoneNumber?: null | string; phoneNumberVerified?: null | boolean; - role?: null | string; - stripeCustomerId?: null | string; - teamId?: null | string; twoFactorEnabled?: null | boolean; updatedAt?: number; userId?: null | string; @@ -1682,7 +2730,21 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "name" + | "email" + | "emailVerified" + | "image" + | "createdAt" + | "updatedAt" + | "twoFactorEnabled" + | "isAnonymous" + | "username" + | "displayUsername" + | "phoneNumber" + | "phoneNumberVerified" + | "userId" + | "id"; operator?: | "lt" | "lte" @@ -1706,11 +2768,8 @@ export declare const components: { | { model: "session"; update: { - activeOrganizationId?: null | string; - activeTeamId?: null | string; createdAt?: number; expiresAt?: number; - impersonatedBy?: null | string; ipAddress?: null | string; token?: string; updatedAt?: number; @@ -1719,7 +2778,15 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "expiresAt" + | "token" + | "createdAt" + | "updatedAt" + | "ipAddress" + | "userAgent" + | "userId" + | "id"; operator?: | "lt" | "lte" @@ -1758,7 +2825,20 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "accountId" + | "providerId" + | "userId" + | "accessToken" + | "refreshToken" + | "idToken" + | "accessTokenExpiresAt" + | "refreshTokenExpiresAt" + | "scope" + | "password" + | "createdAt" + | "updatedAt" + | "id"; operator?: | "lt" | "lte" @@ -1790,7 +2870,13 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "identifier" + | "value" + | "expiresAt" + | "createdAt" + | "updatedAt" + | "id"; operator?: | "lt" | "lte" @@ -1820,7 +2906,7 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: "secret" | "backupCodes" | "userId" | "id"; operator?: | "lt" | "lte" @@ -1857,54 +2943,18 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - model: "apikey"; - update: { - createdAt?: number; - enabled?: null | boolean; - expiresAt?: null | number; - key?: string; - lastRefillAt?: null | number; - lastRequest?: null | number; - metadata?: null | string; - name?: null | string; - permissions?: null | string; - prefix?: null | string; - rateLimitEnabled?: null | boolean; - rateLimitMax?: null | number; - rateLimitTimeWindow?: null | number; - refillAmount?: null | number; - refillInterval?: null | number; - remaining?: null | number; - requestCount?: null | number; - start?: null | string; - updatedAt?: number; - userId?: string; - }; - where?: Array<{ - connector?: "AND" | "OR"; - field: string; + field: + | "name" + | "publicKey" + | "userId" + | "credentialID" + | "counter" + | "deviceType" + | "backedUp" + | "transports" + | "createdAt" + | "aaguid" + | "id"; operator?: | "lt" | "lte" @@ -1942,7 +2992,19 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "name" + | "icon" + | "metadata" + | "clientId" + | "clientSecret" + | "redirectURLs" + | "type" + | "disabled" + | "userId" + | "createdAt" + | "updatedAt" + | "id"; operator?: | "lt" | "lte" @@ -1978,7 +3040,17 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "accessToken" + | "refreshToken" + | "accessTokenExpiresAt" + | "refreshTokenExpiresAt" + | "clientId" + | "userId" + | "scopes" + | "createdAt" + | "updatedAt" + | "id"; operator?: | "lt" | "lte" @@ -2011,7 +3083,14 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "clientId" + | "userId" + | "scopes" + | "createdAt" + | "updatedAt" + | "consentGiven" + | "id"; operator?: | "lt" | "lte" @@ -2042,7 +3121,12 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "name" + | "organizationId" + | "createdAt" + | "updatedAt" + | "id"; operator?: | "lt" | "lte" @@ -2072,7 +3156,7 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: "teamId" | "userId" | "createdAt" | "id"; operator?: | "lt" | "lte" @@ -2104,7 +3188,13 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "name" + | "slug" + | "logo" + | "createdAt" + | "metadata" + | "id"; operator?: | "lt" | "lte" @@ -2135,7 +3225,12 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "organizationId" + | "userId" + | "role" + | "createdAt" + | "id"; operator?: | "lt" | "lte" @@ -2169,7 +3264,15 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "organizationId" + | "email" + | "role" + | "teamId" + | "status" + | "expiresAt" + | "inviterId" + | "id"; operator?: | "lt" | "lte" @@ -2203,7 +3306,15 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "issuer" + | "oidcConfig" + | "samlConfig" + | "userId" + | "providerId" + | "organizationId" + | "domain" + | "id"; operator?: | "lt" | "lte" @@ -2233,7 +3344,7 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: "publicKey" | "privateKey" | "createdAt" | "id"; operator?: | "lt" | "lte" @@ -2271,7 +3382,19 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "plan" + | "referenceId" + | "stripeCustomerId" + | "stripeSubscriptionId" + | "status" + | "periodStart" + | "periodEnd" + | "trialStart" + | "trialEnd" + | "cancelAtPeriodEnd" + | "seats" + | "id"; operator?: | "lt" | "lte" @@ -2303,7 +3426,13 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "userId" + | "address" + | "chainId" + | "isPrimary" + | "createdAt" + | "id"; operator?: | "lt" | "lte" @@ -2333,7 +3462,33 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: "key" | "count" | "lastRequest" | "id"; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "ratelimit"; + update: { count?: number; key?: string; lastRequest?: number }; + where?: Array<{ + connector?: "AND" | "OR"; + field: "key" | "count" | "lastRequest" | "id"; operator?: | "lt" | "lte" @@ -2354,9 +3509,20 @@ export declare const components: { | null; }>; }; + onUpdateHandle?: string; }, any >; }; + adapterTest: { + count: FunctionReference<"query", "internal", any, any>; + create: FunctionReference<"mutation", "internal", any, any>; + delete: FunctionReference<"mutation", "internal", any, any>; + deleteMany: FunctionReference<"mutation", "internal", any, any>; + findMany: FunctionReference<"query", "internal", any, any>; + findOne: FunctionReference<"query", "internal", any, any>; + update: FunctionReference<"mutation", "internal", any, any>; + updateMany: FunctionReference<"mutation", "internal", any, any>; + }; }; }; diff --git a/convex/auth.ts b/convex/auth.ts index d2ca06d14..f1696cd8b 100644 --- a/convex/auth.ts +++ b/convex/auth.ts @@ -1,61 +1,89 @@ import { - BetterAuth, + createClient, + GenericCtx, type AuthFunctions, - type PublicAuthFunctions, } from '@convex-dev/better-auth' -import { api, components, internal } from './_generated/api' +import { components, internal } from './_generated/api' import { query, QueryCtx } from './_generated/server' import type { Id, DataModel } from './_generated/dataModel' import schema from './schema' import { Infer } from 'convex/values' +import { betterAuth } from 'better-auth' +import { convex } from '@convex-dev/better-auth/plugins' // Typesafe way to pass Convex functions defined in this file const authFunctions: AuthFunctions = internal.auth -const publicAuthFunctions: PublicAuthFunctions = api.auth // Initialize the component -export const betterAuthComponent = new BetterAuth(components.betterAuth, { +export const authComponent = createClient(components.betterAuth, { authFunctions, - publicAuthFunctions, + triggers: { + user: { + onCreate: async (ctx, authUser) => { + const userId = await ctx.db.insert('users', { + createdAt: authUser.createdAt, + email: authUser.email, + updatedAt: authUser.updatedAt, + displayUsername: authUser.displayUsername ?? '', + image: authUser.image ?? '', + name: authUser.name, + capabilities: [], + }) + await authComponent.setUserId(ctx, authUser._id, userId) + }, + onUpdate: async (ctx, authUser) => { + await ctx.db.patch(authUser.userId as Id<'users'>, { + email: authUser.email, + updatedAt: authUser.updatedAt, + displayUsername: authUser.displayUsername ?? '', + image: authUser.image ?? '', + name: authUser.name, + }) + }, + onDelete: async (ctx, authUser) => { + await ctx.db.delete(authUser.userId as Id<'users'>) + }, + }, + }, }) -// These are required named exports -export const { - createUser, - updateUser, - deleteUser, - createSession, - isAuthenticated, -} = betterAuthComponent.createAuthFunctions({ - // Must create a user and return the user id - onCreateUser: async (ctx, user) => { - return ctx.db.insert('users', { - createdAt: user.createdAt, - email: user.email, - updatedAt: user.updatedAt, - displayUsername: user.displayUsername ?? '', - image: user.image ?? '', - name: user.name, - capabilities: [], - }) - }, +// You'll want to replace this with an environment variable +const siteUrl = process.env.URL - // Delete the user when they are deleted from Better Auth - onDeleteUser: async (ctx, userId) => { - await ctx.db.delete(userId as Id<'users'>) - }, +export const createAuth = ( + ctx: GenericCtx, + { optionsOnly } = { optionsOnly: false } +) => { + return betterAuth({ + // All auth requests will be proxied through your TanStack Start server + baseURL: siteUrl, + database: authComponent.adapter(ctx), - onUpdateUser: async (ctx, user) => { - await ctx.db.patch(user.userId as Id<'users'>, { - email: user.email, - updatedAt: user.updatedAt, - displayUsername: user.displayUsername ?? '', - image: user.image ?? '', - name: user.name, - }) - }, -}) + // When createAuth is called just to generate options, we don't want to + // log anything + logger: { + disabled: optionsOnly, + }, + + // Simple non-verified email/password to get started + socialProviders: { + github: { + clientId: process.env.GITHUB_OAUTH_CLIENT_ID as string, + clientSecret: process.env.GITHUB_OAUTH_CLIENT_SECRET as string, + }, + google: { + clientId: process.env.GOOGLE_OAUTH_CLIENT_ID as string, + clientSecret: process.env.GOOGLE_OAUTH_CLIENT_SECRET as string, + }, + }, + plugins: [ + // The Convex plugin is required + convex(), + ], + }) +} +export const { onCreate, onUpdate, onDelete } = authComponent.triggersApi() // Example function for getting the current user // Feel free to edit, omit, etc. @@ -86,5 +114,5 @@ export type TanStackUser = Awaited> & Infer function getBetterAuthUser(ctx: QueryCtx) { - return betterAuthComponent.getAuthUser(ctx) + return authComponent.safeGetAuthUser(ctx) } diff --git a/convex/http.ts b/convex/http.ts index b0cb04465..24af94d33 100644 --- a/convex/http.ts +++ b/convex/http.ts @@ -1,11 +1,11 @@ import { ossStats } from './stats' import { httpRouter } from 'convex/server' -import { betterAuthComponent } from './auth' -import { createAuth } from '../src/server/auth.server' +import { authComponent } from './auth' +import { createAuth } from './auth' const http = httpRouter() ossStats.registerRoutes(http) -betterAuthComponent.registerRoutes(http, createAuth) +authComponent.registerRoutes(http, createAuth) export default http diff --git a/package.json b/package.json index 3fdaff0c0..a59d4d989 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "@auth/core": "0.37.0", "@clerk/tanstack-react-start": "^0.21.5", "@convex-dev/auth": "^0.0.88", - "@convex-dev/better-auth": "^0.7.15", + "@convex-dev/better-auth": "0.8", "@convex-dev/react-query": "0.0.0-alpha.11", "@erquhart/convex-oss-stats": "^0.8.1", "@floating-ui/react": "^0.27.8", @@ -53,7 +53,7 @@ "@vitejs/plugin-react": "^4.3.3", "algoliasearch": "^5.23.4", "axios": "^1.6.7", - "better-auth": "^1.3.7", + "better-auth": "^1.3.8", "cmdk": "^1.1.1", "convex": "^1.25.4", "convex-oss-stats": "link:../../../erquhart/convex-oss-stats", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index db66b0dec..6cf43bf7c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -18,8 +18,8 @@ importers: specifier: ^0.0.88 version: 0.0.88(@auth/core@0.37.0)(convex@1.27.0(@clerk/clerk-react@5.48.1(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0))(react@19.0.0) '@convex-dev/better-auth': - specifier: ^0.7.15 - version: 0.7.18(@standard-schema/spec@1.0.0)(better-auth@1.3.8(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(convex@1.27.0(@clerk/clerk-react@5.48.1(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0))(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(typescript@5.9.2) + specifier: '0.8' + version: 0.8.9(@standard-schema/spec@1.0.0)(better-auth@1.3.8(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(convex@1.27.0(@clerk/clerk-react@5.48.1(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0))(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(typescript@5.9.2) '@convex-dev/react-query': specifier: 0.0.0-alpha.11 version: 0.0.0-alpha.11(@standard-schema/spec@1.0.0)(@tanstack/react-query@5.90.2(react@19.0.0))(convex@1.27.0(@clerk/clerk-react@5.48.1(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0))(react@19.0.0)(typescript@5.9.2)(zod@4.0.17) @@ -117,7 +117,7 @@ importers: specifier: ^1.6.7 version: 1.7.8 better-auth: - specifier: ^1.3.7 + specifier: ^1.3.8 version: 1.3.8(react-dom@19.0.0(react@19.0.0))(react@19.0.0) cmdk: specifier: ^1.1.1 @@ -1216,8 +1216,8 @@ packages: react: optional: true - '@convex-dev/better-auth@0.7.18': - resolution: {integrity: sha512-lZwJcRJncmeKZfDQk7PJrJ+8z/S8rmO5rUfPWZd2gOjC+1sbd/JUZiTVPGLxeP5VEGG74TkRTUavK7s+wmKhwg==} + '@convex-dev/better-auth@0.8.9': + resolution: {integrity: sha512-t6x2lYsgv0sGL14xmIsTqxVltkS//mWtIjb+Wm39rWUCgeqmCTqsyhQnmTDQNwaqZS0sH0WfTObNHu3xbCSx1w==} peerDependencies: better-auth: 1.3.8 convex: ^1.26.2 @@ -9615,8 +9615,9 @@ snapshots: optionalDependencies: react: 19.0.0 - '@convex-dev/better-auth@0.7.18(@standard-schema/spec@1.0.0)(better-auth@1.3.8(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(convex@1.27.0(@clerk/clerk-react@5.48.1(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0))(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(typescript@5.9.2)': + '@convex-dev/better-auth@0.8.9(@standard-schema/spec@1.0.0)(better-auth@1.3.8(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(convex@1.27.0(@clerk/clerk-react@5.48.1(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0))(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(typescript@5.9.2)': dependencies: + '@better-fetch/fetch': 1.1.18 better-auth: 1.3.8(react-dom@19.0.0(react@19.0.0))(react@19.0.0) common-tags: 1.8.2 convex: 1.27.0(@clerk/clerk-react@5.48.1(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0) @@ -14056,7 +14057,7 @@ snapshots: eslint: 8.57.0 eslint-plugin-flowtype: 8.0.3(@babel/plugin-syntax-flow@7.27.1(@babel/core@7.28.3))(@babel/plugin-transform-react-jsx@7.27.1(@babel/core@7.28.3))(eslint@8.57.0) eslint-plugin-import: 2.29.1(@typescript-eslint/parser@5.62.0(eslint@8.57.0)(typescript@5.9.2))(eslint@8.57.0) - eslint-plugin-jest: 25.7.0(@typescript-eslint/eslint-plugin@5.62.0(@typescript-eslint/parser@5.62.0(eslint@8.57.0)(typescript@5.9.2))(eslint@8.57.0)(typescript@5.9.2))(eslint@8.57.0)(typescript@5.9.2) + eslint-plugin-jest: 25.7.0(@typescript-eslint/eslint-plugin@5.62.0(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.9.2))(eslint@8.57.0)(typescript@5.9.2))(eslint@8.57.0)(typescript@5.9.2) eslint-plugin-jsx-a11y: 6.8.0(eslint@8.57.0) eslint-plugin-react: 7.34.0(eslint@8.57.0) eslint-plugin-react-hooks: 4.6.0(eslint@8.57.0) @@ -14124,7 +14125,7 @@ snapshots: - eslint-import-resolver-webpack - supports-color - eslint-plugin-jest@25.7.0(@typescript-eslint/eslint-plugin@5.62.0(@typescript-eslint/parser@5.62.0(eslint@8.57.0)(typescript@5.9.2))(eslint@8.57.0)(typescript@5.9.2))(eslint@8.57.0)(typescript@5.9.2): + eslint-plugin-jest@25.7.0(@typescript-eslint/eslint-plugin@5.62.0(@typescript-eslint/parser@7.2.0(eslint@8.57.0)(typescript@5.9.2))(eslint@8.57.0)(typescript@5.9.2))(eslint@8.57.0)(typescript@5.9.2): dependencies: '@typescript-eslint/experimental-utils': 5.62.0(eslint@8.57.0)(typescript@5.9.2) eslint: 8.57.0 diff --git a/src/routes/api/auth/$.ts b/src/routes/api/auth/$.ts index 51c6ea367..461e67dc1 100644 --- a/src/routes/api/auth/$.ts +++ b/src/routes/api/auth/$.ts @@ -1,5 +1,5 @@ import { createFileRoute } from '@tanstack/react-router' -import { reactStartHandler } from "~/server/auth.server" +import { reactStartHandler } from '@convex-dev/better-auth/react-start' export const Route = createFileRoute('/api/auth/$')({ server: { diff --git a/src/server/auth.server.ts b/src/server/auth.server.ts deleted file mode 100644 index 54f9bc91d..000000000 --- a/src/server/auth.server.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { convexAdapter } from '@convex-dev/better-auth' -import { convex } from '@convex-dev/better-auth/plugins' -import { betterAuth } from 'better-auth' -import { reactStartHelpers } from '@convex-dev/better-auth/react-start' -import { GenericCtx } from '../../convex/_generated/server' -import { betterAuthComponent } from '../../convex/auth' - -// You'll want to replace this with an environment variable -const siteUrl = process.env.URL -const convexSiteUrl = - process.env.VITE_CONVEX_SITE_URL || 'http://upbeat-greyhound-631.convex.site' - -export const createAuth = (ctx: GenericCtx) => - betterAuth({ - // All auth requests will be proxied through your TanStack Start server - baseURL: siteUrl, - database: convexAdapter(ctx, betterAuthComponent), - - // Simple non-verified email/password to get started - socialProviders: { - github: { - clientId: process.env.GITHUB_OAUTH_CLIENT_ID as string, - clientSecret: process.env.GITHUB_OAUTH_CLIENT_SECRET as string, - }, - google: { - clientId: process.env.GOOGLE_OAUTH_CLIENT_ID as string, - clientSecret: process.env.GOOGLE_OAUTH_CLIENT_SECRET as string, - }, - }, - plugins: [ - // The Convex plugin is required - convex(), - ], - }) - -export const { fetchSession, reactStartHandler, getCookieName } = - reactStartHelpers(createAuth, { - convexSiteUrl, - }) From 719cadba0975998739341910d02ad65206f3dd73 Mon Sep 17 00:00:00 2001 From: Shawn Erquhart Date: Thu, 23 Oct 2025 14:52:31 -0400 Subject: [PATCH 2/3] upgrade to @convex-dev/auth@0.9 --- convex/_generated/api.d.ts | 1436 ++++-------------------------------- package.json | 4 +- pnpm-lock.yaml | 125 +++- 3 files changed, 224 insertions(+), 1341 deletions(-) diff --git a/convex/_generated/api.d.ts b/convex/_generated/api.d.ts index 860f0d8ae..6f1bdb17f 100644 --- a/convex/_generated/api.d.ts +++ b/convex/_generated/api.d.ts @@ -380,66 +380,6 @@ export declare const components: { }; model: "oauthConsent"; } - | { - data: { - createdAt: number; - name: string; - organizationId: string; - updatedAt?: null | number; - }; - model: "team"; - } - | { - data: { - createdAt?: null | number; - teamId: string; - userId: string; - }; - model: "teamMember"; - } - | { - data: { - createdAt: number; - logo?: null | string; - metadata?: null | string; - name: string; - slug?: null | string; - }; - model: "organization"; - } - | { - data: { - createdAt: number; - organizationId: string; - role: string; - userId: string; - }; - model: "member"; - } - | { - data: { - email: string; - expiresAt: number; - inviterId: string; - organizationId: string; - role?: null | string; - status: string; - teamId?: null | string; - }; - model: "invitation"; - } - | { - data: { - domain: string; - issuer: string; - oidcConfig?: null | string; - organizationId?: null | string; - providerId: string; - samlConfig?: null | string; - userId?: null | string; - }; - model: "ssoProvider"; - } | { data: { createdAt: number; @@ -448,32 +388,6 @@ export declare const components: { }; model: "jwks"; } - | { - data: { - cancelAtPeriodEnd?: null | boolean; - periodEnd?: null | number; - periodStart?: null | number; - plan: string; - referenceId: string; - seats?: null | number; - status?: null | string; - stripeCustomerId?: null | string; - stripeSubscriptionId?: null | string; - trialEnd?: null | number; - trialStart?: null | number; - }; - model: "subscription"; - } - | { - data: { - address: string; - chainId: number; - createdAt: number; - isPrimary?: null | boolean; - userId: string; - }; - model: "walletAddress"; - } | { data: { count?: null | number; @@ -514,7 +428,7 @@ export declare const components: { | "phoneNumber" | "phoneNumberVerified" | "userId" - | "id"; + | "_id"; operator?: | "lt" | "lte" @@ -522,6 +436,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -547,7 +462,7 @@ export declare const components: { | "ipAddress" | "userAgent" | "userId" - | "id"; + | "_id"; operator?: | "lt" | "lte" @@ -555,6 +470,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -585,7 +501,7 @@ export declare const components: { | "password" | "createdAt" | "updatedAt" - | "id"; + | "_id"; operator?: | "lt" | "lte" @@ -593,6 +509,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -616,7 +533,7 @@ export declare const components: { | "expiresAt" | "createdAt" | "updatedAt" - | "id"; + | "_id"; operator?: | "lt" | "lte" @@ -624,6 +541,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -641,7 +559,7 @@ export declare const components: { model: "twoFactor"; where?: Array<{ connector?: "AND" | "OR"; - field: "secret" | "backupCodes" | "userId" | "id"; + field: "secret" | "backupCodes" | "userId" | "_id"; operator?: | "lt" | "lte" @@ -649,6 +567,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -677,7 +596,7 @@ export declare const components: { | "transports" | "createdAt" | "aaguid" - | "id"; + | "_id"; operator?: | "lt" | "lte" @@ -685,6 +604,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -714,7 +634,7 @@ export declare const components: { | "userId" | "createdAt" | "updatedAt" - | "id"; + | "_id"; operator?: | "lt" | "lte" @@ -722,6 +642,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -749,7 +670,7 @@ export declare const components: { | "scopes" | "createdAt" | "updatedAt" - | "id"; + | "_id"; operator?: | "lt" | "lte" @@ -757,6 +678,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -781,189 +703,7 @@ export declare const components: { | "createdAt" | "updatedAt" | "consentGiven" - | "id"; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - model: "team"; - where?: Array<{ - connector?: "AND" | "OR"; - field: - | "name" - | "organizationId" - | "createdAt" - | "updatedAt" - | "id"; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - model: "teamMember"; - where?: Array<{ - connector?: "AND" | "OR"; - field: "teamId" | "userId" | "createdAt" | "id"; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - model: "organization"; - where?: Array<{ - connector?: "AND" | "OR"; - field: - | "name" - | "slug" - | "logo" - | "createdAt" - | "metadata" - | "id"; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - model: "member"; - where?: Array<{ - connector?: "AND" | "OR"; - field: - | "organizationId" - | "userId" - | "role" - | "createdAt" - | "id"; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - model: "invitation"; - where?: Array<{ - connector?: "AND" | "OR"; - field: - | "organizationId" - | "email" - | "role" - | "teamId" - | "status" - | "expiresAt" - | "inviterId" - | "id"; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - model: "ssoProvider"; - where?: Array<{ - connector?: "AND" | "OR"; - field: - | "issuer" - | "oidcConfig" - | "samlConfig" - | "userId" - | "providerId" - | "organizationId" - | "domain" - | "id"; + | "_id"; operator?: | "lt" | "lte" @@ -971,6 +711,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -988,75 +729,7 @@ export declare const components: { model: "jwks"; where?: Array<{ connector?: "AND" | "OR"; - field: "publicKey" | "privateKey" | "createdAt" | "id"; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - model: "subscription"; - where?: Array<{ - connector?: "AND" | "OR"; - field: - | "plan" - | "referenceId" - | "stripeCustomerId" - | "stripeSubscriptionId" - | "status" - | "periodStart" - | "periodEnd" - | "trialStart" - | "trialEnd" - | "cancelAtPeriodEnd" - | "seats" - | "id"; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - model: "walletAddress"; - where?: Array<{ - connector?: "AND" | "OR"; - field: - | "userId" - | "address" - | "chainId" - | "isPrimary" - | "createdAt" - | "id"; + field: "publicKey" | "privateKey" | "createdAt" | "_id"; operator?: | "lt" | "lte" @@ -1064,6 +737,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1081,7 +755,7 @@ export declare const components: { model: "rateLimit"; where?: Array<{ connector?: "AND" | "OR"; - field: "key" | "count" | "lastRequest" | "id"; + field: "key" | "count" | "lastRequest" | "_id"; operator?: | "lt" | "lte" @@ -1089,6 +763,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1106,7 +781,7 @@ export declare const components: { model: "ratelimit"; where?: Array<{ connector?: "AND" | "OR"; - field: "key" | "count" | "lastRequest" | "id"; + field: "key" | "count" | "lastRequest" | "_id"; operator?: | "lt" | "lte" @@ -1114,6 +789,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1162,7 +838,7 @@ export declare const components: { | "phoneNumber" | "phoneNumberVerified" | "userId" - | "id"; + | "_id"; operator?: | "lt" | "lte" @@ -1170,6 +846,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1195,7 +872,7 @@ export declare const components: { | "ipAddress" | "userAgent" | "userId" - | "id"; + | "_id"; operator?: | "lt" | "lte" @@ -1203,6 +880,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1233,7 +911,7 @@ export declare const components: { | "password" | "createdAt" | "updatedAt" - | "id"; + | "_id"; operator?: | "lt" | "lte" @@ -1241,6 +919,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1264,7 +943,7 @@ export declare const components: { | "expiresAt" | "createdAt" | "updatedAt" - | "id"; + | "_id"; operator?: | "lt" | "lte" @@ -1272,6 +951,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1289,7 +969,7 @@ export declare const components: { model: "twoFactor"; where?: Array<{ connector?: "AND" | "OR"; - field: "secret" | "backupCodes" | "userId" | "id"; + field: "secret" | "backupCodes" | "userId" | "_id"; operator?: | "lt" | "lte" @@ -1297,6 +977,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1325,7 +1006,7 @@ export declare const components: { | "transports" | "createdAt" | "aaguid" - | "id"; + | "_id"; operator?: | "lt" | "lte" @@ -1333,6 +1014,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1362,7 +1044,7 @@ export declare const components: { | "userId" | "createdAt" | "updatedAt" - | "id"; + | "_id"; operator?: | "lt" | "lte" @@ -1370,6 +1052,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1397,7 +1080,7 @@ export declare const components: { | "scopes" | "createdAt" | "updatedAt" - | "id"; + | "_id"; operator?: | "lt" | "lte" @@ -1405,6 +1088,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1429,7 +1113,7 @@ export declare const components: { | "createdAt" | "updatedAt" | "consentGiven" - | "id"; + | "_id"; operator?: | "lt" | "lte" @@ -1437,6 +1121,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1451,260 +1136,10 @@ export declare const components: { }>; } | { - model: "team"; + model: "jwks"; where?: Array<{ connector?: "AND" | "OR"; - field: - | "name" - | "organizationId" - | "createdAt" - | "updatedAt" - | "id"; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - model: "teamMember"; - where?: Array<{ - connector?: "AND" | "OR"; - field: "teamId" | "userId" | "createdAt" | "id"; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - model: "organization"; - where?: Array<{ - connector?: "AND" | "OR"; - field: - | "name" - | "slug" - | "logo" - | "createdAt" - | "metadata" - | "id"; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - model: "member"; - where?: Array<{ - connector?: "AND" | "OR"; - field: - | "organizationId" - | "userId" - | "role" - | "createdAt" - | "id"; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - model: "invitation"; - where?: Array<{ - connector?: "AND" | "OR"; - field: - | "organizationId" - | "email" - | "role" - | "teamId" - | "status" - | "expiresAt" - | "inviterId" - | "id"; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - model: "ssoProvider"; - where?: Array<{ - connector?: "AND" | "OR"; - field: - | "issuer" - | "oidcConfig" - | "samlConfig" - | "userId" - | "providerId" - | "organizationId" - | "domain" - | "id"; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - model: "jwks"; - where?: Array<{ - connector?: "AND" | "OR"; - field: "publicKey" | "privateKey" | "createdAt" | "id"; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - model: "subscription"; - where?: Array<{ - connector?: "AND" | "OR"; - field: - | "plan" - | "referenceId" - | "stripeCustomerId" - | "stripeSubscriptionId" - | "status" - | "periodStart" - | "periodEnd" - | "trialStart" - | "trialEnd" - | "cancelAtPeriodEnd" - | "seats" - | "id"; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - model: "walletAddress"; - where?: Array<{ - connector?: "AND" | "OR"; - field: - | "userId" - | "address" - | "chainId" - | "isPrimary" - | "createdAt" - | "id"; + field: "publicKey" | "privateKey" | "createdAt" | "_id"; operator?: | "lt" | "lte" @@ -1712,6 +1147,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1729,7 +1165,7 @@ export declare const components: { model: "rateLimit"; where?: Array<{ connector?: "AND" | "OR"; - field: "key" | "count" | "lastRequest" | "id"; + field: "key" | "count" | "lastRequest" | "_id"; operator?: | "lt" | "lte" @@ -1737,6 +1173,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1754,7 +1191,7 @@ export declare const components: { model: "ratelimit"; where?: Array<{ connector?: "AND" | "OR"; - field: "key" | "count" | "lastRequest" | "id"; + field: "key" | "count" | "lastRequest" | "_id"; operator?: | "lt" | "lte" @@ -1762,6 +1199,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1794,15 +1232,7 @@ export declare const components: { | "oauthApplication" | "oauthAccessToken" | "oauthConsent" - | "team" - | "teamMember" - | "organization" - | "member" - | "invitation" - | "ssoProvider" | "jwks" - | "subscription" - | "walletAddress" | "rateLimit" | "ratelimit"; offset?: number; @@ -1825,6 +1255,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1854,15 +1285,7 @@ export declare const components: { | "oauthApplication" | "oauthAccessToken" | "oauthConsent" - | "team" - | "teamMember" - | "organization" - | "member" - | "invitation" - | "ssoProvider" | "jwks" - | "subscription" - | "walletAddress" | "rateLimit" | "ratelimit"; select?: Array; @@ -1876,6 +1299,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1891,6 +1315,12 @@ export declare const components: { }, any >; + migrationRemoveUserId: FunctionReference< + "mutation", + "internal", + { userId: string }, + any + >; updateMany: FunctionReference< "mutation", "internal", @@ -1929,7 +1359,7 @@ export declare const components: { | "phoneNumber" | "phoneNumberVerified" | "userId" - | "id"; + | "_id"; operator?: | "lt" | "lte" @@ -1937,6 +1367,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1971,7 +1402,7 @@ export declare const components: { | "ipAddress" | "userAgent" | "userId" - | "id"; + | "_id"; operator?: | "lt" | "lte" @@ -1979,6 +1410,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -2023,7 +1455,7 @@ export declare const components: { | "password" | "createdAt" | "updatedAt" - | "id"; + | "_id"; operator?: | "lt" | "lte" @@ -2031,6 +1463,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -2061,7 +1494,7 @@ export declare const components: { | "expiresAt" | "createdAt" | "updatedAt" - | "id"; + | "_id"; operator?: | "lt" | "lte" @@ -2069,6 +1502,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -2091,7 +1525,7 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: "secret" | "backupCodes" | "userId" | "id"; + field: "secret" | "backupCodes" | "userId" | "_id"; operator?: | "lt" | "lte" @@ -2099,6 +1533,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -2139,7 +1574,7 @@ export declare const components: { | "transports" | "createdAt" | "aaguid" - | "id"; + | "_id"; operator?: | "lt" | "lte" @@ -2147,6 +1582,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -2189,7 +1625,7 @@ export declare const components: { | "userId" | "createdAt" | "updatedAt" - | "id"; + | "_id"; operator?: | "lt" | "lte" @@ -2197,6 +1633,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -2235,7 +1672,7 @@ export declare const components: { | "scopes" | "createdAt" | "updatedAt" - | "id"; + | "_id"; operator?: | "lt" | "lte" @@ -2243,6 +1680,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -2275,7 +1713,7 @@ export declare const components: { | "createdAt" | "updatedAt" | "consentGiven" - | "id"; + | "_id"; operator?: | "lt" | "lte" @@ -2283,6 +1721,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -2297,21 +1736,15 @@ export declare const components: { }>; } | { - model: "team"; + model: "jwks"; update: { createdAt?: number; - name?: string; - organizationId?: string; - updatedAt?: null | number; + privateKey?: string; + publicKey?: string; }; where?: Array<{ connector?: "AND" | "OR"; - field: - | "name" - | "organizationId" - | "createdAt" - | "updatedAt" - | "id"; + field: "publicKey" | "privateKey" | "createdAt" | "_id"; operator?: | "lt" | "lte" @@ -2319,6 +1752,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -2333,15 +1767,15 @@ export declare const components: { }>; } | { - model: "teamMember"; + model: "rateLimit"; update: { - createdAt?: null | number; - teamId?: string; - userId?: string; + count?: null | number; + key?: null | string; + lastRequest?: null | number; }; where?: Array<{ connector?: "AND" | "OR"; - field: "teamId" | "userId" | "createdAt" | "id"; + field: "key" | "count" | "lastRequest" | "_id"; operator?: | "lt" | "lte" @@ -2349,6 +1783,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -2363,23 +1798,11 @@ export declare const components: { }>; } | { - model: "organization"; - update: { - createdAt?: number; - logo?: null | string; - metadata?: null | string; - name?: string; - slug?: null | string; - }; + model: "ratelimit"; + update: { count?: number; key?: string; lastRequest?: number }; where?: Array<{ connector?: "AND" | "OR"; - field: - | "name" - | "slug" - | "logo" - | "createdAt" - | "metadata" - | "id"; + field: "key" | "count" | "lastRequest" | "_id"; operator?: | "lt" | "lte" @@ -2387,6 +1810,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -2399,320 +1823,26 @@ export declare const components: { | Array | null; }>; - } + }; + onUpdateHandle?: string; + paginationOpts: { + cursor: string | null; + endCursor?: string | null; + id?: number; + maximumBytesRead?: number; + maximumRowsRead?: number; + numItems: number; + }; + }, + any + >; + updateOne: FunctionReference< + "mutation", + "internal", + { + input: | { - model: "member"; - update: { - createdAt?: number; - organizationId?: string; - role?: string; - userId?: string; - }; - where?: Array<{ - connector?: "AND" | "OR"; - field: - | "organizationId" - | "userId" - | "role" - | "createdAt" - | "id"; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - model: "invitation"; - update: { - email?: string; - expiresAt?: number; - inviterId?: string; - organizationId?: string; - role?: null | string; - status?: string; - teamId?: null | string; - }; - where?: Array<{ - connector?: "AND" | "OR"; - field: - | "organizationId" - | "email" - | "role" - | "teamId" - | "status" - | "expiresAt" - | "inviterId" - | "id"; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - model: "ssoProvider"; - update: { - domain?: string; - issuer?: string; - oidcConfig?: null | string; - organizationId?: null | string; - providerId?: string; - samlConfig?: null | string; - userId?: null | string; - }; - where?: Array<{ - connector?: "AND" | "OR"; - field: - | "issuer" - | "oidcConfig" - | "samlConfig" - | "userId" - | "providerId" - | "organizationId" - | "domain" - | "id"; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - model: "jwks"; - update: { - createdAt?: number; - privateKey?: string; - publicKey?: string; - }; - where?: Array<{ - connector?: "AND" | "OR"; - field: "publicKey" | "privateKey" | "createdAt" | "id"; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - model: "subscription"; - update: { - cancelAtPeriodEnd?: null | boolean; - periodEnd?: null | number; - periodStart?: null | number; - plan?: string; - referenceId?: string; - seats?: null | number; - status?: null | string; - stripeCustomerId?: null | string; - stripeSubscriptionId?: null | string; - trialEnd?: null | number; - trialStart?: null | number; - }; - where?: Array<{ - connector?: "AND" | "OR"; - field: - | "plan" - | "referenceId" - | "stripeCustomerId" - | "stripeSubscriptionId" - | "status" - | "periodStart" - | "periodEnd" - | "trialStart" - | "trialEnd" - | "cancelAtPeriodEnd" - | "seats" - | "id"; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - model: "walletAddress"; - update: { - address?: string; - chainId?: number; - createdAt?: number; - isPrimary?: null | boolean; - userId?: string; - }; - where?: Array<{ - connector?: "AND" | "OR"; - field: - | "userId" - | "address" - | "chainId" - | "isPrimary" - | "createdAt" - | "id"; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - model: "rateLimit"; - update: { - count?: null | number; - key?: null | string; - lastRequest?: null | number; - }; - where?: Array<{ - connector?: "AND" | "OR"; - field: "key" | "count" | "lastRequest" | "id"; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - model: "ratelimit"; - update: { count?: number; key?: string; lastRequest?: number }; - where?: Array<{ - connector?: "AND" | "OR"; - field: "key" | "count" | "lastRequest" | "id"; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - }; - onUpdateHandle?: string; - paginationOpts: { - cursor: string | null; - endCursor?: string | null; - id?: number; - maximumBytesRead?: number; - maximumRowsRead?: number; - numItems: number; - }; - }, - any - >; - updateOne: FunctionReference< - "mutation", - "internal", - { - input: - | { - model: "user"; + model: "user"; update: { createdAt?: number; displayUsername?: null | string; @@ -2744,7 +1874,7 @@ export declare const components: { | "phoneNumber" | "phoneNumberVerified" | "userId" - | "id"; + | "_id"; operator?: | "lt" | "lte" @@ -2752,6 +1882,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -2786,7 +1917,7 @@ export declare const components: { | "ipAddress" | "userAgent" | "userId" - | "id"; + | "_id"; operator?: | "lt" | "lte" @@ -2794,6 +1925,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -2838,7 +1970,7 @@ export declare const components: { | "password" | "createdAt" | "updatedAt" - | "id"; + | "_id"; operator?: | "lt" | "lte" @@ -2846,6 +1978,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -2876,7 +2009,7 @@ export declare const components: { | "expiresAt" | "createdAt" | "updatedAt" - | "id"; + | "_id"; operator?: | "lt" | "lte" @@ -2884,6 +2017,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -2906,7 +2040,7 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: "secret" | "backupCodes" | "userId" | "id"; + field: "secret" | "backupCodes" | "userId" | "_id"; operator?: | "lt" | "lte" @@ -2914,6 +2048,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -2954,7 +2089,7 @@ export declare const components: { | "transports" | "createdAt" | "aaguid" - | "id"; + | "_id"; operator?: | "lt" | "lte" @@ -2962,6 +2097,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -3004,7 +2140,7 @@ export declare const components: { | "userId" | "createdAt" | "updatedAt" - | "id"; + | "_id"; operator?: | "lt" | "lte" @@ -3012,6 +2148,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -3050,7 +2187,7 @@ export declare const components: { | "scopes" | "createdAt" | "updatedAt" - | "id"; + | "_id"; operator?: | "lt" | "lte" @@ -3058,6 +2195,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -3090,231 +2228,7 @@ export declare const components: { | "createdAt" | "updatedAt" | "consentGiven" - | "id"; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - model: "team"; - update: { - createdAt?: number; - name?: string; - organizationId?: string; - updatedAt?: null | number; - }; - where?: Array<{ - connector?: "AND" | "OR"; - field: - | "name" - | "organizationId" - | "createdAt" - | "updatedAt" - | "id"; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - model: "teamMember"; - update: { - createdAt?: null | number; - teamId?: string; - userId?: string; - }; - where?: Array<{ - connector?: "AND" | "OR"; - field: "teamId" | "userId" | "createdAt" | "id"; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - model: "organization"; - update: { - createdAt?: number; - logo?: null | string; - metadata?: null | string; - name?: string; - slug?: null | string; - }; - where?: Array<{ - connector?: "AND" | "OR"; - field: - | "name" - | "slug" - | "logo" - | "createdAt" - | "metadata" - | "id"; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - model: "member"; - update: { - createdAt?: number; - organizationId?: string; - role?: string; - userId?: string; - }; - where?: Array<{ - connector?: "AND" | "OR"; - field: - | "organizationId" - | "userId" - | "role" - | "createdAt" - | "id"; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - model: "invitation"; - update: { - email?: string; - expiresAt?: number; - inviterId?: string; - organizationId?: string; - role?: null | string; - status?: string; - teamId?: null | string; - }; - where?: Array<{ - connector?: "AND" | "OR"; - field: - | "organizationId" - | "email" - | "role" - | "teamId" - | "status" - | "expiresAt" - | "inviterId" - | "id"; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - model: "ssoProvider"; - update: { - domain?: string; - issuer?: string; - oidcConfig?: null | string; - organizationId?: null | string; - providerId?: string; - samlConfig?: null | string; - userId?: null | string; - }; - where?: Array<{ - connector?: "AND" | "OR"; - field: - | "issuer" - | "oidcConfig" - | "samlConfig" - | "userId" - | "providerId" - | "organizationId" - | "domain" - | "id"; + | "_id"; operator?: | "lt" | "lte" @@ -3322,6 +2236,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -3344,95 +2259,7 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: "publicKey" | "privateKey" | "createdAt" | "id"; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - model: "subscription"; - update: { - cancelAtPeriodEnd?: null | boolean; - periodEnd?: null | number; - periodStart?: null | number; - plan?: string; - referenceId?: string; - seats?: null | number; - status?: null | string; - stripeCustomerId?: null | string; - stripeSubscriptionId?: null | string; - trialEnd?: null | number; - trialStart?: null | number; - }; - where?: Array<{ - connector?: "AND" | "OR"; - field: - | "plan" - | "referenceId" - | "stripeCustomerId" - | "stripeSubscriptionId" - | "status" - | "periodStart" - | "periodEnd" - | "trialStart" - | "trialEnd" - | "cancelAtPeriodEnd" - | "seats" - | "id"; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } - | { - model: "walletAddress"; - update: { - address?: string; - chainId?: number; - createdAt?: number; - isPrimary?: null | boolean; - userId?: string; - }; - where?: Array<{ - connector?: "AND" | "OR"; - field: - | "userId" - | "address" - | "chainId" - | "isPrimary" - | "createdAt" - | "id"; + field: "publicKey" | "privateKey" | "createdAt" | "_id"; operator?: | "lt" | "lte" @@ -3440,6 +2267,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -3462,7 +2290,7 @@ export declare const components: { }; where?: Array<{ connector?: "AND" | "OR"; - field: "key" | "count" | "lastRequest" | "id"; + field: "key" | "count" | "lastRequest" | "_id"; operator?: | "lt" | "lte" @@ -3470,6 +2298,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -3488,7 +2317,7 @@ export declare const components: { update: { count?: number; key?: string; lastRequest?: number }; where?: Array<{ connector?: "AND" | "OR"; - field: "key" | "count" | "lastRequest" | "id"; + field: "key" | "count" | "lastRequest" | "_id"; operator?: | "lt" | "lte" @@ -3496,6 +2325,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" diff --git a/package.json b/package.json index a59d4d989..9311f8f36 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "@auth/core": "0.37.0", "@clerk/tanstack-react-start": "^0.21.5", "@convex-dev/auth": "^0.0.88", - "@convex-dev/better-auth": "0.8", + "@convex-dev/better-auth": "0.9", "@convex-dev/react-query": "0.0.0-alpha.11", "@erquhart/convex-oss-stats": "^0.8.1", "@floating-ui/react": "^0.27.8", @@ -53,7 +53,7 @@ "@vitejs/plugin-react": "^4.3.3", "algoliasearch": "^5.23.4", "axios": "^1.6.7", - "better-auth": "^1.3.8", + "better-auth": "^1.3.27", "cmdk": "^1.1.1", "convex": "^1.25.4", "convex-oss-stats": "link:../../../erquhart/convex-oss-stats", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6cf43bf7c..99985494c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -18,8 +18,8 @@ importers: specifier: ^0.0.88 version: 0.0.88(@auth/core@0.37.0)(convex@1.27.0(@clerk/clerk-react@5.48.1(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0))(react@19.0.0) '@convex-dev/better-auth': - specifier: '0.8' - version: 0.8.9(@standard-schema/spec@1.0.0)(better-auth@1.3.8(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(convex@1.27.0(@clerk/clerk-react@5.48.1(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0))(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(typescript@5.9.2) + specifier: '0.9' + version: 0.9.6(@standard-schema/spec@1.0.0)(better-auth@1.3.27(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(solid-js@1.9.9))(convex@1.27.0(@clerk/clerk-react@5.48.1(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0))(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(typescript@5.9.2) '@convex-dev/react-query': specifier: 0.0.0-alpha.11 version: 0.0.0-alpha.11(@standard-schema/spec@1.0.0)(@tanstack/react-query@5.90.2(react@19.0.0))(convex@1.27.0(@clerk/clerk-react@5.48.1(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0))(react@19.0.0)(typescript@5.9.2)(zod@4.0.17) @@ -117,8 +117,8 @@ importers: specifier: ^1.6.7 version: 1.7.8 better-auth: - specifier: ^1.3.8 - version: 1.3.8(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + specifier: ^1.3.27 + version: 1.3.27(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(solid-js@1.9.9) cmdk: specifier: ^1.1.1 version: 1.1.1(@types/react-dom@18.3.1)(@types/react@18.3.12)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) @@ -1091,8 +1091,11 @@ packages: resolution: {integrity: sha512-bkFqkLhh3pMBUQQkpVgWDWq/lqzc2678eUyDlTBhRqhCHFguYYGM0Efga7tYk4TogG/3x0EEl66/OQ+WGbWB/Q==} engines: {node: '>=6.9.0'} - '@better-auth/utils@0.2.6': - resolution: {integrity: sha512-3y/vaL5Ox33dBwgJ6ub3OPkVqr6B5xL2kgxNHG8eHZuryLyG/4JSPGqjbdRSgjuy9kALUZYDFl+ORIAxlWMSuA==} + '@better-auth/core@1.3.27': + resolution: {integrity: sha512-3Sfdax6MQyronY+znx7bOsfQHI6m1SThvJWb0RDscFEAhfqLy95k1sl+/PgGyg0cwc2cUXoEiAOSqYdFYrg3vA==} + + '@better-auth/utils@0.3.0': + resolution: {integrity: sha512-W+Adw6ZA6mgvnSnhOki270rwJ42t4XzSK6YWGF//BbVXL6SwCLWfyzBc1lN2m/4RM28KubdBKQ4X5VMoLRNPQw==} '@better-fetch/fetch@1.1.18': resolution: {integrity: sha512-rEFOE1MYIsBmoMJtQbl32PGHHXuG2hDxvEd7rUHE0vCBoFQVSDqaVs9hkZEtHCxRoY+CljXKFCOuJ8uxqw1LcA==} @@ -1216,10 +1219,10 @@ packages: react: optional: true - '@convex-dev/better-auth@0.8.9': - resolution: {integrity: sha512-t6x2lYsgv0sGL14xmIsTqxVltkS//mWtIjb+Wm39rWUCgeqmCTqsyhQnmTDQNwaqZS0sH0WfTObNHu3xbCSx1w==} + '@convex-dev/better-auth@0.9.6': + resolution: {integrity: sha512-wqwGnvjJmy5WZeRK3nO+o0P95brdIfBbCFzIlJeRoXOP4CgYPaDBZNFZY+W5Zx6Zvnai8WZ2wjTr+jvd9bzJ2A==} peerDependencies: - better-auth: 1.3.8 + better-auth: 1.3.27 convex: ^1.26.2 react: ^18.3.1 || ^19.0.0 react-dom: ^18.3.1 || ^19.0.0 @@ -2097,13 +2100,18 @@ packages: '@nicolo-ribaudo/eslint-scope-5-internals@5.1.1-v1': resolution: {integrity: sha512-54/JRvkLIzzDWshCWfuhadfrfZVPiElY8Fcgmg1HroEly/EDSszzhBAsarCux+D/kOslTRquNzuyGSmUSTTHGg==} - '@noble/ciphers@0.6.0': - resolution: {integrity: sha512-mIbq/R9QXk5/cTfESb1OKtyFnk7oc1Om/8onA1158K9/OZUQFDEVy55jVTato+xmp3XX6F6Qh0zz0Nc1AxAlRQ==} + '@noble/ciphers@2.0.1': + resolution: {integrity: sha512-xHK3XHPUW8DTAobU+G0XT+/w+JLM7/8k1UFdB5xg/zTFPnFCobhftzw8wl4Lw2aq/Rvir5pxfZV5fEazmeCJ2g==} + engines: {node: '>= 20.19.0'} '@noble/hashes@1.8.0': resolution: {integrity: sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==} engines: {node: ^14.21.3 || >=16} + '@noble/hashes@2.0.1': + resolution: {integrity: sha512-XlOlEbQcE9fmuXxrVTXCTlG2nlRXa9Rj3rr5Ue/+tX+nmkgbX720YHh0VR3hBF9xDvwnb8D2shVGOwNx+ulArw==} + engines: {node: '>= 20.19.0'} + '@node-rs/argon2-android-arm-eabi@1.7.0': resolution: {integrity: sha512-udDqkr5P9E+wYX1SZwAVPdyfYvaF4ry9Tm+R9LkfSHbzWH0uhU6zjIwNRp7m+n4gx691rk+lqqDAIP8RLKwbhg==} engines: {node: '>= 10'} @@ -4258,19 +4266,37 @@ packages: peerDependencies: ajv: 4.11.8 - 8 - better-auth@1.3.8: - resolution: {integrity: sha512-uRFzHbWkhr8eWNy+BJwyMnrZPOvQjwrcLND3nc6jusRteYA9cjeRGElgCPTWTIyWUfzaQ708Lb5Mdq9Gv41Qpw==} + better-auth@1.3.27: + resolution: {integrity: sha512-SwiGAJ7yU6dBhNg0NdV1h5M8T5sa7/AszZVc4vBfMDrLLmvUfbt9JoJ0uRUJUEdKRAAxTyl9yA+F3+GhtAD80w==} peerDependencies: - react: ^18.0.0 || ^19.0.0 - react-dom: ^18.0.0 || ^19.0.0 + '@lynx-js/react': '*' + '@sveltejs/kit': '*' + next: '*' + react: '*' + react-dom: '*' + solid-js: '*' + svelte: '*' + vue: '*' peerDependenciesMeta: + '@lynx-js/react': + optional: true + '@sveltejs/kit': + optional: true + next: + optional: true react: optional: true react-dom: optional: true + solid-js: + optional: true + svelte: + optional: true + vue: + optional: true - better-call@1.0.16: - resolution: {integrity: sha512-42dgJ1rOtc0anOoxjXPOWuel/Z/4aeO7EJ2SiXNwvlkySSgjXhNjAjTMWa8DL1nt6EXS3jl3VKC3mPsU/lUgVA==} + better-call@1.0.19: + resolution: {integrity: sha512-sI3GcA1SCVa3H+CDHl8W8qzhlrckwXOTKhqq3OOPXjgn5aTOMIqGY34zLY/pHA6tRRMjTUC3lz5Mi7EbDA24Kw==} binary-extensions@2.2.0: resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==} @@ -6083,6 +6109,9 @@ packages: jose@5.10.0: resolution: {integrity: sha512-s+3Al/p9g32Iq+oqXxkW//7jk2Vig6FF1CFqzVXoTUXt2qz89YWbL+OwS17NFYEvxC35n0FKeGO2LGYSxeM2Gg==} + jose@6.1.0: + resolution: {integrity: sha512-TTQJyoEoKcC1lscpVDCSsVgYzUDg/0Bt3WE//WiTPK6uOCQC2KZS4MpugbMWt/zyjkopgZoXhZuCi00gLudfUA==} + jpeg-js@0.4.4: resolution: {integrity: sha512-WZzeDOEtTOBK4Mdsar0IqEU5sMr3vSV2RqkAIzUEV2BHnUfKGyswWFPFwK5EeDo93K3FohSHbLAjj0s1Wzd+dg==} @@ -6604,9 +6633,9 @@ packages: engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true - nanostores@0.11.4: - resolution: {integrity: sha512-k1oiVNN4hDK8NcNERSZLQiMfRzEGtfnvZvdBvey3SQbgn8Dcrk0h1I6vpxApjb10PFUflZrgJ2WEZyJQ+5v7YQ==} - engines: {node: ^18.0.0 || >=20.0.0} + nanostores@1.0.1: + resolution: {integrity: sha512-kNZ9xnoJYKg/AfxjrVL4SS0fKX++4awQReGqWnwTRHxeHGZ1FJFVgTqr/eMrNQdp0Tz7M7tG/TDaX8QfHDwVCw==} + engines: {node: ^20.0.0 || >=22.0.0} natural-compare-lite@1.4.0: resolution: {integrity: sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==} @@ -7272,6 +7301,9 @@ packages: remeda@2.26.1: resolution: {integrity: sha512-hpiLfhUwkJhiMS3Z7dRrygcRdkMRZASw5qUdNdi33x1/Y9y/J5q5TyLyf8btDoVLIcsg/4fzPdaGXDTbnl+ixw==} + remeda@2.32.0: + resolution: {integrity: sha512-BZx9DsT4FAgXDTOdgJIc5eY6ECIXMwtlSPQoPglF20ycSWigttDDe88AozEsPPT4OWk5NujroGSBC1phw5uU+w==} + remix-utils@8.5.0: resolution: {integrity: sha512-Wf9OGSJveBaVHKptbEgxc+DwKRUUGOH+aiaBlsrAA2b4F+gNtCkvaZzA7Tp+1esBElRcRvMZQq/0aSSWFMP18A==} engines: {node: '>=20.0.0'} @@ -7428,6 +7460,11 @@ packages: engines: {node: '>=10'} hasBin: true + semver@7.7.3: + resolution: {integrity: sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==} + engines: {node: '>=10'} + hasBin: true + serialize-javascript@6.0.2: resolution: {integrity: sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==} @@ -9456,9 +9493,12 @@ snapshots: '@babel/helper-string-parser': 7.27.1 '@babel/helper-validator-identifier': 7.27.1 - '@better-auth/utils@0.2.6': + '@better-auth/core@1.3.27': dependencies: - uncrypto: 0.1.3 + better-call: 1.0.19 + zod: 4.1.9 + + '@better-auth/utils@0.3.0': {} '@better-fetch/fetch@1.1.18': {} @@ -9615,16 +9655,16 @@ snapshots: optionalDependencies: react: 19.0.0 - '@convex-dev/better-auth@0.8.9(@standard-schema/spec@1.0.0)(better-auth@1.3.8(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(convex@1.27.0(@clerk/clerk-react@5.48.1(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0))(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(typescript@5.9.2)': + '@convex-dev/better-auth@0.9.6(@standard-schema/spec@1.0.0)(better-auth@1.3.27(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(solid-js@1.9.9))(convex@1.27.0(@clerk/clerk-react@5.48.1(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0))(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(typescript@5.9.2)': dependencies: - '@better-fetch/fetch': 1.1.18 - better-auth: 1.3.8(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + better-auth: 1.3.27(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(solid-js@1.9.9) common-tags: 1.8.2 convex: 1.27.0(@clerk/clerk-react@5.48.1(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0) convex-helpers: 0.1.104(@standard-schema/spec@1.0.0)(convex@1.27.0(@clerk/clerk-react@5.48.1(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(react@19.0.0))(react@19.0.0)(typescript@5.9.2)(zod@3.25.76) - is-network-error: 1.1.0 react: 19.0.0 react-dom: 19.0.0(react@19.0.0) + remeda: 2.32.0 + semver: 7.7.3 type-fest: 4.41.0 zod: 3.25.76 transitivePeerDependencies: @@ -10525,10 +10565,12 @@ snapshots: dependencies: eslint-scope: 5.1.1 - '@noble/ciphers@0.6.0': {} + '@noble/ciphers@2.0.1': {} '@noble/hashes@1.8.0': {} + '@noble/hashes@2.0.1': {} + '@node-rs/argon2-android-arm-eabi@1.7.0': optional: true @@ -13002,26 +13044,29 @@ snapshots: jsonpointer: 5.0.1 leven: 3.1.0 - better-auth@1.3.8(react-dom@19.0.0(react@19.0.0))(react@19.0.0): + better-auth@1.3.27(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(solid-js@1.9.9): dependencies: - '@better-auth/utils': 0.2.6 + '@better-auth/core': 1.3.27 + '@better-auth/utils': 0.3.0 '@better-fetch/fetch': 1.1.18 - '@noble/ciphers': 0.6.0 - '@noble/hashes': 1.8.0 + '@noble/ciphers': 2.0.1 + '@noble/hashes': 2.0.1 '@simplewebauthn/browser': 13.1.2 '@simplewebauthn/server': 13.1.2 - better-call: 1.0.16 + better-call: 1.0.19 defu: 6.1.4 - jose: 5.10.0 + jose: 6.1.0 kysely: 0.28.5 - nanostores: 0.11.4 + nanostores: 1.0.1 zod: 4.1.9 optionalDependencies: react: 19.0.0 react-dom: 19.0.0(react@19.0.0) + solid-js: 1.9.9 - better-call@1.0.16: + better-call@1.0.19: dependencies: + '@better-auth/utils': 0.3.0 '@better-fetch/fetch': 1.1.18 rou3: 0.5.1 set-cookie-parser: 2.7.1 @@ -15025,6 +15070,8 @@ snapshots: jose@5.10.0: {} + jose@6.1.0: {} + jpeg-js@0.4.4: {} js-cookie@3.0.5: {} @@ -15549,7 +15596,7 @@ snapshots: nanoid@3.3.11: {} - nanostores@0.11.4: {} + nanostores@1.0.1: {} natural-compare-lite@1.4.0: {} @@ -16270,6 +16317,10 @@ snapshots: dependencies: type-fest: 4.41.0 + remeda@2.32.0: + dependencies: + type-fest: 4.41.0 + remix-utils@8.5.0(@oslojs/crypto@1.0.1)(@oslojs/encoding@1.1.0)(react@19.0.0)(zod@4.0.17): dependencies: type-fest: 4.41.0 @@ -16400,6 +16451,8 @@ snapshots: semver@7.7.2: {} + semver@7.7.3: {} + serialize-javascript@6.0.2: dependencies: randombytes: 2.1.0 From e79f11a443948f915cebfc8b16d64578e170a028 Mon Sep 17 00:00:00 2001 From: Shawn Erquhart Date: Thu, 23 Oct 2025 14:55:34 -0400 Subject: [PATCH 3/3] inline reactStartHandler --- src/routes/api/auth/$.ts | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/routes/api/auth/$.ts b/src/routes/api/auth/$.ts index 461e67dc1..bc1999339 100644 --- a/src/routes/api/auth/$.ts +++ b/src/routes/api/auth/$.ts @@ -1,5 +1,28 @@ import { createFileRoute } from '@tanstack/react-router' -import { reactStartHandler } from '@convex-dev/better-auth/react-start' +//import { reactStartHandler } from '@convex-dev/better-auth/react-start' + +export const reactStartHandler = ( + request: Request, + opts?: { convexSiteUrl?: string; verbose?: boolean } +) => { + const requestUrl = new URL(request.url); + const convexSiteUrl = opts?.convexSiteUrl ?? process.env.VITE_CONVEX_SITE_URL; + if (!convexSiteUrl) { + throw new Error("VITE_CONVEX_SITE_URL is not set"); + } + const nextUrl = `${convexSiteUrl}${requestUrl.pathname}${requestUrl.search}`; + const headers = new Headers(request.headers); + headers.set("accept-encoding", "application/json"); + return fetch(nextUrl, { + method: request.method, + headers, + redirect: "manual", + body: request.body, + // @ts-expect-error - duplex is required for streaming request bodies in modern fetch + duplex: "half", + }); +}; + export const Route = createFileRoute('/api/auth/$')({ server: {