@motiadev/workbench 0.13.0-beta.162-846200 → 0.13.1-beta.162
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/LICENSE +93 -21
- package/dist/index.d.ts +10 -189
- package/dist/index.html +1 -1
- package/dist/index.js +7 -1065
- package/dist/middleware.d.ts +8 -66
- package/dist/middleware.js +86 -684
- package/dist/motia-plugin/__tests__/generator.test.d.ts +1 -0
- package/dist/motia-plugin/__tests__/generator.test.js +97 -0
- package/dist/motia-plugin/__tests__/resolver.test.d.ts +1 -0
- package/dist/motia-plugin/__tests__/resolver.test.js +64 -0
- package/dist/motia-plugin/__tests__/validator.test.d.ts +1 -0
- package/dist/motia-plugin/__tests__/validator.test.js +59 -0
- package/dist/motia-plugin/generator.d.ts +78 -0
- package/dist/motia-plugin/{generator.ts → generator.js} +35 -37
- package/dist/motia-plugin/hmr.d.ts +22 -0
- package/dist/motia-plugin/hmr.js +100 -0
- package/dist/motia-plugin/index.d.ts +3 -0
- package/dist/motia-plugin/index.js +153 -0
- package/dist/motia-plugin/{resolver.ts → resolver.d.ts} +5 -38
- package/dist/motia-plugin/resolver.js +92 -0
- package/dist/motia-plugin/types.d.ts +169 -0
- package/dist/motia-plugin/types.js +36 -0
- package/dist/motia-plugin/{utils.ts → utils.d.ts} +4 -17
- package/dist/motia-plugin/utils.js +75 -0
- package/dist/motia-plugin/validator.d.ts +19 -0
- package/dist/motia-plugin/validator.js +163 -0
- package/dist/src/App.d.ts +2 -0
- package/dist/src/App.js +35 -0
- package/dist/src/components/NotFoundPage.d.ts +1 -0
- package/dist/src/components/NotFoundPage.js +3 -0
- package/dist/src/components/bottom-panel.d.ts +1 -0
- package/dist/src/components/bottom-panel.js +15 -0
- package/dist/src/components/flow/base-edge.d.ts +3 -0
- package/dist/src/components/flow/base-edge.js +39 -0
- package/dist/src/components/flow/flow-loader.d.ts +1 -0
- package/dist/src/components/flow/flow-loader.js +4 -0
- package/dist/src/components/flow/flow-page.d.ts +1 -0
- package/dist/src/components/flow/flow-page.js +25 -0
- package/dist/src/components/flow/flow-tab-menu-item.d.ts +1 -0
- package/dist/src/components/flow/flow-tab-menu-item.js +18 -0
- package/dist/src/components/flow/flow-view.d.ts +12 -0
- package/dist/src/components/flow/flow-view.js +22 -0
- package/dist/src/components/flow/hooks/use-get-flow-state.d.ts +10 -0
- package/dist/src/components/flow/hooks/use-get-flow-state.js +133 -0
- package/dist/src/components/flow/hooks/use-save-workflow-config.d.ts +2 -0
- package/dist/src/components/flow/hooks/use-save-workflow-config.js +22 -0
- package/dist/src/components/flow/node-organizer.d.ts +10 -0
- package/dist/src/components/flow/node-organizer.js +82 -0
- package/dist/src/components/flow/nodes/api-flow-node.d.ts +2 -0
- package/dist/src/components/flow/nodes/api-flow-node.js +5 -0
- 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/components/flow/nodes/event-flow-node.d.ts +2 -0
- 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/components/flow/nodes/noop-flow-node.js +5 -0
- package/dist/src/components/header/deploy-button.d.ts +1 -0
- package/dist/src/components/header/deploy-button.js +28 -0
- package/dist/src/components/header/header.d.ts +2 -0
- package/dist/src/components/header/header.js +23 -0
- package/dist/src/components/root-motia.d.ts +2 -0
- package/dist/src/components/root-motia.js +7 -0
- package/dist/src/components/top-panel.d.ts +1 -0
- package/dist/src/components/top-panel.js +15 -0
- package/dist/src/components/tutorial/engine/tutorial-engine.d.ts +12 -0
- package/dist/src/components/tutorial/engine/tutorial-engine.js +36 -0
- package/dist/src/components/tutorial/engine/tutorial-types.d.ts +22 -0
- package/dist/src/components/tutorial/engine/tutorial-types.js +1 -0
- package/dist/src/components/tutorial/engine/workbench-xpath.d.ts +45 -0
- package/dist/src/components/tutorial/engine/workbench-xpath.js +45 -0
- package/dist/src/components/tutorial/hooks/tutorial-utils.d.ts +1 -0
- package/dist/src/components/tutorial/hooks/tutorial-utils.js +17 -0
- package/dist/src/components/tutorial/hooks/use-tutorial-engine.d.ts +15 -0
- package/dist/src/components/tutorial/hooks/use-tutorial-engine.js +183 -0
- package/dist/src/components/tutorial/hooks/use-tutorial.d.ts +5 -0
- package/dist/src/components/tutorial/hooks/use-tutorial.js +10 -0
- package/dist/src/components/tutorial/tutorial-button.d.ts +2 -0
- package/dist/src/components/tutorial/tutorial-button.js +21 -0
- package/dist/src/components/tutorial/tutorial-step.d.ts +14 -0
- package/dist/src/components/tutorial/tutorial-step.js +19 -0
- package/dist/src/components/tutorial/tutorial.css +2 -2
- package/dist/src/components/tutorial/tutorial.d.ts +2 -0
- package/dist/src/components/tutorial/tutorial.js +32 -0
- package/dist/src/components/ui/json-editor.d.ts +12 -0
- package/dist/src/components/ui/json-editor.js +35 -0
- package/dist/src/components/ui/table.d.ts +10 -0
- package/dist/src/components/ui/table.js +20 -0
- package/dist/src/components/ui/theme-toggle.d.ts +2 -0
- package/dist/src/components/ui/theme-toggle.js +19 -0
- package/dist/src/components/ui/tooltip.d.ts +6 -0
- package/dist/src/components/ui/tooltip.js +3 -0
- package/dist/src/hooks/use-debounced.d.ts +1 -0
- package/dist/src/hooks/use-debounced.js +18 -0
- package/dist/src/hooks/use-fetch-flows.d.ts +1 -0
- package/dist/src/hooks/use-fetch-flows.js +26 -0
- package/dist/src/hooks/use-mobile.d.ts +1 -0
- package/dist/src/hooks/use-mobile.js +15 -0
- 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 +5 -5
- package/dist/src/lib/__tests__/utils.test.d.ts +1 -0
- package/dist/src/lib/__tests__/utils.test.js +94 -0
- package/dist/src/lib/motia-analytics.d.ts +38 -0
- package/dist/src/lib/motia-analytics.js +132 -0
- package/dist/src/lib/plugins.d.ts +2 -0
- package/dist/src/lib/plugins.js +105 -0
- package/dist/src/lib/utils.d.ts +7 -0
- package/dist/src/lib/utils.js +34 -0
- package/dist/src/main.d.ts +2 -0
- package/dist/src/main.js +17 -0
- package/dist/src/project-view-mode.d.ts +1 -0
- package/dist/src/project-view-mode.js +20 -0
- package/dist/src/publicComponents/api-node.d.ts +5 -0
- package/dist/src/publicComponents/api-node.js +5 -0
- package/dist/src/publicComponents/base-node/base-handle.d.ts +9 -0
- package/dist/src/publicComponents/base-node/base-handle.js +8 -0
- package/dist/src/publicComponents/base-node/base-node.d.ts +15 -0
- package/dist/src/publicComponents/base-node/base-node.js +30 -0
- package/dist/src/publicComponents/base-node/code-display.d.ts +9 -0
- package/dist/src/publicComponents/base-node/code-display.js +64 -0
- package/dist/src/publicComponents/base-node/emits.d.ts +5 -0
- package/dist/src/publicComponents/base-node/emits.js +5 -0
- package/dist/src/publicComponents/base-node/feature-card.d.ts +10 -0
- package/dist/src/publicComponents/base-node/feature-card.js +5 -0
- package/dist/src/publicComponents/base-node/language-indicator.d.ts +10 -0
- package/dist/src/publicComponents/base-node/language-indicator.js +29 -0
- package/dist/src/publicComponents/base-node/node-header.d.ts +13 -0
- package/dist/src/publicComponents/base-node/node-header.js +30 -0
- package/dist/src/publicComponents/base-node/node-sidebar.d.ts +14 -0
- package/dist/src/publicComponents/base-node/node-sidebar.js +9 -0
- package/dist/src/publicComponents/base-node/subscribe.d.ts +4 -0
- package/dist/src/publicComponents/base-node/subscribe.js +4 -0
- package/dist/src/publicComponents/cron-node.d.ts +4 -0
- package/dist/src/publicComponents/cron-node.js +6 -0
- package/dist/src/publicComponents/event-node.d.ts +4 -0
- package/dist/src/publicComponents/event-node.js +5 -0
- package/dist/src/publicComponents/node-props.d.ts +21 -0
- package/dist/src/publicComponents/node-props.js +1 -0
- package/dist/src/publicComponents/noop-node.d.ts +4 -0
- package/dist/src/publicComponents/noop-node.js +5 -0
- package/dist/src/setupTests.d.ts +1 -0
- package/dist/src/setupTests.js +1 -0
- package/dist/src/stores/use-app-tabs-store.d.ts +16 -0
- package/dist/src/stores/use-app-tabs-store.js +31 -0
- package/dist/src/stores/use-flow-store.d.ts +21 -0
- package/dist/src/stores/use-flow-store.js +16 -0
- package/dist/src/stores/use-global-store.d.ts +18 -0
- package/dist/src/stores/use-global-store.js +12 -0
- package/dist/src/stores/use-motia-config-store.d.ts +12 -0
- package/dist/src/stores/use-motia-config-store.js +24 -0
- package/dist/src/stores/use-tabs-store.d.ts +19 -0
- package/dist/src/stores/use-tabs-store.js +22 -0
- package/dist/src/system-view-mode.d.ts +1 -0
- package/dist/src/system-view-mode.js +10 -0
- package/dist/src/types/endpoint.d.ts +14 -0
- package/dist/src/types/endpoint.js +1 -0
- package/dist/src/types/file.d.ts +7 -0
- package/dist/src/types/file.js +1 -0
- package/dist/src/types/flow.d.ts +115 -0
- package/dist/src/types/flow.js +1 -0
- package/dist/tsconfig.app.tsbuildinfo +1 -0
- package/dist/tsconfig.node.tsbuildinfo +1 -0
- package/package.json +51 -55
- package/dist/motia-plugin/__tests__/generator.test.ts +0 -129
- package/dist/motia-plugin/__tests__/resolver.test.ts +0 -82
- package/dist/motia-plugin/__tests__/validator.test.ts +0 -71
- package/dist/motia-plugin/hmr.ts +0 -123
- package/dist/motia-plugin/index.ts +0 -183
- package/dist/motia-plugin/types.ts +0 -198
- package/dist/motia-plugin/validator.ts +0 -197
- package/dist/src/App.tsx +0 -41
- package/dist/src/components/NotFoundPage.tsx +0 -11
- package/dist/src/components/bottom-panel.tsx +0 -39
- package/dist/src/components/flow/base-edge.tsx +0 -61
- package/dist/src/components/flow/flow-loader.tsx +0 -3
- package/dist/src/components/flow/flow-page.tsx +0 -75
- package/dist/src/components/flow/flow-tab-menu-item.tsx +0 -50
- package/dist/src/components/flow/flow-view.tsx +0 -66
- package/dist/src/components/flow/hooks/use-get-flow-state.tsx +0 -171
- package/dist/src/components/flow/hooks/use-save-workflow-config.ts +0 -25
- package/dist/src/components/flow/node-organizer.tsx +0 -103
- package/dist/src/components/flow/nodes/api-flow-node.tsx +0 -6
- package/dist/src/components/flow/nodes/cron-flow-node.tsx +0 -6
- package/dist/src/components/flow/nodes/event-flow-node.tsx +0 -6
- package/dist/src/components/flow/nodes/noop-flow-node.tsx +0 -6
- package/dist/src/components/header/deploy-button.tsx +0 -110
- package/dist/src/components/header/header.tsx +0 -39
- package/dist/src/components/root-motia.tsx +0 -10
- package/dist/src/components/top-panel.tsx +0 -40
- package/dist/src/components/tutorial/engine/tutorial-engine.ts +0 -26
- package/dist/src/components/tutorial/engine/tutorial-types.ts +0 -26
- package/dist/src/components/tutorial/engine/workbench-xpath.ts +0 -53
- package/dist/src/components/tutorial/hooks/tutorial-utils.ts +0 -26
- package/dist/src/components/tutorial/hooks/use-tutorial-engine.ts +0 -213
- package/dist/src/components/tutorial/hooks/use-tutorial.ts +0 -14
- package/dist/src/components/tutorial/tutorial-button.tsx +0 -46
- package/dist/src/components/tutorial/tutorial-step.tsx +0 -82
- package/dist/src/components/tutorial/tutorial.tsx +0 -59
- package/dist/src/components/ui/json-editor.tsx +0 -68
- package/dist/src/components/ui/table.tsx +0 -75
- package/dist/src/components/ui/theme-toggle.tsx +0 -54
- package/dist/src/components/ui/tooltip.tsx +0 -26
- package/dist/src/hooks/use-debounced.ts +0 -22
- package/dist/src/hooks/use-fetch-flows.ts +0 -33
- package/dist/src/hooks/use-mobile.ts +0 -19
- package/dist/src/hooks/use-update-handle-positions.ts +0 -42
- package/dist/src/lib/__tests__/utils.test.ts +0 -110
- package/dist/src/lib/motia-analytics.ts +0 -140
- package/dist/src/lib/plugins.tsx +0 -132
- package/dist/src/lib/utils.ts +0 -37
- package/dist/src/main.tsx +0 -30
- package/dist/src/project-view-mode.tsx +0 -32
- package/dist/src/publicComponents/api-node.tsx +0 -26
- package/dist/src/publicComponents/base-node/base-handle.tsx +0 -50
- package/dist/src/publicComponents/base-node/base-node.tsx +0 -114
- package/dist/src/publicComponents/base-node/code-display.tsx +0 -119
- package/dist/src/publicComponents/base-node/emits.tsx +0 -17
- package/dist/src/publicComponents/base-node/feature-card.tsx +0 -32
- package/dist/src/publicComponents/base-node/language-indicator.tsx +0 -131
- package/dist/src/publicComponents/base-node/node-header.tsx +0 -49
- package/dist/src/publicComponents/base-node/node-sidebar.tsx +0 -41
- package/dist/src/publicComponents/base-node/subscribe.tsx +0 -13
- package/dist/src/publicComponents/cron-node.tsx +0 -24
- package/dist/src/publicComponents/event-node.tsx +0 -20
- package/dist/src/publicComponents/node-props.tsx +0 -15
- package/dist/src/publicComponents/noop-node.tsx +0 -19
- package/dist/src/setupTests.ts +0 -1
- package/dist/src/stores/use-app-tabs-store.ts +0 -49
- package/dist/src/stores/use-flow-store.ts +0 -31
- package/dist/src/stores/use-global-store.ts +0 -24
- package/dist/src/stores/use-motia-config-store.ts +0 -36
- package/dist/src/stores/use-tabs-store.ts +0 -34
- package/dist/src/system-view-mode.tsx +0 -28
- package/dist/src/types/endpoint.ts +0 -12
- package/dist/src/types/file.ts +0 -7
- package/dist/src/types/flow.ts +0 -103
- package/eslint.config.cjs +0 -22
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare enum TabLocation {
|
|
2
|
+
TOP = "top",
|
|
3
|
+
BOTTOM = "bottom"
|
|
4
|
+
}
|
|
5
|
+
export type AppTab = {
|
|
6
|
+
id: string;
|
|
7
|
+
tabLabel: React.ElementType;
|
|
8
|
+
content: React.ElementType;
|
|
9
|
+
};
|
|
10
|
+
export interface AppTabsState {
|
|
11
|
+
tabs: Record<TabLocation, AppTab[]>;
|
|
12
|
+
addTab: (position: TabLocation, tab: AppTab) => void;
|
|
13
|
+
setTabs: (position: TabLocation, tabs: AppTab[]) => void;
|
|
14
|
+
removeTab: (position: TabLocation, id: string) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const useAppTabsStore: import("zustand").UseBoundStore<import("zustand").StoreApi<AppTabsState>>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { create } from 'zustand';
|
|
2
|
+
export var TabLocation;
|
|
3
|
+
(function (TabLocation) {
|
|
4
|
+
TabLocation["TOP"] = "top";
|
|
5
|
+
TabLocation["BOTTOM"] = "bottom";
|
|
6
|
+
})(TabLocation || (TabLocation = {}));
|
|
7
|
+
const defaultTabs = {
|
|
8
|
+
[TabLocation.TOP]: [],
|
|
9
|
+
[TabLocation.BOTTOM]: [],
|
|
10
|
+
};
|
|
11
|
+
export const useAppTabsStore = create((set) => ({
|
|
12
|
+
tabs: defaultTabs,
|
|
13
|
+
addTab: (position, tab) => set((state) => ({
|
|
14
|
+
tabs: {
|
|
15
|
+
...state.tabs,
|
|
16
|
+
[position]: [...state.tabs[position], tab],
|
|
17
|
+
},
|
|
18
|
+
})),
|
|
19
|
+
setTabs: (position, tabs) => set((state) => ({
|
|
20
|
+
tabs: {
|
|
21
|
+
...state.tabs,
|
|
22
|
+
[position]: tabs,
|
|
23
|
+
},
|
|
24
|
+
})),
|
|
25
|
+
removeTab: (position, id) => set((state) => ({
|
|
26
|
+
tabs: {
|
|
27
|
+
...state.tabs,
|
|
28
|
+
[position]: state.tabs[position].filter((tab) => tab.id !== id),
|
|
29
|
+
},
|
|
30
|
+
})),
|
|
31
|
+
}));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
type UseFlowStore = {
|
|
2
|
+
selectedFlowId?: string;
|
|
3
|
+
selectFlowId: (flowId: string) => void;
|
|
4
|
+
clearSelectedFlowId: () => void;
|
|
5
|
+
flows: string[];
|
|
6
|
+
setFlows: (flows: string[]) => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const useFlowStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<UseFlowStore>, "setState" | "persist"> & {
|
|
9
|
+
setState(partial: UseFlowStore | Partial<UseFlowStore> | ((state: UseFlowStore) => UseFlowStore | Partial<UseFlowStore>), replace?: false | undefined): unknown;
|
|
10
|
+
setState(state: UseFlowStore | ((state: UseFlowStore) => UseFlowStore), replace: true): unknown;
|
|
11
|
+
persist: {
|
|
12
|
+
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<UseFlowStore, UseFlowStore, unknown>>) => void;
|
|
13
|
+
clearStorage: () => void;
|
|
14
|
+
rehydrate: () => Promise<void> | void;
|
|
15
|
+
hasHydrated: () => boolean;
|
|
16
|
+
onHydrate: (fn: (state: UseFlowStore) => void) => () => void;
|
|
17
|
+
onFinishHydration: (fn: (state: UseFlowStore) => void) => () => void;
|
|
18
|
+
getOptions: () => Partial<import("zustand/middleware").PersistOptions<UseFlowStore, UseFlowStore, unknown>>;
|
|
19
|
+
};
|
|
20
|
+
}>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { create } from 'zustand';
|
|
2
|
+
import { createJSONStorage, persist } from 'zustand/middleware';
|
|
3
|
+
export const useFlowStore = create(persist((set) => ({
|
|
4
|
+
flows: [],
|
|
5
|
+
setFlows: (flows) => set({ flows }),
|
|
6
|
+
selectFlowId: (flowId) => set((state) => {
|
|
7
|
+
if (state.selectedFlowId === flowId) {
|
|
8
|
+
return state;
|
|
9
|
+
}
|
|
10
|
+
return { selectedFlowId: flowId };
|
|
11
|
+
}),
|
|
12
|
+
clearSelectedFlowId: () => set({ selectedFlowId: undefined }),
|
|
13
|
+
}), {
|
|
14
|
+
name: 'motia-flow-storage',
|
|
15
|
+
storage: createJSONStorage(() => localStorage),
|
|
16
|
+
}));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type UseGlobalStore = {
|
|
2
|
+
selectedEndpointId?: string;
|
|
3
|
+
selectEndpointId: (endpointId?: string) => void;
|
|
4
|
+
};
|
|
5
|
+
export declare const useGlobalStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<UseGlobalStore>, "setState" | "persist"> & {
|
|
6
|
+
setState(partial: UseGlobalStore | Partial<UseGlobalStore> | ((state: UseGlobalStore) => UseGlobalStore | Partial<UseGlobalStore>), replace?: false | undefined): unknown;
|
|
7
|
+
setState(state: UseGlobalStore | ((state: UseGlobalStore) => UseGlobalStore), replace: true): unknown;
|
|
8
|
+
persist: {
|
|
9
|
+
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<UseGlobalStore, UseGlobalStore, unknown>>) => void;
|
|
10
|
+
clearStorage: () => void;
|
|
11
|
+
rehydrate: () => Promise<void> | void;
|
|
12
|
+
hasHydrated: () => boolean;
|
|
13
|
+
onHydrate: (fn: (state: UseGlobalStore) => void) => () => void;
|
|
14
|
+
onFinishHydration: (fn: (state: UseGlobalStore) => void) => () => void;
|
|
15
|
+
getOptions: () => Partial<import("zustand/middleware").PersistOptions<UseGlobalStore, UseGlobalStore, unknown>>;
|
|
16
|
+
};
|
|
17
|
+
}>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { create } from 'zustand';
|
|
2
|
+
import { createJSONStorage, persist } from 'zustand/middleware';
|
|
3
|
+
const select = (id, name) => (state) => {
|
|
4
|
+
return id ? (state[name] === id ? state : { ...state, [name]: id }) : { ...state, [name]: undefined };
|
|
5
|
+
};
|
|
6
|
+
export const useGlobalStore = create(persist((set) => ({
|
|
7
|
+
selectedEndpointId: undefined,
|
|
8
|
+
selectEndpointId: (endpointId) => set(select(endpointId, 'selectedEndpointId')),
|
|
9
|
+
}), {
|
|
10
|
+
name: 'motia-global-storage',
|
|
11
|
+
storage: createJSONStorage(() => localStorage),
|
|
12
|
+
}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface MotiaConfig {
|
|
2
|
+
isDev: boolean;
|
|
3
|
+
isTutorialDisabled: boolean;
|
|
4
|
+
}
|
|
5
|
+
interface MotiaConfigState {
|
|
6
|
+
config: MotiaConfig | null;
|
|
7
|
+
isLoading: boolean;
|
|
8
|
+
error: Error | null;
|
|
9
|
+
fetchConfig: () => Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export declare const useMotiaConfigStore: import("zustand").UseBoundStore<import("zustand").StoreApi<MotiaConfigState>>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { create } from 'zustand';
|
|
2
|
+
export const useMotiaConfigStore = create((set, get) => ({
|
|
3
|
+
config: null,
|
|
4
|
+
isLoading: false,
|
|
5
|
+
error: null,
|
|
6
|
+
fetchConfig: async () => {
|
|
7
|
+
const { config, isLoading } = get();
|
|
8
|
+
if (isLoading || config)
|
|
9
|
+
return;
|
|
10
|
+
set({ isLoading: true, error: null });
|
|
11
|
+
try {
|
|
12
|
+
const response = await fetch('/__motia');
|
|
13
|
+
if (!response.ok) {
|
|
14
|
+
throw new Error(`Failed to fetch Motia config: ${response.statusText}`);
|
|
15
|
+
}
|
|
16
|
+
const data = await response.json();
|
|
17
|
+
set({ config: data, isLoading: false });
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
console.error('Failed to fetch Motia config:', error);
|
|
21
|
+
set({ error: error, isLoading: false });
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
}));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface TabsState {
|
|
2
|
+
tab: Record<string, string>;
|
|
3
|
+
setTopTab: (tab: string) => void;
|
|
4
|
+
setBottomTab: (tab: string) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const useTabsStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<TabsState>, "setState" | "persist"> & {
|
|
7
|
+
setState(partial: TabsState | Partial<TabsState> | ((state: TabsState) => TabsState | Partial<TabsState>), replace?: false | undefined): unknown;
|
|
8
|
+
setState(state: TabsState | ((state: TabsState) => TabsState), replace: true): unknown;
|
|
9
|
+
persist: {
|
|
10
|
+
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<TabsState, TabsState, unknown>>) => void;
|
|
11
|
+
clearStorage: () => void;
|
|
12
|
+
rehydrate: () => Promise<void> | void;
|
|
13
|
+
hasHydrated: () => boolean;
|
|
14
|
+
onHydrate: (fn: (state: TabsState) => void) => () => void;
|
|
15
|
+
onFinishHydration: (fn: (state: TabsState) => void) => () => void;
|
|
16
|
+
getOptions: () => Partial<import("zustand/middleware").PersistOptions<TabsState, TabsState, unknown>>;
|
|
17
|
+
};
|
|
18
|
+
}>;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { create } from 'zustand';
|
|
2
|
+
import { createJSONStorage, persist } from 'zustand/middleware';
|
|
3
|
+
import { motiaAnalytics } from '@/lib/motia-analytics';
|
|
4
|
+
export const useTabsStore = create(persist((set, get) => ({
|
|
5
|
+
tab: {
|
|
6
|
+
top: 'flow',
|
|
7
|
+
bottom: 'tracing',
|
|
8
|
+
},
|
|
9
|
+
setTopTab: (tab) => {
|
|
10
|
+
const currentTab = get().tab;
|
|
11
|
+
motiaAnalytics.track('Top panel tab changed', { 'new.top': tab, tab: currentTab });
|
|
12
|
+
set((state) => ({ tab: { ...state.tab, top: tab } }));
|
|
13
|
+
},
|
|
14
|
+
setBottomTab: (tab) => {
|
|
15
|
+
const currentTab = get().tab;
|
|
16
|
+
motiaAnalytics.track('Bottom panel tab changed', { 'new.bottom': tab, tab: currentTab });
|
|
17
|
+
set((state) => ({ tab: { ...state.tab, bottom: tab } }));
|
|
18
|
+
},
|
|
19
|
+
}), {
|
|
20
|
+
name: 'motia-tabs-storage',
|
|
21
|
+
storage: createJSONStorage(() => localStorage),
|
|
22
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SystemViewMode: import("react").MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { APP_SIDEBAR_CONTAINER_ID, CollapsiblePanelGroup } from '@motiadev/ui';
|
|
3
|
+
import { memo } from 'react';
|
|
4
|
+
import { BottomPanel } from './components/bottom-panel';
|
|
5
|
+
import { Header } from './components/header/header';
|
|
6
|
+
import { TopPanel } from './components/top-panel';
|
|
7
|
+
export const SystemViewMode = memo(() => {
|
|
8
|
+
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", children: _jsxs(CollapsiblePanelGroup, { autoSaveId: "app-panel", direction: "vertical", className: "gap-1 h-full", "aria-label": "Workbench panels", children: [_jsx(TopPanel, {}), _jsx(BottomPanel, {})] }) }), _jsx("div", { id: APP_SIDEBAR_CONTAINER_ID })] }));
|
|
9
|
+
});
|
|
10
|
+
SystemViewMode.displayName = 'SystemViewMode';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type ApiRouteMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS' | 'HEAD';
|
|
2
|
+
export type QueryParam = {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
};
|
|
6
|
+
export type ApiEndpoint = {
|
|
7
|
+
id: string;
|
|
8
|
+
method: ApiRouteMethod;
|
|
9
|
+
path: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
queryParams?: QueryParam[];
|
|
12
|
+
responseSchema?: Record<string, any>;
|
|
13
|
+
bodySchema?: Record<string, Record<string, any>>;
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { JSONSchema7 } from 'json-schema';
|
|
2
|
+
export type EventNodeData = {
|
|
3
|
+
type: string;
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
subscribes: string[];
|
|
7
|
+
emits: Array<string | {
|
|
8
|
+
topic: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
}>;
|
|
11
|
+
virtualEmits?: Array<string | {
|
|
12
|
+
topic: string;
|
|
13
|
+
label?: string;
|
|
14
|
+
}>;
|
|
15
|
+
virtualSubscribes?: string[];
|
|
16
|
+
language?: string;
|
|
17
|
+
};
|
|
18
|
+
export type NoopNodeData = {
|
|
19
|
+
type: string;
|
|
20
|
+
name: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
virtualEmits: string[];
|
|
23
|
+
subscribes: string[];
|
|
24
|
+
};
|
|
25
|
+
export type ApiNodeData = {
|
|
26
|
+
type: string;
|
|
27
|
+
name: string;
|
|
28
|
+
language?: string;
|
|
29
|
+
description?: string;
|
|
30
|
+
emits: Array<string | {
|
|
31
|
+
topic: string;
|
|
32
|
+
label?: string;
|
|
33
|
+
}>;
|
|
34
|
+
subscribes?: string[];
|
|
35
|
+
virtualEmits?: Array<string | {
|
|
36
|
+
topic: string;
|
|
37
|
+
label?: string;
|
|
38
|
+
}>;
|
|
39
|
+
virtualSubscribes?: string[];
|
|
40
|
+
webhookUrl?: string;
|
|
41
|
+
bodySchema?: JSONSchema7;
|
|
42
|
+
};
|
|
43
|
+
export type CronNodeData = {
|
|
44
|
+
type: string;
|
|
45
|
+
name: string;
|
|
46
|
+
description?: string;
|
|
47
|
+
emits: Array<string | {
|
|
48
|
+
topic: string;
|
|
49
|
+
label?: string;
|
|
50
|
+
}>;
|
|
51
|
+
virtualEmits?: Array<string | {
|
|
52
|
+
topic: string;
|
|
53
|
+
label?: string;
|
|
54
|
+
}>;
|
|
55
|
+
virtualSubscribes?: string[];
|
|
56
|
+
cronExpression: string;
|
|
57
|
+
language?: string;
|
|
58
|
+
};
|
|
59
|
+
export type NodeData = (EventNodeData | ApiNodeData | NoopNodeData | CronNodeData) & {
|
|
60
|
+
position?: {
|
|
61
|
+
x: number;
|
|
62
|
+
y: number;
|
|
63
|
+
};
|
|
64
|
+
filePath?: string;
|
|
65
|
+
nodeConfig?: {
|
|
66
|
+
sourceHandlePosition?: 'bottom' | 'right';
|
|
67
|
+
targetHandlePosition?: 'top' | 'left';
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
export type EdgeData = {
|
|
71
|
+
variant: 'event' | 'virtual';
|
|
72
|
+
label?: string;
|
|
73
|
+
labelVariant?: 'default' | 'conditional';
|
|
74
|
+
};
|
|
75
|
+
export type Emit = string | {
|
|
76
|
+
topic: string;
|
|
77
|
+
label?: string;
|
|
78
|
+
};
|
|
79
|
+
export type FlowStep = {
|
|
80
|
+
id: string;
|
|
81
|
+
name: string;
|
|
82
|
+
type: 'event' | 'api' | 'noop' | 'cron';
|
|
83
|
+
description?: string;
|
|
84
|
+
subscribes?: string[];
|
|
85
|
+
emits: Emit[];
|
|
86
|
+
virtualEmits?: Emit[];
|
|
87
|
+
action?: 'webhook';
|
|
88
|
+
webhookUrl?: string;
|
|
89
|
+
language?: string;
|
|
90
|
+
nodeComponentPath?: string;
|
|
91
|
+
filePath?: string;
|
|
92
|
+
};
|
|
93
|
+
export type FlowResponse = {
|
|
94
|
+
id: string;
|
|
95
|
+
name: string;
|
|
96
|
+
steps: FlowStep[];
|
|
97
|
+
edges: FlowEdge[];
|
|
98
|
+
error?: string;
|
|
99
|
+
};
|
|
100
|
+
export type FlowConfigResponse = {
|
|
101
|
+
id: string;
|
|
102
|
+
config: Record<string, NodeConfig>;
|
|
103
|
+
};
|
|
104
|
+
export type FlowEdge = {
|
|
105
|
+
id: string;
|
|
106
|
+
source: string;
|
|
107
|
+
target: string;
|
|
108
|
+
data: EdgeData;
|
|
109
|
+
};
|
|
110
|
+
export type NodeConfig = {
|
|
111
|
+
x: number;
|
|
112
|
+
y: number;
|
|
113
|
+
sourceHandlePosition?: 'bottom' | 'right';
|
|
114
|
+
targetHandlePosition?: 'top' | 'left';
|
|
115
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|