@softtechai/quickmcp 1.0.14 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/auth-utils.d.ts +130 -0
- package/dist/auth/auth-utils.d.ts.map +1 -0
- package/dist/auth/auth-utils.js +600 -0
- package/dist/auth/auth-utils.js.map +1 -0
- package/dist/auth/jwks-provider.d.ts +9 -0
- package/dist/auth/jwks-provider.d.ts.map +1 -0
- package/dist/auth/jwks-provider.js +56 -0
- package/dist/auth/jwks-provider.js.map +1 -0
- package/dist/auth/token-utils.d.ts +40 -0
- package/dist/auth/token-utils.d.ts.map +1 -0
- package/dist/auth/token-utils.js +162 -0
- package/dist/auth/token-utils.js.map +1 -0
- package/dist/client/MCPClient.js +5 -4
- package/dist/client/MCPClient.js.map +1 -1
- package/dist/config/auth-config.d.ts +16 -0
- package/dist/config/auth-config.d.ts.map +1 -0
- package/dist/config/auth-config.js +107 -0
- package/dist/config/auth-config.js.map +1 -0
- package/dist/constant/constant.d.ts +20 -0
- package/dist/constant/constant.d.ts.map +1 -0
- package/dist/constant/constant.js +24 -0
- package/dist/constant/constant.js.map +1 -0
- package/dist/database/async-datastore.d.ts +6 -0
- package/dist/database/async-datastore.d.ts.map +1 -0
- package/dist/database/async-datastore.js +15 -0
- package/dist/database/async-datastore.js.map +1 -0
- package/dist/database/database-utils.d.ts +6 -0
- package/dist/database/database-utils.d.ts.map +1 -0
- package/dist/database/database-utils.js +29 -0
- package/dist/database/database-utils.js.map +1 -0
- package/dist/database/datastore.d.ts +164 -0
- package/dist/database/datastore.d.ts.map +1 -0
- package/dist/{parsers/types/index.js → database/datastore.js} +1 -0
- package/dist/database/datastore.js.map +1 -0
- package/dist/database/factory.d.ts +4 -0
- package/dist/database/factory.d.ts.map +1 -0
- package/dist/database/factory.js +32 -0
- package/dist/database/factory.js.map +1 -0
- package/dist/database/jdbc-manager.d.ts +49 -0
- package/dist/database/jdbc-manager.d.ts.map +1 -0
- package/dist/database/jdbc-manager.js +50 -0
- package/dist/database/jdbc-manager.js.map +1 -0
- package/dist/database/sqlite-manager.d.ts +46 -44
- package/dist/database/sqlite-manager.d.ts.map +1 -1
- package/dist/database/sqlite-manager.js +492 -42
- package/dist/database/sqlite-manager.js.map +1 -1
- package/dist/database/supabase-manager.d.ts +58 -0
- package/dist/database/supabase-manager.d.ts.map +1 -0
- package/dist/database/supabase-manager.js +432 -0
- package/dist/database/supabase-manager.js.map +1 -0
- package/dist/generators/MCPServerGenerator.d.ts +103 -20
- package/dist/generators/MCPServerGenerator.d.ts.map +1 -1
- package/dist/generators/MCPServerGenerator.js +6930 -128
- package/dist/generators/MCPServerGenerator.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/integrated-mcp-server-new.d.ts +14 -2
- package/dist/integrated-mcp-server-new.d.ts.map +1 -1
- package/dist/integrated-mcp-server-new.js +270 -180
- package/dist/integrated-mcp-server-new.js.map +1 -1
- package/dist/mcp-core/McpCoreService.d.ts +63 -0
- package/dist/mcp-core/McpCoreService.d.ts.map +1 -0
- package/dist/mcp-core/McpCoreService.js +492 -0
- package/dist/mcp-core/McpCoreService.js.map +1 -0
- package/dist/parsers/CsvParser.d.ts +1 -1
- package/dist/parsers/CsvParser.d.ts.map +1 -1
- package/dist/parsers/CsvParser.js +3 -2
- package/dist/parsers/CsvParser.js.map +1 -1
- package/dist/parsers/DatabaseParser.d.ts.map +1 -1
- package/dist/parsers/DatabaseParser.js +9 -8
- package/dist/parsers/DatabaseParser.js.map +1 -1
- package/dist/parsers/ExcelParser.d.ts +15 -0
- package/dist/parsers/ExcelParser.d.ts.map +1 -1
- package/dist/parsers/ExcelParser.js +287 -21
- package/dist/parsers/ExcelParser.js.map +1 -1
- package/dist/parsers/WebPageParser.d.ts +5 -0
- package/dist/parsers/WebPageParser.d.ts.map +1 -0
- package/dist/parsers/WebPageParser.js +35 -0
- package/dist/parsers/WebPageParser.js.map +1 -0
- package/dist/parsers/index.d.ts +3 -2
- package/dist/parsers/index.d.ts.map +1 -1
- package/dist/parsers/index.js +19 -16
- package/dist/parsers/index.js.map +1 -1
- package/dist/server/api/askApi.d.ts +41 -0
- package/dist/server/api/askApi.d.ts.map +1 -0
- package/dist/server/api/askApi.js +479 -0
- package/dist/server/api/askApi.js.map +1 -0
- package/dist/server/api/authApi.d.ts +101 -0
- package/dist/server/api/authApi.d.ts.map +1 -0
- package/dist/server/api/authApi.js +1472 -0
- package/dist/server/api/authApi.js.map +1 -0
- package/dist/server/api/authProperty.d.ts +18 -0
- package/dist/server/api/authProperty.d.ts.map +1 -0
- package/dist/server/api/authProperty.js +41 -0
- package/dist/server/api/authProperty.js.map +1 -0
- package/dist/server/api/configApi.d.ts +15 -0
- package/dist/server/api/configApi.d.ts.map +1 -0
- package/dist/server/api/configApi.js +42 -0
- package/dist/server/api/configApi.js.map +1 -0
- package/dist/server/api/databaseApi.d.ts +14 -0
- package/dist/server/api/databaseApi.d.ts.map +1 -0
- package/dist/server/api/databaseApi.js +111 -0
- package/dist/server/api/databaseApi.js.map +1 -0
- package/dist/server/api/directoryApi.d.ts +9 -0
- package/dist/server/api/directoryApi.d.ts.map +1 -0
- package/dist/server/api/directoryApi.js +103 -0
- package/dist/server/api/directoryApi.js.map +1 -0
- package/dist/server/api/generateApi.d.ts +24 -0
- package/dist/server/api/generateApi.d.ts.map +1 -0
- package/dist/server/api/generateApi.js +457 -0
- package/dist/server/api/generateApi.js.map +1 -0
- package/dist/server/api/healthApi.d.ts +9 -0
- package/dist/server/api/healthApi.d.ts.map +1 -0
- package/dist/server/api/healthApi.js +15 -0
- package/dist/server/api/healthApi.js.map +1 -0
- package/dist/server/api/indexApi.d.ts +21 -0
- package/dist/server/api/indexApi.d.ts.map +1 -0
- package/dist/server/api/indexApi.js +61 -0
- package/dist/server/api/indexApi.js.map +1 -0
- package/dist/server/api/logsApi.d.ts +12 -0
- package/dist/server/api/logsApi.d.ts.map +1 -0
- package/dist/server/api/logsApi.js +37 -0
- package/dist/server/api/logsApi.js.map +1 -0
- package/dist/server/api/mcpApi.d.ts +20 -0
- package/dist/server/api/mcpApi.d.ts.map +1 -0
- package/dist/server/api/mcpApi.js +120 -0
- package/dist/server/api/mcpApi.js.map +1 -0
- package/dist/server/api/nameApi.d.ts +21 -0
- package/dist/server/api/nameApi.d.ts.map +1 -0
- package/dist/server/api/nameApi.js +42 -0
- package/dist/server/api/nameApi.js.map +1 -0
- package/dist/server/api/parseApi.d.ts +9 -0
- package/dist/server/api/parseApi.d.ts.map +1 -0
- package/dist/server/api/parseApi.js +3245 -0
- package/dist/server/api/parseApi.js.map +1 -0
- package/dist/server/api/serverApi.d.ts +44 -0
- package/dist/server/api/serverApi.d.ts.map +1 -0
- package/dist/server/api/serverApi.js +417 -0
- package/dist/server/api/serverApi.js.map +1 -0
- package/dist/{dynamic-mcp-executor.d.ts → server/dynamic-mcp-executor.d.ts} +4 -5
- package/dist/server/dynamic-mcp-executor.d.ts.map +1 -0
- package/dist/server/dynamic-mcp-executor.js +62 -0
- package/dist/server/dynamic-mcp-executor.js.map +1 -0
- package/dist/server/port-utils.d.ts +14 -0
- package/dist/server/port-utils.d.ts.map +1 -0
- package/dist/server/port-utils.js +31 -0
- package/dist/server/port-utils.js.map +1 -0
- package/dist/server/server-utils.d.ts +13 -0
- package/dist/server/server-utils.d.ts.map +1 -0
- package/dist/server/server-utils.js +72 -0
- package/dist/server/server-utils.js.map +1 -0
- package/dist/{web → server}/server.d.ts +1 -0
- package/dist/server/server.d.ts.map +1 -0
- package/dist/server/server.js +535 -0
- package/dist/server/server.js.map +1 -0
- package/dist/server/tool-executer.d.ts +101 -0
- package/dist/server/tool-executer.d.ts.map +1 -0
- package/dist/server/tool-executer.js +6198 -0
- package/dist/server/tool-executer.js.map +1 -0
- package/dist/types/index.d.ts +1197 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1028 -0
- package/dist/types/index.js.map +1 -1
- package/dist/upload/upload-utils.d.ts +4 -0
- package/dist/upload/upload-utils.d.ts.map +1 -0
- package/dist/upload/upload-utils.js +29 -0
- package/dist/upload/upload-utils.js.map +1 -0
- package/dist/utils/deployment-util.d.ts +14 -0
- package/dist/utils/deployment-util.d.ts.map +1 -0
- package/dist/utils/deployment-util.js +46 -0
- package/dist/utils/deployment-util.js.map +1 -0
- package/dist/utils/logger.d.ts +15 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +56 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +18 -6
- package/quickmcp-direct-stdio.js +245 -163
- package/src/web/public/app.js +15370 -1471
- package/src/web/public/authorization.html +868 -0
- package/src/web/public/database-tables.html +283 -547
- package/src/web/public/how-to-use.html +446 -462
- package/src/web/public/how-to-use.js +4 -4
- package/src/web/public/images/app/activepieces.png +0 -0
- package/src/web/public/images/app/airtable.png +0 -0
- package/src/web/public/images/app/androidstudio.png +0 -0
- package/src/web/public/images/app/antigravity.png +0 -0
- package/src/web/public/images/app/applenotes.png +0 -0
- package/src/web/public/images/app/applereminders.png +0 -0
- package/src/web/public/images/app/asana.png +0 -0
- package/src/web/public/images/app/azureai.png +0 -0
- package/src/web/public/images/app/bash.png +0 -0
- package/src/web/public/images/app/bearnotes.png +0 -0
- package/src/web/public/images/app/bitbucket.png +0 -0
- package/src/web/public/images/app/claude.png +0 -0
- package/src/web/public/images/app/cli.png +0 -0
- package/src/web/public/images/app/clickup.png +0 -0
- package/src/web/public/images/app/cohere.png +0 -0
- package/src/web/public/images/app/confluence.png +0 -0
- package/src/web/public/images/app/confluence2.png +0 -0
- package/src/web/public/images/app/curl.png +0 -0
- package/src/web/public/images/app/curl_mini.png +0 -0
- package/src/web/public/images/app/cursor.png +0 -0
- package/src/web/public/images/app/db2.png +0 -0
- package/src/web/public/images/app/deepseek.png +0 -0
- package/src/web/public/images/app/discord.png +0 -0
- package/src/web/public/images/app/docker.png +0 -0
- package/src/web/public/images/app/dockerhub.png +0 -0
- package/src/web/public/images/app/dropbox.png +0 -0
- package/src/web/public/images/app/elasticsearch.png +0 -0
- package/src/web/public/images/app/facebook.png +0 -0
- package/src/web/public/images/app/falai.png +0 -0
- package/src/web/public/images/app/fireworks.png +0 -0
- package/src/web/public/images/app/gdrive.png +0 -0
- package/src/web/public/images/app/gemini.png +0 -0
- package/src/web/public/images/app/github.png +0 -0
- package/src/web/public/images/app/githubcopilot.png +0 -0
- package/src/web/public/images/app/gitlab.png +0 -0
- package/src/web/public/images/app/gmail.png +0 -0
- package/src/web/public/images/app/googlecalender.png +0 -0
- package/src/web/public/images/app/googledocs.png +0 -0
- package/src/web/public/images/app/googlesheets.png +0 -0
- package/src/web/public/images/app/gradle.png +0 -0
- package/src/web/public/images/app/grafana.png +0 -0
- package/src/web/public/images/app/graphql.png +0 -0
- package/src/web/public/images/app/grok.png +0 -0
- package/src/web/public/images/app/groq.png +0 -0
- package/src/web/public/images/app/hazelcast.png +0 -0
- package/src/web/public/images/app/huggingface.png +0 -0
- package/src/web/public/images/app/imessage.png +0 -0
- package/src/web/public/images/app/instagram.png +0 -0
- package/src/web/public/images/app/intellij.png +0 -0
- package/src/web/public/images/app/jenkins.png +0 -0
- package/src/web/public/images/app/jira.png +0 -0
- package/src/web/public/images/app/kafka.png +0 -0
- package/src/web/public/images/app/kubernetes.png +0 -0
- package/src/web/public/images/app/linear.png +0 -0
- package/src/web/public/images/app/linkedin.png +0 -0
- package/src/web/public/images/app/llama.png +0 -0
- package/src/web/public/images/app/make.png +0 -0
- package/src/web/public/images/app/maven.png +0 -0
- package/src/web/public/images/app/mcp.png +0 -0
- package/src/web/public/images/app/microsoftteams.png +0 -0
- package/src/web/public/images/app/mistral.png +0 -0
- package/src/web/public/images/app/monday.png +0 -0
- package/src/web/public/images/app/mongodb.png +0 -0
- package/src/web/public/images/app/mssql.png +0 -0
- package/src/web/public/images/app/mysql.png +0 -0
- package/src/web/public/images/app/n8n.png +0 -0
- package/src/web/public/images/app/notion.png +0 -0
- package/src/web/public/images/app/npm.png +0 -0
- package/src/web/public/images/app/nuget.png +0 -0
- package/src/web/public/images/app/obsidian.png +0 -0
- package/src/web/public/images/app/openai.png +0 -0
- package/src/web/public/images/app/openrouter.png +0 -0
- package/src/web/public/images/app/opensearch.png +0 -0
- package/src/web/public/images/app/openshift.png +0 -0
- package/src/web/public/images/app/oracle.png +0 -0
- package/src/web/public/images/app/perplexity.png +0 -0
- package/src/web/public/images/app/pipedream.png +0 -0
- package/src/web/public/images/app/postgresql.png +0 -0
- package/src/web/public/images/app/powershell.png +0 -0
- package/src/web/public/images/app/prometheus.png +0 -0
- package/src/web/public/images/app/reddit.png +0 -0
- package/src/web/public/images/app/redis.png +0 -0
- package/src/web/public/images/app/rss.png +0 -0
- package/src/web/public/images/app/signal.png +0 -0
- package/src/web/public/images/app/slack.png +0 -0
- package/src/web/public/images/app/soap.png +0 -0
- package/src/web/public/images/app/sqlite.png +0 -0
- package/src/web/public/images/app/supabase.png +0 -0
- package/src/web/public/images/app/telegram.png +0 -0
- package/src/web/public/images/app/things3.png +0 -0
- package/src/web/public/images/app/threads.png +0 -0
- package/src/web/public/images/app/tiktok.png +0 -0
- package/src/web/public/images/app/together.png +0 -0
- package/src/web/public/images/app/trello.png +0 -0
- package/src/web/public/images/app/vscode.png +0 -0
- package/src/web/public/images/app/webhook.png +0 -0
- package/src/web/public/images/app/webpage.png +0 -0
- package/src/web/public/images/app/whatsappbusiness.png +0 -0
- package/src/web/public/images/app/windsorf.png +0 -0
- package/src/web/public/images/app/x.png +0 -0
- package/src/web/public/images/app/youtube.png +0 -0
- package/src/web/public/images/app/zapier.png +0 -0
- package/src/web/public/images/app/zededitor.png +0 -0
- package/src/web/public/images/app/zoom.png +0 -0
- package/src/web/public/images/avatar-anon.svg +4 -0
- package/src/web/public/images/favicon.png +0 -0
- package/src/web/public/images/install/chatgpt-web/step0.png +0 -0
- package/src/web/public/images/install/chatgpt-web/step1.png +0 -0
- package/src/web/public/images/install/chatgpt-web/step2.png +0 -0
- package/src/web/public/images/install/chatgpt-web/step3.png +0 -0
- package/src/web/public/images/install/chatgpt-web/step4.png +0 -0
- package/src/web/public/images/install/chatgpt-web/step5.png +0 -0
- package/src/web/public/images/readme/1-generate-servers.png +0 -0
- package/src/web/public/images/readme/2-database-connection.png +0 -0
- package/src/web/public/images/readme/2-file-upload.png +0 -0
- package/src/web/public/images/readme/3-data-preview.png +0 -0
- package/src/web/public/images/readme/4-data-preview2.png +0 -0
- package/src/web/public/images/readme/5-server-configuration.png +0 -0
- package/src/web/public/images/readme/6-server-generated-modal.png +0 -0
- package/src/web/public/images/readme/7-generated-servers.png +0 -0
- package/src/web/public/images/readme/8-generated-servers-view-details.png +0 -0
- package/src/web/public/images/readme/Screenshot 2025-10-09 at 20.23.51.png +0 -0
- package/src/web/public/images/readme/Screenshot 2025-10-09 at 20.24.59.png +0 -0
- package/src/web/public/images/readme/Screenshot 2025-10-09 at 20.25.05.png +0 -0
- package/src/web/public/images/readme/Screenshot 2025-10-09 at 20.25.14.png +0 -0
- package/src/web/public/images/readme/Screenshot 2025-10-09 at 20.25.21.png +0 -0
- package/src/web/public/images/readme/Screenshot 2025-10-09 at 20.25.36.png +0 -0
- package/src/web/public/index.html +4685 -488
- package/src/web/public/landing.html +1638 -0
- package/src/web/public/logger.js +31 -0
- package/src/web/public/login.html +372 -0
- package/src/web/public/manage-servers.html +121 -188
- package/src/web/public/pricing.html +537 -0
- package/src/web/public/quick-ask.html +133 -0
- package/src/web/public/quickmcp-styles.css +708 -0
- package/src/web/public/roles.html +177 -0
- package/src/web/public/shared.js +736 -3
- package/src/web/public/sidebar.js +414 -0
- package/src/web/public/test-servers.html +605 -221
- package/src/web/public/users.html +191 -0
- package/dist/client/MCPClientUnified.d.ts +0 -31
- package/dist/client/MCPClientUnified.d.ts.map +0 -1
- package/dist/client/MCPClientUnified.js +0 -275
- package/dist/client/MCPClientUnified.js.map +0 -1
- package/dist/client/MCPTestRunnerUnified.d.ts +0 -48
- package/dist/client/MCPTestRunnerUnified.d.ts.map +0 -1
- package/dist/client/MCPTestRunnerUnified.js +0 -183
- package/dist/client/MCPTestRunnerUnified.js.map +0 -1
- package/dist/database/json-manager.d.ts +0 -55
- package/dist/database/json-manager.d.ts.map +0 -1
- package/dist/database/json-manager.js +0 -128
- package/dist/database/json-manager.js.map +0 -1
- package/dist/dynamic-mcp-executor.d.ts.map +0 -1
- package/dist/dynamic-mcp-executor.js +0 -274
- package/dist/dynamic-mcp-executor.js.map +0 -1
- package/dist/generators/MCPServerGenerator-new.d.ts +0 -37
- package/dist/generators/MCPServerGenerator-new.d.ts.map +0 -1
- package/dist/generators/MCPServerGenerator-new.js +0 -287
- package/dist/generators/MCPServerGenerator-new.js.map +0 -1
- package/dist/generators/database/sqlite-manager.d.ts +0 -52
- package/dist/generators/database/sqlite-manager.js +0 -143
- package/dist/generators/generators/MCPServerGenerator.d.ts +0 -37
- package/dist/generators/generators/MCPServerGenerator.js +0 -396
- package/dist/integrated-mcp-server.d.ts +0 -25
- package/dist/integrated-mcp-server.d.ts.map +0 -1
- package/dist/integrated-mcp-server.js +0 -541
- package/dist/integrated-mcp-server.js.map +0 -1
- package/dist/mcp-inspector-server.d.ts +0 -3
- package/dist/mcp-inspector-server.d.ts.map +0 -1
- package/dist/mcp-inspector-server.js +0 -119
- package/dist/mcp-inspector-server.js.map +0 -1
- package/dist/mcp-sdk-server.d.ts +0 -3
- package/dist/mcp-sdk-server.d.ts.map +0 -1
- package/dist/mcp-sdk-server.js +0 -90
- package/dist/mcp-sdk-server.js.map +0 -1
- package/dist/mcp-server.d.ts +0 -3
- package/dist/mcp-server.d.ts.map +0 -1
- package/dist/mcp-server.js +0 -300
- package/dist/mcp-server.js.map +0 -1
- package/dist/parsers/parsers/ExcelParser.js +0 -118
- package/dist/quickmcp-unified-bridge.d.ts +0 -13
- package/dist/quickmcp-unified-bridge.d.ts.map +0 -1
- package/dist/quickmcp-unified-bridge.js +0 -176
- package/dist/quickmcp-unified-bridge.js.map +0 -1
- package/dist/sqlite-manager.js +0 -145
- package/dist/test-app.d.ts +0 -2
- package/dist/test-app.d.ts.map +0 -1
- package/dist/test-app.js +0 -119
- package/dist/test-app.js.map +0 -1
- package/dist/transport/base-transport.d.ts +0 -21
- package/dist/transport/base-transport.d.ts.map +0 -1
- package/dist/transport/base-transport.js +0 -16
- package/dist/transport/base-transport.js.map +0 -1
- package/dist/transport/index.d.ts +0 -10
- package/dist/transport/index.d.ts.map +0 -1
- package/dist/transport/index.js +0 -12
- package/dist/transport/index.js.map +0 -1
- package/dist/transport/sse-transport.d.ts +0 -13
- package/dist/transport/sse-transport.d.ts.map +0 -1
- package/dist/transport/sse-transport.js +0 -106
- package/dist/transport/sse-transport.js.map +0 -1
- package/dist/transport/stdio-transport.d.ts +0 -8
- package/dist/transport/stdio-transport.d.ts.map +0 -1
- package/dist/transport/stdio-transport.js +0 -53
- package/dist/transport/stdio-transport.js.map +0 -1
- package/dist/transport/streamable-http-transport.d.ts +0 -15
- package/dist/transport/streamable-http-transport.d.ts.map +0 -1
- package/dist/transport/streamable-http-transport.js +0 -151
- package/dist/transport/streamable-http-transport.js.map +0 -1
- package/dist/web/client/MCPClient.js +0 -348
- package/dist/web/client/MCPTestRunner.js +0 -317
- package/dist/web/database/json-manager.js +0 -124
- package/dist/web/database/sqlite-manager.js +0 -146
- package/dist/web/dynamic-mcp-executor.js +0 -443
- package/dist/web/generators/MCPServerGenerator-new.js +0 -284
- package/dist/web/generators/MCPServerGenerator.js +0 -566
- package/dist/web/integrated-mcp-server-new.js +0 -394
- package/dist/web/parsers/CsvParser.js +0 -144
- package/dist/web/parsers/DatabaseParser.js +0 -637
- package/dist/web/parsers/ExcelParser.js +0 -180
- package/dist/web/parsers/index.js +0 -152
- package/dist/web/server.d.ts.map +0 -1
- package/dist/web/server.js +0 -790
- package/dist/web/server.js.map +0 -1
- package/dist/web/types/index.js +0 -2
- package/dist/web/web/server.js +0 -860
- package/src/web/public/modern-styles.css +0 -946
- package/src/web/public/shared-styles.css +0 -2091
- /package/src/web/public/images/{1-claude-quickmcp-stdio.png → readme/1-claude-quickmcp-stdio.png} +0 -0
- /package/src/web/public/images/{2-claude-tools.png → readme/2-claude-tools.png} +0 -0
- /package/src/web/public/images/{3-claude-developer-settings.png → readme/3-claude-developer-settings.png} +0 -0
- /package/src/web/public/images/{4-claude-config.png → readme/4-claude-config.png} +0 -0
- /package/src/web/public/images/{5-claude-config-edit.png → readme/5-claude-config-edit.png} +0 -0
|
@@ -0,0 +1,3245 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ParseApi = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const types_1 = require("../../types");
|
|
9
|
+
const upload_utils_1 = require("../../upload/upload-utils");
|
|
10
|
+
const logger_1 = require("../../utils/logger");
|
|
11
|
+
class ParseApi {
|
|
12
|
+
constructor(parser) {
|
|
13
|
+
this.parser = parser;
|
|
14
|
+
this.parseDataSource = async (req, res) => {
|
|
15
|
+
try {
|
|
16
|
+
const { type, connection, swaggerUrl, curlSetting, filePath } = req.body;
|
|
17
|
+
const file = req.file;
|
|
18
|
+
const normalizedFilePath = typeof filePath === 'string' ? filePath.trim() : '';
|
|
19
|
+
let dataSource;
|
|
20
|
+
// Accept database parse when database type is selected or a connection payload is present.
|
|
21
|
+
if ((0, types_1.isDatabase)(type) || connection) {
|
|
22
|
+
let connObj = connection;
|
|
23
|
+
if (typeof connObj === 'string') {
|
|
24
|
+
try {
|
|
25
|
+
connObj = JSON.parse(connObj);
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
connObj = null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (!connObj || !connObj.type) {
|
|
32
|
+
throw new Error('Missing or invalid database connection');
|
|
33
|
+
}
|
|
34
|
+
if (!(0, types_1.isDatabase)(connObj.type)) {
|
|
35
|
+
throw new Error(`Unsupported database type: ${connObj.type}`);
|
|
36
|
+
}
|
|
37
|
+
dataSource = {
|
|
38
|
+
type: connObj.type,
|
|
39
|
+
name: `Database (${connObj.type})`,
|
|
40
|
+
connection: connObj
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
else if (type === types_1.DataSourceType.Rest) {
|
|
44
|
+
if (!swaggerUrl)
|
|
45
|
+
throw new Error('Missing swaggerUrl');
|
|
46
|
+
// Fetch OpenAPI spec
|
|
47
|
+
const resp = await fetch(swaggerUrl);
|
|
48
|
+
if (!resp.ok)
|
|
49
|
+
throw new Error(`Failed to fetch OpenAPI: ${resp.status}`);
|
|
50
|
+
const spec = await resp.json();
|
|
51
|
+
// Derive baseUrl
|
|
52
|
+
let baseUrl = '';
|
|
53
|
+
if (spec && Array.isArray(spec.servers) && spec.servers.length && spec.servers[0]?.url) {
|
|
54
|
+
baseUrl = spec.servers[0].url;
|
|
55
|
+
}
|
|
56
|
+
else if (spec && spec.schemes && spec.host) {
|
|
57
|
+
const scheme = Array.isArray(spec.schemes) && spec.schemes.length ? spec.schemes[0] : 'https';
|
|
58
|
+
const basePath = spec.basePath || '';
|
|
59
|
+
baseUrl = `${scheme}://${spec.host}${basePath}`;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
// Fallback: strip filename from swaggerUrl
|
|
63
|
+
try {
|
|
64
|
+
const u = new URL(swaggerUrl);
|
|
65
|
+
baseUrl = swaggerUrl.replace(/\/[^/]*$/, '');
|
|
66
|
+
if (!baseUrl.startsWith(u.origin))
|
|
67
|
+
baseUrl = u.origin;
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
baseUrl = swaggerUrl.replace(/\/[^/]*$/, '');
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// Parse paths -> endpoints
|
|
74
|
+
const endpoints = [];
|
|
75
|
+
const paths = (spec && spec.paths) || {};
|
|
76
|
+
const methods = ['get', 'post', 'put', 'patch', 'delete'];
|
|
77
|
+
for (const p of Object.keys(paths)) {
|
|
78
|
+
const ops = paths[p] || {};
|
|
79
|
+
for (const m of methods) {
|
|
80
|
+
if (ops[m]) {
|
|
81
|
+
const op = ops[m];
|
|
82
|
+
endpoints.push({
|
|
83
|
+
method: m.toUpperCase(),
|
|
84
|
+
path: p,
|
|
85
|
+
summary: op.summary || op.operationId || '',
|
|
86
|
+
parameters: op.parameters || [],
|
|
87
|
+
requestBody: op.requestBody || null
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const restDataSource = (0, types_1.createRestDataSource)(`REST API`, swaggerUrl, baseUrl);
|
|
93
|
+
return res.json({
|
|
94
|
+
success: true,
|
|
95
|
+
data: {
|
|
96
|
+
dataSource: restDataSource,
|
|
97
|
+
parsedData: endpoints
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
else if (type === types_1.DataSourceType.Curl) {
|
|
102
|
+
let opts;
|
|
103
|
+
if (typeof curlSetting === 'string') {
|
|
104
|
+
try {
|
|
105
|
+
opts = JSON.parse(curlSetting);
|
|
106
|
+
}
|
|
107
|
+
catch (e) {
|
|
108
|
+
throw new Error('Invalid curlSetting JSON');
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
opts = curlSetting;
|
|
113
|
+
}
|
|
114
|
+
if (!opts || !opts.url) {
|
|
115
|
+
throw new Error('Missing curlSetting or url');
|
|
116
|
+
}
|
|
117
|
+
dataSource = (0, types_1.createCurlDataSource)(`cURL to ${opts.url}`, opts);
|
|
118
|
+
// For cURL, there's no data to parse beforehand.
|
|
119
|
+
// The "data" is what the cURL command will fetch at runtime.
|
|
120
|
+
// We'll create a single tool to represent this action.
|
|
121
|
+
const parsedData = [{
|
|
122
|
+
tableName: 'curl_request',
|
|
123
|
+
headers: ['url', 'method', 'status', 'response'],
|
|
124
|
+
rows: [],
|
|
125
|
+
metadata: {
|
|
126
|
+
rowCount: 0,
|
|
127
|
+
columnCount: 4,
|
|
128
|
+
dataTypes: {
|
|
129
|
+
url: 'string',
|
|
130
|
+
method: 'string',
|
|
131
|
+
status: 'number',
|
|
132
|
+
response: 'string'
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}];
|
|
136
|
+
return res.json({
|
|
137
|
+
success: true,
|
|
138
|
+
data: {
|
|
139
|
+
dataSource,
|
|
140
|
+
parsedData
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
else if (type === types_1.DataSourceType.Webpage) {
|
|
145
|
+
const { webUrl, alias } = req.body;
|
|
146
|
+
if (!webUrl) {
|
|
147
|
+
throw new Error('Missing webUrl');
|
|
148
|
+
}
|
|
149
|
+
const dataSource = {
|
|
150
|
+
type: types_1.DataSourceType.Webpage,
|
|
151
|
+
name: alias || 'webpage',
|
|
152
|
+
url: webUrl,
|
|
153
|
+
alias: alias
|
|
154
|
+
};
|
|
155
|
+
// For Webpage, content is fetched at runtime
|
|
156
|
+
const parsedData = [{
|
|
157
|
+
tableName: 'webpage',
|
|
158
|
+
headers: ['url', 'content'],
|
|
159
|
+
rows: [],
|
|
160
|
+
metadata: {
|
|
161
|
+
rowCount: 0,
|
|
162
|
+
columnCount: 2,
|
|
163
|
+
dataTypes: {
|
|
164
|
+
url: 'string',
|
|
165
|
+
content: 'string'
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}];
|
|
169
|
+
return res.json({
|
|
170
|
+
success: true,
|
|
171
|
+
data: {
|
|
172
|
+
dataSource,
|
|
173
|
+
parsedData
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
else if (type === types_1.DataSourceType.GraphQL) {
|
|
178
|
+
const { graphqlBaseUrl, graphqlHeaders } = req.body;
|
|
179
|
+
if (!graphqlBaseUrl) {
|
|
180
|
+
throw new Error('Missing GraphQL base URL');
|
|
181
|
+
}
|
|
182
|
+
let headers = {};
|
|
183
|
+
if (graphqlHeaders) {
|
|
184
|
+
try {
|
|
185
|
+
headers = typeof graphqlHeaders === 'string' ? JSON.parse(graphqlHeaders) : graphqlHeaders;
|
|
186
|
+
}
|
|
187
|
+
catch {
|
|
188
|
+
throw new Error('Invalid GraphQL headers JSON');
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
const dataSource = {
|
|
192
|
+
type: types_1.DataSourceType.GraphQL,
|
|
193
|
+
name: 'GraphQL',
|
|
194
|
+
baseUrl: graphqlBaseUrl,
|
|
195
|
+
headers
|
|
196
|
+
};
|
|
197
|
+
const parsedData = [{
|
|
198
|
+
tableName: 'graphql_tools',
|
|
199
|
+
headers: ['tool', 'description'],
|
|
200
|
+
rows: [
|
|
201
|
+
['query', 'Execute a GraphQL query'],
|
|
202
|
+
['introspect', 'Run GraphQL schema introspection']
|
|
203
|
+
],
|
|
204
|
+
metadata: {
|
|
205
|
+
rowCount: 2,
|
|
206
|
+
columnCount: 2,
|
|
207
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
208
|
+
}
|
|
209
|
+
}];
|
|
210
|
+
return res.json({
|
|
211
|
+
success: true,
|
|
212
|
+
data: {
|
|
213
|
+
dataSource,
|
|
214
|
+
parsedData
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
else if (type === types_1.DataSourceType.Soap) {
|
|
219
|
+
const { soapBaseUrl, soapWsdlUrl, soapAction, soapHeaders } = req.body;
|
|
220
|
+
if (!soapBaseUrl) {
|
|
221
|
+
throw new Error('Missing SOAP base URL');
|
|
222
|
+
}
|
|
223
|
+
let headers = {};
|
|
224
|
+
if (soapHeaders) {
|
|
225
|
+
try {
|
|
226
|
+
headers = typeof soapHeaders === 'string' ? JSON.parse(soapHeaders) : soapHeaders;
|
|
227
|
+
}
|
|
228
|
+
catch {
|
|
229
|
+
throw new Error('Invalid SOAP headers JSON');
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
const dataSource = {
|
|
233
|
+
type: types_1.DataSourceType.Soap,
|
|
234
|
+
name: 'SOAP',
|
|
235
|
+
baseUrl: soapBaseUrl,
|
|
236
|
+
wsdlUrl: soapWsdlUrl,
|
|
237
|
+
soapAction,
|
|
238
|
+
headers
|
|
239
|
+
};
|
|
240
|
+
const parsedData = [{
|
|
241
|
+
tableName: 'soap_tools',
|
|
242
|
+
headers: ['tool', 'description'],
|
|
243
|
+
rows: [
|
|
244
|
+
['call_operation', 'Call a SOAP operation with XML body']
|
|
245
|
+
],
|
|
246
|
+
metadata: {
|
|
247
|
+
rowCount: 1,
|
|
248
|
+
columnCount: 2,
|
|
249
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
250
|
+
}
|
|
251
|
+
}];
|
|
252
|
+
return res.json({
|
|
253
|
+
success: true,
|
|
254
|
+
data: {
|
|
255
|
+
dataSource,
|
|
256
|
+
parsedData
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
else if (type === types_1.DataSourceType.Rss) {
|
|
261
|
+
const { rssFeedUrl } = req.body;
|
|
262
|
+
if (!rssFeedUrl) {
|
|
263
|
+
throw new Error('Missing RSS feed URL');
|
|
264
|
+
}
|
|
265
|
+
const dataSource = {
|
|
266
|
+
type: types_1.DataSourceType.Rss,
|
|
267
|
+
name: 'RSS/Atom',
|
|
268
|
+
feedUrl: rssFeedUrl
|
|
269
|
+
};
|
|
270
|
+
const parsedData = [{
|
|
271
|
+
tableName: 'rss_tools',
|
|
272
|
+
headers: ['tool', 'description'],
|
|
273
|
+
rows: [
|
|
274
|
+
['get_feed', 'Fetch feed metadata and items'],
|
|
275
|
+
['list_entries', 'List feed entries']
|
|
276
|
+
],
|
|
277
|
+
metadata: {
|
|
278
|
+
rowCount: 2,
|
|
279
|
+
columnCount: 2,
|
|
280
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
281
|
+
}
|
|
282
|
+
}];
|
|
283
|
+
return res.json({
|
|
284
|
+
success: true,
|
|
285
|
+
data: {
|
|
286
|
+
dataSource,
|
|
287
|
+
parsedData
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
else if (type === types_1.DataSourceType.GitHub) {
|
|
292
|
+
const { githubToken, githubOwner, githubRepo } = req.body;
|
|
293
|
+
if (!githubToken) {
|
|
294
|
+
throw new Error('Missing GitHub token');
|
|
295
|
+
}
|
|
296
|
+
const dataSource = {
|
|
297
|
+
type: types_1.DataSourceType.GitHub,
|
|
298
|
+
name: 'GitHub',
|
|
299
|
+
token: githubToken,
|
|
300
|
+
owner: githubOwner,
|
|
301
|
+
repo: githubRepo
|
|
302
|
+
};
|
|
303
|
+
// For GitHub, tools are predefined - no parsing needed
|
|
304
|
+
const parsedData = [{
|
|
305
|
+
tableName: 'github_tools',
|
|
306
|
+
headers: ['tool', 'description'],
|
|
307
|
+
rows: [
|
|
308
|
+
['list_repos', 'List repositories for the authenticated user'],
|
|
309
|
+
['search_repos', 'Search for repositories on GitHub'],
|
|
310
|
+
['get_repo', 'Get details of a specific repository'],
|
|
311
|
+
['list_issues', 'List issues for a repository'],
|
|
312
|
+
['create_issue', 'Create a new issue in a repository'],
|
|
313
|
+
['list_pull_requests', 'List pull requests for a repository'],
|
|
314
|
+
['get_file_contents', 'Get contents of a file from a repository'],
|
|
315
|
+
['list_commits', 'List commits for a repository'],
|
|
316
|
+
['get_user', 'Get information about a GitHub user'],
|
|
317
|
+
['create_issue_comment', 'Create a comment on an issue']
|
|
318
|
+
],
|
|
319
|
+
metadata: {
|
|
320
|
+
rowCount: 10,
|
|
321
|
+
columnCount: 2,
|
|
322
|
+
dataTypes: {
|
|
323
|
+
tool: 'string',
|
|
324
|
+
description: 'string'
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}];
|
|
328
|
+
return res.json({
|
|
329
|
+
success: true,
|
|
330
|
+
data: {
|
|
331
|
+
dataSource,
|
|
332
|
+
parsedData
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
else if (type === types_1.DataSourceType.X) {
|
|
337
|
+
const { xToken, xUsername } = req.body;
|
|
338
|
+
if (!xToken) {
|
|
339
|
+
throw new Error('Missing X API token');
|
|
340
|
+
}
|
|
341
|
+
const dataSource = {
|
|
342
|
+
type: types_1.DataSourceType.X,
|
|
343
|
+
name: 'X',
|
|
344
|
+
token: xToken,
|
|
345
|
+
username: xUsername
|
|
346
|
+
};
|
|
347
|
+
const parsedData = [{
|
|
348
|
+
tableName: 'x_tools',
|
|
349
|
+
headers: ['tool', 'description'],
|
|
350
|
+
rows: [
|
|
351
|
+
['get_user_by_username', 'Get X user details by username'],
|
|
352
|
+
['get_user', 'Get X user details by user ID'],
|
|
353
|
+
['get_user_tweets', 'Get recent tweets from a user (max_results 10-100)'],
|
|
354
|
+
['search_recent_tweets', 'Search recent tweets by query (max_results 10-100)'],
|
|
355
|
+
['get_tweet', 'Get a tweet by ID'],
|
|
356
|
+
['create_tweet', 'Create a new tweet']
|
|
357
|
+
],
|
|
358
|
+
metadata: {
|
|
359
|
+
rowCount: 6,
|
|
360
|
+
columnCount: 2,
|
|
361
|
+
dataTypes: {
|
|
362
|
+
tool: 'string',
|
|
363
|
+
description: 'string'
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}];
|
|
367
|
+
return res.json({
|
|
368
|
+
success: true,
|
|
369
|
+
data: {
|
|
370
|
+
dataSource,
|
|
371
|
+
parsedData
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
else if (type === types_1.DataSourceType.Prometheus) {
|
|
376
|
+
const { prometheusBaseUrl } = req.body;
|
|
377
|
+
if (!prometheusBaseUrl) {
|
|
378
|
+
throw new Error('Missing Prometheus base URL');
|
|
379
|
+
}
|
|
380
|
+
const dataSource = {
|
|
381
|
+
type: types_1.DataSourceType.Prometheus,
|
|
382
|
+
name: 'Prometheus',
|
|
383
|
+
baseUrl: prometheusBaseUrl
|
|
384
|
+
};
|
|
385
|
+
const parsedData = [{
|
|
386
|
+
tableName: 'prometheus_tools',
|
|
387
|
+
headers: ['tool', 'description'],
|
|
388
|
+
rows: [
|
|
389
|
+
['query', 'Run an instant PromQL query'],
|
|
390
|
+
['query_range', 'Run a range PromQL query'],
|
|
391
|
+
['labels', 'List label names'],
|
|
392
|
+
['series', 'Find series by label matchers'],
|
|
393
|
+
['targets', 'List Prometheus targets']
|
|
394
|
+
],
|
|
395
|
+
metadata: {
|
|
396
|
+
rowCount: 5,
|
|
397
|
+
columnCount: 2,
|
|
398
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
399
|
+
}
|
|
400
|
+
}];
|
|
401
|
+
return res.json({
|
|
402
|
+
success: true,
|
|
403
|
+
data: {
|
|
404
|
+
dataSource,
|
|
405
|
+
parsedData
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
else if (type === types_1.DataSourceType.Grafana) {
|
|
410
|
+
const { grafanaBaseUrl, grafanaAuthType, grafanaApiKey, grafanaUsername, grafanaPassword } = req.body;
|
|
411
|
+
if (!grafanaBaseUrl) {
|
|
412
|
+
throw new Error('Missing Grafana base URL');
|
|
413
|
+
}
|
|
414
|
+
if (!grafanaAuthType || (grafanaAuthType !== 'apiKey' && grafanaAuthType !== 'basic')) {
|
|
415
|
+
throw new Error('Missing Grafana auth type');
|
|
416
|
+
}
|
|
417
|
+
if (grafanaAuthType === 'apiKey' && !grafanaApiKey) {
|
|
418
|
+
throw new Error('Missing Grafana API key');
|
|
419
|
+
}
|
|
420
|
+
if (grafanaAuthType === 'basic' && (!grafanaUsername || !grafanaPassword)) {
|
|
421
|
+
throw new Error('Missing Grafana username or password');
|
|
422
|
+
}
|
|
423
|
+
const dataSource = {
|
|
424
|
+
type: types_1.DataSourceType.Grafana,
|
|
425
|
+
name: 'Grafana',
|
|
426
|
+
baseUrl: grafanaBaseUrl,
|
|
427
|
+
authType: grafanaAuthType,
|
|
428
|
+
apiKey: grafanaApiKey,
|
|
429
|
+
username: grafanaUsername,
|
|
430
|
+
password: grafanaPassword
|
|
431
|
+
};
|
|
432
|
+
const parsedData = [{
|
|
433
|
+
tableName: 'grafana_tools',
|
|
434
|
+
headers: ['tool', 'description'],
|
|
435
|
+
rows: [
|
|
436
|
+
['search_dashboards', 'Search dashboards (by title/tag)'],
|
|
437
|
+
['get_dashboard', 'Get dashboard by UID'],
|
|
438
|
+
['list_datasources', 'List Grafana datasources'],
|
|
439
|
+
['get_datasource', 'Get datasource by ID'],
|
|
440
|
+
['query_datasource', 'Query a datasource']
|
|
441
|
+
],
|
|
442
|
+
metadata: {
|
|
443
|
+
rowCount: 5,
|
|
444
|
+
columnCount: 2,
|
|
445
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
446
|
+
}
|
|
447
|
+
}];
|
|
448
|
+
return res.json({
|
|
449
|
+
success: true,
|
|
450
|
+
data: {
|
|
451
|
+
dataSource,
|
|
452
|
+
parsedData
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
else if (type === types_1.DataSourceType.MongoDB) {
|
|
457
|
+
const { mongoHost, mongoPort, mongoDatabase, mongoUsername, mongoPassword, mongoAuthSource } = req.body;
|
|
458
|
+
if (!mongoHost || !mongoDatabase) {
|
|
459
|
+
throw new Error('Missing MongoDB host or database');
|
|
460
|
+
}
|
|
461
|
+
const dataSource = {
|
|
462
|
+
type: types_1.DataSourceType.MongoDB,
|
|
463
|
+
name: 'MongoDB',
|
|
464
|
+
host: mongoHost,
|
|
465
|
+
port: mongoPort ? parseInt(mongoPort, 10) : undefined,
|
|
466
|
+
database: mongoDatabase,
|
|
467
|
+
username: mongoUsername,
|
|
468
|
+
password: mongoPassword,
|
|
469
|
+
authSource: mongoAuthSource
|
|
470
|
+
};
|
|
471
|
+
const parsedData = [{
|
|
472
|
+
tableName: 'mongodb_tools',
|
|
473
|
+
headers: ['tool', 'description'],
|
|
474
|
+
rows: [
|
|
475
|
+
['list_databases', 'List databases on the MongoDB server'],
|
|
476
|
+
['list_collections', 'List collections in a database'],
|
|
477
|
+
['find', 'Find documents in a collection'],
|
|
478
|
+
['insert_one', 'Insert a document into a collection'],
|
|
479
|
+
['update_one', 'Update a single document in a collection'],
|
|
480
|
+
['delete_one', 'Delete a single document in a collection'],
|
|
481
|
+
['aggregate', 'Run an aggregation pipeline']
|
|
482
|
+
],
|
|
483
|
+
metadata: {
|
|
484
|
+
rowCount: 7,
|
|
485
|
+
columnCount: 2,
|
|
486
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
487
|
+
}
|
|
488
|
+
}];
|
|
489
|
+
return res.json({
|
|
490
|
+
success: true,
|
|
491
|
+
data: {
|
|
492
|
+
dataSource,
|
|
493
|
+
parsedData
|
|
494
|
+
}
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
else if (type === types_1.DataSourceType.Facebook) {
|
|
498
|
+
const { facebookBaseUrl, facebookApiVersion, facebookAccessToken, facebookUserId, facebookPageId } = req.body;
|
|
499
|
+
if (!facebookBaseUrl || !facebookApiVersion || !facebookAccessToken) {
|
|
500
|
+
throw new Error('Missing Facebook base URL, API version, or access token');
|
|
501
|
+
}
|
|
502
|
+
const dataSource = {
|
|
503
|
+
type: types_1.DataSourceType.Facebook,
|
|
504
|
+
name: 'Facebook',
|
|
505
|
+
baseUrl: facebookBaseUrl,
|
|
506
|
+
apiVersion: facebookApiVersion,
|
|
507
|
+
accessToken: facebookAccessToken,
|
|
508
|
+
userId: facebookUserId,
|
|
509
|
+
pageId: facebookPageId
|
|
510
|
+
};
|
|
511
|
+
const parsedData = [{
|
|
512
|
+
tableName: 'facebook_tools',
|
|
513
|
+
headers: ['tool', 'description'],
|
|
514
|
+
rows: [
|
|
515
|
+
['get_user', 'Get a Facebook user by ID'],
|
|
516
|
+
['get_pages', 'List pages for a user'],
|
|
517
|
+
['get_page_posts', 'List posts for a page'],
|
|
518
|
+
['get_post', 'Get a post by ID'],
|
|
519
|
+
['search', 'Search public content'],
|
|
520
|
+
['get_page_insights', 'Get insights for a page']
|
|
521
|
+
],
|
|
522
|
+
metadata: {
|
|
523
|
+
rowCount: 6,
|
|
524
|
+
columnCount: 2,
|
|
525
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
526
|
+
}
|
|
527
|
+
}];
|
|
528
|
+
return res.json({
|
|
529
|
+
success: true,
|
|
530
|
+
data: {
|
|
531
|
+
dataSource,
|
|
532
|
+
parsedData
|
|
533
|
+
}
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
else if (type === types_1.DataSourceType.Instagram) {
|
|
537
|
+
const { instagramBaseUrl, instagramAccessToken, instagramUserId } = req.body;
|
|
538
|
+
if (!instagramBaseUrl || !instagramAccessToken) {
|
|
539
|
+
throw new Error('Missing Instagram base URL or access token');
|
|
540
|
+
}
|
|
541
|
+
const dataSource = {
|
|
542
|
+
type: types_1.DataSourceType.Instagram,
|
|
543
|
+
name: 'Instagram',
|
|
544
|
+
baseUrl: instagramBaseUrl,
|
|
545
|
+
accessToken: instagramAccessToken,
|
|
546
|
+
userId: instagramUserId
|
|
547
|
+
};
|
|
548
|
+
const parsedData = [{
|
|
549
|
+
tableName: 'instagram_tools',
|
|
550
|
+
headers: ['tool', 'description'],
|
|
551
|
+
rows: [
|
|
552
|
+
['get_user', 'Get user profile'],
|
|
553
|
+
['get_user_media', 'List media for a user'],
|
|
554
|
+
['get_media', 'Get media by ID'],
|
|
555
|
+
['get_media_comments', 'List comments for a media item']
|
|
556
|
+
],
|
|
557
|
+
metadata: {
|
|
558
|
+
rowCount: 4,
|
|
559
|
+
columnCount: 2,
|
|
560
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
561
|
+
}
|
|
562
|
+
}];
|
|
563
|
+
return res.json({
|
|
564
|
+
success: true,
|
|
565
|
+
data: {
|
|
566
|
+
dataSource,
|
|
567
|
+
parsedData
|
|
568
|
+
}
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
else if (type === types_1.DataSourceType.TikTok) {
|
|
572
|
+
const { tiktokBaseUrl, tiktokAccessToken, tiktokUserId } = req.body;
|
|
573
|
+
if (!tiktokBaseUrl || !tiktokAccessToken) {
|
|
574
|
+
throw new Error('Missing TikTok base URL or access token');
|
|
575
|
+
}
|
|
576
|
+
const dataSource = {
|
|
577
|
+
type: types_1.DataSourceType.TikTok,
|
|
578
|
+
name: 'TikTok',
|
|
579
|
+
baseUrl: tiktokBaseUrl,
|
|
580
|
+
accessToken: tiktokAccessToken,
|
|
581
|
+
userId: tiktokUserId
|
|
582
|
+
};
|
|
583
|
+
const parsedData = [{
|
|
584
|
+
tableName: 'tiktok_tools',
|
|
585
|
+
headers: ['tool', 'description'],
|
|
586
|
+
rows: [
|
|
587
|
+
['get_user_info', 'Get user profile'],
|
|
588
|
+
['list_videos', 'List videos for a user'],
|
|
589
|
+
['get_video', 'Get video by ID'],
|
|
590
|
+
['search_videos', 'Search videos']
|
|
591
|
+
],
|
|
592
|
+
metadata: {
|
|
593
|
+
rowCount: 4,
|
|
594
|
+
columnCount: 2,
|
|
595
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
596
|
+
}
|
|
597
|
+
}];
|
|
598
|
+
return res.json({
|
|
599
|
+
success: true,
|
|
600
|
+
data: {
|
|
601
|
+
dataSource,
|
|
602
|
+
parsedData
|
|
603
|
+
}
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
else if (type === types_1.DataSourceType.Notion) {
|
|
607
|
+
const { notionBaseUrl, notionAccessToken, notionVersion } = req.body;
|
|
608
|
+
if (!notionBaseUrl || !notionAccessToken) {
|
|
609
|
+
throw new Error('Missing Notion base URL or access token');
|
|
610
|
+
}
|
|
611
|
+
const dataSource = {
|
|
612
|
+
type: types_1.DataSourceType.Notion,
|
|
613
|
+
name: 'Notion',
|
|
614
|
+
baseUrl: notionBaseUrl,
|
|
615
|
+
accessToken: notionAccessToken,
|
|
616
|
+
notionVersion: notionVersion || '2022-06-28'
|
|
617
|
+
};
|
|
618
|
+
const parsedData = [{
|
|
619
|
+
tableName: 'notion_tools',
|
|
620
|
+
headers: ['tool', 'description'],
|
|
621
|
+
rows: [
|
|
622
|
+
['search', 'Search pages and databases'],
|
|
623
|
+
['get_page', 'Get a page by ID'],
|
|
624
|
+
['get_database', 'Get a database by ID'],
|
|
625
|
+
['query_database', 'Query a database'],
|
|
626
|
+
['create_page', 'Create a new page'],
|
|
627
|
+
['update_page', 'Update a page']
|
|
628
|
+
],
|
|
629
|
+
metadata: {
|
|
630
|
+
rowCount: 6,
|
|
631
|
+
columnCount: 2,
|
|
632
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
633
|
+
}
|
|
634
|
+
}];
|
|
635
|
+
return res.json({
|
|
636
|
+
success: true,
|
|
637
|
+
data: {
|
|
638
|
+
dataSource,
|
|
639
|
+
parsedData
|
|
640
|
+
}
|
|
641
|
+
});
|
|
642
|
+
}
|
|
643
|
+
else if (type === types_1.DataSourceType.Telegram) {
|
|
644
|
+
const { telegramBaseUrl, telegramBotToken, telegramChatId } = req.body;
|
|
645
|
+
if (!telegramBaseUrl || !telegramBotToken) {
|
|
646
|
+
throw new Error('Missing Telegram base URL or bot token');
|
|
647
|
+
}
|
|
648
|
+
const dataSource = {
|
|
649
|
+
type: types_1.DataSourceType.Telegram,
|
|
650
|
+
name: 'Telegram',
|
|
651
|
+
baseUrl: telegramBaseUrl,
|
|
652
|
+
botToken: telegramBotToken,
|
|
653
|
+
defaultChatId: telegramChatId || ''
|
|
654
|
+
};
|
|
655
|
+
const parsedData = [{
|
|
656
|
+
tableName: 'telegram_tools',
|
|
657
|
+
headers: ['tool', 'description'],
|
|
658
|
+
rows: [
|
|
659
|
+
['get_me', 'Get bot information'],
|
|
660
|
+
['get_updates', 'Get updates'],
|
|
661
|
+
['send_message', 'Send a message']
|
|
662
|
+
],
|
|
663
|
+
metadata: {
|
|
664
|
+
rowCount: 3,
|
|
665
|
+
columnCount: 2,
|
|
666
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
667
|
+
}
|
|
668
|
+
}];
|
|
669
|
+
return res.json({
|
|
670
|
+
success: true,
|
|
671
|
+
data: {
|
|
672
|
+
dataSource,
|
|
673
|
+
parsedData
|
|
674
|
+
}
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
else if (type === types_1.DataSourceType.LinkedIn) {
|
|
678
|
+
const { linkedinAccessToken, linkedinPersonId, linkedinOrganizationId } = req.body;
|
|
679
|
+
if (!linkedinAccessToken) {
|
|
680
|
+
throw new Error('Missing LinkedIn access token');
|
|
681
|
+
}
|
|
682
|
+
const dataSource = {
|
|
683
|
+
type: types_1.DataSourceType.LinkedIn,
|
|
684
|
+
name: 'LinkedIn',
|
|
685
|
+
baseUrl: 'https://api.linkedin.com/v2',
|
|
686
|
+
accessToken: linkedinAccessToken,
|
|
687
|
+
personId: linkedinPersonId,
|
|
688
|
+
organizationId: linkedinOrganizationId
|
|
689
|
+
};
|
|
690
|
+
const parsedData = [{
|
|
691
|
+
tableName: 'linkedin_tools',
|
|
692
|
+
headers: ['tool', 'description'],
|
|
693
|
+
rows: [
|
|
694
|
+
['get_profile', 'Get profile by person ID'],
|
|
695
|
+
['get_organization', 'Get organization by ID'],
|
|
696
|
+
['list_connections', 'List connections (requires permissions)'],
|
|
697
|
+
['list_posts', 'List posts for a member or organization'],
|
|
698
|
+
['create_post', 'Create a post'],
|
|
699
|
+
['get_post', 'Get a post by ID'],
|
|
700
|
+
['search_people', 'Search people'],
|
|
701
|
+
['search_companies', 'Search companies']
|
|
702
|
+
],
|
|
703
|
+
metadata: {
|
|
704
|
+
rowCount: 8,
|
|
705
|
+
columnCount: 2,
|
|
706
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
707
|
+
}
|
|
708
|
+
}];
|
|
709
|
+
return res.json({
|
|
710
|
+
success: true,
|
|
711
|
+
data: {
|
|
712
|
+
dataSource,
|
|
713
|
+
parsedData
|
|
714
|
+
}
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
else if (type === types_1.DataSourceType.Reddit) {
|
|
718
|
+
const { redditAccessToken, redditUserAgent, redditSubreddit, redditUsername } = req.body;
|
|
719
|
+
if (!redditAccessToken) {
|
|
720
|
+
throw new Error('Missing Reddit access token');
|
|
721
|
+
}
|
|
722
|
+
const dataSource = {
|
|
723
|
+
type: types_1.DataSourceType.Reddit,
|
|
724
|
+
name: 'Reddit',
|
|
725
|
+
baseUrl: 'https://oauth.reddit.com',
|
|
726
|
+
accessToken: redditAccessToken,
|
|
727
|
+
userAgent: redditUserAgent,
|
|
728
|
+
subreddit: redditSubreddit,
|
|
729
|
+
username: redditUsername
|
|
730
|
+
};
|
|
731
|
+
const parsedData = [{
|
|
732
|
+
tableName: 'reddit_tools',
|
|
733
|
+
headers: ['tool', 'description'],
|
|
734
|
+
rows: [
|
|
735
|
+
['get_user', 'Get user profile'],
|
|
736
|
+
['get_subreddit', 'Get subreddit details'],
|
|
737
|
+
['list_hot', 'List hot posts in a subreddit'],
|
|
738
|
+
['list_new', 'List new posts in a subreddit'],
|
|
739
|
+
['search_posts', 'Search posts in a subreddit'],
|
|
740
|
+
['get_post', 'Get a post by ID'],
|
|
741
|
+
['create_post', 'Create a post'],
|
|
742
|
+
['add_comment', 'Add a comment to a post']
|
|
743
|
+
],
|
|
744
|
+
metadata: {
|
|
745
|
+
rowCount: 8,
|
|
746
|
+
columnCount: 2,
|
|
747
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
748
|
+
}
|
|
749
|
+
}];
|
|
750
|
+
return res.json({
|
|
751
|
+
success: true,
|
|
752
|
+
data: {
|
|
753
|
+
dataSource,
|
|
754
|
+
parsedData
|
|
755
|
+
}
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
else if (type === types_1.DataSourceType.YouTube) {
|
|
759
|
+
const { youtubeApiKey, youtubeAccessToken, youtubeChannelId } = req.body;
|
|
760
|
+
if (!youtubeApiKey) {
|
|
761
|
+
throw new Error('Missing YouTube API key');
|
|
762
|
+
}
|
|
763
|
+
const dataSource = {
|
|
764
|
+
type: types_1.DataSourceType.YouTube,
|
|
765
|
+
name: 'YouTube',
|
|
766
|
+
baseUrl: 'https://www.googleapis.com/youtube/v3',
|
|
767
|
+
apiKey: youtubeApiKey,
|
|
768
|
+
accessToken: youtubeAccessToken,
|
|
769
|
+
channelId: youtubeChannelId
|
|
770
|
+
};
|
|
771
|
+
const parsedData = [{
|
|
772
|
+
tableName: 'youtube_tools',
|
|
773
|
+
headers: ['tool', 'description'],
|
|
774
|
+
rows: [
|
|
775
|
+
['search', 'Search videos, channels, or playlists'],
|
|
776
|
+
['get_channel', 'Get channel details'],
|
|
777
|
+
['list_channel_videos', 'List recent channel videos'],
|
|
778
|
+
['list_playlists', 'List channel playlists'],
|
|
779
|
+
['list_playlist_items', 'List playlist items'],
|
|
780
|
+
['get_video', 'Get video details'],
|
|
781
|
+
['get_comments', 'List comments for a video'],
|
|
782
|
+
['post_comment', 'Post a comment on a video'],
|
|
783
|
+
['rate_video', 'Rate a video']
|
|
784
|
+
],
|
|
785
|
+
metadata: {
|
|
786
|
+
rowCount: 9,
|
|
787
|
+
columnCount: 2,
|
|
788
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
789
|
+
}
|
|
790
|
+
}];
|
|
791
|
+
return res.json({
|
|
792
|
+
success: true,
|
|
793
|
+
data: {
|
|
794
|
+
dataSource,
|
|
795
|
+
parsedData
|
|
796
|
+
}
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
else if (type === types_1.DataSourceType.WhatsAppBusiness) {
|
|
800
|
+
const { whatsappAccessToken, whatsappPhoneNumberId, whatsappBusinessAccountId } = req.body;
|
|
801
|
+
if (!whatsappAccessToken || !whatsappPhoneNumberId) {
|
|
802
|
+
throw new Error('Missing WhatsApp access token or phone number ID');
|
|
803
|
+
}
|
|
804
|
+
const dataSource = {
|
|
805
|
+
type: types_1.DataSourceType.WhatsAppBusiness,
|
|
806
|
+
name: 'WhatsApp Business',
|
|
807
|
+
baseUrl: 'https://graph.facebook.com/v19.0',
|
|
808
|
+
accessToken: whatsappAccessToken,
|
|
809
|
+
phoneNumberId: whatsappPhoneNumberId,
|
|
810
|
+
businessAccountId: whatsappBusinessAccountId
|
|
811
|
+
};
|
|
812
|
+
const parsedData = [{
|
|
813
|
+
tableName: 'whatsappbusiness_tools',
|
|
814
|
+
headers: ['tool', 'description'],
|
|
815
|
+
rows: [
|
|
816
|
+
['send_text_message', 'Send a text message'],
|
|
817
|
+
['send_template_message', 'Send a template message'],
|
|
818
|
+
['send_media_message', 'Send a media message'],
|
|
819
|
+
['get_message_templates', 'List message templates'],
|
|
820
|
+
['get_phone_numbers', 'List phone numbers'],
|
|
821
|
+
['get_business_profile', 'Get business profile'],
|
|
822
|
+
['set_business_profile', 'Update business profile']
|
|
823
|
+
],
|
|
824
|
+
metadata: {
|
|
825
|
+
rowCount: 7,
|
|
826
|
+
columnCount: 2,
|
|
827
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
828
|
+
}
|
|
829
|
+
}];
|
|
830
|
+
return res.json({
|
|
831
|
+
success: true,
|
|
832
|
+
data: {
|
|
833
|
+
dataSource,
|
|
834
|
+
parsedData
|
|
835
|
+
}
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
else if (type === types_1.DataSourceType.Threads) {
|
|
839
|
+
const { threadsAccessToken, threadsUserId } = req.body;
|
|
840
|
+
if (!threadsAccessToken) {
|
|
841
|
+
throw new Error('Missing Threads access token');
|
|
842
|
+
}
|
|
843
|
+
const dataSource = {
|
|
844
|
+
type: types_1.DataSourceType.Threads,
|
|
845
|
+
name: 'Threads',
|
|
846
|
+
baseUrl: 'https://graph.facebook.com/v19.0',
|
|
847
|
+
accessToken: threadsAccessToken,
|
|
848
|
+
userId: threadsUserId
|
|
849
|
+
};
|
|
850
|
+
const parsedData = [{
|
|
851
|
+
tableName: 'threads_tools',
|
|
852
|
+
headers: ['tool', 'description'],
|
|
853
|
+
rows: [
|
|
854
|
+
['get_user', 'Get Threads user profile'],
|
|
855
|
+
['list_threads', 'List user threads'],
|
|
856
|
+
['get_thread', 'Get a thread by ID'],
|
|
857
|
+
['create_thread', 'Create a thread'],
|
|
858
|
+
['delete_thread', 'Delete a thread'],
|
|
859
|
+
['get_thread_insights', 'Get thread insights']
|
|
860
|
+
],
|
|
861
|
+
metadata: {
|
|
862
|
+
rowCount: 6,
|
|
863
|
+
columnCount: 2,
|
|
864
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
865
|
+
}
|
|
866
|
+
}];
|
|
867
|
+
return res.json({
|
|
868
|
+
success: true,
|
|
869
|
+
data: {
|
|
870
|
+
dataSource,
|
|
871
|
+
parsedData
|
|
872
|
+
}
|
|
873
|
+
});
|
|
874
|
+
}
|
|
875
|
+
else if (type === types_1.DataSourceType.Spotify) {
|
|
876
|
+
const { spotifyBaseUrl, spotifyAccessToken } = req.body;
|
|
877
|
+
if (!spotifyBaseUrl || !spotifyAccessToken) {
|
|
878
|
+
throw new Error('Missing Spotify base URL or access token');
|
|
879
|
+
}
|
|
880
|
+
const dataSource = {
|
|
881
|
+
type: types_1.DataSourceType.Spotify,
|
|
882
|
+
name: 'Spotify',
|
|
883
|
+
baseUrl: spotifyBaseUrl,
|
|
884
|
+
accessToken: spotifyAccessToken
|
|
885
|
+
};
|
|
886
|
+
const parsedData = [{
|
|
887
|
+
tableName: 'spotify_tools',
|
|
888
|
+
headers: ['tool', 'description'],
|
|
889
|
+
rows: [
|
|
890
|
+
['search', 'Search tracks, artists, albums, playlists'],
|
|
891
|
+
['get_track', 'Get track details'],
|
|
892
|
+
['get_artist', 'Get artist details'],
|
|
893
|
+
['get_album', 'Get album details'],
|
|
894
|
+
['get_playlist', 'Get playlist details']
|
|
895
|
+
],
|
|
896
|
+
metadata: {
|
|
897
|
+
rowCount: 5,
|
|
898
|
+
columnCount: 2,
|
|
899
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
900
|
+
}
|
|
901
|
+
}];
|
|
902
|
+
return res.json({
|
|
903
|
+
success: true,
|
|
904
|
+
data: {
|
|
905
|
+
dataSource,
|
|
906
|
+
parsedData
|
|
907
|
+
}
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
else if (type === types_1.DataSourceType.Sonos) {
|
|
911
|
+
const { sonosBaseUrl, sonosAccessToken } = req.body;
|
|
912
|
+
if (!sonosBaseUrl || !sonosAccessToken) {
|
|
913
|
+
throw new Error('Missing Sonos base URL or access token');
|
|
914
|
+
}
|
|
915
|
+
const dataSource = {
|
|
916
|
+
type: types_1.DataSourceType.Sonos,
|
|
917
|
+
name: 'Sonos',
|
|
918
|
+
baseUrl: sonosBaseUrl,
|
|
919
|
+
accessToken: sonosAccessToken
|
|
920
|
+
};
|
|
921
|
+
const parsedData = [{
|
|
922
|
+
tableName: 'sonos_tools',
|
|
923
|
+
headers: ['tool', 'description'],
|
|
924
|
+
rows: [
|
|
925
|
+
['list_households', 'List households'],
|
|
926
|
+
['list_groups', 'List groups'],
|
|
927
|
+
['play', 'Start playback'],
|
|
928
|
+
['pause', 'Pause playback'],
|
|
929
|
+
['set_volume', 'Set group volume']
|
|
930
|
+
],
|
|
931
|
+
metadata: {
|
|
932
|
+
rowCount: 5,
|
|
933
|
+
columnCount: 2,
|
|
934
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
935
|
+
}
|
|
936
|
+
}];
|
|
937
|
+
return res.json({
|
|
938
|
+
success: true,
|
|
939
|
+
data: {
|
|
940
|
+
dataSource,
|
|
941
|
+
parsedData
|
|
942
|
+
}
|
|
943
|
+
});
|
|
944
|
+
}
|
|
945
|
+
else if (type === types_1.DataSourceType.Shazam) {
|
|
946
|
+
const { shazamBaseUrl, shazamApiKey, shazamApiHost } = req.body;
|
|
947
|
+
if (!shazamBaseUrl || !shazamApiKey) {
|
|
948
|
+
throw new Error('Missing Shazam base URL or API key');
|
|
949
|
+
}
|
|
950
|
+
const dataSource = {
|
|
951
|
+
type: types_1.DataSourceType.Shazam,
|
|
952
|
+
name: 'Shazam',
|
|
953
|
+
baseUrl: shazamBaseUrl,
|
|
954
|
+
apiKey: shazamApiKey,
|
|
955
|
+
apiHost: shazamApiHost
|
|
956
|
+
};
|
|
957
|
+
const parsedData = [{
|
|
958
|
+
tableName: 'shazam_tools',
|
|
959
|
+
headers: ['tool', 'description'],
|
|
960
|
+
rows: [
|
|
961
|
+
['search', 'Search tracks'],
|
|
962
|
+
['get_track', 'Get track details'],
|
|
963
|
+
['get_artist', 'Get artist details'],
|
|
964
|
+
['get_charts', 'Get charts']
|
|
965
|
+
],
|
|
966
|
+
metadata: {
|
|
967
|
+
rowCount: 4,
|
|
968
|
+
columnCount: 2,
|
|
969
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
970
|
+
}
|
|
971
|
+
}];
|
|
972
|
+
return res.json({
|
|
973
|
+
success: true,
|
|
974
|
+
data: {
|
|
975
|
+
dataSource,
|
|
976
|
+
parsedData
|
|
977
|
+
}
|
|
978
|
+
});
|
|
979
|
+
}
|
|
980
|
+
else if (type === types_1.DataSourceType.PhilipsHue) {
|
|
981
|
+
const { philipshueBaseUrl, philipshueAccessToken } = req.body;
|
|
982
|
+
if (!philipshueBaseUrl || !philipshueAccessToken) {
|
|
983
|
+
throw new Error('Missing Philips Hue base URL or access token');
|
|
984
|
+
}
|
|
985
|
+
const dataSource = {
|
|
986
|
+
type: types_1.DataSourceType.PhilipsHue,
|
|
987
|
+
name: 'Philips Hue',
|
|
988
|
+
baseUrl: philipshueBaseUrl,
|
|
989
|
+
accessToken: philipshueAccessToken
|
|
990
|
+
};
|
|
991
|
+
const parsedData = [{
|
|
992
|
+
tableName: 'philipshue_tools',
|
|
993
|
+
headers: ['tool', 'description'],
|
|
994
|
+
rows: [
|
|
995
|
+
['list_lights', 'List lights'],
|
|
996
|
+
['get_light', 'Get light details'],
|
|
997
|
+
['set_light_state', 'Set light state'],
|
|
998
|
+
['list_groups', 'List groups'],
|
|
999
|
+
['set_group_state', 'Set group state']
|
|
1000
|
+
],
|
|
1001
|
+
metadata: {
|
|
1002
|
+
rowCount: 5,
|
|
1003
|
+
columnCount: 2,
|
|
1004
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
1005
|
+
}
|
|
1006
|
+
}];
|
|
1007
|
+
return res.json({
|
|
1008
|
+
success: true,
|
|
1009
|
+
data: {
|
|
1010
|
+
dataSource,
|
|
1011
|
+
parsedData
|
|
1012
|
+
}
|
|
1013
|
+
});
|
|
1014
|
+
}
|
|
1015
|
+
else if (type === types_1.DataSourceType.EightSleep) {
|
|
1016
|
+
const { eightsleepBaseUrl, eightsleepAccessToken } = req.body;
|
|
1017
|
+
if (!eightsleepBaseUrl || !eightsleepAccessToken) {
|
|
1018
|
+
throw new Error('Missing 8Sleep base URL or access token');
|
|
1019
|
+
}
|
|
1020
|
+
const dataSource = {
|
|
1021
|
+
type: types_1.DataSourceType.EightSleep,
|
|
1022
|
+
name: '8Sleep',
|
|
1023
|
+
baseUrl: eightsleepBaseUrl,
|
|
1024
|
+
accessToken: eightsleepAccessToken
|
|
1025
|
+
};
|
|
1026
|
+
const parsedData = [{
|
|
1027
|
+
tableName: 'eightsleep_tools',
|
|
1028
|
+
headers: ['tool', 'description'],
|
|
1029
|
+
rows: [
|
|
1030
|
+
['get_user', 'Get current user'],
|
|
1031
|
+
['get_sessions', 'Get sleep sessions'],
|
|
1032
|
+
['get_trends', 'Get sleep trends'],
|
|
1033
|
+
['set_pod_temperature', 'Set pod temperature']
|
|
1034
|
+
],
|
|
1035
|
+
metadata: {
|
|
1036
|
+
rowCount: 4,
|
|
1037
|
+
columnCount: 2,
|
|
1038
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
1039
|
+
}
|
|
1040
|
+
}];
|
|
1041
|
+
return res.json({
|
|
1042
|
+
success: true,
|
|
1043
|
+
data: {
|
|
1044
|
+
dataSource,
|
|
1045
|
+
parsedData
|
|
1046
|
+
}
|
|
1047
|
+
});
|
|
1048
|
+
}
|
|
1049
|
+
else if (type === types_1.DataSourceType.HomeAssistant) {
|
|
1050
|
+
const { homeassistantBaseUrl, homeassistantAccessToken } = req.body;
|
|
1051
|
+
if (!homeassistantBaseUrl || !homeassistantAccessToken) {
|
|
1052
|
+
throw new Error('Missing Home Assistant base URL or access token');
|
|
1053
|
+
}
|
|
1054
|
+
const dataSource = {
|
|
1055
|
+
type: types_1.DataSourceType.HomeAssistant,
|
|
1056
|
+
name: 'Home Assistant',
|
|
1057
|
+
baseUrl: homeassistantBaseUrl,
|
|
1058
|
+
accessToken: homeassistantAccessToken
|
|
1059
|
+
};
|
|
1060
|
+
const parsedData = [{
|
|
1061
|
+
tableName: 'homeassistant_tools',
|
|
1062
|
+
headers: ['tool', 'description'],
|
|
1063
|
+
rows: [
|
|
1064
|
+
['get_states', 'List entity states'],
|
|
1065
|
+
['get_services', 'List available services'],
|
|
1066
|
+
['call_service', 'Call a service'],
|
|
1067
|
+
['get_config', 'Get configuration']
|
|
1068
|
+
],
|
|
1069
|
+
metadata: {
|
|
1070
|
+
rowCount: 4,
|
|
1071
|
+
columnCount: 2,
|
|
1072
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
1073
|
+
}
|
|
1074
|
+
}];
|
|
1075
|
+
return res.json({
|
|
1076
|
+
success: true,
|
|
1077
|
+
data: {
|
|
1078
|
+
dataSource,
|
|
1079
|
+
parsedData
|
|
1080
|
+
}
|
|
1081
|
+
});
|
|
1082
|
+
}
|
|
1083
|
+
else if (type === types_1.DataSourceType.AppleNotes) {
|
|
1084
|
+
const { applenotesBaseUrl, applenotesAccessToken } = req.body;
|
|
1085
|
+
if (!applenotesBaseUrl || !applenotesAccessToken) {
|
|
1086
|
+
throw new Error('Missing Apple Notes base URL or access token');
|
|
1087
|
+
}
|
|
1088
|
+
const dataSource = {
|
|
1089
|
+
type: types_1.DataSourceType.AppleNotes,
|
|
1090
|
+
name: 'Apple Notes',
|
|
1091
|
+
baseUrl: applenotesBaseUrl,
|
|
1092
|
+
accessToken: applenotesAccessToken
|
|
1093
|
+
};
|
|
1094
|
+
const parsedData = [{
|
|
1095
|
+
tableName: 'applenotes_tools',
|
|
1096
|
+
headers: ['tool', 'description'],
|
|
1097
|
+
rows: [
|
|
1098
|
+
['list_notes', 'List notes'],
|
|
1099
|
+
['get_note', 'Get a note'],
|
|
1100
|
+
['create_note', 'Create a note'],
|
|
1101
|
+
['update_note', 'Update a note'],
|
|
1102
|
+
['delete_note', 'Delete a note']
|
|
1103
|
+
],
|
|
1104
|
+
metadata: {
|
|
1105
|
+
rowCount: 5,
|
|
1106
|
+
columnCount: 2,
|
|
1107
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
1108
|
+
}
|
|
1109
|
+
}];
|
|
1110
|
+
return res.json({
|
|
1111
|
+
success: true,
|
|
1112
|
+
data: {
|
|
1113
|
+
dataSource,
|
|
1114
|
+
parsedData
|
|
1115
|
+
}
|
|
1116
|
+
});
|
|
1117
|
+
}
|
|
1118
|
+
else if (type === types_1.DataSourceType.AppleReminders) {
|
|
1119
|
+
const { appleremindersBaseUrl, appleremindersAccessToken } = req.body;
|
|
1120
|
+
if (!appleremindersBaseUrl || !appleremindersAccessToken) {
|
|
1121
|
+
throw new Error('Missing Apple Reminders base URL or access token');
|
|
1122
|
+
}
|
|
1123
|
+
const dataSource = {
|
|
1124
|
+
type: types_1.DataSourceType.AppleReminders,
|
|
1125
|
+
name: 'Apple Reminders',
|
|
1126
|
+
baseUrl: appleremindersBaseUrl,
|
|
1127
|
+
accessToken: appleremindersAccessToken
|
|
1128
|
+
};
|
|
1129
|
+
const parsedData = [{
|
|
1130
|
+
tableName: 'applereminders_tools',
|
|
1131
|
+
headers: ['tool', 'description'],
|
|
1132
|
+
rows: [
|
|
1133
|
+
['list_lists', 'List reminder lists'],
|
|
1134
|
+
['list_reminders', 'List reminders'],
|
|
1135
|
+
['create_reminder', 'Create a reminder'],
|
|
1136
|
+
['complete_reminder', 'Complete a reminder'],
|
|
1137
|
+
['delete_reminder', 'Delete a reminder']
|
|
1138
|
+
],
|
|
1139
|
+
metadata: {
|
|
1140
|
+
rowCount: 5,
|
|
1141
|
+
columnCount: 2,
|
|
1142
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
1143
|
+
}
|
|
1144
|
+
}];
|
|
1145
|
+
return res.json({
|
|
1146
|
+
success: true,
|
|
1147
|
+
data: {
|
|
1148
|
+
dataSource,
|
|
1149
|
+
parsedData
|
|
1150
|
+
}
|
|
1151
|
+
});
|
|
1152
|
+
}
|
|
1153
|
+
else if (type === types_1.DataSourceType.Things3) {
|
|
1154
|
+
const { things3BaseUrl, things3AccessToken } = req.body;
|
|
1155
|
+
if (!things3BaseUrl || !things3AccessToken) {
|
|
1156
|
+
throw new Error('Missing Things 3 base URL or access token');
|
|
1157
|
+
}
|
|
1158
|
+
const dataSource = {
|
|
1159
|
+
type: types_1.DataSourceType.Things3,
|
|
1160
|
+
name: 'Things 3',
|
|
1161
|
+
baseUrl: things3BaseUrl,
|
|
1162
|
+
accessToken: things3AccessToken
|
|
1163
|
+
};
|
|
1164
|
+
const parsedData = [{
|
|
1165
|
+
tableName: 'things3_tools',
|
|
1166
|
+
headers: ['tool', 'description'],
|
|
1167
|
+
rows: [
|
|
1168
|
+
['list_projects', 'List projects'],
|
|
1169
|
+
['list_areas', 'List areas'],
|
|
1170
|
+
['list_todos', 'List todos'],
|
|
1171
|
+
['create_todo', 'Create a todo'],
|
|
1172
|
+
['complete_todo', 'Complete a todo']
|
|
1173
|
+
],
|
|
1174
|
+
metadata: {
|
|
1175
|
+
rowCount: 5,
|
|
1176
|
+
columnCount: 2,
|
|
1177
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
1178
|
+
}
|
|
1179
|
+
}];
|
|
1180
|
+
return res.json({
|
|
1181
|
+
success: true,
|
|
1182
|
+
data: {
|
|
1183
|
+
dataSource,
|
|
1184
|
+
parsedData
|
|
1185
|
+
}
|
|
1186
|
+
});
|
|
1187
|
+
}
|
|
1188
|
+
else if (type === types_1.DataSourceType.Obsidian) {
|
|
1189
|
+
const { obsidianBaseUrl, obsidianAccessToken } = req.body;
|
|
1190
|
+
if (!obsidianBaseUrl || !obsidianAccessToken) {
|
|
1191
|
+
throw new Error('Missing Obsidian base URL or access token');
|
|
1192
|
+
}
|
|
1193
|
+
const dataSource = {
|
|
1194
|
+
type: types_1.DataSourceType.Obsidian,
|
|
1195
|
+
name: 'Obsidian',
|
|
1196
|
+
baseUrl: obsidianBaseUrl,
|
|
1197
|
+
accessToken: obsidianAccessToken
|
|
1198
|
+
};
|
|
1199
|
+
const parsedData = [{
|
|
1200
|
+
tableName: 'obsidian_tools',
|
|
1201
|
+
headers: ['tool', 'description'],
|
|
1202
|
+
rows: [
|
|
1203
|
+
['list_files', 'List files'],
|
|
1204
|
+
['get_file', 'Get a file'],
|
|
1205
|
+
['create_file', 'Create a file'],
|
|
1206
|
+
['update_file', 'Update a file'],
|
|
1207
|
+
['search', 'Search files']
|
|
1208
|
+
],
|
|
1209
|
+
metadata: {
|
|
1210
|
+
rowCount: 5,
|
|
1211
|
+
columnCount: 2,
|
|
1212
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
1213
|
+
}
|
|
1214
|
+
}];
|
|
1215
|
+
return res.json({
|
|
1216
|
+
success: true,
|
|
1217
|
+
data: {
|
|
1218
|
+
dataSource,
|
|
1219
|
+
parsedData
|
|
1220
|
+
}
|
|
1221
|
+
});
|
|
1222
|
+
}
|
|
1223
|
+
else if (type === types_1.DataSourceType.BearNotes) {
|
|
1224
|
+
const { bearnotesBaseUrl, bearnotesAccessToken } = req.body;
|
|
1225
|
+
if (!bearnotesBaseUrl || !bearnotesAccessToken) {
|
|
1226
|
+
throw new Error('Missing Bear Notes base URL or access token');
|
|
1227
|
+
}
|
|
1228
|
+
const dataSource = {
|
|
1229
|
+
type: types_1.DataSourceType.BearNotes,
|
|
1230
|
+
name: 'Bear Notes',
|
|
1231
|
+
baseUrl: bearnotesBaseUrl,
|
|
1232
|
+
accessToken: bearnotesAccessToken
|
|
1233
|
+
};
|
|
1234
|
+
const parsedData = [{
|
|
1235
|
+
tableName: 'bearnotes_tools',
|
|
1236
|
+
headers: ['tool', 'description'],
|
|
1237
|
+
rows: [
|
|
1238
|
+
['list_notes', 'List notes'],
|
|
1239
|
+
['get_note', 'Get a note'],
|
|
1240
|
+
['create_note', 'Create a note'],
|
|
1241
|
+
['update_note', 'Update a note'],
|
|
1242
|
+
['archive_note', 'Archive a note']
|
|
1243
|
+
],
|
|
1244
|
+
metadata: {
|
|
1245
|
+
rowCount: 5,
|
|
1246
|
+
columnCount: 2,
|
|
1247
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
1248
|
+
}
|
|
1249
|
+
}];
|
|
1250
|
+
return res.json({
|
|
1251
|
+
success: true,
|
|
1252
|
+
data: {
|
|
1253
|
+
dataSource,
|
|
1254
|
+
parsedData
|
|
1255
|
+
}
|
|
1256
|
+
});
|
|
1257
|
+
}
|
|
1258
|
+
else if (type === types_1.DataSourceType.IMessage) {
|
|
1259
|
+
const { imessageBaseUrl, imessageAccessToken } = req.body;
|
|
1260
|
+
if (!imessageBaseUrl || !imessageAccessToken) {
|
|
1261
|
+
throw new Error('Missing iMessage base URL or access token');
|
|
1262
|
+
}
|
|
1263
|
+
const dataSource = {
|
|
1264
|
+
type: types_1.DataSourceType.IMessage,
|
|
1265
|
+
name: 'iMessage',
|
|
1266
|
+
baseUrl: imessageBaseUrl,
|
|
1267
|
+
accessToken: imessageAccessToken
|
|
1268
|
+
};
|
|
1269
|
+
const parsedData = [{
|
|
1270
|
+
tableName: 'imessage_tools',
|
|
1271
|
+
headers: ['tool', 'description'],
|
|
1272
|
+
rows: [
|
|
1273
|
+
['list_chats', 'List chats'],
|
|
1274
|
+
['list_messages', 'List messages in a chat'],
|
|
1275
|
+
['get_message', 'Get a message'],
|
|
1276
|
+
['send_message', 'Send a message']
|
|
1277
|
+
],
|
|
1278
|
+
metadata: {
|
|
1279
|
+
rowCount: 4,
|
|
1280
|
+
columnCount: 2,
|
|
1281
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
1282
|
+
}
|
|
1283
|
+
}];
|
|
1284
|
+
return res.json({
|
|
1285
|
+
success: true,
|
|
1286
|
+
data: {
|
|
1287
|
+
dataSource,
|
|
1288
|
+
parsedData
|
|
1289
|
+
}
|
|
1290
|
+
});
|
|
1291
|
+
}
|
|
1292
|
+
else if (type === types_1.DataSourceType.Zoom) {
|
|
1293
|
+
const { zoomBaseUrl, zoomAccessToken } = req.body;
|
|
1294
|
+
if (!zoomBaseUrl || !zoomAccessToken) {
|
|
1295
|
+
throw new Error('Missing Zoom base URL or access token');
|
|
1296
|
+
}
|
|
1297
|
+
const dataSource = {
|
|
1298
|
+
type: types_1.DataSourceType.Zoom,
|
|
1299
|
+
name: 'Zoom',
|
|
1300
|
+
baseUrl: zoomBaseUrl,
|
|
1301
|
+
accessToken: zoomAccessToken
|
|
1302
|
+
};
|
|
1303
|
+
const parsedData = [{
|
|
1304
|
+
tableName: 'zoom_tools',
|
|
1305
|
+
headers: ['tool', 'description'],
|
|
1306
|
+
rows: [
|
|
1307
|
+
['list_users', 'List users'],
|
|
1308
|
+
['list_meetings', 'List meetings for a user'],
|
|
1309
|
+
['get_meeting', 'Get meeting details'],
|
|
1310
|
+
['create_meeting', 'Create a meeting'],
|
|
1311
|
+
['delete_meeting', 'Delete a meeting']
|
|
1312
|
+
],
|
|
1313
|
+
metadata: {
|
|
1314
|
+
rowCount: 5,
|
|
1315
|
+
columnCount: 2,
|
|
1316
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
1317
|
+
}
|
|
1318
|
+
}];
|
|
1319
|
+
return res.json({
|
|
1320
|
+
success: true,
|
|
1321
|
+
data: {
|
|
1322
|
+
dataSource,
|
|
1323
|
+
parsedData
|
|
1324
|
+
}
|
|
1325
|
+
});
|
|
1326
|
+
}
|
|
1327
|
+
else if (type === types_1.DataSourceType.MicrosoftTeams) {
|
|
1328
|
+
const { microsoftteamsBaseUrl, microsoftteamsAccessToken } = req.body;
|
|
1329
|
+
if (!microsoftteamsBaseUrl || !microsoftteamsAccessToken) {
|
|
1330
|
+
throw new Error('Missing Microsoft Teams base URL or access token');
|
|
1331
|
+
}
|
|
1332
|
+
const dataSource = {
|
|
1333
|
+
type: types_1.DataSourceType.MicrosoftTeams,
|
|
1334
|
+
name: 'Microsoft Teams',
|
|
1335
|
+
baseUrl: microsoftteamsBaseUrl,
|
|
1336
|
+
accessToken: microsoftteamsAccessToken
|
|
1337
|
+
};
|
|
1338
|
+
const parsedData = [{
|
|
1339
|
+
tableName: 'microsoftteams_tools',
|
|
1340
|
+
headers: ['tool', 'description'],
|
|
1341
|
+
rows: [
|
|
1342
|
+
['list_teams', 'List teams'],
|
|
1343
|
+
['list_channels', 'List channels in a team'],
|
|
1344
|
+
['list_messages', 'List channel messages'],
|
|
1345
|
+
['get_message', 'Get a message'],
|
|
1346
|
+
['send_message', 'Send a message']
|
|
1347
|
+
],
|
|
1348
|
+
metadata: {
|
|
1349
|
+
rowCount: 5,
|
|
1350
|
+
columnCount: 2,
|
|
1351
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
1352
|
+
}
|
|
1353
|
+
}];
|
|
1354
|
+
return res.json({
|
|
1355
|
+
success: true,
|
|
1356
|
+
data: {
|
|
1357
|
+
dataSource,
|
|
1358
|
+
parsedData
|
|
1359
|
+
}
|
|
1360
|
+
});
|
|
1361
|
+
}
|
|
1362
|
+
else if (type === types_1.DataSourceType.Signal) {
|
|
1363
|
+
const { signalBaseUrl, signalAccessToken } = req.body;
|
|
1364
|
+
if (!signalBaseUrl || !signalAccessToken) {
|
|
1365
|
+
throw new Error('Missing Signal base URL or access token');
|
|
1366
|
+
}
|
|
1367
|
+
const dataSource = {
|
|
1368
|
+
type: types_1.DataSourceType.Signal,
|
|
1369
|
+
name: 'Signal',
|
|
1370
|
+
baseUrl: signalBaseUrl,
|
|
1371
|
+
accessToken: signalAccessToken
|
|
1372
|
+
};
|
|
1373
|
+
const parsedData = [{
|
|
1374
|
+
tableName: 'signal_tools',
|
|
1375
|
+
headers: ['tool', 'description'],
|
|
1376
|
+
rows: [
|
|
1377
|
+
['list_groups', 'List groups'],
|
|
1378
|
+
['list_messages', 'List messages'],
|
|
1379
|
+
['get_message', 'Get a message'],
|
|
1380
|
+
['send_message', 'Send a message']
|
|
1381
|
+
],
|
|
1382
|
+
metadata: {
|
|
1383
|
+
rowCount: 4,
|
|
1384
|
+
columnCount: 2,
|
|
1385
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
1386
|
+
}
|
|
1387
|
+
}];
|
|
1388
|
+
return res.json({
|
|
1389
|
+
success: true,
|
|
1390
|
+
data: {
|
|
1391
|
+
dataSource,
|
|
1392
|
+
parsedData
|
|
1393
|
+
}
|
|
1394
|
+
});
|
|
1395
|
+
}
|
|
1396
|
+
else if (type === types_1.DataSourceType.OpenAI) {
|
|
1397
|
+
const { openaiApiKey, openaiModel } = req.body;
|
|
1398
|
+
if (!openaiApiKey) {
|
|
1399
|
+
throw new Error('Missing OpenAI API key');
|
|
1400
|
+
}
|
|
1401
|
+
const dataSource = {
|
|
1402
|
+
type: types_1.DataSourceType.OpenAI,
|
|
1403
|
+
name: 'OpenAI',
|
|
1404
|
+
baseUrl: 'https://api.openai.com/v1',
|
|
1405
|
+
apiKey: openaiApiKey,
|
|
1406
|
+
defaultModel: openaiModel || ''
|
|
1407
|
+
};
|
|
1408
|
+
const parsedData = [{
|
|
1409
|
+
tableName: 'openai_tools',
|
|
1410
|
+
headers: ['tool', 'description'],
|
|
1411
|
+
rows: [
|
|
1412
|
+
['chat', 'Create chat completions'],
|
|
1413
|
+
['embeddings', 'Create embeddings'],
|
|
1414
|
+
['moderations', 'Moderate text'],
|
|
1415
|
+
['images', 'Generate images'],
|
|
1416
|
+
['audio_speech', 'Text to speech'],
|
|
1417
|
+
['audio_transcriptions', 'Transcribe audio'],
|
|
1418
|
+
['audio_translations', 'Translate audio']
|
|
1419
|
+
],
|
|
1420
|
+
metadata: {
|
|
1421
|
+
rowCount: 7,
|
|
1422
|
+
columnCount: 2,
|
|
1423
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
1424
|
+
}
|
|
1425
|
+
}];
|
|
1426
|
+
return res.json({
|
|
1427
|
+
success: true,
|
|
1428
|
+
data: {
|
|
1429
|
+
dataSource,
|
|
1430
|
+
parsedData
|
|
1431
|
+
}
|
|
1432
|
+
});
|
|
1433
|
+
}
|
|
1434
|
+
else if (type === types_1.DataSourceType.Claude) {
|
|
1435
|
+
const { claudeApiKey, claudeApiVersion, claudeModel } = req.body;
|
|
1436
|
+
if (!claudeApiKey) {
|
|
1437
|
+
throw new Error('Missing Claude API key');
|
|
1438
|
+
}
|
|
1439
|
+
const dataSource = {
|
|
1440
|
+
type: types_1.DataSourceType.Claude,
|
|
1441
|
+
name: 'Claude',
|
|
1442
|
+
baseUrl: 'https://api.anthropic.com/v1',
|
|
1443
|
+
apiKey: claudeApiKey,
|
|
1444
|
+
apiVersion: claudeApiVersion || '2023-06-01',
|
|
1445
|
+
defaultModel: claudeModel || ''
|
|
1446
|
+
};
|
|
1447
|
+
const parsedData = [{
|
|
1448
|
+
tableName: 'claude_tools',
|
|
1449
|
+
headers: ['tool', 'description'],
|
|
1450
|
+
rows: [
|
|
1451
|
+
['chat', 'Create messages']
|
|
1452
|
+
],
|
|
1453
|
+
metadata: {
|
|
1454
|
+
rowCount: 1,
|
|
1455
|
+
columnCount: 2,
|
|
1456
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
1457
|
+
}
|
|
1458
|
+
}];
|
|
1459
|
+
return res.json({
|
|
1460
|
+
success: true,
|
|
1461
|
+
data: {
|
|
1462
|
+
dataSource,
|
|
1463
|
+
parsedData
|
|
1464
|
+
}
|
|
1465
|
+
});
|
|
1466
|
+
}
|
|
1467
|
+
else if (type === types_1.DataSourceType.Gemini) {
|
|
1468
|
+
const { geminiApiKey, geminiModel } = req.body;
|
|
1469
|
+
if (!geminiApiKey) {
|
|
1470
|
+
throw new Error('Missing Gemini API key');
|
|
1471
|
+
}
|
|
1472
|
+
const dataSource = {
|
|
1473
|
+
type: types_1.DataSourceType.Gemini,
|
|
1474
|
+
name: 'Gemini',
|
|
1475
|
+
baseUrl: 'https://generativelanguage.googleapis.com/v1beta',
|
|
1476
|
+
apiKey: geminiApiKey,
|
|
1477
|
+
defaultModel: geminiModel || ''
|
|
1478
|
+
};
|
|
1479
|
+
const parsedData = [{
|
|
1480
|
+
tableName: 'gemini_tools',
|
|
1481
|
+
headers: ['tool', 'description'],
|
|
1482
|
+
rows: [
|
|
1483
|
+
['chat', 'Generate content'],
|
|
1484
|
+
['embeddings', 'Create embeddings']
|
|
1485
|
+
],
|
|
1486
|
+
metadata: {
|
|
1487
|
+
rowCount: 2,
|
|
1488
|
+
columnCount: 2,
|
|
1489
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
1490
|
+
}
|
|
1491
|
+
}];
|
|
1492
|
+
return res.json({
|
|
1493
|
+
success: true,
|
|
1494
|
+
data: {
|
|
1495
|
+
dataSource,
|
|
1496
|
+
parsedData
|
|
1497
|
+
}
|
|
1498
|
+
});
|
|
1499
|
+
}
|
|
1500
|
+
else if (type === types_1.DataSourceType.Grok) {
|
|
1501
|
+
const { grokApiKey, grokModel } = req.body;
|
|
1502
|
+
if (!grokApiKey) {
|
|
1503
|
+
throw new Error('Missing Grok API key');
|
|
1504
|
+
}
|
|
1505
|
+
const dataSource = {
|
|
1506
|
+
type: types_1.DataSourceType.Grok,
|
|
1507
|
+
name: 'Grok',
|
|
1508
|
+
baseUrl: 'https://api.x.ai/v1',
|
|
1509
|
+
apiKey: grokApiKey,
|
|
1510
|
+
defaultModel: grokModel || ''
|
|
1511
|
+
};
|
|
1512
|
+
const parsedData = [{
|
|
1513
|
+
tableName: 'grok_tools',
|
|
1514
|
+
headers: ['tool', 'description'],
|
|
1515
|
+
rows: [
|
|
1516
|
+
['chat', 'Create chat completions'],
|
|
1517
|
+
['images', 'Generate images']
|
|
1518
|
+
],
|
|
1519
|
+
metadata: {
|
|
1520
|
+
rowCount: 2,
|
|
1521
|
+
columnCount: 2,
|
|
1522
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
1523
|
+
}
|
|
1524
|
+
}];
|
|
1525
|
+
return res.json({
|
|
1526
|
+
success: true,
|
|
1527
|
+
data: {
|
|
1528
|
+
dataSource,
|
|
1529
|
+
parsedData
|
|
1530
|
+
}
|
|
1531
|
+
});
|
|
1532
|
+
}
|
|
1533
|
+
else if (type === types_1.DataSourceType.FalAI) {
|
|
1534
|
+
const { falaiBaseUrl, falaiApiKey } = req.body;
|
|
1535
|
+
if (!falaiBaseUrl || !falaiApiKey) {
|
|
1536
|
+
throw new Error('Missing fal.ai base URL or API key');
|
|
1537
|
+
}
|
|
1538
|
+
const dataSource = {
|
|
1539
|
+
type: types_1.DataSourceType.FalAI,
|
|
1540
|
+
name: 'fal.ai',
|
|
1541
|
+
baseUrl: falaiBaseUrl,
|
|
1542
|
+
apiKey: falaiApiKey
|
|
1543
|
+
};
|
|
1544
|
+
const parsedData = [{
|
|
1545
|
+
tableName: 'falai_tools',
|
|
1546
|
+
headers: ['tool', 'description'],
|
|
1547
|
+
rows: [
|
|
1548
|
+
['run_model', 'Run a fal.ai model'],
|
|
1549
|
+
['run_model_async', 'Run a fal.ai model (async)'],
|
|
1550
|
+
['get_run_status', 'Get async run status'],
|
|
1551
|
+
['get_run_result', 'Get async run result'],
|
|
1552
|
+
['cancel_run', 'Cancel an async run']
|
|
1553
|
+
],
|
|
1554
|
+
metadata: {
|
|
1555
|
+
rowCount: 5,
|
|
1556
|
+
columnCount: 2,
|
|
1557
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
1558
|
+
}
|
|
1559
|
+
}];
|
|
1560
|
+
return res.json({
|
|
1561
|
+
success: true,
|
|
1562
|
+
data: {
|
|
1563
|
+
dataSource,
|
|
1564
|
+
parsedData
|
|
1565
|
+
}
|
|
1566
|
+
});
|
|
1567
|
+
}
|
|
1568
|
+
else if (type === types_1.DataSourceType.HuggingFace) {
|
|
1569
|
+
const { huggingfaceBaseUrl, huggingfaceApiKey, huggingfaceDefaultModel } = req.body;
|
|
1570
|
+
if (!huggingfaceBaseUrl || !huggingfaceApiKey) {
|
|
1571
|
+
throw new Error('Missing Hugging Face base URL or API key');
|
|
1572
|
+
}
|
|
1573
|
+
const dataSource = {
|
|
1574
|
+
type: types_1.DataSourceType.HuggingFace,
|
|
1575
|
+
name: 'Hugging Face',
|
|
1576
|
+
baseUrl: huggingfaceBaseUrl,
|
|
1577
|
+
apiKey: huggingfaceApiKey,
|
|
1578
|
+
defaultModel: huggingfaceDefaultModel || ''
|
|
1579
|
+
};
|
|
1580
|
+
const parsedData = [{
|
|
1581
|
+
tableName: 'huggingface_tools',
|
|
1582
|
+
headers: ['tool', 'description'],
|
|
1583
|
+
rows: [
|
|
1584
|
+
['chat_completion', 'Create chat completions']
|
|
1585
|
+
],
|
|
1586
|
+
metadata: {
|
|
1587
|
+
rowCount: 1,
|
|
1588
|
+
columnCount: 2,
|
|
1589
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
1590
|
+
}
|
|
1591
|
+
}];
|
|
1592
|
+
return res.json({
|
|
1593
|
+
success: true,
|
|
1594
|
+
data: {
|
|
1595
|
+
dataSource,
|
|
1596
|
+
parsedData
|
|
1597
|
+
}
|
|
1598
|
+
});
|
|
1599
|
+
}
|
|
1600
|
+
else if (type === types_1.DataSourceType.Llama) {
|
|
1601
|
+
const { llamaBaseUrl, llamaModel } = req.body;
|
|
1602
|
+
if (!llamaBaseUrl) {
|
|
1603
|
+
throw new Error('Missing Llama base URL');
|
|
1604
|
+
}
|
|
1605
|
+
const dataSource = {
|
|
1606
|
+
type: types_1.DataSourceType.Llama,
|
|
1607
|
+
name: 'Llama',
|
|
1608
|
+
baseUrl: llamaBaseUrl,
|
|
1609
|
+
defaultModel: llamaModel || ''
|
|
1610
|
+
};
|
|
1611
|
+
const parsedData = [{
|
|
1612
|
+
tableName: 'llama_tools',
|
|
1613
|
+
headers: ['tool', 'description'],
|
|
1614
|
+
rows: [
|
|
1615
|
+
['chat', 'Chat with model'],
|
|
1616
|
+
['generate', 'Generate text'],
|
|
1617
|
+
['embeddings', 'Create embeddings']
|
|
1618
|
+
],
|
|
1619
|
+
metadata: {
|
|
1620
|
+
rowCount: 3,
|
|
1621
|
+
columnCount: 2,
|
|
1622
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
1623
|
+
}
|
|
1624
|
+
}];
|
|
1625
|
+
return res.json({
|
|
1626
|
+
success: true,
|
|
1627
|
+
data: {
|
|
1628
|
+
dataSource,
|
|
1629
|
+
parsedData
|
|
1630
|
+
}
|
|
1631
|
+
});
|
|
1632
|
+
}
|
|
1633
|
+
else if (type === types_1.DataSourceType.DeepSeek) {
|
|
1634
|
+
const { deepseekBaseUrl, deepseekApiKey, deepseekModel } = req.body;
|
|
1635
|
+
if (!deepseekBaseUrl || !deepseekApiKey) {
|
|
1636
|
+
throw new Error('Missing DeepSeek base URL or API key');
|
|
1637
|
+
}
|
|
1638
|
+
const dataSource = {
|
|
1639
|
+
type: types_1.DataSourceType.DeepSeek,
|
|
1640
|
+
name: 'DeepSeek',
|
|
1641
|
+
baseUrl: deepseekBaseUrl,
|
|
1642
|
+
apiKey: deepseekApiKey,
|
|
1643
|
+
defaultModel: deepseekModel || ''
|
|
1644
|
+
};
|
|
1645
|
+
const parsedData = [{
|
|
1646
|
+
tableName: 'deepseek_tools',
|
|
1647
|
+
headers: ['tool', 'description'],
|
|
1648
|
+
rows: [
|
|
1649
|
+
['chat', 'Create chat completions'],
|
|
1650
|
+
['embeddings', 'Create embeddings']
|
|
1651
|
+
],
|
|
1652
|
+
metadata: {
|
|
1653
|
+
rowCount: 2,
|
|
1654
|
+
columnCount: 2,
|
|
1655
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
1656
|
+
}
|
|
1657
|
+
}];
|
|
1658
|
+
return res.json({
|
|
1659
|
+
success: true,
|
|
1660
|
+
data: {
|
|
1661
|
+
dataSource,
|
|
1662
|
+
parsedData
|
|
1663
|
+
}
|
|
1664
|
+
});
|
|
1665
|
+
}
|
|
1666
|
+
else if (type === types_1.DataSourceType.AzureOpenAI) {
|
|
1667
|
+
const { azureOpenAIBaseUrl, azureOpenAIApiKey, azureOpenAIApiVersion, azureOpenAIDeployment } = req.body;
|
|
1668
|
+
if (!azureOpenAIBaseUrl || !azureOpenAIApiKey || !azureOpenAIDeployment) {
|
|
1669
|
+
throw new Error('Missing Azure OpenAI base URL, API key, or deployment');
|
|
1670
|
+
}
|
|
1671
|
+
const dataSource = {
|
|
1672
|
+
type: types_1.DataSourceType.AzureOpenAI,
|
|
1673
|
+
name: 'Azure OpenAI',
|
|
1674
|
+
baseUrl: azureOpenAIBaseUrl,
|
|
1675
|
+
apiKey: azureOpenAIApiKey,
|
|
1676
|
+
apiVersion: azureOpenAIApiVersion || '2024-02-15-preview',
|
|
1677
|
+
deployment: azureOpenAIDeployment
|
|
1678
|
+
};
|
|
1679
|
+
const parsedData = [{
|
|
1680
|
+
tableName: 'azure_openai_tools',
|
|
1681
|
+
headers: ['tool', 'description'],
|
|
1682
|
+
rows: [
|
|
1683
|
+
['chat', 'Create chat completions'],
|
|
1684
|
+
['embeddings', 'Create embeddings']
|
|
1685
|
+
],
|
|
1686
|
+
metadata: {
|
|
1687
|
+
rowCount: 2,
|
|
1688
|
+
columnCount: 2,
|
|
1689
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
1690
|
+
}
|
|
1691
|
+
}];
|
|
1692
|
+
return res.json({
|
|
1693
|
+
success: true,
|
|
1694
|
+
data: { dataSource, parsedData }
|
|
1695
|
+
});
|
|
1696
|
+
}
|
|
1697
|
+
else if (type === types_1.DataSourceType.Mistral) {
|
|
1698
|
+
const { mistralBaseUrl, mistralApiKey, mistralModel } = req.body;
|
|
1699
|
+
if (!mistralBaseUrl || !mistralApiKey) {
|
|
1700
|
+
throw new Error('Missing Mistral base URL or API key');
|
|
1701
|
+
}
|
|
1702
|
+
const dataSource = {
|
|
1703
|
+
type: types_1.DataSourceType.Mistral,
|
|
1704
|
+
name: 'Mistral',
|
|
1705
|
+
baseUrl: mistralBaseUrl,
|
|
1706
|
+
apiKey: mistralApiKey,
|
|
1707
|
+
defaultModel: mistralModel || ''
|
|
1708
|
+
};
|
|
1709
|
+
const parsedData = [{
|
|
1710
|
+
tableName: 'mistral_tools',
|
|
1711
|
+
headers: ['tool', 'description'],
|
|
1712
|
+
rows: [
|
|
1713
|
+
['chat', 'Create chat completions'],
|
|
1714
|
+
['embeddings', 'Create embeddings']
|
|
1715
|
+
],
|
|
1716
|
+
metadata: {
|
|
1717
|
+
rowCount: 2,
|
|
1718
|
+
columnCount: 2,
|
|
1719
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
1720
|
+
}
|
|
1721
|
+
}];
|
|
1722
|
+
return res.json({
|
|
1723
|
+
success: true,
|
|
1724
|
+
data: { dataSource, parsedData }
|
|
1725
|
+
});
|
|
1726
|
+
}
|
|
1727
|
+
else if (type === types_1.DataSourceType.Cohere) {
|
|
1728
|
+
const { cohereBaseUrl, cohereApiKey, cohereModel } = req.body;
|
|
1729
|
+
if (!cohereBaseUrl || !cohereApiKey) {
|
|
1730
|
+
throw new Error('Missing Cohere base URL or API key');
|
|
1731
|
+
}
|
|
1732
|
+
const dataSource = {
|
|
1733
|
+
type: types_1.DataSourceType.Cohere,
|
|
1734
|
+
name: 'Cohere',
|
|
1735
|
+
baseUrl: cohereBaseUrl,
|
|
1736
|
+
apiKey: cohereApiKey,
|
|
1737
|
+
defaultModel: cohereModel || ''
|
|
1738
|
+
};
|
|
1739
|
+
const parsedData = [{
|
|
1740
|
+
tableName: 'cohere_tools',
|
|
1741
|
+
headers: ['tool', 'description'],
|
|
1742
|
+
rows: [
|
|
1743
|
+
['chat', 'Chat with Cohere'],
|
|
1744
|
+
['embeddings', 'Create embeddings']
|
|
1745
|
+
],
|
|
1746
|
+
metadata: {
|
|
1747
|
+
rowCount: 2,
|
|
1748
|
+
columnCount: 2,
|
|
1749
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
1750
|
+
}
|
|
1751
|
+
}];
|
|
1752
|
+
return res.json({
|
|
1753
|
+
success: true,
|
|
1754
|
+
data: { dataSource, parsedData }
|
|
1755
|
+
});
|
|
1756
|
+
}
|
|
1757
|
+
else if (type === types_1.DataSourceType.Perplexity) {
|
|
1758
|
+
const { perplexityBaseUrl, perplexityApiKey, perplexityModel } = req.body;
|
|
1759
|
+
if (!perplexityBaseUrl || !perplexityApiKey) {
|
|
1760
|
+
throw new Error('Missing Perplexity base URL or API key');
|
|
1761
|
+
}
|
|
1762
|
+
const dataSource = {
|
|
1763
|
+
type: types_1.DataSourceType.Perplexity,
|
|
1764
|
+
name: 'Perplexity',
|
|
1765
|
+
baseUrl: perplexityBaseUrl,
|
|
1766
|
+
apiKey: perplexityApiKey,
|
|
1767
|
+
defaultModel: perplexityModel || ''
|
|
1768
|
+
};
|
|
1769
|
+
const parsedData = [{
|
|
1770
|
+
tableName: 'perplexity_tools',
|
|
1771
|
+
headers: ['tool', 'description'],
|
|
1772
|
+
rows: [
|
|
1773
|
+
['chat', 'Create chat completions']
|
|
1774
|
+
],
|
|
1775
|
+
metadata: {
|
|
1776
|
+
rowCount: 1,
|
|
1777
|
+
columnCount: 2,
|
|
1778
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
1779
|
+
}
|
|
1780
|
+
}];
|
|
1781
|
+
return res.json({
|
|
1782
|
+
success: true,
|
|
1783
|
+
data: { dataSource, parsedData }
|
|
1784
|
+
});
|
|
1785
|
+
}
|
|
1786
|
+
else if (type === types_1.DataSourceType.Together) {
|
|
1787
|
+
const { togetherBaseUrl, togetherApiKey, togetherModel } = req.body;
|
|
1788
|
+
if (!togetherBaseUrl || !togetherApiKey) {
|
|
1789
|
+
throw new Error('Missing Together base URL or API key');
|
|
1790
|
+
}
|
|
1791
|
+
const dataSource = {
|
|
1792
|
+
type: types_1.DataSourceType.Together,
|
|
1793
|
+
name: 'Together',
|
|
1794
|
+
baseUrl: togetherBaseUrl,
|
|
1795
|
+
apiKey: togetherApiKey,
|
|
1796
|
+
defaultModel: togetherModel || ''
|
|
1797
|
+
};
|
|
1798
|
+
const parsedData = [{
|
|
1799
|
+
tableName: 'together_tools',
|
|
1800
|
+
headers: ['tool', 'description'],
|
|
1801
|
+
rows: [
|
|
1802
|
+
['chat', 'Create chat completions'],
|
|
1803
|
+
['embeddings', 'Create embeddings']
|
|
1804
|
+
],
|
|
1805
|
+
metadata: {
|
|
1806
|
+
rowCount: 2,
|
|
1807
|
+
columnCount: 2,
|
|
1808
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
1809
|
+
}
|
|
1810
|
+
}];
|
|
1811
|
+
return res.json({
|
|
1812
|
+
success: true,
|
|
1813
|
+
data: { dataSource, parsedData }
|
|
1814
|
+
});
|
|
1815
|
+
}
|
|
1816
|
+
else if (type === types_1.DataSourceType.Fireworks) {
|
|
1817
|
+
const { fireworksBaseUrl, fireworksApiKey, fireworksModel } = req.body;
|
|
1818
|
+
if (!fireworksBaseUrl || !fireworksApiKey) {
|
|
1819
|
+
throw new Error('Missing Fireworks base URL or API key');
|
|
1820
|
+
}
|
|
1821
|
+
const dataSource = {
|
|
1822
|
+
type: types_1.DataSourceType.Fireworks,
|
|
1823
|
+
name: 'Fireworks',
|
|
1824
|
+
baseUrl: fireworksBaseUrl,
|
|
1825
|
+
apiKey: fireworksApiKey,
|
|
1826
|
+
defaultModel: fireworksModel || ''
|
|
1827
|
+
};
|
|
1828
|
+
const parsedData = [{
|
|
1829
|
+
tableName: 'fireworks_tools',
|
|
1830
|
+
headers: ['tool', 'description'],
|
|
1831
|
+
rows: [
|
|
1832
|
+
['chat', 'Create chat completions'],
|
|
1833
|
+
['embeddings', 'Create embeddings']
|
|
1834
|
+
],
|
|
1835
|
+
metadata: {
|
|
1836
|
+
rowCount: 2,
|
|
1837
|
+
columnCount: 2,
|
|
1838
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
1839
|
+
}
|
|
1840
|
+
}];
|
|
1841
|
+
return res.json({
|
|
1842
|
+
success: true,
|
|
1843
|
+
data: { dataSource, parsedData }
|
|
1844
|
+
});
|
|
1845
|
+
}
|
|
1846
|
+
else if (type === types_1.DataSourceType.Groq) {
|
|
1847
|
+
const { groqBaseUrl, groqApiKey, groqModel } = req.body;
|
|
1848
|
+
if (!groqBaseUrl || !groqApiKey) {
|
|
1849
|
+
throw new Error('Missing Groq base URL or API key');
|
|
1850
|
+
}
|
|
1851
|
+
const dataSource = {
|
|
1852
|
+
type: types_1.DataSourceType.Groq,
|
|
1853
|
+
name: 'Groq',
|
|
1854
|
+
baseUrl: groqBaseUrl,
|
|
1855
|
+
apiKey: groqApiKey,
|
|
1856
|
+
defaultModel: groqModel || ''
|
|
1857
|
+
};
|
|
1858
|
+
const parsedData = [{
|
|
1859
|
+
tableName: 'groq_tools',
|
|
1860
|
+
headers: ['tool', 'description'],
|
|
1861
|
+
rows: [
|
|
1862
|
+
['chat', 'Create chat completions']
|
|
1863
|
+
],
|
|
1864
|
+
metadata: {
|
|
1865
|
+
rowCount: 1,
|
|
1866
|
+
columnCount: 2,
|
|
1867
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
1868
|
+
}
|
|
1869
|
+
}];
|
|
1870
|
+
return res.json({
|
|
1871
|
+
success: true,
|
|
1872
|
+
data: { dataSource, parsedData }
|
|
1873
|
+
});
|
|
1874
|
+
}
|
|
1875
|
+
else if (type === types_1.DataSourceType.OpenRouter) {
|
|
1876
|
+
const { openrouterBaseUrl, openrouterApiKey, openrouterModel } = req.body;
|
|
1877
|
+
if (!openrouterBaseUrl || !openrouterApiKey) {
|
|
1878
|
+
throw new Error('Missing OpenRouter base URL or API key');
|
|
1879
|
+
}
|
|
1880
|
+
const dataSource = {
|
|
1881
|
+
type: types_1.DataSourceType.OpenRouter,
|
|
1882
|
+
name: 'OpenRouter',
|
|
1883
|
+
baseUrl: openrouterBaseUrl,
|
|
1884
|
+
apiKey: openrouterApiKey,
|
|
1885
|
+
defaultModel: openrouterModel || ''
|
|
1886
|
+
};
|
|
1887
|
+
const parsedData = [{
|
|
1888
|
+
tableName: 'openrouter_tools',
|
|
1889
|
+
headers: ['tool', 'description'],
|
|
1890
|
+
rows: [
|
|
1891
|
+
['chat', 'Create chat completions']
|
|
1892
|
+
],
|
|
1893
|
+
metadata: {
|
|
1894
|
+
rowCount: 1,
|
|
1895
|
+
columnCount: 2,
|
|
1896
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
1897
|
+
}
|
|
1898
|
+
}];
|
|
1899
|
+
return res.json({
|
|
1900
|
+
success: true,
|
|
1901
|
+
data: { dataSource, parsedData }
|
|
1902
|
+
});
|
|
1903
|
+
}
|
|
1904
|
+
else if (type === types_1.DataSourceType.Dropbox) {
|
|
1905
|
+
const { dropboxBaseUrl, dropboxContentBaseUrl, dropboxAccessToken } = req.body;
|
|
1906
|
+
if (!dropboxBaseUrl || !dropboxAccessToken) {
|
|
1907
|
+
throw new Error('Missing Dropbox base URL or access token');
|
|
1908
|
+
}
|
|
1909
|
+
const dataSource = {
|
|
1910
|
+
type: types_1.DataSourceType.Dropbox,
|
|
1911
|
+
name: 'Dropbox',
|
|
1912
|
+
baseUrl: dropboxBaseUrl,
|
|
1913
|
+
contentBaseUrl: dropboxContentBaseUrl,
|
|
1914
|
+
accessToken: dropboxAccessToken
|
|
1915
|
+
};
|
|
1916
|
+
const parsedData = [{
|
|
1917
|
+
tableName: 'dropbox_tools',
|
|
1918
|
+
headers: ['tool', 'description'],
|
|
1919
|
+
rows: [
|
|
1920
|
+
['list_folder', 'List files/folders at a path'],
|
|
1921
|
+
['get_metadata', 'Get metadata for a file or folder'],
|
|
1922
|
+
['search', 'Search for files and folders'],
|
|
1923
|
+
['download', 'Download a file'],
|
|
1924
|
+
['upload', 'Upload a file']
|
|
1925
|
+
],
|
|
1926
|
+
metadata: {
|
|
1927
|
+
rowCount: 5,
|
|
1928
|
+
columnCount: 2,
|
|
1929
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
1930
|
+
}
|
|
1931
|
+
}];
|
|
1932
|
+
return res.json({
|
|
1933
|
+
success: true,
|
|
1934
|
+
data: {
|
|
1935
|
+
dataSource,
|
|
1936
|
+
parsedData
|
|
1937
|
+
}
|
|
1938
|
+
});
|
|
1939
|
+
}
|
|
1940
|
+
else if (type === types_1.DataSourceType.N8n) {
|
|
1941
|
+
const { n8nBaseUrl, n8nApiKey } = req.body;
|
|
1942
|
+
if (!n8nBaseUrl || !n8nApiKey) {
|
|
1943
|
+
throw new Error('Missing n8n base URL or API key');
|
|
1944
|
+
}
|
|
1945
|
+
const dataSource = {
|
|
1946
|
+
type: types_1.DataSourceType.N8n,
|
|
1947
|
+
name: 'n8n',
|
|
1948
|
+
baseUrl: n8nBaseUrl,
|
|
1949
|
+
apiKey: n8nApiKey
|
|
1950
|
+
};
|
|
1951
|
+
const parsedData = [{
|
|
1952
|
+
tableName: 'n8n_tools',
|
|
1953
|
+
headers: ['tool', 'description'],
|
|
1954
|
+
rows: [
|
|
1955
|
+
['list_workflows', 'List workflows'],
|
|
1956
|
+
['get_workflow', 'Get workflow details'],
|
|
1957
|
+
['activate_workflow', 'Activate a workflow'],
|
|
1958
|
+
['deactivate_workflow', 'Deactivate a workflow'],
|
|
1959
|
+
['list_executions', 'List executions']
|
|
1960
|
+
],
|
|
1961
|
+
metadata: {
|
|
1962
|
+
rowCount: 5,
|
|
1963
|
+
columnCount: 2,
|
|
1964
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
1965
|
+
}
|
|
1966
|
+
}];
|
|
1967
|
+
return res.json({
|
|
1968
|
+
success: true,
|
|
1969
|
+
data: {
|
|
1970
|
+
dataSource,
|
|
1971
|
+
parsedData
|
|
1972
|
+
}
|
|
1973
|
+
});
|
|
1974
|
+
}
|
|
1975
|
+
else if (type === types_1.DataSourceType.Supabase) {
|
|
1976
|
+
const { supabaseBaseUrl, supabaseApiKey } = req.body;
|
|
1977
|
+
if (!supabaseBaseUrl || !supabaseApiKey) {
|
|
1978
|
+
throw new Error('Missing Supabase base URL or API key');
|
|
1979
|
+
}
|
|
1980
|
+
const dataSource = {
|
|
1981
|
+
type: types_1.DataSourceType.Supabase,
|
|
1982
|
+
name: 'Supabase',
|
|
1983
|
+
baseUrl: supabaseBaseUrl,
|
|
1984
|
+
apiKey: supabaseApiKey
|
|
1985
|
+
};
|
|
1986
|
+
const parsedData = [{
|
|
1987
|
+
tableName: 'supabase_tools',
|
|
1988
|
+
headers: ['tool', 'description'],
|
|
1989
|
+
rows: [
|
|
1990
|
+
['select_rows', 'Select rows from a table'],
|
|
1991
|
+
['insert_row', 'Insert a row into a table'],
|
|
1992
|
+
['update_rows', 'Update rows in a table'],
|
|
1993
|
+
['delete_rows', 'Delete rows in a table']
|
|
1994
|
+
],
|
|
1995
|
+
metadata: {
|
|
1996
|
+
rowCount: 4,
|
|
1997
|
+
columnCount: 2,
|
|
1998
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
1999
|
+
}
|
|
2000
|
+
}];
|
|
2001
|
+
return res.json({
|
|
2002
|
+
success: true,
|
|
2003
|
+
data: {
|
|
2004
|
+
dataSource,
|
|
2005
|
+
parsedData
|
|
2006
|
+
}
|
|
2007
|
+
});
|
|
2008
|
+
}
|
|
2009
|
+
else if (type === types_1.DataSourceType.Npm) {
|
|
2010
|
+
const { npmBaseUrl } = req.body;
|
|
2011
|
+
if (!npmBaseUrl) {
|
|
2012
|
+
throw new Error('Missing npm base URL');
|
|
2013
|
+
}
|
|
2014
|
+
const dataSource = {
|
|
2015
|
+
type: types_1.DataSourceType.Npm,
|
|
2016
|
+
name: 'npm',
|
|
2017
|
+
baseUrl: npmBaseUrl
|
|
2018
|
+
};
|
|
2019
|
+
const parsedData = [{
|
|
2020
|
+
tableName: 'npm_tools',
|
|
2021
|
+
headers: ['tool', 'description'],
|
|
2022
|
+
rows: [
|
|
2023
|
+
['search', 'Search packages'],
|
|
2024
|
+
['get_package', 'Get package metadata'],
|
|
2025
|
+
['get_version', 'Get package version metadata']
|
|
2026
|
+
],
|
|
2027
|
+
metadata: {
|
|
2028
|
+
rowCount: 3,
|
|
2029
|
+
columnCount: 2,
|
|
2030
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
2031
|
+
}
|
|
2032
|
+
}];
|
|
2033
|
+
return res.json({
|
|
2034
|
+
success: true,
|
|
2035
|
+
data: {
|
|
2036
|
+
dataSource,
|
|
2037
|
+
parsedData
|
|
2038
|
+
}
|
|
2039
|
+
});
|
|
2040
|
+
}
|
|
2041
|
+
else if (type === types_1.DataSourceType.Nuget) {
|
|
2042
|
+
const { nugetBaseUrl, nugetRegistrationBaseUrl } = req.body;
|
|
2043
|
+
if (!nugetBaseUrl || !nugetRegistrationBaseUrl) {
|
|
2044
|
+
throw new Error('Missing NuGet base URLs');
|
|
2045
|
+
}
|
|
2046
|
+
const dataSource = {
|
|
2047
|
+
type: types_1.DataSourceType.Nuget,
|
|
2048
|
+
name: 'NuGet',
|
|
2049
|
+
baseUrl: nugetBaseUrl,
|
|
2050
|
+
registrationBaseUrl: nugetRegistrationBaseUrl
|
|
2051
|
+
};
|
|
2052
|
+
const parsedData = [{
|
|
2053
|
+
tableName: 'nuget_tools',
|
|
2054
|
+
headers: ['tool', 'description'],
|
|
2055
|
+
rows: [
|
|
2056
|
+
['search', 'Search packages'],
|
|
2057
|
+
['get_package', 'Get package metadata'],
|
|
2058
|
+
['get_versions', 'Get package versions']
|
|
2059
|
+
],
|
|
2060
|
+
metadata: {
|
|
2061
|
+
rowCount: 3,
|
|
2062
|
+
columnCount: 2,
|
|
2063
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
2064
|
+
}
|
|
2065
|
+
}];
|
|
2066
|
+
return res.json({
|
|
2067
|
+
success: true,
|
|
2068
|
+
data: {
|
|
2069
|
+
dataSource,
|
|
2070
|
+
parsedData
|
|
2071
|
+
}
|
|
2072
|
+
});
|
|
2073
|
+
}
|
|
2074
|
+
else if (type === types_1.DataSourceType.Maven) {
|
|
2075
|
+
const { mavenBaseUrl } = req.body;
|
|
2076
|
+
if (!mavenBaseUrl) {
|
|
2077
|
+
throw new Error('Missing Maven base URL');
|
|
2078
|
+
}
|
|
2079
|
+
const dataSource = {
|
|
2080
|
+
type: types_1.DataSourceType.Maven,
|
|
2081
|
+
name: 'Maven Central',
|
|
2082
|
+
baseUrl: mavenBaseUrl
|
|
2083
|
+
};
|
|
2084
|
+
const parsedData = [{
|
|
2085
|
+
tableName: 'maven_tools',
|
|
2086
|
+
headers: ['tool', 'description'],
|
|
2087
|
+
rows: [
|
|
2088
|
+
['search', 'Search artifacts']
|
|
2089
|
+
],
|
|
2090
|
+
metadata: {
|
|
2091
|
+
rowCount: 1,
|
|
2092
|
+
columnCount: 2,
|
|
2093
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
2094
|
+
}
|
|
2095
|
+
}];
|
|
2096
|
+
return res.json({
|
|
2097
|
+
success: true,
|
|
2098
|
+
data: {
|
|
2099
|
+
dataSource,
|
|
2100
|
+
parsedData
|
|
2101
|
+
}
|
|
2102
|
+
});
|
|
2103
|
+
}
|
|
2104
|
+
else if (type === types_1.DataSourceType.Gradle) {
|
|
2105
|
+
const { gradleBaseUrl } = req.body;
|
|
2106
|
+
if (!gradleBaseUrl) {
|
|
2107
|
+
throw new Error('Missing Gradle base URL');
|
|
2108
|
+
}
|
|
2109
|
+
const dataSource = {
|
|
2110
|
+
type: types_1.DataSourceType.Gradle,
|
|
2111
|
+
name: 'Gradle',
|
|
2112
|
+
baseUrl: gradleBaseUrl
|
|
2113
|
+
};
|
|
2114
|
+
const parsedData = [{
|
|
2115
|
+
tableName: 'gradle_tools',
|
|
2116
|
+
headers: ['tool', 'description'],
|
|
2117
|
+
rows: [
|
|
2118
|
+
['search_plugins', 'Search plugins'],
|
|
2119
|
+
['get_plugin_versions', 'Get plugin versions']
|
|
2120
|
+
],
|
|
2121
|
+
metadata: {
|
|
2122
|
+
rowCount: 2,
|
|
2123
|
+
columnCount: 2,
|
|
2124
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
2125
|
+
}
|
|
2126
|
+
}];
|
|
2127
|
+
return res.json({
|
|
2128
|
+
success: true,
|
|
2129
|
+
data: {
|
|
2130
|
+
dataSource,
|
|
2131
|
+
parsedData
|
|
2132
|
+
}
|
|
2133
|
+
});
|
|
2134
|
+
}
|
|
2135
|
+
else if (type === types_1.DataSourceType.Nexus) {
|
|
2136
|
+
const { nexusBaseUrl, nexusApiKey, nexusUsername, nexusPassword } = req.body;
|
|
2137
|
+
if (!nexusBaseUrl || (!nexusApiKey && !(nexusUsername && nexusPassword))) {
|
|
2138
|
+
throw new Error('Missing Nexus base URL or credentials');
|
|
2139
|
+
}
|
|
2140
|
+
const dataSource = {
|
|
2141
|
+
type: types_1.DataSourceType.Nexus,
|
|
2142
|
+
name: 'Nexus',
|
|
2143
|
+
baseUrl: nexusBaseUrl,
|
|
2144
|
+
apiKey: nexusApiKey,
|
|
2145
|
+
username: nexusUsername,
|
|
2146
|
+
password: nexusPassword
|
|
2147
|
+
};
|
|
2148
|
+
const parsedData = [{
|
|
2149
|
+
tableName: 'nexus_tools',
|
|
2150
|
+
headers: ['tool', 'description'],
|
|
2151
|
+
rows: [
|
|
2152
|
+
['list_repositories', 'List repositories'],
|
|
2153
|
+
['list_components', 'List components'],
|
|
2154
|
+
['search', 'Search components']
|
|
2155
|
+
],
|
|
2156
|
+
metadata: {
|
|
2157
|
+
rowCount: 3,
|
|
2158
|
+
columnCount: 2,
|
|
2159
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
2160
|
+
}
|
|
2161
|
+
}];
|
|
2162
|
+
return res.json({
|
|
2163
|
+
success: true,
|
|
2164
|
+
data: {
|
|
2165
|
+
dataSource,
|
|
2166
|
+
parsedData
|
|
2167
|
+
}
|
|
2168
|
+
});
|
|
2169
|
+
}
|
|
2170
|
+
else if (type === types_1.DataSourceType.Trello) {
|
|
2171
|
+
const { trelloBaseUrl, trelloApiKey, trelloApiToken, trelloMemberId, trelloBoardId, trelloListId } = req.body;
|
|
2172
|
+
if (!trelloBaseUrl || !trelloApiKey || !trelloApiToken) {
|
|
2173
|
+
throw new Error('Missing Trello base URL, API key, or token');
|
|
2174
|
+
}
|
|
2175
|
+
const dataSource = {
|
|
2176
|
+
type: types_1.DataSourceType.Trello,
|
|
2177
|
+
name: 'Trello',
|
|
2178
|
+
baseUrl: trelloBaseUrl,
|
|
2179
|
+
apiKey: trelloApiKey,
|
|
2180
|
+
apiToken: trelloApiToken,
|
|
2181
|
+
memberId: trelloMemberId,
|
|
2182
|
+
boardId: trelloBoardId,
|
|
2183
|
+
listId: trelloListId
|
|
2184
|
+
};
|
|
2185
|
+
const parsedData = [{
|
|
2186
|
+
tableName: 'trello_tools',
|
|
2187
|
+
headers: ['tool', 'description'],
|
|
2188
|
+
rows: [
|
|
2189
|
+
['get_member', 'Get member details'],
|
|
2190
|
+
['list_boards', 'List boards for a member'],
|
|
2191
|
+
['get_board', 'Get board by ID'],
|
|
2192
|
+
['list_lists', 'List lists on a board'],
|
|
2193
|
+
['list_cards', 'List cards on a list'],
|
|
2194
|
+
['get_card', 'Get card by ID'],
|
|
2195
|
+
['create_card', 'Create a card in a list']
|
|
2196
|
+
],
|
|
2197
|
+
metadata: {
|
|
2198
|
+
rowCount: 7,
|
|
2199
|
+
columnCount: 2,
|
|
2200
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
2201
|
+
}
|
|
2202
|
+
}];
|
|
2203
|
+
return res.json({
|
|
2204
|
+
success: true,
|
|
2205
|
+
data: {
|
|
2206
|
+
dataSource,
|
|
2207
|
+
parsedData
|
|
2208
|
+
}
|
|
2209
|
+
});
|
|
2210
|
+
}
|
|
2211
|
+
else if (type === types_1.DataSourceType.GitLab) {
|
|
2212
|
+
const { gitlabBaseUrl, gitlabToken, gitlabProjectId } = req.body;
|
|
2213
|
+
if (!gitlabBaseUrl || !gitlabToken) {
|
|
2214
|
+
throw new Error('Missing GitLab base URL or token');
|
|
2215
|
+
}
|
|
2216
|
+
const dataSource = {
|
|
2217
|
+
type: types_1.DataSourceType.GitLab,
|
|
2218
|
+
name: 'GitLab',
|
|
2219
|
+
baseUrl: gitlabBaseUrl,
|
|
2220
|
+
token: gitlabToken,
|
|
2221
|
+
projectId: gitlabProjectId
|
|
2222
|
+
};
|
|
2223
|
+
const parsedData = [{
|
|
2224
|
+
tableName: 'gitlab_tools',
|
|
2225
|
+
headers: ['tool', 'description'],
|
|
2226
|
+
rows: [
|
|
2227
|
+
['list_projects', 'List projects for the authenticated user'],
|
|
2228
|
+
['get_project', 'Get a project by ID or path'],
|
|
2229
|
+
['list_issues', 'List issues for a project'],
|
|
2230
|
+
['create_issue', 'Create an issue in a project'],
|
|
2231
|
+
['list_merge_requests', 'List merge requests for a project'],
|
|
2232
|
+
['get_file', 'Get file contents from repository']
|
|
2233
|
+
],
|
|
2234
|
+
metadata: {
|
|
2235
|
+
rowCount: 6,
|
|
2236
|
+
columnCount: 2,
|
|
2237
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
2238
|
+
}
|
|
2239
|
+
}];
|
|
2240
|
+
return res.json({
|
|
2241
|
+
success: true,
|
|
2242
|
+
data: {
|
|
2243
|
+
dataSource,
|
|
2244
|
+
parsedData
|
|
2245
|
+
}
|
|
2246
|
+
});
|
|
2247
|
+
}
|
|
2248
|
+
else if (type === types_1.DataSourceType.Bitbucket) {
|
|
2249
|
+
const { bitbucketBaseUrl, bitbucketUsername, bitbucketAppPassword, bitbucketWorkspace, bitbucketRepoSlug } = req.body;
|
|
2250
|
+
if (!bitbucketBaseUrl || !bitbucketUsername || !bitbucketAppPassword) {
|
|
2251
|
+
throw new Error('Missing Bitbucket base URL, username, or app password');
|
|
2252
|
+
}
|
|
2253
|
+
const dataSource = {
|
|
2254
|
+
type: types_1.DataSourceType.Bitbucket,
|
|
2255
|
+
name: 'Bitbucket',
|
|
2256
|
+
baseUrl: bitbucketBaseUrl,
|
|
2257
|
+
username: bitbucketUsername,
|
|
2258
|
+
appPassword: bitbucketAppPassword,
|
|
2259
|
+
workspace: bitbucketWorkspace,
|
|
2260
|
+
repoSlug: bitbucketRepoSlug
|
|
2261
|
+
};
|
|
2262
|
+
const parsedData = [{
|
|
2263
|
+
tableName: 'bitbucket_tools',
|
|
2264
|
+
headers: ['tool', 'description'],
|
|
2265
|
+
rows: [
|
|
2266
|
+
['list_repos', 'List repositories in a workspace'],
|
|
2267
|
+
['get_repo', 'Get repository details'],
|
|
2268
|
+
['list_issues', 'List issues for a repository'],
|
|
2269
|
+
['create_issue', 'Create an issue in a repository'],
|
|
2270
|
+
['list_pull_requests', 'List pull requests for a repository'],
|
|
2271
|
+
['get_file', 'Get file contents from repository']
|
|
2272
|
+
],
|
|
2273
|
+
metadata: {
|
|
2274
|
+
rowCount: 6,
|
|
2275
|
+
columnCount: 2,
|
|
2276
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
2277
|
+
}
|
|
2278
|
+
}];
|
|
2279
|
+
return res.json({
|
|
2280
|
+
success: true,
|
|
2281
|
+
data: {
|
|
2282
|
+
dataSource,
|
|
2283
|
+
parsedData
|
|
2284
|
+
}
|
|
2285
|
+
});
|
|
2286
|
+
}
|
|
2287
|
+
else if (type === types_1.DataSourceType.GDrive) {
|
|
2288
|
+
const { gdriveBaseUrl, gdriveAccessToken, gdriveRootFolderId } = req.body;
|
|
2289
|
+
if (!gdriveBaseUrl || !gdriveAccessToken) {
|
|
2290
|
+
throw new Error('Missing Google Drive base URL or access token');
|
|
2291
|
+
}
|
|
2292
|
+
const dataSource = {
|
|
2293
|
+
type: types_1.DataSourceType.GDrive,
|
|
2294
|
+
name: 'Google Drive',
|
|
2295
|
+
baseUrl: gdriveBaseUrl,
|
|
2296
|
+
accessToken: gdriveAccessToken,
|
|
2297
|
+
rootFolderId: gdriveRootFolderId
|
|
2298
|
+
};
|
|
2299
|
+
const parsedData = [{
|
|
2300
|
+
tableName: 'gdrive_tools',
|
|
2301
|
+
headers: ['tool', 'description'],
|
|
2302
|
+
rows: [
|
|
2303
|
+
['list_files', 'List files in a folder'],
|
|
2304
|
+
['get_file', 'Get file metadata by ID'],
|
|
2305
|
+
['download_file', 'Download file content'],
|
|
2306
|
+
['upload_file', 'Upload a file'],
|
|
2307
|
+
['create_folder', 'Create a folder']
|
|
2308
|
+
],
|
|
2309
|
+
metadata: {
|
|
2310
|
+
rowCount: 5,
|
|
2311
|
+
columnCount: 2,
|
|
2312
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
2313
|
+
}
|
|
2314
|
+
}];
|
|
2315
|
+
return res.json({
|
|
2316
|
+
success: true,
|
|
2317
|
+
data: {
|
|
2318
|
+
dataSource,
|
|
2319
|
+
parsedData
|
|
2320
|
+
}
|
|
2321
|
+
});
|
|
2322
|
+
}
|
|
2323
|
+
else if (type === types_1.DataSourceType.GoogleCalendar) {
|
|
2324
|
+
const { gcalBaseUrl, gcalAccessToken, gcalCalendarId } = req.body;
|
|
2325
|
+
if (!gcalBaseUrl || !gcalAccessToken) {
|
|
2326
|
+
throw new Error('Missing Google Calendar base URL or access token');
|
|
2327
|
+
}
|
|
2328
|
+
const dataSource = {
|
|
2329
|
+
type: types_1.DataSourceType.GoogleCalendar,
|
|
2330
|
+
name: 'Google Calendar',
|
|
2331
|
+
baseUrl: gcalBaseUrl,
|
|
2332
|
+
accessToken: gcalAccessToken,
|
|
2333
|
+
calendarId: gcalCalendarId
|
|
2334
|
+
};
|
|
2335
|
+
const parsedData = [{
|
|
2336
|
+
tableName: 'googlecalendar_tools',
|
|
2337
|
+
headers: ['tool', 'description'],
|
|
2338
|
+
rows: [
|
|
2339
|
+
['list_calendars', 'List calendars for the user'],
|
|
2340
|
+
['list_events', 'List events in a calendar'],
|
|
2341
|
+
['get_event', 'Get event details'],
|
|
2342
|
+
['create_event', 'Create a calendar event'],
|
|
2343
|
+
['update_event', 'Update a calendar event']
|
|
2344
|
+
],
|
|
2345
|
+
metadata: {
|
|
2346
|
+
rowCount: 5,
|
|
2347
|
+
columnCount: 2,
|
|
2348
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
2349
|
+
}
|
|
2350
|
+
}];
|
|
2351
|
+
return res.json({
|
|
2352
|
+
success: true,
|
|
2353
|
+
data: {
|
|
2354
|
+
dataSource,
|
|
2355
|
+
parsedData
|
|
2356
|
+
}
|
|
2357
|
+
});
|
|
2358
|
+
}
|
|
2359
|
+
else if (type === types_1.DataSourceType.GoogleDocs) {
|
|
2360
|
+
const { gdocsBaseUrl, gdocsAccessToken, gdocsDocumentId } = req.body;
|
|
2361
|
+
if (!gdocsBaseUrl || !gdocsAccessToken) {
|
|
2362
|
+
throw new Error('Missing Google Docs base URL or access token');
|
|
2363
|
+
}
|
|
2364
|
+
const dataSource = {
|
|
2365
|
+
type: types_1.DataSourceType.GoogleDocs,
|
|
2366
|
+
name: 'Google Docs',
|
|
2367
|
+
baseUrl: gdocsBaseUrl,
|
|
2368
|
+
accessToken: gdocsAccessToken,
|
|
2369
|
+
documentId: gdocsDocumentId
|
|
2370
|
+
};
|
|
2371
|
+
const parsedData = [{
|
|
2372
|
+
tableName: 'googledocs_tools',
|
|
2373
|
+
headers: ['tool', 'description'],
|
|
2374
|
+
rows: [
|
|
2375
|
+
['get_document', 'Get document content'],
|
|
2376
|
+
['create_document', 'Create a new document'],
|
|
2377
|
+
['batch_update', 'Batch update a document']
|
|
2378
|
+
],
|
|
2379
|
+
metadata: {
|
|
2380
|
+
rowCount: 3,
|
|
2381
|
+
columnCount: 2,
|
|
2382
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
2383
|
+
}
|
|
2384
|
+
}];
|
|
2385
|
+
return res.json({
|
|
2386
|
+
success: true,
|
|
2387
|
+
data: {
|
|
2388
|
+
dataSource,
|
|
2389
|
+
parsedData
|
|
2390
|
+
}
|
|
2391
|
+
});
|
|
2392
|
+
}
|
|
2393
|
+
else if (type === types_1.DataSourceType.GoogleSheets) {
|
|
2394
|
+
const { sheetsBaseUrl, sheetsAccessToken, sheetsSpreadsheetId } = req.body;
|
|
2395
|
+
if (!sheetsBaseUrl || !sheetsAccessToken) {
|
|
2396
|
+
throw new Error('Missing Google Sheets base URL or access token');
|
|
2397
|
+
}
|
|
2398
|
+
const dataSource = {
|
|
2399
|
+
type: types_1.DataSourceType.GoogleSheets,
|
|
2400
|
+
name: 'Google Sheets',
|
|
2401
|
+
baseUrl: sheetsBaseUrl,
|
|
2402
|
+
accessToken: sheetsAccessToken,
|
|
2403
|
+
spreadsheetId: sheetsSpreadsheetId
|
|
2404
|
+
};
|
|
2405
|
+
const parsedData = [{
|
|
2406
|
+
tableName: 'googlesheets_tools',
|
|
2407
|
+
headers: ['tool', 'description'],
|
|
2408
|
+
rows: [
|
|
2409
|
+
['get_spreadsheet', 'Get spreadsheet metadata'],
|
|
2410
|
+
['get_values', 'Get values from a range'],
|
|
2411
|
+
['update_values', 'Update values in a range'],
|
|
2412
|
+
['append_values', 'Append values to a range'],
|
|
2413
|
+
['create_spreadsheet', 'Create a new spreadsheet']
|
|
2414
|
+
],
|
|
2415
|
+
metadata: {
|
|
2416
|
+
rowCount: 5,
|
|
2417
|
+
columnCount: 2,
|
|
2418
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
2419
|
+
}
|
|
2420
|
+
}];
|
|
2421
|
+
return res.json({
|
|
2422
|
+
success: true,
|
|
2423
|
+
data: {
|
|
2424
|
+
dataSource,
|
|
2425
|
+
parsedData
|
|
2426
|
+
}
|
|
2427
|
+
});
|
|
2428
|
+
}
|
|
2429
|
+
else if (type === types_1.DataSourceType.Airtable) {
|
|
2430
|
+
const { airtableBaseUrl, airtableAccessToken, airtableBaseId, airtableTableName } = req.body;
|
|
2431
|
+
if (!airtableBaseUrl || !airtableAccessToken) {
|
|
2432
|
+
throw new Error('Missing Airtable base URL or access token');
|
|
2433
|
+
}
|
|
2434
|
+
const dataSource = {
|
|
2435
|
+
type: types_1.DataSourceType.Airtable,
|
|
2436
|
+
name: 'Airtable',
|
|
2437
|
+
baseUrl: airtableBaseUrl,
|
|
2438
|
+
accessToken: airtableAccessToken,
|
|
2439
|
+
baseId: airtableBaseId,
|
|
2440
|
+
tableName: airtableTableName
|
|
2441
|
+
};
|
|
2442
|
+
const parsedData = [{
|
|
2443
|
+
tableName: 'airtable_tools',
|
|
2444
|
+
headers: ['tool', 'description'],
|
|
2445
|
+
rows: [
|
|
2446
|
+
['list_records', 'List records in a table'],
|
|
2447
|
+
['get_record', 'Get a record by ID'],
|
|
2448
|
+
['create_record', 'Create a record'],
|
|
2449
|
+
['update_record', 'Update a record'],
|
|
2450
|
+
['delete_record', 'Delete a record']
|
|
2451
|
+
],
|
|
2452
|
+
metadata: {
|
|
2453
|
+
rowCount: 5,
|
|
2454
|
+
columnCount: 2,
|
|
2455
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
2456
|
+
}
|
|
2457
|
+
}];
|
|
2458
|
+
return res.json({
|
|
2459
|
+
success: true,
|
|
2460
|
+
data: {
|
|
2461
|
+
dataSource,
|
|
2462
|
+
parsedData
|
|
2463
|
+
}
|
|
2464
|
+
});
|
|
2465
|
+
}
|
|
2466
|
+
else if (type === types_1.DataSourceType.Asana) {
|
|
2467
|
+
const { asanaBaseUrl, asanaAccessToken, asanaWorkspaceId } = req.body;
|
|
2468
|
+
if (!asanaBaseUrl || !asanaAccessToken) {
|
|
2469
|
+
throw new Error('Missing Asana base URL or access token');
|
|
2470
|
+
}
|
|
2471
|
+
const dataSource = {
|
|
2472
|
+
type: types_1.DataSourceType.Asana,
|
|
2473
|
+
name: 'Asana',
|
|
2474
|
+
baseUrl: asanaBaseUrl,
|
|
2475
|
+
accessToken: asanaAccessToken,
|
|
2476
|
+
workspaceId: asanaWorkspaceId
|
|
2477
|
+
};
|
|
2478
|
+
const parsedData = [{
|
|
2479
|
+
tableName: 'asana_tools',
|
|
2480
|
+
headers: ['tool', 'description'],
|
|
2481
|
+
rows: [
|
|
2482
|
+
['list_projects', 'List projects in a workspace'],
|
|
2483
|
+
['list_tasks', 'List tasks in a project'],
|
|
2484
|
+
['get_task', 'Get a task by ID'],
|
|
2485
|
+
['create_task', 'Create a task'],
|
|
2486
|
+
['update_task', 'Update a task']
|
|
2487
|
+
],
|
|
2488
|
+
metadata: {
|
|
2489
|
+
rowCount: 5,
|
|
2490
|
+
columnCount: 2,
|
|
2491
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
2492
|
+
}
|
|
2493
|
+
}];
|
|
2494
|
+
return res.json({
|
|
2495
|
+
success: true,
|
|
2496
|
+
data: {
|
|
2497
|
+
dataSource,
|
|
2498
|
+
parsedData
|
|
2499
|
+
}
|
|
2500
|
+
});
|
|
2501
|
+
}
|
|
2502
|
+
else if (type === types_1.DataSourceType.Monday) {
|
|
2503
|
+
const { mondayBaseUrl, mondayApiKey } = req.body;
|
|
2504
|
+
if (!mondayBaseUrl || !mondayApiKey) {
|
|
2505
|
+
throw new Error('Missing Monday base URL or API key');
|
|
2506
|
+
}
|
|
2507
|
+
const dataSource = {
|
|
2508
|
+
type: types_1.DataSourceType.Monday,
|
|
2509
|
+
name: 'Monday.com',
|
|
2510
|
+
baseUrl: mondayBaseUrl,
|
|
2511
|
+
apiKey: mondayApiKey
|
|
2512
|
+
};
|
|
2513
|
+
const parsedData = [{
|
|
2514
|
+
tableName: 'monday_tools',
|
|
2515
|
+
headers: ['tool', 'description'],
|
|
2516
|
+
rows: [
|
|
2517
|
+
['query', 'Run a GraphQL query'],
|
|
2518
|
+
['mutate', 'Run a GraphQL mutation']
|
|
2519
|
+
],
|
|
2520
|
+
metadata: {
|
|
2521
|
+
rowCount: 2,
|
|
2522
|
+
columnCount: 2,
|
|
2523
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
2524
|
+
}
|
|
2525
|
+
}];
|
|
2526
|
+
return res.json({
|
|
2527
|
+
success: true,
|
|
2528
|
+
data: {
|
|
2529
|
+
dataSource,
|
|
2530
|
+
parsedData
|
|
2531
|
+
}
|
|
2532
|
+
});
|
|
2533
|
+
}
|
|
2534
|
+
else if (type === types_1.DataSourceType.ClickUp) {
|
|
2535
|
+
const { clickupBaseUrl, clickupAccessToken, clickupTeamId } = req.body;
|
|
2536
|
+
if (!clickupBaseUrl || !clickupAccessToken) {
|
|
2537
|
+
throw new Error('Missing ClickUp base URL or access token');
|
|
2538
|
+
}
|
|
2539
|
+
const dataSource = {
|
|
2540
|
+
type: types_1.DataSourceType.ClickUp,
|
|
2541
|
+
name: 'ClickUp',
|
|
2542
|
+
baseUrl: clickupBaseUrl,
|
|
2543
|
+
accessToken: clickupAccessToken,
|
|
2544
|
+
teamId: clickupTeamId
|
|
2545
|
+
};
|
|
2546
|
+
const parsedData = [{
|
|
2547
|
+
tableName: 'clickup_tools',
|
|
2548
|
+
headers: ['tool', 'description'],
|
|
2549
|
+
rows: [
|
|
2550
|
+
['list_teams', 'List teams'],
|
|
2551
|
+
['list_spaces', 'List spaces in a team'],
|
|
2552
|
+
['list_tasks', 'List tasks in a list'],
|
|
2553
|
+
['create_task', 'Create a task'],
|
|
2554
|
+
['update_task', 'Update a task']
|
|
2555
|
+
],
|
|
2556
|
+
metadata: {
|
|
2557
|
+
rowCount: 5,
|
|
2558
|
+
columnCount: 2,
|
|
2559
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
2560
|
+
}
|
|
2561
|
+
}];
|
|
2562
|
+
return res.json({
|
|
2563
|
+
success: true,
|
|
2564
|
+
data: {
|
|
2565
|
+
dataSource,
|
|
2566
|
+
parsedData
|
|
2567
|
+
}
|
|
2568
|
+
});
|
|
2569
|
+
}
|
|
2570
|
+
else if (type === types_1.DataSourceType.Linear) {
|
|
2571
|
+
const { linearBaseUrl, linearAccessToken } = req.body;
|
|
2572
|
+
if (!linearBaseUrl || !linearAccessToken) {
|
|
2573
|
+
throw new Error('Missing Linear base URL or access token');
|
|
2574
|
+
}
|
|
2575
|
+
const dataSource = {
|
|
2576
|
+
type: types_1.DataSourceType.Linear,
|
|
2577
|
+
name: 'Linear',
|
|
2578
|
+
baseUrl: linearBaseUrl,
|
|
2579
|
+
accessToken: linearAccessToken
|
|
2580
|
+
};
|
|
2581
|
+
const parsedData = [{
|
|
2582
|
+
tableName: 'linear_tools',
|
|
2583
|
+
headers: ['tool', 'description'],
|
|
2584
|
+
rows: [
|
|
2585
|
+
['query', 'Run a GraphQL query'],
|
|
2586
|
+
['mutate', 'Run a GraphQL mutation']
|
|
2587
|
+
],
|
|
2588
|
+
metadata: {
|
|
2589
|
+
rowCount: 2,
|
|
2590
|
+
columnCount: 2,
|
|
2591
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
2592
|
+
}
|
|
2593
|
+
}];
|
|
2594
|
+
return res.json({
|
|
2595
|
+
success: true,
|
|
2596
|
+
data: {
|
|
2597
|
+
dataSource,
|
|
2598
|
+
parsedData
|
|
2599
|
+
}
|
|
2600
|
+
});
|
|
2601
|
+
}
|
|
2602
|
+
else if (type === types_1.DataSourceType.Jenkins) {
|
|
2603
|
+
const { jenkinsBaseUrl, jenkinsUsername, jenkinsApiToken } = req.body;
|
|
2604
|
+
if (!jenkinsBaseUrl || !jenkinsUsername || !jenkinsApiToken) {
|
|
2605
|
+
throw new Error('Missing Jenkins base URL, username, or API token');
|
|
2606
|
+
}
|
|
2607
|
+
const dataSource = {
|
|
2608
|
+
type: types_1.DataSourceType.Jenkins,
|
|
2609
|
+
name: 'Jenkins',
|
|
2610
|
+
baseUrl: jenkinsBaseUrl,
|
|
2611
|
+
username: jenkinsUsername,
|
|
2612
|
+
apiToken: jenkinsApiToken
|
|
2613
|
+
};
|
|
2614
|
+
const parsedData = [{
|
|
2615
|
+
tableName: 'jenkins_tools',
|
|
2616
|
+
headers: ['tool', 'description'],
|
|
2617
|
+
rows: [
|
|
2618
|
+
['list_jobs', 'List jobs on Jenkins'],
|
|
2619
|
+
['get_job', 'Get job details'],
|
|
2620
|
+
['trigger_build', 'Trigger a build for a job'],
|
|
2621
|
+
['get_build', 'Get build details']
|
|
2622
|
+
],
|
|
2623
|
+
metadata: {
|
|
2624
|
+
rowCount: 4,
|
|
2625
|
+
columnCount: 2,
|
|
2626
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
2627
|
+
}
|
|
2628
|
+
}];
|
|
2629
|
+
return res.json({
|
|
2630
|
+
success: true,
|
|
2631
|
+
data: {
|
|
2632
|
+
dataSource,
|
|
2633
|
+
parsedData
|
|
2634
|
+
}
|
|
2635
|
+
});
|
|
2636
|
+
}
|
|
2637
|
+
else if (type === types_1.DataSourceType.DockerHub) {
|
|
2638
|
+
const { dockerhubBaseUrl, dockerhubAccessToken, dockerhubNamespace } = req.body;
|
|
2639
|
+
if (!dockerhubBaseUrl) {
|
|
2640
|
+
throw new Error('Missing Docker Hub base URL');
|
|
2641
|
+
}
|
|
2642
|
+
const dataSource = {
|
|
2643
|
+
type: types_1.DataSourceType.DockerHub,
|
|
2644
|
+
name: 'Docker Hub',
|
|
2645
|
+
baseUrl: dockerhubBaseUrl,
|
|
2646
|
+
accessToken: dockerhubAccessToken || '',
|
|
2647
|
+
namespace: dockerhubNamespace || ''
|
|
2648
|
+
};
|
|
2649
|
+
const parsedData = [{
|
|
2650
|
+
tableName: 'dockerhub_tools',
|
|
2651
|
+
headers: ['tool', 'description'],
|
|
2652
|
+
rows: [
|
|
2653
|
+
['list_repos', 'List repositories for a namespace'],
|
|
2654
|
+
['get_repo', 'Get repository details'],
|
|
2655
|
+
['list_tags', 'List tags for a repository'],
|
|
2656
|
+
['search_repos', 'Search repositories']
|
|
2657
|
+
],
|
|
2658
|
+
metadata: {
|
|
2659
|
+
rowCount: 4,
|
|
2660
|
+
columnCount: 2,
|
|
2661
|
+
dataTypes: { tool: 'string', description: 'string' }
|
|
2662
|
+
}
|
|
2663
|
+
}];
|
|
2664
|
+
return res.json({
|
|
2665
|
+
success: true,
|
|
2666
|
+
data: {
|
|
2667
|
+
dataSource,
|
|
2668
|
+
parsedData
|
|
2669
|
+
}
|
|
2670
|
+
});
|
|
2671
|
+
}
|
|
2672
|
+
else if (type === types_1.DataSourceType.Jira) {
|
|
2673
|
+
const { jiraHost, jiraEmail, jiraApiToken, jiraProjectKey, jiraApiVersion } = req.body;
|
|
2674
|
+
if (!jiraHost || !jiraEmail || !jiraApiToken) {
|
|
2675
|
+
throw new Error('Missing Jira host, email, or API token');
|
|
2676
|
+
}
|
|
2677
|
+
const dataSource = {
|
|
2678
|
+
type: types_1.DataSourceType.Jira,
|
|
2679
|
+
name: 'Jira',
|
|
2680
|
+
host: jiraHost,
|
|
2681
|
+
email: jiraEmail,
|
|
2682
|
+
apiVersion: jiraApiVersion || 'v2',
|
|
2683
|
+
apiToken: jiraApiToken,
|
|
2684
|
+
projectKey: jiraProjectKey
|
|
2685
|
+
};
|
|
2686
|
+
// For Jira, tools are predefined - no parsing needed
|
|
2687
|
+
const parsedData = [{
|
|
2688
|
+
tableName: 'jira_tools',
|
|
2689
|
+
headers: ['tool', 'description'],
|
|
2690
|
+
rows: [
|
|
2691
|
+
['search_issues', 'Search for issues using JQL'],
|
|
2692
|
+
['get_issue', 'Get details of a specific issue'],
|
|
2693
|
+
['create_issue', 'Create a new issue'],
|
|
2694
|
+
['update_issue', 'Update an existing issue'],
|
|
2695
|
+
['add_comment', 'Add a comment to an issue'],
|
|
2696
|
+
['get_transitions', 'Get available transitions for an issue'],
|
|
2697
|
+
['transition_issue', 'Transition an issue to a new status'],
|
|
2698
|
+
['list_projects', 'List all projects'],
|
|
2699
|
+
['get_project', 'Get details of a specific project'],
|
|
2700
|
+
['get_user', 'Get information about a Jira user'],
|
|
2701
|
+
['assign_issue', 'Assign an issue to a user'],
|
|
2702
|
+
['get_issue_comments', 'Get comments on an issue']
|
|
2703
|
+
],
|
|
2704
|
+
metadata: {
|
|
2705
|
+
rowCount: 12,
|
|
2706
|
+
columnCount: 2,
|
|
2707
|
+
dataTypes: {
|
|
2708
|
+
tool: 'string',
|
|
2709
|
+
description: 'string'
|
|
2710
|
+
}
|
|
2711
|
+
}
|
|
2712
|
+
}];
|
|
2713
|
+
return res.json({
|
|
2714
|
+
success: true,
|
|
2715
|
+
data: {
|
|
2716
|
+
dataSource,
|
|
2717
|
+
parsedData
|
|
2718
|
+
}
|
|
2719
|
+
});
|
|
2720
|
+
}
|
|
2721
|
+
else if (type === types_1.DataSourceType.Confluence) {
|
|
2722
|
+
const { confluenceHost, confluenceEmail, confluenceApiToken, confluenceSpaceKey } = req.body;
|
|
2723
|
+
if (!confluenceHost || !confluenceEmail || !confluenceApiToken) {
|
|
2724
|
+
throw new Error('Missing Confluence host, email, or API token');
|
|
2725
|
+
}
|
|
2726
|
+
const dataSource = {
|
|
2727
|
+
type: types_1.DataSourceType.Confluence,
|
|
2728
|
+
name: 'Confluence',
|
|
2729
|
+
host: confluenceHost,
|
|
2730
|
+
email: confluenceEmail,
|
|
2731
|
+
apiToken: confluenceApiToken,
|
|
2732
|
+
spaceKey: confluenceSpaceKey
|
|
2733
|
+
};
|
|
2734
|
+
const parsedData = [{
|
|
2735
|
+
tableName: 'confluence_tools',
|
|
2736
|
+
headers: ['tool', 'description'],
|
|
2737
|
+
rows: [
|
|
2738
|
+
['list_spaces', 'List Confluence spaces'],
|
|
2739
|
+
['get_space', 'Get details of a space'],
|
|
2740
|
+
['list_pages', 'List pages in a space'],
|
|
2741
|
+
['get_page', 'Get a page by ID'],
|
|
2742
|
+
['search_pages', 'Search pages using CQL'],
|
|
2743
|
+
['create_page', 'Create a new page'],
|
|
2744
|
+
['update_page', 'Update an existing page']
|
|
2745
|
+
],
|
|
2746
|
+
metadata: {
|
|
2747
|
+
rowCount: 7,
|
|
2748
|
+
columnCount: 2,
|
|
2749
|
+
dataTypes: {
|
|
2750
|
+
tool: 'string',
|
|
2751
|
+
description: 'string'
|
|
2752
|
+
}
|
|
2753
|
+
}
|
|
2754
|
+
}];
|
|
2755
|
+
return res.json({
|
|
2756
|
+
success: true,
|
|
2757
|
+
data: {
|
|
2758
|
+
dataSource,
|
|
2759
|
+
parsedData
|
|
2760
|
+
}
|
|
2761
|
+
});
|
|
2762
|
+
}
|
|
2763
|
+
else if (type === types_1.DataSourceType.Ftp) {
|
|
2764
|
+
const { ftpHost, ftpPort, ftpUsername, ftpPassword, ftpSecure, ftpBasePath } = req.body;
|
|
2765
|
+
if (!ftpHost || !ftpUsername || !ftpPassword) {
|
|
2766
|
+
throw new Error('Missing FTP host, username, or password');
|
|
2767
|
+
}
|
|
2768
|
+
const dataSource = {
|
|
2769
|
+
type: types_1.DataSourceType.Ftp,
|
|
2770
|
+
name: 'FTP',
|
|
2771
|
+
host: ftpHost,
|
|
2772
|
+
port: parseInt(ftpPort) || 21,
|
|
2773
|
+
username: ftpUsername,
|
|
2774
|
+
password: ftpPassword,
|
|
2775
|
+
secure: ftpSecure === 'true' || ftpSecure === true,
|
|
2776
|
+
basePath: ftpBasePath || '/'
|
|
2777
|
+
};
|
|
2778
|
+
// For FTP, tools are predefined - no parsing needed
|
|
2779
|
+
const parsedData = [{
|
|
2780
|
+
tableName: 'ftp_tools',
|
|
2781
|
+
headers: ['tool', 'description'],
|
|
2782
|
+
rows: [
|
|
2783
|
+
['list_files', 'List files and directories in a path'],
|
|
2784
|
+
['download_file', 'Download a file from FTP server'],
|
|
2785
|
+
['upload_file', 'Upload a file to FTP server'],
|
|
2786
|
+
['delete_file', 'Delete a file from FTP server'],
|
|
2787
|
+
['create_directory', 'Create a new directory'],
|
|
2788
|
+
['delete_directory', 'Delete a directory'],
|
|
2789
|
+
['rename', 'Rename a file or directory'],
|
|
2790
|
+
['get_file_info', 'Get information about a file']
|
|
2791
|
+
],
|
|
2792
|
+
metadata: {
|
|
2793
|
+
rowCount: 8,
|
|
2794
|
+
columnCount: 2,
|
|
2795
|
+
dataTypes: {
|
|
2796
|
+
tool: 'string',
|
|
2797
|
+
description: 'string'
|
|
2798
|
+
}
|
|
2799
|
+
}
|
|
2800
|
+
}];
|
|
2801
|
+
return res.json({
|
|
2802
|
+
success: true,
|
|
2803
|
+
data: {
|
|
2804
|
+
dataSource,
|
|
2805
|
+
parsedData
|
|
2806
|
+
}
|
|
2807
|
+
});
|
|
2808
|
+
}
|
|
2809
|
+
else if (type === types_1.DataSourceType.LocalFS) {
|
|
2810
|
+
const { localfsBasePath, localfsAllowWrite, localfsAllowDelete } = req.body;
|
|
2811
|
+
if (!localfsBasePath) {
|
|
2812
|
+
throw new Error('Missing base path for Local Filesystem');
|
|
2813
|
+
}
|
|
2814
|
+
const dataSource = {
|
|
2815
|
+
type: types_1.DataSourceType.LocalFS,
|
|
2816
|
+
name: 'LocalFS',
|
|
2817
|
+
basePath: localfsBasePath,
|
|
2818
|
+
allowWrite: localfsAllowWrite === 'true' || localfsAllowWrite === true,
|
|
2819
|
+
allowDelete: localfsAllowDelete === 'true' || localfsAllowDelete === true
|
|
2820
|
+
};
|
|
2821
|
+
// For LocalFS, tools are predefined - no parsing needed
|
|
2822
|
+
const parsedData = [{
|
|
2823
|
+
tableName: 'localfs_tools',
|
|
2824
|
+
headers: ['tool', 'description'],
|
|
2825
|
+
rows: [
|
|
2826
|
+
['list_files', 'List files and directories in a path'],
|
|
2827
|
+
['read_file', 'Read contents of a file'],
|
|
2828
|
+
['write_file', 'Write content to a file'],
|
|
2829
|
+
['delete_file', 'Delete a file'],
|
|
2830
|
+
['create_directory', 'Create a new directory'],
|
|
2831
|
+
['delete_directory', 'Delete a directory'],
|
|
2832
|
+
['rename', 'Rename a file or directory'],
|
|
2833
|
+
['get_file_info', 'Get information about a file'],
|
|
2834
|
+
['search_files', 'Search for files by name pattern'],
|
|
2835
|
+
['copy_file', 'Copy a file to another location']
|
|
2836
|
+
],
|
|
2837
|
+
metadata: {
|
|
2838
|
+
rowCount: 10,
|
|
2839
|
+
columnCount: 2,
|
|
2840
|
+
dataTypes: {
|
|
2841
|
+
tool: 'string',
|
|
2842
|
+
description: 'string'
|
|
2843
|
+
}
|
|
2844
|
+
}
|
|
2845
|
+
}];
|
|
2846
|
+
return res.json({
|
|
2847
|
+
success: true,
|
|
2848
|
+
data: {
|
|
2849
|
+
dataSource,
|
|
2850
|
+
parsedData
|
|
2851
|
+
}
|
|
2852
|
+
});
|
|
2853
|
+
}
|
|
2854
|
+
else if (type === types_1.DataSourceType.Email) {
|
|
2855
|
+
const { emailImapHost, emailImapPort, emailSmtpHost, emailSmtpPort, emailUsername, emailPassword, emailSecure } = req.body;
|
|
2856
|
+
if (!emailImapHost || !emailSmtpHost || !emailUsername || !emailPassword) {
|
|
2857
|
+
throw new Error('Missing email configuration (IMAP host, SMTP host, username, or password)');
|
|
2858
|
+
}
|
|
2859
|
+
const dataSource = {
|
|
2860
|
+
type: types_1.DataSourceType.Email,
|
|
2861
|
+
name: 'Email',
|
|
2862
|
+
imapHost: emailImapHost,
|
|
2863
|
+
imapPort: parseInt(emailImapPort) || 993,
|
|
2864
|
+
smtpHost: emailSmtpHost,
|
|
2865
|
+
smtpPort: parseInt(emailSmtpPort) || 587,
|
|
2866
|
+
username: emailUsername,
|
|
2867
|
+
password: emailPassword,
|
|
2868
|
+
secure: emailSecure === 'true' || emailSecure === true
|
|
2869
|
+
};
|
|
2870
|
+
// For Email, tools are predefined
|
|
2871
|
+
const parsedData = [{
|
|
2872
|
+
tableName: 'email_tools',
|
|
2873
|
+
headers: ['tool', 'description'],
|
|
2874
|
+
rows: [
|
|
2875
|
+
['list_folders', 'List all email folders/mailboxes'],
|
|
2876
|
+
['list_emails', 'List emails in a folder'],
|
|
2877
|
+
['read_email', 'Read a specific email by ID'],
|
|
2878
|
+
['search_emails', 'Search emails by criteria'],
|
|
2879
|
+
['send_email', 'Send a new email'],
|
|
2880
|
+
['reply_email', 'Reply to an email'],
|
|
2881
|
+
['forward_email', 'Forward an email'],
|
|
2882
|
+
['move_email', 'Move email to another folder'],
|
|
2883
|
+
['delete_email', 'Delete an email'],
|
|
2884
|
+
['mark_read', 'Mark email as read/unread']
|
|
2885
|
+
],
|
|
2886
|
+
metadata: {
|
|
2887
|
+
rowCount: 10,
|
|
2888
|
+
columnCount: 2,
|
|
2889
|
+
dataTypes: {
|
|
2890
|
+
tool: 'string',
|
|
2891
|
+
description: 'string'
|
|
2892
|
+
}
|
|
2893
|
+
}
|
|
2894
|
+
}];
|
|
2895
|
+
return res.json({
|
|
2896
|
+
success: true,
|
|
2897
|
+
data: {
|
|
2898
|
+
dataSource,
|
|
2899
|
+
parsedData
|
|
2900
|
+
}
|
|
2901
|
+
});
|
|
2902
|
+
}
|
|
2903
|
+
else if (type === types_1.DataSourceType.Slack) {
|
|
2904
|
+
const { slackBotToken, slackDefaultChannel } = req.body;
|
|
2905
|
+
if (!slackBotToken) {
|
|
2906
|
+
throw new Error('Missing Slack Bot Token');
|
|
2907
|
+
}
|
|
2908
|
+
const dataSource = {
|
|
2909
|
+
type: types_1.DataSourceType.Slack,
|
|
2910
|
+
name: 'Slack',
|
|
2911
|
+
botToken: slackBotToken,
|
|
2912
|
+
defaultChannel: slackDefaultChannel || ''
|
|
2913
|
+
};
|
|
2914
|
+
// For Slack, tools are predefined
|
|
2915
|
+
const parsedData = [{
|
|
2916
|
+
tableName: 'slack_tools',
|
|
2917
|
+
headers: ['tool', 'description'],
|
|
2918
|
+
rows: [
|
|
2919
|
+
['list_channels', 'List all channels in the workspace'],
|
|
2920
|
+
['list_users', 'List all users in the workspace'],
|
|
2921
|
+
['send_message', 'Send a message to a channel'],
|
|
2922
|
+
['get_channel_history', 'Get message history from a channel'],
|
|
2923
|
+
['get_user_info', 'Get information about a user'],
|
|
2924
|
+
['add_reaction', 'Add an emoji reaction to a message'],
|
|
2925
|
+
['upload_file', 'Upload a file to a channel'],
|
|
2926
|
+
['search_messages', 'Search for messages in the workspace']
|
|
2927
|
+
],
|
|
2928
|
+
metadata: {
|
|
2929
|
+
rowCount: 8,
|
|
2930
|
+
columnCount: 2,
|
|
2931
|
+
dataTypes: {
|
|
2932
|
+
tool: 'string',
|
|
2933
|
+
description: 'string'
|
|
2934
|
+
}
|
|
2935
|
+
}
|
|
2936
|
+
}];
|
|
2937
|
+
return res.json({
|
|
2938
|
+
success: true,
|
|
2939
|
+
data: {
|
|
2940
|
+
dataSource,
|
|
2941
|
+
parsedData
|
|
2942
|
+
}
|
|
2943
|
+
});
|
|
2944
|
+
}
|
|
2945
|
+
else if (type === types_1.DataSourceType.Discord) {
|
|
2946
|
+
const { discordBotToken, discordDefaultGuildId, discordDefaultChannelId } = req.body;
|
|
2947
|
+
if (!discordBotToken) {
|
|
2948
|
+
throw new Error('Missing Discord Bot Token');
|
|
2949
|
+
}
|
|
2950
|
+
const dataSource = {
|
|
2951
|
+
type: types_1.DataSourceType.Discord,
|
|
2952
|
+
name: 'Discord',
|
|
2953
|
+
botToken: discordBotToken,
|
|
2954
|
+
defaultGuildId: discordDefaultGuildId || '',
|
|
2955
|
+
defaultChannelId: discordDefaultChannelId || ''
|
|
2956
|
+
};
|
|
2957
|
+
const parsedData = [{
|
|
2958
|
+
tableName: 'discord_tools',
|
|
2959
|
+
headers: ['tool', 'description'],
|
|
2960
|
+
rows: [
|
|
2961
|
+
['list_guilds', 'List guilds (servers) the bot has access to'],
|
|
2962
|
+
['list_channels', 'List channels in a guild'],
|
|
2963
|
+
['list_users', 'List members in a guild'],
|
|
2964
|
+
['send_message', 'Send a message to a channel'],
|
|
2965
|
+
['get_channel_history', 'Get recent messages in a channel'],
|
|
2966
|
+
['get_user_info', 'Get information about a user'],
|
|
2967
|
+
['add_reaction', 'Add an emoji reaction to a message']
|
|
2968
|
+
],
|
|
2969
|
+
metadata: {
|
|
2970
|
+
rowCount: 7,
|
|
2971
|
+
columnCount: 2,
|
|
2972
|
+
dataTypes: {
|
|
2973
|
+
tool: 'string',
|
|
2974
|
+
description: 'string'
|
|
2975
|
+
}
|
|
2976
|
+
}
|
|
2977
|
+
}];
|
|
2978
|
+
return res.json({
|
|
2979
|
+
success: true,
|
|
2980
|
+
data: {
|
|
2981
|
+
dataSource,
|
|
2982
|
+
parsedData
|
|
2983
|
+
}
|
|
2984
|
+
});
|
|
2985
|
+
}
|
|
2986
|
+
else if (type === types_1.DataSourceType.Docker) {
|
|
2987
|
+
const { dockerPath } = req.body;
|
|
2988
|
+
const dataSource = {
|
|
2989
|
+
type: types_1.DataSourceType.Docker,
|
|
2990
|
+
name: 'Docker',
|
|
2991
|
+
dockerPath: dockerPath || 'docker'
|
|
2992
|
+
};
|
|
2993
|
+
const parsedData = [{
|
|
2994
|
+
tableName: 'docker_tools',
|
|
2995
|
+
headers: ['tool', 'description'],
|
|
2996
|
+
rows: [
|
|
2997
|
+
['list_images', 'List local Docker images'],
|
|
2998
|
+
['list_containers', 'List Docker containers (running and stopped)'],
|
|
2999
|
+
['get_container', 'Get detailed information about a container'],
|
|
3000
|
+
['start_container', 'Start a stopped container'],
|
|
3001
|
+
['stop_container', 'Stop a running container'],
|
|
3002
|
+
['restart_container', 'Restart a container'],
|
|
3003
|
+
['remove_container', 'Remove a container'],
|
|
3004
|
+
['remove_image', 'Remove a Docker image'],
|
|
3005
|
+
['pull_image', 'Pull a Docker image from registry'],
|
|
3006
|
+
['get_logs', 'Get recent logs from a container'],
|
|
3007
|
+
['exec_in_container', 'Execute a command inside a running container']
|
|
3008
|
+
],
|
|
3009
|
+
metadata: {
|
|
3010
|
+
rowCount: 11,
|
|
3011
|
+
columnCount: 2,
|
|
3012
|
+
dataTypes: {
|
|
3013
|
+
tool: 'string',
|
|
3014
|
+
description: 'string'
|
|
3015
|
+
}
|
|
3016
|
+
}
|
|
3017
|
+
}];
|
|
3018
|
+
return res.json({
|
|
3019
|
+
success: true,
|
|
3020
|
+
data: {
|
|
3021
|
+
dataSource,
|
|
3022
|
+
parsedData
|
|
3023
|
+
}
|
|
3024
|
+
});
|
|
3025
|
+
}
|
|
3026
|
+
else if (type === types_1.DataSourceType.Kubernetes) {
|
|
3027
|
+
const { kubectlPath, kubeconfig, namespace } = req.body;
|
|
3028
|
+
const dataSource = {
|
|
3029
|
+
type: types_1.DataSourceType.Kubernetes,
|
|
3030
|
+
name: 'Kubernetes',
|
|
3031
|
+
kubectlPath: kubectlPath || 'kubectl',
|
|
3032
|
+
kubeconfig: kubeconfig || '',
|
|
3033
|
+
namespace: namespace || ''
|
|
3034
|
+
};
|
|
3035
|
+
const parsedData = [{
|
|
3036
|
+
tableName: 'kubernetes_tools',
|
|
3037
|
+
headers: ['tool', 'description'],
|
|
3038
|
+
rows: [
|
|
3039
|
+
['list_contexts', 'List kubeconfig contexts'],
|
|
3040
|
+
['get_current_context', 'Get current kubeconfig context'],
|
|
3041
|
+
['list_namespaces', 'List namespaces in the cluster'],
|
|
3042
|
+
['list_pods', 'List pods in a namespace'],
|
|
3043
|
+
['get_pod', 'Get a pod by name'],
|
|
3044
|
+
['describe_pod', 'Describe a pod (text output)'],
|
|
3045
|
+
['list_deployments', 'List deployments in a namespace'],
|
|
3046
|
+
['scale_deployment', 'Scale a deployment to a replica count'],
|
|
3047
|
+
['delete_pod', 'Delete a pod']
|
|
3048
|
+
],
|
|
3049
|
+
metadata: {
|
|
3050
|
+
rowCount: 9,
|
|
3051
|
+
columnCount: 2,
|
|
3052
|
+
dataTypes: {
|
|
3053
|
+
tool: 'string',
|
|
3054
|
+
description: 'string'
|
|
3055
|
+
}
|
|
3056
|
+
}
|
|
3057
|
+
}];
|
|
3058
|
+
return res.json({
|
|
3059
|
+
success: true,
|
|
3060
|
+
data: {
|
|
3061
|
+
dataSource,
|
|
3062
|
+
parsedData
|
|
3063
|
+
}
|
|
3064
|
+
});
|
|
3065
|
+
}
|
|
3066
|
+
else if (type === types_1.DataSourceType.OpenShift) {
|
|
3067
|
+
const { ocPath, kubeconfig, namespace } = req.body;
|
|
3068
|
+
const dataSource = {
|
|
3069
|
+
type: types_1.DataSourceType.OpenShift,
|
|
3070
|
+
name: 'OpenShift',
|
|
3071
|
+
ocPath: ocPath || 'oc',
|
|
3072
|
+
kubeconfig: kubeconfig || '',
|
|
3073
|
+
namespace: namespace || ''
|
|
3074
|
+
};
|
|
3075
|
+
const parsedData = [{
|
|
3076
|
+
tableName: 'openshift_tools',
|
|
3077
|
+
headers: ['tool', 'description'],
|
|
3078
|
+
rows: [
|
|
3079
|
+
['list_projects', 'List OpenShift projects'],
|
|
3080
|
+
['get_current_project', 'Get current OpenShift project'],
|
|
3081
|
+
['list_pods', 'List pods in a project/namespace'],
|
|
3082
|
+
['get_pod', 'Get a pod by name'],
|
|
3083
|
+
['list_deployments', 'List deployments in a project/namespace'],
|
|
3084
|
+
['scale_deployment', 'Scale a deployment to a replica count'],
|
|
3085
|
+
['delete_pod', 'Delete a pod']
|
|
3086
|
+
],
|
|
3087
|
+
metadata: {
|
|
3088
|
+
rowCount: 7,
|
|
3089
|
+
columnCount: 2,
|
|
3090
|
+
dataTypes: {
|
|
3091
|
+
tool: 'string',
|
|
3092
|
+
description: 'string'
|
|
3093
|
+
}
|
|
3094
|
+
}
|
|
3095
|
+
}];
|
|
3096
|
+
return res.json({
|
|
3097
|
+
success: true,
|
|
3098
|
+
data: {
|
|
3099
|
+
dataSource,
|
|
3100
|
+
parsedData
|
|
3101
|
+
}
|
|
3102
|
+
});
|
|
3103
|
+
}
|
|
3104
|
+
else if (type === types_1.DataSourceType.Elasticsearch) {
|
|
3105
|
+
const { baseUrl, apiKey, username, password, index } = req.body;
|
|
3106
|
+
if (!baseUrl) {
|
|
3107
|
+
throw new Error('Missing Elasticsearch baseUrl');
|
|
3108
|
+
}
|
|
3109
|
+
const dataSource = {
|
|
3110
|
+
type: types_1.DataSourceType.Elasticsearch,
|
|
3111
|
+
name: 'Elasticsearch',
|
|
3112
|
+
baseUrl,
|
|
3113
|
+
apiKey: apiKey || '',
|
|
3114
|
+
username: username || '',
|
|
3115
|
+
password: password || '',
|
|
3116
|
+
index: index || ''
|
|
3117
|
+
};
|
|
3118
|
+
const parsedData = [{
|
|
3119
|
+
tableName: 'elasticsearch_tools',
|
|
3120
|
+
headers: ['tool', 'description'],
|
|
3121
|
+
rows: [
|
|
3122
|
+
['list_indices', 'List indices in the cluster'],
|
|
3123
|
+
['get_cluster_health', 'Get cluster health'],
|
|
3124
|
+
['search', 'Search documents in an index'],
|
|
3125
|
+
['get_document', 'Get a document by ID'],
|
|
3126
|
+
['index_document', 'Index (create/update) a document'],
|
|
3127
|
+
['delete_document', 'Delete a document by ID']
|
|
3128
|
+
],
|
|
3129
|
+
metadata: {
|
|
3130
|
+
rowCount: 6,
|
|
3131
|
+
columnCount: 2,
|
|
3132
|
+
dataTypes: {
|
|
3133
|
+
tool: 'string',
|
|
3134
|
+
description: 'string'
|
|
3135
|
+
}
|
|
3136
|
+
}
|
|
3137
|
+
}];
|
|
3138
|
+
return res.json({
|
|
3139
|
+
success: true,
|
|
3140
|
+
data: {
|
|
3141
|
+
dataSource,
|
|
3142
|
+
parsedData
|
|
3143
|
+
}
|
|
3144
|
+
});
|
|
3145
|
+
}
|
|
3146
|
+
else if (type === types_1.DataSourceType.OpenSearch) {
|
|
3147
|
+
const { baseUrl, apiKey, username, password, index } = req.body;
|
|
3148
|
+
if (!baseUrl) {
|
|
3149
|
+
throw new Error('Missing OpenSearch baseUrl');
|
|
3150
|
+
}
|
|
3151
|
+
const dataSource = {
|
|
3152
|
+
type: types_1.DataSourceType.OpenSearch,
|
|
3153
|
+
name: 'OpenSearch',
|
|
3154
|
+
baseUrl,
|
|
3155
|
+
apiKey: apiKey || '',
|
|
3156
|
+
username: username || '',
|
|
3157
|
+
password: password || '',
|
|
3158
|
+
index: index || ''
|
|
3159
|
+
};
|
|
3160
|
+
const parsedData = [{
|
|
3161
|
+
tableName: 'opensearch_tools',
|
|
3162
|
+
headers: ['tool', 'description'],
|
|
3163
|
+
rows: [
|
|
3164
|
+
['list_indices', 'List indices in the cluster'],
|
|
3165
|
+
['get_cluster_health', 'Get cluster health'],
|
|
3166
|
+
['search', 'Search documents in an index'],
|
|
3167
|
+
['get_document', 'Get a document by ID'],
|
|
3168
|
+
['index_document', 'Index (create/update) a document'],
|
|
3169
|
+
['delete_document', 'Delete a document by ID']
|
|
3170
|
+
],
|
|
3171
|
+
metadata: {
|
|
3172
|
+
rowCount: 6,
|
|
3173
|
+
columnCount: 2,
|
|
3174
|
+
dataTypes: {
|
|
3175
|
+
tool: 'string',
|
|
3176
|
+
description: 'string'
|
|
3177
|
+
}
|
|
3178
|
+
}
|
|
3179
|
+
}];
|
|
3180
|
+
return res.json({
|
|
3181
|
+
success: true,
|
|
3182
|
+
data: {
|
|
3183
|
+
dataSource,
|
|
3184
|
+
parsedData
|
|
3185
|
+
}
|
|
3186
|
+
});
|
|
3187
|
+
}
|
|
3188
|
+
else if (type === types_1.DataSourceType.CSV || type === types_1.DataSourceType.Excel) {
|
|
3189
|
+
if (file) {
|
|
3190
|
+
if (type === types_1.DataSourceType.CSV) {
|
|
3191
|
+
dataSource = (0, types_1.createCsvDataSource)(file.originalname, file.path);
|
|
3192
|
+
}
|
|
3193
|
+
else {
|
|
3194
|
+
dataSource = (0, types_1.createExcelDataSource)(file.originalname, file.path);
|
|
3195
|
+
}
|
|
3196
|
+
}
|
|
3197
|
+
else if (normalizedFilePath) {
|
|
3198
|
+
const ext = path_1.default.extname(normalizedFilePath).toLowerCase();
|
|
3199
|
+
if (type === types_1.DataSourceType.CSV && ext !== '.csv') {
|
|
3200
|
+
throw new Error('Selected file must be a .csv file');
|
|
3201
|
+
}
|
|
3202
|
+
if (type === types_1.DataSourceType.Excel && !['.xlsx', '.xls'].includes(ext)) {
|
|
3203
|
+
throw new Error('Selected file must be a .xlsx or .xls file');
|
|
3204
|
+
}
|
|
3205
|
+
if (type === types_1.DataSourceType.CSV) {
|
|
3206
|
+
dataSource = (0, types_1.createCsvDataSource)(path_1.default.basename(normalizedFilePath), normalizedFilePath);
|
|
3207
|
+
}
|
|
3208
|
+
else {
|
|
3209
|
+
dataSource = (0, types_1.createExcelDataSource)(path_1.default.basename(normalizedFilePath), normalizedFilePath);
|
|
3210
|
+
}
|
|
3211
|
+
}
|
|
3212
|
+
else {
|
|
3213
|
+
throw new Error('Please upload a file or provide a file path');
|
|
3214
|
+
}
|
|
3215
|
+
}
|
|
3216
|
+
else {
|
|
3217
|
+
throw new Error('No file or connection provided');
|
|
3218
|
+
}
|
|
3219
|
+
const parsedData = await this.parser.parse(dataSource);
|
|
3220
|
+
res.json({
|
|
3221
|
+
success: true,
|
|
3222
|
+
data: {
|
|
3223
|
+
dataSource,
|
|
3224
|
+
parsedData: parsedData.map(data => ({
|
|
3225
|
+
...data,
|
|
3226
|
+
rows: data.rows.slice(0, 10) // Limit preview rows
|
|
3227
|
+
}))
|
|
3228
|
+
}
|
|
3229
|
+
});
|
|
3230
|
+
}
|
|
3231
|
+
catch (error) {
|
|
3232
|
+
logger_1.logger.error(`Parse error: ${error instanceof Error ? error.message : String(error)}`);
|
|
3233
|
+
res.status(400).json({
|
|
3234
|
+
success: false,
|
|
3235
|
+
error: error instanceof Error ? error.message : 'Unknown error'
|
|
3236
|
+
});
|
|
3237
|
+
}
|
|
3238
|
+
};
|
|
3239
|
+
}
|
|
3240
|
+
registerRoutes(app) {
|
|
3241
|
+
app.post('/api/parse', upload_utils_1.upload.single('file'), this.parseDataSource);
|
|
3242
|
+
}
|
|
3243
|
+
}
|
|
3244
|
+
exports.ParseApi = ParseApi;
|
|
3245
|
+
//# sourceMappingURL=parseApi.js.map
|