@motiadev/workbench 0.13.2-beta.164-562802 → 0.13.2-beta.164-732151
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 +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 -694
- 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 -53
- 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
- package/jest.config.cjs +0 -68
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { ApiNodeData, CronNodeData, EventNodeData, NoopNodeData } from '../types/flow'
|
|
2
|
-
|
|
3
|
-
export type NodeProps = EventNodeProps | NoopNodeProps | ApiNodeProps | CronNodeProps
|
|
4
|
-
export type BaseNodeProps = {
|
|
5
|
-
id: string
|
|
6
|
-
nodeConfig?: {
|
|
7
|
-
sourceHandlePosition?: 'bottom' | 'right'
|
|
8
|
-
targetHandlePosition?: 'top' | 'left'
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export type EventNodeProps = { data: BaseNodeProps & EventNodeData }
|
|
13
|
-
export type NoopNodeProps = { data: BaseNodeProps & NoopNodeData }
|
|
14
|
-
export type ApiNodeProps = { data: BaseNodeProps & ApiNodeData }
|
|
15
|
-
export type CronNodeProps = { data: BaseNodeProps & CronNodeData }
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type React from 'react'
|
|
2
|
-
import type { PropsWithChildren } from 'react'
|
|
3
|
-
import { BaseNode } from './base-node/base-node'
|
|
4
|
-
import type { NoopNodeProps } from './node-props'
|
|
5
|
-
|
|
6
|
-
export const NoopNode: React.FC<PropsWithChildren<NoopNodeProps>> = ({ data, children }) => {
|
|
7
|
-
return (
|
|
8
|
-
<BaseNode
|
|
9
|
-
data={data}
|
|
10
|
-
variant="noop"
|
|
11
|
-
title={data.name}
|
|
12
|
-
subtitle={data.description}
|
|
13
|
-
disableSourceHandle={!data.virtualEmits.length}
|
|
14
|
-
disableTargetHandle={!data.subscribes?.length}
|
|
15
|
-
>
|
|
16
|
-
{children}
|
|
17
|
-
</BaseNode>
|
|
18
|
-
)
|
|
19
|
-
}
|
package/dist/src/setupTests.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@testing-library/jest-dom'
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { create } from 'zustand'
|
|
2
|
-
|
|
3
|
-
export enum TabLocation {
|
|
4
|
-
TOP = 'top',
|
|
5
|
-
BOTTOM = 'bottom',
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export type AppTab = {
|
|
9
|
-
id: string
|
|
10
|
-
tabLabel: React.ElementType
|
|
11
|
-
content: React.ElementType
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface AppTabsState {
|
|
15
|
-
tabs: Record<TabLocation, AppTab[]>
|
|
16
|
-
addTab: (position: TabLocation, tab: AppTab) => void
|
|
17
|
-
setTabs: (position: TabLocation, tabs: AppTab[]) => void
|
|
18
|
-
removeTab: (position: TabLocation, id: string) => void
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const defaultTabs: Record<TabLocation, AppTab[]> = {
|
|
22
|
-
[TabLocation.TOP]: [],
|
|
23
|
-
[TabLocation.BOTTOM]: [],
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export const useAppTabsStore = create<AppTabsState>((set) => ({
|
|
27
|
-
tabs: defaultTabs,
|
|
28
|
-
addTab: (position: TabLocation, tab: AppTab) =>
|
|
29
|
-
set((state) => ({
|
|
30
|
-
tabs: {
|
|
31
|
-
...state.tabs,
|
|
32
|
-
[position]: [...state.tabs[position], tab],
|
|
33
|
-
},
|
|
34
|
-
})),
|
|
35
|
-
setTabs: (position: TabLocation, tabs: AppTab[]) =>
|
|
36
|
-
set((state) => ({
|
|
37
|
-
tabs: {
|
|
38
|
-
...state.tabs,
|
|
39
|
-
[position]: tabs,
|
|
40
|
-
},
|
|
41
|
-
})),
|
|
42
|
-
removeTab: (position: TabLocation, id: string) =>
|
|
43
|
-
set((state) => ({
|
|
44
|
-
tabs: {
|
|
45
|
-
...state.tabs,
|
|
46
|
-
[position]: state.tabs[position].filter((tab) => tab.id !== id),
|
|
47
|
-
},
|
|
48
|
-
})),
|
|
49
|
-
}))
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { create } from 'zustand'
|
|
2
|
-
import { createJSONStorage, persist } from 'zustand/middleware'
|
|
3
|
-
|
|
4
|
-
type UseFlowStore = {
|
|
5
|
-
selectedFlowId?: string
|
|
6
|
-
selectFlowId: (flowId: string) => void
|
|
7
|
-
clearSelectedFlowId: () => void
|
|
8
|
-
flows: string[]
|
|
9
|
-
setFlows: (flows: string[]) => void
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const useFlowStore = create(
|
|
13
|
-
persist<UseFlowStore>(
|
|
14
|
-
(set) => ({
|
|
15
|
-
flows: [],
|
|
16
|
-
setFlows: (flows) => set({ flows }),
|
|
17
|
-
selectFlowId: (flowId) =>
|
|
18
|
-
set((state) => {
|
|
19
|
-
if (state.selectedFlowId === flowId) {
|
|
20
|
-
return state
|
|
21
|
-
}
|
|
22
|
-
return { selectedFlowId: flowId }
|
|
23
|
-
}),
|
|
24
|
-
clearSelectedFlowId: () => set({ selectedFlowId: undefined }),
|
|
25
|
-
}),
|
|
26
|
-
{
|
|
27
|
-
name: 'motia-flow-storage',
|
|
28
|
-
storage: createJSONStorage(() => localStorage),
|
|
29
|
-
},
|
|
30
|
-
),
|
|
31
|
-
)
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { create } from 'zustand'
|
|
2
|
-
import { createJSONStorage, persist } from 'zustand/middleware'
|
|
3
|
-
|
|
4
|
-
type UseGlobalStore = {
|
|
5
|
-
selectedEndpointId?: string
|
|
6
|
-
selectEndpointId: (endpointId?: string) => void
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const select = (id: string | undefined, name: keyof UseGlobalStore) => (state: UseGlobalStore) => {
|
|
10
|
-
return id ? (state[name] === id ? state : { ...state, [name]: id }) : { ...state, [name]: undefined }
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const useGlobalStore = create(
|
|
14
|
-
persist<UseGlobalStore>(
|
|
15
|
-
(set) => ({
|
|
16
|
-
selectedEndpointId: undefined,
|
|
17
|
-
selectEndpointId: (endpointId) => set(select(endpointId, 'selectedEndpointId')),
|
|
18
|
-
}),
|
|
19
|
-
{
|
|
20
|
-
name: 'motia-global-storage',
|
|
21
|
-
storage: createJSONStorage(() => localStorage),
|
|
22
|
-
},
|
|
23
|
-
),
|
|
24
|
-
)
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { create } from 'zustand'
|
|
2
|
-
|
|
3
|
-
interface MotiaConfig {
|
|
4
|
-
isDev: boolean
|
|
5
|
-
isTutorialDisabled: boolean
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
interface MotiaConfigState {
|
|
9
|
-
config: MotiaConfig | null
|
|
10
|
-
isLoading: boolean
|
|
11
|
-
error: Error | null
|
|
12
|
-
fetchConfig: () => Promise<void>
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const useMotiaConfigStore = create<MotiaConfigState>((set, get) => ({
|
|
16
|
-
config: null,
|
|
17
|
-
isLoading: false,
|
|
18
|
-
error: null,
|
|
19
|
-
fetchConfig: async () => {
|
|
20
|
-
const { config, isLoading } = get()
|
|
21
|
-
if (isLoading || config) return
|
|
22
|
-
|
|
23
|
-
set({ isLoading: true, error: null })
|
|
24
|
-
try {
|
|
25
|
-
const response = await fetch('/__motia')
|
|
26
|
-
if (!response.ok) {
|
|
27
|
-
throw new Error(`Failed to fetch Motia config: ${response.statusText}`)
|
|
28
|
-
}
|
|
29
|
-
const data = await response.json()
|
|
30
|
-
set({ config: data, isLoading: false })
|
|
31
|
-
} catch (error) {
|
|
32
|
-
console.error('Failed to fetch Motia config:', error)
|
|
33
|
-
set({ error: error as Error, isLoading: false })
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
}))
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { create } from 'zustand'
|
|
2
|
-
import { createJSONStorage, persist } from 'zustand/middleware'
|
|
3
|
-
import { motiaAnalytics } from '../lib/motia-analytics'
|
|
4
|
-
|
|
5
|
-
interface TabsState {
|
|
6
|
-
tab: Record<string, string>
|
|
7
|
-
setTopTab: (tab: string) => void
|
|
8
|
-
setBottomTab: (tab: string) => void
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const useTabsStore = create(
|
|
12
|
-
persist<TabsState>(
|
|
13
|
-
(set, get) => ({
|
|
14
|
-
tab: {
|
|
15
|
-
top: 'flow',
|
|
16
|
-
bottom: 'tracing',
|
|
17
|
-
},
|
|
18
|
-
setTopTab: (tab) => {
|
|
19
|
-
const currentTab = get().tab
|
|
20
|
-
motiaAnalytics.track('Top panel tab changed', { 'new.top': tab, tab: currentTab })
|
|
21
|
-
set((state) => ({ tab: { ...state.tab, top: tab } }))
|
|
22
|
-
},
|
|
23
|
-
setBottomTab: (tab) => {
|
|
24
|
-
const currentTab = get().tab
|
|
25
|
-
motiaAnalytics.track('Bottom panel tab changed', { 'new.bottom': tab, tab: currentTab })
|
|
26
|
-
set((state) => ({ tab: { ...state.tab, bottom: tab } }))
|
|
27
|
-
},
|
|
28
|
-
}),
|
|
29
|
-
{
|
|
30
|
-
name: 'motia-tabs-storage',
|
|
31
|
-
storage: createJSONStorage(() => localStorage),
|
|
32
|
-
},
|
|
33
|
-
),
|
|
34
|
-
)
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { APP_SIDEBAR_CONTAINER_ID, CollapsiblePanelGroup } from '@motiadev/ui'
|
|
2
|
-
import { memo } from 'react'
|
|
3
|
-
import { BottomPanel } from './components/bottom-panel'
|
|
4
|
-
import { Header } from './components/header/header'
|
|
5
|
-
import { TopPanel } from './components/top-panel'
|
|
6
|
-
|
|
7
|
-
export const SystemViewMode = memo(() => {
|
|
8
|
-
return (
|
|
9
|
-
<div className="grid grid-rows-[auto_1fr] grid-cols-[1fr_auto] bg-background text-foreground h-screen">
|
|
10
|
-
<div className="col-span-2">
|
|
11
|
-
<Header />
|
|
12
|
-
</div>
|
|
13
|
-
<main className="m-2 overflow-hidden">
|
|
14
|
-
<CollapsiblePanelGroup
|
|
15
|
-
autoSaveId="app-panel"
|
|
16
|
-
direction="vertical"
|
|
17
|
-
className="gap-1 h-full"
|
|
18
|
-
aria-label="Workbench panels"
|
|
19
|
-
>
|
|
20
|
-
<TopPanel />
|
|
21
|
-
<BottomPanel />
|
|
22
|
-
</CollapsiblePanelGroup>
|
|
23
|
-
</main>
|
|
24
|
-
<div id={APP_SIDEBAR_CONTAINER_ID} />
|
|
25
|
-
</div>
|
|
26
|
-
)
|
|
27
|
-
})
|
|
28
|
-
SystemViewMode.displayName = 'SystemViewMode'
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export type ApiRouteMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS' | 'HEAD'
|
|
2
|
-
export type QueryParam = { name: string; description: string }
|
|
3
|
-
|
|
4
|
-
export type ApiEndpoint = {
|
|
5
|
-
id: string
|
|
6
|
-
method: ApiRouteMethod
|
|
7
|
-
path: string
|
|
8
|
-
description?: string
|
|
9
|
-
queryParams?: QueryParam[]
|
|
10
|
-
responseSchema?: Record<string, any> // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
11
|
-
bodySchema?: Record<string, Record<string, any>> // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
12
|
-
}
|
package/dist/src/types/file.ts
DELETED
package/dist/src/types/flow.ts
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import type { JSONSchema7 } from 'json-schema'
|
|
2
|
-
|
|
3
|
-
export type EventNodeData = {
|
|
4
|
-
type: string
|
|
5
|
-
name: string
|
|
6
|
-
description?: string
|
|
7
|
-
subscribes: string[]
|
|
8
|
-
emits: Array<string | { topic: string; label?: string }>
|
|
9
|
-
virtualEmits?: Array<string | { topic: string; label?: string }>
|
|
10
|
-
virtualSubscribes?: string[]
|
|
11
|
-
language?: string
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export type NoopNodeData = {
|
|
15
|
-
type: string
|
|
16
|
-
name: string
|
|
17
|
-
description?: string
|
|
18
|
-
virtualEmits: string[]
|
|
19
|
-
subscribes: string[]
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export type ApiNodeData = {
|
|
23
|
-
type: string
|
|
24
|
-
name: string
|
|
25
|
-
language?: string
|
|
26
|
-
description?: string
|
|
27
|
-
emits: Array<string | { topic: string; label?: string }>
|
|
28
|
-
subscribes?: string[]
|
|
29
|
-
virtualEmits?: Array<string | { topic: string; label?: string }>
|
|
30
|
-
virtualSubscribes?: string[]
|
|
31
|
-
webhookUrl?: string
|
|
32
|
-
bodySchema?: JSONSchema7
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export type CronNodeData = {
|
|
36
|
-
type: string
|
|
37
|
-
name: string
|
|
38
|
-
description?: string
|
|
39
|
-
emits: Array<string | { topic: string; label?: string }>
|
|
40
|
-
virtualEmits?: Array<string | { topic: string; label?: string }>
|
|
41
|
-
virtualSubscribes?: string[]
|
|
42
|
-
cronExpression: string
|
|
43
|
-
language?: string
|
|
44
|
-
}
|
|
45
|
-
export type NodeData = (EventNodeData | ApiNodeData | NoopNodeData | CronNodeData) & {
|
|
46
|
-
position?: { x: number; y: number }
|
|
47
|
-
filePath?: string
|
|
48
|
-
nodeConfig?: {
|
|
49
|
-
sourceHandlePosition?: 'bottom' | 'right'
|
|
50
|
-
targetHandlePosition?: 'top' | 'left'
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// ducplicate of packages/core/src/flows-endpoint.ts
|
|
55
|
-
export type EdgeData = {
|
|
56
|
-
variant: 'event' | 'virtual'
|
|
57
|
-
label?: string
|
|
58
|
-
labelVariant?: 'default' | 'conditional'
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export type Emit = string | { topic: string; label?: string }
|
|
62
|
-
|
|
63
|
-
export type FlowStep = {
|
|
64
|
-
id: string
|
|
65
|
-
name: string
|
|
66
|
-
type: 'event' | 'api' | 'noop' | 'cron'
|
|
67
|
-
description?: string
|
|
68
|
-
subscribes?: string[]
|
|
69
|
-
emits: Emit[]
|
|
70
|
-
virtualEmits?: Emit[]
|
|
71
|
-
action?: 'webhook'
|
|
72
|
-
webhookUrl?: string
|
|
73
|
-
language?: string
|
|
74
|
-
nodeComponentPath?: string
|
|
75
|
-
filePath?: string
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export type FlowResponse = {
|
|
79
|
-
id: string
|
|
80
|
-
name: string
|
|
81
|
-
steps: FlowStep[]
|
|
82
|
-
edges: FlowEdge[]
|
|
83
|
-
error?: string
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export type FlowConfigResponse = {
|
|
87
|
-
id: string
|
|
88
|
-
config: Record<string, NodeConfig>
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export type FlowEdge = {
|
|
92
|
-
id: string
|
|
93
|
-
source: string
|
|
94
|
-
target: string
|
|
95
|
-
data: EdgeData
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export type NodeConfig = {
|
|
99
|
-
x: number
|
|
100
|
-
y: number
|
|
101
|
-
sourceHandlePosition?: 'bottom' | 'right'
|
|
102
|
-
targetHandlePosition?: 'top' | 'left'
|
|
103
|
-
}
|
package/eslint.config.cjs
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
const config = require('../../eslint.config.js')
|
|
2
|
-
|
|
3
|
-
module.exports = [
|
|
4
|
-
// ignore src files
|
|
5
|
-
{ ignores: ['**/src/**/*'] },
|
|
6
|
-
...config.map((cfg) => {
|
|
7
|
-
if (!cfg.files) {
|
|
8
|
-
return cfg
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return {
|
|
12
|
-
...cfg,
|
|
13
|
-
languageOptions: {
|
|
14
|
-
...cfg.languageOptions,
|
|
15
|
-
parserOptions: {
|
|
16
|
-
project: null,
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
files: ['middleware.ts', 'tailwind.config.ts', 'vite.config.ts'],
|
|
20
|
-
}
|
|
21
|
-
}),
|
|
22
|
-
]
|
package/jest.config.cjs
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
preset: 'ts-jest',
|
|
3
|
-
testEnvironment: 'jsdom',
|
|
4
|
-
setupFilesAfterEnv: ['<rootDir>/src/setupTests.ts'],
|
|
5
|
-
moduleNameMapper: {
|
|
6
|
-
'^@/(.*)$': '<rootDir>/src/$1',
|
|
7
|
-
},
|
|
8
|
-
testMatch: [
|
|
9
|
-
'<rootDir>/src/**/__tests__/**/*.(ts|tsx|js)',
|
|
10
|
-
'<rootDir>/src/**/*.(test|spec).(ts|tsx|js)',
|
|
11
|
-
'<rootDir>/motia-plugin/**/__tests__/**/*.(ts|tsx|js)',
|
|
12
|
-
'<rootDir>/motia-plugin/**/*.(test|spec).(ts|tsx|js)',
|
|
13
|
-
'<rootDir>/__tests__/**/*.(ts|tsx|js)',
|
|
14
|
-
],
|
|
15
|
-
collectCoverageFrom: [
|
|
16
|
-
'src/**/*.(ts|tsx)',
|
|
17
|
-
'!src/**/*.d.ts',
|
|
18
|
-
'!src/index.tsx',
|
|
19
|
-
'motia-plugin/**/*.(ts|tsx)',
|
|
20
|
-
'!motia-plugin/**/*.d.ts',
|
|
21
|
-
],
|
|
22
|
-
transform: {
|
|
23
|
-
'^.+\\.(ts|tsx)$': [
|
|
24
|
-
'ts-jest',
|
|
25
|
-
{
|
|
26
|
-
tsconfig: {
|
|
27
|
-
jsx: 'react-jsx',
|
|
28
|
-
esModuleInterop: true,
|
|
29
|
-
allowSyntheticDefaultImports: true,
|
|
30
|
-
types: ['jest', '@testing-library/jest-dom', 'node'],
|
|
31
|
-
module: 'commonjs',
|
|
32
|
-
target: 'es2020',
|
|
33
|
-
lib: ['es2020', 'dom', 'dom.iterable'],
|
|
34
|
-
moduleResolution: 'node',
|
|
35
|
-
strict: true,
|
|
36
|
-
skipLibCheck: true,
|
|
37
|
-
isolatedModules: true,
|
|
38
|
-
},
|
|
39
|
-
isolatedModules: true,
|
|
40
|
-
useESM: false,
|
|
41
|
-
},
|
|
42
|
-
],
|
|
43
|
-
'^.+\\.(js|jsx)$': [
|
|
44
|
-
'ts-jest',
|
|
45
|
-
{
|
|
46
|
-
tsconfig: {
|
|
47
|
-
allowJs: true,
|
|
48
|
-
jsx: 'react-jsx',
|
|
49
|
-
esModuleInterop: true,
|
|
50
|
-
allowSyntheticDefaultImports: true,
|
|
51
|
-
module: 'commonjs',
|
|
52
|
-
target: 'es2020',
|
|
53
|
-
},
|
|
54
|
-
isolatedModules: true,
|
|
55
|
-
useESM: false,
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
},
|
|
59
|
-
transformIgnorePatterns: ['node_modules/(?!(@motiadev/stream-client-react|@motiadev/stream-client-browser)/)'],
|
|
60
|
-
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
|
|
61
|
-
testEnvironmentOptions: {
|
|
62
|
-
url: 'http://localhost',
|
|
63
|
-
},
|
|
64
|
-
clearMocks: true,
|
|
65
|
-
resetMocks: true,
|
|
66
|
-
restoreMocks: true,
|
|
67
|
-
}
|
|
68
|
-
|