From ac9f65b3700f1fb8193f05f3712bfae41c962604 Mon Sep 17 00:00:00 2001 From: waleed Date: Fri, 30 Jan 2026 16:33:21 -0800 Subject: [PATCH] fix(invite-modal): migrated invite modal to use tanstack query, updated biome config for lint, removed unused vars --- .../components/social-login-buttons.tsx | 28 +- apps/sim/app/(auth)/login/login-form.tsx | 2 +- apps/sim/app/(auth)/sso/sso-form.tsx | 3 +- .../sim/app/(auth)/verify/use-verification.ts | 4 +- .../components/landing-canvas/dot-pattern.tsx | 2 +- .../landing-canvas/landing-flow.tsx | 3 +- .../app/(landing)/components/hero/hero.tsx | 2 +- apps/sim/app/api/a2a/serve/[agentId]/utils.ts | 2 +- .../app/api/auth/oauth/connections/route.ts | 2 +- .../app/api/auth/oauth/token/route.test.ts | 1 - .../api/auth/oauth2/callback/shopify/route.ts | 2 +- .../app/api/auth/trello/authorize/route.ts | 2 +- .../sim/app/api/auth/trello/callback/route.ts | 2 +- .../app/api/chat/[identifier]/otp/route.ts | 2 +- apps/sim/app/api/chat/[identifier]/route.ts | 2 +- apps/sim/app/api/chat/route.ts | 2 +- .../api/copilot/api-keys/generate/route.ts | 2 +- apps/sim/app/api/copilot/api-keys/route.ts | 6 +- apps/sim/app/api/copilot/chat/route.ts | 41 +- .../api/copilot/checkpoints/revert/route.ts | 2 +- apps/sim/app/api/copilot/checkpoints/route.ts | 2 +- apps/sim/app/api/copilot/confirm/route.ts | 2 - apps/sim/app/api/copilot/feedback/route.ts | 2 +- apps/sim/app/api/copilot/stats/route.ts | 4 +- apps/sim/app/api/copilot/user-models/route.ts | 2 +- apps/sim/app/api/creators/[id]/route.ts | 4 +- .../sim/app/api/creators/[id]/verify/route.ts | 4 +- apps/sim/app/api/creators/route.ts | 2 - .../[id]/invite/[invitationId]/route.ts | 2 +- .../api/credential-sets/[id]/invite/route.ts | 2 +- .../api/credential-sets/[id]/members/route.ts | 2 +- .../sim/app/api/credential-sets/[id]/route.ts | 4 +- .../credential-sets/invite/[token]/route.ts | 4 +- apps/sim/app/api/environment/route.ts | 2 +- apps/sim/app/api/files/authorization.ts | 6 +- apps/sim/app/api/files/parse/route.test.ts | 2 +- apps/sim/app/api/files/parse/route.ts | 10 +- .../api/files/serve/[...path]/route.test.ts | 4 +- .../app/api/files/serve/[...path]/route.ts | 2 +- apps/sim/app/api/files/utils.ts | 6 +- apps/sim/app/api/folders/[id]/route.test.ts | 2 +- apps/sim/app/api/folders/[id]/route.ts | 2 +- apps/sim/app/api/folders/route.test.ts | 4 +- apps/sim/app/api/form/[identifier]/route.ts | 21 +- apps/sim/app/api/form/manage/[id]/route.ts | 4 +- apps/sim/app/api/form/route.ts | 2 +- apps/sim/app/api/form/utils.test.ts | 2 +- apps/sim/app/api/function/execute/route.ts | 2 +- .../[documentId]/chunks/[chunkId]/route.ts | 6 +- .../[id]/documents/[documentId]/route.ts | 6 +- .../[documentId]/tag-definitions/route.ts | 4 +- .../app/api/knowledge/[id]/documents/route.ts | 2 +- .../[id]/next-available-slot/route.ts | 2 +- .../[id]/tag-definitions/[tagId]/route.ts | 4 +- .../knowledge/[id]/tag-definitions/route.ts | 2 +- .../app/api/knowledge/[id]/tag-usage/route.ts | 4 +- apps/sim/app/api/knowledge/search/utils.ts | 2 +- .../sim/app/api/mcp/serve/[serverId]/route.ts | 2 +- .../app/api/mcp/servers/[id]/refresh/route.ts | 2 +- apps/sim/app/api/mcp/servers/route.ts | 2 +- apps/sim/app/api/mcp/tools/stored/route.ts | 2 +- .../api/mcp/workflow-servers/[id]/route.ts | 4 +- .../[id]/tools/[toolId]/route.ts | 4 +- .../mcp/workflow-servers/[id]/tools/route.ts | 2 +- .../sim/app/api/mcp/workflow-servers/route.ts | 2 +- .../[id]/invitations/[invitationId]/route.ts | 2 +- .../organizations/[id]/invitations/route.ts | 4 +- .../[id]/members/[memberId]/route.ts | 2 +- .../api/organizations/[id]/members/route.ts | 2 +- .../permission-groups/[id]/members/route.ts | 2 +- .../app/api/permission-groups/[id]/route.ts | 4 +- .../app/api/providers/base/models/route.ts | 2 +- .../[executionId]/[contextId]/route.ts | 2 +- .../app/api/templates/[id]/approve/route.ts | 2 +- .../app/api/templates/[id]/reject/route.ts | 2 +- apps/sim/app/api/templates/[id]/route.ts | 4 +- apps/sim/app/api/templates/[id]/star/route.ts | 6 +- apps/sim/app/api/templates/[id]/use/route.ts | 2 +- .../api/templates/approved/sanitized/route.ts | 3 +- .../app/api/tools/a2a/resubscribe/route.ts | 8 +- apps/sim/app/api/tools/custom/route.test.ts | 16 +- .../api/tools/dynamodb/introspect/route.ts | 2 +- .../api/tools/microsoft-teams/teams/route.ts | 2 - .../tools/microsoft_planner/tasks/route.ts | 2 +- .../sim/app/api/tools/mongodb/delete/route.ts | 10 +- .../app/api/tools/mongodb/execute/route.ts | 8 +- .../sim/app/api/tools/mongodb/insert/route.ts | 4 +- .../app/api/tools/mongodb/introspect/route.ts | 4 +- apps/sim/app/api/tools/mongodb/query/route.ts | 10 +- .../sim/app/api/tools/mongodb/update/route.ts | 10 +- apps/sim/app/api/tools/mongodb/utils.ts | 4 +- apps/sim/app/api/tools/mysql/delete/route.ts | 2 +- apps/sim/app/api/tools/mysql/execute/route.ts | 2 +- apps/sim/app/api/tools/mysql/insert/route.ts | 2 +- .../app/api/tools/mysql/introspect/route.ts | 2 +- apps/sim/app/api/tools/mysql/query/route.ts | 2 +- apps/sim/app/api/tools/mysql/update/route.ts | 4 +- apps/sim/app/api/tools/mysql/utils.ts | 2 +- apps/sim/app/api/tools/neo4j/create/route.ts | 2 +- apps/sim/app/api/tools/neo4j/delete/route.ts | 2 +- apps/sim/app/api/tools/neo4j/execute/route.ts | 2 +- .../app/api/tools/neo4j/introspect/route.ts | 6 +- apps/sim/app/api/tools/neo4j/merge/route.ts | 2 +- apps/sim/app/api/tools/neo4j/query/route.ts | 2 +- apps/sim/app/api/tools/neo4j/update/route.ts | 2 +- .../sim/app/api/tools/onedrive/files/route.ts | 2 +- .../app/api/tools/onedrive/folder/route.ts | 2 +- .../app/api/tools/onedrive/folders/route.ts | 2 +- .../app/api/tools/postgresql/delete/route.ts | 2 +- .../app/api/tools/postgresql/execute/route.ts | 2 +- .../app/api/tools/postgresql/insert/route.ts | 2 +- .../api/tools/postgresql/introspect/route.ts | 2 +- .../app/api/tools/postgresql/query/route.ts | 2 +- .../app/api/tools/postgresql/update/route.ts | 4 +- apps/sim/app/api/tools/postgresql/utils.ts | 2 +- apps/sim/app/api/tools/rds/delete/route.ts | 2 +- apps/sim/app/api/tools/rds/execute/route.ts | 2 +- apps/sim/app/api/tools/rds/insert/route.ts | 2 +- .../sim/app/api/tools/rds/introspect/route.ts | 2 +- apps/sim/app/api/tools/rds/query/route.ts | 2 +- apps/sim/app/api/tools/rds/update/route.ts | 2 +- apps/sim/app/api/tools/rds/utils.ts | 4 +- apps/sim/app/api/tools/sftp/download/route.ts | 2 +- .../app/api/tools/sharepoint/site/route.ts | 2 +- .../app/api/tools/sharepoint/sites/route.ts | 2 +- apps/sim/app/api/tools/sqs/send/route.ts | 4 +- .../tools/ssh/check-command-exists/route.ts | 2 +- .../api/tools/ssh/check-file-exists/route.ts | 2 +- .../api/tools/ssh/create-directory/route.ts | 2 +- .../app/api/tools/ssh/delete-file/route.ts | 2 +- .../app/api/tools/ssh/download-file/route.ts | 4 +- .../api/tools/ssh/execute-command/route.ts | 2 +- .../app/api/tools/ssh/execute-script/route.ts | 2 +- .../api/tools/ssh/get-system-info/route.ts | 2 +- .../app/api/tools/ssh/list-directory/route.ts | 2 +- .../app/api/tools/ssh/move-rename/route.ts | 2 +- .../api/tools/ssh/read-file-content/route.ts | 2 +- .../app/api/tools/ssh/upload-file/route.ts | 2 +- .../api/tools/ssh/write-file-content/route.ts | 2 +- .../sim/app/api/tools/textract/parse/route.ts | 2 +- apps/sim/app/api/tools/video/route.ts | 5 +- apps/sim/app/api/user/super-user/route.ts | 2 +- .../app/api/users/me/api-keys/[id]/route.ts | 2 +- apps/sim/app/api/users/me/api-keys/route.ts | 2 +- apps/sim/app/api/v1/admin/auth.ts | 2 +- .../api/v1/admin/organizations/[id]/route.ts | 2 +- .../app/api/v1/admin/organizations/route.ts | 2 +- apps/sim/app/api/v1/admin/users/[id]/route.ts | 2 +- .../v1/admin/workflows/[id]/deploy/route.ts | 2 +- .../v1/admin/workflows/[id]/export/route.ts | 2 +- .../app/api/v1/admin/workflows/[id]/route.ts | 4 +- .../versions/[versionId]/activate/route.ts | 2 +- .../v1/admin/workflows/[id]/versions/route.ts | 2 +- .../v1/admin/workspaces/[id]/members/route.ts | 2 +- .../app/api/v1/admin/workspaces/[id]/route.ts | 2 +- .../admin/workspaces/[id]/workflows/route.ts | 2 +- apps/sim/app/api/wand/route.ts | 2 +- apps/sim/app/api/webhooks/[id]/route.ts | 4 +- .../app/api/workflows/[id]/deploy/route.ts | 8 +- .../deployments/[version]/revert/route.ts | 2 +- .../[id]/deployments/[version]/route.ts | 2 +- .../api/workflows/[id]/deployments/route.ts | 2 +- .../app/api/workflows/[id]/execute/route.ts | 8 +- .../api/workflows/[id]/form/status/route.ts | 2 +- .../app/api/workflows/[id]/variables/route.ts | 2 +- .../workspaces/[id]/api-keys/[keyId]/route.ts | 2 +- .../app/api/workspaces/[id]/api-keys/route.ts | 2 +- .../api/workspaces/[id]/byok-keys/route.ts | 4 +- .../api/workspaces/[id]/environment/route.ts | 2 +- .../[id]/files/[fileId]/download/route.ts | 2 +- .../workspaces/[id]/files/[fileId]/route.ts | 2 +- .../app/api/workspaces/[id]/files/route.ts | 2 +- .../notifications/[notificationId]/route.ts | 9 +- .../[notificationId]/test/route.ts | 4 +- .../workspaces/[id]/notifications/route.ts | 8 +- .../api/workspaces/[id]/permissions/route.ts | 4 +- .../invitations/[invitationId]/route.ts | 2 +- .../app/api/workspaces/invitations/route.ts | 4 +- .../components/changelog-content.tsx | 2 +- apps/sim/app/chat/[identifier]/chat.tsx | 55 +- .../sim/app/chat/components/header/header.tsx | 1 - apps/sim/app/chat/components/input/input.tsx | 4 +- .../voice-interface/components/particles.tsx | 11 +- .../voice-interface/voice-interface.tsx | 8 +- .../sim/app/chat/hooks/use-audio-streaming.ts | 4 +- .../components/powered-by-sim.tsx | 3 - .../[executionId]/resume-page-client.tsx | 6 +- .../templates/components/template-card.tsx | 7 +- apps/sim/app/templates/templates.tsx | 4 +- .../files/[fileId]/view/file-viewer.tsx | 2 +- .../files/[fileId]/view/page.tsx | 2 +- .../edit-chunk-modal/edit-chunk-modal.tsx | 2 +- .../knowledge/[id]/[documentId]/document.tsx | 2 +- .../add-documents-modal.tsx | 2 +- .../base-tags-modal/base-tags-modal.tsx | 2 +- .../create-base-modal/create-base-modal.tsx | 2 +- .../components/line-chart/line-chart.tsx | 16 +- .../logs/components/dashboard/dashboard.tsx | 2 +- .../components/log-details/log-details.tsx | 4 +- .../workflow-selector/workflow-selector.tsx | 2 +- .../notifications/notifications.tsx | 8 +- .../logs-toolbar/components/search/search.tsx | 6 +- .../app/workspace/[workspaceId]/logs/logs.tsx | 6 +- .../providers/global-commands-provider.tsx | 7 +- .../workspace-permissions-provider.tsx | 90 ++- .../templates/components/template-card.tsx | 4 +- .../w/[workflowId]/components/chat/chat.tsx | 11 +- .../output-select/output-select.tsx | 13 +- .../notifications/notifications.tsx | 4 +- .../copilot-message/copilot-message.tsx | 11 +- .../hooks/use-message-editing.ts | 2 +- .../components/tool-call/tool-call.tsx | 2 +- .../components/mention-menu/mention-menu.tsx | 2 +- .../user-input/hooks/use-file-attachments.ts | 4 +- .../user-input/hooks/use-mention-data.ts | 6 +- .../user-input/hooks/use-mention-tokens.ts | 2 +- .../hooks/use-textarea-auto-resize.ts | 4 +- .../components/user-input/user-input.tsx | 21 +- .../panel/components/copilot/copilot.tsx | 2 +- .../deploy-modal/components/api/api.tsx | 13 - .../deploy-modal/components/form/form.tsx | 3 +- .../components/template/template.tsx | 2 +- .../components/deploy-modal/deploy-modal.tsx | 2 +- .../deploy/hooks/use-deployed-state.ts | 2 +- .../components/combobox/combobox.tsx | 6 +- .../condition-input/condition-input.tsx | 58 +- .../components/dropdown/dropdown.tsx | 15 +- .../sub-block/components/env-var-dropdown.tsx | 4 +- .../components/file-upload/file-upload.tsx | 4 +- .../components/folder-selector-input.tsx | 2 +- .../components/long-input/long-input.tsx | 4 +- .../mcp-server-modal/mcp-tool-selector.tsx | 2 +- .../project-selector-input.tsx | 2 +- .../selector-combobox/selector-combobox.tsx | 2 +- .../components/short-input/short-input.tsx | 2 - .../components/slider-input/slider-input.tsx | 2 - .../keyboard-navigation-handler.tsx | 6 +- .../components/tag-dropdown/tag-dropdown.tsx | 3 +- .../custom-tool-modal/custom-tool-modal.tsx | 7 +- .../components/tool-input/tool-input.tsx | 12 +- .../sub-block/hooks/use-depends-on-gate.ts | 1 + .../sub-block/hooks/use-sub-block-input.ts | 22 +- .../sub-block/hooks/use-sub-block-value.ts | 20 +- .../hooks/use-editor-subblock-layout.ts | 1 + .../editor/hooks/use-subflow-editor.ts | 2 +- .../panel/hooks/use-usage-limits.ts | 2 +- .../w/[workflowId]/components/panel/panel.tsx | 3 +- .../components/subflows/subflow-node.tsx | 2 +- .../components/structured-output.tsx | 2 +- .../components/terminal/terminal.tsx | 13 +- .../training-modal/training-modal.tsx | 7 +- .../components/variables/variables.tsx | 23 +- .../wand-prompt-bar/wand-prompt-bar.tsx | 2 +- .../workflow-block/workflow-block.tsx | 19 +- .../hooks/float/use-float-resize.ts | 2 +- .../hooks/use-block-dimensions.ts | 2 +- .../hooks/use-block-output-fields.ts | 2 +- .../w/[workflowId]/hooks/use-wand.ts | 1 + .../hooks/use-workflow-execution.ts | 38 +- .../utils/workflow-execution-utils.ts | 2 +- .../[workspaceId]/w/[workflowId]/workflow.tsx | 37 +- .../preview-workflow/preview-workflow.tsx | 35 +- .../w/components/preview/preview.tsx | 2 +- .../access-control/access-control.tsx | 4 +- .../components/api-keys/api-keys.tsx | 2 +- .../components/environment/environment.tsx | 6 +- .../settings-modal/components/files/files.tsx | 7 +- .../components/integrations/integrations.tsx | 2 +- .../settings-modal/components/mcp/mcp.tsx | 2 +- .../components/team-members/team-members.tsx | 2 +- .../team-management/team-management.tsx | 31 +- .../template-profile/template-profile.tsx | 2 +- .../components/usage-limit/usage-limit.tsx | 4 +- .../settings-modal/settings-modal.tsx | 4 - .../usage-indicator/usage-indicator.tsx | 9 +- .../components/folder-item/folder-item.tsx | 4 +- .../workflow-item/workflow-item.tsx | 2 +- .../components/permissions-table.tsx | 7 +- .../components/invite-modal/invite-modal.tsx | 558 +++++++----------- .../w/components/sidebar/hooks/index.ts | 2 +- .../components/sidebar/hooks/use-drag-drop.ts | 63 +- .../sidebar/hooks/use-sidebar-resize.ts | 4 +- .../sidebar/hooks/use-workspace-management.ts | 389 ++++-------- .../w/components/sidebar/sidebar.tsx | 7 +- .../w/hooks/use-export-folder.ts | 2 +- .../app/workspace/[workspaceId]/w/page.tsx | 2 +- .../workspace/providers/socket-provider.tsx | 2 +- apps/sim/background/webhook-execution.ts | 2 +- .../workspace-notification-delivery.ts | 7 +- apps/sim/blocks/blocks.test.ts | 1 - apps/sim/blocks/blocks/kalshi.ts | 2 +- apps/sim/blocks/blocks/microsoft_excel.ts | 2 +- apps/sim/blocks/blocks/onedrive.ts | 3 - apps/sim/blocks/blocks/supabase.ts | 3 - apps/sim/blocks/types.ts | 2 +- .../components/emcn/components/code/code.tsx | 2 +- .../emcn/components/modal/modal.tsx | 2 +- .../emcn/components/s-modal/s-modal.tsx | 2 +- apps/sim/executor/dag/builder.test.ts | 2 +- apps/sim/executor/dag/construction/edges.ts | 2 +- apps/sim/executor/dag/construction/loops.ts | 3 - .../executor/dag/construction/parallels.ts | 3 - apps/sim/executor/execution/block-executor.ts | 8 +- apps/sim/executor/execution/engine.ts | 1 - apps/sim/executor/execution/executor.ts | 2 +- .../handlers/agent/agent-handler.test.ts | 17 +- .../executor/handlers/agent/agent-handler.ts | 11 +- apps/sim/executor/handlers/api/api-handler.ts | 5 +- .../condition/condition-handler.test.ts | 2 +- .../handlers/evaluator/evaluator-handler.ts | 2 +- .../handlers/function/function-handler.ts | 2 +- .../handlers/generic/generic-handler.ts | 2 +- .../handlers/response/response-handler.ts | 2 +- .../handlers/variables/variables-handler.ts | 2 +- .../executor/handlers/wait/wait-handler.ts | 2 +- .../handlers/workflow/workflow-handler.ts | 4 +- apps/sim/executor/orchestrators/loop.ts | 2 +- apps/sim/executor/orchestrators/node.ts | 4 +- apps/sim/executor/orchestrators/parallel.ts | 2 +- apps/sim/executor/utils.ts | 4 +- .../sim/executor/utils/file-tool-processor.ts | 2 +- apps/sim/executor/utils/json.ts | 2 +- apps/sim/executor/utils/parallel-expansion.ts | 2 +- apps/sim/executor/utils/subflow-utils.ts | 3 - apps/sim/executor/variables/resolvers/env.ts | 3 - .../executor/variables/resolvers/parallel.ts | 2 +- apps/sim/hooks/queries/a2a/tasks.ts | 2 +- apps/sim/hooks/queries/folders.ts | 3 - apps/sim/hooks/queries/invitations.ts | 350 +++++++++++ apps/sim/hooks/queries/oauth-connections.ts | 92 ++- .../queries/utils/optimistic-mutation.ts | 2 +- apps/sim/hooks/queries/workspace.ts | 208 ++++++- apps/sim/hooks/use-permission-config.ts | 4 +- apps/sim/hooks/use-selector-display-name.ts | 2 +- apps/sim/hooks/use-slack-accounts.ts | 52 -- apps/sim/hooks/use-user-permissions.ts | 4 +- apps/sim/hooks/use-workspace-permissions.ts | 107 ---- apps/sim/lib/api-key/crypto.ts | 2 +- apps/sim/lib/audio/extractor.ts | 6 +- apps/sim/lib/auth/auth.ts | 2 +- apps/sim/lib/auth/internal.ts | 2 +- .../lib/billing/organizations/membership.ts | 2 +- apps/sim/lib/blog/registry.ts | 4 +- apps/sim/lib/blog/utils.ts | 4 +- apps/sim/lib/chunkers/docs-chunker.ts | 4 +- apps/sim/lib/chunkers/json-yaml-chunker.ts | 4 +- apps/sim/lib/chunkers/text-chunker.test.ts | 1 - apps/sim/lib/copilot/config.ts | 4 +- .../client/blocks/get-blocks-and-tools.ts | 2 - .../tools/client/blocks/get-trigger-blocks.ts | 2 - .../sim/lib/copilot/tools/client/ui-config.ts | 2 +- .../client/workflow/get-workflow-from-name.ts | 3 - .../server/blocks/get-blocks-metadata-tool.ts | 6 +- .../tools/server/workflow/edit-workflow.ts | 11 +- .../server/workflow/get-workflow-console.ts | 47 -- apps/sim/lib/core/idempotency/service.ts | 2 +- apps/sim/lib/core/security/csp.ts | 6 +- apps/sim/lib/core/security/deployment.ts | 2 +- apps/sim/lib/core/security/encryption.ts | 2 +- .../sim/lib/core/security/input-validation.ts | 8 +- apps/sim/lib/core/telemetry.ts | 2 +- apps/sim/lib/core/utils/response-format.ts | 4 +- apps/sim/lib/execution/isolated-vm.ts | 4 +- apps/sim/lib/file-parsers/csv-parser.ts | 4 +- apps/sim/lib/file-parsers/doc-parser.ts | 4 +- apps/sim/lib/file-parsers/docx-parser.ts | 2 +- apps/sim/lib/file-parsers/html-parser.ts | 2 +- apps/sim/lib/file-parsers/index.test.ts | 2 +- apps/sim/lib/file-parsers/index.ts | 4 +- apps/sim/lib/file-parsers/json-parser.ts | 2 +- apps/sim/lib/file-parsers/md-parser.ts | 2 +- apps/sim/lib/file-parsers/pdf-parser.ts | 2 +- apps/sim/lib/file-parsers/pptx-parser.ts | 6 +- apps/sim/lib/file-parsers/txt-parser.ts | 2 +- apps/sim/lib/file-parsers/xlsx-parser.ts | 2 +- apps/sim/lib/file-parsers/yaml-parser.ts | 2 +- apps/sim/lib/guardrails/validate_pii.ts | 6 +- apps/sim/lib/knowledge/chunks/service.ts | 4 +- .../knowledge/documents/document-processor.ts | 20 +- apps/sim/lib/knowledge/documents/service.ts | 2 +- apps/sim/lib/knowledge/service.ts | 2 +- apps/sim/lib/knowledge/tags/service.ts | 2 +- .../sim/lib/logs/execution/logging-session.ts | 8 +- .../lib/logs/execution/snapshot/service.ts | 2 +- .../execution/trace-spans/trace-spans.test.ts | 10 +- .../logs/execution/trace-spans/trace-spans.ts | 6 +- apps/sim/lib/mcp/middleware.ts | 2 +- .../lib/messaging/email/unsubscribe.test.ts | 2 +- apps/sim/lib/messaging/email/unsubscribe.ts | 2 +- apps/sim/lib/messaging/email/validation.ts | 4 +- apps/sim/lib/tokenization/estimators.ts | 2 +- apps/sim/lib/uploads/core/setup.server.ts | 6 +- apps/sim/lib/uploads/core/storage-service.ts | 12 +- apps/sim/lib/uploads/utils/validation.ts | 2 +- .../lib/webhooks/provider-subscriptions.ts | 7 +- apps/sim/lib/webhooks/utils.server.ts | 9 +- apps/sim/lib/workflows/autolayout/core.ts | 8 +- apps/sim/lib/workflows/autolayout/utils.ts | 2 +- apps/sim/lib/workflows/defaults.ts | 2 +- apps/sim/lib/workflows/diff/diff-engine.ts | 29 +- .../workflows/executor/execute-workflow.ts | 2 +- .../lib/workflows/executor/execution-core.ts | 2 +- .../executor/human-in-the-loop-manager.ts | 2 +- .../lib/workflows/persistence/utils.test.ts | 4 +- apps/sim/lib/workflows/persistence/utils.ts | 2 +- apps/sim/lib/workflows/streaming/streaming.ts | 8 +- .../sim/lib/workflows/subblocks/visibility.ts | 16 +- .../lib/workflows/triggers/trigger-utils.ts | 2 +- apps/sim/lib/workflows/utils.test.ts | 5 - apps/sim/lib/workspaces/duplicate.ts | 2 +- apps/sim/lib/workspaces/naming.ts | 2 +- apps/sim/providers/anthropic/index.ts | 18 - apps/sim/scripts/export-workflow.ts | 7 +- apps/sim/scripts/process-docs.ts | 2 +- apps/sim/serializer/index.ts | 6 +- .../serializer/tests/dual-validation.test.ts | 2 +- .../tests/serializer.extended.test.ts | 10 +- apps/sim/socket/config/socket.ts | 2 +- apps/sim/socket/database/operations.ts | 28 - apps/sim/socket/index.test.ts | 2 +- apps/sim/socket/index.ts | 2 +- apps/sim/socket/routes/http.ts | 2 +- apps/sim/socket/tests/socket-server.test.ts | 2 +- apps/sim/stores/folders/store.ts | 3 - apps/sim/stores/operation-queue/store.ts | 1 - apps/sim/stores/panel/copilot/store.ts | 15 +- apps/sim/stores/panel/variables/store.ts | 14 - apps/sim/stores/workflows/index.ts | 1 - apps/sim/stores/workflows/registry/store.ts | 2 +- apps/sim/stores/workflows/utils.test.ts | 8 +- apps/sim/stores/workflows/workflow/utils.ts | 6 +- apps/sim/tools/a2a/cancel_task.ts | 4 +- .../sim/tools/a2a/delete_push_notification.ts | 7 +- apps/sim/tools/a2a/get_agent_card.ts | 4 +- apps/sim/tools/a2a/get_push_notification.ts | 7 +- apps/sim/tools/a2a/get_task.ts | 4 +- apps/sim/tools/a2a/resubscribe.ts | 4 +- apps/sim/tools/a2a/send_message.ts | 4 +- apps/sim/tools/a2a/set_push_notification.ts | 7 +- apps/sim/tools/apify/run_actor_async.ts | 4 +- apps/sim/tools/apify/run_actor_sync.ts | 4 +- apps/sim/tools/confluence/delete_page.ts | 2 +- apps/sim/tools/confluence/retrieve.ts | 2 +- apps/sim/tools/confluence/update.ts | 2 +- apps/sim/tools/datadog/list_monitors.ts | 2 +- apps/sim/tools/discord/add_reaction.ts | 2 +- apps/sim/tools/discord/assign_role.ts | 2 +- apps/sim/tools/discord/ban_member.ts | 2 +- apps/sim/tools/discord/delete_channel.ts | 2 +- apps/sim/tools/discord/delete_invite.ts | 2 +- apps/sim/tools/discord/delete_message.ts | 2 +- apps/sim/tools/discord/delete_role.ts | 2 +- apps/sim/tools/discord/delete_webhook.ts | 2 +- apps/sim/tools/discord/join_thread.ts | 2 +- apps/sim/tools/discord/kick_member.ts | 2 +- apps/sim/tools/discord/leave_thread.ts | 2 +- apps/sim/tools/discord/pin_message.ts | 2 +- apps/sim/tools/discord/remove_reaction.ts | 2 +- apps/sim/tools/discord/remove_role.ts | 2 +- apps/sim/tools/discord/unban_member.ts | 2 +- apps/sim/tools/discord/unpin_message.ts | 2 +- apps/sim/tools/dropbox/upload.ts | 2 +- apps/sim/tools/elevenlabs/tts.ts | 2 +- apps/sim/tools/error-extractors.ts | 4 +- apps/sim/tools/github/delete_branch.ts | 2 +- apps/sim/tools/github/get_file_content.ts | 2 +- apps/sim/tools/github/rerun_workflow.ts | 2 +- apps/sim/tools/gmail/add_label.ts | 3 +- apps/sim/tools/gmail/archive.ts | 3 +- apps/sim/tools/gmail/delete.ts | 3 +- apps/sim/tools/gmail/draft.ts | 3 +- apps/sim/tools/gmail/mark_read.ts | 3 +- apps/sim/tools/gmail/mark_unread.ts | 3 +- apps/sim/tools/gmail/move.ts | 3 +- apps/sim/tools/gmail/read.ts | 3 +- apps/sim/tools/gmail/remove_label.ts | 3 +- apps/sim/tools/gmail/search.ts | 4 +- apps/sim/tools/gmail/send.ts | 3 +- apps/sim/tools/gmail/unarchive.ts | 3 +- apps/sim/tools/gmail/utils.ts | 6 +- apps/sim/tools/google_forms/get_responses.ts | 2 +- apps/sim/tools/google_groups/add_alias.ts | 5 +- apps/sim/tools/google_groups/add_member.ts | 2 +- apps/sim/tools/google_groups/create_group.ts | 2 +- apps/sim/tools/google_groups/delete_group.ts | 2 +- apps/sim/tools/google_groups/get_group.ts | 2 +- apps/sim/tools/google_groups/get_member.ts | 2 +- apps/sim/tools/google_groups/get_settings.ts | 5 +- apps/sim/tools/google_groups/has_member.ts | 2 +- apps/sim/tools/google_groups/list_aliases.ts | 5 +- apps/sim/tools/google_groups/list_groups.ts | 2 +- apps/sim/tools/google_groups/list_members.ts | 5 +- apps/sim/tools/google_groups/remove_alias.ts | 5 +- apps/sim/tools/google_groups/remove_member.ts | 5 +- apps/sim/tools/google_groups/update_group.ts | 2 +- apps/sim/tools/google_groups/update_member.ts | 5 +- .../tools/google_groups/update_settings.ts | 5 +- apps/sim/tools/http/webhook_request.ts | 4 +- apps/sim/tools/hubspot/create_company.ts | 2 +- apps/sim/tools/hubspot/create_contact.ts | 2 +- apps/sim/tools/hubspot/get_users.ts | 2 +- apps/sim/tools/hubspot/update_company.ts | 2 +- apps/sim/tools/hubspot/update_contact.ts | 2 +- .../tools/incidentio/custom_fields_delete.ts | 2 +- .../incidentio/escalation_paths_delete.ts | 2 +- .../tools/incidentio/incident_roles_delete.ts | 2 +- .../incidentio/incident_statuses_list.ts | 4 +- .../tools/incidentio/incident_types_list.ts | 4 +- apps/sim/tools/incidentio/schedules_delete.ts | 2 +- apps/sim/tools/incidentio/severities_list.ts | 5 +- apps/sim/tools/incidentio/users_list.ts | 5 +- apps/sim/tools/incidentio/users_show.ts | 5 +- apps/sim/tools/incidentio/workflows_create.ts | 2 +- apps/sim/tools/incidentio/workflows_delete.ts | 4 +- apps/sim/tools/incidentio/workflows_list.ts | 2 +- apps/sim/tools/incidentio/workflows_show.ts | 2 +- apps/sim/tools/incidentio/workflows_update.ts | 2 +- apps/sim/tools/index.test.ts | 12 +- apps/sim/tools/index.ts | 6 +- apps/sim/tools/intercom/get_company.ts | 3 - apps/sim/tools/intercom/get_conversation.ts | 3 - apps/sim/tools/intercom/list_companies.ts | 3 - apps/sim/tools/intercom/list_contacts.ts | 3 - apps/sim/tools/intercom/list_conversations.ts | 3 - apps/sim/tools/intercom/reply_conversation.ts | 3 - apps/sim/tools/intercom/search_contacts.ts | 5 +- apps/sim/tools/jira/add_worklog.ts | 2 +- apps/sim/tools/jira/assign_issue.ts | 6 +- apps/sim/tools/jira/bulk_read.ts | 8 +- apps/sim/tools/jira/create_issue_link.ts | 16 +- apps/sim/tools/jira/delete_issue.ts | 6 +- apps/sim/tools/jira/get_users.ts | 20 +- apps/sim/tools/jira/retrieve.ts | 14 +- apps/sim/tools/jira/search_issues.ts | 2 +- apps/sim/tools/jira/transition_issue.ts | 10 +- apps/sim/tools/kalshi/amend_order.ts | 4 +- apps/sim/tools/kalshi/cancel_order.ts | 4 +- apps/sim/tools/kalshi/create_order.ts | 4 +- apps/sim/tools/kalshi/get_balance.ts | 4 +- apps/sim/tools/kalshi/get_candlesticks.ts | 4 +- apps/sim/tools/kalshi/get_event.ts | 4 +- apps/sim/tools/kalshi/get_events.ts | 8 +- apps/sim/tools/kalshi/get_exchange_status.ts | 4 +- apps/sim/tools/kalshi/get_fills.ts | 6 +- apps/sim/tools/kalshi/get_market.ts | 4 +- apps/sim/tools/kalshi/get_markets.ts | 6 +- apps/sim/tools/kalshi/get_order.ts | 4 +- apps/sim/tools/kalshi/get_orderbook.ts | 4 +- apps/sim/tools/kalshi/get_orders.ts | 6 +- apps/sim/tools/kalshi/get_positions.ts | 6 +- apps/sim/tools/kalshi/get_series_by_ticker.ts | 4 +- apps/sim/tools/kalshi/get_trades.ts | 8 +- apps/sim/tools/kalshi/types.ts | 2 +- apps/sim/tools/linkedin/share_post.ts | 2 +- apps/sim/tools/mailchimp/add_member.ts | 6 +- apps/sim/tools/mailchimp/add_member_tags.ts | 2 +- .../tools/mailchimp/add_or_update_member.ts | 6 +- .../sim/tools/mailchimp/add_segment_member.ts | 10 +- .../mailchimp/add_subscriber_to_automation.ts | 7 +- apps/sim/tools/mailchimp/archive_member.ts | 5 +- apps/sim/tools/mailchimp/create_audience.ts | 4 +- .../tools/mailchimp/create_batch_operation.ts | 4 +- apps/sim/tools/mailchimp/create_campaign.ts | 6 +- apps/sim/tools/mailchimp/create_interest.ts | 7 +- .../mailchimp/create_interest_category.ts | 7 +- .../tools/mailchimp/create_landing_page.ts | 7 +- .../sim/tools/mailchimp/create_merge_field.ts | 7 +- apps/sim/tools/mailchimp/create_segment.ts | 4 +- apps/sim/tools/mailchimp/create_template.ts | 5 +- apps/sim/tools/mailchimp/delete_audience.ts | 5 +- .../tools/mailchimp/delete_batch_operation.ts | 5 +- apps/sim/tools/mailchimp/delete_campaign.ts | 5 +- apps/sim/tools/mailchimp/delete_interest.ts | 5 +- .../mailchimp/delete_interest_category.ts | 5 +- .../tools/mailchimp/delete_landing_page.ts | 5 +- apps/sim/tools/mailchimp/delete_member.ts | 5 +- .../sim/tools/mailchimp/delete_merge_field.ts | 5 +- apps/sim/tools/mailchimp/delete_segment.ts | 5 +- apps/sim/tools/mailchimp/delete_template.ts | 5 +- apps/sim/tools/mailchimp/get_audience.ts | 7 +- apps/sim/tools/mailchimp/get_audiences.ts | 7 +- apps/sim/tools/mailchimp/get_automation.ts | 7 +- apps/sim/tools/mailchimp/get_automations.ts | 7 +- .../tools/mailchimp/get_batch_operation.ts | 7 +- .../tools/mailchimp/get_batch_operations.ts | 7 +- apps/sim/tools/mailchimp/get_campaign.ts | 9 +- .../tools/mailchimp/get_campaign_content.ts | 9 +- .../tools/mailchimp/get_campaign_report.ts | 9 +- .../tools/mailchimp/get_campaign_reports.ts | 9 +- apps/sim/tools/mailchimp/get_campaigns.ts | 9 +- apps/sim/tools/mailchimp/get_interest.ts | 7 +- .../mailchimp/get_interest_categories.ts | 5 +- .../tools/mailchimp/get_interest_category.ts | 7 +- apps/sim/tools/mailchimp/get_interests.ts | 5 +- apps/sim/tools/mailchimp/get_landing_page.ts | 7 +- apps/sim/tools/mailchimp/get_landing_pages.ts | 7 +- apps/sim/tools/mailchimp/get_member.ts | 9 +- apps/sim/tools/mailchimp/get_member_tags.ts | 5 +- apps/sim/tools/mailchimp/get_members.ts | 9 +- apps/sim/tools/mailchimp/get_merge_field.ts | 5 +- apps/sim/tools/mailchimp/get_merge_fields.ts | 7 +- apps/sim/tools/mailchimp/get_segment.ts | 7 +- .../tools/mailchimp/get_segment_members.ts | 7 +- apps/sim/tools/mailchimp/get_segments.ts | 5 +- apps/sim/tools/mailchimp/get_template.ts | 7 +- apps/sim/tools/mailchimp/get_templates.ts | 7 +- apps/sim/tools/mailchimp/pause_automation.ts | 2 +- .../tools/mailchimp/publish_landing_page.ts | 2 +- .../sim/tools/mailchimp/remove_member_tags.ts | 2 +- .../tools/mailchimp/remove_segment_member.ts | 2 +- .../sim/tools/mailchimp/replicate_campaign.ts | 2 +- apps/sim/tools/mailchimp/schedule_campaign.ts | 2 +- apps/sim/tools/mailchimp/send_campaign.ts | 2 +- .../tools/mailchimp/set_campaign_content.ts | 6 +- apps/sim/tools/mailchimp/start_automation.ts | 2 +- apps/sim/tools/mailchimp/unarchive_member.ts | 6 +- .../tools/mailchimp/unpublish_landing_page.ts | 2 +- .../tools/mailchimp/unschedule_campaign.ts | 2 +- apps/sim/tools/mailchimp/update_audience.ts | 4 +- apps/sim/tools/mailchimp/update_campaign.ts | 6 +- apps/sim/tools/mailchimp/update_interest.ts | 4 +- .../mailchimp/update_interest_category.ts | 4 +- .../tools/mailchimp/update_landing_page.ts | 4 +- apps/sim/tools/mailchimp/update_member.ts | 6 +- .../sim/tools/mailchimp/update_merge_field.ts | 4 +- apps/sim/tools/mailchimp/update_segment.ts | 4 +- apps/sim/tools/mailchimp/update_template.ts | 4 +- apps/sim/tools/mailgun/add_list_member.ts | 2 +- apps/sim/tools/mailgun/create_mailing_list.ts | 2 +- apps/sim/tools/mailgun/get_domain.ts | 2 +- apps/sim/tools/mailgun/get_mailing_list.ts | 2 +- apps/sim/tools/mailgun/get_message.ts | 2 +- apps/sim/tools/mailgun/list_domains.ts | 2 +- apps/sim/tools/mailgun/list_messages.ts | 2 +- apps/sim/tools/mailgun/send_message.ts | 2 +- .../tools/microsoft_planner/delete_bucket.ts | 2 +- .../tools/microsoft_planner/delete_task.ts | 2 +- apps/sim/tools/outlook/read.ts | 6 +- apps/sim/tools/pipedrive/get_all_deals.ts | 2 +- apps/sim/tools/posthog/batch_events.ts | 4 +- apps/sim/tools/posthog/capture_event.ts | 4 +- apps/sim/tools/posthog/create_cohort.ts | 6 +- apps/sim/tools/posthog/create_insight.ts | 4 +- apps/sim/tools/posthog/delete_feature_flag.ts | 2 +- apps/sim/tools/posthog/query.ts | 4 +- apps/sim/tools/reddit/get_comments.ts | 2 +- apps/sim/tools/s3/get_object.ts | 2 +- apps/sim/tools/s3/utils.ts | 2 +- apps/sim/tools/salesforce/get_accounts.ts | 2 +- apps/sim/tools/salesforce/list_dashboards.ts | 2 +- apps/sim/tools/salesforce/list_reports.ts | 6 +- apps/sim/tools/search/tool.ts | 2 +- apps/sim/tools/sendgrid/send_mail.ts | 4 +- apps/sim/tools/sentry/releases_create.ts | 2 +- apps/sim/tools/sharepoint/list_sites.ts | 2 +- apps/sim/tools/shopify/adjust_inventory.ts | 4 +- apps/sim/tools/shopify/cancel_order.ts | 4 +- apps/sim/tools/shopify/create_customer.ts | 4 +- apps/sim/tools/shopify/create_fulfillment.ts | 4 +- apps/sim/tools/shopify/create_product.ts | 4 +- apps/sim/tools/shopify/delete_customer.ts | 2 +- apps/sim/tools/shopify/delete_product.ts | 2 +- apps/sim/tools/shopify/get_collection.ts | 4 +- apps/sim/tools/shopify/get_customer.ts | 4 +- apps/sim/tools/shopify/get_inventory_level.ts | 7 +- apps/sim/tools/shopify/get_order.ts | 4 +- apps/sim/tools/shopify/get_product.ts | 4 +- apps/sim/tools/shopify/list_collections.ts | 4 +- apps/sim/tools/shopify/list_customers.ts | 4 +- .../sim/tools/shopify/list_inventory_items.ts | 7 +- apps/sim/tools/shopify/list_locations.ts | 4 +- apps/sim/tools/shopify/list_orders.ts | 4 +- apps/sim/tools/shopify/list_products.ts | 4 +- apps/sim/tools/shopify/update_customer.ts | 4 +- apps/sim/tools/shopify/update_order.ts | 4 +- apps/sim/tools/shopify/update_product.ts | 4 +- apps/sim/tools/similarweb/bounce_rate.ts | 5 +- apps/sim/tools/similarweb/pages_per_visit.ts | 5 +- apps/sim/tools/similarweb/traffic_visits.ts | 5 +- apps/sim/tools/similarweb/visit_duration.ts | 5 +- apps/sim/tools/similarweb/website_overview.ts | 5 +- apps/sim/tools/spotify/add_to_queue.ts | 2 +- .../tools/spotify/add_tracks_to_playlist.ts | 5 +- apps/sim/tools/spotify/check_saved_tracks.ts | 5 +- apps/sim/tools/spotify/create_playlist.ts | 5 +- apps/sim/tools/spotify/get_album.ts | 6 +- apps/sim/tools/spotify/get_album_tracks.ts | 2 +- apps/sim/tools/spotify/get_albums.ts | 2 +- apps/sim/tools/spotify/get_artist.ts | 2 +- apps/sim/tools/spotify/get_artist_albums.ts | 5 +- .../tools/spotify/get_artist_top_tracks.ts | 7 +- apps/sim/tools/spotify/get_artists.ts | 2 +- apps/sim/tools/spotify/get_categories.ts | 5 +- apps/sim/tools/spotify/get_current_user.ts | 5 +- .../tools/spotify/get_currently_playing.ts | 2 +- apps/sim/tools/spotify/get_devices.ts | 2 +- .../sim/tools/spotify/get_followed_artists.ts | 2 +- apps/sim/tools/spotify/get_new_releases.ts | 7 +- apps/sim/tools/spotify/get_playback_state.ts | 10 +- apps/sim/tools/spotify/get_playlist.ts | 4 +- apps/sim/tools/spotify/get_playlist_tracks.ts | 7 +- apps/sim/tools/spotify/get_queue.ts | 2 +- apps/sim/tools/spotify/get_recently_played.ts | 7 +- apps/sim/tools/spotify/get_saved_albums.ts | 2 +- apps/sim/tools/spotify/get_saved_tracks.ts | 7 +- apps/sim/tools/spotify/get_top_artists.ts | 2 +- apps/sim/tools/spotify/get_top_tracks.ts | 7 +- apps/sim/tools/spotify/get_track.ts | 7 +- apps/sim/tools/spotify/get_tracks.ts | 7 +- apps/sim/tools/spotify/get_user_playlists.ts | 5 +- apps/sim/tools/spotify/pause.ts | 2 +- apps/sim/tools/spotify/play.ts | 2 +- .../spotify/remove_tracks_from_playlist.ts | 4 +- apps/sim/tools/spotify/save_tracks.ts | 2 +- apps/sim/tools/spotify/search.ts | 6 +- apps/sim/tools/spotify/set_volume.ts | 2 +- apps/sim/tools/spotify/skip_next.ts | 2 +- apps/sim/tools/spotify/skip_previous.ts | 2 +- apps/sim/tools/stagehand/extract.ts | 5 +- .../tools/supabase/storage_get_public_url.ts | 2 +- apps/sim/tools/tinybird/events.ts | 2 +- apps/sim/tools/typeform/insights.ts | 3 - apps/sim/tools/wealthbox/read_contact.ts | 3 - apps/sim/tools/wealthbox/read_note.ts | 3 - apps/sim/tools/wordpress/create_category.ts | 2 +- apps/sim/tools/wordpress/create_comment.ts | 2 +- apps/sim/tools/wordpress/create_page.ts | 2 +- apps/sim/tools/wordpress/create_post.ts | 2 +- apps/sim/tools/wordpress/create_tag.ts | 2 +- apps/sim/tools/wordpress/delete_comment.ts | 2 +- apps/sim/tools/wordpress/delete_media.ts | 2 +- apps/sim/tools/wordpress/delete_page.ts | 2 +- apps/sim/tools/wordpress/delete_post.ts | 2 +- apps/sim/tools/wordpress/get_current_user.ts | 2 +- apps/sim/tools/wordpress/get_media.ts | 2 +- apps/sim/tools/wordpress/get_page.ts | 2 +- apps/sim/tools/wordpress/get_post.ts | 2 +- apps/sim/tools/wordpress/get_user.ts | 2 +- apps/sim/tools/wordpress/list_categories.ts | 2 +- apps/sim/tools/wordpress/list_comments.ts | 2 +- apps/sim/tools/wordpress/list_media.ts | 2 +- apps/sim/tools/wordpress/list_pages.ts | 2 +- apps/sim/tools/wordpress/list_posts.ts | 2 +- apps/sim/tools/wordpress/list_tags.ts | 2 +- apps/sim/tools/wordpress/list_users.ts | 2 +- apps/sim/tools/wordpress/search_content.ts | 2 +- apps/sim/tools/wordpress/update_comment.ts | 2 +- apps/sim/tools/wordpress/update_page.ts | 2 +- apps/sim/tools/wordpress/update_post.ts | 2 +- apps/sim/tools/wordpress/upload_media.ts | 5 +- apps/sim/tools/x/user.ts | 2 +- .../zendesk/autocomplete_organizations.ts | 5 +- apps/sim/tools/zendesk/create_organization.ts | 6 +- .../zendesk/create_organizations_bulk.ts | 2 +- apps/sim/tools/zendesk/create_ticket.ts | 6 +- apps/sim/tools/zendesk/create_tickets_bulk.ts | 2 +- apps/sim/tools/zendesk/create_user.ts | 2 +- apps/sim/tools/zendesk/create_users_bulk.ts | 2 +- apps/sim/tools/zendesk/delete_organization.ts | 5 +- apps/sim/tools/zendesk/delete_ticket.ts | 5 +- apps/sim/tools/zendesk/delete_user.ts | 5 +- apps/sim/tools/zendesk/get_current_user.ts | 5 +- apps/sim/tools/zendesk/get_organization.ts | 9 +- apps/sim/tools/zendesk/get_organizations.ts | 5 +- apps/sim/tools/zendesk/get_ticket.ts | 9 +- apps/sim/tools/zendesk/get_tickets.ts | 5 +- apps/sim/tools/zendesk/get_user.ts | 5 +- apps/sim/tools/zendesk/get_users.ts | 5 +- apps/sim/tools/zendesk/merge_tickets.ts | 5 +- apps/sim/tools/zendesk/search.ts | 10 +- apps/sim/tools/zendesk/search_count.ts | 5 +- apps/sim/tools/zendesk/search_users.ts | 5 +- apps/sim/tools/zendesk/update_organization.ts | 6 +- apps/sim/tools/zendesk/update_ticket.ts | 6 +- apps/sim/tools/zendesk/update_tickets_bulk.ts | 5 +- apps/sim/tools/zendesk/update_user.ts | 2 +- apps/sim/tools/zendesk/update_users_bulk.ts | 2 +- apps/sim/triggers/gmail/poller.ts | 2 +- apps/sim/triggers/grain/utils.ts | 2 +- apps/sim/triggers/hubspot/utils.ts | 6 +- apps/sim/triggers/lemlist/utils.ts | 2 +- apps/sim/triggers/outlook/poller.ts | 2 +- apps/sim/vitest.config.ts | 2 +- biome.json | 27 +- packages/cli/src/index.ts | 10 +- packages/testing/src/mocks/socket.mock.ts | 2 +- packages/ts-sdk/src/index.ts | 2 +- scripts/create-single-release.ts | 2 +- scripts/generate-docs.ts | 260 +------- 789 files changed, 2540 insertions(+), 3136 deletions(-) create mode 100644 apps/sim/hooks/queries/invitations.ts delete mode 100644 apps/sim/hooks/use-slack-accounts.ts delete mode 100644 apps/sim/hooks/use-workspace-permissions.ts diff --git a/apps/sim/app/(auth)/components/social-login-buttons.tsx b/apps/sim/app/(auth)/components/social-login-buttons.tsx index 541c242a12..803d3f579a 100644 --- a/apps/sim/app/(auth)/components/social-login-buttons.tsx +++ b/apps/sim/app/(auth)/components/social-login-buttons.tsx @@ -39,18 +39,8 @@ export function SocialLoginButtons({ setIsGithubLoading(true) try { await client.signIn.social({ provider: 'github', callbackURL }) - } catch (err: any) { - let errorMessage = 'Failed to sign in with GitHub' - - if (err.message?.includes('account exists')) { - errorMessage = 'An account with this email already exists. Please sign in instead.' - } else if (err.message?.includes('cancelled')) { - errorMessage = 'GitHub sign in was cancelled. Please try again.' - } else if (err.message?.includes('network')) { - errorMessage = 'Network error. Please check your connection and try again.' - } else if (err.message?.includes('rate limit')) { - errorMessage = 'Too many attempts. Please try again later.' - } + } catch (_err: unknown) { + // Error handling is done silently - user will see the OAuth error page if needed } finally { setIsGithubLoading(false) } @@ -62,18 +52,8 @@ export function SocialLoginButtons({ setIsGoogleLoading(true) try { await client.signIn.social({ provider: 'google', callbackURL }) - } catch (err: any) { - let errorMessage = 'Failed to sign in with Google' - - if (err.message?.includes('account exists')) { - errorMessage = 'An account with this email already exists. Please sign in instead.' - } else if (err.message?.includes('cancelled')) { - errorMessage = 'Google sign in was cancelled. Please try again.' - } else if (err.message?.includes('network')) { - errorMessage = 'Network error. Please check your connection and try again.' - } else if (err.message?.includes('rate limit')) { - errorMessage = 'Too many attempts. Please try again later.' - } + } catch (_err: unknown) { + // Error handling is done silently - user will see the OAuth error page if needed } finally { setIsGoogleLoading(false) } diff --git a/apps/sim/app/(auth)/login/login-form.tsx b/apps/sim/app/(auth)/login/login-form.tsx index c58b102bc5..66d1a31cd6 100644 --- a/apps/sim/app/(auth)/login/login-form.tsx +++ b/apps/sim/app/(auth)/login/login-form.tsx @@ -158,7 +158,7 @@ export default function LoginPage({ return () => { window.removeEventListener('keydown', handleKeyDown) } - }, [forgotPasswordEmail, forgotPasswordOpen]) + }, [forgotPasswordOpen]) const handleEmailChange = (e: React.ChangeEvent) => { const newEmail = e.target.value diff --git a/apps/sim/app/(auth)/sso/sso-form.tsx b/apps/sim/app/(auth)/sso/sso-form.tsx index 12901c51c2..9d4a722357 100644 --- a/apps/sim/app/(auth)/sso/sso-form.tsx +++ b/apps/sim/app/(auth)/sso/sso-form.tsx @@ -3,7 +3,7 @@ import { useEffect, useState } from 'react' import { createLogger } from '@sim/logger' import Link from 'next/link' -import { useRouter, useSearchParams } from 'next/navigation' +import { useSearchParams } from 'next/navigation' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' @@ -52,7 +52,6 @@ const validateCallbackUrl = (url: string): boolean => { } export default function SSOForm() { - const router = useRouter() const searchParams = useSearchParams() const [isLoading, setIsLoading] = useState(false) const [email, setEmail] = useState('') diff --git a/apps/sim/app/(auth)/verify/use-verification.ts b/apps/sim/app/(auth)/verify/use-verification.ts index 3ef05231a4..182d900bbd 100644 --- a/apps/sim/app/(auth)/verify/use-verification.ts +++ b/apps/sim/app/(auth)/verify/use-verification.ts @@ -196,7 +196,7 @@ export function useVerification({ return () => clearTimeout(timeoutId) } - }, [otp, email, isLoading, isVerified]) + }, [otp, email, isLoading, isVerified, verifyCode]) useEffect(() => { if (typeof window !== 'undefined') { @@ -220,7 +220,7 @@ export function useVerification({ handleRedirect() } } - }, [isEmailVerificationEnabled, router, isInviteFlow, redirectUrl]) + }, [isEmailVerificationEnabled, router, isInviteFlow, redirectUrl, refetchSession]) return { otp, diff --git a/apps/sim/app/(landing)/components/hero/components/landing-canvas/dot-pattern.tsx b/apps/sim/app/(landing)/components/hero/components/landing-canvas/dot-pattern.tsx index d3ce55cc3d..35e60c7e31 100644 --- a/apps/sim/app/(landing)/components/hero/components/landing-canvas/dot-pattern.tsx +++ b/apps/sim/app/(landing)/components/hero/components/landing-canvas/dot-pattern.tsx @@ -118,7 +118,7 @@ export function DotPattern({ - {dots.map((dot, index) => ( + {dots.map((dot, _index) => ( { + onInit={() => { setRfReady(true) - // Expose limited viewport API for outer timeline to pan smoothly viewportApiRef.current = { panTo: (x: number, y: number, options?: { duration?: number }) => { setViewport({ x, y, zoom: 1 }, { duration: options?.duration ?? 0 }) diff --git a/apps/sim/app/(landing)/components/hero/hero.tsx b/apps/sim/app/(landing)/components/hero/hero.tsx index 546dc47627..688dce59f5 100644 --- a/apps/sim/app/(landing)/components/hero/hero.tsx +++ b/apps/sim/app/(landing)/components/hero/hero.tsx @@ -140,7 +140,7 @@ export default function Hero() { */ const [rfNodes, setRfNodes] = React.useState([]) const [rfEdges, setRfEdges] = React.useState([]) - const [groupBox, setGroupBox] = React.useState(null) + const [groupBox] = React.useState(null) const [worldWidth, setWorldWidth] = React.useState(1000) const viewportApiRef = React.useRef(null) diff --git a/apps/sim/app/api/a2a/serve/[agentId]/utils.ts b/apps/sim/app/api/a2a/serve/[agentId]/utils.ts index f157d1efb3..1af1939f89 100644 --- a/apps/sim/app/api/a2a/serve/[agentId]/utils.ts +++ b/apps/sim/app/api/a2a/serve/[agentId]/utils.ts @@ -149,7 +149,7 @@ export function extractAgentContent(executeResult: { if (typeof executeResult.output === 'object' && executeResult.output !== null) { const keys = Object.keys(executeResult.output) // Skip empty objects or objects with only undefined values - if (keys.length > 0 && keys.some((k) => executeResult.output![k] !== undefined)) { + if (keys.length > 0 && keys.some((k) => executeResult.output?.[k] !== undefined)) { return JSON.stringify(executeResult.output) } } diff --git a/apps/sim/app/api/auth/oauth/connections/route.ts b/apps/sim/app/api/auth/oauth/connections/route.ts index 148f4b20f2..411928a604 100644 --- a/apps/sim/app/api/auth/oauth/connections/route.ts +++ b/apps/sim/app/api/auth/oauth/connections/route.ts @@ -19,7 +19,7 @@ interface GoogleIdToken { /** * Get all OAuth connections for the current user */ -export async function GET(request: NextRequest) { +export async function GET(_request: NextRequest) { const requestId = generateRequestId() try { diff --git a/apps/sim/app/api/auth/oauth/token/route.test.ts b/apps/sim/app/api/auth/oauth/token/route.test.ts index 6fc18000f2..0e9560c8aa 100644 --- a/apps/sim/app/api/auth/oauth/token/route.test.ts +++ b/apps/sim/app/api/auth/oauth/token/route.test.ts @@ -177,7 +177,6 @@ describe('OAuth Token API Routes', () => { const { POST } = await import('@/app/api/auth/oauth/token/route') const response = await POST(req) - const data = await response.json() expect(response.status).toBe(403) }) diff --git a/apps/sim/app/api/auth/oauth2/callback/shopify/route.ts b/apps/sim/app/api/auth/oauth2/callback/shopify/route.ts index b58fe329c7..7529e28879 100644 --- a/apps/sim/app/api/auth/oauth2/callback/shopify/route.ts +++ b/apps/sim/app/api/auth/oauth2/callback/shopify/route.ts @@ -1,4 +1,4 @@ -import crypto from 'crypto' +import crypto from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { getSession } from '@/lib/auth' diff --git a/apps/sim/app/api/auth/trello/authorize/route.ts b/apps/sim/app/api/auth/trello/authorize/route.ts index d5e23abf03..eac3f0c042 100644 --- a/apps/sim/app/api/auth/trello/authorize/route.ts +++ b/apps/sim/app/api/auth/trello/authorize/route.ts @@ -8,7 +8,7 @@ const logger = createLogger('TrelloAuthorize') export const dynamic = 'force-dynamic' -export async function GET(request: NextRequest) { +export async function GET(_request: NextRequest) { try { const session = await getSession() if (!session?.user?.id) { diff --git a/apps/sim/app/api/auth/trello/callback/route.ts b/apps/sim/app/api/auth/trello/callback/route.ts index 2aa76dc8ad..ba0f7b896e 100644 --- a/apps/sim/app/api/auth/trello/callback/route.ts +++ b/apps/sim/app/api/auth/trello/callback/route.ts @@ -3,7 +3,7 @@ import { getBaseUrl } from '@/lib/core/utils/urls' export const dynamic = 'force-dynamic' -export async function GET(request: NextRequest) { +export async function GET(_request: NextRequest) { const baseUrl = getBaseUrl() return new NextResponse( diff --git a/apps/sim/app/api/chat/[identifier]/otp/route.ts b/apps/sim/app/api/chat/[identifier]/otp/route.ts index 7a9b7bdee9..998efd975e 100644 --- a/apps/sim/app/api/chat/[identifier]/otp/route.ts +++ b/apps/sim/app/api/chat/[identifier]/otp/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { db } from '@sim/db' import { chat, verification } from '@sim/db/schema' import { createLogger } from '@sim/logger' diff --git a/apps/sim/app/api/chat/[identifier]/route.ts b/apps/sim/app/api/chat/[identifier]/route.ts index 57041c4cc5..c6eb003ca5 100644 --- a/apps/sim/app/api/chat/[identifier]/route.ts +++ b/apps/sim/app/api/chat/[identifier]/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { db } from '@sim/db' import { chat, workflow } from '@sim/db/schema' import { createLogger } from '@sim/logger' diff --git a/apps/sim/app/api/chat/route.ts b/apps/sim/app/api/chat/route.ts index e9ad9c079a..6e7c64d462 100644 --- a/apps/sim/app/api/chat/route.ts +++ b/apps/sim/app/api/chat/route.ts @@ -42,7 +42,7 @@ const chatSchema = z.object({ .default([]), }) -export async function GET(request: NextRequest) { +export async function GET(_request: NextRequest) { try { const session = await getSession() diff --git a/apps/sim/app/api/copilot/api-keys/generate/route.ts b/apps/sim/app/api/copilot/api-keys/generate/route.ts index db890bdca3..999a9392a2 100644 --- a/apps/sim/app/api/copilot/api-keys/generate/route.ts +++ b/apps/sim/app/api/copilot/api-keys/generate/route.ts @@ -61,7 +61,7 @@ export async function POST(req: NextRequest) { { success: true, key: { id: data?.id || 'new', apiKey: data.apiKey } }, { status: 201 } ) - } catch (error) { + } catch (_error) { return NextResponse.json({ error: 'Failed to generate copilot API key' }, { status: 500 }) } } diff --git a/apps/sim/app/api/copilot/api-keys/route.ts b/apps/sim/app/api/copilot/api-keys/route.ts index f3e25ac825..f34a7e62cc 100644 --- a/apps/sim/app/api/copilot/api-keys/route.ts +++ b/apps/sim/app/api/copilot/api-keys/route.ts @@ -3,7 +3,7 @@ import { getSession } from '@/lib/auth' import { SIM_AGENT_API_URL_DEFAULT } from '@/lib/copilot/constants' import { env } from '@/lib/core/config/env' -export async function GET(request: NextRequest) { +export async function GET(_request: NextRequest) { try { const session = await getSession() if (!session?.user?.id) { @@ -49,7 +49,7 @@ export async function GET(request: NextRequest) { }) return NextResponse.json({ keys }, { status: 200 }) - } catch (error) { + } catch (_error) { return NextResponse.json({ error: 'Failed to get keys' }, { status: 500 }) } } @@ -89,7 +89,7 @@ export async function DELETE(request: NextRequest) { } return NextResponse.json({ success: true }, { status: 200 }) - } catch (error) { + } catch (_error) { return NextResponse.json({ error: 'Failed to delete key' }, { status: 500 }) } } diff --git a/apps/sim/app/api/copilot/chat/route.ts b/apps/sim/app/api/copilot/chat/route.ts index 9d31bf5c36..e57c1f86d1 100644 --- a/apps/sim/app/api/copilot/chat/route.ts +++ b/apps/sim/app/api/copilot/chat/route.ts @@ -494,20 +494,6 @@ export async function POST(req: NextRequest) { // If streaming is requested, forward the stream and update chat later if (stream && simAgentResponse.body) { - // Create user message to save - const userMessage = { - id: userMessageIdToUse, // Consistent ID used for request and persistence - role: 'user', - content: message, - timestamp: new Date().toISOString(), - ...(fileAttachments && fileAttachments.length > 0 && { fileAttachments }), - ...(Array.isArray(contexts) && contexts.length > 0 && { contexts }), - ...(Array.isArray(contexts) && - contexts.length > 0 && { - contentBlocks: [{ type: 'contexts', contexts: contexts as any, timestamp: Date.now() }], - }), - } - // Create a pass-through stream that captures the response const transformedStream = new ReadableStream({ async start(controller) { @@ -515,14 +501,11 @@ export async function POST(req: NextRequest) { let assistantContent = '' const toolCalls: any[] = [] let buffer = '' - const isFirstDone = true - let responseIdFromStart: string | undefined let responseIdFromDone: string | undefined // Track tool call progress to identify a safe done event const announcedToolCallIds = new Set() const startedToolExecutionIds = new Set() const completedToolExecutionIds = new Set() - let lastDoneResponseId: string | undefined let lastSafeDoneResponseId: string | undefined // Send chatId as first event @@ -564,9 +547,15 @@ export async function POST(req: NextRequest) { } // Forward the sim agent stream and capture assistant response - const reader = simAgentResponse.body!.getReader() + const reader = simAgentResponse.body?.getReader() const decoder = new TextDecoder() + if (!reader) { + logger.error(`[${tracker.requestId}] Failed to get reader from response body`) + controller.close() + return + } + try { while (true) { const { done, value } = await reader.read() @@ -647,15 +636,11 @@ export async function POST(req: NextRequest) { break case 'start': - if (event.data?.responseId) { - responseIdFromStart = event.data.responseId - } break case 'done': if (event.data?.responseId) { responseIdFromDone = event.data.responseId - lastDoneResponseId = responseIdFromDone // Mark this done as safe only if no tool call is currently in progress or pending const announced = announcedToolCallIds.size @@ -690,7 +675,7 @@ export async function POST(req: NextRequest) { `data: ${JSON.stringify({ type: 'content', data: formatted })}\n\n` ) ) - } catch (enqueueErr) { + } catch (_enqueueErr) { reader.cancel() break } @@ -699,7 +684,7 @@ export async function POST(req: NextRequest) { controller.enqueue( encoder.encode(`data: ${JSON.stringify({ type: 'done' })}\n\n`) ) - } catch (enqueueErr) { + } catch (_enqueueErr) { reader.cancel() break } @@ -709,7 +694,7 @@ export async function POST(req: NextRequest) { // Forward original event to client try { controller.enqueue(encoder.encode(`data: ${jsonStr}\n\n`)) - } catch (enqueueErr) { + } catch (_enqueueErr) { reader.cancel() break } @@ -767,17 +752,17 @@ export async function POST(req: NextRequest) { controller.enqueue( encoder.encode(`data: ${JSON.stringify({ type: 'done' })}\n\n`) ) - } catch (enqueueErr) { + } catch (_enqueueErr) { reader.cancel() } } else { try { controller.enqueue(encoder.encode(`data: ${jsonStr}\n\n`)) - } catch (enqueueErr) { + } catch (_enqueueErr) { reader.cancel() } } - } catch (e) { + } catch (_e) { logger.warn(`[${tracker.requestId}] Failed to parse final buffer: "${buffer}"`) } } diff --git a/apps/sim/app/api/copilot/checkpoints/revert/route.ts b/apps/sim/app/api/copilot/checkpoints/revert/route.ts index 7f65e0317e..f98e4230ee 100644 --- a/apps/sim/app/api/copilot/checkpoints/revert/route.ts +++ b/apps/sim/app/api/copilot/checkpoints/revert/route.ts @@ -113,7 +113,7 @@ export async function POST(request: NextRequest) { ) } - const result = await stateResponse.json() + const _result = await stateResponse.json() logger.info( `[${tracker.requestId}] Successfully reverted workflow ${checkpoint.workflowId} to checkpoint ${checkpointId}` ) diff --git a/apps/sim/app/api/copilot/checkpoints/route.ts b/apps/sim/app/api/copilot/checkpoints/route.ts index b1517986a0..3f61992162 100644 --- a/apps/sim/app/api/copilot/checkpoints/route.ts +++ b/apps/sim/app/api/copilot/checkpoints/route.ts @@ -63,7 +63,7 @@ export async function POST(req: NextRequest) { let parsedWorkflowState try { parsedWorkflowState = JSON.parse(workflowState) - } catch (error) { + } catch (_error) { return createBadRequestResponse('Invalid workflow state JSON') } diff --git a/apps/sim/app/api/copilot/confirm/route.ts b/apps/sim/app/api/copilot/confirm/route.ts index 9fd5476c9e..e1b62fc26d 100644 --- a/apps/sim/app/api/copilot/confirm/route.ts +++ b/apps/sim/app/api/copilot/confirm/route.ts @@ -121,8 +121,6 @@ export async function POST(req: NextRequest) { return createBadRequestResponse('Failed to update tool call status or tool call not found') } - const duration = tracker.getDuration() - return NextResponse.json({ success: true, message: message || `Tool call ${toolCallId} has been ${status.toLowerCase()}`, diff --git a/apps/sim/app/api/copilot/feedback/route.ts b/apps/sim/app/api/copilot/feedback/route.ts index 3ff0956122..eb08ea8ae4 100644 --- a/apps/sim/app/api/copilot/feedback/route.ts +++ b/apps/sim/app/api/copilot/feedback/route.ts @@ -111,7 +111,7 @@ export async function POST(req: NextRequest) { * GET /api/copilot/feedback * Get all feedback records (for analytics) */ -export async function GET(req: NextRequest) { +export async function GET(_req: NextRequest) { const tracker = createRequestTracker() try { diff --git a/apps/sim/app/api/copilot/stats/route.ts b/apps/sim/app/api/copilot/stats/route.ts index ea52c1c58b..705c9373fd 100644 --- a/apps/sim/app/api/copilot/stats/route.ts +++ b/apps/sim/app/api/copilot/stats/route.ts @@ -5,7 +5,6 @@ import { authenticateCopilotRequestSessionOnly, createBadRequestResponse, createInternalServerErrorResponse, - createRequestTracker, createUnauthorizedResponse, } from '@/lib/copilot/request-helpers' import { env } from '@/lib/core/config/env' @@ -19,7 +18,6 @@ const BodySchema = z.object({ }) export async function POST(req: NextRequest) { - const tracker = createRequestTracker() try { const { userId, isAuthenticated } = await authenticateCopilotRequestSessionOnly() if (!isAuthenticated || !userId) { @@ -62,7 +60,7 @@ export async function POST(req: NextRequest) { } return NextResponse.json({ success: true }) - } catch (error) { + } catch (_error) { return createInternalServerErrorResponse('Failed to forward copilot stats') } } diff --git a/apps/sim/app/api/copilot/user-models/route.ts b/apps/sim/app/api/copilot/user-models/route.ts index ead14a5e9d..ac64fa74c7 100644 --- a/apps/sim/app/api/copilot/user-models/route.ts +++ b/apps/sim/app/api/copilot/user-models/route.ts @@ -34,7 +34,7 @@ const DEFAULT_ENABLED_MODELS: Record = { } // GET - Fetch user's enabled models -export async function GET(request: NextRequest) { +export async function GET(_request: NextRequest) { try { const session = await getSession() diff --git a/apps/sim/app/api/creators/[id]/route.ts b/apps/sim/app/api/creators/[id]/route.ts index 326504b969..7f181653cd 100644 --- a/apps/sim/app/api/creators/[id]/route.ts +++ b/apps/sim/app/api/creators/[id]/route.ts @@ -46,7 +46,7 @@ async function hasPermission(userId: string, profile: any): Promise { } // GET /api/creators/[id] - Get a specific creator profile -export async function GET(request: NextRequest, { params }: { params: Promise<{ id: string }> }) { +export async function GET(_request: NextRequest, { params }: { params: Promise<{ id: string }> }) { const requestId = generateRequestId() const { id } = await params @@ -137,7 +137,7 @@ export async function PUT(request: NextRequest, { params }: { params: Promise<{ // DELETE /api/creators/[id] - Delete a creator profile export async function DELETE( - request: NextRequest, + _request: NextRequest, { params }: { params: Promise<{ id: string }> } ) { const requestId = generateRequestId() diff --git a/apps/sim/app/api/creators/[id]/verify/route.ts b/apps/sim/app/api/creators/[id]/verify/route.ts index 6ce9e8b3c1..e95fc6cffc 100644 --- a/apps/sim/app/api/creators/[id]/verify/route.ts +++ b/apps/sim/app/api/creators/[id]/verify/route.ts @@ -12,7 +12,7 @@ const logger = createLogger('CreatorVerificationAPI') export const revalidate = 0 // POST /api/creators/[id]/verify - Verify a creator (super users only) -export async function POST(request: NextRequest, { params }: { params: Promise<{ id: string }> }) { +export async function POST(_request: NextRequest, { params }: { params: Promise<{ id: string }> }) { const requestId = generateRequestId() const { id } = await params @@ -62,7 +62,7 @@ export async function POST(request: NextRequest, { params }: { params: Promise<{ // DELETE /api/creators/[id]/verify - Unverify a creator (super users only) export async function DELETE( - request: NextRequest, + _request: NextRequest, { params }: { params: Promise<{ id: string }> } ) { const requestId = generateRequestId() diff --git a/apps/sim/app/api/creators/route.ts b/apps/sim/app/api/creators/route.ts index 1113de3d45..9a44124f2f 100644 --- a/apps/sim/app/api/creators/route.ts +++ b/apps/sim/app/api/creators/route.ts @@ -30,8 +30,6 @@ const CreateCreatorProfileSchema = z.object({ // GET /api/creators - Get creator profiles for current user export async function GET(request: NextRequest) { const requestId = generateRequestId() - const { searchParams } = new URL(request.url) - const userId = searchParams.get('userId') try { const session = await getSession() diff --git a/apps/sim/app/api/credential-sets/[id]/invite/[invitationId]/route.ts b/apps/sim/app/api/credential-sets/[id]/invite/[invitationId]/route.ts index 2e7a5a7dc5..40c4d5751a 100644 --- a/apps/sim/app/api/credential-sets/[id]/invite/[invitationId]/route.ts +++ b/apps/sim/app/api/credential-sets/[id]/invite/[invitationId]/route.ts @@ -37,7 +37,7 @@ async function getCredentialSetWithAccess(credentialSetId: string, userId: strin } export async function POST( - req: NextRequest, + _req: NextRequest, { params }: { params: Promise<{ id: string; invitationId: string }> } ) { const session = await getSession() diff --git a/apps/sim/app/api/credential-sets/[id]/invite/route.ts b/apps/sim/app/api/credential-sets/[id]/invite/route.ts index 3a2e59df5e..bba00ba743 100644 --- a/apps/sim/app/api/credential-sets/[id]/invite/route.ts +++ b/apps/sim/app/api/credential-sets/[id]/invite/route.ts @@ -41,7 +41,7 @@ async function getCredentialSetWithAccess(credentialSetId: string, userId: strin return { set, role: membership.role } } -export async function GET(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { +export async function GET(_req: NextRequest, { params }: { params: Promise<{ id: string }> }) { const session = await getSession() if (!session?.user?.id) { diff --git a/apps/sim/app/api/credential-sets/[id]/members/route.ts b/apps/sim/app/api/credential-sets/[id]/members/route.ts index c09d39f868..4e0e15cafd 100644 --- a/apps/sim/app/api/credential-sets/[id]/members/route.ts +++ b/apps/sim/app/api/credential-sets/[id]/members/route.ts @@ -33,7 +33,7 @@ async function getCredentialSetWithAccess(credentialSetId: string, userId: strin return { set, role: membership.role } } -export async function GET(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { +export async function GET(_req: NextRequest, { params }: { params: Promise<{ id: string }> }) { const session = await getSession() if (!session?.user?.id) { diff --git a/apps/sim/app/api/credential-sets/[id]/route.ts b/apps/sim/app/api/credential-sets/[id]/route.ts index fb40336fd4..7096eed564 100644 --- a/apps/sim/app/api/credential-sets/[id]/route.ts +++ b/apps/sim/app/api/credential-sets/[id]/route.ts @@ -43,7 +43,7 @@ async function getCredentialSetWithAccess(credentialSetId: string, userId: strin return { set, role: membership.role } } -export async function GET(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { +export async function GET(_req: NextRequest, { params }: { params: Promise<{ id: string }> }) { const session = await getSession() if (!session?.user?.id) { @@ -141,7 +141,7 @@ export async function PUT(req: NextRequest, { params }: { params: Promise<{ id: } } -export async function DELETE(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { +export async function DELETE(_req: NextRequest, { params }: { params: Promise<{ id: string }> }) { const session = await getSession() if (!session?.user?.id) { diff --git a/apps/sim/app/api/credential-sets/invite/[token]/route.ts b/apps/sim/app/api/credential-sets/invite/[token]/route.ts index c42fbecda5..1600b19353 100644 --- a/apps/sim/app/api/credential-sets/invite/[token]/route.ts +++ b/apps/sim/app/api/credential-sets/invite/[token]/route.ts @@ -13,7 +13,7 @@ import { syncAllWebhooksForCredentialSet } from '@/lib/webhooks/utils.server' const logger = createLogger('CredentialSetInviteToken') -export async function GET(req: NextRequest, { params }: { params: Promise<{ token: string }> }) { +export async function GET(_req: NextRequest, { params }: { params: Promise<{ token: string }> }) { const { token } = await params const [invitation] = await db @@ -61,7 +61,7 @@ export async function GET(req: NextRequest, { params }: { params: Promise<{ toke }) } -export async function POST(req: NextRequest, { params }: { params: Promise<{ token: string }> }) { +export async function POST(_req: NextRequest, { params }: { params: Promise<{ token: string }> }) { const { token } = await params const session = await getSession() diff --git a/apps/sim/app/api/environment/route.ts b/apps/sim/app/api/environment/route.ts index ad2818b0d1..033fe24538 100644 --- a/apps/sim/app/api/environment/route.ts +++ b/apps/sim/app/api/environment/route.ts @@ -72,7 +72,7 @@ export async function POST(req: NextRequest) { } } -export async function GET(request: Request) { +export async function GET(_request: Request) { const requestId = generateRequestId() try { diff --git a/apps/sim/app/api/files/authorization.ts b/apps/sim/app/api/files/authorization.ts index 3366e5830d..27d39eaa68 100644 --- a/apps/sim/app/api/files/authorization.ts +++ b/apps/sim/app/api/files/authorization.ts @@ -162,7 +162,7 @@ async function verifyWorkspaceFileAccess( cloudKey: string, userId: string, customConfig?: StorageConfig, - isLocal?: boolean + _isLocal?: boolean ): Promise { try { // Priority 1: Check database (most reliable, works for both local and cloud) @@ -228,7 +228,7 @@ async function verifyWorkspaceFileAccess( async function verifyExecutionFileAccess( cloudKey: string, userId: string, - customConfig?: StorageConfig + _customConfig?: StorageConfig ): Promise { const parts = cloudKey.split('/') @@ -493,7 +493,7 @@ async function verifyRegularFileAccess( cloudKey: string, userId: string, customConfig?: StorageConfig, - isLocal?: boolean + _isLocal?: boolean ): Promise { try { // Priority 1: Check if this might be a workspace file (check database) diff --git a/apps/sim/app/api/files/parse/route.test.ts b/apps/sim/app/api/files/parse/route.test.ts index 801795570a..f2e7debf9b 100644 --- a/apps/sim/app/api/files/parse/route.test.ts +++ b/apps/sim/app/api/files/parse/route.test.ts @@ -1,4 +1,4 @@ -import path from 'path' +import path from 'node:path' /** * Tests for file parse API route * diff --git a/apps/sim/app/api/files/parse/route.ts b/apps/sim/app/api/files/parse/route.ts index 50dc55572a..7e857b88cf 100644 --- a/apps/sim/app/api/files/parse/route.ts +++ b/apps/sim/app/api/files/parse/route.ts @@ -1,7 +1,7 @@ -import { Buffer } from 'buffer' -import { createHash } from 'crypto' -import fsPromises, { readFile } from 'fs/promises' -import path from 'path' +import { Buffer } from 'node:buffer' +import { createHash } from 'node:crypto' +import fsPromises, { readFile } from 'node:fs/promises' +import path from 'node:path' import { createLogger } from '@sim/logger' import binaryExtensionsList from 'binary-extensions' import { type NextRequest, NextResponse } from 'next/server' @@ -899,7 +899,7 @@ Please use a PDF viewer for best results.` * Create error message for PDF parsing failure and make it more readable */ function createPdfFailureMessage( - pageCount: number, + _pageCount: number, size: number, path: string, error: string diff --git a/apps/sim/app/api/files/serve/[...path]/route.test.ts b/apps/sim/app/api/files/serve/[...path]/route.test.ts index fe833f3aa3..96c09f05a9 100644 --- a/apps/sim/app/api/files/serve/[...path]/route.test.ts +++ b/apps/sim/app/api/files/serve/[...path]/route.test.ts @@ -131,7 +131,7 @@ describe('File Serve API Route', () => { expect(disposition).toContain('filename=') expect(disposition).toContain('test-file.txt') - const fs = await import('fs/promises') + const fs = await import('node:fs/promises') expect(fs.readFile).toHaveBeenCalled() }) @@ -196,7 +196,7 @@ describe('File Serve API Route', () => { expect(response.status).toBe(200) - const fs = await import('fs/promises') + const fs = await import('node:fs/promises') expect(fs.readFile).toHaveBeenCalledWith('/test/uploads/nested/path/file.txt') }) diff --git a/apps/sim/app/api/files/serve/[...path]/route.ts b/apps/sim/app/api/files/serve/[...path]/route.ts index e339615f87..dd16181cff 100644 --- a/apps/sim/app/api/files/serve/[...path]/route.ts +++ b/apps/sim/app/api/files/serve/[...path]/route.ts @@ -1,4 +1,4 @@ -import { readFile } from 'fs/promises' +import { readFile } from 'node:fs/promises' import { createLogger } from '@sim/logger' import type { NextRequest } from 'next/server' import { NextResponse } from 'next/server' diff --git a/apps/sim/app/api/files/utils.ts b/apps/sim/app/api/files/utils.ts index 953c9b8989..afa09df309 100644 --- a/apps/sim/app/api/files/utils.ts +++ b/apps/sim/app/api/files/utils.ts @@ -1,5 +1,5 @@ -import { existsSync } from 'fs' -import { join, resolve, sep } from 'path' +import { existsSync } from 'node:fs' +import { join, resolve, sep } from 'node:path' import { createLogger } from '@sim/logger' import { NextResponse } from 'next/server' import { UPLOAD_DIR } from '@/lib/uploads/config' @@ -119,7 +119,7 @@ export function extractFilename(path: string): string { return filename } -function sanitizeFilename(filename: string): string { +function _sanitizeFilename(filename: string): string { if (!filename || typeof filename !== 'string') { throw new Error('Invalid filename provided') } diff --git a/apps/sim/app/api/folders/[id]/route.test.ts b/apps/sim/app/api/folders/[id]/route.test.ts index ce25228802..6427a68bcc 100644 --- a/apps/sim/app/api/folders/[id]/route.test.ts +++ b/apps/sim/app/api/folders/[id]/route.test.ts @@ -321,7 +321,7 @@ describe('Individual Folder API Route', () => { await PUT(req, { params }) expect(capturedUpdates).not.toBeNull() - expect(capturedUpdates!.name).toBe('Folder With Spaces') + expect(capturedUpdates?.name).toBe('Folder With Spaces') }) it('should handle database errors gracefully', async () => { diff --git a/apps/sim/app/api/folders/[id]/route.ts b/apps/sim/app/api/folders/[id]/route.ts index 35d41f6939..c46f1d3c9b 100644 --- a/apps/sim/app/api/folders/[id]/route.ts +++ b/apps/sim/app/api/folders/[id]/route.ts @@ -106,7 +106,7 @@ export async function PUT(request: NextRequest, { params }: { params: Promise<{ // DELETE - Delete a folder and all its contents export async function DELETE( - request: NextRequest, + _request: NextRequest, { params }: { params: Promise<{ id: string }> } ) { try { diff --git a/apps/sim/app/api/folders/route.test.ts b/apps/sim/app/api/folders/route.test.ts index 6ad39d75ec..b877af2e7b 100644 --- a/apps/sim/app/api/folders/route.test.ts +++ b/apps/sim/app/api/folders/route.test.ts @@ -551,7 +551,7 @@ describe('Folders API Route', () => { await POST(req) expect(capturedValues).not.toBeNull() - expect(capturedValues!.name).toBe('Test Folder With Spaces') + expect(capturedValues?.name).toBe('Test Folder With Spaces') }) it('should use default color when not provided', async () => { @@ -591,7 +591,7 @@ describe('Folders API Route', () => { await POST(req) expect(capturedValues).not.toBeNull() - expect(capturedValues!.color).toBe('#6B7280') + expect(capturedValues?.color).toBe('#6B7280') }) }) }) diff --git a/apps/sim/app/api/form/[identifier]/route.ts b/apps/sim/app/api/form/[identifier]/route.ts index a4ad31eef8..3513eb7c65 100644 --- a/apps/sim/app/api/form/[identifier]/route.ts +++ b/apps/sim/app/api/form/[identifier]/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { db } from '@sim/db' import { form, workflow, workflowBlocks } from '@sim/db/schema' import { createLogger } from '@sim/logger' @@ -235,28 +235,11 @@ export async function POST( // For forms, we don't stream back - we wait for completion and return success // Consume the stream to wait for completion const reader = stream.getReader() - let lastOutput: any = null try { while (true) { - const { done, value } = await reader.read() + const { done } = await reader.read() if (done) break - - // Parse SSE data if present - const text = new TextDecoder().decode(value) - const lines = text.split('\n') - for (const line of lines) { - if (line.startsWith('data: ')) { - try { - const data = JSON.parse(line.slice(6)) - if (data.type === 'complete' || data.output) { - lastOutput = data.output || data - } - } catch { - // Ignore parse errors - } - } - } } } finally { reader.releaseLock() diff --git a/apps/sim/app/api/form/manage/[id]/route.ts b/apps/sim/app/api/form/manage/[id]/route.ts index f2f1cbd1fb..21602b10c2 100644 --- a/apps/sim/app/api/form/manage/[id]/route.ts +++ b/apps/sim/app/api/form/manage/[id]/route.ts @@ -62,7 +62,7 @@ const updateFormSchema = z.object({ isActive: z.boolean().optional(), }) -export async function GET(request: NextRequest, { params }: { params: Promise<{ id: string }> }) { +export async function GET(_request: NextRequest, { params }: { params: Promise<{ id: string }> }) { try { const session = await getSession() @@ -201,7 +201,7 @@ export async function PATCH(request: NextRequest, { params }: { params: Promise< } export async function DELETE( - request: NextRequest, + _request: NextRequest, { params }: { params: Promise<{ id: string }> } ) { try { diff --git a/apps/sim/app/api/form/route.ts b/apps/sim/app/api/form/route.ts index ada13f5ee1..491d852891 100644 --- a/apps/sim/app/api/form/route.ts +++ b/apps/sim/app/api/form/route.ts @@ -64,7 +64,7 @@ const formSchema = z.object({ showBranding: z.boolean().optional().default(true), }) -export async function GET(request: NextRequest) { +export async function GET(_request: NextRequest) { try { const session = await getSession() diff --git a/apps/sim/app/api/form/utils.test.ts b/apps/sim/app/api/form/utils.test.ts index 4c5a220eae..755f6d3b51 100644 --- a/apps/sim/app/api/form/utils.test.ts +++ b/apps/sim/app/api/form/utils.test.ts @@ -63,7 +63,7 @@ describe('Form API Utils', () => { it.concurrent('should validate tokens with password hash', async () => { const { validateAuthToken } = await import('@/lib/core/security/deployment') - const crypto = await import('crypto') + const crypto = await import('node:crypto') const formId = 'test-form-id' const encryptedPassword = 'encrypted-password-value' diff --git a/apps/sim/app/api/function/execute/route.ts b/apps/sim/app/api/function/execute/route.ts index 4ccbd8d7c0..01a40eb437 100644 --- a/apps/sim/app/api/function/execute/route.ts +++ b/apps/sim/app/api/function/execute/route.ts @@ -292,7 +292,7 @@ function formatE2BError( */ function createUserFriendlyErrorMessage( enhanced: EnhancedError, - requestId: string, + _requestId: string, userCode?: string ): string { let errorMessage = enhanced.message diff --git a/apps/sim/app/api/knowledge/[id]/documents/[documentId]/chunks/[chunkId]/route.ts b/apps/sim/app/api/knowledge/[id]/documents/[documentId]/chunks/[chunkId]/route.ts index 08c02d508b..d670cb6141 100644 --- a/apps/sim/app/api/knowledge/[id]/documents/[documentId]/chunks/[chunkId]/route.ts +++ b/apps/sim/app/api/knowledge/[id]/documents/[documentId]/chunks/[chunkId]/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' @@ -14,7 +14,7 @@ const UpdateChunkSchema = z.object({ }) export async function GET( - req: NextRequest, + _req: NextRequest, { params }: { params: Promise<{ id: string; documentId: string; chunkId: string }> } ) { const requestId = randomUUID().slice(0, 8) @@ -134,7 +134,7 @@ export async function PUT( } export async function DELETE( - req: NextRequest, + _req: NextRequest, { params }: { params: Promise<{ id: string; documentId: string; chunkId: string }> } ) { const requestId = randomUUID().slice(0, 8) diff --git a/apps/sim/app/api/knowledge/[id]/documents/[documentId]/route.ts b/apps/sim/app/api/knowledge/[id]/documents/[documentId]/route.ts index 9d3ad15219..36c2a29b85 100644 --- a/apps/sim/app/api/knowledge/[id]/documents/[documentId]/route.ts +++ b/apps/sim/app/api/knowledge/[id]/documents/[documentId]/route.ts @@ -47,7 +47,7 @@ const UpdateDocumentSchema = z.object({ }) export async function GET( - req: NextRequest, + _req: NextRequest, { params }: { params: Promise<{ id: string; documentId: string }> } ) { const requestId = generateRequestId() @@ -123,8 +123,6 @@ export async function PUT( try { const validatedData = UpdateDocumentSchema.parse(body) - const updateData: any = {} - if (validatedData.markFailedDueToTimeout) { const doc = accessCheck.document @@ -220,7 +218,7 @@ export async function PUT( } export async function DELETE( - req: NextRequest, + _req: NextRequest, { params }: { params: Promise<{ id: string; documentId: string }> } ) { const requestId = generateRequestId() diff --git a/apps/sim/app/api/knowledge/[id]/documents/[documentId]/tag-definitions/route.ts b/apps/sim/app/api/knowledge/[id]/documents/[documentId]/tag-definitions/route.ts index e228255cd9..b425f416a9 100644 --- a/apps/sim/app/api/knowledge/[id]/documents/[documentId]/tag-definitions/route.ts +++ b/apps/sim/app/api/knowledge/[id]/documents/[documentId]/tag-definitions/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' @@ -31,7 +31,7 @@ const BulkTagDefinitionsSchema = z.object({ // GET /api/knowledge/[id]/documents/[documentId]/tag-definitions - Get tag definitions for a document export async function GET( - req: NextRequest, + _req: NextRequest, { params }: { params: Promise<{ id: string; documentId: string }> } ) { const requestId = randomUUID().slice(0, 8) diff --git a/apps/sim/app/api/knowledge/[id]/documents/route.ts b/apps/sim/app/api/knowledge/[id]/documents/route.ts index ae9c135449..614a7bd389 100644 --- a/apps/sim/app/api/knowledge/[id]/documents/route.ts +++ b/apps/sim/app/api/knowledge/[id]/documents/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/knowledge/[id]/next-available-slot/route.ts b/apps/sim/app/api/knowledge/[id]/next-available-slot/route.ts index b328b7d5b6..36a4eb5b1f 100644 --- a/apps/sim/app/api/knowledge/[id]/next-available-slot/route.ts +++ b/apps/sim/app/api/knowledge/[id]/next-available-slot/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { getSession } from '@/lib/auth' diff --git a/apps/sim/app/api/knowledge/[id]/tag-definitions/[tagId]/route.ts b/apps/sim/app/api/knowledge/[id]/tag-definitions/[tagId]/route.ts index a141461ec0..8465a2f1f3 100644 --- a/apps/sim/app/api/knowledge/[id]/tag-definitions/[tagId]/route.ts +++ b/apps/sim/app/api/knowledge/[id]/tag-definitions/[tagId]/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { getSession } from '@/lib/auth' @@ -11,7 +11,7 @@ const logger = createLogger('TagDefinitionAPI') // DELETE /api/knowledge/[id]/tag-definitions/[tagId] - Delete a tag definition export async function DELETE( - req: NextRequest, + _req: NextRequest, { params }: { params: Promise<{ id: string; tagId: string }> } ) { const requestId = randomUUID().slice(0, 8) diff --git a/apps/sim/app/api/knowledge/[id]/tag-definitions/route.ts b/apps/sim/app/api/knowledge/[id]/tag-definitions/route.ts index ba52994c88..e6e005b9fb 100644 --- a/apps/sim/app/api/knowledge/[id]/tag-definitions/route.ts +++ b/apps/sim/app/api/knowledge/[id]/tag-definitions/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/knowledge/[id]/tag-usage/route.ts b/apps/sim/app/api/knowledge/[id]/tag-usage/route.ts index 788ae89758..2ac1d7a15d 100644 --- a/apps/sim/app/api/knowledge/[id]/tag-usage/route.ts +++ b/apps/sim/app/api/knowledge/[id]/tag-usage/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { getSession } from '@/lib/auth' @@ -10,7 +10,7 @@ export const dynamic = 'force-dynamic' const logger = createLogger('TagUsageAPI') // GET /api/knowledge/[id]/tag-usage - Get usage statistics for all tag definitions -export async function GET(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { +export async function GET(_req: NextRequest, { params }: { params: Promise<{ id: string }> }) { const requestId = randomUUID().slice(0, 8) const { id: knowledgeBaseId } = await params diff --git a/apps/sim/app/api/knowledge/search/utils.ts b/apps/sim/app/api/knowledge/search/utils.ts index 3eba10f911..5513254703 100644 --- a/apps/sim/app/api/knowledge/search/utils.ts +++ b/apps/sim/app/api/knowledge/search/utils.ts @@ -269,7 +269,7 @@ function getStructuredTagFilters(filters: StructuredFilter[], embeddingTable: an if (!filtersBySlot.has(slot)) { filtersBySlot.set(slot, []) } - filtersBySlot.get(slot)!.push(filter) + filtersBySlot.get(slot)?.push(filter) } // Build conditions: OR within same slot, AND across different slots diff --git a/apps/sim/app/api/mcp/serve/[serverId]/route.ts b/apps/sim/app/api/mcp/serve/[serverId]/route.ts index baa33e205f..e33ec07083 100644 --- a/apps/sim/app/api/mcp/serve/[serverId]/route.ts +++ b/apps/sim/app/api/mcp/serve/[serverId]/route.ts @@ -63,7 +63,7 @@ async function getServer(serverId: string) { return server } -export async function GET(request: NextRequest, { params }: { params: Promise }) { +export async function GET(_request: NextRequest, { params }: { params: Promise }) { const { serverId } = await params try { diff --git a/apps/sim/app/api/mcp/servers/[id]/refresh/route.ts b/apps/sim/app/api/mcp/servers/[id]/refresh/route.ts index 94348a0f73..3cdd44d097 100644 --- a/apps/sim/app/api/mcp/servers/[id]/refresh/route.ts +++ b/apps/sim/app/api/mcp/servers/[id]/refresh/route.ts @@ -140,7 +140,7 @@ async function syncToolSchemasToWorkflows( } export const POST = withMcpAuth<{ id: string }>('read')( - async (request: NextRequest, { userId, workspaceId, requestId }, { params }) => { + async (_request: NextRequest, { userId, workspaceId, requestId }, { params }) => { const { id: serverId } = await params try { diff --git a/apps/sim/app/api/mcp/servers/route.ts b/apps/sim/app/api/mcp/servers/route.ts index 8f304035b9..f42ac7a90d 100644 --- a/apps/sim/app/api/mcp/servers/route.ts +++ b/apps/sim/app/api/mcp/servers/route.ts @@ -19,7 +19,7 @@ export const dynamic = 'force-dynamic' * GET - List all registered MCP servers for the workspace */ export const GET = withMcpAuth('read')( - async (request: NextRequest, { userId, workspaceId, requestId }) => { + async (_request: NextRequest, { userId, workspaceId, requestId }) => { try { logger.info(`[${requestId}] Listing MCP servers for workspace ${workspaceId}`) diff --git a/apps/sim/app/api/mcp/tools/stored/route.ts b/apps/sim/app/api/mcp/tools/stored/route.ts index 5a5519c277..a208d6ee23 100644 --- a/apps/sim/app/api/mcp/tools/stored/route.ts +++ b/apps/sim/app/api/mcp/tools/stored/route.ts @@ -12,7 +12,7 @@ const logger = createLogger('McpStoredToolsAPI') export const dynamic = 'force-dynamic' export const GET = withMcpAuth('read')( - async (request: NextRequest, { userId, workspaceId, requestId }) => { + async (_request: NextRequest, { userId, workspaceId, requestId }) => { try { logger.info(`[${requestId}] Fetching stored MCP tools for workspace ${workspaceId}`) diff --git a/apps/sim/app/api/mcp/workflow-servers/[id]/route.ts b/apps/sim/app/api/mcp/workflow-servers/[id]/route.ts index 3ce0e00455..055fa8ba72 100644 --- a/apps/sim/app/api/mcp/workflow-servers/[id]/route.ts +++ b/apps/sim/app/api/mcp/workflow-servers/[id]/route.ts @@ -18,7 +18,7 @@ interface RouteParams { * GET - Get a specific workflow MCP server with its tools */ export const GET = withMcpAuth('read')( - async (request: NextRequest, { userId, workspaceId, requestId }, { params }) => { + async (_request: NextRequest, { userId, workspaceId, requestId }, { params }) => { try { const { id: serverId } = await params @@ -127,7 +127,7 @@ export const PATCH = withMcpAuth('write')( * DELETE - Delete a workflow MCP server and all its tools */ export const DELETE = withMcpAuth('admin')( - async (request: NextRequest, { userId, workspaceId, requestId }, { params }) => { + async (_request: NextRequest, { userId, workspaceId, requestId }, { params }) => { try { const { id: serverId } = await params diff --git a/apps/sim/app/api/mcp/workflow-servers/[id]/tools/[toolId]/route.ts b/apps/sim/app/api/mcp/workflow-servers/[id]/tools/[toolId]/route.ts index d7fd532590..d7c74c19b5 100644 --- a/apps/sim/app/api/mcp/workflow-servers/[id]/tools/[toolId]/route.ts +++ b/apps/sim/app/api/mcp/workflow-servers/[id]/tools/[toolId]/route.ts @@ -20,7 +20,7 @@ interface RouteParams { * GET - Get a specific tool */ export const GET = withMcpAuth('read')( - async (request: NextRequest, { userId, workspaceId, requestId }, { params }) => { + async (_request: NextRequest, { userId, workspaceId, requestId }, { params }) => { try { const { id: serverId, toolId } = await params @@ -131,7 +131,7 @@ export const PATCH = withMcpAuth('write')( * DELETE - Remove a tool from an MCP server */ export const DELETE = withMcpAuth('write')( - async (request: NextRequest, { userId, workspaceId, requestId }, { params }) => { + async (_request: NextRequest, { userId, workspaceId, requestId }, { params }) => { try { const { id: serverId, toolId } = await params diff --git a/apps/sim/app/api/mcp/workflow-servers/[id]/tools/route.ts b/apps/sim/app/api/mcp/workflow-servers/[id]/tools/route.ts index b2cef8ee5b..45d9d021a1 100644 --- a/apps/sim/app/api/mcp/workflow-servers/[id]/tools/route.ts +++ b/apps/sim/app/api/mcp/workflow-servers/[id]/tools/route.ts @@ -20,7 +20,7 @@ interface RouteParams { * GET - List all tools for a workflow MCP server */ export const GET = withMcpAuth('read')( - async (request: NextRequest, { userId, workspaceId, requestId }, { params }) => { + async (_request: NextRequest, { userId, workspaceId, requestId }, { params }) => { try { const { id: serverId } = await params diff --git a/apps/sim/app/api/mcp/workflow-servers/route.ts b/apps/sim/app/api/mcp/workflow-servers/route.ts index e2900f5a88..524920329c 100644 --- a/apps/sim/app/api/mcp/workflow-servers/route.ts +++ b/apps/sim/app/api/mcp/workflow-servers/route.ts @@ -16,7 +16,7 @@ export const dynamic = 'force-dynamic' * GET - List all workflow MCP servers for the workspace */ export const GET = withMcpAuth('read')( - async (request: NextRequest, { userId, workspaceId, requestId }) => { + async (_request: NextRequest, { userId, workspaceId, requestId }) => { try { logger.info(`[${requestId}] Listing workflow MCP servers for workspace ${workspaceId}`) diff --git a/apps/sim/app/api/organizations/[id]/invitations/[invitationId]/route.ts b/apps/sim/app/api/organizations/[id]/invitations/[invitationId]/route.ts index 0c98a52bf8..c202e68c6a 100644 --- a/apps/sim/app/api/organizations/[id]/invitations/[invitationId]/route.ts +++ b/apps/sim/app/api/organizations/[id]/invitations/[invitationId]/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { db } from '@sim/db' import { invitation, diff --git a/apps/sim/app/api/organizations/[id]/invitations/route.ts b/apps/sim/app/api/organizations/[id]/invitations/route.ts index 124d709574..51540d2895 100644 --- a/apps/sim/app/api/organizations/[id]/invitations/route.ts +++ b/apps/sim/app/api/organizations/[id]/invitations/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { db } from '@sim/db' import { invitation, @@ -42,7 +42,7 @@ interface WorkspaceInvitation { * GET /api/organizations/[id]/invitations * Get all pending invitations for an organization */ -export async function GET(request: NextRequest, { params }: { params: Promise<{ id: string }> }) { +export async function GET(_request: NextRequest, { params }: { params: Promise<{ id: string }> }) { try { const session = await getSession() diff --git a/apps/sim/app/api/organizations/[id]/members/[memberId]/route.ts b/apps/sim/app/api/organizations/[id]/members/[memberId]/route.ts index 6793a5d13b..c5426b29ed 100644 --- a/apps/sim/app/api/organizations/[id]/members/[memberId]/route.ts +++ b/apps/sim/app/api/organizations/[id]/members/[memberId]/route.ts @@ -239,7 +239,7 @@ export async function PUT( * Remove member from organization */ export async function DELETE( - request: NextRequest, + _request: NextRequest, { params }: { params: Promise<{ id: string; memberId: string }> } ) { try { diff --git a/apps/sim/app/api/organizations/[id]/members/route.ts b/apps/sim/app/api/organizations/[id]/members/route.ts index eb3f4b0cda..8e762fbd6b 100644 --- a/apps/sim/app/api/organizations/[id]/members/route.ts +++ b/apps/sim/app/api/organizations/[id]/members/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { db } from '@sim/db' import { invitation, member, organization, user, userStats } from '@sim/db/schema' import { createLogger } from '@sim/logger' diff --git a/apps/sim/app/api/permission-groups/[id]/members/route.ts b/apps/sim/app/api/permission-groups/[id]/members/route.ts index 4979da755e..be89b08369 100644 --- a/apps/sim/app/api/permission-groups/[id]/members/route.ts +++ b/apps/sim/app/api/permission-groups/[id]/members/route.ts @@ -32,7 +32,7 @@ async function getPermissionGroupWithAccess(groupId: string, userId: string) { return { group, role: membership.role } } -export async function GET(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { +export async function GET(_req: NextRequest, { params }: { params: Promise<{ id: string }> }) { const session = await getSession() if (!session?.user?.id) { diff --git a/apps/sim/app/api/permission-groups/[id]/route.ts b/apps/sim/app/api/permission-groups/[id]/route.ts index 977cb1bbfe..63147bf6a2 100644 --- a/apps/sim/app/api/permission-groups/[id]/route.ts +++ b/apps/sim/app/api/permission-groups/[id]/route.ts @@ -70,7 +70,7 @@ async function getPermissionGroupWithAccess(groupId: string, userId: string) { return { group, role: membership.role } } -export async function GET(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { +export async function GET(_req: NextRequest, { params }: { params: Promise<{ id: string }> }) { const session = await getSession() if (!session?.user?.id) { @@ -195,7 +195,7 @@ export async function PUT(req: NextRequest, { params }: { params: Promise<{ id: } } -export async function DELETE(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { +export async function DELETE(_req: NextRequest, { params }: { params: Promise<{ id: string }> }) { const session = await getSession() if (!session?.user?.id) { diff --git a/apps/sim/app/api/providers/base/models/route.ts b/apps/sim/app/api/providers/base/models/route.ts index 6733eaf5f4..1ecd3c327a 100644 --- a/apps/sim/app/api/providers/base/models/route.ts +++ b/apps/sim/app/api/providers/base/models/route.ts @@ -5,7 +5,7 @@ export async function GET() { try { const allModels = Object.keys(getBaseModelProviders()) return NextResponse.json({ models: allModels }) - } catch (error) { + } catch (_error) { return NextResponse.json({ models: [], error: 'Failed to fetch models' }, { status: 500 }) } } diff --git a/apps/sim/app/api/resume/[workflowId]/[executionId]/[contextId]/route.ts b/apps/sim/app/api/resume/[workflowId]/[executionId]/[contextId]/route.ts index 6c0f44ff54..2c8ec4979a 100644 --- a/apps/sim/app/api/resume/[workflowId]/[executionId]/[contextId]/route.ts +++ b/apps/sim/app/api/resume/[workflowId]/[executionId]/[contextId]/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { generateRequestId } from '@/lib/core/utils/request' diff --git a/apps/sim/app/api/templates/[id]/approve/route.ts b/apps/sim/app/api/templates/[id]/approve/route.ts index 0492ae5845..c7e3f19b3b 100644 --- a/apps/sim/app/api/templates/[id]/approve/route.ts +++ b/apps/sim/app/api/templates/[id]/approve/route.ts @@ -14,7 +14,7 @@ export const revalidate = 0 /** * POST /api/templates/[id]/approve - Approve a template (super users only) */ -export async function POST(request: NextRequest, { params }: { params: Promise<{ id: string }> }) { +export async function POST(_request: NextRequest, { params }: { params: Promise<{ id: string }> }) { const requestId = generateRequestId() const { id } = await params diff --git a/apps/sim/app/api/templates/[id]/reject/route.ts b/apps/sim/app/api/templates/[id]/reject/route.ts index 99e50e52a9..0c47739932 100644 --- a/apps/sim/app/api/templates/[id]/reject/route.ts +++ b/apps/sim/app/api/templates/[id]/reject/route.ts @@ -14,7 +14,7 @@ export const revalidate = 0 /** * POST /api/templates/[id]/reject - Reject a template (super users only) */ -export async function POST(request: NextRequest, { params }: { params: Promise<{ id: string }> }) { +export async function POST(_request: NextRequest, { params }: { params: Promise<{ id: string }> }) { const requestId = generateRequestId() const { id } = await params diff --git a/apps/sim/app/api/templates/[id]/route.ts b/apps/sim/app/api/templates/[id]/route.ts index bc38d2dd56..649db1b1b2 100644 --- a/apps/sim/app/api/templates/[id]/route.ts +++ b/apps/sim/app/api/templates/[id]/route.ts @@ -16,7 +16,7 @@ const logger = createLogger('TemplateByIdAPI') export const revalidate = 0 -export async function GET(request: NextRequest, { params }: { params: Promise<{ id: string }> }) { +export async function GET(_request: NextRequest, { params }: { params: Promise<{ id: string }> }) { const requestId = generateRequestId() const { id } = await params @@ -234,7 +234,7 @@ export async function PUT(request: NextRequest, { params }: { params: Promise<{ // DELETE /api/templates/[id] - Delete a template export async function DELETE( - request: NextRequest, + _request: NextRequest, { params }: { params: Promise<{ id: string }> } ) { const requestId = generateRequestId() diff --git a/apps/sim/app/api/templates/[id]/star/route.ts b/apps/sim/app/api/templates/[id]/star/route.ts index 8f9fc19a0a..d613e3b3ff 100644 --- a/apps/sim/app/api/templates/[id]/star/route.ts +++ b/apps/sim/app/api/templates/[id]/star/route.ts @@ -13,7 +13,7 @@ export const dynamic = 'force-dynamic' export const revalidate = 0 // GET /api/templates/[id]/star - Check if user has starred this template -export async function GET(request: NextRequest, { params }: { params: Promise<{ id: string }> }) { +export async function GET(_request: NextRequest, { params }: { params: Promise<{ id: string }> }) { const requestId = generateRequestId() const { id } = await params @@ -47,7 +47,7 @@ export async function GET(request: NextRequest, { params }: { params: Promise<{ } // POST /api/templates/[id]/star - Add a star to the template -export async function POST(request: NextRequest, { params }: { params: Promise<{ id: string }> }) { +export async function POST(_request: NextRequest, { params }: { params: Promise<{ id: string }> }) { const requestId = generateRequestId() const { id } = await params @@ -120,7 +120,7 @@ export async function POST(request: NextRequest, { params }: { params: Promise<{ // DELETE /api/templates/[id]/star - Remove a star from the template export async function DELETE( - request: NextRequest, + _request: NextRequest, { params }: { params: Promise<{ id: string }> } ) { const requestId = generateRequestId() diff --git a/apps/sim/app/api/templates/[id]/use/route.ts b/apps/sim/app/api/templates/[id]/use/route.ts index 59c5466871..d791b7c87f 100644 --- a/apps/sim/app/api/templates/[id]/use/route.ts +++ b/apps/sim/app/api/templates/[id]/use/route.ts @@ -136,7 +136,7 @@ export async function POST(request: NextRequest, { params }: { params: Promise<{ } // Use a transaction for template updates and deployment version - const result = await db.transaction(async (tx) => { + const _result = await db.transaction(async (tx) => { // Prepare template update data const updateData: any = { views: sql`${templates.views} + 1`, diff --git a/apps/sim/app/api/templates/approved/sanitized/route.ts b/apps/sim/app/api/templates/approved/sanitized/route.ts index 2b6fad9652..9e93cdd052 100644 --- a/apps/sim/app/api/templates/approved/sanitized/route.ts +++ b/apps/sim/app/api/templates/approved/sanitized/route.ts @@ -20,7 +20,6 @@ export async function GET(request: NextRequest) { const requestId = generateRequestId() try { - const url = new URL(request.url) const hasApiKey = !!request.headers.get('x-api-key') // Check internal API key authentication @@ -126,7 +125,7 @@ export async function GET(request: NextRequest) { } // Add a helpful OPTIONS handler for CORS preflight -export async function OPTIONS(request: NextRequest) { +export async function OPTIONS(_request: NextRequest) { const requestId = generateRequestId() logger.info(`[${requestId}] OPTIONS request received for /api/templates/approved/sanitized`) diff --git a/apps/sim/app/api/tools/a2a/resubscribe/route.ts b/apps/sim/app/api/tools/a2a/resubscribe/route.ts index 75c0d24aec..2064fa1ad8 100644 --- a/apps/sim/app/api/tools/a2a/resubscribe/route.ts +++ b/apps/sim/app/api/tools/a2a/resubscribe/route.ts @@ -9,7 +9,7 @@ import type { import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' -import { createA2AClient, extractTextContent, isTerminalState } from '@/lib/a2a/utils' +import { createA2AClient, isTerminalState } from '@/lib/a2a/utils' import { checkHybridAuth } from '@/lib/auth/hybrid' import { generateRequestId } from '@/lib/core/utils/request' @@ -50,14 +50,12 @@ export async function POST(request: NextRequest) { let taskId = validatedData.taskId let contextId: string | undefined let state: TaskState = 'working' - let content = '' let artifacts: Artifact[] = [] let history: Message[] = [] for await (const event of stream) { if (event.kind === 'message') { const msg = event as Message - content = extractTextContent(msg) taskId = msg.taskId || taskId contextId = msg.contextId || contextId state = 'completed' @@ -68,10 +66,6 @@ export async function POST(request: NextRequest) { state = task.status.state artifacts = task.artifacts || [] history = task.history || [] - const lastAgentMessage = history.filter((m) => m.role === 'agent').pop() - if (lastAgentMessage) { - content = extractTextContent(lastAgentMessage) - } } else if ('status' in event) { const statusEvent = event as TaskStatusUpdateEvent state = statusEvent.status.state diff --git a/apps/sim/app/api/tools/custom/route.test.ts b/apps/sim/app/api/tools/custom/route.test.ts index f1e8899137..a12ea0d20d 100644 --- a/apps/sim/app/api/tools/custom/route.test.ts +++ b/apps/sim/app/api/tools/custom/route.test.ts @@ -82,7 +82,7 @@ describe('Custom Tools API Routes', () => { mockSelect.mockReturnValue({ from: mockFrom }) mockFrom.mockReturnValue({ where: mockWhere }) - mockWhere.mockImplementation((condition) => { + mockWhere.mockImplementation((_condition) => { const queryBuilder = { orderBy: mockOrderBy, limit: mockLimit, @@ -90,7 +90,7 @@ describe('Custom Tools API Routes', () => { resolve(sampleTools) return queryBuilder }, - catch: (reject: (error: Error) => void) => queryBuilder, + catch: (_reject: (error: Error) => void) => queryBuilder, } return queryBuilder }) @@ -101,7 +101,7 @@ describe('Custom Tools API Routes', () => { resolve(sampleTools) return queryBuilder }, - catch: (reject: (error: Error) => void) => queryBuilder, + catch: (_reject: (error: Error) => void) => queryBuilder, } return queryBuilder }) @@ -131,12 +131,12 @@ describe('Custom Tools API Routes', () => { resolve(sampleTools) return queryBuilder }, - catch: (reject: (error: Error) => void) => queryBuilder, + catch: (_reject: (error: Error) => void) => queryBuilder, } return queryBuilder }) - const txMockWhere = vi.fn().mockImplementation((condition) => { + const txMockWhere = vi.fn().mockImplementation((_condition) => { const queryBuilder = { orderBy: txMockOrderBy, limit: mockLimit, @@ -144,7 +144,7 @@ describe('Custom Tools API Routes', () => { resolve(sampleTools) return queryBuilder }, - catch: (reject: (error: Error) => void) => queryBuilder, + catch: (_reject: (error: Error) => void) => queryBuilder, } return queryBuilder }) @@ -274,14 +274,14 @@ describe('Custom Tools API Routes', () => { mockLimit.mockResolvedValueOnce([{ workspaceId: 'workspace-123' }]) - mockWhere.mockImplementationOnce((condition) => { + mockWhere.mockImplementationOnce((_condition) => { const queryBuilder = { limit: mockLimit, then: (resolve: (value: typeof sampleTools) => void) => { resolve(sampleTools) return queryBuilder }, - catch: (reject: (error: Error) => void) => queryBuilder, + catch: (_reject: (error: Error) => void) => queryBuilder, } return queryBuilder }) diff --git a/apps/sim/app/api/tools/dynamodb/introspect/route.ts b/apps/sim/app/api/tools/dynamodb/introspect/route.ts index 6e55bde87b..dc104a4a65 100644 --- a/apps/sim/app/api/tools/dynamodb/introspect/route.ts +++ b/apps/sim/app/api/tools/dynamodb/introspect/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/tools/microsoft-teams/teams/route.ts b/apps/sim/app/api/tools/microsoft-teams/teams/route.ts index a903815abe..298ed15204 100644 --- a/apps/sim/app/api/tools/microsoft-teams/teams/route.ts +++ b/apps/sim/app/api/tools/microsoft-teams/teams/route.ts @@ -1,7 +1,6 @@ import { createLogger } from '@sim/logger' import { NextResponse } from 'next/server' import { authorizeCredentialUse } from '@/lib/auth/credential-access' -import { generateRequestId } from '@/lib/core/utils/request' import { refreshAccessTokenIfNeeded } from '@/app/api/auth/oauth/utils' export const dynamic = 'force-dynamic' @@ -20,7 +19,6 @@ export async function POST(request: Request) { } try { - const requestId = generateRequestId() const authz = await authorizeCredentialUse(request as any, { credentialId: credential, workflowId, diff --git a/apps/sim/app/api/tools/microsoft_planner/tasks/route.ts b/apps/sim/app/api/tools/microsoft_planner/tasks/route.ts index 67566ad8a8..89c1ca7f51 100644 --- a/apps/sim/app/api/tools/microsoft_planner/tasks/route.ts +++ b/apps/sim/app/api/tools/microsoft_planner/tasks/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { db } from '@sim/db' import { account } from '@sim/db/schema' import { createLogger } from '@sim/logger' diff --git a/apps/sim/app/api/tools/mongodb/delete/route.ts b/apps/sim/app/api/tools/mongodb/delete/route.ts index 95dcf328cd..21ca4979c1 100644 --- a/apps/sim/app/api/tools/mongodb/delete/route.ts +++ b/apps/sim/app/api/tools/mongodb/delete/route.ts @@ -1,9 +1,13 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' import { checkInternalAuth } from '@/lib/auth/hybrid' -import { createMongoDBConnection, sanitizeCollectionName, validateFilter } from '../utils' +import { + createMongoDBConnection, + sanitizeCollectionName, + validateFilter, +} from '@/app/api/tools/mongodb/utils' const logger = createLogger('MongoDBDeleteAPI') @@ -69,7 +73,7 @@ export async function POST(request: NextRequest) { let filterDoc try { filterDoc = JSON.parse(params.filter) - } catch (error) { + } catch (_error) { logger.warn(`[${requestId}] Invalid filter JSON: ${params.filter}`) return NextResponse.json({ error: 'Invalid JSON format in filter' }, { status: 400 }) } diff --git a/apps/sim/app/api/tools/mongodb/execute/route.ts b/apps/sim/app/api/tools/mongodb/execute/route.ts index 666d4a4506..e0ff97b157 100644 --- a/apps/sim/app/api/tools/mongodb/execute/route.ts +++ b/apps/sim/app/api/tools/mongodb/execute/route.ts @@ -1,9 +1,13 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' import { checkInternalAuth } from '@/lib/auth/hybrid' -import { createMongoDBConnection, sanitizeCollectionName, validatePipeline } from '../utils' +import { + createMongoDBConnection, + sanitizeCollectionName, + validatePipeline, +} from '@/app/api/tools/mongodb/utils' const logger = createLogger('MongoDBExecuteAPI') diff --git a/apps/sim/app/api/tools/mongodb/insert/route.ts b/apps/sim/app/api/tools/mongodb/insert/route.ts index f7feafd615..09a35c6801 100644 --- a/apps/sim/app/api/tools/mongodb/insert/route.ts +++ b/apps/sim/app/api/tools/mongodb/insert/route.ts @@ -1,9 +1,9 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' import { checkInternalAuth } from '@/lib/auth/hybrid' -import { createMongoDBConnection, sanitizeCollectionName } from '../utils' +import { createMongoDBConnection, sanitizeCollectionName } from '@/app/api/tools/mongodb/utils' const logger = createLogger('MongoDBInsertAPI') diff --git a/apps/sim/app/api/tools/mongodb/introspect/route.ts b/apps/sim/app/api/tools/mongodb/introspect/route.ts index 67f281553e..37cf819956 100644 --- a/apps/sim/app/api/tools/mongodb/introspect/route.ts +++ b/apps/sim/app/api/tools/mongodb/introspect/route.ts @@ -1,9 +1,9 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' import { checkInternalAuth } from '@/lib/auth/hybrid' -import { createMongoDBConnection, executeIntrospect } from '../utils' +import { createMongoDBConnection, executeIntrospect } from '@/app/api/tools/mongodb/utils' const logger = createLogger('MongoDBIntrospectAPI') diff --git a/apps/sim/app/api/tools/mongodb/query/route.ts b/apps/sim/app/api/tools/mongodb/query/route.ts index 06533e3a8f..e217d75f41 100644 --- a/apps/sim/app/api/tools/mongodb/query/route.ts +++ b/apps/sim/app/api/tools/mongodb/query/route.ts @@ -1,9 +1,13 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' import { checkInternalAuth } from '@/lib/auth/hybrid' -import { createMongoDBConnection, sanitizeCollectionName, validateFilter } from '../utils' +import { + createMongoDBConnection, + sanitizeCollectionName, + validateFilter, +} from '@/app/api/tools/mongodb/utils' const logger = createLogger('MongoDBQueryAPI') @@ -83,7 +87,7 @@ export async function POST(request: NextRequest) { if (params.sort?.trim()) { try { sortCriteria = JSON.parse(params.sort) - } catch (error) { + } catch (_error) { logger.warn(`[${requestId}] Invalid sort JSON: ${params.sort}`) return NextResponse.json({ error: 'Invalid JSON format in sort criteria' }, { status: 400 }) } diff --git a/apps/sim/app/api/tools/mongodb/update/route.ts b/apps/sim/app/api/tools/mongodb/update/route.ts index e6c0f867f7..83bdd37e9b 100644 --- a/apps/sim/app/api/tools/mongodb/update/route.ts +++ b/apps/sim/app/api/tools/mongodb/update/route.ts @@ -1,9 +1,13 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' import { checkInternalAuth } from '@/lib/auth/hybrid' -import { createMongoDBConnection, sanitizeCollectionName, validateFilter } from '../utils' +import { + createMongoDBConnection, + sanitizeCollectionName, + validateFilter, +} from '@/app/api/tools/mongodb/utils' const logger = createLogger('MongoDBUpdateAPI') @@ -90,7 +94,7 @@ export async function POST(request: NextRequest) { try { filterDoc = JSON.parse(params.filter) updateDoc = JSON.parse(params.update) - } catch (error) { + } catch (_error) { logger.warn(`[${requestId}] Invalid JSON in filter or update`) return NextResponse.json( { error: 'Invalid JSON format in filter or update' }, diff --git a/apps/sim/app/api/tools/mongodb/utils.ts b/apps/sim/app/api/tools/mongodb/utils.ts index 4697a1cce0..50fbf69c48 100644 --- a/apps/sim/app/api/tools/mongodb/utils.ts +++ b/apps/sim/app/api/tools/mongodb/utils.ts @@ -72,7 +72,7 @@ export function validateFilter(filter: string): { isValid: boolean; error?: stri } return { isValid: true } - } catch (error) { + } catch (_error) { return { isValid: false, error: 'Invalid JSON format in filter', @@ -113,7 +113,7 @@ export function validatePipeline(pipeline: string): { isValid: boolean; error?: } return { isValid: true } - } catch (error) { + } catch (_error) { return { isValid: false, error: 'Invalid JSON format in pipeline', diff --git a/apps/sim/app/api/tools/mysql/delete/route.ts b/apps/sim/app/api/tools/mysql/delete/route.ts index 7a9e5c81c5..bc644e2c09 100644 --- a/apps/sim/app/api/tools/mysql/delete/route.ts +++ b/apps/sim/app/api/tools/mysql/delete/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/tools/mysql/execute/route.ts b/apps/sim/app/api/tools/mysql/execute/route.ts index 5ab45b85a1..b476edf0fe 100644 --- a/apps/sim/app/api/tools/mysql/execute/route.ts +++ b/apps/sim/app/api/tools/mysql/execute/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/tools/mysql/insert/route.ts b/apps/sim/app/api/tools/mysql/insert/route.ts index 4e9b3a953c..d9456068bb 100644 --- a/apps/sim/app/api/tools/mysql/insert/route.ts +++ b/apps/sim/app/api/tools/mysql/insert/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/tools/mysql/introspect/route.ts b/apps/sim/app/api/tools/mysql/introspect/route.ts index 686705da40..07915f2c98 100644 --- a/apps/sim/app/api/tools/mysql/introspect/route.ts +++ b/apps/sim/app/api/tools/mysql/introspect/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/tools/mysql/query/route.ts b/apps/sim/app/api/tools/mysql/query/route.ts index 9237ab4542..36a8c79be8 100644 --- a/apps/sim/app/api/tools/mysql/query/route.ts +++ b/apps/sim/app/api/tools/mysql/query/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/tools/mysql/update/route.ts b/apps/sim/app/api/tools/mysql/update/route.ts index 5204d92a36..191912c2a6 100644 --- a/apps/sim/app/api/tools/mysql/update/route.ts +++ b/apps/sim/app/api/tools/mysql/update/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' @@ -29,7 +29,7 @@ const UpdateSchema = z.object({ throw new Error('Data must be a JSON object') } return parsed - } catch (e) { + } catch (_e) { throw new Error('Invalid JSON format in data field') } }), diff --git a/apps/sim/app/api/tools/mysql/utils.ts b/apps/sim/app/api/tools/mysql/utils.ts index 44bab141b6..73f3c9f349 100644 --- a/apps/sim/app/api/tools/mysql/utils.ts +++ b/apps/sim/app/api/tools/mysql/utils.ts @@ -271,7 +271,7 @@ export async function executeIntrospect( unique: row.NON_UNIQUE === 0, }) } - indexMap.get(indexName)!.columns.push(row.COLUMN_NAME) + indexMap.get(indexName)?.columns.push(row.COLUMN_NAME) } const indexes = Array.from(indexMap.values()) diff --git a/apps/sim/app/api/tools/neo4j/create/route.ts b/apps/sim/app/api/tools/neo4j/create/route.ts index c599b9c13e..f26ddf3b5b 100644 --- a/apps/sim/app/api/tools/neo4j/create/route.ts +++ b/apps/sim/app/api/tools/neo4j/create/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/tools/neo4j/delete/route.ts b/apps/sim/app/api/tools/neo4j/delete/route.ts index 7a4ed7b315..aa90d2d7a0 100644 --- a/apps/sim/app/api/tools/neo4j/delete/route.ts +++ b/apps/sim/app/api/tools/neo4j/delete/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/tools/neo4j/execute/route.ts b/apps/sim/app/api/tools/neo4j/execute/route.ts index df4dc43b5a..02801c2396 100644 --- a/apps/sim/app/api/tools/neo4j/execute/route.ts +++ b/apps/sim/app/api/tools/neo4j/execute/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/tools/neo4j/introspect/route.ts b/apps/sim/app/api/tools/neo4j/introspect/route.ts index f463e15325..8ebee20f61 100644 --- a/apps/sim/app/api/tools/neo4j/introspect/route.ts +++ b/apps/sim/app/api/tools/neo4j/introspect/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' @@ -76,7 +76,7 @@ export async function POST(request: NextRequest) { if (!nodePropertiesMap.has(labelKey)) { nodePropertiesMap.set(labelKey, []) } - nodePropertiesMap.get(labelKey)!.push({ name: propertyName, types: propertyTypes }) + nodePropertiesMap.get(labelKey)?.push({ name: propertyName, types: propertyTypes }) } for (const [labelKey, properties] of nodePropertiesMap) { @@ -108,7 +108,7 @@ export async function POST(request: NextRequest) { relPropertiesMap.set(relType, []) } if (propertyName) { - relPropertiesMap.get(relType)!.push({ name: propertyName, types: propertyTypes }) + relPropertiesMap.get(relType)?.push({ name: propertyName, types: propertyTypes }) } } diff --git a/apps/sim/app/api/tools/neo4j/merge/route.ts b/apps/sim/app/api/tools/neo4j/merge/route.ts index 839b98f384..0c1b01a577 100644 --- a/apps/sim/app/api/tools/neo4j/merge/route.ts +++ b/apps/sim/app/api/tools/neo4j/merge/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/tools/neo4j/query/route.ts b/apps/sim/app/api/tools/neo4j/query/route.ts index 1bb22ab980..4813b0d68f 100644 --- a/apps/sim/app/api/tools/neo4j/query/route.ts +++ b/apps/sim/app/api/tools/neo4j/query/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/tools/neo4j/update/route.ts b/apps/sim/app/api/tools/neo4j/update/route.ts index 828d6ef6f5..fe5484882a 100644 --- a/apps/sim/app/api/tools/neo4j/update/route.ts +++ b/apps/sim/app/api/tools/neo4j/update/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/tools/onedrive/files/route.ts b/apps/sim/app/api/tools/onedrive/files/route.ts index c894834576..ef8dcc28fa 100644 --- a/apps/sim/app/api/tools/onedrive/files/route.ts +++ b/apps/sim/app/api/tools/onedrive/files/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { db } from '@sim/db' import { account } from '@sim/db/schema' import { createLogger } from '@sim/logger' diff --git a/apps/sim/app/api/tools/onedrive/folder/route.ts b/apps/sim/app/api/tools/onedrive/folder/route.ts index 2cf68fa533..c6afcc7d79 100644 --- a/apps/sim/app/api/tools/onedrive/folder/route.ts +++ b/apps/sim/app/api/tools/onedrive/folder/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { db } from '@sim/db' import { account } from '@sim/db/schema' import { createLogger } from '@sim/logger' diff --git a/apps/sim/app/api/tools/onedrive/folders/route.ts b/apps/sim/app/api/tools/onedrive/folders/route.ts index 1eac6c2678..606fff552f 100644 --- a/apps/sim/app/api/tools/onedrive/folders/route.ts +++ b/apps/sim/app/api/tools/onedrive/folders/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { db } from '@sim/db' import { account } from '@sim/db/schema' import { createLogger } from '@sim/logger' diff --git a/apps/sim/app/api/tools/postgresql/delete/route.ts b/apps/sim/app/api/tools/postgresql/delete/route.ts index e1f6cfd338..116f99aa9f 100644 --- a/apps/sim/app/api/tools/postgresql/delete/route.ts +++ b/apps/sim/app/api/tools/postgresql/delete/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/tools/postgresql/execute/route.ts b/apps/sim/app/api/tools/postgresql/execute/route.ts index 20bc9a8e05..f55c115002 100644 --- a/apps/sim/app/api/tools/postgresql/execute/route.ts +++ b/apps/sim/app/api/tools/postgresql/execute/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/tools/postgresql/insert/route.ts b/apps/sim/app/api/tools/postgresql/insert/route.ts index 2b5b2dd03f..81ca2d282b 100644 --- a/apps/sim/app/api/tools/postgresql/insert/route.ts +++ b/apps/sim/app/api/tools/postgresql/insert/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/tools/postgresql/introspect/route.ts b/apps/sim/app/api/tools/postgresql/introspect/route.ts index 239c5d1250..8e94b4f441 100644 --- a/apps/sim/app/api/tools/postgresql/introspect/route.ts +++ b/apps/sim/app/api/tools/postgresql/introspect/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/tools/postgresql/query/route.ts b/apps/sim/app/api/tools/postgresql/query/route.ts index bd164e7305..a5199c87e9 100644 --- a/apps/sim/app/api/tools/postgresql/query/route.ts +++ b/apps/sim/app/api/tools/postgresql/query/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/tools/postgresql/update/route.ts b/apps/sim/app/api/tools/postgresql/update/route.ts index d248dea7a6..c2e419501b 100644 --- a/apps/sim/app/api/tools/postgresql/update/route.ts +++ b/apps/sim/app/api/tools/postgresql/update/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' @@ -29,7 +29,7 @@ const UpdateSchema = z.object({ throw new Error('Data must be a JSON object') } return parsed - } catch (e) { + } catch (_e) { throw new Error('Invalid JSON format in data field') } }), diff --git a/apps/sim/app/api/tools/postgresql/utils.ts b/apps/sim/app/api/tools/postgresql/utils.ts index eef711144d..98ba9add4a 100644 --- a/apps/sim/app/api/tools/postgresql/utils.ts +++ b/apps/sim/app/api/tools/postgresql/utils.ts @@ -324,7 +324,7 @@ export async function executeIntrospect( unique: row.is_unique, }) } - indexMap.get(indexName)!.columns.push(row.column_name) + indexMap.get(indexName)?.columns.push(row.column_name) } const indexes = Array.from(indexMap.values()) diff --git a/apps/sim/app/api/tools/rds/delete/route.ts b/apps/sim/app/api/tools/rds/delete/route.ts index 8db9e2e1dd..6fbfb953d2 100644 --- a/apps/sim/app/api/tools/rds/delete/route.ts +++ b/apps/sim/app/api/tools/rds/delete/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/tools/rds/execute/route.ts b/apps/sim/app/api/tools/rds/execute/route.ts index 8c88edb0f7..99a81dd14b 100644 --- a/apps/sim/app/api/tools/rds/execute/route.ts +++ b/apps/sim/app/api/tools/rds/execute/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/tools/rds/insert/route.ts b/apps/sim/app/api/tools/rds/insert/route.ts index 783d80821a..3b0da1a4f5 100644 --- a/apps/sim/app/api/tools/rds/insert/route.ts +++ b/apps/sim/app/api/tools/rds/insert/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/tools/rds/introspect/route.ts b/apps/sim/app/api/tools/rds/introspect/route.ts index ea96f05b24..6d3b4efeb7 100644 --- a/apps/sim/app/api/tools/rds/introspect/route.ts +++ b/apps/sim/app/api/tools/rds/introspect/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/tools/rds/query/route.ts b/apps/sim/app/api/tools/rds/query/route.ts index 6caf743c3a..ee1290ef72 100644 --- a/apps/sim/app/api/tools/rds/query/route.ts +++ b/apps/sim/app/api/tools/rds/query/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/tools/rds/update/route.ts b/apps/sim/app/api/tools/rds/update/route.ts index d973d04d8c..cf237cd10b 100644 --- a/apps/sim/app/api/tools/rds/update/route.ts +++ b/apps/sim/app/api/tools/rds/update/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/tools/rds/utils.ts b/apps/sim/app/api/tools/rds/utils.ts index ac78b83d87..72f5fa22b2 100644 --- a/apps/sim/app/api/tools/rds/utils.ts +++ b/apps/sim/app/api/tools/rds/utils.ts @@ -467,7 +467,7 @@ async function introspectPostgresql( unique: idx.is_unique, }) } - indexMap.get(indexName)!.columns.push(idx.column_name) + indexMap.get(indexName)?.columns.push(idx.column_name) } const indexes = Array.from(indexMap.values()) @@ -657,7 +657,7 @@ async function introspectMysql( unique: idx.non_unique === 0, }) } - indexMap.get(indexName)!.columns.push(idx.column_name) + indexMap.get(indexName)?.columns.push(idx.column_name) } const indexes = Array.from(indexMap.values()) diff --git a/apps/sim/app/api/tools/sftp/download/route.ts b/apps/sim/app/api/tools/sftp/download/route.ts index 4914703fcc..4e67e22ca2 100644 --- a/apps/sim/app/api/tools/sftp/download/route.ts +++ b/apps/sim/app/api/tools/sftp/download/route.ts @@ -1,4 +1,4 @@ -import path from 'path' +import path from 'node:path' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/tools/sharepoint/site/route.ts b/apps/sim/app/api/tools/sharepoint/site/route.ts index 2ffecce942..c65216ae88 100644 --- a/apps/sim/app/api/tools/sharepoint/site/route.ts +++ b/apps/sim/app/api/tools/sharepoint/site/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { db } from '@sim/db' import { account } from '@sim/db/schema' import { createLogger } from '@sim/logger' diff --git a/apps/sim/app/api/tools/sharepoint/sites/route.ts b/apps/sim/app/api/tools/sharepoint/sites/route.ts index 7e98bf6212..8c9cf2f932 100644 --- a/apps/sim/app/api/tools/sharepoint/sites/route.ts +++ b/apps/sim/app/api/tools/sharepoint/sites/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { db } from '@sim/db' import { account } from '@sim/db/schema' import { createLogger } from '@sim/logger' diff --git a/apps/sim/app/api/tools/sqs/send/route.ts b/apps/sim/app/api/tools/sqs/send/route.ts index 2c3e643e37..b901637d1e 100644 --- a/apps/sim/app/api/tools/sqs/send/route.ts +++ b/apps/sim/app/api/tools/sqs/send/route.ts @@ -1,9 +1,9 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' import { checkInternalAuth } from '@/lib/auth/hybrid' -import { createSqsClient, sendMessage } from '../utils' +import { createSqsClient, sendMessage } from '@/app/api/tools/sqs/utils' const logger = createLogger('SQSSendMessageAPI') diff --git a/apps/sim/app/api/tools/ssh/check-command-exists/route.ts b/apps/sim/app/api/tools/ssh/check-command-exists/route.ts index 6290cde47d..c3796871fa 100644 --- a/apps/sim/app/api/tools/ssh/check-command-exists/route.ts +++ b/apps/sim/app/api/tools/ssh/check-command-exists/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/tools/ssh/check-file-exists/route.ts b/apps/sim/app/api/tools/ssh/check-file-exists/route.ts index b5e2546279..92238a48de 100644 --- a/apps/sim/app/api/tools/ssh/check-file-exists/route.ts +++ b/apps/sim/app/api/tools/ssh/check-file-exists/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import type { Client, SFTPWrapper, Stats } from 'ssh2' diff --git a/apps/sim/app/api/tools/ssh/create-directory/route.ts b/apps/sim/app/api/tools/ssh/create-directory/route.ts index 3fd058ba68..4b51db8570 100644 --- a/apps/sim/app/api/tools/ssh/create-directory/route.ts +++ b/apps/sim/app/api/tools/ssh/create-directory/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/tools/ssh/delete-file/route.ts b/apps/sim/app/api/tools/ssh/delete-file/route.ts index 14cbc2ae6f..29725c354b 100644 --- a/apps/sim/app/api/tools/ssh/delete-file/route.ts +++ b/apps/sim/app/api/tools/ssh/delete-file/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/tools/ssh/download-file/route.ts b/apps/sim/app/api/tools/ssh/download-file/route.ts index e3bffd29d1..03eb0d61cb 100644 --- a/apps/sim/app/api/tools/ssh/download-file/route.ts +++ b/apps/sim/app/api/tools/ssh/download-file/route.ts @@ -1,5 +1,5 @@ -import { randomUUID } from 'crypto' -import path from 'path' +import { randomUUID } from 'node:crypto' +import path from 'node:path' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import type { Client, SFTPWrapper } from 'ssh2' diff --git a/apps/sim/app/api/tools/ssh/execute-command/route.ts b/apps/sim/app/api/tools/ssh/execute-command/route.ts index 94bd2b365b..0c8c808444 100644 --- a/apps/sim/app/api/tools/ssh/execute-command/route.ts +++ b/apps/sim/app/api/tools/ssh/execute-command/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/tools/ssh/execute-script/route.ts b/apps/sim/app/api/tools/ssh/execute-script/route.ts index 55c6df58f3..ce9a91785c 100644 --- a/apps/sim/app/api/tools/ssh/execute-script/route.ts +++ b/apps/sim/app/api/tools/ssh/execute-script/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/tools/ssh/get-system-info/route.ts b/apps/sim/app/api/tools/ssh/get-system-info/route.ts index cdb6c0cf25..ae0fe9d1c4 100644 --- a/apps/sim/app/api/tools/ssh/get-system-info/route.ts +++ b/apps/sim/app/api/tools/ssh/get-system-info/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/tools/ssh/list-directory/route.ts b/apps/sim/app/api/tools/ssh/list-directory/route.ts index cb256f4239..fcd38b6687 100644 --- a/apps/sim/app/api/tools/ssh/list-directory/route.ts +++ b/apps/sim/app/api/tools/ssh/list-directory/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import type { Client, FileEntry, SFTPWrapper } from 'ssh2' diff --git a/apps/sim/app/api/tools/ssh/move-rename/route.ts b/apps/sim/app/api/tools/ssh/move-rename/route.ts index ba4a9a2956..b5f30238c7 100644 --- a/apps/sim/app/api/tools/ssh/move-rename/route.ts +++ b/apps/sim/app/api/tools/ssh/move-rename/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/tools/ssh/read-file-content/route.ts b/apps/sim/app/api/tools/ssh/read-file-content/route.ts index 237c8336ca..3ece6be404 100644 --- a/apps/sim/app/api/tools/ssh/read-file-content/route.ts +++ b/apps/sim/app/api/tools/ssh/read-file-content/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import type { Client, SFTPWrapper } from 'ssh2' diff --git a/apps/sim/app/api/tools/ssh/upload-file/route.ts b/apps/sim/app/api/tools/ssh/upload-file/route.ts index 2ce4804303..bf0314adc8 100644 --- a/apps/sim/app/api/tools/ssh/upload-file/route.ts +++ b/apps/sim/app/api/tools/ssh/upload-file/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import type { Client, SFTPWrapper } from 'ssh2' diff --git a/apps/sim/app/api/tools/ssh/write-file-content/route.ts b/apps/sim/app/api/tools/ssh/write-file-content/route.ts index ede5252004..d6d78ce450 100644 --- a/apps/sim/app/api/tools/ssh/write-file-content/route.ts +++ b/apps/sim/app/api/tools/ssh/write-file-content/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import type { Client, SFTPWrapper } from 'ssh2' diff --git a/apps/sim/app/api/tools/textract/parse/route.ts b/apps/sim/app/api/tools/textract/parse/route.ts index 86fa83512f..0130206876 100644 --- a/apps/sim/app/api/tools/textract/parse/route.ts +++ b/apps/sim/app/api/tools/textract/parse/route.ts @@ -1,4 +1,4 @@ -import crypto from 'crypto' +import crypto from 'node:crypto' import { createLogger } from '@sim/logger' import { type NextRequest, NextResponse } from 'next/server' import { z } from 'zod' diff --git a/apps/sim/app/api/tools/video/route.ts b/apps/sim/app/api/tools/video/route.ts index 375042e931..eb34befbee 100644 --- a/apps/sim/app/api/tools/video/route.ts +++ b/apps/sim/app/api/tools/video/route.ts @@ -272,7 +272,7 @@ export async function POST(request: NextRequest) { async function generateWithRunway( apiKey: string, - model: string, + _model: string, prompt: string, duration: number, aspectRatio: string, @@ -815,9 +815,6 @@ async function generateWithFalAI( 'minimax-hailuo-2.3-standard', ] - // Models that only need prompt (minimal params) - const minimalParamModels = ['ltxv-0.9.8', 'wan-2.1', 'veo-3.1', 'sora-2'] - if (supportsStandardParams.includes(model)) { // Kling and MiniMax models support duration and aspect_ratio const formattedDuration = formatDuration(model, duration) diff --git a/apps/sim/app/api/user/super-user/route.ts b/apps/sim/app/api/user/super-user/route.ts index 28c8b9733e..9921593b7c 100644 --- a/apps/sim/app/api/user/super-user/route.ts +++ b/apps/sim/app/api/user/super-user/route.ts @@ -11,7 +11,7 @@ const logger = createLogger('SuperUserAPI') export const revalidate = 0 // GET /api/user/super-user - Check if current user is a super user (database status) -export async function GET(request: NextRequest) { +export async function GET(_request: NextRequest) { const requestId = generateRequestId() try { diff --git a/apps/sim/app/api/users/me/api-keys/[id]/route.ts b/apps/sim/app/api/users/me/api-keys/[id]/route.ts index 56be3ce7bb..db1a301130 100644 --- a/apps/sim/app/api/users/me/api-keys/[id]/route.ts +++ b/apps/sim/app/api/users/me/api-keys/[id]/route.ts @@ -10,7 +10,7 @@ const logger = createLogger('ApiKeyAPI') // DELETE /api/users/me/api-keys/[id] - Delete an API key export async function DELETE( - request: NextRequest, + _request: NextRequest, { params }: { params: Promise<{ id: string }> } ) { const requestId = generateRequestId() diff --git a/apps/sim/app/api/users/me/api-keys/route.ts b/apps/sim/app/api/users/me/api-keys/route.ts index 252011ec95..947564fb90 100644 --- a/apps/sim/app/api/users/me/api-keys/route.ts +++ b/apps/sim/app/api/users/me/api-keys/route.ts @@ -10,7 +10,7 @@ import { getSession } from '@/lib/auth' const logger = createLogger('ApiKeysAPI') // GET /api/users/me/api-keys - Get all API keys for the current user -export async function GET(request: NextRequest) { +export async function GET(_request: NextRequest) { try { const session = await getSession() if (!session?.user?.id) { diff --git a/apps/sim/app/api/v1/admin/auth.ts b/apps/sim/app/api/v1/admin/auth.ts index 5e04bcc1d9..912c878b43 100644 --- a/apps/sim/app/api/v1/admin/auth.ts +++ b/apps/sim/app/api/v1/admin/auth.ts @@ -8,7 +8,7 @@ * curl -H "x-admin-key: your_admin_key" https://your-instance/api/v1/admin/... */ -import { createHash, timingSafeEqual } from 'crypto' +import { createHash, timingSafeEqual } from 'node:crypto' import { createLogger } from '@sim/logger' import type { NextRequest } from 'next/server' import { env } from '@/lib/core/config/env' diff --git a/apps/sim/app/api/v1/admin/organizations/[id]/route.ts b/apps/sim/app/api/v1/admin/organizations/[id]/route.ts index 3d0373014e..fc9cd422fa 100644 --- a/apps/sim/app/api/v1/admin/organizations/[id]/route.ts +++ b/apps/sim/app/api/v1/admin/organizations/[id]/route.ts @@ -39,7 +39,7 @@ interface RouteParams { id: string } -export const GET = withAdminAuthParams(async (request, context) => { +export const GET = withAdminAuthParams(async (_request, context) => { const { id: organizationId } = await context.params try { diff --git a/apps/sim/app/api/v1/admin/organizations/route.ts b/apps/sim/app/api/v1/admin/organizations/route.ts index 5cac5aba07..4de6e93297 100644 --- a/apps/sim/app/api/v1/admin/organizations/route.ts +++ b/apps/sim/app/api/v1/admin/organizations/route.ts @@ -21,7 +21,7 @@ * Response: AdminSingleResponse */ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { db } from '@sim/db' import { member, organization, user } from '@sim/db/schema' import { createLogger } from '@sim/logger' diff --git a/apps/sim/app/api/v1/admin/users/[id]/route.ts b/apps/sim/app/api/v1/admin/users/[id]/route.ts index 3700a427b1..6a9e13bfdd 100644 --- a/apps/sim/app/api/v1/admin/users/[id]/route.ts +++ b/apps/sim/app/api/v1/admin/users/[id]/route.ts @@ -24,7 +24,7 @@ interface RouteParams { id: string } -export const GET = withAdminAuthParams(async (request, context) => { +export const GET = withAdminAuthParams(async (_request, context) => { const { id: userId } = await context.params try { diff --git a/apps/sim/app/api/v1/admin/workflows/[id]/deploy/route.ts b/apps/sim/app/api/v1/admin/workflows/[id]/deploy/route.ts index 3eab0374db..856b7bdb9d 100644 --- a/apps/sim/app/api/v1/admin/workflows/[id]/deploy/route.ts +++ b/apps/sim/app/api/v1/admin/workflows/[id]/deploy/route.ts @@ -181,7 +181,7 @@ export const POST = withAdminAuthParams(async (request, context) => } }) -export const DELETE = withAdminAuthParams(async (request, context) => { +export const DELETE = withAdminAuthParams(async (_request, context) => { const { id: workflowId } = await context.params const requestId = generateRequestId() diff --git a/apps/sim/app/api/v1/admin/workflows/[id]/export/route.ts b/apps/sim/app/api/v1/admin/workflows/[id]/export/route.ts index 565467444b..4e22c60cb1 100644 --- a/apps/sim/app/api/v1/admin/workflows/[id]/export/route.ts +++ b/apps/sim/app/api/v1/admin/workflows/[id]/export/route.ts @@ -29,7 +29,7 @@ interface RouteParams { id: string } -export const GET = withAdminAuthParams(async (request, context) => { +export const GET = withAdminAuthParams(async (_request, context) => { const { id: workflowId } = await context.params try { diff --git a/apps/sim/app/api/v1/admin/workflows/[id]/route.ts b/apps/sim/app/api/v1/admin/workflows/[id]/route.ts index ca596d6afd..28abf53c5a 100644 --- a/apps/sim/app/api/v1/admin/workflows/[id]/route.ts +++ b/apps/sim/app/api/v1/admin/workflows/[id]/route.ts @@ -31,7 +31,7 @@ interface RouteParams { id: string } -export const GET = withAdminAuthParams(async (request, context) => { +export const GET = withAdminAuthParams(async (_request, context) => { const { id: workflowId } = await context.params try { @@ -71,7 +71,7 @@ export const GET = withAdminAuthParams(async (request, context) => } }) -export const DELETE = withAdminAuthParams(async (request, context) => { +export const DELETE = withAdminAuthParams(async (_request, context) => { const { id: workflowId } = await context.params try { diff --git a/apps/sim/app/api/v1/admin/workflows/[id]/versions/[versionId]/activate/route.ts b/apps/sim/app/api/v1/admin/workflows/[id]/versions/[versionId]/activate/route.ts index a1406ca830..944e7355ba 100644 --- a/apps/sim/app/api/v1/admin/workflows/[id]/versions/[versionId]/activate/route.ts +++ b/apps/sim/app/api/v1/admin/workflows/[id]/versions/[versionId]/activate/route.ts @@ -191,7 +191,7 @@ export const POST = withAdminAuthParams(async (request, context) => return singleResponse({ success: true, version: versionNum, - deployedAt: result.deployedAt!.toISOString(), + deployedAt: result.deployedAt?.toISOString(), warnings: triggerSaveResult.warnings, }) } catch (error) { diff --git a/apps/sim/app/api/v1/admin/workflows/[id]/versions/route.ts b/apps/sim/app/api/v1/admin/workflows/[id]/versions/route.ts index 004e4c15b0..d5dbae069f 100644 --- a/apps/sim/app/api/v1/admin/workflows/[id]/versions/route.ts +++ b/apps/sim/app/api/v1/admin/workflows/[id]/versions/route.ts @@ -16,7 +16,7 @@ interface RouteParams { id: string } -export const GET = withAdminAuthParams(async (request, context) => { +export const GET = withAdminAuthParams(async (_request, context) => { const { id: workflowId } = await context.params try { diff --git a/apps/sim/app/api/v1/admin/workspaces/[id]/members/route.ts b/apps/sim/app/api/v1/admin/workspaces/[id]/members/route.ts index 687198506c..4b7dcddf2e 100644 --- a/apps/sim/app/api/v1/admin/workspaces/[id]/members/route.ts +++ b/apps/sim/app/api/v1/admin/workspaces/[id]/members/route.ts @@ -30,7 +30,7 @@ * Response: AdminSingleResponse<{ removed: true }> */ -import crypto from 'crypto' +import crypto from 'node:crypto' import { db } from '@sim/db' import { permissions, user, workspace } from '@sim/db/schema' import { createLogger } from '@sim/logger' diff --git a/apps/sim/app/api/v1/admin/workspaces/[id]/route.ts b/apps/sim/app/api/v1/admin/workspaces/[id]/route.ts index ee34556fc6..0c6624a08f 100644 --- a/apps/sim/app/api/v1/admin/workspaces/[id]/route.ts +++ b/apps/sim/app/api/v1/admin/workspaces/[id]/route.ts @@ -24,7 +24,7 @@ interface RouteParams { id: string } -export const GET = withAdminAuthParams(async (request, context) => { +export const GET = withAdminAuthParams(async (_request, context) => { const { id: workspaceId } = await context.params try { diff --git a/apps/sim/app/api/v1/admin/workspaces/[id]/workflows/route.ts b/apps/sim/app/api/v1/admin/workspaces/[id]/workflows/route.ts index ea1ab87fc5..808d99d14b 100644 --- a/apps/sim/app/api/v1/admin/workspaces/[id]/workflows/route.ts +++ b/apps/sim/app/api/v1/admin/workspaces/[id]/workflows/route.ts @@ -84,7 +84,7 @@ export const GET = withAdminAuthParams(async (request, context) => } }) -export const DELETE = withAdminAuthParams(async (request, context) => { +export const DELETE = withAdminAuthParams(async (_request, context) => { const { id: workspaceId } = await context.params try { diff --git a/apps/sim/app/api/wand/route.ts b/apps/sim/app/api/wand/route.ts index 54f914a2b7..6e1a051d88 100644 --- a/apps/sim/app/api/wand/route.ts +++ b/apps/sim/app/api/wand/route.ts @@ -386,7 +386,7 @@ Use this context to calculate relative dates like "yesterday", "last week", "beg `[${requestId}] Received usage data: ${JSON.stringify(parsed.usage)}` ) } - } catch (parseError) { + } catch (_parseError) { logger.debug( `[${requestId}] Skipped non-JSON line: ${data.substring(0, 100)}` ) diff --git a/apps/sim/app/api/webhooks/[id]/route.ts b/apps/sim/app/api/webhooks/[id]/route.ts index e4c381cad4..2f2835c2fa 100644 --- a/apps/sim/app/api/webhooks/[id]/route.ts +++ b/apps/sim/app/api/webhooks/[id]/route.ts @@ -15,7 +15,7 @@ const logger = createLogger('WebhookAPI') export const dynamic = 'force-dynamic' // Get a specific webhook -export async function GET(request: NextRequest, { params }: { params: Promise<{ id: string }> }) { +export async function GET(_request: NextRequest, { params }: { params: Promise<{ id: string }> }) { const requestId = generateRequestId() try { @@ -176,7 +176,7 @@ export async function PATCH(request: NextRequest, { params }: { params: Promise< // Delete a webhook export async function DELETE( - request: NextRequest, + _request: NextRequest, { params }: { params: Promise<{ id: string }> } ) { const requestId = generateRequestId() diff --git a/apps/sim/app/api/workflows/[id]/deploy/route.ts b/apps/sim/app/api/workflows/[id]/deploy/route.ts index 9fd15eb606..9786383251 100644 --- a/apps/sim/app/api/workflows/[id]/deploy/route.ts +++ b/apps/sim/app/api/workflows/[id]/deploy/route.ts @@ -27,7 +27,7 @@ const logger = createLogger('WorkflowDeployAPI') export const dynamic = 'force-dynamic' export const runtime = 'nodejs' -export async function GET(request: NextRequest, { params }: { params: Promise<{ id: string }> }) { +export async function GET(_request: NextRequest, { params }: { params: Promise<{ id: string }> }) { const requestId = generateRequestId() const { id } = await params @@ -154,7 +154,7 @@ export async function POST(request: NextRequest, { params }: { params: Promise<{ const deployResult = await deployWorkflow({ workflowId: id, deployedBy: actorUserId, - workflowName: workflowData!.name, + workflowName: workflowData?.name, }) if (!deployResult.success) { @@ -258,7 +258,7 @@ export async function POST(request: NextRequest, { params }: { params: Promise<{ // Sync MCP tools with the latest parameter schema await syncMcpToolsForWorkflow({ workflowId: id, requestId, context: 'deploy' }) - const responseApiKeyInfo = workflowData!.workspaceId + const responseApiKeyInfo = workflowData?.workspaceId ? 'Workspace API keys' : 'Personal API keys' @@ -288,7 +288,7 @@ export async function POST(request: NextRequest, { params }: { params: Promise<{ } export async function DELETE( - request: NextRequest, + _request: NextRequest, { params }: { params: Promise<{ id: string }> } ) { const requestId = generateRequestId() diff --git a/apps/sim/app/api/workflows/[id]/deployments/[version]/revert/route.ts b/apps/sim/app/api/workflows/[id]/deployments/[version]/revert/route.ts index b7e31a0e3a..8f1e08ae7e 100644 --- a/apps/sim/app/api/workflows/[id]/deployments/[version]/revert/route.ts +++ b/apps/sim/app/api/workflows/[id]/deployments/[version]/revert/route.ts @@ -15,7 +15,7 @@ export const dynamic = 'force-dynamic' export const runtime = 'nodejs' export async function POST( - request: NextRequest, + _request: NextRequest, { params }: { params: Promise<{ id: string; version: string }> } ) { const requestId = generateRequestId() diff --git a/apps/sim/app/api/workflows/[id]/deployments/[version]/route.ts b/apps/sim/app/api/workflows/[id]/deployments/[version]/route.ts index 4ea2e49085..f27fa6a266 100644 --- a/apps/sim/app/api/workflows/[id]/deployments/[version]/route.ts +++ b/apps/sim/app/api/workflows/[id]/deployments/[version]/route.ts @@ -32,7 +32,7 @@ export const dynamic = 'force-dynamic' export const runtime = 'nodejs' export async function GET( - request: NextRequest, + _request: NextRequest, { params }: { params: Promise<{ id: string; version: string }> } ) { const requestId = generateRequestId() diff --git a/apps/sim/app/api/workflows/[id]/deployments/route.ts b/apps/sim/app/api/workflows/[id]/deployments/route.ts index ac2e7e1015..effad957e7 100644 --- a/apps/sim/app/api/workflows/[id]/deployments/route.ts +++ b/apps/sim/app/api/workflows/[id]/deployments/route.ts @@ -11,7 +11,7 @@ const logger = createLogger('WorkflowDeploymentsListAPI') export const dynamic = 'force-dynamic' export const runtime = 'nodejs' -export async function GET(request: NextRequest, { params }: { params: Promise<{ id: string }> }) { +export async function GET(_request: NextRequest, { params }: { params: Promise<{ id: string }> }) { const requestId = generateRequestId() const { id } = await params diff --git a/apps/sim/app/api/workflows/[id]/execute/route.ts b/apps/sim/app/api/workflows/[id]/execute/route.ts index 53161e42a0..f0362535e8 100644 --- a/apps/sim/app/api/workflows/[id]/execute/route.ts +++ b/apps/sim/app/api/workflows/[id]/execute/route.ts @@ -192,7 +192,7 @@ export async function POST(req: NextRequest, { params }: { params: Promise<{ id: if (text) { body = JSON.parse(text) } - } catch (error) { + } catch (_error) { logger.warn(`[${requestId}] Failed to parse request body, using defaults`) } @@ -291,8 +291,8 @@ export async function POST(req: NextRequest, { params }: { params: Promise<{ id: if (!preprocessResult.success) { return NextResponse.json( - { error: preprocessResult.error!.message }, - { status: preprocessResult.error!.statusCode } + { error: preprocessResult.error?.message }, + { status: preprocessResult.error?.statusCode } ) } @@ -660,14 +660,12 @@ export async function POST(req: NextRequest, { params }: { params: Promise<{ id: const reader = streamingExec.stream.getReader() const decoder = new TextDecoder() - let chunkCount = 0 try { while (true) { const { done, value } = await reader.read() if (done) break - chunkCount++ const chunk = decoder.decode(value, { stream: true }) sendEvent({ type: 'stream:chunk', diff --git a/apps/sim/app/api/workflows/[id]/form/status/route.ts b/apps/sim/app/api/workflows/[id]/form/status/route.ts index a14abe736f..f1c0a6008f 100644 --- a/apps/sim/app/api/workflows/[id]/form/status/route.ts +++ b/apps/sim/app/api/workflows/[id]/form/status/route.ts @@ -8,7 +8,7 @@ import { createErrorResponse, createSuccessResponse } from '@/app/api/workflows/ const logger = createLogger('FormStatusAPI') -export async function GET(request: NextRequest, { params }: { params: Promise<{ id: string }> }) { +export async function GET(_request: NextRequest, { params }: { params: Promise<{ id: string }> }) { try { const session = await getSession() diff --git a/apps/sim/app/api/workflows/[id]/variables/route.ts b/apps/sim/app/api/workflows/[id]/variables/route.ts index f107f31748..9d98408ffa 100644 --- a/apps/sim/app/api/workflows/[id]/variables/route.ts +++ b/apps/sim/app/api/workflows/[id]/variables/route.ts @@ -95,7 +95,7 @@ export async function POST(req: NextRequest, { params }: { params: Promise<{ id: } } -export async function GET(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { +export async function GET(_req: NextRequest, { params }: { params: Promise<{ id: string }> }) { const requestId = generateRequestId() const workflowId = (await params).id diff --git a/apps/sim/app/api/workspaces/[id]/api-keys/[keyId]/route.ts b/apps/sim/app/api/workspaces/[id]/api-keys/[keyId]/route.ts index f72a86f1d8..83129f77c6 100644 --- a/apps/sim/app/api/workspaces/[id]/api-keys/[keyId]/route.ts +++ b/apps/sim/app/api/workspaces/[id]/api-keys/[keyId]/route.ts @@ -98,7 +98,7 @@ export async function PUT( } export async function DELETE( - request: NextRequest, + _request: NextRequest, { params }: { params: Promise<{ id: string; keyId: string }> } ) { const requestId = generateRequestId() diff --git a/apps/sim/app/api/workspaces/[id]/api-keys/route.ts b/apps/sim/app/api/workspaces/[id]/api-keys/route.ts index c649972140..cecc14adbd 100644 --- a/apps/sim/app/api/workspaces/[id]/api-keys/route.ts +++ b/apps/sim/app/api/workspaces/[id]/api-keys/route.ts @@ -21,7 +21,7 @@ const DeleteKeysSchema = z.object({ keys: z.array(z.string()).min(1), }) -export async function GET(request: NextRequest, { params }: { params: Promise<{ id: string }> }) { +export async function GET(_request: NextRequest, { params }: { params: Promise<{ id: string }> }) { const requestId = generateRequestId() const workspaceId = (await params).id diff --git a/apps/sim/app/api/workspaces/[id]/byok-keys/route.ts b/apps/sim/app/api/workspaces/[id]/byok-keys/route.ts index 3078555350..e45582537e 100644 --- a/apps/sim/app/api/workspaces/[id]/byok-keys/route.ts +++ b/apps/sim/app/api/workspaces/[id]/byok-keys/route.ts @@ -33,7 +33,7 @@ function maskApiKey(key: string): string { return `${key.slice(0, 6)}...${key.slice(-4)}` } -export async function GET(request: NextRequest, { params }: { params: Promise<{ id: string }> }) { +export async function GET(_request: NextRequest, { params }: { params: Promise<{ id: string }> }) { const requestId = generateRequestId() const workspaceId = (await params).id @@ -231,7 +231,7 @@ export async function DELETE( const body = await request.json() const { providerId } = DeleteKeySchema.parse(body) - const result = await db + const _result = await db .delete(workspaceBYOKKeys) .where( and( diff --git a/apps/sim/app/api/workspaces/[id]/environment/route.ts b/apps/sim/app/api/workspaces/[id]/environment/route.ts index f11da0ecc9..76ed285090 100644 --- a/apps/sim/app/api/workspaces/[id]/environment/route.ts +++ b/apps/sim/app/api/workspaces/[id]/environment/route.ts @@ -19,7 +19,7 @@ const DeleteSchema = z.object({ keys: z.array(z.string()).min(1), }) -export async function GET(request: NextRequest, { params }: { params: Promise<{ id: string }> }) { +export async function GET(_request: NextRequest, { params }: { params: Promise<{ id: string }> }) { const requestId = generateRequestId() const workspaceId = (await params).id diff --git a/apps/sim/app/api/workspaces/[id]/files/[fileId]/download/route.ts b/apps/sim/app/api/workspaces/[id]/files/[fileId]/download/route.ts index c35f283060..cf38308541 100644 --- a/apps/sim/app/api/workspaces/[id]/files/[fileId]/download/route.ts +++ b/apps/sim/app/api/workspaces/[id]/files/[fileId]/download/route.ts @@ -15,7 +15,7 @@ const logger = createLogger('WorkspaceFileDownloadAPI') * Uses /api/files/serve endpoint which enforces authentication and context */ export async function POST( - request: NextRequest, + _request: NextRequest, { params }: { params: Promise<{ id: string; fileId: string }> } ) { const requestId = generateRequestId() diff --git a/apps/sim/app/api/workspaces/[id]/files/[fileId]/route.ts b/apps/sim/app/api/workspaces/[id]/files/[fileId]/route.ts index 2c646d8e1d..fe0d94eb93 100644 --- a/apps/sim/app/api/workspaces/[id]/files/[fileId]/route.ts +++ b/apps/sim/app/api/workspaces/[id]/files/[fileId]/route.ts @@ -14,7 +14,7 @@ const logger = createLogger('WorkspaceFileAPI') * Delete a workspace file (requires write permission) */ export async function DELETE( - request: NextRequest, + _request: NextRequest, { params }: { params: Promise<{ id: string; fileId: string }> } ) { const requestId = generateRequestId() diff --git a/apps/sim/app/api/workspaces/[id]/files/route.ts b/apps/sim/app/api/workspaces/[id]/files/route.ts index 22a4233b0f..9d26bf60c7 100644 --- a/apps/sim/app/api/workspaces/[id]/files/route.ts +++ b/apps/sim/app/api/workspaces/[id]/files/route.ts @@ -14,7 +14,7 @@ const logger = createLogger('WorkspaceFilesAPI') * GET /api/workspaces/[id]/files * List all files for a workspace (requires read permission) */ -export async function GET(request: NextRequest, { params }: { params: Promise<{ id: string }> }) { +export async function GET(_request: NextRequest, { params }: { params: Promise<{ id: string }> }) { const requestId = generateRequestId() const { id: workspaceId } = await params diff --git a/apps/sim/app/api/workspaces/[id]/notifications/[notificationId]/route.ts b/apps/sim/app/api/workspaces/[id]/notifications/[notificationId]/route.ts index 0fff019545..f4ce8d2aba 100644 --- a/apps/sim/app/api/workspaces/[id]/notifications/[notificationId]/route.ts +++ b/apps/sim/app/api/workspaces/[id]/notifications/[notificationId]/route.ts @@ -7,8 +7,11 @@ import { z } from 'zod' import { getSession } from '@/lib/auth' import { encryptSecret } from '@/lib/core/security/encryption' import { getUserEntityPermissions } from '@/lib/workspaces/permissions/utils' +import { + MAX_EMAIL_RECIPIENTS, + MAX_WORKFLOW_IDS, +} from '@/app/api/workspaces/[id]/notifications/constants' import { CORE_TRIGGER_TYPES } from '@/stores/logs/filters/types' -import { MAX_EMAIL_RECIPIENTS, MAX_WORKFLOW_IDS } from '../constants' const logger = createLogger('WorkspaceNotificationAPI') @@ -118,7 +121,7 @@ async function getSubscription(notificationId: string, workspaceId: string) { return subscription } -export async function GET(request: NextRequest, { params }: RouteParams) { +export async function GET(_request: NextRequest, { params }: RouteParams) { try { const session = await getSession() if (!session?.user?.id) { @@ -278,7 +281,7 @@ export async function PUT(request: NextRequest, { params }: RouteParams) { } } -export async function DELETE(request: NextRequest, { params }: RouteParams) { +export async function DELETE(_request: NextRequest, { params }: RouteParams) { try { const session = await getSession() if (!session?.user?.id) { diff --git a/apps/sim/app/api/workspaces/[id]/notifications/[notificationId]/test/route.ts b/apps/sim/app/api/workspaces/[id]/notifications/[notificationId]/test/route.ts index f549bc98b2..6b3c86e1c1 100644 --- a/apps/sim/app/api/workspaces/[id]/notifications/[notificationId]/test/route.ts +++ b/apps/sim/app/api/workspaces/[id]/notifications/[notificationId]/test/route.ts @@ -1,4 +1,4 @@ -import { createHmac } from 'crypto' +import { createHmac } from 'node:crypto' import { db } from '@sim/db' import { account, workspaceNotificationSubscription } from '@sim/db/schema' import { createLogger } from '@sim/logger' @@ -278,7 +278,7 @@ async function testSlack( } } -export async function POST(request: NextRequest, { params }: RouteParams) { +export async function POST(_request: NextRequest, { params }: RouteParams) { try { const session = await getSession() if (!session?.user?.id) { diff --git a/apps/sim/app/api/workspaces/[id]/notifications/route.ts b/apps/sim/app/api/workspaces/[id]/notifications/route.ts index 36d33204ea..c84baf9790 100644 --- a/apps/sim/app/api/workspaces/[id]/notifications/route.ts +++ b/apps/sim/app/api/workspaces/[id]/notifications/route.ts @@ -8,8 +8,12 @@ import { z } from 'zod' import { getSession } from '@/lib/auth' import { encryptSecret } from '@/lib/core/security/encryption' import { getUserEntityPermissions } from '@/lib/workspaces/permissions/utils' +import { + MAX_EMAIL_RECIPIENTS, + MAX_NOTIFICATIONS_PER_TYPE, + MAX_WORKFLOW_IDS, +} from '@/app/api/workspaces/[id]/notifications/constants' import { CORE_TRIGGER_TYPES } from '@/stores/logs/filters/types' -import { MAX_EMAIL_RECIPIENTS, MAX_NOTIFICATIONS_PER_TYPE, MAX_WORKFLOW_IDS } from './constants' const logger = createLogger('WorkspaceNotificationsAPI') @@ -115,7 +119,7 @@ async function checkWorkspaceWriteAccess( return { hasAccess, permission } } -export async function GET(request: NextRequest, { params }: { params: Promise<{ id: string }> }) { +export async function GET(_request: NextRequest, { params }: { params: Promise<{ id: string }> }) { try { const session = await getSession() if (!session?.user?.id) { diff --git a/apps/sim/app/api/workspaces/[id]/permissions/route.ts b/apps/sim/app/api/workspaces/[id]/permissions/route.ts index 0025c90fc0..0ae5a2b70d 100644 --- a/apps/sim/app/api/workspaces/[id]/permissions/route.ts +++ b/apps/sim/app/api/workspaces/[id]/permissions/route.ts @@ -1,4 +1,4 @@ -import crypto from 'crypto' +import crypto from 'node:crypto' import { db } from '@sim/db' import { permissions, workspace } from '@sim/db/schema' import { createLogger } from '@sim/logger' @@ -31,7 +31,7 @@ const updatePermissionsSchema = z.object({ * @param workspaceId - The workspace ID from the URL parameters * @returns Array of users with their permissions for the workspace */ -export async function GET(request: NextRequest, { params }: { params: Promise<{ id: string }> }) { +export async function GET(_request: NextRequest, { params }: { params: Promise<{ id: string }> }) { try { const { id: workspaceId } = await params const session = await getSession() diff --git a/apps/sim/app/api/workspaces/invitations/[invitationId]/route.ts b/apps/sim/app/api/workspaces/invitations/[invitationId]/route.ts index c7574a61e2..21140d4191 100644 --- a/apps/sim/app/api/workspaces/invitations/[invitationId]/route.ts +++ b/apps/sim/app/api/workspaces/invitations/[invitationId]/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { render } from '@react-email/render' import { db } from '@sim/db' import { diff --git a/apps/sim/app/api/workspaces/invitations/route.ts b/apps/sim/app/api/workspaces/invitations/route.ts index bd70b9dc9c..570cb1ffc5 100644 --- a/apps/sim/app/api/workspaces/invitations/route.ts +++ b/apps/sim/app/api/workspaces/invitations/route.ts @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto' +import { randomUUID } from 'node:crypto' import { render } from '@react-email/render' import { db } from '@sim/db' import { @@ -30,7 +30,7 @@ const logger = createLogger('WorkspaceInvitationsAPI') type PermissionType = (typeof permissionTypeEnum.enumValues)[number] // Get all invitations for the user's workspaces -export async function GET(req: NextRequest) { +export async function GET(_req: NextRequest) { const session = await getSession() if (!session?.user?.id) { diff --git a/apps/sim/app/changelog/components/changelog-content.tsx b/apps/sim/app/changelog/components/changelog-content.tsx index e0eefc3324..efbe3b5558 100644 --- a/apps/sim/app/changelog/components/changelog-content.tsx +++ b/apps/sim/app/changelog/components/changelog-content.tsx @@ -42,7 +42,7 @@ export default async function ChangelogContent() { url: r.html_url, contributors: extractMentions(String(r.body || '')), })) - } catch (err) { + } catch (_err) { entries = [] } diff --git a/apps/sim/app/chat/[identifier]/chat.tsx b/apps/sim/app/chat/[identifier]/chat.tsx index 94082ffec2..6031659597 100644 --- a/apps/sim/app/chat/[identifier]/chat.tsx +++ b/apps/sim/app/chat/[identifier]/chat.tsx @@ -138,33 +138,30 @@ export default function ChatClient({ identifier }: { identifier: string }) { } }, []) - const scrollToMessage = useCallback( - (messageId: string, scrollToShowOnlyMessage = false) => { - const messageElement = document.querySelector(`[data-message-id="${messageId}"]`) - if (messageElement && messagesContainerRef.current) { - const container = messagesContainerRef.current - const containerRect = container.getBoundingClientRect() - const messageRect = messageElement.getBoundingClientRect() - - if (scrollToShowOnlyMessage) { - const scrollTop = container.scrollTop + messageRect.top - containerRect.top - - container.scrollTo({ - top: scrollTop, - behavior: 'smooth', - }) - } else { - const scrollTop = container.scrollTop + messageRect.top - containerRect.top - 80 - - container.scrollTo({ - top: scrollTop, - behavior: 'smooth', - }) - } + const scrollToMessage = useCallback((messageId: string, scrollToShowOnlyMessage = false) => { + const messageElement = document.querySelector(`[data-message-id="${messageId}"]`) + if (messageElement && messagesContainerRef.current) { + const container = messagesContainerRef.current + const containerRect = container.getBoundingClientRect() + const messageRect = messageElement.getBoundingClientRect() + + if (scrollToShowOnlyMessage) { + const scrollTop = container.scrollTop + messageRect.top - containerRect.top + + container.scrollTo({ + top: scrollTop, + behavior: 'smooth', + }) + } else { + const scrollTop = container.scrollTop + messageRect.top - containerRect.top - 80 + + container.scrollTo({ + top: scrollTop, + behavior: 'smooth', + }) } - }, - [messagesContainerRef] - ) + } + }, []) const handleScroll = useCallback( throttle(() => { @@ -179,7 +176,7 @@ export default function ChatClient({ identifier }: { identifier: string }) { setUserHasScrolled(true) } }, 100), - [isStreamingResponse] + [] ) useEffect(() => { @@ -265,7 +262,7 @@ export default function ChatClient({ identifier }: { identifier: string }) { .catch((err) => { logger.error('Failed to fetch GitHub stars:', err) }) - }, [identifier]) + }, [fetchChatConfig]) const refreshChat = () => { fetchChatConfig() @@ -440,7 +437,7 @@ export default function ChatClient({ identifier }: { identifier: string }) { if (isStreamingResponse) { stopStreaming(setMessages) } - }, [isStreamingResponse, stopStreaming, setMessages, stopAudio]) + }, [isStreamingResponse, stopStreaming, stopAudio]) const handleVoiceStart = useCallback(() => { setIsVoiceFirstMode(true) diff --git a/apps/sim/app/chat/components/header/header.tsx b/apps/sim/app/chat/components/header/header.tsx index 55fa058b96..85fcb74ad0 100644 --- a/apps/sim/app/chat/components/header/header.tsx +++ b/apps/sim/app/chat/components/header/header.tsx @@ -21,7 +21,6 @@ interface ChatHeaderProps { export function ChatHeader({ chatConfig, starCount }: ChatHeaderProps) { const brand = useBrandConfig() - const primaryColor = chatConfig?.customizations?.primaryColor || 'var(--brand-primary-hex)' const customImage = chatConfig?.customizations?.imageUrl || chatConfig?.customizations?.logoUrl return ( diff --git a/apps/sim/app/chat/components/input/input.tsx b/apps/sim/app/chat/components/input/input.tsx index ea41dbb954..0892b0a618 100644 --- a/apps/sim/app/chat/components/input/input.tsx +++ b/apps/sim/app/chat/components/input/input.tsx @@ -70,7 +70,7 @@ export const ChatInput: React.FC<{ // Adjust height on input change useEffect(() => { adjustTextareaHeight() - }, [inputValue]) + }, [adjustTextareaHeight]) // Close the input when clicking outside (only when empty) useEffect(() => { @@ -96,7 +96,7 @@ export const ChatInput: React.FC<{ textareaRef.current.focus() adjustTextareaHeight() // Adjust height when becoming active } - }, [isActive]) + }, [isActive, adjustTextareaHeight]) const handleActivate = () => { setIsActive(true) diff --git a/apps/sim/app/chat/components/voice-interface/components/particles.tsx b/apps/sim/app/chat/components/voice-interface/components/particles.tsx index 3b206e3369..c1006e0b3c 100644 --- a/apps/sim/app/chat/components/voice-interface/components/particles.tsx +++ b/apps/sim/app/chat/components/voice-interface/components/particles.tsx @@ -463,7 +463,16 @@ export function ParticlesVisualization({ container.removeEventListener('mousemove', handleMouseMove) cleanup() } - }, []) + }, [ + audioLevels.length, + audioLevels.reduce, + cleanup, + isListening, + isMuted, + isPlayingAudio, + isProcessingInterruption, + isStreaming, + ]) useEffect(() => { const handleResize = () => { diff --git a/apps/sim/app/chat/components/voice-interface/voice-interface.tsx b/apps/sim/app/chat/components/voice-interface/voice-interface.tsx index 94411a0e29..3da3cfd448 100644 --- a/apps/sim/app/chat/components/voice-interface/voice-interface.tsx +++ b/apps/sim/app/chat/components/voice-interface/voice-interface.tsx @@ -72,9 +72,7 @@ export function VoiceInterface({ const [isInitialized, setIsInitialized] = useState(false) const [isMuted, setIsMuted] = useState(false) const [audioLevels, setAudioLevels] = useState(new Array(200).fill(0)) - const [permissionStatus, setPermissionStatus] = useState<'prompt' | 'granted' | 'denied'>( - 'prompt' - ) + const [, setPermissionStatus] = useState<'prompt' | 'granted' | 'denied'>('prompt') const [currentTranscript, setCurrentTranscript] = useState('') const currentStateRef = useRef<'idle' | 'listening' | 'agent_speaking'>('idle') @@ -254,7 +252,7 @@ export function VoiceInterface({ if (recognitionRef.current) { try { recognitionRef.current.stop() - } catch (error) { + } catch (_error) { // Ignore } } @@ -326,7 +324,7 @@ export function VoiceInterface({ if (recognitionRef.current) { try { recognitionRef.current.stop() - } catch (error) { + } catch (_error) { // Ignore } } diff --git a/apps/sim/app/chat/hooks/use-audio-streaming.ts b/apps/sim/app/chat/hooks/use-audio-streaming.ts index b7bda6208e..7f78b6f368 100644 --- a/apps/sim/app/chat/hooks/use-audio-streaming.ts +++ b/apps/sim/app/chat/hooks/use-audio-streaming.ts @@ -43,7 +43,7 @@ export function useAudioStreaming(sharedAudioContextRef?: RefObject { abortControllerRef.current?.abort() @@ -51,7 +51,7 @@ export function useAudioStreaming(sharedAudioContextRef?: RefObject('paused') const [queuePosition, setQueuePosition] = useState(undefined) - const [resumeInputs, setResumeInputs] = useState>({}) + const [, setResumeInputs] = useState>({}) const [resumeInput, setResumeInput] = useState('') - const [formValuesByContext, setFormValuesByContext] = useState< - Record> - >({}) + const [, setFormValuesByContext] = useState>>({}) const [formValues, setFormValues] = useState>({}) const [formErrors, setFormErrors] = useState>({}) const [loadingDetail, setLoadingDetail] = useState(false) diff --git a/apps/sim/app/templates/components/template-card.tsx b/apps/sim/app/templates/components/template-card.tsx index 6663b1de57..e8133f59e7 100644 --- a/apps/sim/app/templates/components/template-card.tsx +++ b/apps/sim/app/templates/components/template-card.tsx @@ -1,5 +1,4 @@ import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react' -import { createLogger } from '@sim/logger' import { Star, User } from 'lucide-react' import { useParams, useRouter } from 'next/navigation' import { VerifiedBadge } from '@/components/ui/verified-badge' @@ -9,8 +8,6 @@ import { getBlock } from '@/blocks/registry' import { useStarTemplate } from '@/hooks/queries/templates' import type { WorkflowState } from '@/stores/workflows/workflow/types' -const logger = createLogger('TemplateCard') - interface TemplateCardProps { id: string title: string @@ -64,8 +61,8 @@ const extractBlockTypesFromState = (state?: { const blockTypes = Object.keys(state.blocks) .sort() - .map((key) => state.blocks![key].type) - .filter((type) => type !== 'starter') + .map((key) => state.blocks?.[key].type) + .filter((type): type is string => type !== undefined && type !== 'starter') return [...new Set(blockTypes)] } diff --git a/apps/sim/app/templates/templates.tsx b/apps/sim/app/templates/templates.tsx index cbb3ab6938..b7727a7952 100644 --- a/apps/sim/app/templates/templates.tsx +++ b/apps/sim/app/templates/templates.tsx @@ -59,8 +59,8 @@ export default function Templates({ const [searchQuery, setSearchQuery] = useState('') const debouncedSearchQuery = useDebounce(searchQuery, 300) const [activeTab, setActiveTab] = useState('gallery') - const [templates, setTemplates] = useState(initialTemplates) - const [loading, setLoading] = useState(false) + const [templates] = useState(initialTemplates) + const [loading] = useState(false) useEffect(() => { if (currentUserId) { diff --git a/apps/sim/app/workspace/[workspaceId]/files/[fileId]/view/file-viewer.tsx b/apps/sim/app/workspace/[workspaceId]/files/[fileId]/view/file-viewer.tsx index fb858aa0d4..f4b9da278f 100644 --- a/apps/sim/app/workspace/[workspaceId]/files/[fileId]/view/file-viewer.tsx +++ b/apps/sim/app/workspace/[workspaceId]/files/[fileId]/view/file-viewer.tsx @@ -18,7 +18,7 @@ export function FileViewer({ file }: FileViewerProps) { src={serveUrl} className='h-full w-full border-0' title={file.name} - onError={(e) => { + onError={(_e) => { logger.error(`Failed to load file: ${file.name}`) }} /> diff --git a/apps/sim/app/workspace/[workspaceId]/files/[fileId]/view/page.tsx b/apps/sim/app/workspace/[workspaceId]/files/[fileId]/view/page.tsx index e82182edb7..c84c0fde6d 100644 --- a/apps/sim/app/workspace/[workspaceId]/files/[fileId]/view/page.tsx +++ b/apps/sim/app/workspace/[workspaceId]/files/[fileId]/view/page.tsx @@ -31,7 +31,7 @@ export default async function FileViewerPage({ params }: FileViewerPageProps) { } return - } catch (error) { + } catch (_error) { redirect(`/workspace/${workspaceId}`) } } diff --git a/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/components/edit-chunk-modal/edit-chunk-modal.tsx b/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/components/edit-chunk-modal/edit-chunk-modal.tsx index e1faef399a..d976e96eec 100644 --- a/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/components/edit-chunk-modal/edit-chunk-modal.tsx +++ b/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/components/edit-chunk-modal/edit-chunk-modal.tsx @@ -100,7 +100,7 @@ export function EditChunkModal({ if (chunk?.content) { setEditedContent(chunk.content) } - }, [chunk?.id, chunk?.content]) + }, [chunk?.content]) const currentChunkIndex = chunk ? allChunks.findIndex((c) => c.id === chunk.id) : -1 diff --git a/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/document.tsx b/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/document.tsx index ad4750e851..ebfe765a34 100644 --- a/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/document.tsx +++ b/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/document.tsx @@ -355,7 +355,7 @@ export function Document({ }, [hasPrevPage, currentPage, goToPage]) const refreshChunks = showingSearch ? async () => {} : initialRefreshChunks - const updateChunk = showingSearch ? (id: string, updates: any) => {} : initialUpdateChunk + const updateChunk = showingSearch ? (_id: string, _updates: any) => {} : initialUpdateChunk const [isCreateChunkModalOpen, setIsCreateChunkModalOpen] = useState(false) const [chunkToDelete, setChunkToDelete] = useState(null) diff --git a/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/components/add-documents-modal/add-documents-modal.tsx b/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/components/add-documents-modal/add-documents-modal.tsx index 183036155a..85341c36f1 100644 --- a/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/components/add-documents-modal/add-documents-modal.tsx +++ b/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/components/add-documents-modal/add-documents-modal.tsx @@ -47,7 +47,7 @@ export function AddDocumentsModal({ const [files, setFiles] = useState([]) const [fileError, setFileError] = useState(null) const [isDragging, setIsDragging] = useState(false) - const [dragCounter, setDragCounter] = useState(0) + const [_dragCounter, setDragCounter] = useState(0) const [retryingIndexes, setRetryingIndexes] = useState>(new Set()) const { isUploading, uploadProgress, uploadFiles, uploadError, clearError } = useKnowledgeUpload({ diff --git a/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/components/base-tags-modal/base-tags-modal.tsx b/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/components/base-tags-modal/base-tags-modal.tsx index 282a85622b..4fef69e10c 100644 --- a/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/components/base-tags-modal/base-tags-modal.tsx +++ b/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/components/base-tags-modal/base-tags-modal.tsx @@ -203,7 +203,7 @@ export function BaseTagsModal({ open, onOpenChange, knowledgeBaseId }: BaseTagsM label: `${FIELD_TYPE_LABELS[type]} (${used}/${max})`, } }) - }, [kbTagDefinitions]) + }, [getSlotUsageByFieldType, hasAvailableSlots]) const saveTagDefinition = async () => { if (!canSaveTag()) return diff --git a/apps/sim/app/workspace/[workspaceId]/knowledge/components/create-base-modal/create-base-modal.tsx b/apps/sim/app/workspace/[workspaceId]/knowledge/components/create-base-modal/create-base-modal.tsx index 70419c8211..bf8ee489fa 100644 --- a/apps/sim/app/workspace/[workspaceId]/knowledge/components/create-base-modal/create-base-modal.tsx +++ b/apps/sim/app/workspace/[workspaceId]/knowledge/components/create-base-modal/create-base-modal.tsx @@ -90,7 +90,7 @@ export function CreateBaseModal({ open, onOpenChange }: CreateBaseModalProps) { const [files, setFiles] = useState([]) const [fileError, setFileError] = useState(null) const [isDragging, setIsDragging] = useState(false) - const [dragCounter, setDragCounter] = useState(0) + const [_dragCounter, setDragCounter] = useState(0) const [retryingIndexes, setRetryingIndexes] = useState>(new Set()) const scrollContainerRef = useRef(null) diff --git a/apps/sim/app/workspace/[workspaceId]/logs/components/dashboard/components/line-chart/line-chart.tsx b/apps/sim/app/workspace/[workspaceId]/logs/components/dashboard/components/line-chart/line-chart.tsx index 24a80a8f80..15adc379ad 100644 --- a/apps/sim/app/workspace/[workspaceId]/logs/components/dashboard/components/line-chart/line-chart.tsx +++ b/apps/sim/app/workspace/[workspaceId]/logs/components/dashboard/components/line-chart/line-chart.tsx @@ -146,7 +146,7 @@ function LineChartComponent({ const y = Math.max(yMin, Math.min(yMax, rawY)) return { x, y } }), - [data, chartWidth, chartHeight, minValue, valueRange, yMin, yMax, padding.left, padding.top] + [data, chartWidth, chartHeight, minValue, valueRange, yMin, yMax] ) const scaledSeries = useMemo( @@ -161,17 +161,7 @@ function LineChartComponent({ }) return { ...s, pts } }), - [ - allSeries, - chartWidth, - chartHeight, - minValue, - valueRange, - yMin, - yMax, - padding.left, - padding.top, - ] + [allSeries, chartWidth, chartHeight, minValue, valueRange, yMin, yMax] ) const getSeriesById = (id?: string | null) => scaledSeries.find((s) => s.id === id) @@ -206,7 +196,7 @@ function LineChartComponent({ try { const f = formatDate(timestamp) return `${f.compactDate} ${f.compactTime}` - } catch (e) { + } catch (_e) { const d = new Date(timestamp) if (Number.isNaN(d.getTime())) return '' return d.toLocaleString('en-US', { diff --git a/apps/sim/app/workspace/[workspaceId]/logs/components/dashboard/dashboard.tsx b/apps/sim/app/workspace/[workspaceId]/logs/components/dashboard/dashboard.tsx index aebf9df71e..729d9877f0 100644 --- a/apps/sim/app/workspace/[workspaceId]/logs/components/dashboard/dashboard.tsx +++ b/apps/sim/app/workspace/[workspaceId]/logs/components/dashboard/dashboard.tsx @@ -376,7 +376,7 @@ export default function Dashboard({ stats, isLoading, error }: DashboardProps) { useEffect(() => { setSelectedSegments({}) setLastAnchorIndices({}) - }, [stats, timeRange, workflowIds, searchQuery]) + }, []) if (isLoading) { return diff --git a/apps/sim/app/workspace/[workspaceId]/logs/components/log-details/log-details.tsx b/apps/sim/app/workspace/[workspaceId]/logs/components/log-details/log-details.tsx index b0f79805a0..28945c801d 100644 --- a/apps/sim/app/workspace/[workspaceId]/logs/components/log-details/log-details.tsx +++ b/apps/sim/app/workspace/[workspaceId]/logs/components/log-details/log-details.tsx @@ -263,7 +263,7 @@ export const LogDetails = memo(function LogDetails({ if (scrollAreaRef.current) { scrollAreaRef.current.scrollTop = 0 } - }, [log?.id]) + }, []) const isWorkflowExecutionLog = useMemo(() => { if (!log) return false @@ -311,7 +311,7 @@ export const LogDetails = memo(function LogDetails({ const formattedTimestamp = useMemo( () => (log ? formatDate(log.createdAt) : null), - [log?.createdAt] + [log?.createdAt, log] ) const logStatus = useMemo(() => getDisplayStatus(log?.status), [log?.status]) diff --git a/apps/sim/app/workspace/[workspaceId]/logs/components/logs-toolbar/components/notifications/components/workflow-selector/workflow-selector.tsx b/apps/sim/app/workspace/[workspaceId]/logs/components/logs-toolbar/components/notifications/components/workflow-selector/workflow-selector.tsx index fe8b66356b..8f5df4fff8 100644 --- a/apps/sim/app/workspace/[workspaceId]/logs/components/logs-toolbar/components/notifications/components/workflow-selector/workflow-selector.tsx +++ b/apps/sim/app/workspace/[workspaceId]/logs/components/logs-toolbar/components/notifications/components/workflow-selector/workflow-selector.tsx @@ -99,7 +99,7 @@ export function WorkflowSelector({ )} ) - }, [allWorkflows, selectedWorkflows, selectedIds]) + }, [allWorkflows, selectedWorkflows, handleRemove]) if (isLoading) { return ( diff --git a/apps/sim/app/workspace/[workspaceId]/logs/components/logs-toolbar/components/notifications/notifications.tsx b/apps/sim/app/workspace/[workspaceId]/logs/components/logs-toolbar/components/notifications/notifications.tsx index 216ccf8414..81bbfa3a28 100644 --- a/apps/sim/app/workspace/[workspaceId]/logs/components/logs-toolbar/components/notifications/notifications.tsx +++ b/apps/sim/app/workspace/[workspaceId]/logs/components/logs-toolbar/components/notifications/notifications.tsx @@ -32,8 +32,7 @@ import { useTestNotification, useUpdateNotification, } from '@/hooks/queries/notifications' -import { useConnectOAuthService } from '@/hooks/queries/oauth-connections' -import { useSlackAccounts } from '@/hooks/use-slack-accounts' +import { useConnectedAccounts, useConnectOAuthService } from '@/hooks/queries/oauth-connections' import { CORE_TRIGGER_TYPES, type CoreTriggerType } from '@/stores/logs/filters/types' import { SlackChannelSelector } from './components/slack-channel-selector' import { WorkflowSelector } from './components/workflow-selector' @@ -167,7 +166,8 @@ export function NotificationSettings({ const deleteNotification = useDeleteNotification() const testNotification = useTestNotification() - const { accounts: slackAccounts, isLoading: isLoadingSlackAccounts } = useSlackAccounts() + const { data: slackAccounts = [], isLoading: isLoadingSlackAccounts } = + useConnectedAccounts('slack') const connectSlack = useConnectOAuthService() useEffect(() => { @@ -530,7 +530,7 @@ export function NotificationSettings({ message: result.data?.error || (result.data?.success ? 'Test sent successfully' : 'Test failed'), }) - } catch (error) { + } catch (_error) { setTestStatus({ id, success: false, message: 'Failed to send test' }) } } diff --git a/apps/sim/app/workspace/[workspaceId]/logs/components/logs-toolbar/components/search/search.tsx b/apps/sim/app/workspace/[workspaceId]/logs/components/logs-toolbar/components/search/search.tsx index f4964ad44d..5fa483e23f 100644 --- a/apps/sim/app/workspace/[workspaceId]/logs/components/logs-toolbar/components/search/search.tsx +++ b/apps/sim/app/workspace/[workspaceId]/logs/components/logs-toolbar/components/search/search.tsx @@ -119,7 +119,7 @@ export function AutocompleteSearch({ initializeFromQuery(parsed.textSearch, parsed.filters) } // eslint-disable-next-line react-hooks/exhaustive-deps - }, []) + }, [initializeFromQuery, value]) const [dropdownWidth, setDropdownWidth] = useState(400) useEffect(() => { @@ -131,7 +131,7 @@ export function AutocompleteSearch({ measure() window.addEventListener('resize', measure) return () => window.removeEventListener('resize', measure) - }, []) + }, [inputRef.current]) useEffect(() => { onOpenChange?.(isOpen) @@ -144,7 +144,7 @@ export function AutocompleteSearch({ if (container && optionEl) { optionEl.scrollIntoView({ block: 'nearest', behavior: 'smooth' }) } - }, [isOpen, highlightedIndex]) + }, [isOpen, highlightedIndex, dropdownRef.current]) const hasFilters = appliedFilters.length > 0 const hasTextSearch = textSearch.length > 0 diff --git a/apps/sim/app/workspace/[workspaceId]/logs/logs.tsx b/apps/sim/app/workspace/[workspaceId]/logs/logs.tsx index aa7311fa59..60577771fa 100644 --- a/apps/sim/app/workspace/[workspaceId]/logs/logs.tsx +++ b/apps/sim/app/workspace/[workspaceId]/logs/logs.tsx @@ -76,7 +76,7 @@ export default function Logs() { setSearchQuery(urlSearch) } // eslint-disable-next-line react-hooks/exhaustive-deps - }, []) + }, [searchQuery]) const [isLive, setIsLive] = useState(true) const [isVisuallyRefreshing, setIsVisuallyRefreshing] = useState(false) @@ -226,7 +226,7 @@ export default function Logs() { const handleClearAllFilters = useCallback(() => { resetFilters() setSearchQuery('') - }, [resetFilters, setSearchQuery]) + }, [resetFilters]) const handleOpenPreview = useCallback(() => { if (contextMenuLog?.id) { @@ -256,7 +256,7 @@ export default function Logs() { block: 'nearest', }) } - }, [selectedLogIndex]) + }, []) const handleRefresh = useCallback(() => { setIsVisuallyRefreshing(true) diff --git a/apps/sim/app/workspace/[workspaceId]/providers/global-commands-provider.tsx b/apps/sim/app/workspace/[workspaceId]/providers/global-commands-provider.tsx index e4cbb443df..0bf35752ca 100644 --- a/apps/sim/app/workspace/[workspaceId]/providers/global-commands-provider.tsx +++ b/apps/sim/app/workspace/[workspaceId]/providers/global-commands-provider.tsx @@ -10,7 +10,6 @@ import { useRef, } from 'react' import { createLogger } from '@sim/logger' -import { useRouter } from 'next/navigation' const logger = createLogger('GlobalCommands') @@ -81,8 +80,6 @@ function matchesShortcut(e: KeyboardEvent, parsed: ParsedShortcut): boolean { export function GlobalCommandsProvider({ children }: { children: ReactNode }) { const registryRef = useRef>(new Map()) - const isMac = useMemo(() => isMacPlatform(), []) - const router = useRouter() const register = useCallback((commands: GlobalCommand[]) => { const createdIds: string[] = [] @@ -134,7 +131,7 @@ export function GlobalCommandsProvider({ children }: { children: ReactNode }) { window.addEventListener('keydown', onKeyDown, { capture: true }) return () => window.removeEventListener('keydown', onKeyDown, { capture: true }) - }, [isMac, router]) + }, []) const value = useMemo(() => ({ register }), [register]) @@ -164,5 +161,5 @@ export function useRegisterGlobalCommands(commands: GlobalCommand[] | (() => Glo const unregister = ctx.register(wrappedCommands) return unregister // eslint-disable-next-line react-hooks/exhaustive-deps - }, []) + }, [ctx.register]) } diff --git a/apps/sim/app/workspace/[workspaceId]/providers/workspace-permissions-provider.tsx b/apps/sim/app/workspace/[workspaceId]/providers/workspace-permissions-provider.tsx index 607d177888..ab198204d0 100644 --- a/apps/sim/app/workspace/[workspaceId]/providers/workspace-permissions-provider.tsx +++ b/apps/sim/app/workspace/[workspaceId]/providers/workspace-permissions-provider.tsx @@ -1,32 +1,28 @@ 'use client' import type React from 'react' -import { createContext, useContext, useEffect, useMemo, useState } from 'react' +import { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react' import { createLogger } from '@sim/logger' +import { useQueryClient } from '@tanstack/react-query' import { useParams } from 'next/navigation' -import { useUserPermissions, type WorkspaceUserPermissions } from '@/hooks/use-user-permissions' import { - useWorkspacePermissions, + useWorkspacePermissionsQuery, type WorkspacePermissions, -} from '@/hooks/use-workspace-permissions' + workspaceKeys, +} from '@/hooks/queries/workspace' +import { useUserPermissions, type WorkspaceUserPermissions } from '@/hooks/use-user-permissions' import { useNotificationStore } from '@/stores/notifications' import { useOperationQueueStore } from '@/stores/operation-queue/store' const logger = createLogger('WorkspacePermissionsProvider') interface WorkspacePermissionsContextType { - // Raw workspace permissions data workspacePermissions: WorkspacePermissions | null permissionsLoading: boolean permissionsError: string | null updatePermissions: (newPermissions: WorkspacePermissions) => void refetchPermissions: () => Promise - - // Computed user permissions (connection-aware) userPermissions: WorkspaceUserPermissions & { isOfflineMode?: boolean } - - // Connection state management - setOfflineMode: (isOffline: boolean) => void } const WorkspacePermissionsContext = createContext({ @@ -43,7 +39,6 @@ const WorkspacePermissionsContext = createContext {}, }) interface WorkspacePermissionsProviderProps { @@ -51,35 +46,20 @@ interface WorkspacePermissionsProviderProps { } /** - * Provider that manages workspace permissions and user access - * Also provides connection-aware permissions that enforce read-only mode when offline + * Provides workspace permissions and connection-aware user access throughout the app. + * Enforces read-only mode when offline to prevent data loss. */ export function WorkspacePermissionsProvider({ children }: WorkspacePermissionsProviderProps) { const params = useParams() const workspaceId = params?.workspaceId as string + const queryClient = useQueryClient() - // Manage offline mode state locally - const [isOfflineMode, setIsOfflineMode] = useState(false) - - // Track whether we've already surfaced an offline notification to avoid duplicates const [hasShownOfflineNotification, setHasShownOfflineNotification] = useState(false) - - // Get operation error state directly from the store (avoid full useCollaborativeWorkflow subscription) const hasOperationError = useOperationQueueStore((state) => state.hasOperationError) - const addNotification = useNotificationStore((state) => state.addNotification) - // Set offline mode when there are operation errors - useEffect(() => { - if (hasOperationError) { - setIsOfflineMode(true) - } - }, [hasOperationError]) + const isOfflineMode = hasOperationError - /** - * Surface a global notification when entering offline mode. - * Uses the shared notifications system instead of bespoke UI in individual components. - */ useEffect(() => { if (!isOfflineMode || hasShownOfflineNotification) { return @@ -89,7 +69,6 @@ export function WorkspacePermissionsProvider({ children }: WorkspacePermissionsP addNotification({ level: 'error', message: 'Connection unavailable', - // Global notification (no workflowId) so it is visible regardless of the active workflow action: { type: 'refresh', message: '', @@ -101,40 +80,44 @@ export function WorkspacePermissionsProvider({ children }: WorkspacePermissionsP } }, [addNotification, hasShownOfflineNotification, isOfflineMode]) - // Fetch workspace permissions and loading state const { - permissions: workspacePermissions, - loading: permissionsLoading, - error: permissionsError, - updatePermissions, - refetch: refetchPermissions, - } = useWorkspacePermissions(workspaceId) - - // Get base user permissions from workspace permissions + data: workspacePermissions, + isLoading: permissionsLoading, + error: permissionsErrorObj, + refetch, + } = useWorkspacePermissionsQuery(workspaceId) + + const permissionsError = permissionsErrorObj?.message ?? null + + const updatePermissions = useCallback( + (newPermissions: WorkspacePermissions) => { + if (!workspaceId) return + queryClient.setQueryData(workspaceKeys.permissions(workspaceId), newPermissions) + }, + [workspaceId, queryClient] + ) + + const refetchPermissions = useCallback(async () => { + await refetch() + }, [refetch]) + const baseUserPermissions = useUserPermissions( - workspacePermissions, + workspacePermissions ?? null, permissionsLoading, permissionsError ) - // Note: Connection-based error detection removed - only rely on operation timeouts - // The 5-second operation timeout system will handle all error cases - - // Create connection-aware permissions that override user permissions when offline const userPermissions = useMemo((): WorkspaceUserPermissions & { isOfflineMode?: boolean } => { if (isOfflineMode) { - // In offline mode, force read-only permissions regardless of actual user permissions return { ...baseUserPermissions, canEdit: false, canAdmin: false, - // Keep canRead true so users can still view content canRead: baseUserPermissions.canRead, isOfflineMode: true, } } - // When online, use normal permissions return { ...baseUserPermissions, isOfflineMode: false, @@ -143,13 +126,12 @@ export function WorkspacePermissionsProvider({ children }: WorkspacePermissionsP const contextValue = useMemo( () => ({ - workspacePermissions, + workspacePermissions: workspacePermissions ?? null, permissionsLoading, permissionsError, updatePermissions, refetchPermissions, userPermissions, - setOfflineMode: setIsOfflineMode, }), [ workspacePermissions, @@ -169,8 +151,8 @@ export function WorkspacePermissionsProvider({ children }: WorkspacePermissionsP } /** - * Hook to access workspace permissions and data from context - * This provides both raw workspace permissions and computed user permissions + * Accesses workspace permissions data and operations from context. + * Must be used within a WorkspacePermissionsProvider. */ export function useWorkspacePermissionsContext(): WorkspacePermissionsContextType { const context = useContext(WorkspacePermissionsContext) @@ -183,8 +165,8 @@ export function useWorkspacePermissionsContext(): WorkspacePermissionsContextTyp } /** - * Hook to access user permissions from context - * This replaces individual useUserPermissions calls and includes connection-aware permissions + * Accesses the current user's computed permissions including offline mode status. + * Convenience hook that extracts userPermissions from the context. */ export function useUserPermissionsContext(): WorkspaceUserPermissions & { isOfflineMode?: boolean diff --git a/apps/sim/app/workspace/[workspaceId]/templates/components/template-card.tsx b/apps/sim/app/workspace/[workspaceId]/templates/components/template-card.tsx index 5e7e112f6c..2f7fdda3cd 100644 --- a/apps/sim/app/workspace/[workspaceId]/templates/components/template-card.tsx +++ b/apps/sim/app/workspace/[workspaceId]/templates/components/template-card.tsx @@ -67,8 +67,8 @@ const extractBlockTypesFromState = (state?: { const blockTypes = Object.keys(state.blocks) .sort() - .map((key) => state.blocks![key].type) - .filter((type) => type !== 'starter') + .map((key) => state.blocks?.[key].type) + .filter((type): type is string => type !== undefined && type !== 'starter') return [...new Set(blockTypes)] } diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/chat/chat.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/chat/chat.tsx index 1c1d468bef..af041a867b 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/chat/chat.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/chat/chat.tsx @@ -53,7 +53,6 @@ import { useChatStore } from '@/stores/chat/store' import { getChatPosition } from '@/stores/chat/utils' import { useExecutionStore } from '@/stores/execution' import { useOperationQueue } from '@/stores/operation-queue/store' -import { useTerminalConsoleStore } from '@/stores/terminal' import { useWorkflowRegistry } from '@/stores/workflows/registry/store' import { useSubBlockStore } from '@/stores/workflows/subblock/store' import { useWorkflowStore } from '@/stores/workflows/workflow/store' @@ -253,9 +252,6 @@ export function Chat() { exportChatCSV, } = useChatStore() - const hasConsoleHydrated = useTerminalConsoleStore((state) => state._hasHydrated) - const entriesFromStore = useTerminalConsoleStore((state) => state.entries) - const entries = hasConsoleHydrated ? entriesFromStore : [] const { isExecuting } = useExecutionStore() const { handleRunWorkflow, handleCancelExecution } = useWorkflowExecution() const { data: session } = useSession() @@ -415,11 +411,6 @@ export function Chat() { onDimensionsChange: setChatDimensions, }) - const outputEntries = useMemo(() => { - if (!activeWorkflowId) return [] - return entries.filter((entry) => entry.workflowId === activeWorkflowId && entry.output) - }, [entries, activeWorkflowId]) - const workflowMessages = useMemo(() => { if (!activeWorkflowId) return [] return messages @@ -599,7 +590,7 @@ export function Chat() { focusInput(100) } }, - [appendMessageContent, finalizeMessageStream, focusInput, selectedOutputs, activeWorkflowId] + [appendMessageContent, finalizeMessageStream, focusInput] ) /** diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/chat/components/output-select/output-select.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/chat/components/output-select/output-select.tsx index 16b8e60d6c..3763b67656 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/chat/components/output-select/output-select.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/chat/components/output-select/output-select.tsx @@ -194,16 +194,7 @@ export function OutputSelect({ }) return outputs - }, [ - workflowBlocks, - workflowId, - isShowingDiff, - isDiffReady, - baselineWorkflow, - blocks, - subBlockValues, - shouldUseBaseline, - ]) + }, [workflowBlocks, workflowId, baselineWorkflow, subBlockValues, shouldUseBaseline]) /** * Gets display text for selected outputs @@ -317,7 +308,7 @@ export function OutputSelect({ })), } }) - }, [workflowOutputs, blocks, valueMode]) + }, [workflowOutputs, blocks, valueMode, getOutputColor]) /** * Normalize selected values to match the valueMode diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/notifications/notifications.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/notifications/notifications.tsx index ddd25134fc..593169d7fb 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/notifications/notifications.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/notifications/notifications.tsx @@ -171,9 +171,9 @@ export const Notifications = memo(function Notifications() { onClick={() => executeAction(notification.id, notification.action!)} className='w-full px-[8px] py-[4px] font-medium text-[12px]' > - {notification.action!.type === 'copilot' + {notification.action?.type === 'copilot' ? 'Fix in Copilot' - : notification.action!.type === 'refresh' + : notification.action?.type === 'refresh' ? 'Refresh' : 'Take action'} diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/copilot-message/copilot-message.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/copilot-message/copilot-message.tsx index 1e745f3f28..a539e4bd44 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/copilot-message/copilot-message.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/copilot-message/copilot-message.tsx @@ -144,11 +144,6 @@ const CopilotMessage: FC = memo( cancelEditRef.current = handleCancelEdit - const cleanTextContent = useMemo(() => { - if (!message.content) return '' - return message.content.replace(/\n{3,}/g, '\n\n') - }, [message.content]) - const parsedTags = useMemo(() => { if (isUser) return null @@ -210,7 +205,7 @@ const CopilotMessage: FC = memo( return message.contentBlocks.map((block, index) => { if (block.type === 'text') { const isLastTextBlock = - index === message.contentBlocks!.length - 1 && block.type === 'text' + index === (message.contentBlocks?.length ?? 0) - 1 && block.type === 'text' const parsed = parseSpecialTags(block.content) // Mask credential IDs in the displayed content const cleanBlockContent = maskCredentialValue( @@ -236,7 +231,7 @@ const CopilotMessage: FC = memo( ) } if (block.type === 'thinking') { - const hasFollowingContent = index < message.contentBlocks!.length - 1 + const hasFollowingContent = index < (message.contentBlocks?.length ?? 0) - 1 const hasSpecialTags = !!(parsedTags?.options || parsedTags?.plan) const blockKey = `thinking-${index}-${block.timestamp || index}` @@ -266,7 +261,7 @@ const CopilotMessage: FC = memo( } return null }) - }, [message.contentBlocks, isActivelyStreaming, parsedTags, isLastMessage]) + }, [message.contentBlocks, isActivelyStreaming, parsedTags, isLastMessage, maskCredentialValue]) if (isUser) { return ( diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/copilot-message/hooks/use-message-editing.ts b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/copilot-message/hooks/use-message-editing.ts index 4842777971..8c2e1f564b 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/copilot-message/hooks/use-message-editing.ts +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/copilot-message/hooks/use-message-editing.ts @@ -78,7 +78,7 @@ export function useMessageEditing(props: UseMessageEditingProps) { const scrollHeight = messageContentRef.current.scrollHeight setNeedsExpansion(scrollHeight > MESSAGE_TRUNCATION_HEIGHT) } - }, [message.content, message.role]) + }, [message.role]) /** Enters edit mode */ const handleEditMessage = useCallback(() => { diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/tool-call/tool-call.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/tool-call/tool-call.tsx index d22542375e..ebfb58ad1d 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/tool-call/tool-call.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/tool-call/tool-call.tsx @@ -1332,7 +1332,7 @@ async function handleSkip(toolCall: CopilotToolCall, setToolCallState: any, onSt if (res.ok) { notified = true } - } catch (e) { + } catch (_e) { if (attempt < 2) { await new Promise((resolve) => setTimeout(resolve, 500)) } diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/components/mention-menu/mention-menu.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/components/mention-menu/mention-menu.tsx index 89dbafa4b2..785072a9ef 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/components/mention-menu/mention-menu.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/components/mention-menu/mention-menu.tsx @@ -95,7 +95,7 @@ function MentionMenuContent({ useEffect(() => { setSubmenuActiveIndex(0) - }, [isInFolder, setSubmenuActiveIndex]) + }, [setSubmenuActiveIndex]) useEffect(() => { if (onFolderNavChange) { diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/hooks/use-file-attachments.ts b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/hooks/use-file-attachments.ts index 7587f69a9c..53bb10fcef 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/hooks/use-file-attachments.ts +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/hooks/use-file-attachments.ts @@ -58,7 +58,7 @@ export function useFileAttachments(props: UseFileAttachmentsProps) { const [attachedFiles, setAttachedFiles] = useState([]) const [isDragging, setIsDragging] = useState(false) - const [dragCounter, setDragCounter] = useState(0) + const [_dragCounter, setDragCounter] = useState(0) const fileInputRef = useRef(null) /** @@ -72,7 +72,7 @@ export function useFileAttachments(props: UseFileAttachmentsProps) { } }) } - }, []) + }, [attachedFiles.forEach]) /** * Formats file size in bytes to human-readable format diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/hooks/use-mention-data.ts b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/hooks/use-mention-data.ts index 15f5007b6b..f85880aac5 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/hooks/use-mention-data.ts +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/hooks/use-mention-data.ts @@ -136,7 +136,7 @@ export function useMentionData(props: UseMentionDataProps): MentionDataReturn { useEffect(() => { setBlocksList([]) - }, [config.allowedIntegrations]) + }, []) const [templatesList, setTemplatesList] = useState([]) const [isLoadingTemplates, setIsLoadingTemplates] = useState(false) @@ -145,7 +145,7 @@ export function useMentionData(props: UseMentionDataProps): MentionDataReturn { const [isLoadingLogs, setIsLoadingLogs] = useState(false) const [workflowBlocks, setWorkflowBlocks] = useState([]) - const [isLoadingWorkflowBlocks, setIsLoadingWorkflowBlocks] = useState(false) + const [isLoadingWorkflowBlocks, _setIsLoadingWorkflowBlocks] = useState(false) const blockKeys = useWorkflowStore( useShallow(useCallback((state) => Object.keys(state.blocks), [])) @@ -177,7 +177,7 @@ export function useMentionData(props: UseMentionDataProps): MentionDataReturn { useEffect(() => { setPastChats([]) setIsLoadingPastChats(false) - }, [workflowId]) + }, []) /** * Syncs workflow blocks from store diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/hooks/use-mention-tokens.ts b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/hooks/use-mention-tokens.ts index fc82f845db..b94ed186dd 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/hooks/use-mention-tokens.ts +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/hooks/use-mention-tokens.ts @@ -166,7 +166,7 @@ export function useMentionTokens({ * @param e - Clipboard event */ const handleCut = useCallback( - (e: React.ClipboardEvent) => { + (_e: React.ClipboardEvent) => { const textarea = mentionMenu.textareaRef.current if (!textarea) return diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/hooks/use-textarea-auto-resize.ts b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/hooks/use-textarea-auto-resize.ts index 82ee7107ec..bb14aacde8 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/hooks/use-textarea-auto-resize.ts +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/hooks/use-textarea-auto-resize.ts @@ -148,7 +148,7 @@ export function useTextareaAutoResize({ } syncOverlayStyles.current() - }, [message, selectedContexts, textareaRef]) + }, [message, textareaRef]) /** * Sync scroll position between textarea and overlay @@ -208,7 +208,7 @@ export function useTextareaAutoResize({ mutationObserver.disconnect() window.removeEventListener('resize', handleResize) } - }, [panelWidth, textareaRef, containerRef]) + }, [textareaRef, containerRef]) /** * Cleanup ResizeObservers on unmount diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/user-input.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/user-input.tsx index 02a4fb28f5..ae712774de 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/user-input.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/user-input/user-input.tsx @@ -276,7 +276,19 @@ const UserInput = forwardRef( requestAnimationFrame(() => mentionMenu.scrollActiveItemIntoView(0)) } // eslint-disable-next-line react-hooks/exhaustive-deps - }, [mentionMenu.showMentionMenu, mentionFolderNav?.isInFolder, message]) + }, [ + mentionMenu.showMentionMenu, + mentionFolderNav?.isInFolder, + mentionData.ensureBlocksLoaded, + mentionData.ensureKnowledgeLoaded, + mentionData.ensureLogsLoaded, + mentionData.ensurePastChatsLoaded, + mentionData.ensureTemplatesLoaded, + mentionMenu.getActiveMentionQueryAtPosition, + mentionMenu.getCaretPos, + mentionMenu.scrollActiveItemIntoView, + mentionMenu.setSubmenuActiveIndex, + ]) useEffect(() => { if (mentionFolderNav?.isInFolder) { @@ -284,7 +296,11 @@ const UserInput = forwardRef( requestAnimationFrame(() => mentionMenu.scrollActiveItemIntoView(0)) } // eslint-disable-next-line react-hooks/exhaustive-deps - }, [mentionFolderNav?.isInFolder]) + }, [ + mentionFolderNav?.isInFolder, + mentionMenu.scrollActiveItemIntoView, + mentionMenu.setSubmenuActiveIndex, + ]) const handleSubmit = useCallback( async (overrideMessage?: string, options: { preserveInput?: boolean } = {}) => { @@ -332,7 +348,6 @@ const UserInput = forwardRef( [ message, disabled, - isLoading, fileAttachments, onSubmit, contextManagement, diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/copilot.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/copilot.tsx index f0c9a59f07..dd83fd37ce 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/copilot.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/copilot.tsx @@ -268,7 +268,7 @@ export const Copilot = forwardRef(({ panelWidth }, ref if (showPlanTodos) { setTodosCollapsed(true) } - }, [abortMessage, showPlanTodos]) + }, [abortMessage, showPlanTodos, setTodosCollapsed]) /** Closes the plan todos section and clears the todos */ const handleClosePlanTodos = useCallback(() => { diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/api/api.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/api/api.tsx index eff1cff3a5..53401d6f9f 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/api/api.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/api/api.tsx @@ -399,19 +399,6 @@ console.log(limits);` } } - const getAsyncExampleTitle = () => { - switch (asyncExampleType) { - case 'execute': - return 'Execute Job' - case 'status': - return 'Check Status' - case 'rate-limits': - return 'Rate Limits' - default: - return 'Execute Job' - } - } - const handleCopy = (key: keyof CopiedState, value: string) => { navigator.clipboard.writeText(value) setCopied((prev) => ({ ...prev, [key]: true })) diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/form/form.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/form/form.tsx index d6f6f3e904..a0ba6412fc 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/form/form.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/form/form.tsx @@ -169,7 +169,7 @@ export function FormDeploy({ } } } - }, [workflowId, fieldConfigs.length]) + }, [fieldConfigs.length]) const allowedEmails = emailItems.filter((item) => item.isValid).map((item) => item.value) @@ -297,6 +297,7 @@ export function FormDeploy({ updateFormMutation, onDeployed, onDeploymentComplete, + setError, ] ) diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/template/template.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/template/template.tsx index c134f63f13..7bd4f199d2 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/template/template.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/template/template.tsx @@ -99,7 +99,7 @@ export function TemplateDeploy({ updateField('creatorId', creatorProfiles[0].id) logger.info('Auto-selected single creator profile:', creatorProfiles[0].name) } - }, [creatorProfiles, formData.creatorId]) + }, [creatorProfiles, formData.creatorId, updateField]) useEffect(() => { const handleCreatorProfileSaved = () => { diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/deploy-modal.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/deploy-modal.tsx index 4598318e0f..e722d3c268 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/deploy-modal.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/deploy-modal.tsx @@ -260,7 +260,7 @@ export function DeployModal({ if (validOutputs.length !== selectedStreamingOutputs.length) { setSelectedStreamingOutputs(validOutputs) } - }, [open, selectedStreamingOutputs, setSelectedStreamingOutputs]) + }, [open, selectedStreamingOutputs]) useEffect(() => { const handleOpenDeployModal = (event: Event) => { diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/hooks/use-deployed-state.ts b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/hooks/use-deployed-state.ts index 0bcdad7006..9426979bc1 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/hooks/use-deployed-state.ts +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/hooks/use-deployed-state.ts @@ -100,7 +100,7 @@ export function useDeployedState({ setIsLoadingDeployedState(false) } // eslint-disable-next-line react-hooks/exhaustive-deps - }, [workflowId, isDeployed, isRegistryLoading, setNeedsRedeploymentFlag]) + }, [workflowId, isDeployed, isRegistryLoading, setNeedsRedeploymentFlag, fetchDeployedState]) return { deployedState, diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/combobox/combobox.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/combobox/combobox.tsx index ea922b3baf..1cd736a9a2 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/combobox/combobox.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/combobox/combobox.tsx @@ -335,7 +335,7 @@ export const ComboBox = memo(function ComboBox({ fetchedOptions.length, isLoadingOptions, fetchError, - dependencyValues, + fetchOptionsIfNeeded, ]) // Hydrate the stored value's label by fetching it individually @@ -463,7 +463,7 @@ export const ComboBox = memo(function ComboBox({ ) - }, [inputValue, accessiblePrefixes, selectedOption, selectedOptionIcon]) + }, [inputValue, accessiblePrefixes, selectedOptionIcon]) const ctrlOnChangeRef = useRef< ((e: React.ChangeEvent) => void) | null @@ -491,7 +491,7 @@ export const ComboBox = memo(function ComboBox({ } as React.ChangeEvent ctrlOnChangeRef.current?.(syntheticEvent) }, - [comboboxOptions, setInputValue] + [comboboxOptions] ) const comboboxInputProps = useMemo( diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/condition-input/condition-input.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/condition-input/condition-input.tsx index 4b2c78c357..1d1c2c5da6 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/condition-input/condition-input.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/condition-input/condition-input.tsx @@ -333,7 +333,15 @@ export function ConditionInput({ isSyncingFromStoreRef.current = false }, 0) } - }, [storeValue, previewValue, isPreview, blockId, isReady]) + }, [ + storeValue, + previewValue, + isPreview, + isReady, + createDefaultBlocks, + isRouterMode, + safeParseJSON, + ]) // Update store whenever conditional blocks change useEffect(() => { @@ -353,15 +361,7 @@ export function ConditionInput({ setStoreValue(newValue) updateNodeInternals(blockId) } - }, [ - conditionalBlocks, - blockId, - subBlockId, - setStoreValue, - updateNodeInternals, - isReady, - isPreview, - ]) + }, [conditionalBlocks, blockId, setStoreValue, updateNodeInternals, isReady, isPreview]) // Cleanup when component unmounts useEffect(() => { @@ -518,42 +518,6 @@ export function ConditionInput({ } } - // Handle tag selection - updated for individual blocks - const handleTagSelect = (blockId: string, newValue: string) => { - if (isPreview || disabled) return - shouldPersistRef.current = true - setConditionalBlocks((blocks) => - blocks.map((block) => - block.id === blockId - ? { - ...block, - value: newValue, - showTags: false, - activeSourceBlockId: null, - } - : block - ) - ) - } - - // Handle environment variable selection - updated for individual blocks - const handleEnvVarSelect = (blockId: string, newValue: string) => { - if (isPreview || disabled) return - shouldPersistRef.current = true - setConditionalBlocks((blocks) => - blocks.map((block) => - block.id === blockId - ? { - ...block, - value: newValue, - showEnvVars: false, - searchTerm: '', - } - : block - ) - ) - } - const handleTagSelectImmediate = (blockId: string, newValue: string) => { if (isPreview || disabled) return @@ -743,7 +707,7 @@ export function ConditionInput({ }) } }) - }, [conditionalBlocks.length]) + }, [conditionalBlocks.forEach]) // Capture textarea refs from Editor components (condition mode) useEffect(() => { diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/dropdown/dropdown.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/dropdown/dropdown.tsx index d8d3ec00ec..af9289013f 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/dropdown/dropdown.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/dropdown/dropdown.tsx @@ -286,7 +286,7 @@ export const Dropdown = memo(function Dropdown({ } return [] - } catch (error) { + } catch (_error) { return [] } } @@ -331,7 +331,16 @@ export const Dropdown = memo(function Dropdown({ } previousModeRef.current = currentMode - }, [storeValue, subBlockId, isPreview, disabled, setData, setBuilderData, multiSelect]) + }, [ + storeValue, + subBlockId, + isPreview, + disabled, + setData, + setBuilderData, + multiSelect, + convertJsonToBuilderData, + ]) /** * Handles selection change for both single and multi-select modes @@ -400,7 +409,7 @@ export const Dropdown = memo(function Dropdown({ fetchedOptions.length, isLoadingOptions, fetchError, - dependencyValues, + fetchOptionsIfNeeded, ]) /** diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/env-var-dropdown.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/env-var-dropdown.tsx index 32a6dd33c4..b371cfe0d7 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/env-var-dropdown.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/env-var-dropdown.tsx @@ -165,7 +165,7 @@ export const EnvVarDropdown: React.FC = ({ useEffect(() => { setSelectedIndex(0) - }, [searchTerm]) + }, []) const openEnvironmentSettings = () => { window.dispatchEvent(new CustomEvent('open-settings', { detail: { tab: 'environment' } })) @@ -249,7 +249,7 @@ export const EnvVarDropdown: React.FC = ({ window.addEventListener('keydown', handleKeyboardEvent, true) return () => window.removeEventListener('keydown', handleKeyboardEvent, true) } - }, [visible, selectedIndex, filteredEnvVars]) + }, [visible, selectedIndex, filteredEnvVars, handleEnvVarSelect, onClose]) if (!visible) return null diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/file-upload/file-upload.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/file-upload/file-upload.tsx index 234498d01c..3862dcad7a 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/file-upload/file-upload.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/file-upload/file-upload.tsx @@ -131,7 +131,7 @@ export function FileUpload({ useEffect(() => { void loadWorkspaceFiles() - }, [workspaceId]) + }, [loadWorkspaceFiles]) /** * Opens file dialog @@ -512,7 +512,7 @@ export function FileUpload({ } }), ], - [availableWorkspaceFiles, acceptedTypes] + [availableWorkspaceFiles, acceptedTypes, isFileTypeAccepted] ) const handleComboboxChange = (value: string) => { diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/folder-selector/components/folder-selector-input.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/folder-selector/components/folder-selector-input.tsx index fa9a48bb4b..0aa04b7ef0 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/folder-selector/components/folder-selector-input.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/folder-selector/components/folder-selector-input.tsx @@ -30,7 +30,7 @@ export function FolderSelectorInput({ const [connectedCredential] = useSubBlockValue(blockId, 'credential') const { collaborativeSetSubblockValue } = useCollaborativeWorkflow() const { activeWorkflowId } = useWorkflowRegistry() - const [selectedFolderId, setSelectedFolderId] = useState('') + const [, setSelectedFolderId] = useState('') // Derive provider from serviceId using OAuth config (same pattern as credential-selector) const serviceId = subBlock.serviceId || '' diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/long-input/long-input.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/long-input/long-input.tsx index ed7dcc23c7..a127ba2b1c 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/long-input/long-input.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/long-input/long-input.tsx @@ -202,7 +202,7 @@ export function LongInput({ setLocalContent(baseValueString) } } - }, [baseValue, wandHook.isStreaming]) // Removed localContent to prevent infinite loop + }, [baseValue, wandHook.isStreaming, localContent]) // Removed localContent to prevent infinite loop // Update height when rows prop changes useLayoutEffect(() => { @@ -231,7 +231,7 @@ export function LongInput({ overlayRef.current.scrollTop = textareaRef.current.scrollTop overlayRef.current.scrollLeft = textareaRef.current.scrollLeft } - }, [value]) + }, []) // Handle resize functionality const startResize = (e: React.MouseEvent) => { diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/mcp-server-modal/mcp-tool-selector.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/mcp-server-modal/mcp-tool-selector.tsx index fa5fcd496c..3238cd609b 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/mcp-server-modal/mcp-tool-selector.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/mcp-server-modal/mcp-tool-selector.tsx @@ -61,7 +61,7 @@ export function McpToolSelector({ setStoreValue('') } } - }, [serverValue, availableTools, storeValue, setStoreValue, isPreview, disabled]) + }, [availableTools, storeValue, setStoreValue, isPreview, disabled]) const comboboxOptions = useMemo( () => diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/project-selector/project-selector-input.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/project-selector/project-selector-input.tsx index 9d5e353202..950664c5ab 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/project-selector/project-selector-input.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/project-selector/project-selector-input.tsx @@ -37,7 +37,7 @@ export function ProjectSelectorInput({ }: ProjectSelectorInputProps) { const params = useParams() const activeWorkflowId = useWorkflowRegistry((s) => s.activeWorkflowId) as string | null - const [selectedProjectId, setSelectedProjectId] = useState('') + const [, setSelectedProjectId] = useState('') const [storeValue] = useSubBlockValue(blockId, subBlock.id) const [jiraDomainFromStore] = useSubBlockValue(blockId, 'domain') diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/selector-combobox/selector-combobox.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/selector-combobox/selector-combobox.tsx index 2ba0322d23..cf2a99dba7 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/selector-combobox/selector-combobox.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/selector-combobox/selector-combobox.tsx @@ -61,7 +61,7 @@ export function SelectorCombobox({ context: selectorContext, detailId: activeValue, }) - const optionMap = useSelectorOptionMap(options, detailOption ?? undefined) + const optionMap = useSelectorOptionMap(options, detailOption) const hasMissingOption = Boolean(activeValue) && Boolean(missingOptionLabel) && diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/short-input/short-input.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/short-input/short-input.tsx index 606f120a7b..27928a7660 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/short-input/short-input.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/short-input/short-input.tsx @@ -210,8 +210,6 @@ export const ShortInput = memo(function ShortInput({ const effectiveValue = useWebhookUrl && webhookManagement.webhookUrl ? webhookManagement.webhookUrl : baseValue - const value = wandHook?.isStreaming ? localContent : effectiveValue - useEffect(() => { if (!wandHook.isStreaming) { const baseValueString = baseValue?.toString() ?? '' diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/slider-input/slider-input.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/slider-input/slider-input.tsx index 673669356e..ab6d76a6bd 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/slider-input/slider-input.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/slider-input/slider-input.tsx @@ -41,8 +41,6 @@ export function SliderInput({ ? Math.max(min, Math.min(max, value)) : computedDefaultValue - const displayValue = normalizedValue ?? computedDefaultValue - // Ensure the normalized value is set if it differs from the current value useEffect(() => { if (!isPreview && value !== null && value !== undefined && value !== normalizedValue) { diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tag-dropdown/components/keyboard-navigation-handler.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tag-dropdown/components/keyboard-navigation-handler.tsx index adb2981be4..91a50e645f 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tag-dropdown/components/keyboard-navigation-handler.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tag-dropdown/components/keyboard-navigation-handler.tsx @@ -136,7 +136,7 @@ export const KeyboardNavigationHandler: React.FC if (currentNestedTag) { if (currentNestedTag.parentTag) { const parentIdx = flatTagList.findIndex( - (item) => item.tag === currentNestedTag!.parentTag + (item) => item.tag === currentNestedTag?.parentTag ) if (parentIdx >= 0) { indices.push(parentIdx) @@ -182,14 +182,12 @@ export const KeyboardNavigationHandler: React.FC return indices }, [isInFolder, currentFolder, flatTagList, nestedBlockTagGroups, nestedNav]) - const nestedPathLength = nestedNav?.nestedPath.length ?? 0 - useEffect(() => { if (!visible || visibleIndices.length === 0) return setSelectedIndex(visibleIndices[0]) // eslint-disable-next-line react-hooks/exhaustive-deps - }, [visible, isInFolder, currentFolder, nestedPathLength]) + }, [visible, setSelectedIndex, visibleIndices.length, visibleIndices[0]]) useEffect(() => { if (!visible || !flatTagList.length) return diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tag-dropdown/tag-dropdown.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tag-dropdown/tag-dropdown.tsx index bc982daec4..173eea1228 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tag-dropdown/tag-dropdown.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tag-dropdown/tag-dropdown.tsx @@ -1586,7 +1586,6 @@ export const TagDropdown: React.FC = ({ loops, parallels, workflowVariables, - workflowId, ]) const filteredTags = useMemo(() => { @@ -1888,7 +1887,7 @@ export const TagDropdown: React.FC = ({ useEffect(() => { setSelectedIndex(0) - }, [flatTagList.length]) + }, []) useEffect(() => { if (visible) { diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/components/custom-tool-modal/custom-tool-modal.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/components/custom-tool-modal/custom-tool-modal.tsx index 85ca3447c6..7e4c3b78b0 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/components/custom-tool-modal/custom-tool-modal.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/components/custom-tool-modal/custom-tool-modal.tsx @@ -297,7 +297,7 @@ try { } else { resetForm() } - }, [open]) + }, [open, initialValues]) useEffect(() => { if (!showSchemaParams || schemaParamSelectedIndex < 0) return @@ -391,7 +391,10 @@ try { } }, [jsonSchema]) - const isSchemaValid = useMemo(() => validateSchema(jsonSchema).isValid, [jsonSchema]) + const isSchemaValid = useMemo( + () => validateSchema(jsonSchema).isValid, + [jsonSchema, validateSchema] + ) const hasChanges = useMemo(() => { if (!isEditing) return true diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/tool-input.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/tool-input.tsx index c52e247ff6..399bfd2cf8 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/tool-input.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/tool-input.tsx @@ -1001,7 +1001,7 @@ export const ToolInput = memo(function ToolInput({ const workspaceId = params.workspaceId as string const workflowId = params.workflowId as string const [storeValue, setStoreValue] = useSubBlockValue(blockId, subBlockId) - const [open, setOpen] = useState(false) + const [, setOpen] = useState(false) const [customToolModalOpen, setCustomToolModalOpen] = useState(false) const [editingToolIndex, setEditingToolIndex] = useState(null) const [draggedIndex, setDraggedIndex] = useState(null) @@ -1330,9 +1330,9 @@ export const ToolInput = memo(function ToolInput({ * @returns Empty parameter object to be populated by the user */ const initializeToolParams = ( - toolId: string, - params: ToolParameterConfig[], - instanceId?: string + _toolId: string, + _params: ToolParameterConfig[], + _instanceId?: string ): Record => { return {} } @@ -1558,8 +1558,6 @@ export const ToolInput = memo(function ToolInput({ const initialParams = initializeToolParams(newToolId, toolParams.userInputParameters, blockId) - const oldToolParams = tool.toolId ? getToolParametersConfig(tool.toolId, tool.type) : null - const oldParamIds = new Set(oldToolParams?.userInputParameters.map((p) => p.id) || []) const newParamIds = new Set(toolParams.userInputParameters.map((p) => p.id)) const preservedParams: Record = {} @@ -2683,7 +2681,7 @@ export const ToolInput = memo(function ToolInput({ parsed[param.id] ? 'true' : 'false' ) }) - } catch (e) { + } catch (_e) { // Handle error } }} diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-depends-on-gate.ts b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-depends-on-gate.ts index 9673f11c7d..27a86b1e23 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-depends-on-gate.ts +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-depends-on-gate.ts @@ -147,6 +147,7 @@ export function useDependsOnGate( blockId, canonicalIndex, canonicalModeOverrides, + normalizeDependencyValue, ] ) diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-input.ts b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-input.ts index 1f742c464d..f545093c8a 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-input.ts +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-input.ts @@ -208,7 +208,7 @@ export function useSubBlockInput(options: UseSubBlockInputOptions): UseSubBlockI setLocalContent(baseValueString) } } - }, [baseValue, isStreaming]) + }, [baseValue, isStreaming, localContent]) // Update store during streaming (deferred persistence is handled by onStreamingEnd) useEffect(() => { @@ -391,22 +391,6 @@ export function useSubBlockInput(options: UseSubBlockInputOptions): UseSubBlockI // Intentionally empty; consumers may mirror scroll to overlays if needed }, []) - // Helper to apply selected value coming from popovers - const applySelectedValue = useCallback( - (newValue: string, isTagSelection: boolean) => { - if (onChange) { - onChange(newValue) - } else if (!isPreview) { - if (isTagSelection) { - emitTagSelection(newValue) - } else { - setStoreValue(newValue) - } - } - }, - [onChange, isPreview, emitTagSelection, setStoreValue] - ) - // Field-level state tracking for array-based inputs const [fieldStates, setFieldStates] = useState>({}) @@ -532,7 +516,7 @@ export function useSubBlockInput(options: UseSubBlockInputOptions): UseSubBlockI // Create tag select handler for a field const createTagSelectHandler = useCallback( - (fieldId: string, fieldValue: string, onFieldChange: (newValue: string) => void) => { + (fieldId: string, _fieldValue: string, onFieldChange: (newValue: string) => void) => { return (newValue: string) => { if (!isPreview && !disabled) { onFieldChange(newValue) @@ -545,7 +529,7 @@ export function useSubBlockInput(options: UseSubBlockInputOptions): UseSubBlockI // Create env var select handler for a field const createEnvVarSelectHandler = useCallback( - (fieldId: string, fieldValue: string, onFieldChange: (newValue: string) => void) => { + (fieldId: string, _fieldValue: string, onFieldChange: (newValue: string) => void) => { return (newValue: string) => { if (!isPreview && !disabled) { onFieldChange(newValue) diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-value.ts b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-value.ts index 4ff1db0b82..3d97103165 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-value.ts +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/hooks/use-sub-block-value.ts @@ -88,25 +88,10 @@ export function useSubBlockValue( const hasSnapshotValue = snapshotSubBlock !== undefined const snapshotValue = hasSnapshotValue ? ((snapshotSubBlock as any)?.value ?? null) : null - // Check if this is an API key field that could be auto-filled - const isApiKey = - subBlockId === 'apiKey' || (subBlockId?.toLowerCase().includes('apikey') ?? false) - - // Always call this hook unconditionally - don't wrap it in a condition - // Optimized: only re-render if model value actually changes - const modelSubBlockValue = useStoreWithEqualityFn( - useSubBlockStore, - useCallback((state) => (blockId ? state.getValue(blockId, 'model') : null), [blockId]), - (a, b) => a === b - ) - // Determine if this is a provider-based block type const isProviderBasedBlock = blockType === 'agent' || blockType === 'router' || blockType === 'evaluator' - // Compute the modelValue based on block type - const modelValue = isProviderBasedBlock ? (modelSubBlockValue as string) : null - // Emit the value to socket/DB and update local store const emitValue = useCallback( (value: T) => { @@ -190,11 +175,8 @@ export function useSubBlockValue( [ blockId, subBlockId, - blockType, - isApiKey, storeValue, triggerWorkflowUpdate, - modelValue, isStreaming, emitValue, isBaselineView, @@ -213,7 +195,7 @@ export function useSubBlockValue( // Initialize valueRef on first render useEffect(() => { valueRef.current = effectiveValue - }, []) + }, [effectiveValue]) // Update the ref if the effective value changes // This ensures we're always working with the latest value diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/hooks/use-editor-subblock-layout.ts b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/hooks/use-editor-subblock-layout.ts index 23137d26e8..3023b1ad16 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/hooks/use-editor-subblock-layout.ts +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/hooks/use-editor-subblock-layout.ts @@ -149,5 +149,6 @@ export function useEditorSubblockLayout( activeWorkflowId, isSnapshotView, blockDataFromStore, + config, ]) } diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/hooks/use-subflow-editor.ts b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/hooks/use-subflow-editor.ts index c9343a90bf..7dc9528db4 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/hooks/use-subflow-editor.ts +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/hooks/use-subflow-editor.ts @@ -313,7 +313,7 @@ export function useSubflowEditor(currentBlock: BlockState | null, currentBlockId isSubflow && subflowConfig ? (nodeConfig as any)?.[subflowConfig.typeKey] || (blockData as any)?.[subflowConfig.typeKey] || - (currentBlock!.type === 'loop' ? 'for' : 'count') + (currentBlock?.type === 'loop' ? 'for' : 'count') : null const isCountMode = currentType === 'for' || currentType === 'count' diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/hooks/use-usage-limits.ts b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/hooks/use-usage-limits.ts index 4bf8846668..1300e782fc 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/hooks/use-usage-limits.ts +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/hooks/use-usage-limits.ts @@ -8,7 +8,7 @@ const isBillingEnabled = isTruthy(getEnv('NEXT_PUBLIC_BILLING_ENABLED')) * Provides usage exceeded status from existing subscription data. */ -export function useUsageLimits(options?: { +export function useUsageLimits(_options?: { context?: 'user' | 'organization' organizationId?: string autoRefresh?: boolean diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/panel.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/panel.tsx index cea18901e9..cc6e904f65 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/panel.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/panel.tsx @@ -75,7 +75,6 @@ export const Panel = memo(function Panel() { const workspaceId = params.workspaceId as string const panelRef = useRef(null) - const fileInputRef = useRef(null) const { activeTab, setActiveTab, panelWidth, _hasHydrated, setHasHydrated } = usePanelStore( useShallow((state) => ({ activeTab: state.activeTab, @@ -168,7 +167,7 @@ export const Panel = memo(function Panel() { return } await handleRunWorkflow() - }, [usageExceeded, handleRunWorkflow]) + }, [usageExceeded, handleRunWorkflow, openSubscriptionSettings]) // Chat state const { isChatOpen, setIsChatOpen } = useChatStore( diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/subflows/subflow-node.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/subflows/subflow-node.tsx index 11f131065b..bdc95fc539 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/subflows/subflow-node.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/subflows/subflow-node.tsx @@ -105,7 +105,7 @@ export const SubflowNodeComponent = memo(({ data, id, selected }: NodeProps cancelAnimationFrame(rafId) - }, [currentMatchIndex, allMatchPaths.length, expandedPaths, useVirtualization]) + }, [currentMatchIndex, allMatchPaths.length, useVirtualization]) const containerClass = cn('flex flex-col pl-[20px]', wrapText && 'overflow-x-hidden', className) const virtualizedContainerClass = cn('relative', wrapText && 'overflow-x-hidden', className) diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/terminal/terminal.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/terminal/terminal.tsx index abe60c6a40..04764b756f 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/terminal/terminal.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/terminal/terminal.tsx @@ -615,7 +615,7 @@ export const Terminal = memo(function Terminal() { */ useEffect(() => { hasInitializedEntriesRef.current = false - }, [activeWorkflowId]) + }, []) /** * Auto-open the terminal on new entries when "Open on run" is enabled. @@ -649,14 +649,7 @@ export const Terminal = memo(function Terminal() { } prevWorkflowEntriesLengthRef.current = currentLength - }, [ - allWorkflowEntries.length, - expandToLastHeight, - openOnRun, - isExpanded, - hasConsoleHydrated, - activeWorkflowId, - ]) + }, [allWorkflowEntries.length, expandToLastHeight, openOnRun, isExpanded, hasConsoleHydrated]) /** * Auto-expand subflows and iterations when new entries arrive. @@ -946,7 +939,7 @@ export const Terminal = memo(function Terminal() { if (selectedEntry) { scrollEntryIntoView(selectedEntry.id) } - }, [selectedEntry?.id, scrollEntryIntoView]) + }, [selectedEntry?.id, scrollEntryIntoView, selectedEntry]) /** * Sync selected entry with latest data from store. diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/training-modal/training-modal.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/training-modal/training-modal.tsx index cbdac251fe..b5a307f269 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/training-modal/training-modal.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/training-modal/training-modal.tsx @@ -183,7 +183,7 @@ export function TrainingModal() { }) }, 5000) }) - .catch((error) => { + .catch((_error) => { // Remove from sending and mark as failed setSendingDatasets((prev) => { const newSet = new Set(prev) @@ -207,9 +207,6 @@ export function TrainingModal() { try { const results = await Promise.allSettled(datasets.map((dataset) => sendToIndexer(dataset))) - const successes = results.filter((r) => r.status === 'fulfilled') - const failures = results.filter((r) => r.status === 'rejected') - // Mark successes and failures visually const successfulIds = datasets .filter((_, i) => results[i].status === 'fulfilled') @@ -508,7 +505,7 @@ export function TrainingModal() {
- {datasets.map((dataset, index) => ( + {datasets.map((dataset) => (
{ - const validatedName = validateName(newName) - setLocalNames((prev) => ({ - ...prev, - [variableId]: validatedName, - })) - clearVariableState(variableId, false) - }, []) + const handleVariableNameChange = useCallback( + (variableId: string, newName: string) => { + const validatedName = validateName(newName) + setLocalNames((prev) => ({ + ...prev, + [variableId]: validatedName, + })) + clearVariableState(variableId, false) + }, + [clearVariableState] + ) const handleVariableNameBlur = useCallback( (variableId: string) => { @@ -266,7 +269,7 @@ export function Variables() { collaborativeUpdateVariable(variableId, 'name', trimmedName) clearVariableState(variableId) }, - [localNames, isDuplicateName, collaborativeUpdateVariable] + [localNames, isDuplicateName, collaborativeUpdateVariable, clearVariableState] ) const handleVariableNameKeyDown = (e: React.KeyboardEvent) => { @@ -317,7 +320,7 @@ export function Variables() {
) }, - [collapsedById, toggleCollapsed, handleRemoveVariable] + [collapsedById, toggleCollapsed, handleRemoveVariable, handleHeaderKeyDown] ) /** diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/wand-prompt-bar/wand-prompt-bar.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/wand-prompt-bar/wand-prompt-bar.tsx index a15022ea52..6478cb32ea 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/wand-prompt-bar/wand-prompt-bar.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/wand-prompt-bar/wand-prompt-bar.tsx @@ -64,7 +64,7 @@ export function WandPromptBar({ return () => { document.removeEventListener('mousedown', handleClickOutside) } - }, [isVisible, isStreaming, isLoading, isExiting, onCancel]) + }, [isVisible, isStreaming, isLoading, isExiting, handleCancel]) // Reset the exit state when visibility changes useEffect(() => { diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/workflow-block.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/workflow-block.tsx index b3ef432442..daaf23bc8e 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/workflow-block.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/workflow-block.tsx @@ -425,13 +425,7 @@ const SubBlockRow = memo(function SubBlockRow({ } return accumulator }, {}) - }, [ - canonicalIndex, - canonicalModeOverrides, - displayAdvancedOptions, - rawValues, - subBlock?.dependsOn, - ]) + }, [canonicalIndex, canonicalModeOverrides, rawValues, subBlock?.dependsOn]) const credentialSourceId = subBlock?.type === 'oauth-input' && typeof rawValue === 'string' ? rawValue : undefined @@ -616,7 +610,7 @@ const SubBlockRow = memo(function SubBlockRow({ if (toolNames.length === 1) return toolNames[0] if (toolNames.length === 2) return `${toolNames[0]}, ${toolNames[1]}` return `${toolNames[0]}, ${toolNames[1]} +${toolNames.length - 2}` - }, [subBlock?.type, rawValue, customTools, workspaceId]) + }, [subBlock?.type, rawValue, customTools]) const isPasswordField = subBlock?.password === true const maskedValue = isPasswordField && value && value !== '-' ? '•••' : null @@ -678,8 +672,6 @@ export const WorkflowBlock = memo(function WorkflowBlock({ runPathStatus, } = useBlockVisual({ blockId: id, data, isPending, isSelected: selected }) - const currentBlock = currentWorkflow.getBlockById(id) - const { horizontalHandles, blockHeight, blockWidth, displayAdvancedMode, displayTriggerMode } = useBlockProperties( id, @@ -839,18 +831,15 @@ export const WorkflowBlock = memo(function WorkflowBlock({ config.subBlocks, config.category, config.triggers, - id, displayAdvancedMode, displayTriggerMode, data.isPreview, data.subBlockValues, - currentWorkflow.isDiffMode, - currentBlock, canonicalModeOverrides, userPermissions.canEdit, canonicalIndex, blockSubBlockValues, - activeWorkflowId, + blockWidth, ]) const subBlockRows = subBlockRowsData.rows @@ -1030,7 +1019,7 @@ export const WorkflowBlock = memo(function WorkflowBlock({ const updateNodeInternals = useUpdateNodeInternals() useEffect(() => { updateNodeInternals(id) - }, [horizontalHandles, id, updateNodeInternals]) + }, [id, updateNodeInternals]) const showWebhookIndicator = (isStarterBlock || isWebhookTriggerBlock) && isWebhookConfigured const shouldShowScheduleBadge = diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/float/use-float-resize.ts b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/float/use-float-resize.ts index 9ccc292363..ad97fc512d 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/float/use-float-resize.ts +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/float/use-float-resize.ts @@ -319,7 +319,7 @@ export function useFloatResize({ y: finalY, }) }, - [onDimensionsChange, onPositionChange] + [onDimensionsChange, onPositionChange, maxHeight, maxWidth, minHeight, minWidth] ) /** diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-block-dimensions.ts b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-block-dimensions.ts index aaa2025423..a4eda27013 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-block-dimensions.ts +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-block-dimensions.ts @@ -41,5 +41,5 @@ export function useBlockDimensions({ updateNodeInternals(blockId) } // eslint-disable-next-line react-hooks/exhaustive-deps - }, [blockId, updateBlockLayoutMetrics, updateNodeInternals, ...dependencies]) + }, [blockId, updateBlockLayoutMetrics, updateNodeInternals, ...dependencies, calculateDimensions]) } diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-block-output-fields.ts b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-block-output-fields.ts index af5f675299..87c33127d5 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-block-output-fields.ts +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-block-output-fields.ts @@ -290,5 +290,5 @@ export function useBlockOutputFields({ } return Object.entries(baseOutputs).map(([name, output]) => createFieldFromOutput(name, output)) - }, [blockId, blockType, mergedSubBlocks, responseFormat, operation, triggerMode]) + }, [blockId, blockType, mergedSubBlocks, responseFormat, triggerMode]) } diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-wand.ts b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-wand.ts index fa35aa42b8..0b6ac7aa89 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-wand.ts +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-wand.ts @@ -235,6 +235,7 @@ export function useWand({ onStreamStart, onGenerationComplete, queryClient, + conversationHistory, ] ) diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-workflow-execution.ts b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-workflow-execution.ts index 6dcad6c175..84193d373c 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-workflow-execution.ts +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/hooks/use-workflow-execution.ts @@ -174,7 +174,7 @@ export function useWorkflowExecution() { // Reset debug state resetDebugState() }, - [activeWorkflowId, resetDebugState] + [resetDebugState] ) /** @@ -220,7 +220,7 @@ export function useWorkflowExecution() { // Reset debug state resetDebugState() }, - [debugContext, activeWorkflowId, resetDebugState] + [debugContext, resetDebugState] ) const persistLogs = async ( @@ -529,10 +529,6 @@ export function useWorkflowExecution() { // Update block logs with actual stream completion times if (result.logs && streamCompletionTimes.size > 0) { - const streamCompletionEndTime = new Date( - Math.max(...Array.from(streamCompletionTimes.values())) - ).toISOString() - result.logs.forEach((log: BlockLog) => { if (streamCompletionTimes.has(log.blockId)) { const completionTime = streamCompletionTimes.get(log.blockId)! @@ -656,14 +652,9 @@ export function useWorkflowExecution() { }, [ activeWorkflowId, - currentWorkflow, - toggleConsole, - getAllVariables, - getVariablesByWorkflowId, setIsExecuting, setIsDebugging, setDebugContext, - setExecutor, setPendingBlocks, setActiveBlocks, workflows, @@ -674,7 +665,7 @@ export function useWorkflowExecution() { const executeWorkflow = async ( workflowInput?: any, onStream?: (se: StreamingExecution) => Promise, - executionId?: string, + _executionId?: string, onBlockComplete?: (blockId: string, output: any) => Promise, overrideTriggerType?: 'chat' | 'manual' | 'api', stopAfterBlockId?: string @@ -1267,16 +1258,6 @@ export function useWorkflowExecution() { setIsDebugging(false) setActiveBlocks(new Set()) - let notificationMessage = WORKFLOW_EXECUTION_FAILURE_MESSAGE - if (isRecord(error) && isRecord(error.request) && sanitizeMessage(error.request.url)) { - notificationMessage += `: Request to ${(error.request.url as string).trim()} failed` - if ('status' in error && typeof error.status === 'number') { - notificationMessage += ` (Status: ${error.status})` - } - } else if (sanitizeMessage(errorResult.error)) { - notificationMessage += `: ${errorResult.error}` - } - return errorResult } @@ -1314,7 +1295,6 @@ export function useWorkflowExecution() { executor, debugContext, pendingBlocks, - activeWorkflowId, validateDebugState, resetDebugState, isDebugSessionComplete, @@ -1346,7 +1326,7 @@ export function useWorkflowExecution() { let currentResult: ExecutionResult = { success: true, output: {}, - logs: debugContext!.blockLogs, + logs: debugContext?.blockLogs, } // Create copies to avoid mutation issues @@ -1415,7 +1395,6 @@ export function useWorkflowExecution() { executor, debugContext, pendingBlocks, - activeWorkflowId, validateDebugState, resetDebugState, handleDebugSessionComplete, @@ -1788,7 +1767,14 @@ export function useWorkflowExecution() { setActiveBlocks(new Set()) } }, - [activeWorkflowId, setExecutionResult, setIsExecuting, setIsDebugging, setActiveBlocks] + [ + activeWorkflowId, + setIsExecuting, + setIsDebugging, + setActiveBlocks, + executeWorkflow, + handleExecutionError, + ] ) return { diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/utils/workflow-execution-utils.ts b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/utils/workflow-execution-utils.ts index c69670f8dc..823b93d32b 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/utils/workflow-execution-utils.ts +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/utils/workflow-execution-utils.ts @@ -168,7 +168,7 @@ export async function executeWorkflowWithFullLogging( case 'execution:error': throw new Error(event.data.error || 'Execution failed') } - } catch (parseError) { + } catch (_parseError) { // Skip malformed SSE events } } diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx index 2e305431ab..4be0e9473b 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx @@ -733,7 +733,7 @@ const WorkflowContent = React.memo(() => { ) usePanelEditorStore.getState().setCurrentBlockId(id) }, - [collaborativeBatchAddBlocks, setSelectedEdges, setPendingSelection] + [collaborativeBatchAddBlocks, setPendingSelection] ) const { activeBlockIds, pendingBlocks, isDebugging, isExecuting, getLastExecutionSnapshot } = @@ -1236,6 +1236,7 @@ const WorkflowContent = React.memo(() => { clipboard, getViewportCenter, executePasteOperation, + blocks, ]) /** @@ -2084,31 +2085,6 @@ const WorkflowContent = React.memo(() => { return blockConfigCache.current.get(type) }, []) - const prevBlocksHashRef = useRef('') - const prevBlocksRef = useRef(blocks) - - /** Stable hash of block STRUCTURAL properties - excludes position to prevent node recreation during drag. */ - const blocksStructureHash = useMemo(() => { - // Only recalculate hash if blocks reference actually changed - if (prevBlocksRef.current === blocks) { - return prevBlocksHashRef.current - } - - prevBlocksRef.current = blocks - // Hash only structural properties - NOT position (position changes shouldn't recreate nodes) - const hash = Object.values(blocks) - .map((b) => { - const width = typeof b.data?.width === 'number' ? b.data.width : '' - const height = typeof b.data?.height === 'number' ? b.data.height : '' - // Exclude position from hash - drag should not recreate nodes - return `${b.id}:${b.type}:${b.name}:${b.height}:${b.data?.parentId || ''}:${width}:${height}` - }) - .join('|') - - prevBlocksHashRef.current = hash - return hash - }, [blocks]) - /** Transforms blocks into ReactFlow nodes - only recreates on structural changes. */ const derivedNodes = useMemo(() => { const nodeArray: Node[] = [] @@ -2200,7 +2176,7 @@ const WorkflowContent = React.memo(() => { }) return nodeArray - }, [blocksStructureHash, blocks, activeBlockIds, pendingBlocks, isDebugging, getBlockConfig]) + }, [blocks, activeBlockIds, pendingBlocks, isDebugging, getBlockConfig]) // Local state for nodes - allows smooth drag without store updates on every frame const [displayNodes, setDisplayNodes] = useState([]) @@ -2835,7 +2811,7 @@ const WorkflowContent = React.memo(() => { } }) }, - [blocks, setDragStartPosition, getNodes, potentialParentId, setPotentialParentId] + [blocks, setDragStartPosition, getNodes] ) /** Handles node drag stop to establish parent-child relationships. */ @@ -3199,7 +3175,6 @@ const WorkflowContent = React.memo(() => { potentialParentId, getNodeAbsolutePosition, getNodeDepth, - clearDragHighlights, highlightContainerNode, ] ) @@ -3228,8 +3203,8 @@ const WorkflowContent = React.memo(() => { getNodes, collaborativeBatchUpdatePositions, potentialParentId, - clearDragHighlights, - executeBatchParentUpdate, + executeBatchParentUpdate, // Clear drag state + setDragStartPosition, ] ) diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/preview/components/preview-workflow/preview-workflow.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/preview/components/preview-workflow/preview-workflow.tsx index 0e6948ac4b..caebfe2b14 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/preview/components/preview-workflow/preview-workflow.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/preview/components/preview-workflow/preview-workflow.tsx @@ -240,22 +240,6 @@ export function PreviewWorkflow({ } }, [workflowState.blocks, isValidWorkflowState]) - const loopsStructure = useMemo(() => { - if (!isValidWorkflowState) return { count: 0, ids: '' } - return { - count: Object.keys(workflowState.loops || {}).length, - ids: Object.keys(workflowState.loops || {}).join(','), - } - }, [workflowState.loops, isValidWorkflowState]) - - const parallelsStructure = useMemo(() => { - if (!isValidWorkflowState) return { count: 0, ids: '' } - return { - count: Object.keys(workflowState.parallels || {}).length, - ids: Object.keys(workflowState.parallels || {}).join(','), - } - }, [workflowState.parallels, isValidWorkflowState]) - /** Map of subflow ID to child block IDs */ const subflowChildrenMap = useMemo(() => { if (!isValidWorkflowState) return new Map() @@ -325,14 +309,6 @@ export function PreviewWorkflow({ } }, [workflowState.blocks, getSubflowExecutionStatus, blockExecutionMap]) - const edgesStructure = useMemo(() => { - if (!isValidWorkflowState) return { count: 0, ids: '' } - return { - count: workflowState.edges?.length || 0, - ids: workflowState.edges?.map((e) => e.id).join(',') || '', - } - }, [workflowState.edges, isValidWorkflowState]) - const nodes: Node[] = useMemo(() => { if (!isValidWorkflowState) return [] @@ -412,9 +388,6 @@ export function PreviewWorkflow({ return nodeArray }, [ - blocksStructure, - loopsStructure, - parallelsStructure, workflowState.blocks, isValidWorkflowState, executedBlocks, @@ -467,13 +440,7 @@ export function PreviewWorkflow({ zIndex: status === 'success' ? 10 : isErrorEdge ? 5 : 0, } }) - }, [ - edgesStructure, - workflowState.edges, - isValidWorkflowState, - blockExecutionMap, - getBlockExecutionStatus, - ]) + }, [workflowState.edges, isValidWorkflowState, blockExecutionMap, getBlockExecutionStatus]) if (!isValidWorkflowState) { return ( diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/preview/preview.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/preview/preview.tsx index 816e31526b..9337832472 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/preview/preview.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/preview/preview.tsx @@ -229,7 +229,7 @@ export function Preview({ useEffect(() => { setWorkflowStack([]) - }, [rootWorkflowState]) + }, []) const isNested = workflowStack.length > 0 diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/access-control/access-control.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/access-control/access-control.tsx index af7db3fcc9..87e3384895 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/access-control/access-control.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/access-control/access-control.tsx @@ -247,7 +247,6 @@ export function AccessControl() { const isOwner = userRole === 'owner' const isAdmin = userRole === 'admin' const isOrgAdminOrOwner = isOwner || isAdmin - const canManage = hasEnterprisePlan && isOrgAdminOrOwner && !!activeOrganization?.id const queryEnabled = !!activeOrganization?.id const { data: permissionGroups = [], isPending: groupsLoading } = usePermissionGroups( @@ -555,10 +554,9 @@ export function AccessControl() { }, [viewingGroup, editingConfig, activeOrganization?.id, updatePermissionGroup]) const handleOpenAddMembersModal = useCallback(() => { - const existingMemberUserIds = new Set(members.map((m) => m.userId)) setSelectedMemberIds(new Set()) setShowAddMembersModal(true) - }, [members]) + }, []) const handleAddSelectedMembers = useCallback(async () => { if (!viewingGroup || selectedMemberIds.size === 0) return diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/api-keys/api-keys.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/api-keys/api-keys.tsx index 8e3862eccc..34f98fa50b 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/api-keys/api-keys.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/api-keys/api-keys.tsx @@ -122,7 +122,7 @@ export function ApiKeys({ onOpenChange, registerCloseHandler }: ApiKeysProps) { if (registerCloseHandler) { registerCloseHandler(handleModalClose) } - }, [registerCloseHandler]) + }, [registerCloseHandler, handleModalClose]) useEffect(() => { if (shouldScrollToBottom && scrollContainerRef.current) { diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/environment/environment.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/environment/environment.tsx index 026d646cad..01a664df48 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/environment/environment.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/environment/environment.tsx @@ -172,10 +172,10 @@ export function EnvironmentVariables({ registerBeforeLeaveHandler }: Environment const [showUnsavedChanges, setShowUnsavedChanges] = useState(false) const [shouldScrollToBottom, setShouldScrollToBottom] = useState(false) const [workspaceVars, setWorkspaceVars] = useState>({}) - const [conflicts, setConflicts] = useState([]) + const [, setConflicts] = useState([]) const [renamingKey, setRenamingKey] = useState(null) const [pendingKeyValue, setPendingKeyValue] = useState('') - const [changeToken, setChangeToken] = useState(0) + const [, setChangeToken] = useState(0) const initialWorkspaceVarsRef = useRef>({}) const scrollContainerRef = useRef(null) @@ -225,7 +225,7 @@ export function EnvironmentVariables({ registerBeforeLeaveHandler }: Environment } return false - }, [envVars, workspaceVars, changeToken]) + }, [envVars, workspaceVars]) const hasConflicts = useMemo(() => { return envVars.some((envVar) => !!envVar.key && Object.hasOwn(workspaceVars, envVar.key)) diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/files/files.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/files/files.tsx index 824dbf0263..92422d6ee0 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/files/files.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/files/files.tsx @@ -21,14 +21,13 @@ import { cn } from '@/lib/core/utils/cn' import type { WorkspaceFileRecord } from '@/lib/uploads/contexts/workspace' import { getFileExtension } from '@/lib/uploads/utils/file-utils' import { getDocumentIcon } from '@/app/workspace/[workspaceId]/knowledge/components' +import { useWorkspacePermissionsContext } from '@/app/workspace/[workspaceId]/providers/workspace-permissions-provider' import { useDeleteWorkspaceFile, useStorageInfo, useUploadWorkspaceFile, useWorkspaceFiles, } from '@/hooks/queries/workspace-files' -import { useUserPermissions } from '@/hooks/use-user-permissions' -import { useWorkspacePermissions } from '@/hooks/use-workspace-permissions' const logger = createLogger('FileUploadsSettings') const isBillingEnabled = isTruthy(getEnv('NEXT_PUBLIC_BILLING_ENABLED')) @@ -94,9 +93,7 @@ export function Files() { const fileInputRef = useRef(null) const scrollContainerRef = useRef(null) - const { permissions: workspacePermissions, loading: permissionsLoading } = - useWorkspacePermissions(workspaceId) - const userPermissions = useUserPermissions(workspacePermissions, permissionsLoading) + const { userPermissions, permissionsLoading } = useWorkspacePermissionsContext() const handleUploadClick = () => { fileInputRef.current?.click() diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/integrations/integrations.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/integrations/integrations.tsx index dabdfc03f8..da8edce87c 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/integrations/integrations.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/integrations/integrations.tsx @@ -104,8 +104,8 @@ export function Integrations({ onOpenChange, registerCloseHandler }: Integration const { config: permissionConfig } = usePermissionConfig() const [searchTerm, setSearchTerm] = useState('') - const [pendingService, setPendingService] = useState(null) const [authSuccess, setAuthSuccess] = useState(false) + const [pendingService, setPendingService] = useState(null) const [showActionRequired, setShowActionRequired] = useState(false) const prevConnectedIdsRef = useRef>(new Set()) const connectionAddedRef = useRef(false) diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/mcp/mcp.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/mcp/mcp.tsx index d4103702bc..c673ee1cb9 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/mcp/mcp.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/mcp/mcp.tsx @@ -941,7 +941,7 @@ export function MCP({ initialServerId }: MCPProps) { Parameters

- {Object.entries(tool.inputSchema!.properties!).map( + {Object.entries(tool.inputSchema?.properties!).map( ([paramName, param]) => { const isRequired = requiredParams.includes(paramName) const paramType = diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/team-management/components/team-members/team-members.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/team-management/components/team-members/team-members.tsx index 4e62f6e462..f098399ebc 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/team-management/components/team-members/team-members.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/team-management/components/team-members/team-members.tsx @@ -51,7 +51,7 @@ export function TeamMembers({ }: TeamMembersProps) { const [cancellingInvitations, setCancellingInvitations] = useState>(new Set()) const [resendingInvitations, setResendingInvitations] = useState>(new Set()) - const [resentInvitations, setResentInvitations] = useState>(new Set()) + const [, setResentInvitations] = useState>(new Set()) const [resendCooldowns, setResendCooldowns] = useState>({}) const { data: memberUsageResponse, isLoading: isLoadingUsage } = useOrganizationMembers( diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/team-management/team-management.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/team-management/team-management.tsx index b78de6ed98..3c9a34d38e 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/team-management/team-management.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/team-management/team-management.tsx @@ -126,7 +126,7 @@ export function TeamManagement() { } catch (error) { logger.error('Failed to create organization', error) } - }, [orgName, orgSlug, createOrgMutation]) + }, [orgName, orgSlug, createOrgMutation, session?.user]) const handleInviteMember = useCallback(async () => { if (!session?.user || !activeOrganization?.id || !inviteEmail.trim()) return @@ -157,7 +157,14 @@ export function TeamManagement() { } catch (error) { logger.error('Failed to invite member', error) } - }, [session?.user?.id, activeOrganization?.id, inviteEmail, selectedWorkspaces, inviteMutation]) + }, [ + session?.user?.id, + activeOrganization?.id, + inviteEmail, + selectedWorkspaces, + inviteMutation, + session?.user, + ]) const handleWorkspaceToggle = useCallback((workspaceId: string, permission: string) => { setSelectedWorkspaces((prev) => { @@ -221,7 +228,14 @@ export function TeamManagement() { logger.error('Failed to remove member', error) } }, - [removeMemberDialog.memberId, session?.user?.id, activeOrganization?.id, removeMemberMutation] + [ + removeMemberDialog.memberId, + session?.user?.id, + activeOrganization?.id, + removeMemberMutation, + removeMemberDialog, + session?.user, + ] ) const handleReduceSeats = useCallback(async () => { @@ -242,7 +256,14 @@ export function TeamManagement() { } catch (error) { logger.error('Failed to reduce seats', error) } - }, [session?.user?.id, activeOrganization?.id, subscriptionData, usedSeats, updateSeatsMutation]) + }, [ + session?.user?.id, + activeOrganization?.id, + subscriptionData, + usedSeats, + updateSeatsMutation, + session?.user, + ]) const handleAddSeatDialog = useCallback(() => { if (subscriptionData && !checkEnterprisePlan(subscriptionData)) { @@ -279,7 +300,7 @@ export function TeamManagement() { logger.info('Team upgrade requested', { seats, organizationId: activeOrganization?.id }) alert(`Team upgrade to ${seats} seats - integration needed`) }, - [session?.user?.id, activeOrganization?.id] + [session?.user?.id, activeOrganization?.id, session?.user] ) const queryError = orgError || subscriptionError diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/template-profile/template-profile.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/template-profile/template-profile.tsx index 97d5651aae..913bd86106 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/template-profile/template-profile.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/template-profile/template-profile.tsx @@ -126,7 +126,7 @@ export function TemplateProfile() { // Reset image load error when the URL changes useEffect(() => { setImageLoadError(false) - }, [profilePictureUrl]) + }, []) // Initialize referenceId and initial form data when session loads (for new profiles) useEffect(() => { diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/usage-limit/usage-limit.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/usage-limit/usage-limit.tsx index b5720f2760..58e58ad4eb 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/usage-limit/usage-limit.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/usage-limit/usage-limit.tsx @@ -39,7 +39,7 @@ export const UsageLimit = forwardRef( ) => { const [inputValue, setInputValue] = useState(currentLimit.toString()) const [hasError, setHasError] = useState(false) - const [errorType, setErrorType] = useState<'general' | 'belowUsage' | null>(null) + const [, setErrorType] = useState<'general' | 'belowUsage' | null>(null) const [isEditing, setIsEditing] = useState(false) const [pendingLimit, setPendingLimit] = useState(null) const inputRef = useRef(null) @@ -64,7 +64,7 @@ export const UsageLimit = forwardRef( () => ({ startEdit: handleStartEdit, }), - [canEdit, currentLimit, pendingLimit] + [handleStartEdit] ) useEffect(() => { diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/settings-modal.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/settings-modal.tsx index d2a72a9983..a1879a8344 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/settings-modal.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/settings-modal.tsx @@ -227,7 +227,6 @@ export function SettingsModal({ open, onOpenChange }: SettingsModalProps) { const subscriptionStatus = getSubscriptionStatus(subscriptionData?.data) const hasTeamPlan = subscriptionStatus.isTeam || subscriptionStatus.isEnterprise const hasEnterprisePlan = subscriptionStatus.isEnterprise - const hasOrganization = !!activeOrganization?.id // Fetch superuser status useEffect(() => { @@ -315,14 +314,11 @@ export function SettingsModal({ open, onOpenChange }: SettingsModalProps) { return true }) }, [ - hasOrganization, hasTeamPlan, hasEnterprisePlan, isOrgAdminOrOwner, isSSOProviderOwner, ssoProvidersData?.providers?.length, - isOwner, - isAdmin, permissionConfig, isSuperUser, generalSettings?.superUserModeEnabled, diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/usage-indicator/usage-indicator.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/usage-indicator/usage-indicator.tsx index 71ef8060c2..07b16d2ebd 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/usage-indicator/usage-indicator.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/usage-indicator/usage-indicator.tsx @@ -256,19 +256,16 @@ export function UsageIndicator({ onClick }: UsageIndicatorProps) { canManageBilling: userCanManageBilling, } - const badgeConfig = useMemo( - () => getBadgeConfig(displayState), - [isBlocked, isDispute, planType, isCritical, userCanManageBilling] - ) + const badgeConfig = useMemo(() => getBadgeConfig(displayState), [displayState]) const statusText = useMemo( () => getStatusTextConfig(isBlocked, isDispute, usage), - [isBlocked, isDispute, usage.current, usage.limit] + [isBlocked, isDispute, usage.current, usage.limit, usage] ) const showPlanText = useMemo( () => shouldShowPlanText(planType, usage, sidebarWidth, badgeConfig.show, isBlocked), - [planType, usage.current, usage.limit, sidebarWidth, badgeConfig.show, isBlocked] + [planType, usage.current, usage.limit, sidebarWidth, badgeConfig.show, isBlocked, usage] ) const pillCount = useMemo(() => { diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/folder-item/folder-item.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/folder-item/folder-item.tsx index 7cca373647..e6fdf16697 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/folder-item/folder-item.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/folder-item/folder-item.tsx @@ -426,13 +426,13 @@ export function FolderItem({ const isMixedSelection = useMemo(() => { return capturedSelectionRef.current?.isMixed ?? false - }, [isContextMenuOpen]) + }, []) const hasExportableContent = useMemo(() => { if (!capturedSelectionRef.current) return hasWorkflows const { workflowIds } = capturedSelectionRef.current return workflowIds.length > 0 || hasWorkflows - }, [isContextMenuOpen, hasWorkflows]) + }, [hasWorkflows]) return ( <> diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/workflow-item/workflow-item.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/workflow-item/workflow-item.tsx index 3c099da60d..df5b38b9ef 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/workflow-item/workflow-item.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/workflow-item/workflow-item.tsx @@ -182,7 +182,7 @@ export function WorkflowItem({ const isMixedSelection = useMemo(() => { return capturedSelectionRef.current?.isMixed ?? false - }, [isContextMenuOpen]) + }, []) const captureSelectionState = useCallback(() => { const store = useFolderStore.getState() diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workspace-header/components/invite-modal/components/permissions-table.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workspace-header/components/invite-modal/components/permissions-table.tsx index b27970559e..92f0b9cafb 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workspace-header/components/invite-modal/components/permissions-table.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workspace-header/components/invite-modal/components/permissions-table.tsx @@ -4,7 +4,7 @@ import { Badge, Button, Tooltip } from '@/components/emcn' import { useSession } from '@/lib/auth/auth-client' import type { PermissionType } from '@/lib/workspaces/permissions/utils' import { useUserPermissionsContext } from '@/app/workspace/[workspaceId]/providers/workspace-permissions-provider' -import type { WorkspacePermissions } from '@/hooks/use-workspace-permissions' +import type { WorkspacePermissions } from '@/hooks/queries/workspace' import { PermissionSelector } from './permission-selector' import { PermissionsTableSkeleton } from './permissions-table-skeleton' import type { UserPermissions } from './types' @@ -14,7 +14,7 @@ export interface PermissionsTableProps { onPermissionChange: (userId: string, permissionType: PermissionType) => void onRemoveMember?: (userId: string, email: string) => void onRemoveInvitation?: (invitationId: string, email: string) => void - onResendInvitation?: (invitationId: string, email: string) => void + onResendInvitation?: (invitationId: string) => void disabled?: boolean existingUserPermissionChanges: Record> isSaving?: boolean @@ -143,7 +143,6 @@ export const PermissionsTable = ({
{allUsers.map((user) => { const isCurrentUser = user.isCurrentUser === true - const isExistingUser = filteredExistingUsers.some((eu) => eu.email === user.email) const isPendingInvitation = user.isPendingInvitation === true const userIdentifier = user.userId || user.email const originalPermission = workspacePermissions?.users?.find( @@ -205,7 +204,7 @@ export const PermissionsTable = ({ - -
- )} +
+ + +