mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-06 12:27:44 +00:00
chore: use type from core (#5196)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { Models } from "../types";
|
||||
import type { DBPreservedModels } from "@better-auth/core/db";
|
||||
import type { BetterAuthOptions } from "@better-auth/core";
|
||||
import type { DBAdapter, Where } from "@better-auth/core/db/adapter";
|
||||
import { getCurrentAdapter } from "../context/transaction";
|
||||
@@ -13,7 +13,7 @@ export function getWithHooks(
|
||||
) {
|
||||
const hooks = ctx.hooks;
|
||||
type BaseModels = Extract<
|
||||
Models,
|
||||
DBPreservedModels,
|
||||
"user" | "account" | "session" | "verification"
|
||||
>;
|
||||
async function createWithHooks<T extends Record<string, any>>(
|
||||
|
||||
@@ -5,19 +5,6 @@ import type { StripEmptyObjects, UnionToIntersection } from "./helper";
|
||||
import type { BetterAuthPlugin } from "@better-auth/core";
|
||||
import type { User, Session } from "@better-auth/core/db";
|
||||
|
||||
export type Models =
|
||||
| "user"
|
||||
| "account"
|
||||
| "session"
|
||||
| "verification"
|
||||
| "rate-limit"
|
||||
| "organization"
|
||||
| "member"
|
||||
| "invitation"
|
||||
| "jwks"
|
||||
| "passkey"
|
||||
| "two-factor";
|
||||
|
||||
export type AdditionalUserFieldsInput<Options extends BetterAuthOptions> =
|
||||
InferFieldsFromPlugins<Options, "user", "input"> &
|
||||
InferFieldsFromOptions<Options, "user", "input">;
|
||||
|
||||
@@ -4,6 +4,7 @@ import type {
|
||||
DBFieldType,
|
||||
DBPrimitive,
|
||||
BetterAuthDBSchema,
|
||||
DBPreservedModels,
|
||||
} from "./type";
|
||||
import type { BetterAuthPluginDBSchema } from "./plugin";
|
||||
export type { BetterAuthPluginDBSchema } from "./plugin";
|
||||
@@ -21,6 +22,7 @@ export type {
|
||||
DBFieldType,
|
||||
DBPrimitive,
|
||||
BetterAuthDBSchema,
|
||||
DBPreservedModels,
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,16 +1,7 @@
|
||||
import type { ZodType } from "zod";
|
||||
import type { LiteralString } from "../types";
|
||||
|
||||
declare module "../index" {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
interface BetterAuthMutators<O, C> {
|
||||
"better-auth/db": {
|
||||
// todo: we should infer the schema from the adapter
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export type Models =
|
||||
export type DBPreservedModels =
|
||||
| "user"
|
||||
| "account"
|
||||
| "session"
|
||||
|
||||
@@ -10,7 +10,7 @@ import type { OAuthProvider } from "../oauth2";
|
||||
import { createLogger } from "../env";
|
||||
import type { DBAdapter, Where } from "../db/adapter";
|
||||
import type { BetterAuthCookies } from "./cookie";
|
||||
import type { Models } from "../db/type";
|
||||
import type { DBPreservedModels } from "../db/type";
|
||||
import type { LiteralUnion } from "./helper";
|
||||
import type { CookieOptions, EndpointContext } from "better-call";
|
||||
import type {
|
||||
@@ -247,7 +247,7 @@ export type AuthContext<Options extends BetterAuthOptions = BetterAuthOptions> =
|
||||
freshAge: number;
|
||||
};
|
||||
generateId: (options: {
|
||||
model: LiteralUnion<Models, string>;
|
||||
model: LiteralUnion<DBPreservedModels, string>;
|
||||
size?: number;
|
||||
}) => string | false;
|
||||
secondaryStorage: SecondaryStorage | undefined;
|
||||
|
||||
@@ -2,7 +2,11 @@ import type { Dialect, Kysely, MysqlPool, PostgresPool } from "kysely";
|
||||
import type { Database } from "better-sqlite3";
|
||||
import type { CookieOptions } from "better-call";
|
||||
import type { LiteralUnion } from "./helper";
|
||||
import type { DBFieldAttribute, Models, SecondaryStorage } from "../db/type";
|
||||
import type {
|
||||
DBFieldAttribute,
|
||||
DBPreservedModels,
|
||||
SecondaryStorage,
|
||||
} from "../db/type";
|
||||
import type { Account, RateLimit, Session, User, Verification } from "../db";
|
||||
import type { Database as BunDatabase } from "bun:sqlite";
|
||||
import type { DatabaseSync } from "node:sqlite";
|
||||
@@ -17,7 +21,7 @@ type KyselyDatabaseType = "postgres" | "mysql" | "sqlite" | "mssql";
|
||||
type OmitId<T extends { id: unknown }> = Omit<T, "id">;
|
||||
|
||||
export type GenerateIdFn = (options: {
|
||||
model: LiteralUnion<Models, string>;
|
||||
model: LiteralUnion<DBPreservedModels, string>;
|
||||
size?: number;
|
||||
}) => string | false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user