@invect/ui 0.0.1
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 +21 -0
- package/README.md +77 -0
- package/dist/Invect-CWpIwZ5F.js +92738 -0
- package/dist/Invect.d.ts +25 -0
- package/dist/InvectShell.d.ts +14 -0
- package/dist/api/agent-tools.api.d.ts +1 -0
- package/dist/api/client.d.ts +207 -0
- package/dist/api/credentials.api.d.ts +47 -0
- package/dist/api/executions.api.d.ts +43 -0
- package/dist/api/flows.api.d.ts +100 -0
- package/dist/api/index.d.ts +9 -0
- package/dist/api/node-data.api.d.ts +66 -0
- package/dist/api/query-keys.d.ts +22 -0
- package/dist/api/triggers.api.d.ts +44 -0
- package/dist/api/types.d.ts +147 -0
- package/dist/api/use-flow-run-stream.d.ts +12 -0
- package/dist/assets/invect-branding.d.ts +4 -0
- package/dist/assets/provider-icons/index.d.ts +8 -0
- package/dist/babel-C9OtljFZ.js +9721 -0
- package/dist/components/PageLayout.d.ts +17 -0
- package/dist/components/chat/ChatInput.d.ts +17 -0
- package/dist/components/chat/ChatMessageList.d.ts +14 -0
- package/dist/components/chat/ChatModelSelector.d.ts +11 -0
- package/dist/components/chat/ChatPanel.d.ts +19 -0
- package/dist/components/chat/ChatPromptOverlay.d.ts +13 -0
- package/dist/components/chat/ChatProviderSelector.d.ts +9 -0
- package/dist/components/chat/ChatSettingsPanel.d.ts +11 -0
- package/dist/components/chat/InlineCredentialSetup.d.ts +9 -0
- package/dist/components/chat/MarkdownRenderer.d.ts +7 -0
- package/dist/components/chat/chat-memory.d.ts +21 -0
- package/dist/components/chat/chat.store.d.ts +416 -0
- package/dist/components/chat/index.d.ts +5 -0
- package/dist/components/chat/use-chat.d.ts +28 -0
- package/dist/components/credentials/CreateCredentialModal.d.ts +13 -0
- package/dist/components/credentials/CredentialDetailDialog.d.ts +17 -0
- package/dist/components/credentials/EditCredentialModal.d.ts +11 -0
- package/dist/components/credentials/OAuth2ConnectButton.d.ts +38 -0
- package/dist/components/credentials/OAuth2ProviderSelector.d.ts +15 -0
- package/dist/components/credentials/credential-utils.d.ts +12 -0
- package/dist/components/credentials/index.d.ts +9 -0
- package/dist/components/dashboard/FailedRunsAlert.d.ts +3 -0
- package/dist/components/dashboard/FlowCard.d.ts +7 -0
- package/dist/components/dashboard/RecentActivityTable.d.ts +9 -0
- package/dist/components/dashboard/StatCard.d.ts +10 -0
- package/dist/components/dashboard/index.d.ts +5 -0
- package/dist/components/dashboard/status-helpers.d.ts +5 -0
- package/dist/components/flow-editor/ActionsSidebar.d.ts +2 -0
- package/dist/components/flow-editor/FlowEditor.d.ts +21 -0
- package/dist/components/flow-editor/FlowHeader.d.ts +9 -0
- package/dist/components/flow-editor/FlowLayout.d.ts +24 -0
- package/dist/components/flow-editor/ModeSwitcher.d.ts +7 -0
- package/dist/components/flow-editor/NodeSidebar.d.ts +24 -0
- package/dist/components/flow-editor/RunControls.d.ts +12 -0
- package/dist/components/flow-editor/ToolConfigPanel.d.ts +16 -0
- package/dist/components/flow-editor/ValidationPanel.d.ts +5 -0
- package/dist/components/flow-editor/flow-editor.store.d.ts +1 -0
- package/dist/components/flow-editor/index.d.ts +6 -0
- package/dist/components/flow-editor/inline-edit.d.ts +10 -0
- package/dist/components/flow-editor/node-config-panel/ConfigFieldWithTemplate.d.ts +26 -0
- package/dist/components/flow-editor/node-config-panel/CredentialCombobox.d.ts +21 -0
- package/dist/components/flow-editor/node-config-panel/CredentialsSection.d.ts +19 -0
- package/dist/components/flow-editor/node-config-panel/DroppableInput.d.ts +20 -0
- package/dist/components/flow-editor/node-config-panel/DynamicSelectField.d.ts +22 -0
- package/dist/components/flow-editor/node-config-panel/JsonPreviewPanel.d.ts +25 -0
- package/dist/components/flow-editor/node-config-panel/NodeConfigPanel.d.ts +14 -0
- package/dist/components/flow-editor/node-config-panel/NodeConfigPanelHeader.d.ts +15 -0
- package/dist/components/flow-editor/node-config-panel/ParametersSection.d.ts +16 -0
- package/dist/components/flow-editor/node-config-panel/SearchableSelectField.d.ts +17 -0
- package/dist/components/flow-editor/node-config-panel/SwitchCasesField.d.ts +18 -0
- package/dist/components/flow-editor/node-config-panel/hooks/index.d.ts +2 -0
- package/dist/components/flow-editor/node-config-panel/hooks/use-node-config-panel-state.d.ts +24 -0
- package/dist/components/flow-editor/node-config-panel/hooks/use-node-execution.d.ts +46 -0
- package/dist/components/flow-editor/node-config-panel/hooks/use-upstream-slots.d.ts +16 -0
- package/dist/components/flow-editor/node-config-panel/panels/AgentToolsPanel.d.ts +18 -0
- package/dist/components/flow-editor/node-config-panel/panels/ConfigurationPanel.d.ts +49 -0
- package/dist/components/flow-editor/node-config-panel/panels/DataMapperPane.d.ts +40 -0
- package/dist/components/flow-editor/node-config-panel/panels/InputPanel.d.ts +49 -0
- package/dist/components/flow-editor/node-config-panel/panels/OutputPanel.d.ts +7 -0
- package/dist/components/flow-editor/node-config-panel/panels/index.d.ts +4 -0
- package/dist/components/flow-editor/node-config-panel/types.d.ts +19 -0
- package/dist/components/flow-editor/node-config-panel/use-node-config-panel-store.d.ts +49 -0
- package/dist/components/flow-editor/node-config-panel/use-node-config-state.d.ts +26 -0
- package/dist/components/flow-editor/node-config-panel/use-run-node.d.ts +16 -0
- package/dist/components/flow-editor/node-config-panel/utils.d.ts +9 -0
- package/dist/components/flow-editor/serialize-to-sdk.d.ts +20 -0
- package/dist/components/flow-editor/toolbar-context.d.ts +2 -0
- package/dist/components/flow-editor/use-copy-paste.d.ts +7 -0
- package/dist/components/flow-editor/use-copy-paste.types.d.ts +38 -0
- package/dist/components/flow-editor/use-flow-editor.d.ts +44 -0
- package/dist/components/flow-runs-table/FlowRunsTable.d.ts +6 -0
- package/dist/components/flow-runs-table/index.d.ts +1 -0
- package/dist/components/flow-viewer/FlowRunsView.d.ts +7 -0
- package/dist/components/flow-viewer/FlowStatusView.d.ts +21 -0
- package/dist/components/flow-viewer/RunSelector.d.ts +13 -0
- package/dist/components/flow-viewer/RunsSidebar.d.ts +14 -0
- package/dist/components/flow-viewer/agent-tool-executions-list.d.ts +7 -0
- package/dist/components/flow-viewer/index.d.ts +1 -0
- package/dist/components/flow-viewer/logs-panel.d.ts +18 -0
- package/dist/components/flow-viewer/use-execution-log-data.d.ts +113 -0
- package/dist/components/graph/BatchFlowEdge.d.ts +33 -0
- package/dist/components/graph/LayoutSelector.d.ts +9 -0
- package/dist/components/graph/index.d.ts +47 -0
- package/dist/components/graph/styleUtils.d.ts +124 -0
- package/dist/components/nodes/AgentConfigPanel.d.ts +24 -0
- package/dist/components/nodes/AgentNode.d.ts +8 -0
- package/dist/components/nodes/AgentToolsBox.d.ts +41 -0
- package/dist/components/nodes/NodeAppendix.d.ts +19 -0
- package/dist/components/nodes/NodeStatusIndicator.d.ts +30 -0
- package/dist/components/nodes/NodeViewContext.d.ts +18 -0
- package/dist/components/nodes/ToolParamField.d.ts +28 -0
- package/dist/components/nodes/ToolSelectorModal.d.ts +80 -0
- package/dist/components/nodes/ToolSelectorParts.d.ts +30 -0
- package/dist/components/nodes/UniversalNode.d.ts +2 -0
- package/dist/components/nodes/createContextAwareNodes.d.ts +6 -0
- package/dist/components/nodes/index.d.ts +22 -0
- package/dist/components/nodes/nodeRegistry.d.ts +13 -0
- package/dist/components/nodes/withNodeContext.d.ts +7 -0
- package/dist/components/shared/InvectLoader.d.ts +8 -0
- package/dist/components/shared/InvectLogo.d.ts +9 -0
- package/dist/components/shared/ProviderIcon.d.ts +23 -0
- package/dist/components/side-menu/side-menu.d.ts +4 -0
- package/dist/components/sidebar/BaseSidebar.d.ts +17 -0
- package/dist/components/sidebar/index.d.ts +1 -0
- package/dist/components/triggers/CronPreview.d.ts +12 -0
- package/dist/components/triggers/index.d.ts +1 -0
- package/dist/components/ui/alert-dialog.d.ts +18 -0
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/button.d.ts +13 -0
- package/dist/components/ui/card.d.ts +9 -0
- package/dist/components/ui/codemirror-js-editor.d.ts +25 -0
- package/dist/components/ui/codemirror-json-editor.d.ts +18 -0
- package/dist/components/ui/codemirror-nunjucks-editor.d.ts +13 -0
- package/dist/components/ui/codemirror-vscode-theme.d.ts +24 -0
- package/dist/components/ui/collapsible.d.ts +6 -0
- package/dist/components/ui/command.d.ts +18 -0
- package/dist/components/ui/dialog.d.ts +18 -0
- package/dist/components/ui/dropdown-menu.d.ts +25 -0
- package/dist/components/ui/empty-state.d.ts +21 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/label.d.ts +4 -0
- package/dist/components/ui/popover.d.ts +10 -0
- package/dist/components/ui/resizable.d.ts +8 -0
- package/dist/components/ui/scroll-area.d.ts +5 -0
- package/dist/components/ui/select.d.ts +18 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/slider.d.ts +4 -0
- package/dist/components/ui/switch.d.ts +3 -0
- package/dist/components/ui/table.d.ts +10 -0
- package/dist/components/ui/textarea.d.ts +3 -0
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/components/ui/tree-view.d.ts +107 -0
- package/dist/contexts/AgentToolCallbacksContext.d.ts +23 -0
- package/dist/contexts/ApiContext.d.ts +11 -0
- package/dist/contexts/FlowDataContext.d.ts +9 -0
- package/dist/contexts/NodeRegistryContext.d.ts +14 -0
- package/dist/contexts/PluginRegistryContext.d.ts +39 -0
- package/dist/contexts/ThemeProvider.d.ts +18 -0
- package/dist/contexts/ValidationContext.d.ts +22 -0
- package/dist/demo/DemoInvect.d.ts +11 -0
- package/dist/demo/FlowViewer.d.ts +31 -0
- package/dist/demo/demo-api-client.d.ts +33 -0
- package/dist/demo/index.d.ts +6 -0
- package/dist/demo/sample-data.d.ts +1538 -0
- package/dist/demo.d.ts +2 -0
- package/dist/demo.js +2774 -0
- package/dist/estree-ClbRfS-1.js +7076 -0
- package/dist/fonts/geist-cyrillic-wght-normal.woff2 +0 -0
- package/dist/fonts/geist-latin-ext-wght-normal.woff2 +0 -0
- package/dist/fonts/geist-latin-wght-normal.woff2 +0 -0
- package/dist/fonts/iosevka-latin-400-normal.woff2 +0 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/use-document-title.d.ts +1 -0
- package/dist/hooks/use-flow-data.d.ts +22 -0
- package/dist/hooks/use-invect-portal-class.d.ts +21 -0
- package/dist/hooks/useFlowEditorStore.d.ts +1 -0
- package/dist/index.css +3 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +717 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/prettier.d.ts +13 -0
- package/dist/routes/all-flow-runs.d.ts +5 -0
- package/dist/routes/credentials.d.ts +5 -0
- package/dist/routes/flow-route-layout.d.ts +19 -0
- package/dist/routes/flow-runs.d.ts +5 -0
- package/dist/routes/flow.d.ts +5 -0
- package/dist/routes/home.d.ts +5 -0
- package/dist/services/index.d.ts +1 -0
- package/dist/standalone-C3Df7W52.js +3463 -0
- package/dist/stores/executionViewStore.d.ts +64 -0
- package/dist/stores/flow-editor.store.d.ts +137 -0
- package/dist/stores/flowEditorStore.d.ts +1 -0
- package/dist/stores/index.d.ts +2 -0
- package/dist/stores/uiStore.d.ts +45 -0
- package/dist/types/agent-tools.types.d.ts +53 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/node-definition.types.d.ts +85 -0
- package/dist/types/plugin.types.d.ts +100 -0
- package/dist/utils/credentialBranding.d.ts +8 -0
- package/dist/utils/credentialFiltering.d.ts +20 -0
- package/dist/utils/flowTransformations.d.ts +16 -0
- package/dist/utils/layoutUtils.d.ts +23 -0
- package/dist/utils/nodeReferenceUtils.d.ts +37 -0
- package/dist/vendor.d.ts +5 -0
- package/package.json +130 -0
- package/src/.DS_Store +0 -0
- package/src/Invect.tsx +229 -0
- package/src/InvectShell.tsx +55 -0
- package/src/api/agent-tools.api.ts +23 -0
- package/src/api/client.ts +899 -0
- package/src/api/credentials.api.ts +197 -0
- package/src/api/executions.api.ts +228 -0
- package/src/api/flows.api.ts +195 -0
- package/src/api/index.ts +17 -0
- package/src/api/node-data.api.ts +167 -0
- package/src/api/query-keys.ts +44 -0
- package/src/api/triggers.api.ts +120 -0
- package/src/api/types.ts +212 -0
- package/src/api/use-flow-run-stream.ts +206 -0
- package/src/app.css +560 -0
- package/src/assets/.DS_Store +0 -0
- package/src/assets/favicon.ico +0 -0
- package/src/assets/fonts/geist-cyrillic-wght-normal.woff2 +0 -0
- package/src/assets/fonts/geist-latin-ext-wght-normal.woff2 +0 -0
- package/src/assets/fonts/geist-latin-wght-normal.woff2 +0 -0
- package/src/assets/fonts/iosevka-latin-400-normal.woff2 +0 -0
- package/src/assets/invect-branding.ts +51 -0
- package/src/assets/provider-icons/anthropic.svg +1 -0
- package/src/assets/provider-icons/anthropic_light.svg +1 -0
- package/src/assets/provider-icons/github.svg +1 -0
- package/src/assets/provider-icons/github_light.svg +1 -0
- package/src/assets/provider-icons/gmail.svg +1 -0
- package/src/assets/provider-icons/google_calendar.svg +1 -0
- package/src/assets/provider-icons/google_docs.svg +1 -0
- package/src/assets/provider-icons/google_drive.svg +1 -0
- package/src/assets/provider-icons/google_sheets.svg +1 -0
- package/src/assets/provider-icons/index.ts +55 -0
- package/src/assets/provider-icons/linear.svg +1 -0
- package/src/assets/provider-icons/openai.svg +1 -0
- package/src/assets/provider-icons/postgres.svg +1 -0
- package/src/assets/provider-icons/slack.svg +1 -0
- package/src/assets/small-loader-dark.svg +22 -0
- package/src/assets/small-loader-light.svg +22 -0
- package/src/assets/small.svg +7 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/PageLayout.tsx +55 -0
- package/src/components/chat/ChatInput.tsx +115 -0
- package/src/components/chat/ChatMessageList.tsx +788 -0
- package/src/components/chat/ChatModelSelector.tsx +208 -0
- package/src/components/chat/ChatPanel.tsx +243 -0
- package/src/components/chat/ChatPromptOverlay.tsx +150 -0
- package/src/components/chat/ChatProviderSelector.tsx +135 -0
- package/src/components/chat/ChatSettingsPanel.tsx +277 -0
- package/src/components/chat/InlineCredentialSetup.tsx +343 -0
- package/src/components/chat/MarkdownRenderer.tsx +140 -0
- package/src/components/chat/chat-memory.ts +88 -0
- package/src/components/chat/chat.store.ts +479 -0
- package/src/components/chat/index.ts +5 -0
- package/src/components/chat/use-chat.ts +473 -0
- package/src/components/credentials/CreateCredentialModal.tsx +609 -0
- package/src/components/credentials/CredentialDetailDialog.tsx +882 -0
- package/src/components/credentials/EditCredentialModal.tsx +399 -0
- package/src/components/credentials/OAuth2ConnectButton.tsx +288 -0
- package/src/components/credentials/OAuth2ProviderSelector.tsx +360 -0
- package/src/components/credentials/credential-utils.ts +99 -0
- package/src/components/credentials/index.ts +10 -0
- package/src/components/dashboard/FailedRunsAlert.tsx +67 -0
- package/src/components/dashboard/FlowCard.tsx +64 -0
- package/src/components/dashboard/RecentActivityTable.tsx +92 -0
- package/src/components/dashboard/StatCard.tsx +32 -0
- package/src/components/dashboard/index.ts +5 -0
- package/src/components/dashboard/status-helpers.tsx +102 -0
- package/src/components/flow-editor/ActionsSidebar.tsx +503 -0
- package/src/components/flow-editor/FlowEditor.tsx +1002 -0
- package/src/components/flow-editor/FlowHeader.tsx +87 -0
- package/src/components/flow-editor/FlowLayout.tsx +117 -0
- package/src/components/flow-editor/ModeSwitcher.tsx +49 -0
- package/src/components/flow-editor/NodeSidebar.tsx +343 -0
- package/src/components/flow-editor/RunControls.tsx +109 -0
- package/src/components/flow-editor/ToolConfigPanel.tsx +434 -0
- package/src/components/flow-editor/ValidationPanel.tsx +167 -0
- package/src/components/flow-editor/flow-editor.store.ts +2 -0
- package/src/components/flow-editor/index.ts +6 -0
- package/src/components/flow-editor/inline-edit.tsx +111 -0
- package/src/components/flow-editor/node-config-panel/ConfigFieldWithTemplate.tsx +334 -0
- package/src/components/flow-editor/node-config-panel/CredentialCombobox.tsx +217 -0
- package/src/components/flow-editor/node-config-panel/CredentialsSection.tsx +154 -0
- package/src/components/flow-editor/node-config-panel/DroppableInput.tsx +45 -0
- package/src/components/flow-editor/node-config-panel/DynamicSelectField.tsx +223 -0
- package/src/components/flow-editor/node-config-panel/JsonPreviewPanel.tsx +134 -0
- package/src/components/flow-editor/node-config-panel/NodeConfigPanel.tsx +650 -0
- package/src/components/flow-editor/node-config-panel/NodeConfigPanelHeader.tsx +91 -0
- package/src/components/flow-editor/node-config-panel/ParametersSection.tsx +144 -0
- package/src/components/flow-editor/node-config-panel/SearchableSelectField.tsx +126 -0
- package/src/components/flow-editor/node-config-panel/SwitchCasesField.tsx +212 -0
- package/src/components/flow-editor/node-config-panel/hooks/index.ts +2 -0
- package/src/components/flow-editor/node-config-panel/hooks/use-node-config-panel-state.ts +284 -0
- package/src/components/flow-editor/node-config-panel/hooks/use-node-execution.ts +287 -0
- package/src/components/flow-editor/node-config-panel/hooks/use-upstream-slots.ts +310 -0
- package/src/components/flow-editor/node-config-panel/panels/AgentToolsPanel.tsx +837 -0
- package/src/components/flow-editor/node-config-panel/panels/ConfigurationPanel.tsx +383 -0
- package/src/components/flow-editor/node-config-panel/panels/DataMapperPane.tsx +456 -0
- package/src/components/flow-editor/node-config-panel/panels/InputPanel.tsx +338 -0
- package/src/components/flow-editor/node-config-panel/panels/OutputPanel.tsx +109 -0
- package/src/components/flow-editor/node-config-panel/panels/index.ts +4 -0
- package/src/components/flow-editor/node-config-panel/types.ts +20 -0
- package/src/components/flow-editor/node-config-panel/use-node-config-panel-store.ts +283 -0
- package/src/components/flow-editor/node-config-panel/use-node-config-state.ts +172 -0
- package/src/components/flow-editor/node-config-panel/use-run-node.ts +147 -0
- package/src/components/flow-editor/node-config-panel/utils.ts +73 -0
- package/src/components/flow-editor/serialize-to-sdk.ts +204 -0
- package/src/components/flow-editor/toolbar-context.ts +9 -0
- package/src/components/flow-editor/use-copy-paste.ts +575 -0
- package/src/components/flow-editor/use-copy-paste.types.ts +35 -0
- package/src/components/flow-editor/use-flow-editor.ts +241 -0
- package/src/components/flow-runs-table/FlowRunsTable.tsx +631 -0
- package/src/components/flow-runs-table/index.ts +1 -0
- package/src/components/flow-viewer/FlowRunsView.tsx +268 -0
- package/src/components/flow-viewer/FlowStatusView.tsx +351 -0
- package/src/components/flow-viewer/RunSelector.tsx +422 -0
- package/src/components/flow-viewer/RunsSidebar.tsx +125 -0
- package/src/components/flow-viewer/agent-tool-executions-list.tsx +298 -0
- package/src/components/flow-viewer/index.ts +1 -0
- package/src/components/flow-viewer/logs-panel.tsx +567 -0
- package/src/components/flow-viewer/use-execution-log-data.ts +374 -0
- package/src/components/graph/BatchFlowEdge.tsx +229 -0
- package/src/components/graph/LayoutSelector.tsx +42 -0
- package/src/components/graph/index.ts +61 -0
- package/src/components/graph/styleUtils.ts +375 -0
- package/src/components/nodes/.DS_Store +0 -0
- package/src/components/nodes/AgentConfigPanel.tsx +1033 -0
- package/src/components/nodes/AgentNode.tsx +298 -0
- package/src/components/nodes/AgentToolsBox.tsx +193 -0
- package/src/components/nodes/NodeAppendix.tsx +98 -0
- package/src/components/nodes/NodeStatusIndicator.tsx +74 -0
- package/src/components/nodes/NodeViewContext.tsx +45 -0
- package/src/components/nodes/ToolParamField.tsx +282 -0
- package/src/components/nodes/ToolSelectorModal.tsx +648 -0
- package/src/components/nodes/ToolSelectorParts.tsx +505 -0
- package/src/components/nodes/UniversalNode.tsx +356 -0
- package/src/components/nodes/createContextAwareNodes.ts +19 -0
- package/src/components/nodes/index.ts +45 -0
- package/src/components/nodes/nodeRegistry.ts +50 -0
- package/src/components/nodes/withNodeContext.tsx +55 -0
- package/src/components/shared/InvectLoader.tsx +59 -0
- package/src/components/shared/InvectLogo.tsx +59 -0
- package/src/components/shared/ProviderIcon.tsx +115 -0
- package/src/components/side-menu/side-menu.tsx +267 -0
- package/src/components/sidebar/BaseSidebar.tsx +148 -0
- package/src/components/sidebar/index.ts +1 -0
- package/src/components/triggers/CronPreview.tsx +243 -0
- package/src/components/triggers/index.ts +1 -0
- package/src/components/ui/alert-dialog.tsx +152 -0
- package/src/components/ui/badge.tsx +39 -0
- package/src/components/ui/button.tsx +58 -0
- package/src/components/ui/card.tsx +75 -0
- package/src/components/ui/codemirror-js-editor.tsx +432 -0
- package/src/components/ui/codemirror-json-editor.tsx +816 -0
- package/src/components/ui/codemirror-nunjucks-editor.tsx +451 -0
- package/src/components/ui/codemirror-vscode-theme.ts +243 -0
- package/src/components/ui/collapsible.tsx +12 -0
- package/src/components/ui/command.tsx +162 -0
- package/src/components/ui/dialog.tsx +140 -0
- package/src/components/ui/dropdown-menu.tsx +232 -0
- package/src/components/ui/empty-state.tsx +93 -0
- package/src/components/ui/input.tsx +26 -0
- package/src/components/ui/label.tsx +19 -0
- package/src/components/ui/popover.tsx +53 -0
- package/src/components/ui/resizable.tsx +61 -0
- package/src/components/ui/scroll-area.tsx +56 -0
- package/src/components/ui/select.tsx +179 -0
- package/src/components/ui/separator.tsx +26 -0
- package/src/components/ui/slider.tsx +58 -0
- package/src/components/ui/switch.tsx +22 -0
- package/src/components/ui/table.tsx +90 -0
- package/src/components/ui/textarea.tsx +23 -0
- package/src/components/ui/tooltip.tsx +54 -0
- package/src/components/ui/tree-view.tsx +574 -0
- package/src/contexts/AgentToolCallbacksContext.tsx +31 -0
- package/src/contexts/ApiContext.tsx +51 -0
- package/src/contexts/FlowDataContext.tsx +21 -0
- package/src/contexts/NodeRegistryContext.tsx +54 -0
- package/src/contexts/PluginRegistryContext.tsx +182 -0
- package/src/contexts/ThemeProvider.tsx +106 -0
- package/src/contexts/ValidationContext.tsx +122 -0
- package/src/demo/DemoInvect.tsx +42 -0
- package/src/demo/FlowViewer.tsx +294 -0
- package/src/demo/demo-api-client.ts +246 -0
- package/src/demo/index.ts +28 -0
- package/src/demo/sample-data.ts +1980 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use-document-title.ts +8 -0
- package/src/hooks/use-flow-data.ts +144 -0
- package/src/hooks/use-invect-portal-class.ts +27 -0
- package/src/hooks/useFlowEditorStore.ts +2 -0
- package/src/index.ts +70 -0
- package/src/lib/utils.ts +6 -0
- package/src/prettier.d.ts +13 -0
- package/src/routes/all-flow-runs.tsx +27 -0
- package/src/routes/credentials.tsx +362 -0
- package/src/routes/flow-route-layout.tsx +113 -0
- package/src/routes/flow-runs.tsx +22 -0
- package/src/routes/flow.tsx +22 -0
- package/src/routes/home.tsx +282 -0
- package/src/services/index.ts +6 -0
- package/src/stores/executionViewStore.ts +211 -0
- package/src/stores/flow-editor.store.ts +738 -0
- package/src/stores/flowEditorStore.ts +2 -0
- package/src/stores/index.ts +10 -0
- package/src/stores/uiStore.ts +189 -0
- package/src/types/agent-tools.types.ts +64 -0
- package/src/types/index.ts +5 -0
- package/src/types/node-definition.types.ts +104 -0
- package/src/types/plugin.types.ts +123 -0
- package/src/utils/credentialBranding.ts +116 -0
- package/src/utils/credentialFiltering.ts +68 -0
- package/src/utils/flowTransformations.ts +137 -0
- package/src/utils/layoutUtils.ts +127 -0
- package/src/utils/nodeReferenceUtils.ts +135 -0
- package/src/vendor.d.ts +7 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React, { createContext, useContext, useCallback, useMemo } from 'react';
|
|
2
|
+
import { useAvailableNodes } from '../api/node-data.api';
|
|
3
|
+
import { NodeDefinition } from '../types/node-definition.types';
|
|
4
|
+
|
|
5
|
+
interface NodeRegistryContextType {
|
|
6
|
+
nodeDefinitions: NodeDefinition[];
|
|
7
|
+
isLoading: boolean;
|
|
8
|
+
error: Error | null;
|
|
9
|
+
getNodeDefinition: (type: string) => NodeDefinition | undefined;
|
|
10
|
+
refreshDefinitions: () => Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const NodeRegistryContext = createContext<NodeRegistryContextType | undefined>(undefined);
|
|
14
|
+
|
|
15
|
+
export const NodeRegistryProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
|
|
16
|
+
const { data: nodeDefinitions = [], isLoading, error, refetch } = useAvailableNodes();
|
|
17
|
+
|
|
18
|
+
const getNodeDefinition = useCallback(
|
|
19
|
+
(type: string) => {
|
|
20
|
+
return nodeDefinitions.find((def) => def.type === type);
|
|
21
|
+
},
|
|
22
|
+
[nodeDefinitions],
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const refreshDefinitions = useCallback(async () => {
|
|
26
|
+
await refetch();
|
|
27
|
+
}, [refetch]);
|
|
28
|
+
|
|
29
|
+
const value = useMemo(
|
|
30
|
+
() => ({
|
|
31
|
+
nodeDefinitions,
|
|
32
|
+
isLoading,
|
|
33
|
+
error:
|
|
34
|
+
error instanceof Error
|
|
35
|
+
? error
|
|
36
|
+
: error
|
|
37
|
+
? new Error('Failed to fetch node definitions')
|
|
38
|
+
: null,
|
|
39
|
+
getNodeDefinition,
|
|
40
|
+
refreshDefinitions,
|
|
41
|
+
}),
|
|
42
|
+
[nodeDefinitions, isLoading, error, getNodeDefinition, refreshDefinitions],
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
return <NodeRegistryContext.Provider value={value}>{children}</NodeRegistryContext.Provider>;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const useNodeRegistry = () => {
|
|
49
|
+
const context = useContext(NodeRegistryContext);
|
|
50
|
+
if (context === undefined) {
|
|
51
|
+
throw new Error('useNodeRegistry must be used within a NodeRegistryProvider');
|
|
52
|
+
}
|
|
53
|
+
return context;
|
|
54
|
+
};
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PluginRegistryContext — Collects and resolves contributions from frontend plugins.
|
|
3
|
+
*
|
|
4
|
+
* Provides `usePluginRegistry()` to any component in the tree so they
|
|
5
|
+
* can read sidebar items, routes, panel tabs, header actions, and
|
|
6
|
+
* permission checks contributed by plugins.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import React, { createContext, useContext, useMemo, type ReactNode } from 'react';
|
|
10
|
+
import type {
|
|
11
|
+
InvectFrontendPlugin,
|
|
12
|
+
PluginSidebarContribution,
|
|
13
|
+
PluginRouteContribution,
|
|
14
|
+
PluginPanelTabContribution,
|
|
15
|
+
PluginHeaderActionContribution,
|
|
16
|
+
PermissionContext,
|
|
17
|
+
} from '../types/plugin.types';
|
|
18
|
+
|
|
19
|
+
// ─────────────────────────────────────────────────────────────
|
|
20
|
+
// Registry Interface
|
|
21
|
+
// ─────────────────────────────────────────────────────────────
|
|
22
|
+
|
|
23
|
+
export interface PluginRegistry {
|
|
24
|
+
/** All sidebar items from plugins, grouped by position */
|
|
25
|
+
sidebarItems: PluginSidebarContribution[];
|
|
26
|
+
/** Component for the sidebar footer (user menu). First plugin to provide wins. */
|
|
27
|
+
SidebarFooter: React.ComponentType<{ collapsed: boolean; basePath: string }> | null;
|
|
28
|
+
/** All routes contributed by plugins */
|
|
29
|
+
routes: PluginRouteContribution[];
|
|
30
|
+
/** Panel tabs grouped by context (e.g. 'flowEditor', 'nodeConfig') */
|
|
31
|
+
panelTabs: Record<string, PluginPanelTabContribution[]>;
|
|
32
|
+
/** Header actions grouped by context (e.g. 'flowHeader', 'flowList') */
|
|
33
|
+
headerActions: Record<string, PluginHeaderActionContribution[]>;
|
|
34
|
+
/** All provider wrappers from plugins (in registration order) */
|
|
35
|
+
providers: React.ComponentType<{ children: ReactNode }>[];
|
|
36
|
+
/**
|
|
37
|
+
* Permission checker — first plugin to return non-undefined wins.
|
|
38
|
+
* Returns true if no plugin overrides (default: allow everything).
|
|
39
|
+
*/
|
|
40
|
+
checkPermission: (permission: string, context?: PermissionContext) => boolean;
|
|
41
|
+
/** Whether any plugins are registered */
|
|
42
|
+
hasPlugins: boolean;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// ─────────────────────────────────────────────────────────────
|
|
46
|
+
// Context
|
|
47
|
+
// ─────────────────────────────────────────────────────────────
|
|
48
|
+
|
|
49
|
+
const defaultRegistry: PluginRegistry = {
|
|
50
|
+
sidebarItems: [],
|
|
51
|
+
SidebarFooter: null,
|
|
52
|
+
routes: [],
|
|
53
|
+
panelTabs: {},
|
|
54
|
+
headerActions: {},
|
|
55
|
+
providers: [],
|
|
56
|
+
checkPermission: () => true,
|
|
57
|
+
hasPlugins: false,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const PluginRegistryContext = createContext<PluginRegistry>(defaultRegistry);
|
|
61
|
+
|
|
62
|
+
// ─────────────────────────────────────────────────────────────
|
|
63
|
+
// Provider
|
|
64
|
+
// ─────────────────────────────────────────────────────────────
|
|
65
|
+
|
|
66
|
+
interface PluginRegistryProviderProps {
|
|
67
|
+
plugins: InvectFrontendPlugin[];
|
|
68
|
+
children: ReactNode;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function PluginRegistryProvider({ plugins, children }: PluginRegistryProviderProps) {
|
|
72
|
+
const registry = useMemo(() => buildRegistry(plugins), [plugins]);
|
|
73
|
+
|
|
74
|
+
// Wrap children in all plugin providers (outermost = first plugin)
|
|
75
|
+
let wrapped = <>{children}</>;
|
|
76
|
+
for (let i = registry.providers.length - 1; i >= 0; i--) {
|
|
77
|
+
const Provider = registry.providers[i];
|
|
78
|
+
wrapped = <Provider>{wrapped}</Provider>;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<PluginRegistryContext.Provider value={registry}>{wrapped}</PluginRegistryContext.Provider>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// ─────────────────────────────────────────────────────────────
|
|
87
|
+
// Hook
|
|
88
|
+
// ─────────────────────────────────────────────────────────────
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Access the plugin registry from any component inside `<Invect />`.
|
|
92
|
+
* Returns a default (empty) registry if no plugins are registered.
|
|
93
|
+
*/
|
|
94
|
+
export function usePluginRegistry(): PluginRegistry {
|
|
95
|
+
return useContext(PluginRegistryContext);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// ─────────────────────────────────────────────────────────────
|
|
99
|
+
// Registry Builder
|
|
100
|
+
// ─────────────────────────────────────────────────────────────
|
|
101
|
+
|
|
102
|
+
function buildRegistry(plugins: InvectFrontendPlugin[]): PluginRegistry {
|
|
103
|
+
const sidebarItems: PluginSidebarContribution[] = [];
|
|
104
|
+
let SidebarFooter: React.ComponentType<{ collapsed: boolean; basePath: string }> | null = null;
|
|
105
|
+
const routes: PluginRouteContribution[] = [];
|
|
106
|
+
const panelTabs: Record<string, PluginPanelTabContribution[]> = {};
|
|
107
|
+
const headerActions: Record<string, PluginHeaderActionContribution[]> = {};
|
|
108
|
+
const providers: React.ComponentType<{ children: ReactNode }>[] = [];
|
|
109
|
+
const permissionCheckers: Array<
|
|
110
|
+
(permission: string, context?: PermissionContext) => boolean | undefined
|
|
111
|
+
> = [];
|
|
112
|
+
|
|
113
|
+
for (const plugin of plugins) {
|
|
114
|
+
// Collect sidebar items
|
|
115
|
+
if (plugin.sidebar) {
|
|
116
|
+
sidebarItems.push(...plugin.sidebar);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Collect sidebar footer (first plugin to provide wins)
|
|
120
|
+
if (plugin.sidebarFooter && !SidebarFooter) {
|
|
121
|
+
SidebarFooter = plugin.sidebarFooter;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Collect routes
|
|
125
|
+
if (plugin.routes) {
|
|
126
|
+
routes.push(...plugin.routes);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Collect panel tabs
|
|
130
|
+
if (plugin.panelTabs) {
|
|
131
|
+
for (const tab of plugin.panelTabs) {
|
|
132
|
+
if (!panelTabs[tab.context]) {
|
|
133
|
+
panelTabs[tab.context] = [];
|
|
134
|
+
}
|
|
135
|
+
panelTabs[tab.context].push(tab);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Collect header actions
|
|
140
|
+
if (plugin.headerActions) {
|
|
141
|
+
for (const action of plugin.headerActions) {
|
|
142
|
+
if (!headerActions[action.context]) {
|
|
143
|
+
headerActions[action.context] = [];
|
|
144
|
+
}
|
|
145
|
+
headerActions[action.context].push(action);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Collect providers
|
|
150
|
+
if (plugin.providers) {
|
|
151
|
+
providers.push(...plugin.providers);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Collect permission checkers
|
|
155
|
+
if (plugin.checkPermission) {
|
|
156
|
+
permissionCheckers.push(plugin.checkPermission);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Build composite permission checker
|
|
161
|
+
const checkPermission = (permission: string, context?: PermissionContext): boolean => {
|
|
162
|
+
for (const checker of permissionCheckers) {
|
|
163
|
+
const result = checker(permission, context);
|
|
164
|
+
if (result !== undefined) {
|
|
165
|
+
return result;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
// Default: allow everything when no plugin overrides
|
|
169
|
+
return true;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
return {
|
|
173
|
+
sidebarItems,
|
|
174
|
+
SidebarFooter,
|
|
175
|
+
routes,
|
|
176
|
+
panelTabs,
|
|
177
|
+
headerActions,
|
|
178
|
+
providers,
|
|
179
|
+
checkPermission,
|
|
180
|
+
hasPlugins: plugins.length > 0,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import React, { createContext, useContext, useEffect, useMemo, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
type Theme = 'dark' | 'light' | 'system';
|
|
4
|
+
type ResolvedTheme = 'dark' | 'light';
|
|
5
|
+
|
|
6
|
+
interface ThemeProviderProps {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
defaultTheme?: Theme;
|
|
9
|
+
storageKey?: string;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface ThemeContextValue {
|
|
14
|
+
theme: Theme;
|
|
15
|
+
resolvedTheme: ResolvedTheme;
|
|
16
|
+
setTheme: (theme: Theme) => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const ThemeContext = createContext<ThemeContextValue | undefined>(undefined);
|
|
20
|
+
|
|
21
|
+
function isTheme(value: string | null): value is Theme {
|
|
22
|
+
return value === 'light' || value === 'dark' || value === 'system';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function getSystemTheme(): ResolvedTheme {
|
|
26
|
+
if (typeof window === 'undefined') {
|
|
27
|
+
return 'light';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function ThemeProvider({
|
|
34
|
+
children,
|
|
35
|
+
defaultTheme = 'dark',
|
|
36
|
+
storageKey = 'invect-ui-theme',
|
|
37
|
+
className,
|
|
38
|
+
}: ThemeProviderProps) {
|
|
39
|
+
const [theme, setTheme] = useState<Theme>(() => {
|
|
40
|
+
if (typeof window !== 'undefined') {
|
|
41
|
+
const storedTheme = localStorage.getItem(storageKey);
|
|
42
|
+
if (isTheme(storedTheme)) {
|
|
43
|
+
return storedTheme;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return defaultTheme;
|
|
48
|
+
});
|
|
49
|
+
const [resolvedTheme, setResolvedTheme] = useState<ResolvedTheme>(() =>
|
|
50
|
+
theme === 'system' ? getSystemTheme() : theme,
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (theme === 'system') {
|
|
55
|
+
const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
|
|
56
|
+
const handleChange = (event: MediaQueryListEvent) => {
|
|
57
|
+
setResolvedTheme(event.matches ? 'dark' : 'light');
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
setResolvedTheme(mediaQuery.matches ? 'dark' : 'light');
|
|
61
|
+
mediaQuery.addEventListener('change', handleChange);
|
|
62
|
+
|
|
63
|
+
return () => {
|
|
64
|
+
mediaQuery.removeEventListener('change', handleChange);
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
setResolvedTheme(theme);
|
|
69
|
+
}, [theme]);
|
|
70
|
+
|
|
71
|
+
const value = useMemo<ThemeContextValue>(
|
|
72
|
+
() => ({
|
|
73
|
+
theme,
|
|
74
|
+
resolvedTheme,
|
|
75
|
+
setTheme: (newTheme: Theme) => {
|
|
76
|
+
localStorage.setItem(storageKey, newTheme);
|
|
77
|
+
setTheme(newTheme);
|
|
78
|
+
},
|
|
79
|
+
}),
|
|
80
|
+
[resolvedTheme, storageKey, theme],
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<ThemeContext.Provider value={value}>
|
|
85
|
+
<div
|
|
86
|
+
className={['invect', resolvedTheme, 'flex-1 w-full h-full min-h-0', className]
|
|
87
|
+
.filter(Boolean)
|
|
88
|
+
.join(' ')}
|
|
89
|
+
>
|
|
90
|
+
{children}
|
|
91
|
+
</div>
|
|
92
|
+
</ThemeContext.Provider>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function useOptionalTheme() {
|
|
97
|
+
return useContext(ThemeContext);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function useTheme() {
|
|
101
|
+
const context = useContext(ThemeContext);
|
|
102
|
+
if (context === undefined) {
|
|
103
|
+
throw new Error('useTheme must be used within a ThemeProvider');
|
|
104
|
+
}
|
|
105
|
+
return context;
|
|
106
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import React, { createContext, useContext, useState, ReactNode } from 'react';
|
|
2
|
+
import type {
|
|
3
|
+
FlowValidationResult,
|
|
4
|
+
FlowValidationError,
|
|
5
|
+
FlowValidationWarning,
|
|
6
|
+
} from '@invect/core/types';
|
|
7
|
+
|
|
8
|
+
interface ValidationContextValue {
|
|
9
|
+
validationResult: FlowValidationResult | null;
|
|
10
|
+
setValidationResult: (result: FlowValidationResult | null) => void;
|
|
11
|
+
clearValidation: () => void;
|
|
12
|
+
|
|
13
|
+
// Helper methods for checking validation state
|
|
14
|
+
hasErrors: boolean;
|
|
15
|
+
hasWarnings: boolean;
|
|
16
|
+
|
|
17
|
+
// Methods to get errors/warnings by element
|
|
18
|
+
getNodeErrors: (nodeId: string) => FlowValidationError[];
|
|
19
|
+
getNodeWarnings: (nodeId: string) => FlowValidationWarning[];
|
|
20
|
+
getEdgeErrors: (edgeId: string) => FlowValidationError[];
|
|
21
|
+
getEdgeWarnings: (edgeId: string) => FlowValidationWarning[];
|
|
22
|
+
|
|
23
|
+
// Check if specific elements have validation issues
|
|
24
|
+
isNodeInvalid: (nodeId: string) => boolean;
|
|
25
|
+
isEdgeInvalid: (edgeId: string) => boolean;
|
|
26
|
+
hasNodeWarnings: (nodeId: string) => boolean;
|
|
27
|
+
hasEdgeWarnings: (edgeId: string) => boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const ValidationContext = createContext<ValidationContextValue | null>(null);
|
|
31
|
+
|
|
32
|
+
export function ValidationProvider({ children }: { children: ReactNode }) {
|
|
33
|
+
const [validationResult, setValidationResult] = useState<FlowValidationResult | null>(null);
|
|
34
|
+
|
|
35
|
+
const clearValidation = () => setValidationResult(null);
|
|
36
|
+
|
|
37
|
+
// Helper methods
|
|
38
|
+
const hasErrors = validationResult
|
|
39
|
+
? !validationResult.isValid && validationResult.errors?.length > 0
|
|
40
|
+
: false;
|
|
41
|
+
const hasWarnings = validationResult ? (validationResult.warnings?.length || 0) > 0 : false;
|
|
42
|
+
|
|
43
|
+
const getNodeErrors = (nodeId: string): FlowValidationError[] => {
|
|
44
|
+
if (!validationResult || validationResult.isValid) {
|
|
45
|
+
return [];
|
|
46
|
+
}
|
|
47
|
+
return validationResult.errors.filter(
|
|
48
|
+
(error: FlowValidationError) =>
|
|
49
|
+
error.nodeId === nodeId || error.sourceNodeId === nodeId || error.targetNodeId === nodeId,
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const getNodeWarnings = (nodeId: string): FlowValidationWarning[] => {
|
|
54
|
+
if (!validationResult || !validationResult.warnings) {
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
57
|
+
return validationResult.warnings.filter(
|
|
58
|
+
(warning: FlowValidationWarning) =>
|
|
59
|
+
warning.nodeId === nodeId ||
|
|
60
|
+
warning.sourceNodeId === nodeId ||
|
|
61
|
+
warning.targetNodeId === nodeId,
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const getEdgeErrors = (edgeId: string): FlowValidationError[] => {
|
|
66
|
+
if (!validationResult || validationResult.isValid) {
|
|
67
|
+
return [];
|
|
68
|
+
}
|
|
69
|
+
return validationResult.errors.filter((error: FlowValidationError) => error.edgeId === edgeId);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const getEdgeWarnings = (edgeId: string): FlowValidationWarning[] => {
|
|
73
|
+
if (!validationResult || !validationResult.warnings) {
|
|
74
|
+
return [];
|
|
75
|
+
}
|
|
76
|
+
return validationResult.warnings.filter(
|
|
77
|
+
(warning: FlowValidationWarning) => warning.edgeId === edgeId,
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const isNodeInvalid = (nodeId: string): boolean => {
|
|
82
|
+
return getNodeErrors(nodeId).length > 0;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const isEdgeInvalid = (edgeId: string): boolean => {
|
|
86
|
+
return getEdgeErrors(edgeId).length > 0;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const hasNodeWarnings = (nodeId: string): boolean => {
|
|
90
|
+
return getNodeWarnings(nodeId).length > 0;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const hasEdgeWarnings = (edgeId: string): boolean => {
|
|
94
|
+
return getEdgeWarnings(edgeId).length > 0;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const value: ValidationContextValue = {
|
|
98
|
+
validationResult,
|
|
99
|
+
setValidationResult,
|
|
100
|
+
clearValidation,
|
|
101
|
+
hasErrors,
|
|
102
|
+
hasWarnings,
|
|
103
|
+
getNodeErrors,
|
|
104
|
+
getNodeWarnings,
|
|
105
|
+
getEdgeErrors,
|
|
106
|
+
getEdgeWarnings,
|
|
107
|
+
isNodeInvalid,
|
|
108
|
+
isEdgeInvalid,
|
|
109
|
+
hasNodeWarnings,
|
|
110
|
+
hasEdgeWarnings,
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
return <ValidationContext.Provider value={value}>{children}</ValidationContext.Provider>;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export function useValidation() {
|
|
117
|
+
const context = useContext(ValidationContext);
|
|
118
|
+
if (!context) {
|
|
119
|
+
throw new Error('useValidation must be used within a ValidationProvider');
|
|
120
|
+
}
|
|
121
|
+
return context;
|
|
122
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DemoInvect — Full Invect UI powered by static demo data.
|
|
3
|
+
*
|
|
4
|
+
* Renders the complete Invect dashboard (sidebar, flow editor, credentials page, etc.)
|
|
5
|
+
* without requiring a backend server. All API calls resolve from the provided DemoData.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* import { DemoInvect } from '@invect/ui/demo';
|
|
10
|
+
* import '@invect/ui/styles';
|
|
11
|
+
*
|
|
12
|
+
* const demoData = {
|
|
13
|
+
* flows: [{ id: 'flow-1', name: 'My Flow', ... }],
|
|
14
|
+
* flowReactFlowData: { 'flow-1': { nodes: [...], edges: [...], ... } },
|
|
15
|
+
* nodeDefinitions: [...],
|
|
16
|
+
* };
|
|
17
|
+
*
|
|
18
|
+
* <div style={{ height: '600px' }}>
|
|
19
|
+
* <DemoInvect data={demoData} />
|
|
20
|
+
* </div>
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import React, { useMemo } from 'react';
|
|
25
|
+
import { Invect, type InvectProps } from '../Invect';
|
|
26
|
+
import { createDemoApiClient, type DemoData } from './demo-api-client';
|
|
27
|
+
import type { ApiClient } from '../api/client';
|
|
28
|
+
|
|
29
|
+
export interface DemoInvectProps extends Omit<InvectProps, 'apiBaseUrl' | 'apiClient'> {
|
|
30
|
+
/** Static data to power the demo UI */
|
|
31
|
+
data: DemoData;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Full Invect UI with no backend — all data comes from the `data` prop.
|
|
36
|
+
* Uses MemoryRouter by default so it doesn't affect the host page's URL.
|
|
37
|
+
*/
|
|
38
|
+
export function DemoInvect({ data, useMemoryRouter = true, ...rest }: DemoInvectProps) {
|
|
39
|
+
const mockClient = useMemo(() => createDemoApiClient(data) as unknown as ApiClient, [data]);
|
|
40
|
+
|
|
41
|
+
return <Invect apiClient={mockClient} useMemoryRouter={useMemoryRouter} {...rest} />;
|
|
42
|
+
}
|