@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,899 @@
|
|
|
1
|
+
// API client for communicating with the Invect backend
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
Flow,
|
|
5
|
+
FlowVersion,
|
|
6
|
+
FlowRun,
|
|
7
|
+
NodeExecution,
|
|
8
|
+
CreateFlowRequest,
|
|
9
|
+
CreateFlowVersionRequest,
|
|
10
|
+
FlowValidationResult,
|
|
11
|
+
PaginatedResponse,
|
|
12
|
+
SubmitPromptRequest,
|
|
13
|
+
SubmitSQLQueryRequest,
|
|
14
|
+
SQLQueryResult,
|
|
15
|
+
QueryOptions,
|
|
16
|
+
InvectDatabaseConfig,
|
|
17
|
+
InvectDefinition,
|
|
18
|
+
Model,
|
|
19
|
+
ReactFlowData,
|
|
20
|
+
AgentToolDefinition,
|
|
21
|
+
NodeConfigUpdateResponse,
|
|
22
|
+
DashboardStats,
|
|
23
|
+
FlowRunResult,
|
|
24
|
+
FlowInputs,
|
|
25
|
+
ExecuteFlowOptions,
|
|
26
|
+
UpdateFlowInput,
|
|
27
|
+
NodeDefinition,
|
|
28
|
+
} from './types';
|
|
29
|
+
|
|
30
|
+
import {
|
|
31
|
+
ValidationError,
|
|
32
|
+
type ReactFlowDataOptions,
|
|
33
|
+
type Credential,
|
|
34
|
+
type CredentialFilters,
|
|
35
|
+
type CreateCredentialInput,
|
|
36
|
+
type UpdateCredentialInput,
|
|
37
|
+
type CredentialUsage,
|
|
38
|
+
type OAuth2ProviderDefinition,
|
|
39
|
+
type OAuth2StartResult,
|
|
40
|
+
type FlowTriggerRegistration,
|
|
41
|
+
type CreateTriggerInput,
|
|
42
|
+
type UpdateTriggerInput,
|
|
43
|
+
} from './types';
|
|
44
|
+
|
|
45
|
+
class ApiClient {
|
|
46
|
+
private baseURL: string;
|
|
47
|
+
private userId: string;
|
|
48
|
+
|
|
49
|
+
constructor(baseURL: string, options?: { userId?: string }) {
|
|
50
|
+
this.baseURL = baseURL;
|
|
51
|
+
this.userId = options?.userId ?? 'user_123';
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Method to configure the base URL
|
|
55
|
+
setBaseURL(baseURL: string): void {
|
|
56
|
+
this.baseURL = baseURL;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
getBaseURL(): string {
|
|
60
|
+
return this.baseURL;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
setUserId(userId: string): void {
|
|
64
|
+
this.userId = userId;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
private getUserHeaders(): Record<string, string> {
|
|
68
|
+
return this.userId ? { 'X-User-ID': this.userId } : {};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private async request<T>(endpoint: string, options: RequestInit = {}): Promise<T> {
|
|
72
|
+
const url = `${this.baseURL}${endpoint}`;
|
|
73
|
+
|
|
74
|
+
const { headers: optionsHeaders, ...restOptions } = options;
|
|
75
|
+
const config: RequestInit = {
|
|
76
|
+
...restOptions,
|
|
77
|
+
credentials: 'include',
|
|
78
|
+
headers: {
|
|
79
|
+
'Content-Type': 'application/json',
|
|
80
|
+
...(optionsHeaders as Record<string, string>),
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const response = await fetch(url, config);
|
|
85
|
+
|
|
86
|
+
if (!response.ok) {
|
|
87
|
+
// Try to extract error message from response body
|
|
88
|
+
let errorMessage = `HTTP error! status: ${response.status}`;
|
|
89
|
+
try {
|
|
90
|
+
const errorData = await response.json();
|
|
91
|
+
|
|
92
|
+
// Handle ZodError format directly (when backend returns ZodError structure)
|
|
93
|
+
if (
|
|
94
|
+
response.status === 400 &&
|
|
95
|
+
errorData.error === 'Validation Error' &&
|
|
96
|
+
errorData.details
|
|
97
|
+
) {
|
|
98
|
+
const validationResult = {
|
|
99
|
+
isValid: false,
|
|
100
|
+
errors: errorData.details.map((detail: { message: string; path?: string }) => ({
|
|
101
|
+
type: 'VALIDATION_ERROR',
|
|
102
|
+
message: detail.message,
|
|
103
|
+
severity: 'error' as const,
|
|
104
|
+
field: detail.path || '',
|
|
105
|
+
value: undefined,
|
|
106
|
+
})),
|
|
107
|
+
warnings: [],
|
|
108
|
+
};
|
|
109
|
+
const validationError = new ValidationError(
|
|
110
|
+
errorData.message || 'Flow validation failed',
|
|
111
|
+
validationResult,
|
|
112
|
+
);
|
|
113
|
+
throw validationError;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Handle Express backend validation errors
|
|
117
|
+
if (
|
|
118
|
+
response.status === 400 &&
|
|
119
|
+
errorData.error === 'VALIDATION_ERROR' &&
|
|
120
|
+
errorData.details
|
|
121
|
+
) {
|
|
122
|
+
const validationResult = {
|
|
123
|
+
isValid: false,
|
|
124
|
+
errors: errorData.details.map(
|
|
125
|
+
(detail: { message: string; field?: string; value?: unknown }) => ({
|
|
126
|
+
type: 'VALIDATION_ERROR',
|
|
127
|
+
message: detail.message,
|
|
128
|
+
severity: 'error' as const,
|
|
129
|
+
field: detail.field || '',
|
|
130
|
+
value: detail.value,
|
|
131
|
+
}),
|
|
132
|
+
),
|
|
133
|
+
warnings: [],
|
|
134
|
+
};
|
|
135
|
+
const validationError = new ValidationError(
|
|
136
|
+
errorData.message || 'Flow validation failed',
|
|
137
|
+
validationResult,
|
|
138
|
+
);
|
|
139
|
+
throw validationError;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Legacy: Handle express-simple backend validation errors (validation field format)
|
|
143
|
+
if (
|
|
144
|
+
response.status === 400 &&
|
|
145
|
+
errorData.error === 'VALIDATION_ERROR' &&
|
|
146
|
+
errorData.validation
|
|
147
|
+
) {
|
|
148
|
+
throw new ValidationError(
|
|
149
|
+
errorData.message || 'Flow validation failed',
|
|
150
|
+
errorData.validation,
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Check if this is a validation error (400 with validation field)
|
|
155
|
+
if (response.status === 400 && errorData.validation) {
|
|
156
|
+
throw new ValidationError(
|
|
157
|
+
errorData.message || 'Flow validation failed',
|
|
158
|
+
errorData.validation,
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Handle validation errors nested in response property
|
|
163
|
+
if (
|
|
164
|
+
(response.status === 400 || response.status === 500) &&
|
|
165
|
+
errorData.response?.validation
|
|
166
|
+
) {
|
|
167
|
+
throw new ValidationError(
|
|
168
|
+
errorData.response.message || errorData.message || 'Flow validation failed',
|
|
169
|
+
errorData.response.validation,
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Check for validation data in any error response structure
|
|
174
|
+
if (errorData.validation) {
|
|
175
|
+
throw new ValidationError(
|
|
176
|
+
errorData.message || 'Flow validation failed',
|
|
177
|
+
errorData.validation,
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// Additional check for validation data nested in response object (any status code)
|
|
182
|
+
if (errorData.response && typeof errorData.response === 'object') {
|
|
183
|
+
if (errorData.response.validation) {
|
|
184
|
+
throw new ValidationError(
|
|
185
|
+
errorData.response.message || errorData.message || 'Flow validation failed',
|
|
186
|
+
errorData.response.validation,
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Handle other errors
|
|
192
|
+
if (errorData.error) {
|
|
193
|
+
errorMessage = errorData.error;
|
|
194
|
+
} else if (errorData.message) {
|
|
195
|
+
errorMessage = errorData.message;
|
|
196
|
+
}
|
|
197
|
+
} catch (parseError) {
|
|
198
|
+
// Re-throw validation errors
|
|
199
|
+
if (parseError instanceof ValidationError) {
|
|
200
|
+
throw parseError;
|
|
201
|
+
}
|
|
202
|
+
// If we can't parse the response body, use the default message
|
|
203
|
+
}
|
|
204
|
+
throw new Error(errorMessage);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// Handle 204 No Content responses (e.g., DELETE operations)
|
|
208
|
+
if (response.status === 204) {
|
|
209
|
+
return undefined as T;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
const result = await response.json();
|
|
213
|
+
return result;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// Dashboard endpoints
|
|
217
|
+
async getDashboardStats(): Promise<DashboardStats> {
|
|
218
|
+
return this.request<DashboardStats>('/dashboard/stats');
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// Flow endpoints
|
|
222
|
+
async getFlows(options?: QueryOptions<Flow>): Promise<PaginatedResponse<Flow>> {
|
|
223
|
+
const response = await this.request<PaginatedResponse<Flow>>('/flows/list', {
|
|
224
|
+
method: 'POST',
|
|
225
|
+
body: JSON.stringify(options || {}),
|
|
226
|
+
});
|
|
227
|
+
return response;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
async getFlow(id: string): Promise<Flow> {
|
|
231
|
+
const response = await this.request<Flow>(`/flows/${id}`);
|
|
232
|
+
return response;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
async createFlow(createFlowRequest: CreateFlowRequest): Promise<Flow> {
|
|
236
|
+
const response = await this.request<Flow>('/flows', {
|
|
237
|
+
method: 'POST',
|
|
238
|
+
body: JSON.stringify(createFlowRequest),
|
|
239
|
+
});
|
|
240
|
+
return response;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
async createFlowWithVersion(
|
|
244
|
+
createFlowRequest: CreateFlowRequest,
|
|
245
|
+
createVersionRequest: CreateFlowVersionRequest,
|
|
246
|
+
): Promise<Flow> {
|
|
247
|
+
// First create the flow
|
|
248
|
+
const flow = await this.createFlow(createFlowRequest);
|
|
249
|
+
|
|
250
|
+
// Then create the initial version
|
|
251
|
+
await this.createFlowVersion(flow.id, createVersionRequest);
|
|
252
|
+
|
|
253
|
+
// Return the flow with the version data
|
|
254
|
+
return this.getFlow(flow.id);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
async updateFlow(id: string, updateData: UpdateFlowInput): Promise<Flow> {
|
|
258
|
+
const flow = await this.request<Flow>(`/flows/${id}`, {
|
|
259
|
+
method: 'PUT',
|
|
260
|
+
body: JSON.stringify(updateData),
|
|
261
|
+
});
|
|
262
|
+
return flow;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
async deleteFlow(id: string): Promise<void> {
|
|
266
|
+
return this.request<void>(`/flows/${id}`, {
|
|
267
|
+
method: 'DELETE',
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// Flow version endpoints
|
|
272
|
+
async createFlowVersion(
|
|
273
|
+
flowId: string,
|
|
274
|
+
createVersionRequest: CreateFlowVersionRequest,
|
|
275
|
+
): Promise<FlowVersion> {
|
|
276
|
+
const endpoint = `/flows/${flowId}/versions`;
|
|
277
|
+
|
|
278
|
+
const response = await this.request<FlowVersion>(endpoint, {
|
|
279
|
+
method: 'POST',
|
|
280
|
+
body: JSON.stringify(createVersionRequest),
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
return response;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
async getFlowVersions(
|
|
287
|
+
flowId: string,
|
|
288
|
+
options?: QueryOptions<FlowVersion>,
|
|
289
|
+
): Promise<PaginatedResponse<FlowVersion>> {
|
|
290
|
+
const response = await this.request<PaginatedResponse<FlowVersion>>(
|
|
291
|
+
`/flows/${flowId}/versions/list`,
|
|
292
|
+
{
|
|
293
|
+
method: 'POST',
|
|
294
|
+
body: JSON.stringify(options || {}),
|
|
295
|
+
},
|
|
296
|
+
);
|
|
297
|
+
return response;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
async validateFlow(
|
|
301
|
+
flowId: string,
|
|
302
|
+
flowDefinition: InvectDefinition,
|
|
303
|
+
): Promise<FlowValidationResult> {
|
|
304
|
+
return this.request<FlowValidationResult>(`/validate-flow`, {
|
|
305
|
+
method: 'POST',
|
|
306
|
+
body: JSON.stringify({ flowId, flowDefinition }),
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// Flow run execution endpoints
|
|
311
|
+
async executeFlow(
|
|
312
|
+
flowId: string,
|
|
313
|
+
inputs?: FlowInputs,
|
|
314
|
+
options?: ExecuteFlowOptions,
|
|
315
|
+
): Promise<FlowRunResult> {
|
|
316
|
+
const response = await this.request<FlowRunResult>(`/flows/${flowId}/run`, {
|
|
317
|
+
method: 'POST',
|
|
318
|
+
body: JSON.stringify({ inputs, options }),
|
|
319
|
+
});
|
|
320
|
+
return response;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
async getFlowRun(flowRunId: string): Promise<FlowRun> {
|
|
324
|
+
const response = await this.request<FlowRun>(`/flow-runs/${flowRunId}`);
|
|
325
|
+
return response;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
async getFlowRunsByFlowId(flowId: string): Promise<PaginatedResponse<FlowRun>> {
|
|
329
|
+
return this.request<PaginatedResponse<FlowRun>>(`/flows/${flowId}/flow-runs`);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
async getAllFlowRuns(options?: QueryOptions<FlowRun>): Promise<PaginatedResponse<FlowRun>> {
|
|
333
|
+
return this.request<PaginatedResponse<FlowRun>>('/flow-runs/list', {
|
|
334
|
+
method: 'POST',
|
|
335
|
+
body: JSON.stringify(options || {}),
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// Flow run control endpoints
|
|
340
|
+
async pauseFlowRun(
|
|
341
|
+
flowRunId: string,
|
|
342
|
+
reason?: string,
|
|
343
|
+
): Promise<{ message: string; timestamp: string }> {
|
|
344
|
+
return this.request<{ message: string; timestamp: string }>(`/flow-runs/${flowRunId}/pause`, {
|
|
345
|
+
method: 'POST',
|
|
346
|
+
body: JSON.stringify({ reason }),
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
async resumeFlowRun(flowRunId: string): Promise<{ message: string; timestamp: string }> {
|
|
351
|
+
return this.request<{ message: string; timestamp: string }>(`/flow-runs/${flowRunId}/resume`, {
|
|
352
|
+
method: 'POST',
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
async cancelFlowRun(flowRunId: string): Promise<{ message: string; timestamp: string }> {
|
|
357
|
+
return this.request<{ message: string; timestamp: string }>(`/flow-runs/${flowRunId}/cancel`, {
|
|
358
|
+
method: 'POST',
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// Node execution endpoints
|
|
363
|
+
async getNodeExecutionsByFlowRun(flowRunId: string): Promise<NodeExecution[]> {
|
|
364
|
+
const result = await this.request<PaginatedResponse<NodeExecution>>(
|
|
365
|
+
`/flow-runs/${flowRunId}/node-executions?limit=100`,
|
|
366
|
+
);
|
|
367
|
+
return result.data;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
async getAllNodeExecutions(
|
|
371
|
+
options?: QueryOptions<NodeExecution>,
|
|
372
|
+
): Promise<PaginatedResponse<NodeExecution>> {
|
|
373
|
+
return this.request<PaginatedResponse<NodeExecution>>('/node-executions/list', {
|
|
374
|
+
method: 'POST',
|
|
375
|
+
body: JSON.stringify(options || {}),
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// React Flow endpoint
|
|
380
|
+
async getFlowReactFlowData(
|
|
381
|
+
flowId: string,
|
|
382
|
+
options?: ReactFlowDataOptions,
|
|
383
|
+
): Promise<ReactFlowData> {
|
|
384
|
+
const params = new URLSearchParams();
|
|
385
|
+
|
|
386
|
+
if (options?.version) {
|
|
387
|
+
params.set('version', options.version);
|
|
388
|
+
}
|
|
389
|
+
if (options?.flowRunId) {
|
|
390
|
+
params.set('flowRunId', options.flowRunId);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
const queryString = params.toString();
|
|
394
|
+
const url = `/flows/${flowId}/react-flow${queryString ? `?${queryString}` : ''}`;
|
|
395
|
+
|
|
396
|
+
return this.request<ReactFlowData>(url);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// Database endpoints
|
|
400
|
+
async getAvailableDatabases(): Promise<InvectDatabaseConfig[]> {
|
|
401
|
+
return this.request<InvectDatabaseConfig[]>('/node-data/databases');
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// Database query endpoint (for testing individual nodes)
|
|
405
|
+
async executeSqlQuery(request: SubmitSQLQueryRequest): Promise<SQLQueryResult> {
|
|
406
|
+
return this.request<SQLQueryResult>('/node-data/sql-query', {
|
|
407
|
+
method: 'POST',
|
|
408
|
+
body: JSON.stringify(request),
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
// JS expression test endpoint (for testing data mapper expressions)
|
|
413
|
+
async testJsExpression(request: {
|
|
414
|
+
expression: string;
|
|
415
|
+
context: Record<string, unknown>;
|
|
416
|
+
}): Promise<{ success: boolean; result?: unknown; error?: string }> {
|
|
417
|
+
return this.request<{ success: boolean; result?: unknown; error?: string }>(
|
|
418
|
+
'/node-data/test-expression',
|
|
419
|
+
{
|
|
420
|
+
method: 'POST',
|
|
421
|
+
body: JSON.stringify(request),
|
|
422
|
+
},
|
|
423
|
+
);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
// Data mapper test endpoint (for testing mapper expressions with mode semantics)
|
|
427
|
+
async testMapper(request: {
|
|
428
|
+
expression: string;
|
|
429
|
+
incomingData: Record<string, unknown>;
|
|
430
|
+
mode?: 'auto' | 'iterate' | 'reshape';
|
|
431
|
+
}): Promise<{
|
|
432
|
+
success: boolean;
|
|
433
|
+
result?: unknown;
|
|
434
|
+
resultType?: 'array' | 'object' | 'primitive';
|
|
435
|
+
itemCount?: number;
|
|
436
|
+
error?: string;
|
|
437
|
+
}> {
|
|
438
|
+
return this.request<{
|
|
439
|
+
success: boolean;
|
|
440
|
+
result?: unknown;
|
|
441
|
+
resultType?: 'array' | 'object' | 'primitive';
|
|
442
|
+
itemCount?: number;
|
|
443
|
+
error?: string;
|
|
444
|
+
}>('/node-data/test-mapper', {
|
|
445
|
+
method: 'POST',
|
|
446
|
+
body: JSON.stringify(request),
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
// Model test endpoint (for testing model nodes)
|
|
451
|
+
async testModelPrompt(request: SubmitPromptRequest): Promise<unknown> {
|
|
452
|
+
return this.request<unknown>('/node-data/model-query', {
|
|
453
|
+
method: 'POST',
|
|
454
|
+
body: JSON.stringify(request),
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
// Models endpoint
|
|
459
|
+
async getModels(options?: {
|
|
460
|
+
credentialId?: string;
|
|
461
|
+
provider?: string;
|
|
462
|
+
}): Promise<{ provider?: string; models: Model[]; defaultModel: string }> {
|
|
463
|
+
const params = new URLSearchParams();
|
|
464
|
+
if (options?.credentialId) {
|
|
465
|
+
params.set('credentialId', options.credentialId);
|
|
466
|
+
}
|
|
467
|
+
if (options?.provider) {
|
|
468
|
+
params.set('provider', options.provider);
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
const query = params.toString();
|
|
472
|
+
const endpoint = `/node-data/models${query ? `?${query}` : ''}`;
|
|
473
|
+
return this.request<{ provider?: string; models: Model[]; defaultModel: string }>(endpoint);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
async getModelsForCredential(credentialId: string) {
|
|
477
|
+
return this.getModels({ credentialId });
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
// Node definitions endpoint
|
|
481
|
+
async getAvailableNodes(): Promise<NodeDefinition[]> {
|
|
482
|
+
return this.request<NodeDefinition[]>('/nodes');
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
// Test/execute a single node in isolation
|
|
486
|
+
async testNode(
|
|
487
|
+
nodeType: string,
|
|
488
|
+
params: Record<string, unknown>,
|
|
489
|
+
inputData: Record<string, unknown> = {},
|
|
490
|
+
): Promise<{ success: boolean; output?: Record<string, unknown>; error?: string }> {
|
|
491
|
+
return this.request<{ success: boolean; output?: Record<string, unknown>; error?: string }>(
|
|
492
|
+
'/nodes/test',
|
|
493
|
+
{
|
|
494
|
+
method: 'POST',
|
|
495
|
+
body: JSON.stringify({ nodeType, params, inputData }),
|
|
496
|
+
},
|
|
497
|
+
);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Execute a flow up to a specific target node.
|
|
502
|
+
*/
|
|
503
|
+
async executeFlowToNode(
|
|
504
|
+
flowId: string,
|
|
505
|
+
nodeId: string,
|
|
506
|
+
inputs: Record<string, unknown> = {},
|
|
507
|
+
options?: { version?: number | 'latest'; useBatchProcessing?: boolean },
|
|
508
|
+
): Promise<FlowRunResult> {
|
|
509
|
+
return this.request<FlowRunResult>(`/flows/${flowId}/run-to-node/${nodeId}`, {
|
|
510
|
+
method: 'POST',
|
|
511
|
+
body: JSON.stringify({ inputs, options }),
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
async resolveNodeDefinition(
|
|
516
|
+
nodeType: string,
|
|
517
|
+
options?: {
|
|
518
|
+
nodeId?: string | null;
|
|
519
|
+
flowId?: string | null;
|
|
520
|
+
params?: Record<string, unknown>;
|
|
521
|
+
changeField?: string;
|
|
522
|
+
changeValue?: unknown;
|
|
523
|
+
},
|
|
524
|
+
): Promise<NodeConfigUpdateResponse> {
|
|
525
|
+
const searchParams = new URLSearchParams();
|
|
526
|
+
|
|
527
|
+
if (options?.nodeId) {
|
|
528
|
+
searchParams.set('nodeId', options.nodeId);
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
if (options?.flowId) {
|
|
532
|
+
searchParams.set('flowId', options.flowId);
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
if (options?.changeField) {
|
|
536
|
+
searchParams.set('changeField', options.changeField);
|
|
537
|
+
if (options.changeValue !== undefined && options.changeValue !== null) {
|
|
538
|
+
searchParams.set('changeValue', String(options.changeValue));
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
if (options?.params && Object.keys(options.params).length > 0) {
|
|
543
|
+
searchParams.set('params', JSON.stringify(options.params));
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
const query = searchParams.toString();
|
|
547
|
+
const endpoint = `/node-definition/${encodeURIComponent(nodeType)}${query ? `?${query}` : ''}`;
|
|
548
|
+
|
|
549
|
+
return this.request<NodeConfigUpdateResponse>(endpoint);
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* Load dynamic options for a field that has `loadOptions` defined.
|
|
554
|
+
*/
|
|
555
|
+
async loadFieldOptions(
|
|
556
|
+
actionId: string,
|
|
557
|
+
fieldName: string,
|
|
558
|
+
dependencyValues: Record<string, unknown>,
|
|
559
|
+
): Promise<{
|
|
560
|
+
options: { label: string; value: string | number }[];
|
|
561
|
+
defaultValue?: string | number;
|
|
562
|
+
placeholder?: string;
|
|
563
|
+
disabled?: boolean;
|
|
564
|
+
}> {
|
|
565
|
+
const params = new URLSearchParams();
|
|
566
|
+
params.set('deps', JSON.stringify(dependencyValues));
|
|
567
|
+
return this.request(
|
|
568
|
+
`/actions/${encodeURIComponent(actionId)}/fields/${encodeURIComponent(fieldName)}/options?${params.toString()}`,
|
|
569
|
+
);
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
// Credential endpoints
|
|
573
|
+
async listCredentials(filters?: CredentialFilters): Promise<Credential[]> {
|
|
574
|
+
const params = new URLSearchParams();
|
|
575
|
+
if (filters?.type) {
|
|
576
|
+
params.set('type', filters.type);
|
|
577
|
+
}
|
|
578
|
+
if (filters?.authType) {
|
|
579
|
+
params.set('authType', filters.authType);
|
|
580
|
+
}
|
|
581
|
+
if (filters?.isActive !== undefined) {
|
|
582
|
+
params.set('isActive', String(filters.isActive));
|
|
583
|
+
}
|
|
584
|
+
if (filters?.includeShared) {
|
|
585
|
+
params.set('includeShared', 'true');
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
const query = params.toString();
|
|
589
|
+
const endpoint = `/credentials${query ? `?${query}` : ''}`;
|
|
590
|
+
return this.request<Credential[]>(endpoint, {
|
|
591
|
+
headers: {
|
|
592
|
+
...this.getUserHeaders(),
|
|
593
|
+
},
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
async getCredential(id: string): Promise<Credential> {
|
|
598
|
+
return this.request<Credential>(`/credentials/${id}`, {
|
|
599
|
+
headers: {
|
|
600
|
+
...this.getUserHeaders(),
|
|
601
|
+
},
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
async createCredential(input: CreateCredentialInput): Promise<Credential> {
|
|
606
|
+
return this.request<Credential>('/credentials', {
|
|
607
|
+
method: 'POST',
|
|
608
|
+
headers: {
|
|
609
|
+
...this.getUserHeaders(),
|
|
610
|
+
},
|
|
611
|
+
body: JSON.stringify(input),
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
async updateCredential(id: string, input: UpdateCredentialInput): Promise<Credential> {
|
|
616
|
+
return this.request<Credential>(`/credentials/${id}`, {
|
|
617
|
+
method: 'PUT',
|
|
618
|
+
headers: {
|
|
619
|
+
...this.getUserHeaders(),
|
|
620
|
+
},
|
|
621
|
+
body: JSON.stringify(input),
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
async deleteCredential(id: string): Promise<void> {
|
|
626
|
+
await this.request<void>(`/credentials/${id}`, {
|
|
627
|
+
method: 'DELETE',
|
|
628
|
+
headers: {
|
|
629
|
+
...this.getUserHeaders(),
|
|
630
|
+
},
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
async testCredential(id: string): Promise<{ success: boolean; error?: string }> {
|
|
635
|
+
return this.request<{ success: boolean; error?: string }>(`/credentials/${id}/test`, {
|
|
636
|
+
method: 'POST',
|
|
637
|
+
headers: {
|
|
638
|
+
...this.getUserHeaders(),
|
|
639
|
+
},
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* Test a credential configuration by making an HTTP request through the backend
|
|
645
|
+
*/
|
|
646
|
+
async testCredentialRequest(params: {
|
|
647
|
+
url: string;
|
|
648
|
+
method?: string;
|
|
649
|
+
headers?: Record<string, string>;
|
|
650
|
+
body?: string;
|
|
651
|
+
}): Promise<{ status: number; statusText: string; ok: boolean; body: unknown }> {
|
|
652
|
+
return this.request<{ status: number; statusText: string; ok: boolean; body: unknown }>(
|
|
653
|
+
'/credentials/test-request',
|
|
654
|
+
{
|
|
655
|
+
method: 'POST',
|
|
656
|
+
headers: {
|
|
657
|
+
...this.getUserHeaders(),
|
|
658
|
+
},
|
|
659
|
+
body: JSON.stringify(params),
|
|
660
|
+
},
|
|
661
|
+
);
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
async getCredentialUsage(id: string): Promise<CredentialUsage> {
|
|
665
|
+
return this.request<CredentialUsage>(`/credentials/${id}/usage`, {
|
|
666
|
+
headers: {
|
|
667
|
+
...this.getUserHeaders(),
|
|
668
|
+
},
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
// =====================================
|
|
673
|
+
// OAUTH2
|
|
674
|
+
// =====================================
|
|
675
|
+
|
|
676
|
+
async getOAuth2Providers(): Promise<OAuth2ProviderDefinition[]> {
|
|
677
|
+
return this.request<OAuth2ProviderDefinition[]>('/credentials/oauth2/providers', {
|
|
678
|
+
headers: {
|
|
679
|
+
...this.getUserHeaders(),
|
|
680
|
+
},
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
async getOAuth2Provider(providerId: string): Promise<OAuth2ProviderDefinition> {
|
|
685
|
+
return this.request<OAuth2ProviderDefinition>(`/credentials/oauth2/providers/${providerId}`, {
|
|
686
|
+
headers: {
|
|
687
|
+
...this.getUserHeaders(),
|
|
688
|
+
},
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
async startOAuth2Flow(params: {
|
|
693
|
+
providerId?: string;
|
|
694
|
+
clientId?: string;
|
|
695
|
+
clientSecret?: string;
|
|
696
|
+
redirectUri: string;
|
|
697
|
+
scopes?: string[];
|
|
698
|
+
returnUrl?: string;
|
|
699
|
+
credentialName?: string;
|
|
700
|
+
existingCredentialId?: string;
|
|
701
|
+
}): Promise<OAuth2StartResult> {
|
|
702
|
+
return this.request<OAuth2StartResult>('/credentials/oauth2/start', {
|
|
703
|
+
method: 'POST',
|
|
704
|
+
headers: {
|
|
705
|
+
...this.getUserHeaders(),
|
|
706
|
+
},
|
|
707
|
+
body: JSON.stringify(params),
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
async handleOAuth2Callback(params: {
|
|
712
|
+
code: string;
|
|
713
|
+
state: string;
|
|
714
|
+
clientId?: string;
|
|
715
|
+
clientSecret?: string;
|
|
716
|
+
redirectUri?: string;
|
|
717
|
+
}): Promise<Credential> {
|
|
718
|
+
return this.request<Credential>('/credentials/oauth2/callback', {
|
|
719
|
+
method: 'POST',
|
|
720
|
+
headers: {
|
|
721
|
+
...this.getUserHeaders(),
|
|
722
|
+
},
|
|
723
|
+
body: JSON.stringify(params),
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
async refreshOAuth2Credential(credentialId: string): Promise<Credential> {
|
|
728
|
+
return this.request<Credential>(`/credentials/${credentialId}/refresh`, {
|
|
729
|
+
method: 'POST',
|
|
730
|
+
headers: {
|
|
731
|
+
...this.getUserHeaders(),
|
|
732
|
+
},
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
// =====================================
|
|
737
|
+
// AGENT TOOLS
|
|
738
|
+
// =====================================
|
|
739
|
+
|
|
740
|
+
async getAgentTools(): Promise<AgentToolDefinition[]> {
|
|
741
|
+
return this.request<AgentToolDefinition[]>('/agent/tools', {
|
|
742
|
+
headers: {
|
|
743
|
+
...this.getUserHeaders(),
|
|
744
|
+
},
|
|
745
|
+
});
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
// =====================================
|
|
749
|
+
// TRIGGERS
|
|
750
|
+
// =====================================
|
|
751
|
+
|
|
752
|
+
async listTriggersForFlow(flowId: string): Promise<FlowTriggerRegistration[]> {
|
|
753
|
+
return this.request<FlowTriggerRegistration[]>(`/flows/${flowId}/triggers`, {
|
|
754
|
+
headers: { ...this.getUserHeaders() },
|
|
755
|
+
});
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
async getTrigger(triggerId: string): Promise<FlowTriggerRegistration> {
|
|
759
|
+
return this.request<FlowTriggerRegistration>(`/triggers/${triggerId}`, {
|
|
760
|
+
headers: { ...this.getUserHeaders() },
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
async createTrigger(flowId: string, input: CreateTriggerInput): Promise<FlowTriggerRegistration> {
|
|
765
|
+
return this.request<FlowTriggerRegistration>(`/flows/${flowId}/triggers`, {
|
|
766
|
+
method: 'POST',
|
|
767
|
+
headers: { ...this.getUserHeaders() },
|
|
768
|
+
body: JSON.stringify(input),
|
|
769
|
+
});
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
async updateTrigger(
|
|
773
|
+
triggerId: string,
|
|
774
|
+
input: UpdateTriggerInput,
|
|
775
|
+
): Promise<FlowTriggerRegistration> {
|
|
776
|
+
return this.request<FlowTriggerRegistration>(`/triggers/${triggerId}`, {
|
|
777
|
+
method: 'PUT',
|
|
778
|
+
headers: { ...this.getUserHeaders() },
|
|
779
|
+
body: JSON.stringify(input),
|
|
780
|
+
});
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
async deleteTrigger(triggerId: string): Promise<void> {
|
|
784
|
+
await this.request<void>(`/triggers/${triggerId}`, {
|
|
785
|
+
method: 'DELETE',
|
|
786
|
+
headers: { ...this.getUserHeaders() },
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
async syncTriggersForFlow(
|
|
791
|
+
flowId: string,
|
|
792
|
+
definition: { nodes: Array<{ id: string; type: string; params?: Record<string, unknown> }> },
|
|
793
|
+
): Promise<FlowTriggerRegistration[]> {
|
|
794
|
+
return this.request<FlowTriggerRegistration[]>(`/flows/${flowId}/triggers/sync`, {
|
|
795
|
+
method: 'POST',
|
|
796
|
+
headers: { ...this.getUserHeaders() },
|
|
797
|
+
body: JSON.stringify({ definition }),
|
|
798
|
+
});
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
// =====================================
|
|
802
|
+
// CHAT ASSISTANT
|
|
803
|
+
// =====================================
|
|
804
|
+
|
|
805
|
+
async getChatStatus(): Promise<{ enabled: boolean }> {
|
|
806
|
+
return this.request<{ enabled: boolean }>('/chat/status');
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
async getChatModels(
|
|
810
|
+
credentialId: string,
|
|
811
|
+
query?: string,
|
|
812
|
+
): Promise<Array<{ id: string; name?: string; provider?: string }>> {
|
|
813
|
+
const params = query ? `?q=${encodeURIComponent(query)}` : '';
|
|
814
|
+
return this.request<Array<{ id: string; name?: string; provider?: string }>>(
|
|
815
|
+
`/chat/models/${credentialId}${params}`,
|
|
816
|
+
);
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
async sendChatMessage(
|
|
820
|
+
messages: Array<{ role: string; content: string; toolCalls?: unknown[]; toolCallId?: string }>,
|
|
821
|
+
context: {
|
|
822
|
+
flowId?: string;
|
|
823
|
+
selectedNodeId?: string;
|
|
824
|
+
selectedRunId?: string;
|
|
825
|
+
viewMode?: string;
|
|
826
|
+
credentialId?: string;
|
|
827
|
+
maxSteps?: number;
|
|
828
|
+
model?: string;
|
|
829
|
+
memoryNotes?: {
|
|
830
|
+
flowNotes?: string[];
|
|
831
|
+
workspaceNotes?: string[];
|
|
832
|
+
};
|
|
833
|
+
},
|
|
834
|
+
signal?: AbortSignal,
|
|
835
|
+
): Promise<Response> {
|
|
836
|
+
const url = `${this.baseURL}/chat`;
|
|
837
|
+
const response = await fetch(url, {
|
|
838
|
+
method: 'POST',
|
|
839
|
+
headers: { 'Content-Type': 'application/json' },
|
|
840
|
+
body: JSON.stringify({ messages, context }),
|
|
841
|
+
signal,
|
|
842
|
+
});
|
|
843
|
+
|
|
844
|
+
if (!response.ok) {
|
|
845
|
+
const errorData = await response.json().catch(() => ({}));
|
|
846
|
+
throw new Error(errorData.message || `Chat request failed: ${response.status}`);
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
return response;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
// =====================================
|
|
853
|
+
// CHAT MESSAGE PERSISTENCE
|
|
854
|
+
// =====================================
|
|
855
|
+
|
|
856
|
+
async getChatMessages(flowId: string): Promise<
|
|
857
|
+
Array<{
|
|
858
|
+
id: string;
|
|
859
|
+
flowId: string;
|
|
860
|
+
role: 'user' | 'assistant' | 'system' | 'tool';
|
|
861
|
+
content: string;
|
|
862
|
+
toolMeta?: Record<string, unknown> | null;
|
|
863
|
+
createdAt: string;
|
|
864
|
+
}>
|
|
865
|
+
> {
|
|
866
|
+
const result = await this.request<{
|
|
867
|
+
data: Array<{
|
|
868
|
+
id: string;
|
|
869
|
+
flowId: string;
|
|
870
|
+
role: 'user' | 'assistant' | 'system' | 'tool';
|
|
871
|
+
content: string;
|
|
872
|
+
toolMeta?: Record<string, unknown> | null;
|
|
873
|
+
createdAt: string;
|
|
874
|
+
}>;
|
|
875
|
+
pagination: { page: number; limit: number; totalPages: number };
|
|
876
|
+
}>(`/chat/messages/${flowId}?limit=100`);
|
|
877
|
+
return result.data;
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
async saveChatMessages(
|
|
881
|
+
flowId: string,
|
|
882
|
+
messages: Array<{
|
|
883
|
+
role: 'user' | 'assistant' | 'system' | 'tool';
|
|
884
|
+
content: string;
|
|
885
|
+
toolMeta?: Record<string, unknown> | null;
|
|
886
|
+
}>,
|
|
887
|
+
): Promise<void> {
|
|
888
|
+
return this.request(`/chat/messages/${flowId}`, {
|
|
889
|
+
method: 'PUT',
|
|
890
|
+
body: JSON.stringify({ messages }),
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
async deleteChatMessages(flowId: string): Promise<void> {
|
|
895
|
+
return this.request(`/chat/messages/${flowId}`, { method: 'DELETE' });
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
export { ApiClient };
|