Refactor Skyvern node operations to consolidate display options and improve code organization (#2868)

This commit is contained in:
Prakash Maheshwaran
2025-07-04 11:32:07 -04:00
committed by GitHub
parent f832206f38
commit 10f893e2d5

View File

@@ -65,24 +65,25 @@ export class Skyvern implements INodeType {
], ],
default: 'task', default: 'task',
}, },
// Task Operations
{ {
displayName: 'Operation', displayName: 'Operation',
name: 'operation', name: 'taskOperation',
type: 'options', type: 'options',
noDataExpression: true, noDataExpression: true,
required: true, required: true,
default: 'dispatchTask', default: 'dispatchTask',
displayOptions: {
show: {
resource: ['task'],
},
},
options: [ options: [
{ {
name: 'Dispatch a Task', name: 'Dispatch a Task',
value: 'dispatchTask', value: 'dispatchTask',
action: 'Dispatch a task to execute asynchronously', action: 'Dispatch a task to execute asynchronously',
description: 'Dispatch a task to execute asynchronously', description: 'Dispatch a task to execute asynchronously',
displayOptions: {
show: {
resource: ['task'],
},
},
routing: { routing: {
request: { request: {
baseURL: '={{$credentials.baseUrl}}', baseURL: '={{$credentials.baseUrl}}',
@@ -113,11 +114,6 @@ export class Skyvern implements INodeType {
value: 'getTask', value: 'getTask',
action: 'Get a task by ID', action: 'Get a task by ID',
description: 'Get a task by ID', description: 'Get a task by ID',
displayOptions: {
show: {
resource: ['task'],
},
},
routing: { routing: {
request: { request: {
baseURL: '={{$credentials.baseUrl}}', baseURL: '={{$credentials.baseUrl}}',
@@ -125,16 +121,27 @@ export class Skyvern implements INodeType {
}, },
}, },
}, },
],
},
// Workflow Operations
{
displayName: 'Operation',
name: 'workflowOperation',
type: 'options',
noDataExpression: true,
required: true,
default: 'getWorkflow',
displayOptions: {
show: {
resource: ['workflow'],
},
},
options: [
{ {
name: 'Get a Workflow Run', name: 'Get a Workflow Run',
value: 'getWorkflow', value: 'getWorkflow',
action: 'Get a workflow run by ID', action: 'Get a workflow run by ID',
description: 'Get a workflow run by ID', description: 'Get a workflow run by ID',
displayOptions: {
show: {
resource: ['workflow'],
},
},
routing: { routing: {
request: { request: {
baseURL: '={{$credentials.baseUrl}}', baseURL: '={{$credentials.baseUrl}}',
@@ -147,11 +154,6 @@ export class Skyvern implements INodeType {
value: 'dispatchWorkflow', value: 'dispatchWorkflow',
action: 'Dispatch a workflow run to execute asynchronously', action: 'Dispatch a workflow run to execute asynchronously',
description: 'Dispatch a workflow run to execute asynchronously', description: 'Dispatch a workflow run to execute asynchronously',
displayOptions: {
show: {
resource: ['workflow'],
},
},
routing: { routing: {
request: { request: {
baseURL: '={{$credentials.baseUrl}}', baseURL: '={{$credentials.baseUrl}}',
@@ -173,7 +175,7 @@ export class Skyvern implements INodeType {
displayOptions: { displayOptions: {
show: { show: {
resource: ['task'], resource: ['task'],
operation: ['dispatchTask'], taskOperation: ['dispatchTask'],
}, },
}, },
routing: { routing: {
@@ -194,7 +196,7 @@ export class Skyvern implements INodeType {
displayOptions: { displayOptions: {
show: { show: {
resource: ['task'], resource: ['task'],
operation: ['dispatchTask'], taskOperation: ['dispatchTask'],
}, },
}, },
routing: { routing: {
@@ -215,7 +217,7 @@ export class Skyvern implements INodeType {
displayOptions: { displayOptions: {
show: { show: {
resource: ['task'], resource: ['task'],
operation: ['dispatchTask'], taskOperation: ['dispatchTask'],
}, },
}, },
routing: { routing: {
@@ -236,7 +238,7 @@ export class Skyvern implements INodeType {
displayOptions: { displayOptions: {
show: { show: {
resource: ['task'], resource: ['task'],
operation: ['getTask'], taskOperation: ['getTask'],
}, },
}, },
routing: { routing: {
@@ -310,7 +312,7 @@ export class Skyvern implements INodeType {
displayOptions: { displayOptions: {
show: { show: {
resource: ['task'], resource: ['task'],
operation: ['dispatchTask'], taskOperation: ['dispatchTask'],
}, },
}, },
}, },
@@ -341,7 +343,7 @@ export class Skyvern implements INodeType {
displayOptions: { displayOptions: {
show: { show: {
resource: ['workflow'], resource: ['workflow'],
operation: ['getWorkflow'], workflowOperation: ['getWorkflow'],
}, },
}, },
routing: { routing: {
@@ -364,7 +366,7 @@ export class Skyvern implements INodeType {
displayOptions: { displayOptions: {
show: { show: {
resource: ['workflow'], resource: ['workflow'],
operation: ['dispatchWorkflow'], workflowOperation: ['dispatchWorkflow'],
}, },
}, },
typeOptions: { typeOptions: {
@@ -398,7 +400,7 @@ export class Skyvern implements INodeType {
displayOptions: { displayOptions: {
show: { show: {
resource: ['workflow'], resource: ['workflow'],
operation: ['dispatchWorkflow'], workflowOperation: ['dispatchWorkflow'],
}, },
}, },
routing: { routing: {
@@ -436,7 +438,7 @@ export class Skyvern implements INodeType {
const resource = this.getCurrentNodeParameter('resource') as string; const resource = this.getCurrentNodeParameter('resource') as string;
if (resource !== 'workflow') return { fields: [] }; if (resource !== 'workflow') return { fields: [] };
const operation = this.getCurrentNodeParameter('operation') as string; const operation = this.getCurrentNodeParameter('workflowOperation') as string;
if (operation !== 'dispatchWorkflow') return { fields: [] }; if (operation !== 'dispatchWorkflow') return { fields: [] };
const workflowId = this.getCurrentNodeParameter('workflowId') as string; const workflowId = this.getCurrentNodeParameter('workflowId') as string;