Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
15 changes: 1 addition & 14 deletions nodes/Feather/operations/cancelWorkflowExecution.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
import { IExecuteFunctions, INodeExecutionData, LoggerProxy as Logger } from 'n8n-workflow';
import { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';

export async function executeCancelWorkflowExecution(
this: IExecuteFunctions,
i: number,
baseURL: string,
): Promise<INodeExecutionData> {
try {
Logger.info('Starting workflow execution cancellation...');

// Get the workflow and execution IDs
const workflowId = this.getNodeParameter('workflowId', i) as string;
const executionId = this.getNodeParameter('executionId', i) as string;

Logger.info('Parameters:', { workflowId, executionId });

try {
const response = await this.helpers.httpRequestWithAuthentication.call(this, 'featherApi', {
method: 'POST',
Expand All @@ -25,25 +21,16 @@ export async function executeCancelWorkflowExecution(
json: true,
});

Logger.info('Workflow execution cancelled successfully:', { response });

return {
json: response,
pairedItem: {
item: i,
},
};
} catch (apiError) {
Logger.error('API request failed:', { error: apiError });
Logger.error('Request details:', {
url: `${baseURL}/api/v1/workflow/${workflowId}/executions/${executionId}/cancel`,
workflowId,
executionId,
});
throw apiError;
}
} catch (error) {
Logger.error('Error in workflow execution cancellation:', { error });
throw error;
}
}
31 changes: 1 addition & 30 deletions nodes/Feather/operations/createAgentWorkflow.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IExecuteFunctions, INodeExecutionData, LoggerProxy as Logger } from 'n8n-workflow';
import { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';

type WorkflowStep = {
id: string;
Expand Down Expand Up @@ -72,20 +72,15 @@ export async function executeCreateAgentWorkflow(
baseURL: string,
): Promise<INodeExecutionData> {
try {
Logger.info('Starting workflow creation...');

// Get basic workflow information
const name = this.getNodeParameter('name', i) as string;
const description = this.getNodeParameter('description', i) as string;
const active = this.getNodeParameter('active', i) as boolean;
const timezone = this.getNodeParameter('timezone', i) as string;
const agentId = this.getNodeParameter('agentId', i) as string;

Logger.info('Basic parameters:', { name, description, active, timezone, agentId });

// Get step configuration
const stepConfig = this.getNodeParameter('stepConfiguration', i) as Record<string, unknown>;
Logger.info('Step configuration:', stepConfig);

// Get schedule configurations
const workflowScheduleUi = this.getNodeParameter('workflowScheduleUi', i) as Record<
Expand All @@ -97,8 +92,6 @@ export async function executeCreateAgentWorkflow(
const workflowScheduleData = workflowScheduleUi?.scheduleConfiguration || {};
const tcpaScheduleData = tcpaScheduleUi?.tcpaConfiguration || {};

Logger.info('Schedule configurations:', { workflowScheduleData, tcpaScheduleData });

// Build workflow schedule
const workflowSchedule: Schedule = {
monday: { enabled: false, timeRanges: [] },
Expand All @@ -123,7 +116,6 @@ export async function executeCreateAgentWorkflow(

// Configure workflow schedule
if (workflowScheduleData) {
Logger.info('Configuring workflow schedule...');
const scheduleData = workflowScheduleData as Record<string, unknown>;
const {
workingDays = [],
Expand All @@ -133,8 +125,6 @@ export async function executeCreateAgentWorkflow(
workingMinutesEnd = 0,
} = scheduleData;

Logger.info('Working days configuration:', { workingDays });

if (Array.isArray(workingDays) && workingDays.length > 0) {
for (const day of workingDays) {
workflowSchedule[day as keyof Schedule] = {
Expand All @@ -149,15 +139,11 @@ export async function executeCreateAgentWorkflow(
],
};
}
Logger.info('Workflow schedule configured:', workflowSchedule);
} else {
Logger.info('No working days configured, using default empty schedule');
}
}

// Configure TCPA schedule
if (tcpaScheduleData) {
Logger.info('Configuring TCPA schedule...');
const tcpaData = tcpaScheduleData as Record<string, unknown>;
const {
tcpaDays = [],
Expand All @@ -167,8 +153,6 @@ export async function executeCreateAgentWorkflow(
tcpaMinutesEnd = 0,
} = tcpaData;

Logger.info('TCPA days configuration:', { tcpaDays });

if (Array.isArray(tcpaDays) && tcpaDays.length > 0) {
for (const day of tcpaDays) {
tcpaSchedule[day as keyof Schedule] = {
Expand All @@ -183,9 +167,6 @@ export async function executeCreateAgentWorkflow(
],
};
}
Logger.info('TCPA schedule configured:', tcpaSchedule);
} else {
Logger.info('No TCPA days configured, using default empty schedule');
}
}

Expand All @@ -201,8 +182,6 @@ export async function executeCreateAgentWorkflow(
definition: stepDefinition,
};

Logger.info('Preparing API request with workflow:', { workflow });

try {
const response = await this.helpers.httpRequestWithAuthentication.call(this, 'featherApi', {
method: 'POST',
Expand All @@ -215,24 +194,16 @@ export async function executeCreateAgentWorkflow(
json: true,
});

Logger.info('Workflow created successfully:', { response });

return {
json: response,
pairedItem: {
item: i,
},
};
} catch (apiError) {
Logger.error('API request failed:', apiError);
Logger.error('Request details:', {
url: `${baseURL}/api/v1/workflow`,
workflow,
});
throw apiError;
}
} catch (error) {
Logger.error('Error in workflow creation:', error);
throw error;
}
}
16 changes: 1 addition & 15 deletions nodes/Feather/operations/createWorkflowExecution.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { IExecuteFunctions, INodeExecutionData, LoggerProxy as Logger, NodeOperationError } from 'n8n-workflow';
import { IExecuteFunctions, INodeExecutionData, NodeOperationError } from 'n8n-workflow';

export async function executeCreateWorkflowExecution(
this: IExecuteFunctions,
i: number,
baseURL: string,
): Promise<INodeExecutionData> {
try {
Logger.info('Starting workflow execution creation...');

// Get required parameters
const workflowId = this.getNodeParameter('workflowId', i) as string;
const customerLeadId = this.getNodeParameter('customerLeadId', i) as string;
Expand Down Expand Up @@ -75,8 +73,6 @@ export async function executeCreateWorkflowExecution(
}
}

Logger.info('Basic parameters:', { workflowId, customerLeadId, primaryPhone, zipcode, state });

// Build request body
const body: Record<string, unknown> = {
customerLeadId,
Expand Down Expand Up @@ -132,8 +128,6 @@ export async function executeCreateWorkflowExecution(

body.metadata = metadata;

Logger.info('Preparing API request with execution data:', { body});

try {
const response = await this.helpers.httpRequestWithAuthentication.call(this, 'featherApi', {
method: 'POST',
Expand All @@ -146,24 +140,16 @@ export async function executeCreateWorkflowExecution(
json: true,
});

Logger.info('Workflow execution created successfully:', { response });
return {
json: response,
pairedItem: {
item: i,
},
};
} catch (apiError) {
Logger.error('API request failed:', apiError);
Logger.error('Request details:', {
url: `${baseURL}/api/v1/workflow/${workflowId}/execution`,
workflowId,
body,
});
throw apiError;
}
} catch (error) {
Logger.error('Error in workflow execution creation:', error);
throw error;
}
}
Loading