diff --git a/apps/http-backend/src/index.ts b/apps/http-backend/src/index.ts index f6a39d4..e518948 100644 --- a/apps/http-backend/src/index.ts +++ b/apps/http-backend/src/index.ts @@ -16,7 +16,7 @@ import { NodeRegistry } from "@repo/nodes/nodeClient"; import express from "express"; import { userRouter } from "./routes/userRoutes/userRoutes.js"; import cors from "cors" -import { sheetRouter } from "./routes/nodes.routes.js"; +import { sheetRouter } from "./routes/sheet.routes.js"; import { googleAuth } from "./routes/google_callback.js"; import { tokenScheduler } from "./scheduler/token-scheduler.js"; diff --git a/apps/http-backend/src/routes/nodes.routes.ts b/apps/http-backend/src/routes/sheet.routes.ts similarity index 100% rename from apps/http-backend/src/routes/nodes.routes.ts rename to apps/http-backend/src/routes/sheet.routes.ts diff --git a/apps/web/app/lib/api.ts b/apps/web/app/lib/api.ts index cfe242c..2123d74 100644 --- a/apps/web/app/lib/api.ts +++ b/apps/web/app/lib/api.ts @@ -111,7 +111,11 @@ export const api = { withCredentials: true, headers: {"Content-Type":"application/json"} }) - return data.data.files.data + const tabs = data.data.files.data + return tabs.map((tab: any) =>({ + id: tab.id, + name: tab.name + })) }, } }; diff --git a/apps/web/app/lib/nodeConfigs/googleSheet.action.ts b/apps/web/app/lib/nodeConfigs/googleSheet.action.ts index 01b4f84..85aa974 100644 --- a/apps/web/app/lib/nodeConfigs/googleSheet.action.ts +++ b/apps/web/app/lib/nodeConfigs/googleSheet.action.ts @@ -34,7 +34,7 @@ export const googleSheetActionConfig: NodeConfig = { fetchOptions: "google.getSheets", }, { - name: "action", + name: "operation", label: "Action", type: "dropdown", options: [ @@ -47,9 +47,9 @@ export const googleSheetActionConfig: NodeConfig = { description: "What operation to perform on the sheet" }, { - name: "Range", + name: "range", type: "text", - label: "range", + label: "Range", value: "A1:Z100", required: true } diff --git a/apps/web/app/workflows/[id]/components/ConfigModal.tsx b/apps/web/app/workflows/[id]/components/ConfigModal.tsx index dc9766f..f396273 100644 --- a/apps/web/app/workflows/[id]/components/ConfigModal.tsx +++ b/apps/web/app/workflows/[id]/components/ConfigModal.tsx @@ -171,7 +171,7 @@ export default function ConfigModal({ > {options.map((opt: any) => ( - ))} diff --git a/apps/worker/src/engine/executor.ts b/apps/worker/src/engine/executor.ts index 631046f..bf4d8a7 100644 --- a/apps/worker/src/engine/executor.ts +++ b/apps/worker/src/engine/executor.ts @@ -14,7 +14,7 @@ export async function executeWorkflow( AvailableNode: true, credentials: true, }, - orderBy: { position: "asc" }, + orderBy: { stage: "asc" }, }, }, }, @@ -40,16 +40,29 @@ export async function executeWorkflow( console.log(`Total nodes - ${nodes.length}`); for (const node of nodes) { - console.log(`${node.name}, ${node.position}th - started Execution`); + console.log(`${node.name}, ${node.stage}, ${node.id}th - started Execution`); const nodeType = node.AvailableNode.type; + // Create mutable copy of config + const nodeConfig = { ...(node.config as Record) }; + + // Properly concatenate body with input data + if (nodeConfig.body && currentInputData) { + const inputStr = typeof currentInputData === 'object' + ? JSON.stringify(currentInputData) + : String(currentInputData); + nodeConfig.body = nodeConfig.body + inputStr; + } const context = { // nodeId: node.id, userId: data.workflow.userId, - credId: node.credentials[0]?.id, - config: node.config as Record, + credId: node.CredentialsID, + // config: node.config as Record, + config: nodeConfig, inputData: currentInputData, }; - console.log(`Executing with context: ${context}`); + console.log(`Executing with context: ${JSON.stringify(context)}`); + console.log(`Executing with context: ${context.credId}`); + const execute = await register.execute(nodeType, context); if (!execute.success) { await prismaClient.workflowExecution.update({ diff --git a/packages/nodes/src/registry/node-registry.ts b/packages/nodes/src/registry/node-registry.ts index 658017d..0524bab 100644 --- a/packages/nodes/src/registry/node-registry.ts +++ b/packages/nodes/src/registry/node-registry.ts @@ -72,7 +72,7 @@ class NodeRegistry { await GoogleSheetNode.register(); await GmailNode.register(); await NodeRegistry.registerTrigger({ - name: 'Webhook Trigger', + name: 'webhook', type: 'webhook', description: 'Triggers when an HTTP webhook is received.', config: {},