Some checks failed
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
90 lines
2.0 KiB
TypeScript
90 lines
2.0 KiB
TypeScript
import { NodeConnectionTypes, type INodeType, type INodeTypeDescription } from 'n8n-workflow';
|
|
|
|
import { auditFields, auditOperations } from './AuditDescription';
|
|
import { credentialFields, credentialOperations } from './CredentialDescription';
|
|
import { executionFields, executionOperations } from './ExecutionDescription';
|
|
import { workflowFields, workflowOperations } from './WorkflowDescription';
|
|
import { searchWorkflows } from './WorkflowLocator';
|
|
|
|
/**
|
|
* The n8n node provides access to the n8n API.
|
|
*
|
|
* See: https://docs.n8n.io/api/api-reference/
|
|
*/
|
|
export class N8n implements INodeType {
|
|
description: INodeTypeDescription = {
|
|
displayName: 'n8n',
|
|
name: 'n8n',
|
|
icon: 'file:n8n.svg',
|
|
group: ['transform'],
|
|
version: 1,
|
|
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
description: 'Handle events and perform actions on your n8n instance',
|
|
defaults: {
|
|
name: 'n8n',
|
|
},
|
|
inputs: [NodeConnectionTypes.Main],
|
|
outputs: [NodeConnectionTypes.Main],
|
|
credentials: [
|
|
{
|
|
name: 'n8nApi',
|
|
required: true,
|
|
},
|
|
],
|
|
requestDefaults: {
|
|
returnFullResponse: true,
|
|
baseURL: '={{ $credentials.baseUrl.replace(new RegExp("/$"), "") }}',
|
|
headers: {
|
|
Accept: 'application/json',
|
|
'Content-Type': 'application/json',
|
|
},
|
|
},
|
|
properties: [
|
|
{
|
|
displayName: 'Resource',
|
|
name: 'resource',
|
|
type: 'options',
|
|
noDataExpression: true,
|
|
options: [
|
|
{
|
|
name: 'Audit',
|
|
value: 'audit',
|
|
},
|
|
{
|
|
name: 'Credential',
|
|
value: 'credential',
|
|
},
|
|
{
|
|
name: 'Execution',
|
|
value: 'execution',
|
|
},
|
|
{
|
|
name: 'Workflow',
|
|
value: 'workflow',
|
|
},
|
|
],
|
|
default: 'workflow',
|
|
},
|
|
|
|
...auditOperations,
|
|
...auditFields,
|
|
|
|
...credentialOperations,
|
|
...credentialFields,
|
|
|
|
...executionOperations,
|
|
...executionFields,
|
|
|
|
...workflowOperations,
|
|
...workflowFields,
|
|
],
|
|
};
|
|
|
|
methods = {
|
|
listSearch: {
|
|
// Provide workflows search capability for the workflow resourceLocator
|
|
searchWorkflows,
|
|
},
|
|
};
|
|
}
|