mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-17 12:56:05 +00:00
optimized module manager seeding, added type support for new api hooks and reduced amount of dist chunks
This commit is contained in:
@@ -2,7 +2,7 @@ import { parse } from "core/utils";
|
||||
import { AppFlows } from "flows/AppFlows";
|
||||
import { useState } from "react";
|
||||
import { JsonViewer } from "../../../components/code/JsonViewer";
|
||||
import { JsonSchemaForm } from "../../../components/form/json-schema/JsonSchemaForm";
|
||||
import { JsonSchemaForm } from "../../../components/form/json-schema";
|
||||
import { Scrollable } from "../../../layouts/AppShell/AppShell";
|
||||
|
||||
export default function FlowCreateSchemaTest() {
|
||||
|
||||
@@ -2,12 +2,9 @@ import Form from "@rjsf/core";
|
||||
import type { RJSFSchema, UiSchema } from "@rjsf/utils";
|
||||
import { useRef } from "react";
|
||||
import { TbPlus, TbTrash } from "react-icons/tb";
|
||||
import { Button } from "../../../../components/buttons/Button";
|
||||
import { Button } from "ui/components/buttons/Button";
|
||||
import { JsonSchemaForm, type JsonSchemaFormRef } from "ui/components/form/json-schema";
|
||||
import * as Formy from "../../../../components/form/Formy";
|
||||
import {
|
||||
JsonSchemaForm,
|
||||
type JsonSchemaFormRef
|
||||
} from "../../../../components/form/json-schema/JsonSchemaForm";
|
||||
import * as AppShell from "../../../../layouts/AppShell/AppShell";
|
||||
|
||||
class CfJsonSchemaValidator {}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Schema } from "@cfworker/json-schema";
|
||||
import { useState } from "react";
|
||||
import { JsonSchemaForm } from "../../../components/form/json-schema/JsonSchemaForm";
|
||||
import { Scrollable } from "../../../layouts/AppShell/AppShell";
|
||||
import { JsonSchemaForm } from "ui/components/form/json-schema";
|
||||
import { Scrollable } from "ui/layouts/AppShell/AppShell";
|
||||
|
||||
const schema: Schema = {
|
||||
definitions: {
|
||||
@@ -9,52 +9,52 @@ const schema: Schema = {
|
||||
anyOf: [
|
||||
{
|
||||
title: "String",
|
||||
type: "string",
|
||||
type: "string"
|
||||
},
|
||||
{
|
||||
title: "Number",
|
||||
type: "number",
|
||||
type: "number"
|
||||
},
|
||||
{
|
||||
title: "Boolean",
|
||||
type: "boolean",
|
||||
},
|
||||
],
|
||||
type: "boolean"
|
||||
}
|
||||
]
|
||||
},
|
||||
numeric: {
|
||||
anyOf: [
|
||||
{
|
||||
title: "Number",
|
||||
type: "number",
|
||||
type: "number"
|
||||
},
|
||||
{
|
||||
title: "Datetime",
|
||||
type: "string",
|
||||
format: "date-time",
|
||||
format: "date-time"
|
||||
},
|
||||
{
|
||||
title: "Date",
|
||||
type: "string",
|
||||
format: "date",
|
||||
format: "date"
|
||||
},
|
||||
{
|
||||
title: "Time",
|
||||
type: "string",
|
||||
format: "time",
|
||||
},
|
||||
],
|
||||
format: "time"
|
||||
}
|
||||
]
|
||||
},
|
||||
boolean: {
|
||||
title: "Boolean",
|
||||
type: "boolean",
|
||||
},
|
||||
type: "boolean"
|
||||
}
|
||||
},
|
||||
type: "object",
|
||||
properties: {
|
||||
operand: {
|
||||
enum: ["$and", "$or"],
|
||||
default: "$and",
|
||||
type: "string",
|
||||
type: "string"
|
||||
},
|
||||
conditions: {
|
||||
type: "array",
|
||||
@@ -64,10 +64,10 @@ const schema: Schema = {
|
||||
operand: {
|
||||
enum: ["$and", "$or"],
|
||||
default: "$and",
|
||||
type: "string",
|
||||
type: "string"
|
||||
},
|
||||
key: {
|
||||
type: "string",
|
||||
type: "string"
|
||||
},
|
||||
operator: {
|
||||
type: "array",
|
||||
@@ -78,30 +78,30 @@ const schema: Schema = {
|
||||
type: "object",
|
||||
properties: {
|
||||
$eq: {
|
||||
$ref: "#/definitions/primitive",
|
||||
},
|
||||
$ref: "#/definitions/primitive"
|
||||
}
|
||||
},
|
||||
required: ["$eq"],
|
||||
required: ["$eq"]
|
||||
},
|
||||
{
|
||||
title: "Lower than",
|
||||
type: "object",
|
||||
properties: {
|
||||
$lt: {
|
||||
$ref: "#/definitions/numeric",
|
||||
},
|
||||
$ref: "#/definitions/numeric"
|
||||
}
|
||||
},
|
||||
required: ["$lt"],
|
||||
required: ["$lt"]
|
||||
},
|
||||
{
|
||||
title: "Greather than",
|
||||
type: "object",
|
||||
properties: {
|
||||
$gt: {
|
||||
$ref: "#/definitions/numeric",
|
||||
},
|
||||
$ref: "#/definitions/numeric"
|
||||
}
|
||||
},
|
||||
required: ["$gt"],
|
||||
required: ["$gt"]
|
||||
},
|
||||
{
|
||||
title: "Between",
|
||||
@@ -110,13 +110,13 @@ const schema: Schema = {
|
||||
$between: {
|
||||
type: "array",
|
||||
items: {
|
||||
$ref: "#/definitions/numeric",
|
||||
$ref: "#/definitions/numeric"
|
||||
},
|
||||
minItems: 2,
|
||||
maxItems: 2,
|
||||
},
|
||||
maxItems: 2
|
||||
}
|
||||
},
|
||||
required: ["$between"],
|
||||
required: ["$between"]
|
||||
},
|
||||
{
|
||||
title: "In",
|
||||
@@ -125,23 +125,23 @@ const schema: Schema = {
|
||||
$in: {
|
||||
type: "array",
|
||||
items: {
|
||||
$ref: "#/definitions/primitive",
|
||||
$ref: "#/definitions/primitive"
|
||||
},
|
||||
minItems: 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
minItems: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
minItems: 1,
|
||||
},
|
||||
minItems: 1
|
||||
}
|
||||
},
|
||||
required: ["key", "operator"],
|
||||
required: ["key", "operator"]
|
||||
},
|
||||
minItems: 1,
|
||||
},
|
||||
minItems: 1
|
||||
}
|
||||
},
|
||||
required: ["operand", "conditions"],
|
||||
required: ["operand", "conditions"]
|
||||
};
|
||||
|
||||
export default function QueryJsonFormTest() {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { twMerge } from "tailwind-merge";
|
||||
import { useBknd } from "../../../client/BkndProvider";
|
||||
import { JsonSchemaForm } from "../../../components/form/json-schema/JsonSchemaForm";
|
||||
import { Scrollable } from "../../../layouts/AppShell/AppShell";
|
||||
import { useBknd } from "ui/client/BkndProvider";
|
||||
import { JsonSchemaForm } from "ui/components/form/json-schema";
|
||||
import { Scrollable } from "ui/layouts/AppShell/AppShell";
|
||||
|
||||
function useSchema() {
|
||||
const [schema, setSchema] = useState<any>();
|
||||
|
||||
@@ -1,7 +1,20 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { useApiQuery } from "ui/client";
|
||||
import { useApi, useApiQuery } from "ui/client";
|
||||
import { Scrollable } from "ui/layouts/AppShell/AppShell";
|
||||
|
||||
function Bla() {
|
||||
const api = useApi();
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
const one = await api.data.readOne("users", 1);
|
||||
const many = await api.data.readMany("users");
|
||||
})();
|
||||
}, []);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
export default function SWRAndAPI() {
|
||||
const [text, setText] = useState("");
|
||||
const { data, ...r } = useApiQuery((api) => api.data.readOne("comments", 1), {
|
||||
@@ -16,7 +29,7 @@ export default function SWRAndAPI() {
|
||||
|
||||
return (
|
||||
<Scrollable>
|
||||
<pre>{JSON.stringify(r.promise.keyArray({ search: false }))}</pre>
|
||||
<pre>{JSON.stringify(r.key)}</pre>
|
||||
{r.error && <div>failed to load</div>}
|
||||
{r.isLoading && <div>loading...</div>}
|
||||
{data && <pre>{JSON.stringify(data, null, 2)}</pre>}
|
||||
|
||||
@@ -13,7 +13,7 @@ export default function SwrAndDataApi() {
|
||||
|
||||
function QueryDataApi() {
|
||||
const [text, setText] = useState("");
|
||||
const { data, update, ...r } = useEntityQuery("comments", 1, {});
|
||||
const { data, update, ...r } = useEntityQuery("comments", 2);
|
||||
const comment = data ? data : null;
|
||||
|
||||
useEffect(() => {
|
||||
@@ -45,10 +45,10 @@ function QueryDataApi() {
|
||||
|
||||
function DirectDataApi() {
|
||||
const [data, setData] = useState<any>();
|
||||
const { create, read, update, _delete } = useEntity("comments", 1);
|
||||
const { create, read, update, _delete } = useEntity("users");
|
||||
|
||||
useEffect(() => {
|
||||
read().then(setData);
|
||||
read().then((data) => setData(data));
|
||||
}, []);
|
||||
|
||||
return <pre>{JSON.stringify(data, null, 2)}</pre>;
|
||||
|
||||
Reference in New Issue
Block a user