cleaned up left over bknd/utils imports (#235)

This commit is contained in:
dswbx
2025-08-12 16:12:10 +02:00
committed by GitHub
parent 725a2d453a
commit 97d6af3792
45 changed files with 47 additions and 60 deletions

View File

@@ -4,7 +4,7 @@ import { DataApi, type DataApiOptions } from "data/api/DataApi";
import { decode } from "hono/jwt"; import { decode } from "hono/jwt";
import { MediaApi, type MediaApiOptions } from "media/api/MediaApi"; import { MediaApi, type MediaApiOptions } from "media/api/MediaApi";
import { SystemApi } from "modules/SystemApi"; import { SystemApi } from "modules/SystemApi";
import { omitKeys } from "core/utils"; import { omitKeys } from "bknd/utils";
import type { BaseModuleApiOptions } from "modules"; import type { BaseModuleApiOptions } from "modules";
export type TApiUser = SafeUser; export type TApiUser = SafeUser;

View File

@@ -1,5 +1,5 @@
import type { CreateUserPayload } from "auth/AppAuth"; import type { CreateUserPayload } from "auth/AppAuth";
import { $console } from "core/utils"; import { $console } from "bknd/utils";
import { Event } from "core/events"; import { Event } from "core/events";
import type { em as prototypeEm } from "data/prototype"; import type { em as prototypeEm } from "data/prototype";
import { Connection } from "data/connection/Connection"; import { Connection } from "data/connection/Connection";

View File

@@ -6,7 +6,7 @@ import { serveStatic } from "hono/cloudflare-workers";
import { getFresh } from "./modes/fresh"; import { getFresh } from "./modes/fresh";
import { getCached } from "./modes/cached"; import { getCached } from "./modes/cached";
import type { App, MaybePromise } from "bknd"; import type { App, MaybePromise } from "bknd";
import { $console } from "core/utils"; import { $console } from "bknd/utils";
declare global { declare global {
namespace Cloudflare { namespace Cloudflare {

View File

@@ -9,7 +9,7 @@ import { d1Sqlite } from "./connection/D1Connection";
import type { CloudflareBkndConfig, CloudflareEnv } from "."; import type { CloudflareBkndConfig, CloudflareEnv } from ".";
import { App } from "bknd"; import { App } from "bknd";
import type { Context, ExecutionContext } from "hono"; import type { Context, ExecutionContext } from "hono";
import { $console } from "core/utils"; import { $console } from "bknd/utils";
import { setCookie } from "hono/cookie"; import { setCookie } from "hono/cookie";
export const constants = { export const constants = {

View File

@@ -2,7 +2,7 @@ import type { DB } from "bknd";
import * as AuthPermissions from "auth/auth-permissions"; import * as AuthPermissions from "auth/auth-permissions";
import type { AuthStrategy } from "auth/authenticate/strategies/Strategy"; import type { AuthStrategy } from "auth/authenticate/strategies/Strategy";
import type { PasswordStrategy } from "auth/authenticate/strategies/PasswordStrategy"; import type { PasswordStrategy } from "auth/authenticate/strategies/PasswordStrategy";
import { $console, secureRandomString, transformObject } from "core/utils"; import { $console, secureRandomString, transformObject } from "bknd/utils";
import type { Entity, EntityManager } from "data/entities"; import type { Entity, EntityManager } from "data/entities";
import { em, entity, enumm, type FieldSchema } from "data/prototype"; import { em, entity, enumm, type FieldSchema } from "data/prototype";
import { Module } from "modules/Module"; import { Module } from "modules/Module";

View File

@@ -1,6 +1,6 @@
import { AppAuth } from "auth/AppAuth"; import { AppAuth } from "auth/AppAuth";
import type { CreateUser, SafeUser, User, UserPool } from "auth/authenticate/Authenticator"; import type { CreateUser, SafeUser, User, UserPool } from "auth/authenticate/Authenticator";
import { $console } from "core/utils"; import { $console } from "bknd/utils";
import { pick } from "lodash-es"; import { pick } from "lodash-es";
import { import {
InvalidConditionsException, InvalidConditionsException,

View File

@@ -1,11 +1,10 @@
import type { User } from "bknd"; import type { User } from "bknd";
import type { Authenticator } from "auth/authenticate/Authenticator"; import type { Authenticator } from "auth/authenticate/Authenticator";
import { InvalidCredentialsException } from "auth/errors"; import { InvalidCredentialsException } from "auth/errors";
import { hash, $console } from "core/utils"; import { hash, $console, s, parse, jsc } from "bknd/utils";
import { Hono } from "hono"; import { Hono } from "hono";
import { compare as bcryptCompare, genSalt as bcryptGenSalt, hash as bcryptHash } from "bcryptjs"; import { compare as bcryptCompare, genSalt as bcryptGenSalt, hash as bcryptHash } from "bcryptjs";
import { AuthStrategy } from "./Strategy"; import { AuthStrategy } from "./Strategy";
import { s, parse, jsc } from "bknd/utils";
const schema = s const schema = s
.object({ .object({

View File

@@ -1,5 +1,5 @@
import { Exception } from "core/errors"; import { Exception } from "core/errors";
import { $console, objectTransform } from "core/utils"; import { $console, objectTransform } from "bknd/utils";
import { Permission } from "core/security/Permission"; import { Permission } from "core/security/Permission";
import type { Context } from "hono"; import type { Context } from "hono";
import type { ServerEnv } from "modules/Controller"; import type { ServerEnv } from "modules/Controller";

View File

@@ -1,7 +1,6 @@
import * as $p from "@clack/prompts"; import * as $p from "@clack/prompts";
import { overrideJson, overridePackageJson } from "cli/commands/create/npm"; import { overrideJson } from "cli/commands/create/npm";
import { typewriter, wait } from "cli/utils/cli"; import { typewriter } from "cli/utils/cli";
import { uuid } from "core/utils";
import c from "picocolors"; import c from "picocolors";
import type { Template, TemplateSetupCtx } from "."; import type { Template, TemplateSetupCtx } from ".";
import { exec } from "cli/utils/sys"; import { exec } from "cli/utils/sys";

View File

@@ -1,5 +1,5 @@
import path from "node:path"; import path from "node:path";
import { $console } from "core/utils"; import { $console } from "bknd/utils";
import type { MiddlewareHandler } from "hono"; import type { MiddlewareHandler } from "hono";
import open from "open"; import open from "open";
import { fileExists, getRelativeDistPath } from "../../utils/sys"; import { fileExists, getRelativeDistPath } from "../../utils/sys";

View File

@@ -9,9 +9,8 @@ import type { PasswordStrategy } from "auth/authenticate/strategies";
import { makeAppFromEnv } from "cli/commands/run"; import { makeAppFromEnv } from "cli/commands/run";
import type { CliCommand } from "cli/types"; import type { CliCommand } from "cli/types";
import { Argument } from "commander"; import { Argument } from "commander";
import { $console } from "core/utils"; import { $console, isBun } from "bknd/utils";
import c from "picocolors"; import c from "picocolors";
import { isBun } from "core/utils";
export const user: CliCommand = (program) => { export const user: CliCommand = (program) => {
program program

View File

@@ -1,4 +1,4 @@
import { $console } from "core/utils"; import { $console } from "bknd/utils";
import { execSync, exec as nodeExec } from "node:child_process"; import { execSync, exec as nodeExec } from "node:child_process";
import { readFile, writeFile as nodeWriteFile } from "node:fs/promises"; import { readFile, writeFile as nodeWriteFile } from "node:fs/promises";
import path from "node:path"; import path from "node:path";

View File

@@ -1,4 +1,4 @@
import { mergeObject, type RecursivePartial } from "core/utils"; import { mergeObject, type RecursivePartial } from "bknd/utils";
import type { IEmailDriver } from "./index"; import type { IEmailDriver } from "./index";
export type MailchannelsEmailOptions = { export type MailchannelsEmailOptions = {

View File

@@ -1,6 +1,6 @@
import { type Event, type EventClass, InvalidEventReturn } from "./Event"; import { type Event, type EventClass, InvalidEventReturn } from "./Event";
import { EventListener, type ListenerHandler, type ListenerMode } from "./EventListener"; import { EventListener, type ListenerHandler, type ListenerMode } from "./EventListener";
import { $console } from "core/utils"; import { $console } from "bknd/utils";
export type RegisterListenerConfig = export type RegisterListenerConfig =
| ListenerMode | ListenerMode

View File

@@ -1,4 +1,4 @@
import { transformObject } from "core/utils"; import { transformObject } from "bknd/utils";
import { Module } from "modules/Module"; import { Module } from "modules/Module";
import { DataController } from "./api/DataController"; import { DataController } from "./api/DataController";

View File

@@ -1,6 +1,6 @@
import type { TestRunner } from "core/test"; import type { TestRunner } from "core/test";
import { Connection, type FieldSpec } from "./Connection"; import { Connection, type FieldSpec } from "./Connection";
import { getPath } from "core/utils"; import { getPath } from "bknd/utils";
import * as proto from "data/prototype"; import * as proto from "data/prototype";
import { createApp } from "App"; import { createApp } from "App";
import type { MaybePromise } from "core/types"; import type { MaybePromise } from "core/types";

View File

@@ -1,4 +1,4 @@
import { objectTransform } from "core/utils"; import { objectTransform } from "bknd/utils";
import { MediaField, mediaFieldConfigSchema } from "../media/MediaField"; import { MediaField, mediaFieldConfigSchema } from "../media/MediaField";
import { FieldClassMap } from "data/fields"; import { FieldClassMap } from "data/fields";
import { RelationClassMap, RelationFieldClassMap } from "data/relations"; import { RelationClassMap, RelationFieldClassMap } from "data/relations";

View File

@@ -1,6 +1,6 @@
import type { Entity, EntityManager, TEntityType } from "data/entities"; import type { Entity, EntityManager, TEntityType } from "data/entities";
import type { EntityRelation } from "data/relations"; import type { EntityRelation } from "data/relations";
import { autoFormatString } from "core/utils"; import { autoFormatString } from "bknd/utils";
import { usersFields } from "auth/auth-entities"; import { usersFields } from "auth/auth-entities";
import { mediaFields } from "media/media-entities"; import { mediaFields } from "media/media-entities";

View File

@@ -1,5 +1,5 @@
import { isDebug } from "core/env"; import { isDebug } from "core/env";
import { pick } from "core/utils"; import { pick } from "bknd/utils";
import type { Connection } from "data/connection"; import type { Connection } from "data/connection";
import type { import type {
Compilable, Compilable,

View File

@@ -1,4 +1,4 @@
import { $console } from "core/utils"; import { $console } from "bknd/utils";
import type { Entity, EntityData } from "../Entity"; import type { Entity, EntityData } from "../Entity";
import type { EntityManager } from "../EntityManager"; import type { EntityManager } from "../EntityManager";
import { Result, type ResultJSON, type ResultOptions } from "../Result"; import { Result, type ResultJSON, type ResultOptions } from "../Result";

View File

@@ -1,5 +1,5 @@
import type { DB as DefaultDB, PrimaryFieldType } from "bknd"; import type { DB as DefaultDB, PrimaryFieldType } from "bknd";
import { $console } from "core/utils"; import { $console } from "bknd/utils";
import { type EmitsEvents, EventManager } from "core/events"; import { type EmitsEvents, EventManager } from "core/events";
import { type SelectQueryBuilder, sql } from "kysely"; import { type SelectQueryBuilder, sql } from "kysely";
import { InvalidSearchParamsException } from "../../errors"; import { InvalidSearchParamsException } from "../../errors";

View File

@@ -2,7 +2,7 @@ import type { Entity, EntityData } from "../Entity";
import type { EntityManager } from "../EntityManager"; import type { EntityManager } from "../EntityManager";
import { Result, type ResultJSON, type ResultOptions } from "../Result"; import { Result, type ResultJSON, type ResultOptions } from "../Result";
import type { Compilable, SelectQueryBuilder } from "kysely"; import type { Compilable, SelectQueryBuilder } from "kysely";
import { $console, ensureInt } from "core/utils"; import { $console, ensureInt } from "bknd/utils";
export type RepositoryResultOptions = ResultOptions & { export type RepositoryResultOptions = ResultOptions & {
silent?: boolean; silent?: boolean;

View File

@@ -1,4 +1,4 @@
import { isObject } from "core/utils"; import { isObject } from "bknd/utils";
import type { KyselyJsonFrom } from "data/relations/EntityRelation"; import type { KyselyJsonFrom } from "data/relations/EntityRelation";
import type { RepoQuery } from "data/server/query"; import type { RepoQuery } from "data/server/query";

View File

@@ -1,8 +1,7 @@
import { omitKeys } from "core/utils"; import { omitKeys, s } from "bknd/utils";
import type { EntityManager } from "data/entities"; import type { EntityManager } from "data/entities";
import { TransformPersistFailedException } from "../errors"; import { TransformPersistFailedException } from "../errors";
import { Field, type TActionContext, type TRenderContext, baseFieldConfigSchema } from "./Field"; import { Field, type TActionContext, type TRenderContext, baseFieldConfigSchema } from "./Field";
import { s } from "bknd/utils";
export const booleanFieldConfigSchema = s export const booleanFieldConfigSchema = s
.strictObject({ .strictObject({

View File

@@ -1,9 +1,7 @@
import { dayjs } from "core/utils"; import { dayjs, $console, s } from "bknd/utils";
import type { EntityManager } from "../entities"; import type { EntityManager } from "../entities";
import { Field, type TActionContext, type TRenderContext, baseFieldConfigSchema } from "./Field"; import { Field, type TActionContext, type TRenderContext, baseFieldConfigSchema } from "./Field";
import { $console } from "core/utils";
import type { TFieldTSType } from "data/entities/EntityTypescript"; import type { TFieldTSType } from "data/entities/EntityTypescript";
import { s } from "bknd/utils";
export const dateFieldConfigSchema = s export const dateFieldConfigSchema = s
.strictObject({ .strictObject({

View File

@@ -1,4 +1,4 @@
import { omitKeys } from "core/utils"; import { omitKeys } from "bknd/utils";
import type { EntityManager } from "data/entities"; import type { EntityManager } from "data/entities";
import { TransformPersistFailedException } from "../errors"; import { TransformPersistFailedException } from "../errors";
import { baseFieldConfigSchema, Field, type TActionContext, type TRenderContext } from "./Field"; import { baseFieldConfigSchema, Field, type TActionContext, type TRenderContext } from "./Field";

View File

@@ -1,4 +1,4 @@
import { omitKeys } from "core/utils"; import { omitKeys } from "bknd/utils";
import type { EntityManager } from "data/entities"; import type { EntityManager } from "data/entities";
import { TransformPersistFailedException } from "../errors"; import { TransformPersistFailedException } from "../errors";
import { Field, type TActionContext, type TRenderContext, baseFieldConfigSchema } from "./Field"; import { Field, type TActionContext, type TRenderContext, baseFieldConfigSchema } from "./Field";

View File

@@ -1,5 +1,5 @@
import { type Schema as JsonSchema, Validator } from "@cfworker/json-schema"; import { type Schema as JsonSchema, Validator } from "@cfworker/json-schema";
import { objectToJsLiteral } from "core/utils"; import { objectToJsLiteral } from "bknd/utils";
import type { EntityManager } from "data/entities"; import type { EntityManager } from "data/entities";
import { TransformPersistFailedException } from "../errors"; import { TransformPersistFailedException } from "../errors";
import { Field, type TActionContext, type TRenderContext, baseFieldConfigSchema } from "./Field"; import { Field, type TActionContext, type TRenderContext, baseFieldConfigSchema } from "./Field";

View File

@@ -2,8 +2,7 @@ import type { EntityManager } from "data/entities";
import { TransformPersistFailedException } from "../errors"; import { TransformPersistFailedException } from "../errors";
import { Field, type TActionContext, type TRenderContext, baseFieldConfigSchema } from "./Field"; import { Field, type TActionContext, type TRenderContext, baseFieldConfigSchema } from "./Field";
import type { TFieldTSType } from "data/entities/EntityTypescript"; import type { TFieldTSType } from "data/entities/EntityTypescript";
import { s } from "bknd/utils"; import { s, omitKeys } from "bknd/utils";
import { omitKeys } from "core/utils";
export const numberFieldConfigSchema = s export const numberFieldConfigSchema = s
.strictObject({ .strictObject({

View File

@@ -1,8 +1,7 @@
import type { EntityManager } from "data/entities"; import type { EntityManager } from "data/entities";
import { omitKeys } from "core/utils"; import { omitKeys, s } from "bknd/utils";
import { TransformPersistFailedException } from "../errors"; import { TransformPersistFailedException } from "../errors";
import { Field, type TActionContext, baseFieldConfigSchema } from "./Field"; import { Field, type TActionContext, baseFieldConfigSchema } from "./Field";
import { s } from "bknd/utils";
export const textFieldConfigSchema = s export const textFieldConfigSchema = s
.strictObject({ .strictObject({

View File

@@ -1,4 +1,4 @@
import { transformObject } from "core/utils"; import { transformObject } from "bknd/utils";
import { Entity } from "data/entities"; import { Entity } from "data/entities";
import type { Field } from "data/fields"; import type { Field } from "data/fields";
import { FIELDS, RELATIONS, type TAppDataEntity, type TAppDataRelation } from "data/data-schema"; import { FIELDS, RELATIONS, type TAppDataEntity, type TAppDataRelation } from "data/data-schema";

View File

@@ -1,6 +1,5 @@
import { s } from "bknd/utils"; import { s, isObject, $console } from "bknd/utils";
import { WhereBuilder, type WhereQuery } from "data/entities/query/WhereBuilder"; import { WhereBuilder, type WhereQuery } from "data/entities/query/WhereBuilder";
import { isObject, $console } from "core/utils";
import type { anyOf, CoercionOptions, Schema } from "jsonv-ts"; import type { anyOf, CoercionOptions, Schema } from "jsonv-ts";
// ------- // -------

View File

@@ -1,6 +1,5 @@
import { transformObject } from "core/utils"; import { transformObject, s } from "bknd/utils";
import { TaskMap, TriggerMap } from "flows"; import { TaskMap, TriggerMap } from "flows";
import { s } from "bknd/utils";
export const TASKS = { export const TASKS = {
...TaskMap, ...TaskMap,

View File

@@ -2,7 +2,7 @@ import { Event, EventManager, type ListenerHandler } from "core/events";
import type { EmitsEvents } from "core/events"; import type { EmitsEvents } from "core/events";
import type { Task, TaskResult } from "../tasks/Task"; import type { Task, TaskResult } from "../tasks/Task";
import type { Flow } from "./Flow"; import type { Flow } from "./Flow";
import { $console } from "core/utils"; import { $console } from "bknd/utils";
export type TaskLog = TaskResult & { export type TaskLog = TaskResult & {
task: Task; task: Task;

View File

@@ -1,4 +1,4 @@
import { $console, transformObject } from "core/utils"; import { $console, transformObject } from "bknd/utils";
import { type TaskMapType, TriggerMap } from "../index"; import { type TaskMapType, TriggerMap } from "../index";
import type { Task } from "../tasks/Task"; import type { Task } from "../tasks/Task";
import { Condition, TaskConnection } from "../tasks/TaskConnection"; import { Condition, TaskConnection } from "../tasks/TaskConnection";

View File

@@ -1,5 +1,5 @@
import type { Task } from "../../tasks/Task"; import type { Task } from "../../tasks/Task";
import { $console } from "core/utils"; import { $console } from "bknd/utils";
export class RuntimeExecutor { export class RuntimeExecutor {
async run( async run(

View File

@@ -1,8 +1,7 @@
import type { EventManager } from "core/events"; import type { EventManager } from "core/events";
import type { Flow } from "../Flow"; import type { Flow } from "../Flow";
import { Trigger } from "./Trigger"; import { Trigger } from "./Trigger";
import { $console } from "core/utils"; import { $console, s } from "bknd/utils";
import { s } from "bknd/utils";
export class EventTrigger extends Trigger<typeof EventTrigger.schema> { export class EventTrigger extends Trigger<typeof EventTrigger.schema> {
override type = "event"; override type = "event";

View File

@@ -1,4 +1,4 @@
import { objectCleanEmpty, uuid } from "core/utils"; import { objectCleanEmpty, uuid } from "bknd/utils";
import { get } from "lodash-es"; import { get } from "lodash-es";
import type { Task, TaskResult } from "./Task"; import type { Task, TaskResult } from "./Task";

View File

@@ -1,6 +1,5 @@
import { Task } from "../Task"; import { Task } from "../Task";
import { $console } from "core/utils"; import { $console, s } from "bknd/utils";
import { s } from "bknd/utils";
export class LogTask extends Task<typeof LogTask.schema> { export class LogTask extends Task<typeof LogTask.schema> {
type = "log"; type = "log";

View File

@@ -1,5 +1,5 @@
import type { AppEntity, FileUploadedEventData, StorageAdapter } from "bknd"; import type { AppEntity, FileUploadedEventData, StorageAdapter } from "bknd";
import { $console } from "core/utils"; import { $console } from "bknd/utils";
import type { Entity, EntityManager } from "data/entities"; import type { Entity, EntityManager } from "data/entities";
import { Storage } from "media/storage/Storage"; import { Storage } from "media/storage/Storage";
import { Module } from "modules/Module"; import { Module } from "modules/Module";

View File

@@ -1,5 +1,5 @@
import { type EmitsEvents, EventManager } from "core/events"; import { type EmitsEvents, EventManager } from "core/events";
import { $console, isFile, detectImageDimensions } from "core/utils"; import { $console, isFile, detectImageDimensions } from "bknd/utils";
import { isMimeType } from "media/storage/mime-types-tiny"; import { isMimeType } from "media/storage/mime-types-tiny";
import * as StorageEvents from "./events"; import * as StorageEvents from "./events";
import type { FileUploadedEventData } from "./events"; import type { FileUploadedEventData } from "./events";

View File

@@ -1,7 +1,6 @@
import { hash, pickHeaders } from "core/utils"; import { hash, pickHeaders, s, parse } from "bknd/utils";
import type { FileBody, FileListObject, FileMeta } from "../../Storage"; import type { FileBody, FileListObject, FileMeta } from "../../Storage";
import { StorageAdapter } from "../../StorageAdapter"; import { StorageAdapter } from "../../StorageAdapter";
import { s, parse } from "bknd/utils";
export const cloudinaryAdapterConfig = s.object( export const cloudinaryAdapterConfig = s.object(
{ {

View File

@@ -1,4 +1,4 @@
import { transformObject } from "core/utils"; import { transformObject } from "bknd/utils";
import type { Kysely } from "kysely"; import type { Kysely } from "kysely";
import { set } from "lodash-es"; import { set } from "lodash-es";

View File

@@ -1,6 +1,6 @@
import { type NotificationData, notifications } from "@mantine/notifications"; import { type NotificationData, notifications } from "@mantine/notifications";
import type { Api } from "Api"; import type { Api } from "Api";
import { ucFirst } from "core/utils"; import { ucFirst } from "bknd/utils";
import type { ModuleConfigs } from "modules"; import type { ModuleConfigs } from "modules";
import type { ResponseObject } from "modules/ModuleApi"; import type { ResponseObject } from "modules/ModuleApi";
import type { ConfigUpdateResponse } from "modules/server/SystemController"; import type { ConfigUpdateResponse } from "modules/server/SystemController";

View File

@@ -1,9 +1,9 @@
import { autoFormatString, omitKeys } from "core/utils"; import { autoFormatString, omitKeys } from "bknd/utils";
import { type Draft, Draft2019, type JsonSchema } from "json-schema-library"; import { type Draft, Draft2019, type JsonSchema } from "json-schema-library";
import type { JSONSchema } from "json-schema-to-ts"; import type { JSONSchema } from "json-schema-to-ts";
import type { JSONSchemaType } from "json-schema-to-ts/lib/types/definitions/jsonSchema"; import type { JSONSchemaType } from "json-schema-to-ts/lib/types/definitions/jsonSchema";
export { isEqual, getPath } from "core/utils/objects"; export { isEqual, getPath } from "bknd/utils";
export function isNotDefined(value: any) { export function isNotDefined(value: any) {
return value === null || value === undefined || value === ""; return value === null || value === undefined || value === "";