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 { MediaApi, type MediaApiOptions } from "media/api/MediaApi";
import { SystemApi } from "modules/SystemApi";
import { omitKeys } from "core/utils";
import { omitKeys } from "bknd/utils";
import type { BaseModuleApiOptions } from "modules";
export type TApiUser = SafeUser;

View File

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

View File

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

View File

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

View File

@@ -2,7 +2,7 @@ import type { DB } from "bknd";
import * as AuthPermissions from "auth/auth-permissions";
import type { AuthStrategy } from "auth/authenticate/strategies/Strategy";
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 { em, entity, enumm, type FieldSchema } from "data/prototype";
import { Module } from "modules/Module";

View File

@@ -1,6 +1,6 @@
import { AppAuth } from "auth/AppAuth";
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 {
InvalidConditionsException,

View File

@@ -1,11 +1,10 @@
import type { User } from "bknd";
import type { Authenticator } from "auth/authenticate/Authenticator";
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 { compare as bcryptCompare, genSalt as bcryptGenSalt, hash as bcryptHash } from "bcryptjs";
import { AuthStrategy } from "./Strategy";
import { s, parse, jsc } from "bknd/utils";
const schema = s
.object({

View File

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

View File

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

View File

@@ -1,5 +1,5 @@
import path from "node:path";
import { $console } from "core/utils";
import { $console } from "bknd/utils";
import type { MiddlewareHandler } from "hono";
import open from "open";
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 type { CliCommand } from "cli/types";
import { Argument } from "commander";
import { $console } from "core/utils";
import { $console, isBun } from "bknd/utils";
import c from "picocolors";
import { isBun } from "core/utils";
export const user: CliCommand = (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 { readFile, writeFile as nodeWriteFile } from "node:fs/promises";
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";
export type MailchannelsEmailOptions = {

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
import type { TestRunner } from "core/test";
import { Connection, type FieldSpec } from "./Connection";
import { getPath } from "core/utils";
import { getPath } from "bknd/utils";
import * as proto from "data/prototype";
import { createApp } from "App";
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 { FieldClassMap } from "data/fields";
import { RelationClassMap, RelationFieldClassMap } from "data/relations";

View File

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

View File

@@ -1,5 +1,5 @@
import { isDebug } from "core/env";
import { pick } from "core/utils";
import { pick } from "bknd/utils";
import type { Connection } from "data/connection";
import type {
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 { EntityManager } from "../EntityManager";
import { Result, type ResultJSON, type ResultOptions } from "../Result";

View File

@@ -1,5 +1,5 @@
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 SelectQueryBuilder, sql } from "kysely";
import { InvalidSearchParamsException } from "../../errors";

View File

@@ -2,7 +2,7 @@ import type { Entity, EntityData } from "../Entity";
import type { EntityManager } from "../EntityManager";
import { Result, type ResultJSON, type ResultOptions } from "../Result";
import type { Compilable, SelectQueryBuilder } from "kysely";
import { $console, ensureInt } from "core/utils";
import { $console, ensureInt } from "bknd/utils";
export type RepositoryResultOptions = ResultOptions & {
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 { 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 { TransformPersistFailedException } from "../errors";
import { Field, type TActionContext, type TRenderContext, baseFieldConfigSchema } from "./Field";
import { s } from "bknd/utils";
export const booleanFieldConfigSchema = s
.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 { Field, type TActionContext, type TRenderContext, baseFieldConfigSchema } from "./Field";
import { $console } from "core/utils";
import type { TFieldTSType } from "data/entities/EntityTypescript";
import { s } from "bknd/utils";
export const dateFieldConfigSchema = s
.strictObject({

View File

@@ -1,4 +1,4 @@
import { omitKeys } from "core/utils";
import { omitKeys } from "bknd/utils";
import type { EntityManager } from "data/entities";
import { TransformPersistFailedException } from "../errors";
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 { TransformPersistFailedException } from "../errors";
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 { objectToJsLiteral } from "core/utils";
import { objectToJsLiteral } from "bknd/utils";
import type { EntityManager } from "data/entities";
import { TransformPersistFailedException } from "../errors";
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 { Field, type TActionContext, type TRenderContext, baseFieldConfigSchema } from "./Field";
import type { TFieldTSType } from "data/entities/EntityTypescript";
import { s } from "bknd/utils";
import { omitKeys } from "core/utils";
import { s, omitKeys } from "bknd/utils";
export const numberFieldConfigSchema = s
.strictObject({

View File

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

View File

@@ -1,4 +1,4 @@
import { transformObject } from "core/utils";
import { transformObject } from "bknd/utils";
import { Entity } from "data/entities";
import type { Field } from "data/fields";
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 { isObject, $console } from "core/utils";
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 { s } from "bknd/utils";
export const TASKS = {
...TaskMap,

View File

@@ -2,7 +2,7 @@ import { Event, EventManager, type ListenerHandler } from "core/events";
import type { EmitsEvents } from "core/events";
import type { Task, TaskResult } from "../tasks/Task";
import type { Flow } from "./Flow";
import { $console } from "core/utils";
import { $console } from "bknd/utils";
export type TaskLog = TaskResult & {
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 { Task } from "../tasks/Task";
import { Condition, TaskConnection } from "../tasks/TaskConnection";

View File

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

View File

@@ -1,8 +1,7 @@
import type { EventManager } from "core/events";
import type { Flow } from "../Flow";
import { Trigger } from "./Trigger";
import { $console } from "core/utils";
import { s } from "bknd/utils";
import { $console, s } from "bknd/utils";
export class EventTrigger extends Trigger<typeof EventTrigger.schema> {
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 type { Task, TaskResult } from "./Task";

View File

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

View File

@@ -1,5 +1,5 @@
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 { Storage } from "media/storage/Storage";
import { Module } from "modules/Module";

View File

@@ -1,5 +1,5 @@
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 * as StorageEvents 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 { StorageAdapter } from "../../StorageAdapter";
import { s, parse } from "bknd/utils";
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 { set } from "lodash-es";

View File

@@ -1,6 +1,6 @@
import { type NotificationData, notifications } from "@mantine/notifications";
import type { Api } from "Api";
import { ucFirst } from "core/utils";
import { ucFirst } from "bknd/utils";
import type { ModuleConfigs } from "modules";
import type { ResponseObject } from "modules/ModuleApi";
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 { JSONSchema } from "json-schema-to-ts";
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) {
return value === null || value === undefined || value === "";