mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-14 08:34:07 -08:00
d548161632
* ✨ Implement security audit * ⚡ Use logger * 🧪 Fix test * ⚡ Switch logger with stdout * 🎨 Set new logo * ⚡ Fill out Public API schema * ✏️ Fix typo * ⚡ Break dependency cycle * ⚡ Add security settings values * 🧪 Test security settings * ⚡ Add publicly accessible instance warning * ⚡ Add metric to CLI command * ✏️ Fix typo * 🔥 Remove unneeded path alias * 📘 Add type import * 🔥 Remove inferrable output type * ⚡ Set description at correct level * ⚡ Rename constant for consistency * ⚡ Sort URLs * ⚡ Rename local var * ⚡ Shorten name * ✏️ Improve phrasing * ⚡ Improve naming * ⚡ Fix casing * ✏️ Add docline * ✏️ Relocate comment * ⚡ Add singular/plurals * 🔥 Remove unneeded await * ✏️ Improve test description * ⚡ Optimize with sets * ⚡ Adjust post master merge * ✏️ Improve naming * ⚡ Adjust in spy * 🧪 Fix outdated instance test * 🧪 Make diagnostics check consistent * ⚡ Refactor `getAllExistingCreds` * ⚡ Create helper `getNodeTypes` * 🐛 Fix `InternalHooksManager` call * 🚚 Rename `execution` to `nodes` risk * ⚡ Add options to CLI command * ⚡ Make days configurable * :revert: Undo changes to `BaseCommand` * ⚡ Improve CLI command UX * ⚡ Change no-report return value Empty array to trigger empty state on FE. * ⚡ Add empty check to `reportInstanceRisk` * 🧪 Extend Jest `expect` * 📘 Augment `jest.Matchers` * 🧪 Set extend as setup file * 🔧 Override lint rule for `.d.ts` * ⚡ Use new matcher * ⚡ Update check * 📘 Improve typings * ⚡ Adjust instance risk check * ✏️ Rename `execution` → `nodes` in Public API schema * ✏️ Add clarifying comment * ✏️ Fix typo * ⚡ Validate categories in CLI command * ✏️ Improve naming * ✏️ Make audit reference consistent * 📘 Fix typing * ⚡ Use `finally` in CLI command
89 lines
1.9 KiB
TypeScript
89 lines
1.9 KiB
TypeScript
import type { INodeType, 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: 'Consume n8n API',
|
|
defaults: {
|
|
name: 'n8n',
|
|
},
|
|
inputs: ['main'],
|
|
outputs: ['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,
|
|
},
|
|
};
|
|
}
|