Skip to content
Closed
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
9 changes: 7 additions & 2 deletions apps/http-backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ app.use("/user" , userRouter)
app.use('/node', sheetRouter)
app.use('/google', googleAuth)
const PORT= 3002
async function startServer() {
/**
* Initialize runtime and start the HTTP server.
*
* Registers all nodes, starts the token scheduler, and begins listening on the configured port.
*/
async function startServer() {
await NodeRegistry.registerAll()
tokenScheduler.start();
app.listen(PORT, () => {
Expand All @@ -48,4 +53,4 @@ async function startServer() {
}


startServer()
startServer()
13 changes: 12 additions & 1 deletion apps/web/app/components/nodes/CreateWorkFlow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ export const CreateWorkFlow = () => {
dispatch(workflowActions.setWorkflowStatus(newWorkflow.isEmpty))
}
}
/**
* Fetches workflow data for the current `workflowId` and updates Redux workflow state when successful.
*
* If `workflowId` is not set, the function returns without performing any action. On successful fetch,
* it dispatches actions to mark the workflow as non-empty, populate workflow nodes, and set the workflow trigger.
*/
async function getWorkflowData(){
if(!workflowId) return
const workflow = await getworkflowData(workflowId)
Expand All @@ -158,6 +164,11 @@ export const CreateWorkFlow = () => {
return; // Keep the current placeholder state
}

/**
* Build node and edge lists from Redux workflow data and replace the local React Flow state.
*
* Constructs a sequence of nodes from `existingTrigger` and `existingNodes`, positions them horizontally with a constant gap, appends a trailing placeholder node, and creates edges that connect each node to the next. Node IDs follow the conventions `trigger~{id}` for the trigger and `action~{id}~{index}` for actions. Finally, updates the component state by calling `setNodes` and `setEdges`.
*/
function loadWorkflow(){
const START_X = 100;
const GAP = 250;
Expand Down Expand Up @@ -357,4 +368,4 @@ export const CreateWorkFlow = () => {
);
};

export default CreateWorkFlow;
export default CreateWorkFlow;
12 changes: 11 additions & 1 deletion apps/web/app/components/nodes/GoogleSheetFormClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ interface GoogleSheetFormClientProps {
};
}

/**
* Renders a Google Sheets configuration form for selecting a credential, spreadsheet, sheet, operation, and range, and for saving or updating the node configuration.
*
* @param type - Credential type used to load available Google credentials
* @param nodeType - Node type string containing the node kind and node id separated by `~`
* @param avlNode - Optional external node identifier (accepted for API compatibility)
* @param position - Position index of the node within the workflow
* @param initialData - Optional initial configuration used to pre-populate the form; may include `credentialId`, `spreadSheetId`, `sheetName`, `operation`, and `range`
* @returns The rendered JSX element for the form
*/
export function GoogleSheetFormClient({ type, nodeType, avlNode, position, initialData }: GoogleSheetFormClientProps) {
const [selectedCredential, setSelectedCredential] = useState<string>(initialData?.credentialId || '');
const [documents, setDocuments] = useState<Array<{ id: string; name: string }>>([]);
Expand Down Expand Up @@ -418,4 +428,4 @@ export function GoogleSheetFormClient({ type, nodeType, avlNode, position, initi
</div>
</div>
);
}
}
15 changes: 14 additions & 1 deletion apps/web/app/components/nodes/actions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import { createNode, createTrigger, updateNode, updateTrigger } from '@/app/workflow/lib/config';

interface SaveConfigFormData {
Expand Down Expand Up @@ -26,6 +25,14 @@ interface updateConfigData{
id: string
}

/**
* Create a node or trigger from the provided Google Sheets configuration and return the backend result.
*
* Builds a config object from the supplied form data, calls the trigger creation path when `formData.type === 'trigger'`, or the node creation path otherwise, and returns the service response.
*
* @param formData - Form values containing type, credentialId, spreadsheetId, sheetName, operation, range, name, node_Trigger, workflowId, and optional position
* @returns `{ success: boolean, data: any }` where `success` indicates operation outcome and `data` contains the created entity or backend payload
*/
export async function handleSaveConfig(formData: SaveConfigFormData) {
// const executor = new GoogleSheetsNodeExecutor();
const context = {
Expand Down Expand Up @@ -73,6 +80,12 @@ export async function handleSaveConfig(formData: SaveConfigFormData) {
// };
}

/**
* Updates an existing node or trigger configuration using the provided form data.
*
* @param formData - Payload containing `id`, `type` ('trigger' or other), and updated config fields: `credentialId`, `spreadsheetId`, `sheetName`, `operation`, and `range`
* @returns An object with `success` indicating whether the update succeeded and `data` containing the updated resource payload
*/
export async function handleUpdateConfig(formData: updateConfigData){
const data = {
id: formData.id,
Expand Down
7 changes: 7 additions & 0 deletions apps/web/app/components/ui/app-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ import { toast } from 'sonner'
import { signOut } from 'next-auth/react'
import { useRouter } from 'next/navigation'

/**
* Render the application's sidebar with workflow and credential management controls and the user menu.
*
* Loads workflows and credentials, updates Redux with selected workflow and fetched workflow data, provides actions to create a new workflow and sign out, and exposes UI for selecting workflows and credentials.
*
* @returns The sidebar JSX element containing the create-workflow button, workflow and credential lists, and the user dropdown menu.
*/
export function AppSidebar() {

const user = useAppSelector((s)=> s.user)
Expand Down