diff --git a/convex/_generated/api.d.ts b/convex/_generated/api.d.ts index 1c6f029a4..6f1bdb17f 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; @@ -425,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; @@ -493,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; @@ -526,211 +395,40 @@ export declare const components: { lastRequest?: null | number; }; model: "rateLimit"; + } + | { + data: { count: number; key: string; lastRequest: number }; + model: "ratelimit"; }; - }, - 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; - }; + onCreateHandle?: string; 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; - }>; - }, - any - >; - findMany: FunctionReference< - "query", - "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 - >; - findOne: FunctionReference< - "query", - "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; - }>; - }, - any - >; - getCurrentSession: FunctionReference<"query", "internal", {}, any>; - updateMany: FunctionReference< + deleteMany: 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; - emailVerified?: boolean; - image?: null | string; - isAnonymous?: null | boolean; - 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; - username?: null | string; - }; 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" @@ -738,6 +436,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -752,35 +451,18 @@ 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; - userAgent?: null | string; - userId?: string; - }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "expiresAt" + | "token" + | "createdAt" + | "updatedAt" + | "ipAddress" + | "userAgent" + | "userId" + | "_id"; operator?: | "lt" | "lte" @@ -788,6 +470,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -802,37 +485,23 @@ 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; - accountId?: string; - createdAt?: number; - idToken?: null | string; - password?: null | string; - providerId?: string; - refreshToken?: null | string; - refreshTokenExpiresAt?: null | number; - scope?: null | string; - updatedAt?: number; - userId?: string; - }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "accountId" + | "providerId" + | "userId" + | "accessToken" + | "refreshToken" + | "idToken" + | "accessTokenExpiresAt" + | "refreshTokenExpiresAt" + | "scope" + | "password" + | "createdAt" + | "updatedAt" + | "_id"; operator?: | "lt" | "lte" @@ -840,6 +509,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -854,30 +524,16 @@ 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; - identifier?: string; - updatedAt?: number; - value?: string; - }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "identifier" + | "value" + | "expiresAt" + | "createdAt" + | "updatedAt" + | "_id"; operator?: | "lt" | "lte" @@ -885,6 +541,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -899,28 +556,10 @@ 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; - userId?: string; - }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: "secret" | "backupCodes" | "userId" | "_id"; operator?: | "lt" | "lte" @@ -928,6 +567,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -942,35 +582,21 @@ 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; - counter?: number; - createdAt?: null | number; - credentialID?: string; - deviceType?: string; - name?: null | string; - publicKey?: string; - transports?: null | string; - userId?: string; - }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "name" + | "publicKey" + | "userId" + | "credentialID" + | "counter" + | "deviceType" + | "backedUp" + | "transports" + | "createdAt" + | "aaguid" + | "_id"; operator?: | "lt" | "lte" @@ -978,6 +604,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -992,45 +619,299 @@ export declare const components: { }>; } | { - 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; - }; + 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" + | "not_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" + | "not_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" + | "not_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" + | "not_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" + | "not_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" + | "not_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" + | "not_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" + | "not_in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + } + | { + model: "account"; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "accountId" + | "providerId" + | "userId" + | "accessToken" + | "refreshToken" + | "idToken" + | "accessTokenExpiresAt" + | "refreshTokenExpiresAt" + | "scope" + | "password" + | "createdAt" + | "updatedAt" + | "_id"; operator?: | "lt" | "lte" @@ -1038,6 +919,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1052,36 +934,16 @@ 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; - createdAt?: null | number; - disabled?: null | boolean; - icon?: null | string; - metadata?: null | string; - name?: null | string; - redirectURLs?: null | string; - type?: null | string; - updatedAt?: null | number; - userId?: null | string; - }; + model: "verification"; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "identifier" + | "value" + | "expiresAt" + | "createdAt" + | "updatedAt" + | "_id"; operator?: | "lt" | "lte" @@ -1089,6 +951,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1103,34 +966,10 @@ 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; - clientId?: null | string; - createdAt?: null | number; - refreshToken?: null | string; - refreshTokenExpiresAt?: null | number; - scopes?: null | string; - updatedAt?: null | number; - userId?: null | string; - }; + model: "twoFactor"; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: "secret" | "backupCodes" | "userId" | "_id"; operator?: | "lt" | "lte" @@ -1138,6 +977,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1152,31 +992,21 @@ 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; - createdAt?: null | number; - scopes?: null | string; - updatedAt?: null | number; - userId?: null | string; - }; + model: "passkey"; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "name" + | "publicKey" + | "userId" + | "credentialID" + | "counter" + | "deviceType" + | "backedUp" + | "transports" + | "createdAt" + | "aaguid" + | "_id"; operator?: | "lt" | "lte" @@ -1184,6 +1014,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1198,29 +1029,22 @@ 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; - organizationId?: string; - updatedAt?: null | number; - }; + model: "oauthApplication"; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "name" + | "icon" + | "metadata" + | "clientId" + | "clientSecret" + | "redirectURLs" + | "type" + | "disabled" + | "userId" + | "createdAt" + | "updatedAt" + | "_id"; operator?: | "lt" | "lte" @@ -1228,6 +1052,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1242,28 +1067,20 @@ 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; - userId?: string; - }; + model: "oauthAccessToken"; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "accessToken" + | "refreshToken" + | "accessTokenExpiresAt" + | "refreshTokenExpiresAt" + | "clientId" + | "userId" + | "scopes" + | "createdAt" + | "updatedAt" + | "_id"; operator?: | "lt" | "lte" @@ -1271,6 +1088,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1285,30 +1103,17 @@ 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; - metadata?: null | string; - name?: string; - slug?: null | string; - }; + model: "oauthConsent"; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "clientId" + | "userId" + | "scopes" + | "createdAt" + | "updatedAt" + | "consentGiven" + | "_id"; operator?: | "lt" | "lte" @@ -1316,6 +1121,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1330,29 +1136,10 @@ 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; - role?: string; - userId?: string; - }; + model: "jwks"; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: "publicKey" | "privateKey" | "createdAt" | "_id"; operator?: | "lt" | "lte" @@ -1360,6 +1147,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1374,32 +1162,10 @@ 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; - inviterId?: string; - organizationId?: string; - role?: null | string; - status?: string; - teamId?: null | string; - }; + model: "rateLimit"; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: "key" | "count" | "lastRequest" | "_id"; operator?: | "lt" | "lte" @@ -1407,6 +1173,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1421,32 +1188,10 @@ 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; - oidcConfig?: null | string; - organizationId?: null | string; - providerId?: string; - samlConfig?: null | string; - userId?: null | string; - }; + model: "ratelimit"; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: "key" | "count" | "lastRequest" | "_id"; operator?: | "lt" | "lte" @@ -1454,6 +1199,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1466,30 +1212,154 @@ export declare const components: { | Array | null; }>; - } + }; + onDeleteHandle?: string; + }, + any + >; + findMany: FunctionReference< + "query", + "internal", + { + limit?: number; + model: + | "user" + | "session" + | "account" + | "verification" + | "twoFactor" + | "passkey" + | "oauthApplication" + | "oauthAccessToken" + | "oauthConsent" + | "jwks" + | "rateLimit" + | "ratelimit"; + offset?: number; + paginationOpts: { + cursor: string | null; + endCursor?: string | null; + id?: number; + maximumBytesRead?: number; + maximumRowsRead?: number; + numItems: number; + }; + sortBy?: { direction: "asc" | "desc"; field: string }; + where?: Array<{ + connector?: "AND" | "OR"; + field: string; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "not_in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + }, + any + >; + findOne: FunctionReference< + "query", + "internal", + { + model: + | "user" + | "session" + | "account" + | "verification" + | "twoFactor" + | "passkey" + | "oauthApplication" + | "oauthAccessToken" + | "oauthConsent" + | "jwks" + | "rateLimit" + | "ratelimit"; + select?: Array; + where?: Array<{ + connector?: "AND" | "OR"; + field: string; + operator?: + | "lt" + | "lte" + | "gt" + | "gte" + | "eq" + | "in" + | "not_in" + | "ne" + | "contains" + | "starts_with" + | "ends_with"; + value: + | string + | number + | boolean + | Array + | Array + | null; + }>; + }, + any + >; + migrationRemoveUserId: FunctionReference< + "mutation", + "internal", + { userId: string }, + any + >; + updateMany: FunctionReference< + "mutation", + "internal", + { + input: | { - 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; + model: "user"; update: { createdAt?: number; - privateKey?: string; - publicKey?: string; + displayUsername?: null | string; + email?: string; + emailVerified?: boolean; + image?: null | string; + isAnonymous?: null | boolean; + name?: string; + phoneNumber?: null | string; + phoneNumberVerified?: null | boolean; + twoFactorEnabled?: null | boolean; + updatedAt?: number; + userId?: null | string; + username?: null | string; }; 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" @@ -1497,6 +1367,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1511,36 +1382,27 @@ 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; + model: "session"; 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; + createdAt?: number; + expiresAt?: number; + ipAddress?: null | string; + token?: string; + updatedAt?: number; + userAgent?: null | string; + userId?: string; }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "expiresAt" + | "token" + | "createdAt" + | "updatedAt" + | "ipAddress" + | "userAgent" + | "userId" + | "_id"; operator?: | "lt" | "lte" @@ -1548,6 +1410,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1562,30 +1425,37 @@ 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; + model: "account"; update: { - address?: string; - chainId?: number; + accessToken?: null | string; + accessTokenExpiresAt?: null | number; + accountId?: string; createdAt?: number; - isPrimary?: null | boolean; + idToken?: null | string; + password?: null | string; + providerId?: string; + refreshToken?: null | string; + refreshTokenExpiresAt?: null | number; + scope?: null | string; + updatedAt?: number; userId?: string; }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "accountId" + | "providerId" + | "userId" + | "accessToken" + | "refreshToken" + | "idToken" + | "accessTokenExpiresAt" + | "refreshTokenExpiresAt" + | "scope" + | "password" + | "createdAt" + | "updatedAt" + | "_id"; operator?: | "lt" | "lte" @@ -1593,6 +1463,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1607,28 +1478,23 @@ 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; + model: "verification"; update: { - count?: null | number; - key?: null | string; - lastRequest?: null | number; + createdAt?: number; + expiresAt?: number; + identifier?: string; + updatedAt?: number; + value?: string; }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "identifier" + | "value" + | "expiresAt" + | "createdAt" + | "updatedAt" + | "_id"; operator?: | "lt" | "lte" @@ -1636,6 +1502,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1648,41 +1515,17 @@ export declare const components: { | Array | null; }>; - }; - }, - any - >; - updateOne: FunctionReference< - "mutation", - "internal", - { - input: + } | { - model: "user"; + model: "twoFactor"; update: { - banExpires?: null | number; - banReason?: null | string; - banned?: null | boolean; - createdAt?: number; - displayUsername?: null | string; - email?: string; - emailVerified?: boolean; - image?: null | string; - isAnonymous?: null | boolean; - 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; - username?: null | string; + backupCodes?: string; + secret?: string; + userId?: string; }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: "secret" | "backupCodes" | "userId" | "_id"; operator?: | "lt" | "lte" @@ -1690,6 +1533,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1702,24 +1546,35 @@ export declare const components: { | Array | null; }>; - } - | { - model: "session"; - update: { - activeOrganizationId?: null | string; - activeTeamId?: null | string; - createdAt?: number; - expiresAt?: number; - impersonatedBy?: null | string; - ipAddress?: null | string; - token?: string; - updatedAt?: number; - userAgent?: null | string; + } + | { + model: "passkey"; + update: { + aaguid?: null | string; + backedUp?: boolean; + counter?: number; + createdAt?: null | number; + credentialID?: string; + deviceType?: string; + name?: null | string; + publicKey?: string; + transports?: null | string; userId?: string; }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "name" + | "publicKey" + | "userId" + | "credentialID" + | "counter" + | "deviceType" + | "backedUp" + | "transports" + | "createdAt" + | "aaguid" + | "_id"; operator?: | "lt" | "lte" @@ -1727,6 +1582,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1741,24 +1597,35 @@ export declare const components: { }>; } | { - model: "account"; + model: "oauthApplication"; update: { - accessToken?: null | string; - accessTokenExpiresAt?: null | number; - accountId?: string; - createdAt?: number; - idToken?: null | string; - password?: null | string; - providerId?: string; - refreshToken?: null | string; - refreshTokenExpiresAt?: null | number; - scope?: null | string; - updatedAt?: number; - userId?: string; + clientId?: null | string; + clientSecret?: null | string; + createdAt?: null | number; + disabled?: null | boolean; + icon?: null | string; + metadata?: null | string; + name?: null | string; + redirectURLs?: null | string; + type?: null | string; + updatedAt?: null | number; + userId?: null | string; }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "name" + | "icon" + | "metadata" + | "clientId" + | "clientSecret" + | "redirectURLs" + | "type" + | "disabled" + | "userId" + | "createdAt" + | "updatedAt" + | "_id"; operator?: | "lt" | "lte" @@ -1766,6 +1633,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1780,17 +1648,31 @@ export declare const components: { }>; } | { - model: "verification"; + model: "oauthAccessToken"; update: { - createdAt?: number; - expiresAt?: number; - identifier?: string; - updatedAt?: number; - value?: string; + accessToken?: null | string; + accessTokenExpiresAt?: null | number; + clientId?: null | string; + createdAt?: null | number; + refreshToken?: null | string; + refreshTokenExpiresAt?: null | number; + scopes?: null | string; + updatedAt?: null | number; + userId?: null | string; }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "accessToken" + | "refreshToken" + | "accessTokenExpiresAt" + | "refreshTokenExpiresAt" + | "clientId" + | "userId" + | "scopes" + | "createdAt" + | "updatedAt" + | "_id"; operator?: | "lt" | "lte" @@ -1798,6 +1680,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1812,15 +1695,25 @@ export declare const components: { }>; } | { - model: "twoFactor"; + model: "oauthConsent"; update: { - backupCodes?: string; - secret?: string; - userId?: string; + clientId?: null | string; + consentGiven?: null | boolean; + createdAt?: null | number; + scopes?: null | string; + updatedAt?: null | number; + userId?: null | string; }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "clientId" + | "userId" + | "scopes" + | "createdAt" + | "updatedAt" + | "consentGiven" + | "_id"; operator?: | "lt" | "lte" @@ -1828,6 +1721,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1842,22 +1736,15 @@ export declare const components: { }>; } | { - model: "passkey"; + model: "jwks"; update: { - aaguid?: null | string; - backedUp?: boolean; - counter?: number; - createdAt?: null | number; - credentialID?: string; - deviceType?: string; - name?: null | string; + createdAt?: number; + privateKey?: string; publicKey?: string; - transports?: null | string; - userId?: string; }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: "publicKey" | "privateKey" | "createdAt" | "_id"; operator?: | "lt" | "lte" @@ -1865,6 +1752,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1879,32 +1767,15 @@ export declare const components: { }>; } | { - model: "apikey"; + model: "rateLimit"; update: { - createdAt?: number; - enabled?: null | boolean; - expiresAt?: null | number; - key?: string; - lastRefillAt?: null | number; + count?: null | number; + key?: null | string; 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: "key" | "count" | "lastRequest" | "_id"; operator?: | "lt" | "lte" @@ -1912,6 +1783,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1926,23 +1798,11 @@ export declare const components: { }>; } | { - model: "oauthApplication"; - update: { - clientId?: null | string; - clientSecret?: null | string; - createdAt?: null | number; - disabled?: null | boolean; - icon?: null | string; - metadata?: null | string; - name?: null | string; - redirectURLs?: null | string; - type?: null | string; - updatedAt?: null | number; - userId?: null | string; - }; + model: "ratelimit"; + update: { count?: number; key?: string; lastRequest?: number }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: "key" | "count" | "lastRequest" | "_id"; operator?: | "lt" | "lte" @@ -1950,6 +1810,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -1962,23 +1823,58 @@ 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: "oauthAccessToken"; + model: "user"; update: { - accessToken?: null | string; - accessTokenExpiresAt?: null | number; - clientId?: null | string; - createdAt?: null | number; - refreshToken?: null | string; - refreshTokenExpiresAt?: null | number; - scopes?: null | string; - updatedAt?: null | number; + createdAt?: number; + displayUsername?: null | string; + email?: string; + emailVerified?: boolean; + image?: null | string; + isAnonymous?: null | boolean; + name?: string; + phoneNumber?: null | string; + phoneNumberVerified?: null | boolean; + twoFactorEnabled?: null | boolean; + updatedAt?: number; userId?: null | string; + username?: null | string; }; 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" @@ -1986,6 +1882,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -2000,18 +1897,27 @@ export declare const components: { }>; } | { - model: "oauthConsent"; + model: "session"; update: { - clientId?: null | string; - consentGiven?: null | boolean; - createdAt?: null | number; - scopes?: null | string; - updatedAt?: null | number; - userId?: null | string; + createdAt?: number; + expiresAt?: number; + ipAddress?: null | string; + token?: string; + updatedAt?: number; + userAgent?: null | string; + userId?: string; }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "expiresAt" + | "token" + | "createdAt" + | "updatedAt" + | "ipAddress" + | "userAgent" + | "userId" + | "_id"; operator?: | "lt" | "lte" @@ -2019,6 +1925,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -2033,16 +1940,37 @@ export declare const components: { }>; } | { - model: "team"; + model: "account"; update: { + accessToken?: null | string; + accessTokenExpiresAt?: null | number; + accountId?: string; createdAt?: number; - name?: string; - organizationId?: string; - updatedAt?: null | number; + idToken?: null | string; + password?: null | string; + providerId?: string; + refreshToken?: null | string; + refreshTokenExpiresAt?: null | number; + scope?: null | string; + updatedAt?: number; + userId?: string; }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "accountId" + | "providerId" + | "userId" + | "accessToken" + | "refreshToken" + | "idToken" + | "accessTokenExpiresAt" + | "refreshTokenExpiresAt" + | "scope" + | "password" + | "createdAt" + | "updatedAt" + | "_id"; operator?: | "lt" | "lte" @@ -2050,6 +1978,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -2064,15 +1993,23 @@ export declare const components: { }>; } | { - model: "teamMember"; + model: "verification"; update: { - createdAt?: null | number; - teamId?: string; - userId?: string; + createdAt?: number; + expiresAt?: number; + identifier?: string; + updatedAt?: number; + value?: string; }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "identifier" + | "value" + | "expiresAt" + | "createdAt" + | "updatedAt" + | "_id"; operator?: | "lt" | "lte" @@ -2080,6 +2017,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -2094,17 +2032,15 @@ export declare const components: { }>; } | { - model: "organization"; + model: "twoFactor"; update: { - createdAt?: number; - logo?: null | string; - metadata?: null | string; - name?: string; - slug?: null | string; + backupCodes?: string; + secret?: string; + userId?: string; }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: "secret" | "backupCodes" | "userId" | "_id"; operator?: | "lt" | "lte" @@ -2112,6 +2048,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -2126,16 +2063,33 @@ export declare const components: { }>; } | { - model: "member"; + model: "passkey"; update: { - createdAt?: number; - organizationId?: string; - role?: string; + aaguid?: null | string; + backedUp?: boolean; + counter?: number; + createdAt?: null | number; + credentialID?: string; + deviceType?: string; + name?: null | string; + publicKey?: string; + transports?: null | string; userId?: string; }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "name" + | "publicKey" + | "userId" + | "credentialID" + | "counter" + | "deviceType" + | "backedUp" + | "transports" + | "createdAt" + | "aaguid" + | "_id"; operator?: | "lt" | "lte" @@ -2143,6 +2097,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -2157,19 +2112,35 @@ export declare const components: { }>; } | { - model: "invitation"; + model: "oauthApplication"; update: { - email?: string; - expiresAt?: number; - inviterId?: string; - organizationId?: string; - role?: null | string; - status?: string; - teamId?: null | string; + clientId?: null | string; + clientSecret?: null | string; + createdAt?: null | number; + disabled?: null | boolean; + icon?: null | string; + metadata?: null | string; + name?: null | string; + redirectURLs?: null | string; + type?: null | string; + updatedAt?: null | number; + userId?: null | string; }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "name" + | "icon" + | "metadata" + | "clientId" + | "clientSecret" + | "redirectURLs" + | "type" + | "disabled" + | "userId" + | "createdAt" + | "updatedAt" + | "_id"; operator?: | "lt" | "lte" @@ -2177,6 +2148,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -2191,19 +2163,31 @@ export declare const components: { }>; } | { - model: "ssoProvider"; + model: "oauthAccessToken"; update: { - domain?: string; - issuer?: string; - oidcConfig?: null | string; - organizationId?: null | string; - providerId?: string; - samlConfig?: null | string; + accessToken?: null | string; + accessTokenExpiresAt?: null | number; + clientId?: null | string; + createdAt?: null | number; + refreshToken?: null | string; + refreshTokenExpiresAt?: null | number; + scopes?: null | string; + updatedAt?: null | number; userId?: null | string; }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "accessToken" + | "refreshToken" + | "accessTokenExpiresAt" + | "refreshTokenExpiresAt" + | "clientId" + | "userId" + | "scopes" + | "createdAt" + | "updatedAt" + | "_id"; operator?: | "lt" | "lte" @@ -2211,6 +2195,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -2225,15 +2210,25 @@ export declare const components: { }>; } | { - model: "jwks"; + model: "oauthConsent"; update: { - createdAt?: number; - privateKey?: string; - publicKey?: string; + clientId?: null | string; + consentGiven?: null | boolean; + createdAt?: null | number; + scopes?: null | string; + updatedAt?: null | number; + userId?: null | string; }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: + | "clientId" + | "userId" + | "scopes" + | "createdAt" + | "updatedAt" + | "consentGiven" + | "_id"; operator?: | "lt" | "lte" @@ -2241,6 +2236,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -2255,23 +2251,15 @@ export declare const components: { }>; } | { - model: "subscription"; + model: "jwks"; 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; + createdAt?: number; + privateKey?: string; + publicKey?: string; }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: "publicKey" | "privateKey" | "createdAt" | "_id"; operator?: | "lt" | "lte" @@ -2279,6 +2267,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -2293,17 +2282,15 @@ export declare const components: { }>; } | { - model: "walletAddress"; + model: "rateLimit"; update: { - address?: string; - chainId?: number; - createdAt?: number; - isPrimary?: null | boolean; - userId?: string; + count?: null | number; + key?: null | string; + lastRequest?: null | number; }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: "key" | "count" | "lastRequest" | "_id"; operator?: | "lt" | "lte" @@ -2311,6 +2298,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -2325,15 +2313,11 @@ export declare const components: { }>; } | { - model: "rateLimit"; - update: { - count?: null | number; - key?: null | string; - lastRequest?: null | number; - }; + model: "ratelimit"; + update: { count?: number; key?: string; lastRequest?: number }; where?: Array<{ connector?: "AND" | "OR"; - field: string; + field: "key" | "count" | "lastRequest" | "_id"; operator?: | "lt" | "lte" @@ -2341,6 +2325,7 @@ export declare const components: { | "gte" | "eq" | "in" + | "not_in" | "ne" | "contains" | "starts_with" @@ -2354,9 +2339,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..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.7.15", + "@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.7", + "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 db66b0dec..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.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.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.7 - 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.7.18': - resolution: {integrity: sha512-lZwJcRJncmeKZfDQk7PJrJ+8z/S8rmO5rUfPWZd2gOjC+1sbd/JUZiTVPGLxeP5VEGG74TkRTUavK7s+wmKhwg==} + '@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,15 +9655,16 @@ 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.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-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: @@ -10524,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 @@ -13001,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 @@ -14056,7 +14102,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 +14170,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 @@ -15024,6 +15070,8 @@ snapshots: jose@5.10.0: {} + jose@6.1.0: {} + jpeg-js@0.4.4: {} js-cookie@3.0.5: {} @@ -15548,7 +15596,7 @@ snapshots: nanoid@3.3.11: {} - nanostores@0.11.4: {} + nanostores@1.0.1: {} natural-compare-lite@1.4.0: {} @@ -16269,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 @@ -16399,6 +16451,8 @@ snapshots: semver@7.7.2: {} + semver@7.7.3: {} + serialize-javascript@6.0.2: dependencies: randombytes: 2.1.0 diff --git a/src/routes/api/auth/$.ts b/src/routes/api/auth/$.ts index 51c6ea367..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 "~/server/auth.server" +//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: { 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, - })