@motiadev/workbench 0.7.1-beta.132 → 0.7.1-beta.133-796499
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/middleware.d.ts +1 -1
- package/dist/middleware.js +9 -5
- package/dist/src/App.js +1 -2
- package/dist/src/assets/.empty +0 -0
- package/dist/src/components/endpoints/hooks/use-state-stream.d.ts +1 -1
- package/dist/src/components/endpoints/hooks/use-state-stream.js +1 -1
- package/dist/src/components/flow/hooks/use-get-flow-state.js +0 -2
- package/dist/src/components/header/header.js +12 -4
- package/dist/src/components/states/hooks/states-hooks.js +1 -1
- package/dist/src/components/states/state-editor.js +1 -1
- package/dist/src/publicComponents/base-node/base-node.js +1 -1
- package/dist/tailwind.config.js +1 -1
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/tsconfig.node.tsbuildinfo +1 -1
- package/package.json +3 -3
- /package/dist/{public → src/assets}/motia-dark.png +0 -0
- /package/dist/{public → src/assets}/motia-light.png +0 -0
package/dist/middleware.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Express } from 'express';
|
|
2
|
-
export declare const applyMiddleware: (app: Express, port: number) => Promise<void>;
|
|
2
|
+
export declare const applyMiddleware: (app: Express, port: number, workbenchBase?: string) => Promise<void>;
|
package/dist/middleware.js
CHANGED
|
@@ -35,10 +35,11 @@ const reoPlugin = () => {
|
|
|
35
35
|
},
|
|
36
36
|
};
|
|
37
37
|
};
|
|
38
|
-
const applyMiddleware = async (app, port) => {
|
|
38
|
+
const applyMiddleware = async (app, port, workbenchBase = '') => {
|
|
39
39
|
const vite = await (0, vite_1.createServer)({
|
|
40
40
|
appType: 'spa',
|
|
41
41
|
root: __dirname,
|
|
42
|
+
base: workbenchBase,
|
|
42
43
|
server: {
|
|
43
44
|
middlewareMode: true,
|
|
44
45
|
allowedHosts: true,
|
|
@@ -54,14 +55,17 @@ const applyMiddleware = async (app, port) => {
|
|
|
54
55
|
},
|
|
55
56
|
},
|
|
56
57
|
resolve: {
|
|
57
|
-
alias: {
|
|
58
|
+
alias: {
|
|
59
|
+
'@': path_1.default.resolve(__dirname, './src'),
|
|
60
|
+
'@/assets': path_1.default.resolve(__dirname, './src/assets'),
|
|
61
|
+
},
|
|
58
62
|
},
|
|
59
63
|
plugins: [(0, plugin_react_1.default)(), processCwdPlugin(), reoPlugin()],
|
|
64
|
+
assetsInclude: ['**/*.png', '**/*.jpg', '**/*.jpeg', '**/*.gif', '**/*.svg', '**/*.ico', '**/*.webp', '**/*.avif'],
|
|
60
65
|
});
|
|
61
|
-
app.use(vite.middlewares);
|
|
62
|
-
app.use(
|
|
66
|
+
app.use(workbenchBase, vite.middlewares);
|
|
67
|
+
app.use(`${workbenchBase}/*`, async (req, res, next) => {
|
|
63
68
|
const url = req.originalUrl;
|
|
64
|
-
console.log('[UI] Request', { url });
|
|
65
69
|
try {
|
|
66
70
|
const index = fs_1.default.readFileSync(path_1.default.resolve(__dirname, 'index.html'), 'utf-8');
|
|
67
71
|
const html = await vite.transformIndexHtml(url, index);
|
package/dist/src/App.js
CHANGED
|
@@ -12,7 +12,6 @@ import { LogsPage } from './components/logs/logs-page';
|
|
|
12
12
|
import { TracesPage } from './components/observability/traces-page';
|
|
13
13
|
import { APP_SIDEBAR_CONTAINER_ID } from './components/sidebar/sidebar';
|
|
14
14
|
import { StatesPage } from './components/states/states-page';
|
|
15
|
-
import { Tutorial } from './components/tutorial/tutorial';
|
|
16
15
|
import { useTabsStore } from './stores/use-tabs-store';
|
|
17
16
|
var TabLocation;
|
|
18
17
|
(function (TabLocation) {
|
|
@@ -53,5 +52,5 @@ export const App = () => {
|
|
|
53
52
|
},
|
|
54
53
|
] }) }), _jsx("div", { id: APP_SIDEBAR_CONTAINER_ID })] }));
|
|
55
54
|
}
|
|
56
|
-
return (_jsxs("div", { className: "grid grid-rows-[auto_1fr] grid-cols-[1fr_auto] bg-background text-foreground h-screen", children: [_jsx("div", { className: "col-span-2", children: _jsx(Header, {}) }), _jsx("main", { className: "m-2 overflow-hidden", role: "main", children: _jsxs(CollapsiblePanelGroup, { autoSaveId: "app-panel", direction: "vertical", className: "gap-1 h-full", "aria-label": "Workbench panels", children: [_jsxs(CollapsiblePanel, { id: "top-panel", variant: 'tabs', defaultTab: tab.top, onTabChange: onTabChange(TabLocation.TOP), header: _jsxs(TabsList, { children: [_jsx(TabsTrigger, { value: "flow", "data-testid": "flows-link", children: _jsx(FlowTabMenuItem, {}) }), _jsxs(TabsTrigger, { value: "endpoint", "data-testid": "endpoints-link", className: "cursor-pointer", children: [_jsx(Link2, {}), "Endpoint"] })] }), children: [_jsx(TabsContent, { value: "flow", className: "h-full", asChild: true, children: _jsx(ReactFlowProvider, { children: _jsx(FlowPage, {}) }) }), _jsx(TabsContent, { value: "endpoint", asChild: true, children: _jsx(EndpointsPage, {}) })] }), _jsxs(CollapsiblePanel, { id: "bottom-panel", variant: 'tabs', defaultTab: tab.bottom, onTabChange: onTabChange(TabLocation.BOTTOM), header: _jsxs(TabsList, { children: [_jsxs(TabsTrigger, { value: "tracing", "data-testid": "traces-link", className: "cursor-pointer", children: [_jsx(GanttChart, {}), " Tracing"] }), _jsxs(TabsTrigger, { value: "logs", "data-testid": "logs-link", className: "cursor-pointer", children: [_jsx(LogsIcon, {}), "Logs"] }), _jsxs(TabsTrigger, { value: "states", "data-testid": "states-link", className: "cursor-pointer", children: [_jsx(File, {}), "States"] })] }), children: [_jsx(TabsContent, { value: "tracing", className: "max-h-fit", asChild: true, children: _jsx(TracesPage, {}) }), _jsx(TabsContent, { value: "logs", asChild: true, children: _jsx(LogsPage, {}) }), _jsx(TabsContent, { value: "states", asChild: true, children: _jsx(StatesPage, {}) })] })] }) }), _jsx("div", { id: APP_SIDEBAR_CONTAINER_ID })
|
|
55
|
+
return (_jsxs("div", { className: "grid grid-rows-[auto_1fr] grid-cols-[1fr_auto] bg-background text-foreground h-screen", children: [_jsx("div", { className: "col-span-2", children: _jsx(Header, {}) }), _jsx("main", { className: "m-2 overflow-hidden", role: "main", children: _jsxs(CollapsiblePanelGroup, { autoSaveId: "app-panel", direction: "vertical", className: "gap-1 h-full", "aria-label": "Workbench panels", children: [_jsxs(CollapsiblePanel, { id: "top-panel", variant: 'tabs', defaultTab: tab.top, onTabChange: onTabChange(TabLocation.TOP), header: _jsxs(TabsList, { children: [_jsx(TabsTrigger, { value: "flow", "data-testid": "flows-link", children: _jsx(FlowTabMenuItem, {}) }), _jsxs(TabsTrigger, { value: "endpoint", "data-testid": "endpoints-link", className: "cursor-pointer", children: [_jsx(Link2, {}), "Endpoint"] })] }), children: [_jsx(TabsContent, { value: "flow", className: "h-full", asChild: true, children: _jsx(ReactFlowProvider, { children: _jsx(FlowPage, {}) }) }), _jsx(TabsContent, { value: "endpoint", asChild: true, children: _jsx(EndpointsPage, {}) })] }), _jsxs(CollapsiblePanel, { id: "bottom-panel", variant: 'tabs', defaultTab: tab.bottom, onTabChange: onTabChange(TabLocation.BOTTOM), header: _jsxs(TabsList, { children: [_jsxs(TabsTrigger, { value: "tracing", "data-testid": "traces-link", className: "cursor-pointer", children: [_jsx(GanttChart, {}), " Tracing"] }), _jsxs(TabsTrigger, { value: "logs", "data-testid": "logs-link", className: "cursor-pointer", children: [_jsx(LogsIcon, {}), "Logs"] }), _jsxs(TabsTrigger, { value: "states", "data-testid": "states-link", className: "cursor-pointer", children: [_jsx(File, {}), "States"] })] }), children: [_jsx(TabsContent, { value: "tracing", className: "max-h-fit", asChild: true, children: _jsx(TracesPage, {}) }), _jsx(TabsContent, { value: "logs", asChild: true, children: _jsx(LogsPage, {}) }), _jsx(TabsContent, { value: "states", asChild: true, children: _jsx(StatesPage, {}) })] })] }) }), _jsx("div", { id: APP_SIDEBAR_CONTAINER_ID })] }));
|
|
57
56
|
};
|
|
File without changes
|
|
@@ -2,7 +2,7 @@ import { useStreamItem } from '@motiadev/stream-client-react';
|
|
|
2
2
|
export const useStateStream = (object) => {
|
|
3
3
|
const { __motia, ...rest } = object || {};
|
|
4
4
|
const { data } = useStreamItem(__motia);
|
|
5
|
-
const originalData = rest || object;
|
|
5
|
+
const originalData = Array.isArray(object) ? object : rest || object;
|
|
6
6
|
return {
|
|
7
7
|
data: data || originalData,
|
|
8
8
|
originalData,
|
|
@@ -32,7 +32,6 @@ async function importFlow(flow, flowConfig) {
|
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
34
|
try {
|
|
35
|
-
console.log(path);
|
|
36
35
|
const module = await import(/* @vite-ignore */ `/@fs/${path}`);
|
|
37
36
|
const component = module.Node ?? module.default;
|
|
38
37
|
nodeComponentCache.set(path, component);
|
|
@@ -113,7 +112,6 @@ export const useGetFlowState = (flow, flowConfig) => {
|
|
|
113
112
|
return acc;
|
|
114
113
|
}, {});
|
|
115
114
|
if (!isEqual(steps, lastSavedConfigRef.current)) {
|
|
116
|
-
console.log('steps', steps, lastSavedConfigRef.current);
|
|
117
115
|
lastSavedConfigRef.current = steps;
|
|
118
116
|
const newConfig = { id: flowIdRef.current, config: steps };
|
|
119
117
|
try {
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import motiaLogoDark from '@/assets/motia-dark.png';
|
|
3
|
+
import motiaLogoLight from '@/assets/motia-light.png';
|
|
3
4
|
import { useThemeStore } from '@/stores/use-theme-store';
|
|
4
|
-
import {
|
|
5
|
+
import { useEffect, useState } from 'react';
|
|
6
|
+
import { Tutorial } from '../tutorial/tutorial';
|
|
5
7
|
import { TutorialButton } from '../tutorial/tutorial-button';
|
|
8
|
+
import { ThemeToggle } from '../ui/theme-toggle';
|
|
6
9
|
import { DeployButton } from './deploy-button';
|
|
7
10
|
export const Header = () => {
|
|
8
11
|
const [isDevMode, setIsDevMode] = useState(false);
|
|
12
|
+
const [isTutorialDisabled, setIsTutorialDisabled] = useState(true);
|
|
9
13
|
const theme = useThemeStore((state) => state.theme);
|
|
14
|
+
const logo = theme === 'light' ? motiaLogoLight : motiaLogoDark;
|
|
10
15
|
useEffect(() => {
|
|
11
16
|
fetch('/__motia')
|
|
12
17
|
.then((res) => res.json())
|
|
13
|
-
.then((data) =>
|
|
18
|
+
.then((data) => {
|
|
19
|
+
setIsDevMode(data.isDev);
|
|
20
|
+
setIsTutorialDisabled(data.isTutorialDisabled);
|
|
21
|
+
})
|
|
14
22
|
.catch((err) => console.error(err));
|
|
15
23
|
}, []);
|
|
16
|
-
return (_jsxs("header", { className: "min-h-16 px-4 gap-4 flex items-center bg-default text-default-foreground border-b", children: [_jsx("img", { src:
|
|
24
|
+
return (_jsxs("header", { className: "min-h-16 px-4 gap-4 flex items-center bg-default text-default-foreground border-b", children: [_jsx("img", { src: logo, className: "h-5", id: "logo-icon", "data-testid": "logo-icon" }), _jsx("div", { className: "flex-1" }), _jsx(ThemeToggle, {}), isDevMode && !isTutorialDisabled && _jsx(TutorialButton, {}), isDevMode && _jsx(DeployButton, {}), !isTutorialDisabled && _jsx(Tutorial, {})] }));
|
|
17
25
|
};
|
|
@@ -24,7 +24,7 @@ export const StateEditor = ({ state }) => {
|
|
|
24
24
|
try {
|
|
25
25
|
setIsRequestLoading(true);
|
|
26
26
|
setSaveStatus('idle');
|
|
27
|
-
const response = await fetch('/
|
|
27
|
+
const response = await fetch('/__motia/state', {
|
|
28
28
|
method: 'POST',
|
|
29
29
|
headers: {
|
|
30
30
|
'Content-Type': 'application/json',
|
|
@@ -12,7 +12,7 @@ export const BaseNode = ({ title, variant, children, disableSourceHandle, disabl
|
|
|
12
12
|
const [content, setContent] = useState(null);
|
|
13
13
|
const [features, setFeatures] = useState([]);
|
|
14
14
|
const fetchContent = useCallback(async () => {
|
|
15
|
-
const response = await fetch(`/step/${data.id}`);
|
|
15
|
+
const response = await fetch(`/__motia/step/${data.id}`);
|
|
16
16
|
const responseData = await response.json();
|
|
17
17
|
setContent(responseData.content);
|
|
18
18
|
setFeatures(responseData.features);
|
package/dist/tailwind.config.js
CHANGED