Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/client/adapterUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import { stream } from "convex-helpers/server/stream";
import { mergedStream } from "convex-helpers/server/stream";
import { stripIndent } from "common-tags";
import { BetterAuthDbSchema } from "better-auth/db";
import { BetterAuthDBSchema } from "better-auth/db";

export const adapterWhereValidator = v.object({
field: v.string(),
Expand Down Expand Up @@ -57,7 +57,7 @@ export const adapterArgsValidator = v.object({
});

const isUniqueField = (
betterAuthSchema: BetterAuthDbSchema,
betterAuthSchema: BetterAuthDBSchema,
model: string,
field: string
) => {
Expand All @@ -72,7 +72,7 @@ const isUniqueField = (
.includes(field);
};
export const hasUniqueFields = (
betterAuthSchema: BetterAuthDbSchema,
betterAuthSchema: BetterAuthDBSchema,
model: string,
input: Record<string, any>
) => {
Expand Down Expand Up @@ -241,7 +241,7 @@ export const checkUniqueFields = async <
>(
ctx: GenericQueryCtx<GenericDataModel>,
schema: Schema,
betterAuthSchema: BetterAuthDbSchema,
betterAuthSchema: BetterAuthDBSchema,
table: string,
input: Record<string, any>,
doc?: Record<string, any>
Expand Down Expand Up @@ -466,7 +466,7 @@ export const paginate = async <
>(
ctx: GenericQueryCtx<GenericDataModel>,
schema: SchemaDefinition<any, any>,
betterAuthSchema: BetterAuthDbSchema,
betterAuthSchema: BetterAuthDBSchema,
args: Infer<typeof adapterArgsValidator> & {
paginationOpts: PaginationOptions;
}
Expand Down Expand Up @@ -623,7 +623,7 @@ export const listOne = async <
>(
ctx: GenericQueryCtx<GenericDataModel>,
schema: SchemaDefinition<any, any>,
betterAuthSchema: BetterAuthDbSchema,
betterAuthSchema: BetterAuthDBSchema,
args: Infer<typeof adapterArgsValidator>
): Promise<Doc | null> => {
return (
Expand Down
12 changes: 6 additions & 6 deletions src/client/createSchema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BetterAuthDbSchema, type FieldAttribute } from "better-auth/db";
import { BetterAuthDBSchema, type DBFieldAttribute } from "better-auth/db";

// Manually add fields to index on for schema generation,
// all fields in the schema specialFields are automatically indexed
Expand All @@ -13,7 +13,7 @@ export const indexFields = {
};

// Return map of unique, sortable, and reference fields
const specialFields = (tables: BetterAuthDbSchema) =>
const specialFields = (tables: BetterAuthDBSchema) =>
Object.fromEntries(
Object.entries(tables)
.map(([key, table]) => {
Expand All @@ -38,7 +38,7 @@ const specialFields = (tables: BetterAuthDbSchema) =>
)
);

const mergedIndexFields = (tables: BetterAuthDbSchema) =>
const mergedIndexFields = (tables: BetterAuthDBSchema) =>
Object.fromEntries(
Object.entries(tables).map(([key]) => {
const manualIndexes = indexFields[key as keyof typeof indexFields] || [];
Expand All @@ -59,7 +59,7 @@ export const createSchema = async ({
file,
tables,
}: {
tables: BetterAuthDbSchema;
tables: BetterAuthDBSchema;
file?: string;
}) => {
// stop convex esbuild from throwing over this import, only runs
Expand Down Expand Up @@ -94,7 +94,7 @@ export const tables = {
Object.entries(table.fields).filter(([key]) => key !== "id")
);

function getType(name: string, field: FieldAttribute) {
function getType(name: string, field: DBFieldAttribute) {
const type = field.type as
| "string"
| "number"
Expand Down Expand Up @@ -126,7 +126,7 @@ export const tables = {
${Object.keys(fields)
.map((field) => {
const attr = fields[field]!;
const type = getType(field, attr as FieldAttribute);
const type = getType(field, attr as DBFieldAttribute);
const optional = (fieldSchema: string) =>
attr.required
? fieldSchema
Expand Down