mirror of
https://github.com/bknd-io/bknd/
synced 2026-08-03 00:26:01 +00:00
added format command and added trailing commas to reduce conflicts
This commit is contained in:
@@ -29,7 +29,7 @@ export const KeyValueInput: React.FC<KeyValueInputProps> = ({
|
||||
onChange,
|
||||
error,
|
||||
classNames,
|
||||
mode = "object"
|
||||
mode = "object",
|
||||
}) => {
|
||||
const [items, setItems] = useState(initialValue ? toItems(initialValue) : [ITEM]);
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ const Wrapper = ({ children, className, ...props }: ElementProps<"div">) => (
|
||||
{...props}
|
||||
className={twMerge(
|
||||
"flex flex-row bg-lightest border ring-2 ring-muted/5 border-muted rounded-full items-center p-1",
|
||||
className
|
||||
className,
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
@@ -71,7 +71,7 @@ const Text = forwardRef<any, ElementProps<"span"> & { mono?: boolean }>(
|
||||
>
|
||||
{children}
|
||||
</span>
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
FlowPanel.Wrapper = Wrapper;
|
||||
|
||||
@@ -36,7 +36,7 @@ export function BaseNode({ children, className, tabs, Icon, isInvalid, ...props
|
||||
"w-96",
|
||||
//props.selected && "ring-4 ring-blue-500/15",
|
||||
isInvalid && "ring-8 ring-red-500/15",
|
||||
className
|
||||
className,
|
||||
)}
|
||||
>
|
||||
<Header
|
||||
@@ -70,7 +70,7 @@ const BaseNodeTabs = ({ tabs }: { tabs: BaseNodeProps["tabs"] }) => {
|
||||
onClick={handleClick(i)}
|
||||
className={twMerge(
|
||||
"text-sm leading-none",
|
||||
i === active ? "font-bold opacity-80" : "font-medium opacity-50"
|
||||
i === active ? "font-bold opacity-80" : "font-medium opacity-50",
|
||||
)}
|
||||
>
|
||||
{tab.label}
|
||||
@@ -90,7 +90,7 @@ const Header = ({
|
||||
rightSection,
|
||||
initialValue,
|
||||
changable = false,
|
||||
onChange
|
||||
onChange,
|
||||
}: {
|
||||
Icon: React.FC<any>;
|
||||
iconProps?: ElementProps<"svg">;
|
||||
@@ -129,7 +129,7 @@ const Header = ({
|
||||
disabled={!changable}
|
||||
onChange={handleChange}
|
||||
className={twMerge(
|
||||
"font-mono font-semibold bg-transparent rounded-lg outline-none pl-1.5 w-full hover:bg-lightest/30 transition-colors focus:bg-lightest/60"
|
||||
"font-mono font-semibold bg-transparent rounded-lg outline-none pl-1.5 w-full hover:bg-lightest/30 transition-colors focus:bg-lightest/60",
|
||||
)}
|
||||
/>
|
||||
) : (
|
||||
|
||||
@@ -6,18 +6,18 @@ export function Handle(props: Omit<HandleProps, "position">) {
|
||||
width: 10,
|
||||
height: 10,
|
||||
background: "transparent",
|
||||
border: "2px solid #999"
|
||||
border: "2px solid #999",
|
||||
};
|
||||
const offset = -10;
|
||||
const styles = {
|
||||
target: {
|
||||
...base,
|
||||
left: offset
|
||||
left: offset,
|
||||
},
|
||||
source: {
|
||||
...base,
|
||||
right: offset
|
||||
}
|
||||
right: offset,
|
||||
},
|
||||
};
|
||||
//console.log("type", props.type, styles[props.type]);
|
||||
|
||||
|
||||
@@ -15,15 +15,15 @@ const nodes = [
|
||||
params: {
|
||||
method: "GET",
|
||||
headers: [],
|
||||
url: ""
|
||||
}
|
||||
}
|
||||
url: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "render",
|
||||
label: "Render",
|
||||
description: "Render data using LiquidJS"
|
||||
}
|
||||
description: "Render data using LiquidJS",
|
||||
},
|
||||
];
|
||||
|
||||
export function SelectNode(props) {
|
||||
@@ -46,13 +46,13 @@ export function SelectNode(props) {
|
||||
type: "task",
|
||||
data: {
|
||||
...node.template,
|
||||
label
|
||||
}
|
||||
label,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return n;
|
||||
})
|
||||
}),
|
||||
);
|
||||
setTimeout(() => {
|
||||
reactflow.setEdges((prev) =>
|
||||
@@ -62,12 +62,12 @@ export function SelectNode(props) {
|
||||
return {
|
||||
...e,
|
||||
id: "task-" + label,
|
||||
target: "task-" + label
|
||||
target: "task-" + label,
|
||||
};
|
||||
}
|
||||
|
||||
return e;
|
||||
})
|
||||
}),
|
||||
);
|
||||
}, 100);
|
||||
|
||||
@@ -92,7 +92,7 @@ export function SelectNode(props) {
|
||||
key={node.type}
|
||||
className={twMerge(
|
||||
"border border-primary/10 rounded-md py-2 px-4 hover:bg-primary/10",
|
||||
selected === node.type && "bg-primary/10"
|
||||
selected === node.type && "bg-primary/10",
|
||||
)}
|
||||
onClick={() => setSelected(node.type)}
|
||||
>
|
||||
|
||||
@@ -5,5 +5,5 @@ import { TriggerNode } from "./triggers/TriggerNode";
|
||||
export const nodeTypes = {
|
||||
select: SelectNode,
|
||||
trigger: TriggerNode,
|
||||
task: TaskNode
|
||||
task: TaskNode,
|
||||
};
|
||||
|
||||
@@ -19,8 +19,8 @@ import { BaseNode } from "../BaseNode";
|
||||
const schema = Type.Composite([
|
||||
FetchTask.schema,
|
||||
Type.Object({
|
||||
query: Type.Optional(Type.Record(Type.String(), Type.String()))
|
||||
})
|
||||
query: Type.Optional(Type.Record(Type.String(), Type.String())),
|
||||
}),
|
||||
]);
|
||||
|
||||
type TFetchTaskSchema = Static<typeof FetchTask.schema>;
|
||||
@@ -39,11 +39,11 @@ export function FetchTaskForm({ onChange, params, ...props }: FetchTaskFormProps
|
||||
getValues,
|
||||
formState: { isValid, errors },
|
||||
watch,
|
||||
control
|
||||
control,
|
||||
} = useForm({
|
||||
resolver: typeboxResolver(schema),
|
||||
defaultValues: params as Static<typeof schema>,
|
||||
mode: "onChange"
|
||||
mode: "onChange",
|
||||
//defaultValues: (state.relations?.create?.[0] ?? {}) as Static<typeof schema>
|
||||
});
|
||||
|
||||
@@ -130,11 +130,11 @@ const TaskNodeTabs = ({ watch }: any) => [
|
||||
<div className="scroll-auto">
|
||||
<JsonViewer json={watch()} expand={2} className="bg-white break-all" />
|
||||
</div>
|
||||
)
|
||||
),
|
||||
},
|
||||
{
|
||||
id: "test",
|
||||
label: "test",
|
||||
content: () => <div>test</div>
|
||||
}
|
||||
content: () => <div>test</div>,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -11,7 +11,7 @@ registerCustomTypeboxKinds(TypeRegistry);
|
||||
|
||||
const TaskComponents = {
|
||||
fetch: FetchTaskForm,
|
||||
render: RenderNode
|
||||
render: RenderNode,
|
||||
};
|
||||
|
||||
export const TaskNode = (
|
||||
@@ -24,10 +24,10 @@ export const TaskNode = (
|
||||
responding?: boolean;
|
||||
}
|
||||
>
|
||||
>
|
||||
>,
|
||||
) => {
|
||||
const {
|
||||
data: { label, start, last, responding }
|
||||
data: { label, start, last, responding },
|
||||
} = props;
|
||||
const task = useFlowSelector((s) => s.flow!.tasks![label])!;
|
||||
const { actions } = useFlowCanvas();
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
StringEnum,
|
||||
Type,
|
||||
registerCustomTypeboxKinds,
|
||||
transformObject
|
||||
transformObject,
|
||||
} from "core/utils";
|
||||
import { TriggerMap } from "flows";
|
||||
import type { TAppFlowTriggerSchema } from "flows/AppFlows";
|
||||
@@ -33,18 +33,18 @@ const schema = Type.Object({
|
||||
Type.Object(
|
||||
{
|
||||
type: Const(name),
|
||||
config: trigger.cls.schema
|
||||
config: trigger.cls.schema,
|
||||
},
|
||||
{ title: String(name), additionalProperties: false }
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
{ title: String(name), additionalProperties: false },
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
});
|
||||
|
||||
export const TriggerNode = (props: NodeProps<Node<TAppFlowTriggerSchema & { label: string }>>) => {
|
||||
const {
|
||||
data: { label, ...trigger }
|
||||
data: { label, ...trigger },
|
||||
} = props;
|
||||
//console.log("TriggerNode");
|
||||
const state = useFlowSelector((s) => s.flow!.trigger!);
|
||||
@@ -57,11 +57,11 @@ export const TriggerNode = (props: NodeProps<Node<TAppFlowTriggerSchema & { labe
|
||||
getValues,
|
||||
formState: { isValid, errors },
|
||||
watch,
|
||||
control
|
||||
control,
|
||||
} = useForm({
|
||||
resolver: typeboxResolver(schema),
|
||||
defaultValues: { trigger: state } as Static<typeof schema>,
|
||||
mode: "onChange"
|
||||
mode: "onChange",
|
||||
});
|
||||
const data = watch("trigger");
|
||||
|
||||
@@ -91,7 +91,7 @@ export const TriggerNode = (props: NodeProps<Node<TAppFlowTriggerSchema & { labe
|
||||
data={[
|
||||
{ label: "Manual", value: "manual" },
|
||||
{ label: "HTTP", value: "http" },
|
||||
{ label: "Event", value: "event", disabled: true }
|
||||
{ label: "Event", value: "event", disabled: true },
|
||||
]}
|
||||
name="trigger.type"
|
||||
control={control}
|
||||
@@ -101,7 +101,7 @@ export const TriggerNode = (props: NodeProps<Node<TAppFlowTriggerSchema & { labe
|
||||
defaultValue="async"
|
||||
data={[
|
||||
{ label: "Async", value: "async" },
|
||||
{ label: "Sync", value: "sync" }
|
||||
{ label: "Sync", value: "sync" },
|
||||
]}
|
||||
name="trigger.config.mode"
|
||||
control={control}
|
||||
@@ -148,7 +148,7 @@ const Http = ({ form }) => {
|
||||
data={[
|
||||
{ label: "JSON", value: "json" },
|
||||
{ label: "HTML", value: "html" },
|
||||
{ label: "Text", value: "text" }
|
||||
{ label: "Text", value: "text" },
|
||||
]}
|
||||
name="trigger.config.response_type"
|
||||
control={form.control}
|
||||
@@ -162,11 +162,11 @@ const TriggerNodeTabs = ({ data, ...props }) => [
|
||||
{
|
||||
id: "json",
|
||||
label: "JSON",
|
||||
content: () => <JsonViewer json={data} expand={2} className="" />
|
||||
content: () => <JsonViewer json={data} expand={2} className="" />,
|
||||
},
|
||||
{
|
||||
id: "test",
|
||||
label: "test",
|
||||
content: () => <div>test</div>
|
||||
}
|
||||
content: () => <div>test</div>,
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user