upgrade vite + fix types

This commit is contained in:
dswbx
2025-10-31 21:40:55 +01:00
parent a91ddb1ec3
commit ac6cd4a900
8 changed files with 341 additions and 313 deletions

View File

@@ -4,11 +4,11 @@ import path from "node:path";
import { type RuntimeBkndConfig, createRuntimeApp } from "bknd/adapter";
import { registerLocalMediaAdapter } from ".";
import { config, type App } from "bknd";
import type { ServeOptions } from "bun";
import { serveStatic } from "hono/bun";
type BunEnv = Bun.Env;
export type BunBkndConfig<Env = BunEnv> = RuntimeBkndConfig<Env> & Omit<ServeOptions, "fetch">;
export type BunBkndConfig<Env = BunEnv> = RuntimeBkndConfig<Env> &
Omit<Bun.Serve.Options<undefined, string>, "fetch">;
export async function createApp<Env = BunEnv>(
{ distPath, serveStatic: _serveStatic, ...config }: BunBkndConfig<Env> = {},
@@ -60,7 +60,7 @@ export function serve<Env = BunEnv>(
args: Env = Bun.env as Env,
) {
Bun.serve({
...serveOptions,
...(serveOptions as any),
port,
fetch: createHandler(
{

View File

@@ -17,6 +17,7 @@ import {
type Simplify,
sql,
} from "kysely";
import type { jsonArrayFrom, jsonBuildObject, jsonObjectFrom } from "kysely/helpers/sqlite";
import type { BaseIntrospector, BaseIntrospectorConfig } from "./BaseIntrospector";
import type { DB } from "bknd";
import type { Constructor } from "core/registry/Registry";
@@ -70,15 +71,9 @@ export type IndexSpec = {
};
export type DbFunctions = {
jsonObjectFrom<O>(expr: SelectQueryBuilderExpression<O>): RawBuilder<Simplify<O> | null>;
jsonArrayFrom<O>(expr: SelectQueryBuilderExpression<O>): RawBuilder<Simplify<O>[]>;
jsonBuildObject<O extends Record<string, Expression<unknown>>>(
obj: O,
): RawBuilder<
Simplify<{
[K in keyof O]: O[K] extends Expression<infer V> ? V : never;
}>
>;
jsonObjectFrom: typeof jsonObjectFrom;
jsonArrayFrom: typeof jsonArrayFrom;
jsonBuildObject: typeof jsonBuildObject;
};
export type ConnQuery = CompiledQuery | Compilable;

View File

@@ -18,7 +18,7 @@ export type LibsqlClientFns = {
function getClient(clientOrCredentials: Client | LibSqlCredentials | LibsqlClientFns): Client {
if (clientOrCredentials && "url" in clientOrCredentials) {
const { url, authToken } = clientOrCredentials;
return createClient({ url, authToken });
return createClient({ url, authToken }) as unknown as Client;
}
return clientOrCredentials as Client;

View File

@@ -19,9 +19,10 @@ import type { RelationField } from "data/relations";
import { useEntityAdminOptions } from "ui/options";
// simplify react form types 🤦
export type FormApi = ReactFormExtendedApi<any, any, any, any, any, any, any, any, any, any>;
// biome-ignore format: ...
export type TFieldApi = FieldApi<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
export type FormApi = ReactFormExtendedApi<any, any, any, any, any, any, any, any, any, any, any, any>;
// biome-ignore format: ...
export type TFieldApi = FieldApi<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
type EntityFormProps = {
entity: Entity;

View File

@@ -207,7 +207,7 @@ function DataEntityUpdateImpl({ params }) {
handleSubmit={handleSubmit}
fieldsDisabled={fieldsDisabled}
data={data ?? undefined}
Form={Form}
Form={Form as any}
action="update"
className="flex flex-grow flex-col gap-3 p-3"
/>

View File

@@ -121,7 +121,7 @@ export function DataEntityCreate({ params }) {
handleSubmit={handleSubmit}
fieldsDisabled={fieldsDisabled}
data={search.value}
Form={Form}
Form={Form as any}
action="create"
className="flex flex-grow flex-col gap-3 p-3"
/>