diff --git a/.changeset/ready-turtles-lay.md b/.changeset/ready-turtles-lay.md new file mode 100644 index 00000000..94ae9e4d --- /dev/null +++ b/.changeset/ready-turtles-lay.md @@ -0,0 +1,5 @@ +--- +"namesake": patch +--- + +Upgrades authentication provider to use the latest package diff --git a/convex/_generated/api.d.ts b/convex/_generated/api.d.ts index ad042ae4..3fef2a26 100644 --- a/convex/_generated/api.d.ts +++ b/convex/_generated/api.d.ts @@ -84,6 +84,3263 @@ export declare const internal: FilterApi< export declare const components: { betterAuth: { + adapter: { + create: FunctionReference< + "mutation", + "internal", + { + input: + | { + data: { + 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; + }; + model: "user"; + } + | { + data: { + createdAt: number; + expiresAt: number; + ipAddress?: null | string; + token: string; + updatedAt: number; + userAgent?: null | string; + userId: string; + }; + model: "session"; + } + | { + data: { + 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; + }; + model: "account"; + } + | { + data: { + createdAt: number; + expiresAt: number; + identifier: string; + updatedAt: number; + value: string; + }; + model: "verification"; + } + | { + data: { backupCodes: string; secret: string; userId: string }; + model: "twoFactor"; + } + | { + data: { + aaguid?: null | string; + backedUp: boolean; + counter: number; + createdAt?: null | number; + credentialID: string; + deviceType: string; + name?: null | string; + publicKey: string; + transports?: null | string; + userId: string; + }; + model: "passkey"; + } + | { + data: { + 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: "oauthApplication"; + } + | { + data: { + 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: "oauthAccessToken"; + } + | { + data: { + clientId?: null | string; + consentGiven?: null | boolean; + createdAt?: null | number; + scopes?: null | string; + updatedAt?: null | number; + userId?: null | string; + }; + 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; + privateKey: string; + publicKey: string; + }; + 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; + key?: null | string; + 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; + }>; + }; + onDeleteHandle?: string; + }, + any + >; + findMany: FunctionReference< + "query", + "internal", + { + limit?: number; + 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; + 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" + | "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" + | "team" + | "teamMember" + | "organization" + | "member" + | "invitation" + | "ssoProvider" + | "jwks" + | "subscription" + | "walletAddress" + | "rateLimit" + | "ratelimit"; + select?: Array; + 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 + >; + updateMany: FunctionReference< + "mutation", + "internal", + { + input: + | { + model: "user"; + update: { + 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: + | "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"; + update: { + createdAt?: number; + expiresAt?: number; + ipAddress?: null | string; + token?: string; + updatedAt?: number; + userAgent?: null | string; + userId?: string; + }; + 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"; + 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: + | "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"; + update: { + createdAt?: number; + expiresAt?: number; + identifier?: string; + updatedAt?: number; + value?: string; + }; + 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"; + update: { + backupCodes?: string; + secret?: string; + userId?: string; + }; + 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"; + 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: + | "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"; + 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; + }; + 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"; + 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; + }; + 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"; + update: { + clientId?: null | string; + consentGiven?: null | boolean; + createdAt?: null | number; + scopes?: null | string; + updatedAt?: null | number; + userId?: null | string; + }; + 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"; + 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"; + 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"; + update: { + 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: + | "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"; + update: { + createdAt?: number; + expiresAt?: number; + ipAddress?: null | string; + token?: string; + updatedAt?: number; + userAgent?: null | string; + userId?: string; + }; + 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"; + 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: + | "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"; + update: { + createdAt?: number; + expiresAt?: number; + identifier?: string; + updatedAt?: number; + value?: string; + }; + 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"; + update: { + backupCodes?: string; + secret?: string; + userId?: string; + }; + 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"; + 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: + | "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"; + 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; + }; + 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"; + 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; + }; + 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"; + update: { + clientId?: null | string; + consentGiven?: null | boolean; + createdAt?: null | number; + scopes?: null | string; + updatedAt?: null | number; + userId?: null | string; + }; + 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"; + 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"; + 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; + }, + any + >; + }; adapterTest: { count: FunctionReference<"query", "internal", any, any>; create: FunctionReference<"mutation", "internal", any, any>; @@ -91,7 +3348,6 @@ export declare const components: { 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>; }; @@ -103,9 +3359,6 @@ export declare const components: { input: | { data: { - banExpires?: null | number; - banReason?: null | string; - banned?: null | boolean; createdAt: number; displayUsername?: null | string; email: string; @@ -115,9 +3368,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; @@ -127,11 +3377,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; @@ -186,31 +3433,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; @@ -353,6 +3575,10 @@ export declare const components: { lastRequest?: null | number; }; model: "rateLimit"; + } + | { + data: { count: number; key: string; lastRequest: number }; + model: "ratelimit"; }; }, any @@ -535,9 +3761,6 @@ export declare const components: { 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; @@ -547,9 +3770,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; @@ -594,11 +3814,8 @@ export declare const components: { 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; @@ -818,66 +4035,6 @@ export declare const components: { | 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; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } | { limit?: number; model: "oauthApplication"; @@ -1475,6 +4632,45 @@ export declare const components: { | Array | null; }>; + } + | { + 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?: number; key?: string; lastRequest?: number }; + 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 @@ -1487,9 +4683,6 @@ export declare const components: { | { model: "user"; update: { - banExpires?: null | number; - banReason?: null | string; - banned?: null | boolean; createdAt?: number; displayUsername?: null | string; email?: string; @@ -1499,9 +4692,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; @@ -1533,11 +4723,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; @@ -1705,53 +4892,6 @@ export declare const components: { | 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; - operator?: - | "lt" - | "lte" - | "gt" - | "gte" - | "eq" - | "in" - | "ne" - | "contains" - | "starts_with" - | "ends_with"; - value: - | string - | number - | boolean - | Array - | Array - | null; - }>; - } | { model: "oauthApplication"; update: { @@ -2180,6 +5320,32 @@ export declare const components: { | Array | null; }>; + } + | { + model: "ratelimit"; + update: { count?: number; key?: string; lastRequest?: number }; + 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 diff --git a/convex/auth.ts b/convex/auth.ts index 7e14c55f..92ae8e27 100644 --- a/convex/auth.ts +++ b/convex/auth.ts @@ -1,7 +1,7 @@ import { type AuthFunctions, - BetterAuth, - convexAdapter, + createClient, + type GenericCtx, } from "@convex-dev/better-auth"; import { convex, crossDomain } from "@convex-dev/better-auth/plugins"; import { betterAuth } from "better-auth"; @@ -10,7 +10,6 @@ import { DeleteAccountEmail } from "../emails/DeleteAccount"; import { ResetPasswordEmail } from "../emails/ResetPassword"; import { components, internal } from "./_generated/api"; import type { DataModel } from "./_generated/dataModel"; -import type { GenericCtx } from "./_generated/server"; import * as AuthModel from "./model/authModel"; const resend = new Resend(process.env.AUTH_RESEND_KEY); @@ -26,14 +25,45 @@ const trustedOrigins = [ const authFunctions: AuthFunctions = internal.auth; -export const betterAuthComponent = new BetterAuth(components.betterAuth, { +export const authComponent = createClient(components.betterAuth, { authFunctions, + triggers: { + user: { + onCreate: async (ctx, authUser) => { + const userId = await AuthModel.createUser(ctx, { + name: authUser.name, + email: authUser.email, + emailVerified: authUser.emailVerified, + }); + + // Facilitate migration to convex-better-auth 0.8 + await authComponent.setUserId(ctx, authUser._id, userId); + }, + + onUpdate: async (ctx, oldUser, newUser) => { + await AuthModel.updateUser(ctx, { + userId: oldUser._id, + ...newUser, + updatedAt: Date.now(), + }); + }, + + onDelete: async (ctx, authUser) => { + await AuthModel.deleteUser(ctx, authUser._id); + }, + }, + }, }); -export const createAuth = (ctx: GenericCtx) => - betterAuth({ - database: convexAdapter(ctx, betterAuthComponent), - plugins: [convex(), crossDomain({ siteUrl })], +export const { onCreate, onUpdate, onDelete } = authComponent.triggersApi(); + +export const createAuth = ( + ctx: GenericCtx, + { optionsOnly } = { optionsOnly: false }, +) => { + return betterAuth({ + database: authComponent.adapter(ctx), + plugins: [crossDomain({ siteUrl }), convex()], emailAndPassword: { enabled: true, requireEmailVerification: false, @@ -46,6 +76,10 @@ export const createAuth = (ctx: GenericCtx) => }); }, }, + logger: { + // Reduce noise in the logs + disabled: optionsOnly, + }, telemetry: { enabled: false }, trustedOrigins, user: { @@ -62,10 +96,4 @@ export const createAuth = (ctx: GenericCtx) => }, }, }); - -export const { createUser, updateUser, deleteUser, createSession } = - betterAuthComponent.createAuthFunctions({ - onCreateUser: AuthModel.createUser, - onUpdateUser: AuthModel.updateUser, - onDeleteUser: AuthModel.deleteUser, - }); +}; diff --git a/convex/helpers.ts b/convex/helpers.ts index 2851b073..cdd819d4 100644 --- a/convex/helpers.ts +++ b/convex/helpers.ts @@ -5,39 +5,36 @@ import { } from "convex-helpers/server/customFunctions"; import type { Id } from "./_generated/dataModel"; import { mutation, query } from "./_generated/server"; +import { authComponent } from "./auth"; export const userQuery = customQuery( query, customCtx(async (ctx) => { - const identity = await ctx.auth.getUserIdentity(); - if (!identity) { - throw new Error("Not authenticated"); - } - return { userId: identity.subject as Id<"users">, ctx }; + const userId = (await authComponent.getAuthUser(ctx)) + ?.userId as Id<"users">; + return { userId, ctx }; }), ); export const userMutation = customMutation(mutation, { args: {}, input: async (ctx) => { - const identity = await ctx.auth.getUserIdentity(); - if (!identity) { - throw new Error("Not authenticated"); - } - return { ctx: { userId: identity.subject as Id<"users"> }, args: {} }; + const userId = (await authComponent.getAuthUser(ctx)) + ?.userId as Id<"users">; + return { ctx: { userId }, args: {} }; }, }); export const adminQuery = customQuery(query, { args: {}, input: async (ctx) => { - const identity = await ctx.auth.getUserIdentity(); - if (!identity) throw new Error("Not authenticated"); + const userId = (await authComponent.getAuthUser(ctx)) + ?.userId as Id<"users">; const user = await ctx.db .query("users") - .withIndex("by_id", (q) => q.eq("_id", identity.subject as Id<"users">)) + .withIndex("by_id", (q) => q.eq("_id", userId)) .unique(); - if (!user) throw new Error("Not authenticated"); + if (!user) throw new Error("Unauthenticated"); if (user.role !== "admin") throw new Error("Insufficient permissions"); return { ctx: { userId: user._id }, args: {} }; }, @@ -46,13 +43,13 @@ export const adminQuery = customQuery(query, { export const adminMutation = customMutation(mutation, { args: {}, input: async (ctx) => { - const identity = await ctx.auth.getUserIdentity(); - if (!identity) throw new Error("Not authenticated"); + const userId = (await authComponent.getAuthUser(ctx)) + ?.userId as Id<"users">; const user = await ctx.db .query("users") - .withIndex("by_id", (q) => q.eq("_id", identity.subject as Id<"users">)) + .withIndex("by_id", (q) => q.eq("_id", userId)) .unique(); - if (!user) throw new Error("Not authenticated"); + if (!user) throw new Error("Unauthenticated"); if (user.role !== "admin") throw new Error("Insufficient permissions"); return { ctx: { userId: user._id }, args: {} }; }, diff --git a/convex/http.ts b/convex/http.ts index f32b1775..e4d28969 100644 --- a/convex/http.ts +++ b/convex/http.ts @@ -1,10 +1,8 @@ import { httpRouter } from "convex/server"; -import { betterAuthComponent, createAuth } from "./auth"; +import { authComponent, createAuth } from "./auth"; const http = httpRouter(); -betterAuthComponent.registerRoutes(http, createAuth, { - cors: true, -}); +authComponent.registerRoutes(http, createAuth, { cors: true }); export default http; diff --git a/convex/users.ts b/convex/users.ts index 9fcdff6d..77f55cb3 100644 --- a/convex/users.ts +++ b/convex/users.ts @@ -2,6 +2,7 @@ import { v } from "convex/values"; import type { Role } from "../src/constants"; import type { Id } from "./_generated/dataModel"; import { query } from "./_generated/server"; +import { authComponent } from "./auth"; import { adminQuery, userMutation } from "./helpers"; import * as Users from "./model/usersModel"; @@ -18,10 +19,10 @@ export const getById = adminQuery({ export const getCurrent = query({ args: {}, handler: async (ctx) => { - const identity = await ctx.auth.getUserIdentity(); - if (!identity) return null; + const userId = (await authComponent.safeGetAuthUser(ctx))?.userId; + if (!userId) return null; return await Users.getById(ctx, { - userId: identity.subject as Id<"users">, + userId: userId as Id<"users">, }); }, }); @@ -29,10 +30,10 @@ export const getCurrent = query({ export const getCurrentRole = query({ args: {}, handler: async (ctx) => { - const identity = await ctx.auth.getUserIdentity(); - if (!identity) return null; + const userId = (await authComponent.safeGetAuthUser(ctx))?.userId; + if (!userId) return null; const user = await Users.getById(ctx, { - userId: identity.subject as Id<"users">, + userId: userId as Id<"users">, }); return user?.role as Role; }, diff --git a/package.json b/package.json index f67d9fd3..46c08884 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@cantoo/pdf-lib": "2.4.2", - "@convex-dev/better-auth": "0.7.18", + "@convex-dev/better-auth": "0.8.6", "@convex-dev/migrations": "0.2.9", "@faker-js/faker": "10.0.0", "@maskito/core": "3.10.3", @@ -68,7 +68,7 @@ "@zxcvbn-ts/language-common": "3.0.4", "@zxcvbn-ts/language-en": "3.0.2", "better-auth": "1.3.8", - "convex": "1.26.2", + "convex": "1.27.0", "convex-helpers": "0.1.104", "language-name-map": "0.3.0", "lucide-react": "0.544.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 61384b1d..68b6f41f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -18,11 +18,11 @@ importers: specifier: 2.4.2 version: 2.4.2 '@convex-dev/better-auth': - specifier: 0.7.18 - version: 0.7.18(better-auth@1.3.8(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(convex@1.26.2(react@19.1.1))(react-dom@19.1.1(react@19.1.1))(react@19.1.1)(typescript@5.9.2) + specifier: 0.8.6 + version: 0.8.6(better-auth@1.3.8(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(convex@1.27.0(react@19.1.1))(react-dom@19.1.1(react@19.1.1))(react@19.1.1)(typescript@5.9.2) '@convex-dev/migrations': specifier: 0.2.9 - version: 0.2.9(convex@1.26.2(react@19.1.1)) + version: 0.2.9(convex@1.27.0(react@19.1.1)) '@faker-js/faker': specifier: 10.0.0 version: 10.0.0 @@ -108,11 +108,11 @@ importers: specifier: 1.3.8 version: 1.3.8(react-dom@19.1.1(react@19.1.1))(react@19.1.1) convex: - specifier: 1.26.2 - version: 1.26.2(react@19.1.1) + specifier: 1.27.0 + version: 1.27.0(react@19.1.1) convex-helpers: specifier: 0.1.104 - version: 0.1.104(convex@1.26.2(react@19.1.1))(react@19.1.1)(typescript@5.9.2)(zod@3.25.76) + version: 0.1.104(convex@1.27.0(react@19.1.1))(react@19.1.1)(typescript@5.9.2)(zod@3.25.76) language-name-map: specifier: 0.3.0 version: 0.3.0 @@ -248,7 +248,7 @@ importers: version: 2.2.11(axe-core@4.10.3) convex-test: specifier: 0.0.38 - version: 0.0.38(convex@1.26.2(react@19.1.1)) + version: 0.0.38(convex@1.27.0(react@19.1.1)) globals: specifier: 16.3.0 version: 16.3.0 @@ -602,8 +602,8 @@ packages: '@changesets/write@0.4.0': resolution: {integrity: sha512-CdTLvIOPiCNuH71pyDu3rA+Q0n65cmAbXnwWH84rKGiFumFzkmHNT8KHTMEchcxN+Kl8I54xGUhJ7l3E7X396Q==} - '@convex-dev/better-auth@0.7.18': - resolution: {integrity: sha512-lZwJcRJncmeKZfDQk7PJrJ+8z/S8rmO5rUfPWZd2gOjC+1sbd/JUZiTVPGLxeP5VEGG74TkRTUavK7s+wmKhwg==} + '@convex-dev/better-auth@0.8.6': + resolution: {integrity: sha512-iP2erc4YKz0HzrWSdaSRv2ck3gsdb2yBwUdSOsM0ebvNMcTsoWEBuu07cq6lUGMyJ97qxOnZDtN7CemTXKpSpA==} peerDependencies: better-auth: 1.3.8 convex: ^1.26.2 @@ -3228,8 +3228,8 @@ packages: peerDependencies: convex: ^1.16.4 - convex@1.26.2: - resolution: {integrity: sha512-QG3zvZ9GTTeeBS+N5PJj73TULHYu99eVSOI3KU2hMnB9q40fHxkMFJ+AYox+K81roTakciBvNTvGlhfz+M10fQ==} + convex@1.27.0: + resolution: {integrity: sha512-IHkqZX3GtY4nKFPTAR4mvWHHhDiQX9PM7EjpEv0pJWoMoq0On6oOL3iZ7Xz4Ls96dF7WJd4AjfitJsg2hUnLSQ==} engines: {node: '>=18.0.0', npm: '>=7.0.0'} hasBin: true peerDependencies: @@ -5576,12 +5576,13 @@ snapshots: human-id: 4.1.1 prettier: 2.8.8 - '@convex-dev/better-auth@0.7.18(better-auth@1.3.8(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(convex@1.26.2(react@19.1.1))(react-dom@19.1.1(react@19.1.1))(react@19.1.1)(typescript@5.9.2)': + '@convex-dev/better-auth@0.8.6(better-auth@1.3.8(react-dom@19.1.1(react@19.1.1))(react@19.1.1))(convex@1.27.0(react@19.1.1))(react-dom@19.1.1(react@19.1.1))(react@19.1.1)(typescript@5.9.2)': dependencies: + '@better-fetch/fetch': 1.1.18 better-auth: 1.3.8(react-dom@19.1.1(react@19.1.1))(react@19.1.1) common-tags: 1.8.2 - convex: 1.26.2(react@19.1.1) - convex-helpers: 0.1.104(convex@1.26.2(react@19.1.1))(react@19.1.1)(typescript@5.9.2)(zod@3.25.76) + convex: 1.27.0(react@19.1.1) + convex-helpers: 0.1.104(convex@1.27.0(react@19.1.1))(react@19.1.1)(typescript@5.9.2)(zod@3.25.76) is-network-error: 1.3.0 react: 19.1.1 react-dom: 19.1.1(react@19.1.1) @@ -5592,9 +5593,9 @@ snapshots: - hono - typescript - '@convex-dev/migrations@0.2.9(convex@1.26.2(react@19.1.1))': + '@convex-dev/migrations@0.2.9(convex@1.27.0(react@19.1.1))': dependencies: - convex: 1.26.2(react@19.1.1) + convex: 1.27.0(react@19.1.1) '@csstools/color-helpers@5.1.0': {} @@ -8406,19 +8407,19 @@ snapshots: convert-source-map@2.0.0: {} - convex-helpers@0.1.104(convex@1.26.2(react@19.1.1))(react@19.1.1)(typescript@5.9.2)(zod@3.25.76): + convex-helpers@0.1.104(convex@1.27.0(react@19.1.1))(react@19.1.1)(typescript@5.9.2)(zod@3.25.76): dependencies: - convex: 1.26.2(react@19.1.1) + convex: 1.27.0(react@19.1.1) optionalDependencies: react: 19.1.1 typescript: 5.9.2 zod: 3.25.76 - convex-test@0.0.38(convex@1.26.2(react@19.1.1)): + convex-test@0.0.38(convex@1.27.0(react@19.1.1)): dependencies: - convex: 1.26.2(react@19.1.1) + convex: 1.27.0(react@19.1.1) - convex@1.26.2(react@19.1.1): + convex@1.27.0(react@19.1.1): dependencies: esbuild: 0.25.4 jwt-decode: 4.0.0 diff --git a/tests/vitest.setup.ts b/tests/vitest.setup.ts index dcae0183..5c343053 100644 --- a/tests/vitest.setup.ts +++ b/tests/vitest.setup.ts @@ -83,14 +83,14 @@ vi.mock("@convex-dev/better-auth/convex.config", () => ({ })); vi.mock("@convex-dev/better-auth", () => ({ - BetterAuth: vi.fn(() => ({ - createAuthFunctions: vi.fn(() => ({ - createUser: vi.fn(), - updateUser: vi.fn(), - deleteUser: vi.fn(), - createSession: vi.fn(), + createClient: vi.fn(() => ({ + triggersApi: vi.fn(() => ({ + onCreate: vi.fn(), + onUpdate: vi.fn(), + onDelete: vi.fn(), })), - getHeaders: vi.fn(), + getAuthUser: vi.fn(), + safeGetAuthUser: vi.fn(), })), convexAdapter: vi.fn(), AuthFunctions: {},