Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/http-backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
6 changes: 5 additions & 1 deletion apps/web/app/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}))
Comment on lines +114 to +118
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add defensive checks for nested property access.

The deeply nested access data.data.files.data is fragile and will throw if any intermediate property is undefined. Consider adding optional chaining or validation.

🛡️ Proposed fix with defensive access
-      const tabs = data.data.files.data
-      return tabs.map((tab: any) =>({
+      const tabs = data.data?.files?.data ?? [];
+      return tabs.map((tab: { id: unknown; name: unknown }) => ({
         id: tab.id,
         name: tab.name
       }))
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const tabs = data.data.files.data
return tabs.map((tab: any) =>({
id: tab.id,
name: tab.name
}))
const tabs = data.data?.files?.data ?? [];
return tabs.map((tab: { id: unknown; name: unknown }) => ({
id: tab.id,
name: tab.name
}))
🤖 Prompt for AI Agents
In `@apps/web/app/lib/api.ts` around lines 114 - 118, The code assumes
data.data.files.data exists and will throw if any part is undefined; change the
extraction of tabs to use defensive access (e.g., optional chaining and a
fallback) so tabs is set to an empty array when the nested path is missing, then
map over that safe array; update the area around the tabs = data.data.files.data
assignment and the subsequent map (referencing variables/data) to perform
validation or use optional chaining (e.g., data?.data?.files?.data ?? []) before
mapping.

},
}
};
6 changes: 3 additions & 3 deletions apps/web/app/lib/nodeConfigs/googleSheet.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const googleSheetActionConfig: NodeConfig = {
fetchOptions: "google.getSheets",
},
{
name: "action",
name: "operation",
label: "Action",
type: "dropdown",
options: [
Expand All @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/workflows/[id]/components/ConfigModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export default function ConfigModal({
>
<option value="">Select {field.label.toLowerCase()}</option>
{options.map((opt: any) => (
<option key={opt.value || opt.id || opt} value={opt.value || opt.id || opt}>
<option key={opt.value || opt.id || opt} value={opt.value || opt.id !== undefined ? opt.id : opt }>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Critical: Operator precedence bug causes incorrect value selection.

The expression opt.value || opt.id !== undefined ? opt.id : opt is parsed as (opt.value || opt.id !== undefined) ? opt.id : opt due to operator precedence. This means:

  • When opt.value is truthy, the condition is truthy, so it returns opt.id instead of opt.value
  • The intended behavior was likely opt.value || (opt.id !== undefined ? opt.id : opt)
🐛 Proposed fix with correct parentheses
-              <option key={opt.value || opt.id || opt} value={opt.value || opt.id !== undefined ? opt.id : opt }>
+              <option key={opt.value || opt.id || opt} value={opt.value || (opt.id !== undefined ? opt.id : opt)}>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<option key={opt.value || opt.id || opt} value={opt.value || opt.id !== undefined ? opt.id : opt }>
<option key={opt.value || opt.id || opt} value={opt.value || (opt.id !== undefined ? opt.id : opt)}>
🤖 Prompt for AI Agents
In `@apps/web/app/workflows/`[id]/components/ConfigModal.tsx at line 174, The
option's value expression has an operator-precedence bug: in the JSX option
within ConfigModal (the line using opt.value || opt.id !== undefined ? opt.id :
opt), the ternary is evaluated incorrectly; change the expression to use
parentheses so it evaluates as opt.value || (opt.id !== undefined ? opt.id :
opt) (or use nullish coalescing like opt.value ?? (opt.id ?? opt)) and apply the
same fix to the key expression that currently mirrors this logic (references:
ConfigModal.tsx, the JSX <option> using variable opt).

{opt.label || opt.name || opt}
</option>
))}
Expand Down
23 changes: 18 additions & 5 deletions apps/worker/src/engine/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export async function executeWorkflow(
AvailableNode: true,
credentials: true,
},
orderBy: { position: "asc" },
orderBy: { stage: "asc" },
},
},
},
Expand All @@ -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<string, any>) };

// 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<string, any>,
credId: node.CredentialsID,
// config: node.config as Record<string, any>,
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({
Expand Down
2 changes: 1 addition & 1 deletion packages/nodes/src/registry/node-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {},
Expand Down