mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
merge origin/release/0.20
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
/// <reference types="bun-types" />
|
||||
|
||||
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 +58,7 @@ export function serve<Env = BunEnv>(
|
||||
args: Env = Bun.env as Env,
|
||||
) {
|
||||
Bun.serve({
|
||||
...serveOptions,
|
||||
...(serveOptions as any),
|
||||
port,
|
||||
fetch: createHandler(
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { createFrameworkApp, type FrameworkBkndConfig } from "bknd/adapter";
|
||||
import { isNode } from "bknd/utils";
|
||||
// @ts-expect-error next is not installed
|
||||
import type { NextApiRequest } from "next";
|
||||
|
||||
type NextjsEnv = NextApiRequest["env"];
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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"
|
||||
/>
|
||||
|
||||
@@ -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"
|
||||
/>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { JSONSchema7 } from "json-schema";
|
||||
import type { JSONSchema } from "json-schema-to-ts";
|
||||
import { omitKeys, type s } from "bknd/utils";
|
||||
|
||||
export function extractSchema<
|
||||
@@ -10,7 +10,7 @@ export function extractSchema<
|
||||
config: Config,
|
||||
keys: Keys[],
|
||||
): [
|
||||
JSONSchema7,
|
||||
Exclude<JSONSchema, boolean | null | undefined>,
|
||||
Partial<Config>,
|
||||
{
|
||||
[K in Keys]: {
|
||||
|
||||
Reference in New Issue
Block a user