mirror of
https://github.com/bknd-io/bknd/
synced 2026-08-02 08:06:00 +00:00
fix schema import path
This commit is contained in:
@@ -6,7 +6,7 @@ import { dataConfigSchema } from "../../src/data/data-schema";
|
||||
import * as proto from "../../src/data/prototype";
|
||||
import { schemaToEm } from "../helper";
|
||||
import { disableConsoleLog, enableConsoleLog } from "core/utils/test";
|
||||
import { parse } from "core/object/schema";
|
||||
import { parse } from "bknd/core";
|
||||
|
||||
beforeAll(disableConsoleLog);
|
||||
afterAll(enableConsoleLog);
|
||||
|
||||
@@ -2,7 +2,7 @@ import { describe, expect, test } from "bun:test";
|
||||
import { Authenticator, type User, type UserPool } from "../../src/auth";
|
||||
import { cookieConfig } from "../../src/auth/authenticate/Authenticator";
|
||||
import { PasswordStrategy } from "../../src/auth/authenticate/strategies/PasswordStrategy";
|
||||
import { parse } from "core/object/schema";
|
||||
import { parse } from "bknd/core";
|
||||
|
||||
/*class MemoryUserPool implements UserPool {
|
||||
constructor(private users: User[] = []) {}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { Registry } from "core";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
type Constructor<T> = new (...args: any[]) => T;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { SchemaObject } from "../../../src/core";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
describe("SchemaObject", async () => {
|
||||
test("basic", async () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { afterAll, beforeAll, describe, expect, test } from "bun:test";
|
||||
|
||||
import { Guard } from "../../src/auth";
|
||||
import { parse } from "core/object/schema";
|
||||
import { parse } from "bknd/core";
|
||||
import {
|
||||
Entity,
|
||||
type EntityData,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { afterAll, expect as bunExpect, describe, test } from "bun:test";
|
||||
import { stripMark } from "core/object/schema";
|
||||
import { stripMark } from "bknd/core";
|
||||
import { Entity, EntityManager, PolymorphicRelation, TextField } from "../../src/data";
|
||||
import { getDummyConnection } from "./helper";
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { describe, expect, test } from "bun:test";
|
||||
import { baseFieldConfigSchema, Field } from "../../../../src/data/fields/Field";
|
||||
import { fieldTestSuite } from "data/fields/field-test-suite";
|
||||
import { bunTestRunner } from "adapter/bun/test";
|
||||
import { stripMark } from "core/object/schema";
|
||||
import { stripMark } from "bknd/core";
|
||||
|
||||
describe("[data] Field", async () => {
|
||||
class FieldSpec extends Field {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { Entity, EntityIndex, Field } from "../../../../src/data";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
class TestField extends Field {
|
||||
protected getSchema(): any {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { Flow, LogTask, SubFlowTask, RenderTask, Task } from "../../src/flows";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
export class StringifyTask<Output extends string> extends Task<
|
||||
typeof StringifyTask.schema,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { Task } from "../../src/flows";
|
||||
import { dynamic } from "../../src/flows/tasks/Task";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
describe.skip("Task", async () => {
|
||||
test("resolveParams: template with parse", async () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { Hono } from "hono";
|
||||
import { Event, EventManager } from "../../src/core/events";
|
||||
import { s, parse } from "core/object/schema";
|
||||
import { s, parse } from "bknd/core";
|
||||
import { EventTrigger, Flow, HttpTrigger, type InputsMap, Task } from "../../src/flows";
|
||||
import { dynamic } from "../../src/flows/tasks/Task";
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { isEqual } from "lodash-es";
|
||||
import { _jsonp, withDisabledConsole } from "../../src/core/utils";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
import { Condition, ExecutionEvent, FetchTask, Flow, LogTask, Task } from "../../src/flows";
|
||||
|
||||
/*beforeAll(disableConsoleLog);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { beforeEach, describe, expect, test } from "bun:test";
|
||||
import { parse } from "core/object/schema";
|
||||
import { parse } from "bknd/core";
|
||||
import { fieldsSchema } from "../../src/data/data-schema";
|
||||
import { AppData, type ModuleBuildContext } from "../../src/modules";
|
||||
import { makeCtx, moduleTestSuite } from "./module-test-suite";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { s, stripMark } from "core/object/schema";
|
||||
import { s, stripMark } from "bknd/core";
|
||||
import { EntityManager, em, entity, index, text } from "../../src/data";
|
||||
import { DummyConnection } from "../../src/data/connection/DummyConnection";
|
||||
import { Module } from "../../src/modules/Module";
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Module } from "modules/Module";
|
||||
import { type ConfigTable, getDefaultConfig, ModuleManager } from "modules/ModuleManager";
|
||||
import { CURRENT_VERSION, TABLE_NAME } from "modules/migrations";
|
||||
import { getDummyConnection } from "../helper";
|
||||
import { s, stripMark } from "core/object/schema";
|
||||
import { s, stripMark } from "bknd/core";
|
||||
|
||||
describe("ModuleManager", async () => {
|
||||
test("s1: no config, no build", async () => {
|
||||
|
||||
@@ -12,7 +12,10 @@ export function getBindings<T extends GetBindingType>(env: any, type: T): Bindin
|
||||
const bindings: BindingMap<T>[] = [];
|
||||
for (const key in env) {
|
||||
try {
|
||||
if (env[key] && (env[key] as any).constructor.name === type) {
|
||||
if (
|
||||
env[key] &&
|
||||
((env[key] as any).constructor.name === type || String(env[key]) === `[object ${type}]`)
|
||||
) {
|
||||
bindings.push({
|
||||
key,
|
||||
value: env[key] as BindingTypeMap[T],
|
||||
|
||||
@@ -13,7 +13,7 @@ export {
|
||||
type BindingMap,
|
||||
} from "./bindings";
|
||||
export { constants } from "./config";
|
||||
export { StorageR2Adapter } from "./storage/StorageR2Adapter";
|
||||
export { StorageR2Adapter, registerMedia } from "./storage/StorageR2Adapter";
|
||||
export { registries } from "bknd";
|
||||
|
||||
// for compatibility with old code
|
||||
|
||||
@@ -2,7 +2,7 @@ import { registries } from "bknd";
|
||||
import { isDebug } from "bknd/core";
|
||||
import { guessMimeType as guess, StorageAdapter, type FileBody } from "bknd/media";
|
||||
import { getBindings } from "../bindings";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
export function makeSchema(bindings: string[] = []) {
|
||||
return s.object(
|
||||
|
||||
@@ -2,7 +2,7 @@ import { readFile, readdir, stat, unlink, writeFile } from "node:fs/promises";
|
||||
import { isFile } from "bknd/utils";
|
||||
import type { FileBody, FileListObject, FileMeta, FileUploadPayload } from "bknd/media";
|
||||
import { StorageAdapter, guessMimeType as guess } from "bknd/media";
|
||||
import { parse, s } from "core/object/schema";
|
||||
import { parse, s } from "bknd/core";
|
||||
|
||||
export const localAdapterConfig = s.object(
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ import { transformObject } from "core/utils";
|
||||
import { DataPermissions } from "data";
|
||||
import type { Hono } from "hono";
|
||||
import { Controller, type ServerEnv } from "modules/Controller";
|
||||
import { describeRoute, jsc, s, parse, InvalidSchemaError } from "core/object/schema";
|
||||
import { describeRoute, jsc, s, parse, InvalidSchemaError } from "bknd/core";
|
||||
|
||||
export type AuthActionResponse = {
|
||||
success: boolean;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { cookieConfig, jwtConfig } from "auth/authenticate/Authenticator";
|
||||
import { CustomOAuthStrategy, OAuthStrategy, PasswordStrategy } from "auth/authenticate/strategies";
|
||||
import { objectTransform } from "core/utils";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
export const Strategies = {
|
||||
password: {
|
||||
|
||||
@@ -8,7 +8,7 @@ import type { CookieOptions } from "hono/utils/cookie";
|
||||
import type { ServerEnv } from "modules/Controller";
|
||||
import { pick } from "lodash-es";
|
||||
import { InvalidConditionsException } from "auth/errors";
|
||||
import { s, parse, secret } from "core/object/schema";
|
||||
import { s, parse, secret } from "bknd/core";
|
||||
|
||||
type Input = any; // workaround
|
||||
export type JWTPayload = Parameters<typeof sign>[0];
|
||||
|
||||
@@ -3,7 +3,7 @@ import { hash, $console } from "core/utils";
|
||||
import { Hono } from "hono";
|
||||
import { compare as bcryptCompare, genSalt as bcryptGenSalt, hash as bcryptHash } from "bcryptjs";
|
||||
import { Strategy } from "./Strategy";
|
||||
import { s, parse, jsc } from "core/object/schema";
|
||||
import { s, parse, jsc } from "bknd/core";
|
||||
|
||||
const schema = s
|
||||
.object({
|
||||
|
||||
@@ -5,7 +5,7 @@ import type {
|
||||
StrategyActions,
|
||||
} from "../Authenticator";
|
||||
import type { Hono } from "hono";
|
||||
import { type s, parse } from "core/object/schema";
|
||||
import { type s, parse } from "bknd/core";
|
||||
|
||||
export type StrategyMode = "form" | "external";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type * as oauth from "oauth4webapi";
|
||||
import { OAuthStrategy } from "./OAuthStrategy";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
type SupportedTypes = "oauth2" | "oidc";
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { getSignedCookie, setSignedCookie } from "hono/cookie";
|
||||
import * as oauth from "oauth4webapi";
|
||||
import * as issuers from "./issuers";
|
||||
import { Strategy } from "auth/authenticate/strategies/Strategy";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
type ConfiguredIssuers = keyof typeof issuers;
|
||||
type SupportedTypes = "oauth2" | "oidc";
|
||||
|
||||
@@ -25,8 +25,12 @@ export {
|
||||
} from "./object/query/query";
|
||||
export { Registry, type Constructor } from "./registry/Registry";
|
||||
export { getFlashMessage } from "./server/flash";
|
||||
/* export {
|
||||
export {
|
||||
s,
|
||||
stripMark,
|
||||
mark,
|
||||
stringIdentifier,
|
||||
secret,
|
||||
parse,
|
||||
jsc,
|
||||
describeRoute,
|
||||
@@ -34,7 +38,7 @@ export { getFlashMessage } from "./server/flash";
|
||||
openAPISpecs,
|
||||
type ParseOptions,
|
||||
InvalidSchemaError,
|
||||
} from "./object/schema"; */
|
||||
} from "./object/schema";
|
||||
|
||||
export * from "./drivers";
|
||||
export * from "./events";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { get, has, omit, set } from "lodash-es";
|
||||
import { getFullPathKeys, mergeObjectWith } from "../utils";
|
||||
import { type s, parse, stripMark } from "core/object/schema";
|
||||
import { type s, parse, stripMark } from "bknd/core";
|
||||
|
||||
export type SchemaObjectOptions<Schema extends s.Schema> = {
|
||||
onUpdate?: (config: s.Static<Schema>) => void | Promise<void>;
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
import type { Handler } from "hono/types";
|
||||
import type { ModuleBuildContext } from "modules";
|
||||
import { Controller } from "modules/Controller";
|
||||
import { jsc, s, describeRoute, schemaToSpec } from "core/object/schema";
|
||||
import { jsc, s, describeRoute, schemaToSpec } from "bknd/core";
|
||||
import * as SystemPermissions from "modules/permissions";
|
||||
import type { AppDataConfig } from "../data-schema";
|
||||
import { omitKeys } from "core/utils";
|
||||
|
||||
@@ -4,7 +4,7 @@ import { FieldClassMap } from "data/fields";
|
||||
import { RelationClassMap, RelationFieldClassMap } from "data/relations";
|
||||
import { entityConfigSchema, entityTypes } from "data/entities";
|
||||
import { primaryFieldTypes } from "./fields";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
export const FIELDS = {
|
||||
...FieldClassMap,
|
||||
@@ -18,6 +18,7 @@ export const RELATIONS = RelationClassMap;
|
||||
export const fieldsSchemaObject = objectTransform(FIELDS, (field, name) => {
|
||||
return s.strictObject(
|
||||
{
|
||||
name: s.string().optional(), // @todo: verify, old schema wasn't strict (req in UI)
|
||||
type: s.literal(name),
|
||||
config: field.schema.optional(),
|
||||
},
|
||||
@@ -32,9 +33,10 @@ export type TAppDataField = s.Static<typeof fieldsSchema>;
|
||||
export type TAppDataEntityFields = s.Static<typeof entityFields>;
|
||||
|
||||
export const entitiesSchema = s.strictObject({
|
||||
type: s.string({ enum: entityTypes, default: "regular", readOnly: true }),
|
||||
config: entityConfigSchema.optional(),
|
||||
fields: entityFields.optional(),
|
||||
name: s.string().optional(), // @todo: verify, old schema wasn't strict (req in UI)
|
||||
type: s.string({ enum: entityTypes, default: "regular" }),
|
||||
config: entityConfigSchema,
|
||||
fields: entityFields,
|
||||
});
|
||||
export type TAppDataEntity = s.Static<typeof entitiesSchema>;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
type TActionContext,
|
||||
type TRenderContext,
|
||||
} from "../fields";
|
||||
import { s, parse } from "core/object/schema";
|
||||
import { s, parse } from "bknd/core";
|
||||
|
||||
// @todo: entity must be migrated to typebox
|
||||
export const entityConfigSchema = s
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Exception } from "core";
|
||||
import { HttpStatus } from "core/utils";
|
||||
import type { InvalidSchemaError } from "core/object/schema";
|
||||
import type { InvalidSchemaError } from "bknd/core";
|
||||
import type { Entity } from "./entities";
|
||||
import type { Field } from "./fields";
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { omitKeys } from "core/utils";
|
||||
import type { EntityManager } from "data";
|
||||
import { TransformPersistFailedException } from "../errors";
|
||||
import { Field, type TActionContext, type TRenderContext, baseFieldConfigSchema } from "./Field";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
export const booleanFieldConfigSchema = s
|
||||
.strictObject({
|
||||
|
||||
@@ -3,7 +3,7 @@ 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 "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
export const dateFieldConfigSchema = s
|
||||
.strictObject({
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { EntityManager } from "data";
|
||||
import { TransformPersistFailedException } from "../errors";
|
||||
import { baseFieldConfigSchema, Field, type TActionContext, type TRenderContext } from "./Field";
|
||||
import type { TFieldTSType } from "data/entities/EntityTypescript";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
export const enumFieldConfigSchema = s
|
||||
.strictObject({
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { EntityManager } from "../entities";
|
||||
import { InvalidFieldConfigException, TransformPersistFailedException } from "../errors";
|
||||
import type { FieldSpec } from "data/connection/Connection";
|
||||
import type { TFieldTSType } from "data/entities/EntityTypescript";
|
||||
import { s, parse, InvalidSchemaError } from "core/object/schema";
|
||||
import { s, parse, InvalidSchemaError } from "bknd/core";
|
||||
|
||||
// @todo: contexts need to be reworked
|
||||
// e.g. "table" is irrelevant, because if read is not given, it fails
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { EntityManager } from "data";
|
||||
import { TransformPersistFailedException } from "../errors";
|
||||
import { Field, type TActionContext, type TRenderContext, baseFieldConfigSchema } from "./Field";
|
||||
import type { TFieldTSType } from "data/entities/EntityTypescript";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
export const jsonFieldConfigSchema = s
|
||||
.strictObject({
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { EntityManager } from "data";
|
||||
import { TransformPersistFailedException } from "../errors";
|
||||
import { Field, type TActionContext, type TRenderContext, baseFieldConfigSchema } from "./Field";
|
||||
import type { TFieldTSType } from "data/entities/EntityTypescript";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
export const jsonSchemaFieldConfigSchema = s
|
||||
.strictObject({
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { EntityManager } from "data";
|
||||
import { TransformPersistFailedException } from "../errors";
|
||||
import { Field, type TActionContext, type TRenderContext, baseFieldConfigSchema } from "./Field";
|
||||
import type { TFieldTSType } from "data/entities/EntityTypescript";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
import { omitKeys } from "core/utils";
|
||||
|
||||
export const numberFieldConfigSchema = s
|
||||
|
||||
@@ -2,7 +2,7 @@ import { config } from "core";
|
||||
import { omitKeys, uuidv7 } from "core/utils";
|
||||
import { Field, baseFieldConfigSchema } from "./Field";
|
||||
import type { TFieldTSType } from "data/entities/EntityTypescript";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
export const primaryFieldTypes = ["integer", "uuid"] as const;
|
||||
export type TPrimaryFieldFormat = (typeof primaryFieldTypes)[number];
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { EntityManager } from "data";
|
||||
import { omitKeys } from "core/utils";
|
||||
import { TransformPersistFailedException } from "../errors";
|
||||
import { Field, type TActionContext, baseFieldConfigSchema } from "./Field";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
export const textFieldConfigSchema = s
|
||||
.strictObject({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Field, baseFieldConfigSchema } from "./Field";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
export const virtualFieldConfigSchema = s
|
||||
.strictObject({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { parse } from "core/object/schema";
|
||||
import { parse } from "bknd/core";
|
||||
import type { ExpressionBuilder, SelectQueryBuilder } from "kysely";
|
||||
import type { Entity, EntityData, EntityManager } from "../entities";
|
||||
import {
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
import type { RepoQuery } from "../server/query";
|
||||
import type { RelationType } from "./relation-types";
|
||||
import type { PrimaryFieldType } from "core";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
const directions = ["source", "target"] as const;
|
||||
export type TDirection = (typeof directions)[number];
|
||||
|
||||
@@ -6,7 +6,7 @@ import { EntityRelation, type KyselyQueryBuilder } from "./EntityRelation";
|
||||
import { EntityRelationAnchor } from "./EntityRelationAnchor";
|
||||
import { RelationField } from "./RelationField";
|
||||
import { type RelationType, RelationTypes } from "./relation-types";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
export type ManyToManyRelationConfig = s.Static<typeof ManyToManyRelation.schema>;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import { EntityRelationAnchor } from "./EntityRelationAnchor";
|
||||
import { RelationField, type RelationFieldBaseConfig } from "./RelationField";
|
||||
import type { MutationInstructionResponse } from "./RelationMutator";
|
||||
import { type RelationType, RelationTypes } from "./relation-types";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
/**
|
||||
* Source entity receives the mapping field
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { RepoQuery } from "../server/query";
|
||||
import { EntityRelation, type KyselyJsonFrom, type KyselyQueryBuilder } from "./EntityRelation";
|
||||
import { EntityRelationAnchor } from "./EntityRelationAnchor";
|
||||
import { type RelationType, RelationTypes } from "./relation-types";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
export type PolymorphicRelationConfig = s.Static<typeof PolymorphicRelation.schema>;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Field, baseFieldConfigSchema } from "../fields";
|
||||
import type { EntityRelation } from "./EntityRelation";
|
||||
import type { EntityRelationAnchor } from "./EntityRelationAnchor";
|
||||
import type { TFieldTSType } from "data/entities/EntityTypescript";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
const CASCADES = ["cascade", "set null", "set default", "restrict", "no action"] as const;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { test, describe, expect } from "bun:test";
|
||||
import * as q from "./query";
|
||||
import { s as schema, parse as $parse, type ParseOptions } from "core/object/schema";
|
||||
import { s as schema, parse as $parse, type ParseOptions } from "bknd/core";
|
||||
|
||||
const parse = (v: unknown, o: ParseOptions = {}) =>
|
||||
$parse(q.repoQuery, v, {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
import { WhereBuilder, type WhereQuery } from "data/entities/query/WhereBuilder";
|
||||
import { isObject, $console } from "core/utils";
|
||||
import type { anyOf, CoercionOptions, Schema } from "jsonv-ts";
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Flow, HttpTrigger } from "flows";
|
||||
import { Hono } from "hono";
|
||||
import { Module } from "modules/Module";
|
||||
import { TASKS, flowsConfigSchema } from "./flows-schema";
|
||||
import type { s } from "core/object/schema";
|
||||
import type { s } from "bknd/core";
|
||||
|
||||
export type AppFlowsSchema = s.Static<typeof flowsConfigSchema>;
|
||||
export type TAppFlowSchema = AppFlowsSchema["flows"][number];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { transformObject } from "core/utils";
|
||||
import { TaskMap, TriggerMap } from "flows";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
export const TASKS = {
|
||||
...TaskMap,
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { EventManager } from "core/events";
|
||||
import type { Flow } from "../Flow";
|
||||
import { Trigger } from "./Trigger";
|
||||
import { $console } from "core/utils";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
export class EventTrigger extends Trigger<typeof EventTrigger.schema> {
|
||||
override type = "event";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Context, Hono } from "hono";
|
||||
import type { Flow } from "../Flow";
|
||||
import { Trigger } from "./Trigger";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
const httpMethods = ["GET", "POST", "PUT", "PATCH", "DELETE"] as const;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Execution } from "../Execution";
|
||||
import type { Flow } from "../Flow";
|
||||
import { s, parse } from "core/object/schema";
|
||||
import { s, parse } from "bknd/core";
|
||||
|
||||
export class Trigger<Schema extends typeof Trigger.schema = typeof Trigger.schema> {
|
||||
// @todo: remove this
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//import { BkndError, SimpleRenderer } from "core";
|
||||
import { BkndError } from "core/errors";
|
||||
|
||||
import { s, parse } from "core/object/schema";
|
||||
import { s, parse } from "bknd/core";
|
||||
import type { InputsMap } from "../flows/Execution";
|
||||
import { SimpleRenderer } from "core/template/SimpleRenderer";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Task, dynamic } from "../Task";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
const FetchMethods = ["GET", "POST", "PUT", "PATCH", "DELETE"];
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Task } from "../Task";
|
||||
import { $console } from "core/utils";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
export class LogTask extends Task<typeof LogTask.schema> {
|
||||
type = "log";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Task } from "../Task";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
export class RenderTask<Output extends Record<string, any>> extends Task<
|
||||
typeof RenderTask.schema,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Flow } from "../../flows/Flow";
|
||||
import { Task, dynamic } from "../Task";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
export class SubFlowTask<Output extends Record<string, any>> extends Task<
|
||||
typeof SubFlowTask.schema,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Field, baseFieldConfigSchema } from "data/fields";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
export const mediaFieldConfigSchema = s
|
||||
.strictObject({
|
||||
|
||||
@@ -6,7 +6,7 @@ import { DataPermissions } from "data";
|
||||
import { Controller } from "modules/Controller";
|
||||
import type { AppMedia } from "../AppMedia";
|
||||
import { MediaField } from "../MediaField";
|
||||
import { jsc, s, describeRoute } from "core/object/schema";
|
||||
import { jsc, s, describeRoute } from "bknd/core";
|
||||
|
||||
export class MediaController extends Controller {
|
||||
constructor(private readonly media: AppMedia) {
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
StorageCloudinaryAdapter,
|
||||
} from "./storage/adapters/cloudinary/StorageCloudinaryAdapter";
|
||||
import { type S3AdapterConfig, StorageS3Adapter } from "./storage/adapters/s3/StorageS3Adapter";
|
||||
import type { s } from "core/object/schema";
|
||||
import type { s } from "bknd/core";
|
||||
|
||||
export { StorageAdapter };
|
||||
export { StorageS3Adapter, type S3AdapterConfig, StorageCloudinaryAdapter, type CloudinaryConfig };
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { objectTransform } from "core/utils";
|
||||
import { Adapters } from "media";
|
||||
import { registries } from "modules/registries";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
export const ADAPTERS = {
|
||||
...Adapters,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { FileListObject, FileMeta } from "media";
|
||||
import type { FileBody, FileUploadPayload } from "media/storage/Storage";
|
||||
import type { s } from "core/object/schema";
|
||||
import type { s } from "bknd/core";
|
||||
|
||||
const SYMBOL = Symbol.for("bknd:storage");
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { hash, pickHeaders } from "core/utils";
|
||||
import type { FileBody, FileListObject, FileMeta } from "../../Storage";
|
||||
import { StorageAdapter } from "../../StorageAdapter";
|
||||
import { s, parse } from "core/object/schema";
|
||||
import { s, parse } from "bknd/core";
|
||||
|
||||
export const cloudinaryAdapterConfig = s.object(
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ import { isFile, pickHeaders2 } from "core/utils";
|
||||
import { transform } from "lodash-es";
|
||||
import type { FileBody, FileListObject } from "../../Storage";
|
||||
import { StorageAdapter } from "../../StorageAdapter";
|
||||
import { parse, s } from "core/object/schema";
|
||||
import { parse, s } from "bknd/core";
|
||||
|
||||
export const s3AdapterConfig = s.object(
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ import { type Context, type Env, Hono } from "hono";
|
||||
import * as middlewares from "modules/middlewares";
|
||||
import type { SafeUser } from "auth";
|
||||
import type { EntityManager } from "data";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
export interface ServerEnv extends Env {
|
||||
Variables: {
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { Connection, EntityManager } from "data";
|
||||
import type { Hono } from "hono";
|
||||
import type { ServerEnv } from "modules/Controller";
|
||||
import type { ModuleHelper } from "./ModuleHelper";
|
||||
import type { s } from "core/object/schema";
|
||||
import type { s } from "bknd/core";
|
||||
|
||||
type PartialRec<T> = { [P in keyof T]?: PartialRec<T[P]> };
|
||||
|
||||
|
||||
@@ -20,7 +20,8 @@ import { AppMedia } from "../media/AppMedia";
|
||||
import type { ServerEnv } from "./Controller";
|
||||
import { Module, type ModuleBuildContext } from "./Module";
|
||||
import { ModuleHelper } from "./ModuleHelper";
|
||||
import { s, mark, stripMark } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
import { mark, stripMark } from "bknd/core";
|
||||
|
||||
export type { ModuleBuildContext };
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { $console } from "core/utils";
|
||||
import { cors } from "hono/cors";
|
||||
import { Module } from "modules/Module";
|
||||
import { AuthException } from "auth/errors";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
const serverMethods = ["GET", "POST", "PATCH", "PUT", "DELETE"] as const;
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
type ModuleKey,
|
||||
} from "modules/ModuleManager";
|
||||
import * as SystemPermissions from "modules/permissions";
|
||||
import { jsc, s, describeRoute, InvalidSchemaError } from "core/object/schema";
|
||||
import { jsc, s, describeRoute, InvalidSchemaError } from "bknd/core";
|
||||
import { getVersion } from "core/env";
|
||||
import { SecretSchema } from "core/object/schema/secret";
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
import { useBknd } from "ui/client/bknd";
|
||||
import type { TSchemaActions } from "ui/client/schema/actions";
|
||||
import { bkndModals } from "ui/modals";
|
||||
import { s, parse, InvalidSchemaError } from "core/object/schema";
|
||||
import { s, parse, InvalidSchemaError } from "bknd/core";
|
||||
|
||||
export function useBkndData() {
|
||||
const { config, app, schema, actions: bkndActions } = useBknd();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { parse } from "core/object/schema";
|
||||
import { parse } from "bknd/core";
|
||||
import { type TAppFlowSchema, flowSchema } from "flows/flows-schema";
|
||||
import { useBknd } from "../../BkndProvider";
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import { Button } from "ui/components/buttons/Button";
|
||||
import { Group, Input, Password, Label } from "ui/components/form/Formy/components";
|
||||
import { SocialLink } from "./SocialLink";
|
||||
import type { Validator } from "json-schema-form-react";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
import type { ErrorDetail } from "jsonv-ts";
|
||||
|
||||
class JsonvTsValidator implements Validator<ErrorDetail> {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { decodeSearch, encodeSearch, mergeObject } from "core/utils";
|
||||
import { isEqual, transform } from "lodash-es";
|
||||
import { useLocation, useSearch as useWouterSearch } from "wouter";
|
||||
import { type s, parse } from "core/object/schema";
|
||||
import { type s, parse } from "bknd/core";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
|
||||
export type UseSearchOptions<Schema extends s.Schema = s.Schema> = {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { ModalProps } from "@mantine/core";
|
||||
import type { ContextModalProps } from "@mantine/modals";
|
||||
import { entitiesSchema, fieldsSchema, relationsSchema } from "data/data-schema";
|
||||
import { useState } from "react";
|
||||
import { type Modal2Ref, ModalBody, ModalFooter, ModalTitle } from "ui/components/modal/Modal2";
|
||||
import { Step, Steps, useStepContext } from "ui/components/steps/Steps";
|
||||
@@ -10,52 +9,10 @@ import { StepEntityFields } from "./step.entity.fields";
|
||||
import { StepRelation } from "./step.relation";
|
||||
import { StepSelect } from "./step.select";
|
||||
import Templates from "./templates/register";
|
||||
import { s } from "core/object/schema";
|
||||
import type { TCreateModalSchema } from "./schema";
|
||||
|
||||
export type CreateModalRef = Modal2Ref;
|
||||
|
||||
export const ModalActions = ["entity", "relation", "media"] as const;
|
||||
|
||||
export const entitySchema = s.object({
|
||||
name: s.string(),
|
||||
...entitiesSchema.properties,
|
||||
});
|
||||
|
||||
// @todo: this union is not fully working, just "string"
|
||||
const schemaAction = s.anyOf([
|
||||
s.string({ enum: ["entity", "relation", "media"] }),
|
||||
s.string({ pattern: "^template-" }),
|
||||
]);
|
||||
export type TSchemaAction = s.Static<typeof schemaAction>;
|
||||
|
||||
const createFieldSchema = s.object({
|
||||
entity: s.string(),
|
||||
name: s.string(),
|
||||
field: s.array(fieldsSchema),
|
||||
});
|
||||
export type TFieldCreate = s.Static<typeof createFieldSchema>;
|
||||
|
||||
const createModalSchema = s.strictObject({
|
||||
action: schemaAction,
|
||||
initial: s.any().optional(),
|
||||
entities: s
|
||||
.object({
|
||||
create: s.array(entitySchema).optional(),
|
||||
})
|
||||
.optional(),
|
||||
relations: s
|
||||
.object({
|
||||
create: s.array(s.anyOf(relationsSchema)).optional(),
|
||||
})
|
||||
.optional(),
|
||||
fields: s
|
||||
.object({
|
||||
create: s.array(createFieldSchema).optional(),
|
||||
})
|
||||
.optional(),
|
||||
});
|
||||
export type TCreateModalSchema = s.Static<typeof createModalSchema>;
|
||||
|
||||
export function CreateModal({
|
||||
context,
|
||||
id,
|
||||
@@ -107,4 +64,4 @@ CreateModal.modalProps = {
|
||||
padding: 0,
|
||||
} satisfies Partial<ModalProps>;
|
||||
|
||||
export { ModalBody, ModalFooter, ModalTitle, useStepContext, relationsSchema };
|
||||
export { ModalBody, ModalFooter, ModalTitle, useStepContext };
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
import { s } from "bknd/core";
|
||||
import { entitiesSchema, fieldsSchema, relationsSchema } from "data/data-schema";
|
||||
|
||||
export const ModalActions = ["entity", "relation", "media"] as const;
|
||||
|
||||
export const entitySchema = s.object({
|
||||
name: s.string(),
|
||||
...entitiesSchema.properties,
|
||||
});
|
||||
|
||||
// @todo: this union is not fully working, just "string"
|
||||
const schemaAction = s.anyOf([
|
||||
s.string({ enum: ["entity", "relation", "media"] }),
|
||||
s.string({ pattern: "^template-" }),
|
||||
]);
|
||||
export type TSchemaAction = s.Static<typeof schemaAction>;
|
||||
|
||||
const createFieldSchema = s.object({
|
||||
entity: s.string(),
|
||||
name: s.string(),
|
||||
field: s.array(fieldsSchema),
|
||||
});
|
||||
export type TFieldCreate = s.Static<typeof createFieldSchema>;
|
||||
|
||||
const createModalSchema = s.strictObject({
|
||||
action: schemaAction,
|
||||
initial: s.any().optional(),
|
||||
entities: s
|
||||
.object({
|
||||
create: s.array(entitySchema).optional(),
|
||||
})
|
||||
.optional(),
|
||||
relations: s
|
||||
.object({
|
||||
create: s.array(s.anyOf(relationsSchema)).optional(),
|
||||
})
|
||||
.optional(),
|
||||
fields: s
|
||||
.object({
|
||||
create: s.array(createFieldSchema).optional(),
|
||||
})
|
||||
.optional(),
|
||||
});
|
||||
export type TCreateModalSchema = s.Static<typeof createModalSchema>;
|
||||
@@ -1,7 +1,6 @@
|
||||
import { useDisclosure } from "@mantine/hooks";
|
||||
import {
|
||||
IconAlignJustified,
|
||||
IconAugmentedReality,
|
||||
IconBox,
|
||||
IconCirclesRelation,
|
||||
IconInfoCircle,
|
||||
@@ -15,7 +14,7 @@ import { IconButton, type IconType } from "ui/components/buttons/IconButton";
|
||||
import { JsonViewer } from "ui/components/code/JsonViewer";
|
||||
import { ModalBody, ModalFooter } from "ui/components/modal/Modal2";
|
||||
import { useStepContext } from "ui/components/steps/Steps";
|
||||
import type { TCreateModalSchema } from "ui/modules/data/components/schema/create-modal/CreateModal";
|
||||
import type { TCreateModalSchema } from "ui/modules/data/components/schema/create-modal/schema";
|
||||
|
||||
type ActionItem = SummaryItemProps & {
|
||||
run: () => Promise<boolean>;
|
||||
@@ -35,9 +34,9 @@ export function StepCreate() {
|
||||
action: "add",
|
||||
Icon: IconBox,
|
||||
type: "Entity",
|
||||
name: entity.name,
|
||||
name: entity.name!,
|
||||
json: entity,
|
||||
run: async () => await $data.actions.entity.add(entity.name, entity),
|
||||
run: async () => await $data.actions.entity.add(entity.name!, entity),
|
||||
})),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
//import { typeboxResolver } from "@hookform/resolvers/typebox";
|
||||
import { objectCleanEmpty } from "core/utils";
|
||||
import { type TAppDataEntityFields, entitiesSchema } from "data/data-schema";
|
||||
import { mergeWith } from "lodash-es";
|
||||
@@ -10,12 +9,13 @@ import {
|
||||
EntityFieldsForm,
|
||||
type EntityFieldsFormRef,
|
||||
} from "ui/routes/data/forms/entity.fields.form";
|
||||
import { ModalBody, ModalFooter, type TCreateModalSchema, useStepContext } from "./CreateModal";
|
||||
import { ModalBody, ModalFooter, useStepContext } from "./CreateModal";
|
||||
import { useBkndData } from "ui/client/schema/data/use-bknd-data";
|
||||
import type { s } from "core/object/schema";
|
||||
import type { s } from "bknd/core";
|
||||
import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
|
||||
import { entitySchema, type TCreateModalSchema } from "./schema";
|
||||
|
||||
const schema = entitiesSchema;
|
||||
const schema = entitySchema;
|
||||
type Schema = s.Static<typeof schema>;
|
||||
|
||||
export function StepEntityFields() {
|
||||
|
||||
@@ -2,30 +2,29 @@ import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
|
||||
import { TextInput, Textarea } from "@mantine/core";
|
||||
import { useFocusTrap } from "@mantine/hooks";
|
||||
import { useForm } from "react-hook-form";
|
||||
import {
|
||||
ModalBody,
|
||||
ModalFooter,
|
||||
type TCreateModalSchema,
|
||||
entitySchema,
|
||||
useStepContext,
|
||||
} from "./CreateModal";
|
||||
import { ModalBody, ModalFooter, useStepContext } from "./CreateModal";
|
||||
import { entitySchema, type TCreateModalSchema } from "./schema";
|
||||
import { s } from "bknd/core";
|
||||
import { cloneSchema } from "core/object/schema";
|
||||
|
||||
const schema = s.object({
|
||||
name: entitySchema.properties.name,
|
||||
config: entitySchema.properties.config.partial().optional(),
|
||||
});
|
||||
type Schema = s.Static<typeof schema>;
|
||||
|
||||
export function StepEntity() {
|
||||
const focusTrapRef = useFocusTrap();
|
||||
|
||||
const { nextStep, stepBack, state, setState } = useStepContext<TCreateModalSchema>();
|
||||
const { register, handleSubmit, formState, watch, control } = useForm({
|
||||
mode: "onTouched",
|
||||
resolver: standardSchemaResolver(entitySchema),
|
||||
defaultValues: state.entities?.create?.[0] ?? {},
|
||||
mode: "onChange",
|
||||
resolver: standardSchemaResolver(cloneSchema(schema)),
|
||||
defaultValues: (state.entities?.create?.[0] ?? {}) as Schema,
|
||||
});
|
||||
/*const data = watch();
|
||||
console.log("state", { isValid });
|
||||
console.log("schema", JSON.stringify(entitySchema));
|
||||
console.log("data", JSON.stringify(data));*/
|
||||
|
||||
function onSubmit(data: any) {
|
||||
console.log(data);
|
||||
console.log("onSubmit", data);
|
||||
setState((prev) => {
|
||||
const prevEntity = prev.entities?.create?.[0];
|
||||
if (prevEntity && prevEntity.name !== data.name) {
|
||||
@@ -45,6 +44,7 @@ export function StepEntity() {
|
||||
<>
|
||||
<form onSubmit={handleSubmit(onSubmit)} ref={focusTrapRef}>
|
||||
<ModalBody>
|
||||
<input type="hidden" {...register("type")} defaultValue="regular" />
|
||||
<TextInput
|
||||
data-autofocus
|
||||
required
|
||||
|
||||
@@ -10,8 +10,9 @@ import { MantineNumberInput } from "ui/components/form/hook-form-mantine/Mantine
|
||||
import { MantineSelect } from "ui/components/form/hook-form-mantine/MantineSelect";
|
||||
import { useStepContext } from "ui/components/steps/Steps";
|
||||
import { useEvent } from "ui/hooks/use-event";
|
||||
import { ModalBody, ModalFooter, type TCreateModalSchema } from "./CreateModal";
|
||||
import { s, stringIdentifier } from "core/object/schema";
|
||||
import { ModalBody, ModalFooter } from "./CreateModal";
|
||||
import type { TCreateModalSchema } from "./schema";
|
||||
import { s, stringIdentifier } from "bknd/core";
|
||||
import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
|
||||
|
||||
const Relations: {
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
import type { IconType } from "react-icons";
|
||||
import { TbBox, TbCirclesRelation, TbPhoto } from "react-icons/tb";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
import {
|
||||
type ModalActions,
|
||||
ModalBody,
|
||||
ModalFooter,
|
||||
type TCreateModalSchema,
|
||||
type TSchemaAction,
|
||||
useStepContext,
|
||||
} from "./CreateModal";
|
||||
import { ModalBody, ModalFooter, useStepContext } from "./CreateModal";
|
||||
import Templates from "./templates/register";
|
||||
import type { TCreateModalSchema, TSchemaAction } from "./schema";
|
||||
|
||||
export function StepSelect() {
|
||||
const { nextStep, stepBack, state, path, setState } = useStepContext<TCreateModalSchema>();
|
||||
|
||||
+3
-8
@@ -7,14 +7,9 @@ import { useBknd } from "ui/client/bknd";
|
||||
import { MantineNumberInput } from "ui/components/form/hook-form-mantine/MantineNumberInput";
|
||||
import { MantineRadio } from "ui/components/form/hook-form-mantine/MantineRadio";
|
||||
import { MantineSelect } from "ui/components/form/hook-form-mantine/MantineSelect";
|
||||
import {
|
||||
ModalBody,
|
||||
ModalFooter,
|
||||
type TCreateModalSchema,
|
||||
type TFieldCreate,
|
||||
useStepContext,
|
||||
} from "../../CreateModal";
|
||||
import { s, stringIdentifier } from "core/object/schema";
|
||||
import { ModalBody, ModalFooter, useStepContext } from "../../CreateModal";
|
||||
import type { TCreateModalSchema, TFieldCreate } from "../../schema";
|
||||
import { s, stringIdentifier } from "bknd/core";
|
||||
import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
|
||||
|
||||
const schema = s.object({
|
||||
|
||||
@@ -4,7 +4,7 @@ import { type Trigger, TriggerMap } from "flows";
|
||||
import type { IconType } from "react-icons";
|
||||
import { TbCircleLetterT } from "react-icons/tb";
|
||||
import { JsonSchemaForm } from "ui/components/form/json-schema";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
export type TaskComponentProps = NodeProps<Node<{ trigger: Trigger }>> & {
|
||||
Icon?: IconType;
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Input, TextInput } from "@mantine/core";
|
||||
import { useToggle } from "@mantine/hooks";
|
||||
import { IconMinus, IconPlus, IconWorld } from "@tabler/icons-react";
|
||||
import type { Node, NodeProps } from "@xyflow/react";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
import { FetchTask } from "flows";
|
||||
import { useState } from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
|
||||
@@ -10,7 +10,7 @@ import { MantineSelect } from "ui/components/form/hook-form-mantine/MantineSelec
|
||||
import { useFlowCanvas, useFlowSelector } from "../../../hooks/use-flow";
|
||||
import { BaseNode } from "../BaseNode";
|
||||
import { Handle } from "../Handle";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
|
||||
|
||||
const schema = s.object({
|
||||
|
||||
@@ -6,7 +6,7 @@ import { Button } from "../../components/buttons/Button";
|
||||
import { CellValue, DataTable } from "../../components/table/DataTable";
|
||||
import * as AppShell from "../../layouts/AppShell/AppShell";
|
||||
import { routes, useNavigate } from "../../lib/routes";
|
||||
import { stringIdentifier } from "core/object/schema";
|
||||
import { stringIdentifier } from "bknd/core";
|
||||
|
||||
export function AuthRolesList() {
|
||||
const [navigate] = useNavigate();
|
||||
|
||||
@@ -6,7 +6,7 @@ import { type UseControllerProps, useController, useForm } from "react-hook-form
|
||||
import { useBknd } from "ui/client/bknd";
|
||||
import { Button } from "ui/components/buttons/Button";
|
||||
import { MantineSwitch } from "ui/components/form/hook-form-mantine/MantineSwitch";
|
||||
import type { s } from "core/object/schema";
|
||||
import type { s } from "bknd/core";
|
||||
import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
|
||||
|
||||
const schema = guardRoleSchema;
|
||||
|
||||
@@ -11,7 +11,7 @@ import { Breadcrumbs2 } from "ui/layouts/AppShell/Breadcrumbs2";
|
||||
import { routes, useNavigate } from "ui/lib/routes";
|
||||
import { EntityForm } from "ui/modules/data/components/EntityForm";
|
||||
import { useEntityForm } from "ui/modules/data/hooks/useEntityForm";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
export function DataEntityCreate({ params }) {
|
||||
const { $data } = useBkndData();
|
||||
|
||||
@@ -14,7 +14,7 @@ import * as AppShell from "ui/layouts/AppShell/AppShell";
|
||||
import { routes, useNavigate } from "ui/lib/routes";
|
||||
import { useCreateUserModal } from "ui/modules/auth/hooks/use-create-user-modal";
|
||||
import { EntityTable2 } from "ui/modules/data/components/EntityTable2";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
import { pick } from "core/utils/objects";
|
||||
|
||||
const searchSchema = s.partialObject({
|
||||
|
||||
@@ -21,7 +21,7 @@ import { dataFieldsUiSchema } from "../../settings/routes/data.settings";
|
||||
import { useRoutePathState } from "ui/hooks/use-route-path-state";
|
||||
import { MantineSelect } from "ui/components/form/hook-form-mantine/MantineSelect";
|
||||
import type { TPrimaryFieldFormat } from "data/fields/PrimaryField";
|
||||
import { s, stringIdentifier } from "core/object/schema";
|
||||
import { s, stringIdentifier } from "bknd/core";
|
||||
import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
|
||||
|
||||
const fieldsSchemaObject = originalFieldsSchemaObject;
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
ModalTitle,
|
||||
} from "../../../components/modal/Modal2";
|
||||
import { Step, Steps, useStepContext } from "../../../components/steps/Steps";
|
||||
import { s, stringIdentifier } from "core/object/schema";
|
||||
import { s, stringIdentifier } from "bknd/core";
|
||||
import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
|
||||
|
||||
export type TCreateFlowModalSchema = any;
|
||||
|
||||
@@ -18,7 +18,7 @@ import { Link, Route, useLocation } from "wouter";
|
||||
import { extractSchema } from "../utils/schema";
|
||||
import { SettingNewModal, type SettingsNewModalProps } from "./SettingNewModal";
|
||||
import { SettingSchemaModal, type SettingsSchemaModalRef } from "./SettingSchemaModal";
|
||||
import type { s } from "core/object/schema";
|
||||
import type { s } from "bknd/core";
|
||||
|
||||
export type SettingProps<
|
||||
Schema extends s.ObjectSchema = s.ObjectSchema,
|
||||
|
||||
@@ -8,7 +8,7 @@ import { JsonSchemaForm, type JsonSchemaFormRef } from "ui/components/form/json-
|
||||
import { Dropdown } from "ui/components/overlay/Dropdown";
|
||||
import { Modal } from "ui/components/overlay/Modal";
|
||||
import { useLocation } from "wouter";
|
||||
import type { s } from "core/object/schema";
|
||||
import type { s } from "bknd/core";
|
||||
|
||||
export type SettingsNewModalProps = {
|
||||
schema: s.ObjectSchema;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { JSONSchema7 } from "json-schema";
|
||||
import type { s } from "core/object/schema";
|
||||
import type { s } from "bknd/core";
|
||||
import { omitKeys } from "core/utils";
|
||||
|
||||
export function extractSchema<
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useState } from "react";
|
||||
import { JsonViewer } from "../../../components/code/JsonViewer";
|
||||
import { JsonSchemaForm } from "../../../components/form/json-schema";
|
||||
import { Scrollable } from "../../../layouts/AppShell/AppShell";
|
||||
import { parse } from "core/object/schema";
|
||||
import { parse } from "bknd/core";
|
||||
|
||||
export default function FlowCreateSchemaTest() {
|
||||
//const schema = flowsConfigSchema;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
|
||||
import { TextInput } from "@mantine/core";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { s } from "core/object/schema";
|
||||
import { s } from "bknd/core";
|
||||
|
||||
const schema = s.object({
|
||||
example: s.string().optional(),
|
||||
|
||||
Reference in New Issue
Block a user