mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
optimized performance
This commit is contained in:
@@ -27,7 +27,7 @@ export class SchemaObject<Schema extends TSchema = TSchema> {
|
||||
) {
|
||||
this._default = deepFreeze(_schema.template({}, { withOptional: true }) as any);
|
||||
this._value = deepFreeze(
|
||||
parse(_schema, structuredClone(initial ?? {}), {
|
||||
parse(_schema, initial ?? {}, {
|
||||
withDefaults: true,
|
||||
//withExtendedDefaults: true,
|
||||
forceParse: this.isForceParse(),
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
import { createApp as createAppInternal, type CreateAppConfig } from "App";
|
||||
import { bunSqlite } from "adapter/bun/connection/BunSqliteConnection";
|
||||
import { Connection } from "data/connection/Connection";
|
||||
import type { getSystemMcp } from "modules/mcp/system-mcp";
|
||||
import { Connection, createApp as createAppInternal, type CreateAppConfig } from "bknd";
|
||||
import { bunSqlite } from "bknd/adapter/bun";
|
||||
import type { McpServer } from "bknd/utils";
|
||||
|
||||
export { App } from "App";
|
||||
export { App } from "bknd";
|
||||
|
||||
export function createApp({ connection, ...config }: CreateAppConfig = {}) {
|
||||
return createAppInternal({
|
||||
...config,
|
||||
connection: Connection.isConnection(connection) ? connection : bunSqlite(connection as any),
|
||||
connection: Connection.isConnection(connection)
|
||||
? connection
|
||||
: (bunSqlite(connection as any) as any),
|
||||
});
|
||||
}
|
||||
|
||||
export function createMcpToolCaller() {
|
||||
return async (server: ReturnType<typeof getSystemMcp>, name: string, args: any, raw?: any) => {
|
||||
return async (server: McpServer, name: string, args: any, raw?: any) => {
|
||||
const res = await server.handle(
|
||||
{
|
||||
jsonrpc: "2.0",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { extension, guess, isMimeType } from "media/storage/mime-types-tiny";
|
||||
import { randomString } from "core/utils/strings";
|
||||
import { randomString } from "./strings";
|
||||
import type { Context } from "hono";
|
||||
import { invariant } from "core/utils/runtime";
|
||||
import { invariant } from "./runtime";
|
||||
import { $console } from "./console";
|
||||
|
||||
export function getContentName(request: Request): string | undefined;
|
||||
|
||||
@@ -14,3 +14,4 @@ export * from "./test";
|
||||
export * from "./runtime";
|
||||
export * from "./numbers";
|
||||
export * from "./schema";
|
||||
export { DebugLogger } from "./DebugLogger";
|
||||
|
||||
@@ -10,6 +10,7 @@ export {
|
||||
mcpTool,
|
||||
mcpResource,
|
||||
getMcpServer,
|
||||
stdioTransport,
|
||||
type ToolAnnotation,
|
||||
type ToolHandlerCtx,
|
||||
} from "jsonv-ts/mcp";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { StringSchema, type IStringOptions } from "jsonv-ts";
|
||||
import { s } from "bknd/utils";
|
||||
|
||||
export class SecretSchema<O extends IStringOptions> extends StringSchema<O> {}
|
||||
export class SecretSchema<O extends s.IStringOptions> extends s.StringSchema<O> {}
|
||||
|
||||
export const secret = <O extends IStringOptions>(o?: O): SecretSchema<O> & O =>
|
||||
export const secret = <O extends s.IStringOptions>(o?: O): SecretSchema<O> & O =>
|
||||
new SecretSchema(o) as any;
|
||||
|
||||
Reference in New Issue
Block a user