@motiadev/workbench 0.3.1-beta.87 → 0.3.1-beta.88-406962
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +3 -4
- package/dist/index.html +3 -2
- package/dist/index.js +2 -3
- package/dist/public/icon.png +0 -0
- package/dist/public/motia-dark.png +0 -0
- package/dist/public/motia-light.png +0 -0
- package/dist/src/App.d.ts +2 -0
- package/dist/src/App.js +19 -0
- package/dist/src/components/endpoints/endpoint-badge.d.ts +1 -1
- package/dist/src/components/endpoints/endpoint-badge.js +8 -8
- package/dist/src/components/endpoints/endpoint-call.d.ts +3 -3
- package/dist/src/components/endpoints/endpoint-call.js +28 -23
- package/dist/src/components/endpoints/endpoint-response-schema.d.ts +10 -0
- package/dist/src/components/endpoints/endpoint-response-schema.js +17 -0
- package/dist/src/components/endpoints/endpoint-response.d.ts +8 -0
- package/dist/src/components/endpoints/endpoint-response.js +39 -0
- package/dist/src/components/endpoints/endpoints-page.js +14 -0
- package/dist/src/components/endpoints/hooks/use-get-endpoints.d.ts +1 -15
- package/dist/src/components/endpoints/json-editor.d.ts +9 -0
- package/dist/src/components/endpoints/json-editor.js +31 -0
- package/dist/src/components/flow/flow-page.d.ts +1 -0
- package/dist/src/components/flow/flow-page.js +20 -0
- package/dist/src/components/flow/flow-tab-menu-item.d.ts +1 -0
- package/dist/src/components/flow/flow-tab-menu-item.js +15 -0
- package/dist/src/{views → components}/flow/flow-view.d.ts +1 -2
- package/dist/src/components/flow/flow-view.js +21 -0
- package/dist/src/components/flow/hooks/use-get-flow-state.d.ts +10 -0
- package/dist/src/{views → components}/flow/hooks/use-get-flow-state.js +17 -10
- package/dist/src/{views → components}/flow/hooks/use-organize-nodes.d.ts +1 -1
- package/dist/src/{views → components}/flow/hooks/use-save-workflow-config.d.ts +1 -1
- package/dist/src/components/flow/nodes/api-flow-node.d.ts +2 -0
- package/dist/src/{views → components}/flow/nodes/api-flow-node.js +1 -1
- package/dist/src/components/flow/nodes/cron-flow-node.d.ts +2 -0
- package/dist/src/components/flow/nodes/cron-flow-node.js +5 -0
- package/dist/src/{views → components}/flow/nodes/event-flow-node.d.ts +1 -1
- package/dist/src/components/flow/nodes/event-flow-node.js +5 -0
- package/dist/src/components/flow/nodes/noop-flow-node.d.ts +2 -0
- package/dist/src/{views → components}/flow/nodes/noop-flow-node.js +1 -1
- package/dist/src/components/header/header.js +3 -11
- package/dist/src/components/logs/log-detail.d.ts +3 -1
- package/dist/src/components/logs/log-detail.js +33 -11
- package/dist/src/components/logs/log-level-badge.js +6 -6
- package/dist/src/components/logs/log-level-dot.js +7 -7
- package/dist/src/components/logs/logs-page.js +26 -0
- package/dist/src/components/observability/events/code/function-call.js +1 -1
- package/dist/src/components/observability/events/trace-event.d.ts +1 -1
- package/dist/src/components/observability/events/trace-log-event.d.ts +1 -1
- package/dist/src/components/observability/events/trace-log-event.js +2 -2
- package/dist/src/components/observability/hooks/use-get-endtime.d.ts +1 -1
- package/dist/src/components/observability/trace-item/trace-item-detail.d.ts +1 -0
- package/dist/src/components/observability/trace-item/trace-item-detail.js +5 -4
- package/dist/src/components/observability/trace-item/trace-item.d.ts +1 -0
- package/dist/src/components/observability/trace-item/trace-item.js +11 -17
- package/dist/src/components/observability/trace-status.d.ts +6 -10
- package/dist/src/components/observability/trace-status.js +7 -32
- package/dist/src/components/observability/trace-timeline.js +16 -4
- package/dist/src/components/observability/traces-groups.d.ts +2 -2
- package/dist/src/components/observability/traces-groups.js +4 -4
- package/dist/src/components/observability/traces-page.js +12 -0
- package/dist/src/components/sidebar/sidebar.d.ts +8 -0
- package/dist/src/components/sidebar/sidebar.js +39 -0
- package/dist/src/components/states/hooks/states-hooks.d.ts +7 -3
- package/dist/src/components/states/hooks/states-hooks.js +5 -33
- package/dist/src/components/states/state-detail.d.ts +2 -1
- package/dist/src/components/states/state-detail.js +15 -9
- package/dist/src/components/states/state-value.js +7 -7
- package/dist/src/components/states/states-page.js +18 -0
- package/dist/src/components/ui/badge.d.ts +1 -1
- package/dist/src/components/ui/table.js +1 -1
- package/dist/src/components/ui/theme-toggle.js +4 -3
- package/dist/src/hooks/use-fetch-flows.d.ts +1 -5
- package/dist/src/hooks/use-fetch-flows.js +18 -13
- package/dist/src/hooks/use-log-listener.js +2 -2
- package/dist/src/hooks/use-update-handle-positions.d.ts +10 -0
- package/dist/src/hooks/use-update-handle-positions.js +35 -0
- package/dist/src/index.css +36 -176
- package/dist/src/lib/utils.d.ts +1 -0
- package/dist/src/lib/utils.js +4 -0
- package/dist/src/main.d.ts +1 -0
- package/dist/src/main.js +4 -11
- package/dist/src/publicComponents/api-node.js +2 -4
- package/dist/src/publicComponents/{base-handle.d.ts → base-node/base-handle.d.ts} +1 -0
- package/dist/src/publicComponents/base-node/base-handle.js +8 -0
- package/dist/src/publicComponents/base-node/base-node.d.ts +21 -0
- package/dist/src/publicComponents/base-node/base-node.js +13 -0
- package/dist/src/publicComponents/{emits.d.ts → base-node/emits.d.ts} +1 -1
- package/dist/src/publicComponents/base-node/emits.js +5 -0
- package/dist/src/{views/flow/nodes → publicComponents/base-node}/language-indicator.d.ts +1 -1
- package/dist/src/{views/flow/nodes → publicComponents/base-node}/language-indicator.js +8 -7
- package/dist/src/publicComponents/base-node/node-header.d.ts +12 -0
- package/dist/src/publicComponents/base-node/node-header.js +30 -0
- package/dist/src/publicComponents/base-node/node-sidebar.d.ts +18 -0
- package/dist/src/publicComponents/base-node/node-sidebar.js +20 -0
- package/dist/src/publicComponents/base-node/subscribe.js +4 -0
- package/dist/src/publicComponents/cron-node.d.ts +2 -1
- package/dist/src/publicComponents/cron-node.js +3 -4
- package/dist/src/publicComponents/event-node.d.ts +1 -5
- package/dist/src/publicComponents/event-node.js +4 -6
- package/dist/src/publicComponents/node-details.js +21 -12
- package/dist/src/publicComponents/node-props.d.ts +13 -6
- package/dist/src/publicComponents/noop-node.d.ts +3 -7
- package/dist/src/publicComponents/noop-node.js +3 -3
- package/dist/src/stores/use-flow-store.d.ts +18 -0
- package/dist/src/stores/use-flow-store.js +15 -0
- package/dist/src/stores/use-global-store.d.ts +24 -0
- package/dist/src/stores/use-global-store.js +20 -0
- package/dist/src/stores/{use-logs.d.ts → use-logs-store.d.ts} +1 -3
- package/dist/src/stores/use-logs-store.js +10 -0
- package/dist/src/stores/use-tabs-store.d.ts +17 -0
- package/dist/src/stores/use-tabs-store.js +13 -0
- package/dist/src/stores/use-theme-store.d.ts +17 -0
- package/dist/src/stores/use-theme-store.js +26 -0
- package/dist/src/types/endpoint.d.ts +14 -0
- package/dist/src/{views/flow/nodes/nodes.types.d.ts → types/flow.d.ts} +45 -0
- package/dist/src/types/flow.js +1 -0
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/package.json +28 -26
- package/dist/public/.empty +0 -0
- package/dist/src/components/app-sidebar.d.ts +0 -1
- package/dist/src/components/app-sidebar.js +0 -12
- package/dist/src/components/endpoints/endpoints.d.ts +0 -1
- package/dist/src/components/endpoints/endpoints.js +0 -34
- package/dist/src/components/endpoints/selected-endpoint.d.ts +0 -7
- package/dist/src/components/endpoints/selected-endpoint.js +0 -7
- package/dist/src/components/logs/log-console.d.ts +0 -1
- package/dist/src/components/logs/log-console.js +0 -69
- package/dist/src/components/logs/log-field.d.ts +0 -7
- package/dist/src/components/logs/log-field.js +0 -20
- package/dist/src/components/logs/logs.d.ts +0 -1
- package/dist/src/components/logs/logs.js +0 -18
- package/dist/src/components/observability/observability-stats.d.ts +0 -5
- package/dist/src/components/observability/observability-stats.js +0 -17
- package/dist/src/components/states/states.d.ts +0 -1
- package/dist/src/components/states/states.js +0 -21
- package/dist/src/components/ui/BadgeCount.d.ts +0 -7
- package/dist/src/components/ui/BadgeCount.js +0 -13
- package/dist/src/components/ui/button.d.ts +0 -11
- package/dist/src/components/ui/button.js +0 -33
- package/dist/src/components/ui/card.d.ts +0 -8
- package/dist/src/components/ui/card.js +0 -16
- package/dist/src/components/ui/collapsible.d.ts +0 -5
- package/dist/src/components/ui/collapsible.js +0 -5
- package/dist/src/components/ui/dialog.d.ts +0 -19
- package/dist/src/components/ui/dialog.js +0 -22
- package/dist/src/components/ui/dropdown-menu.d.ts +0 -25
- package/dist/src/components/ui/dropdown-menu.js +0 -50
- package/dist/src/components/ui/input.d.ts +0 -3
- package/dist/src/components/ui/input.js +0 -8
- package/dist/src/components/ui/logo-icon.d.ts +0 -5
- package/dist/src/components/ui/logo-icon.js +0 -5
- package/dist/src/components/ui/navigation-menu.d.ts +0 -13
- package/dist/src/components/ui/navigation-menu.js +0 -30
- package/dist/src/components/ui/scroll-area.d.ts +0 -5
- package/dist/src/components/ui/scroll-area.js +0 -9
- package/dist/src/components/ui/select.d.ts +0 -13
- package/dist/src/components/ui/select.js +0 -25
- package/dist/src/components/ui/separator.d.ts +0 -4
- package/dist/src/components/ui/separator.js +0 -8
- package/dist/src/components/ui/sheet.d.ts +0 -25
- package/dist/src/components/ui/sheet.js +0 -36
- package/dist/src/components/ui/sidebar.d.ts +0 -12
- package/dist/src/components/ui/sidebar.js +0 -25
- package/dist/src/components/ui/skeleton.d.ts +0 -3
- package/dist/src/components/ui/skeleton.js +0 -6
- package/dist/src/components/ui/switch.d.ts +0 -4
- package/dist/src/components/ui/switch.js +0 -7
- package/dist/src/components/ui/tabs.d.ts +0 -7
- package/dist/src/components/ui/tabs.js +0 -12
- package/dist/src/components/ui/textarea.d.ts +0 -3
- package/dist/src/components/ui/textarea.js +0 -8
- package/dist/src/components/ui/tooltip.d.ts +0 -7
- package/dist/src/components/ui/tooltip.js +0 -11
- package/dist/src/hooks/use-list-flows.d.ts +0 -9
- package/dist/src/hooks/use-list-flows.js +0 -8
- package/dist/src/hooks/use-theme.d.ts +0 -6
- package/dist/src/hooks/use-theme.js +0 -28
- package/dist/src/publicComponents/base-handle.js +0 -10
- package/dist/src/publicComponents/base-node.d.ts +0 -16
- package/dist/src/publicComponents/base-node.js +0 -25
- package/dist/src/publicComponents/colorMap.d.ts +0 -6
- package/dist/src/publicComponents/colorMap.js +0 -6
- package/dist/src/publicComponents/components/header-bar.d.ts +0 -11
- package/dist/src/publicComponents/components/header-bar.js +0 -15
- package/dist/src/publicComponents/emits.js +0 -6
- package/dist/src/publicComponents/subscribe.js +0 -5
- package/dist/src/route-wrapper.d.ts +0 -2
- package/dist/src/route-wrapper.js +0 -5
- package/dist/src/routes/endpoints-page.js +0 -5
- package/dist/src/routes/flow.d.ts +0 -1
- package/dist/src/routes/flow.js +0 -11
- package/dist/src/routes/index.d.ts +0 -1
- package/dist/src/routes/index.js +0 -5
- package/dist/src/routes/logs-page.js +0 -12
- package/dist/src/routes/states-page.js +0 -5
- package/dist/src/routes/traces-page.js +0 -14
- package/dist/src/stores/use-logs.js +0 -52
- package/dist/src/views/flow/arrow-head.d.ts +0 -8
- package/dist/src/views/flow/arrow-head.js +0 -6
- package/dist/src/views/flow/flow-view.js +0 -48
- package/dist/src/views/flow/hooks/use-get-flow-state.d.ts +0 -52
- package/dist/src/views/flow/legend.d.ts +0 -4
- package/dist/src/views/flow/legend.js +0 -51
- package/dist/src/views/flow/nodes/api-flow-node.d.ts +0 -4
- package/dist/src/views/flow/nodes/event-flow-node.js +0 -5
- package/dist/src/views/flow/nodes/noop-flow-node.d.ts +0 -4
- /package/dist/src/{routes → components/endpoints}/endpoints-page.d.ts +0 -0
- /package/dist/src/{views → components}/flow/base-edge.d.ts +0 -0
- /package/dist/src/{views → components}/flow/base-edge.js +0 -0
- /package/dist/src/{views → components}/flow/flow-loader.d.ts +0 -0
- /package/dist/src/{views → components}/flow/flow-loader.js +0 -0
- /package/dist/src/{views → components}/flow/hooks/use-organize-nodes.js +0 -0
- /package/dist/src/{views → components}/flow/hooks/use-save-workflow-config.js +0 -0
- /package/dist/src/{views → components}/flow/node-organizer.d.ts +0 -0
- /package/dist/src/{views → components}/flow/node-organizer.js +0 -0
- /package/dist/src/{routes → components/logs}/logs-page.d.ts +0 -0
- /package/dist/src/{routes → components/observability}/traces-page.d.ts +0 -0
- /package/dist/src/{routes → components/states}/states-page.d.ts +0 -0
- /package/dist/src/publicComponents/{subscribe.d.ts → base-node/subscribe.d.ts} +0 -0
- /package/dist/src/{views/flow/nodes/nodes.types.js → types/endpoint.js} +0 -0
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Logs } from '@/components/logs/logs';
|
|
3
|
-
import { useLogs } from '@/stores/use-logs';
|
|
4
|
-
import { useEffect } from 'react';
|
|
5
|
-
export const LogsPage = () => {
|
|
6
|
-
const setUnreadLogsCount = useLogs((state) => state.setUnreadLogsCount);
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
setUnreadLogsCount(0);
|
|
9
|
-
return () => setUnreadLogsCount(0);
|
|
10
|
-
}, [setUnreadLogsCount]);
|
|
11
|
-
return (_jsxs("div", { className: "w-full h-full overflow-hidden bg-background text-foreground", children: [_jsxs("header", { className: "p-4 border-b border-border", children: [_jsx("h1", { className: "text-2xl font-bold text-foreground", children: "Logs" }), _jsx("span", { className: "text-sm text-muted-foreground", children: "Check all logs saved locally" })] }), _jsx(Logs, {})] }));
|
|
12
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { States } from '@/components/states/states';
|
|
3
|
-
export const StatesPage = () => {
|
|
4
|
-
return (_jsxs("div", { className: "w-full h-full overflow-hidden bg-background text-foreground", children: [_jsxs("header", { className: "p-4 border-b border-border", children: [_jsx("h1", { className: "text-xl font-bold text-foreground", children: "State details" }), _jsx("span", { className: "text-sm text-muted-foreground", children: "Check all states saved locally along with all fields" })] }), _jsx(States, {})] }));
|
|
5
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { ObservabilityStats } from '@/components/observability/observability-stats';
|
|
3
|
-
import { TraceTimeline } from '@/components/observability/trace-timeline';
|
|
4
|
-
import { useStreamGroup } from '@motiadev/stream-client-react';
|
|
5
|
-
import { useState } from 'react';
|
|
6
|
-
import { TracesGroups } from '../components/observability/traces-groups';
|
|
7
|
-
export const TracesPage = () => {
|
|
8
|
-
const [selectedGroupId, setSelectedGroupId] = useState(null);
|
|
9
|
-
const { data } = useStreamGroup({ streamName: 'motia-trace-group', groupId: 'default' });
|
|
10
|
-
const handleGroupSelect = (group) => {
|
|
11
|
-
setSelectedGroupId(group.id);
|
|
12
|
-
};
|
|
13
|
-
return (_jsxs("div", { className: "flex flex-col h-screen", children: [_jsx("div", { className: "border-b border-border p-4", children: _jsx(ObservabilityStats, { groups: data }) }), _jsxs("div", { className: "flex flex-1 overflow-hidden", children: [_jsx("div", { className: "w-1/3 border-r border-border overflow-auto", "data-testid": "traces-container", children: _jsx(TracesGroups, { groups: data, selectedGroupId: selectedGroupId, onGroupSelect: handleGroupSelect }) }), _jsxs("div", { className: "flex-1 overflow-auto", "data-testid": "trace-details", children: [selectedGroupId && _jsx(TraceTimeline, { groupId: selectedGroupId }), !selectedGroupId && (_jsx("div", { className: "flex items-center justify-center h-full text-muted-foreground", children: "Select a trace or trace group to view the timeline" }))] })] })] }));
|
|
14
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { useSyncExternalStore, useCallback } from 'react';
|
|
2
|
-
const listeners = new Set();
|
|
3
|
-
let currentLogs = [];
|
|
4
|
-
let currentUnreadLogsCount = 0;
|
|
5
|
-
let memoizedSnapshot;
|
|
6
|
-
const updateMemoizedSnapshot = () => {
|
|
7
|
-
memoizedSnapshot = {
|
|
8
|
-
logs: currentLogs,
|
|
9
|
-
unreadLogsCount: currentUnreadLogsCount,
|
|
10
|
-
addLog: storeActions.addLog,
|
|
11
|
-
resetLogs: storeActions.resetLogs,
|
|
12
|
-
setUnreadLogsCount: storeActions.setUnreadLogsCount,
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
const notify = () => {
|
|
16
|
-
listeners.forEach((listener) => listener());
|
|
17
|
-
};
|
|
18
|
-
const storeActions = {
|
|
19
|
-
addLog: (log) => {
|
|
20
|
-
currentLogs = [log, ...currentLogs];
|
|
21
|
-
currentUnreadLogsCount += 1;
|
|
22
|
-
updateMemoizedSnapshot();
|
|
23
|
-
notify();
|
|
24
|
-
},
|
|
25
|
-
resetLogs: () => {
|
|
26
|
-
if (currentLogs.length === 0 && currentUnreadLogsCount === 0) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
currentLogs = [];
|
|
30
|
-
currentUnreadLogsCount = 0;
|
|
31
|
-
updateMemoizedSnapshot();
|
|
32
|
-
notify();
|
|
33
|
-
},
|
|
34
|
-
setUnreadLogsCount: (count) => {
|
|
35
|
-
if (currentUnreadLogsCount === count) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
currentUnreadLogsCount = count;
|
|
39
|
-
updateMemoizedSnapshot();
|
|
40
|
-
notify();
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
updateMemoizedSnapshot();
|
|
44
|
-
// Stable subscribe function so React doesn't unnecessarily tear down the subscription
|
|
45
|
-
const subscribe = (onStoreChange) => {
|
|
46
|
-
listeners.add(onStoreChange);
|
|
47
|
-
return () => listeners.delete(onStoreChange);
|
|
48
|
-
};
|
|
49
|
-
export function useLogs(selector = (state) => state) {
|
|
50
|
-
const getSnapshot = useCallback(() => selector(memoizedSnapshot), [selector]);
|
|
51
|
-
return useSyncExternalStore(subscribe, getSnapshot);
|
|
52
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
export const ArrowHead = (props) => {
|
|
3
|
-
// Use CSS custom property for theme-aware coloring, fallback to provided color
|
|
4
|
-
const strokeColor = props.color || 'var(--arrow-color, #B3B3B3)';
|
|
5
|
-
return (_jsxs("marker", { id: props.id, viewBox: "-5 -5 10 10", markerUnits: "strokeWidth", markerWidth: "10", markerHeight: "10", className: props.className, children: [_jsx("line", { x1: 0, y1: 0, x2: 2, y2: -2, stroke: strokeColor, strokeWidth: "1", strokeOpacity: "1", strokeLinecap: "round" }), _jsx("line", { x1: -2, y1: -2, x2: 0, y2: 0, stroke: strokeColor, strokeWidth: "1", strokeOpacity: "1", strokeLinecap: "round" })] }));
|
|
6
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { LogConsole } from '@/components/logs/log-console';
|
|
3
|
-
import { Background, BackgroundVariant, ReactFlow, } from '@xyflow/react';
|
|
4
|
-
import { useCallback, useMemo, useState } from 'react';
|
|
5
|
-
import { ArrowHead } from './arrow-head';
|
|
6
|
-
import { BaseEdge } from './base-edge';
|
|
7
|
-
import { FlowLoader } from './flow-loader';
|
|
8
|
-
import { useGetFlowState } from './hooks/use-get-flow-state';
|
|
9
|
-
import { Legend } from './legend';
|
|
10
|
-
import { NodeOrganizer } from './node-organizer';
|
|
11
|
-
import '@xyflow/react/dist/style.css';
|
|
12
|
-
const edgeTypes = {
|
|
13
|
-
base: BaseEdge,
|
|
14
|
-
};
|
|
15
|
-
export const FlowView = ({ flow, flowConfig }) => {
|
|
16
|
-
const { nodes, edges, onNodesChange, onEdgesChange, nodeTypes } = useGetFlowState(flow, flowConfig);
|
|
17
|
-
const [initialized, setInitialized] = useState(false);
|
|
18
|
-
const [hoveredType, setHoveredType] = useState(null);
|
|
19
|
-
const onInitialized = useCallback(() => {
|
|
20
|
-
setInitialized(true);
|
|
21
|
-
}, []);
|
|
22
|
-
const getClassName = useCallback((nodeType) => {
|
|
23
|
-
if (!hoveredType)
|
|
24
|
-
return '';
|
|
25
|
-
if (nodeType) {
|
|
26
|
-
return nodeType === hoveredType
|
|
27
|
-
? 'border border-border scale-[1.02] transition-all duration-300'
|
|
28
|
-
: 'opacity-30 transition-all duration-300';
|
|
29
|
-
}
|
|
30
|
-
// If no nodeType is provided, this is an edge
|
|
31
|
-
return 'opacity-30 transition-all duration-300';
|
|
32
|
-
}, [hoveredType]);
|
|
33
|
-
const nodesWithHighlights = useMemo(() => nodes.map((node) => ({
|
|
34
|
-
...node,
|
|
35
|
-
className: getClassName(node.data.type),
|
|
36
|
-
})), [nodes, getClassName]);
|
|
37
|
-
const edgesWithHighlights = useMemo(() => edges.map((edge) => ({
|
|
38
|
-
...edge,
|
|
39
|
-
className: getClassName(), // No argument means it's an edge
|
|
40
|
-
})), [edges, getClassName]);
|
|
41
|
-
const onNodesChangeHandler = useCallback((changes) => {
|
|
42
|
-
onNodesChange(changes);
|
|
43
|
-
}, [onNodesChange]);
|
|
44
|
-
if (!nodeTypes) {
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
return (_jsxs("div", { className: "w-full h-full relative bg-background", children: [!initialized && _jsx(FlowLoader, {}), _jsx(Legend, { onHover: setHoveredType }), _jsxs(ReactFlow, { nodes: nodesWithHighlights, edges: edgesWithHighlights, nodeTypes: nodeTypes, edgeTypes: edgeTypes, onNodesChange: onNodesChangeHandler, onEdgesChange: onEdgesChange, children: [_jsx(Background, { variant: BackgroundVariant.Dots, gap: 50, size: 2, className: "[--xy-background-color-dots:theme(colors.muted.DEFAULT)] [--xy-background-color:theme(colors.background)]" }), _jsx(NodeOrganizer, { onInitialized: onInitialized }), _jsx("svg", { className: "[--arrow-color:theme(colors.muted.foreground)]", children: _jsx("defs", { children: _jsx(ArrowHead, { id: "arrowhead" }) }) })] }), _jsx(LogConsole, {})] }));
|
|
48
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { Edge, Node } from '@xyflow/react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import type { EdgeData, NodeData } from '../nodes/nodes.types';
|
|
4
|
-
type Emit = string | {
|
|
5
|
-
topic: string;
|
|
6
|
-
label?: string;
|
|
7
|
-
};
|
|
8
|
-
type FlowStep = {
|
|
9
|
-
id: string;
|
|
10
|
-
name: string;
|
|
11
|
-
type: 'event' | 'api' | 'noop' | 'cron';
|
|
12
|
-
description?: string;
|
|
13
|
-
subscribes?: string[];
|
|
14
|
-
emits: Emit[];
|
|
15
|
-
virtualEmits?: Emit[];
|
|
16
|
-
action?: 'webhook';
|
|
17
|
-
webhookUrl?: string;
|
|
18
|
-
language?: string;
|
|
19
|
-
nodeComponentPath?: string;
|
|
20
|
-
filePath?: string;
|
|
21
|
-
};
|
|
22
|
-
export type FlowResponse = {
|
|
23
|
-
id: string;
|
|
24
|
-
name: string;
|
|
25
|
-
steps: FlowStep[];
|
|
26
|
-
edges: FlowEdge[];
|
|
27
|
-
error?: string;
|
|
28
|
-
};
|
|
29
|
-
export type FlowConfigResponse = {
|
|
30
|
-
id: string;
|
|
31
|
-
config: {
|
|
32
|
-
[stepName: string]: Position;
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
type FlowEdge = {
|
|
36
|
-
id: string;
|
|
37
|
-
source: string;
|
|
38
|
-
target: string;
|
|
39
|
-
data: EdgeData;
|
|
40
|
-
};
|
|
41
|
-
type Position = {
|
|
42
|
-
x: number;
|
|
43
|
-
y: number;
|
|
44
|
-
};
|
|
45
|
-
export declare const useGetFlowState: (flow: FlowResponse, flowConfig: FlowConfigResponse) => {
|
|
46
|
-
nodes: Node<NodeData>[];
|
|
47
|
-
edges: Edge<EdgeData>[];
|
|
48
|
-
onNodesChange: import("@xyflow/react").OnNodesChange<Node<NodeData>>;
|
|
49
|
-
onEdgesChange: import("@xyflow/react").OnEdgesChange<Edge<EdgeData>>;
|
|
50
|
-
nodeTypes: Record<string, React.ComponentType<any>>;
|
|
51
|
-
};
|
|
52
|
-
export {};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { Button } from '@/components/ui/button';
|
|
3
|
-
import { cn } from '@/lib/utils';
|
|
4
|
-
import { LayoutList, X } from 'lucide-react';
|
|
5
|
-
import { useState } from 'react';
|
|
6
|
-
import { colorMap } from '@/publicComponents/colorMap';
|
|
7
|
-
const EdgeSwatch = ({ color, dashed }) => (_jsx("svg", { className: "my-1", width: "48", height: "10", viewBox: "0 0 48 10", xmlns: "http://www.w3.org/2000/svg", children: _jsx("line", { x1: "0", y1: "5", x2: "48", y2: "5", stroke: color, strokeWidth: "2", strokeDasharray: dashed ? '4' : 'none', strokeLinecap: "round" }) }));
|
|
8
|
-
const legendItems = [
|
|
9
|
-
{
|
|
10
|
-
label: 'Event (Core)',
|
|
11
|
-
type: 'event',
|
|
12
|
-
color: colorMap.event,
|
|
13
|
-
description: 'Core logic components that process events.',
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
label: 'API',
|
|
17
|
-
type: 'api',
|
|
18
|
-
color: colorMap.api,
|
|
19
|
-
description: 'HTTP endpoints that trigger flows.',
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
label: 'Noop (Non-Operation)',
|
|
23
|
-
type: 'noop',
|
|
24
|
-
color: colorMap.noop,
|
|
25
|
-
description: 'Placeholder nodes for external processes.',
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
label: 'Cron',
|
|
29
|
-
type: 'cron',
|
|
30
|
-
color: colorMap.cron,
|
|
31
|
-
description: 'Scheduled tasks that run at specified intervals.',
|
|
32
|
-
},
|
|
33
|
-
];
|
|
34
|
-
const edgeLegendItems = [
|
|
35
|
-
{
|
|
36
|
-
label: 'Event Edge',
|
|
37
|
-
color: colorMap.event,
|
|
38
|
-
description: 'Represents an event emitted and subscribed by steps.',
|
|
39
|
-
dashed: true,
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
label: 'Virtual Edge',
|
|
43
|
-
color: 'hsl(var(--muted-foreground))',
|
|
44
|
-
description: 'Represents virtual connections.',
|
|
45
|
-
dashed: true,
|
|
46
|
-
},
|
|
47
|
-
];
|
|
48
|
-
export const Legend = ({ onHover }) => {
|
|
49
|
-
const [isExpanded, setIsExpanded] = useState(false);
|
|
50
|
-
return (_jsx("div", { className: 'absolute right-4 top-4 z-10 max-w-[500px]', children: _jsxs("div", { className: cn('rounded-lg border border-border bg-background/90 p-4 flex flex-col', !isExpanded && 'rounded-b-lg', isExpanded && 'gap-4'), children: [_jsxs("div", { className: "flex items-center gap-2", children: [isExpanded && _jsx("div", { className: "text-sm text-muted-foreground uppercase", children: "Flow Legend" }), _jsx("div", { className: "flex-1 flex justify-end", children: _jsx(Button, { variant: "ghost", size: "sm", onClick: () => setIsExpanded(!isExpanded), className: "p-2 hover:bg-muted", children: isExpanded ? _jsx(X, { size: 16 }) : _jsx(LayoutList, { size: 16 }) }) })] }), _jsx("div", { className: cn('overflow-hidden transition-all duration-200 ease-in-out', isExpanded ? 'max-h-[600px] opacity-100' : 'max-h-0 opacity-0'), children: isExpanded && (_jsxs(_Fragment, { children: [_jsx("div", { className: "grid grid-cols-2 gap-3", children: legendItems.map((item) => (_jsx("div", { onMouseEnter: () => onHover(item.type), onMouseLeave: () => onHover(null), className: "group cursor-pointer transition-all hover:bg-muted/20 rounded-md p-2", children: _jsxs("div", { className: "flex items-start gap-3", children: [_jsx("div", { className: "w-[8px] h-[8px] mt-[4px] rounded-full", style: { backgroundColor: item.color } }), _jsxs("div", { className: "flex-1", children: [_jsx("div", { className: "text-foreground text-sm font-medium", children: item.label }), _jsx("div", { className: "text-muted-foreground text-sm mt-0.5", children: item.description })] })] }) }, item.type))) }), _jsx("div", { className: "h-px bg-border my-4" }), _jsx("div", { className: "text-sm text-muted-foreground uppercase pb-4", children: "Edge Legend" }), _jsx("div", { className: "grid grid-cols-2 gap-3", children: edgeLegendItems.map((item) => (_jsxs("div", { className: "flex items-start gap-3", children: [_jsx(EdgeSwatch, { color: item.color, dashed: item.dashed }), _jsxs("div", { className: "flex-1", children: [_jsx("div", { className: "text-foreground text-sm font-medium", children: item.label }), _jsx("div", { className: "text-muted-foreground text-sm mt-0.5", children: item.description })] })] }, item.label))) })] })) })] }) }));
|
|
51
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|