mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 12:44:07 -08:00
⚡ Cleanup of external hooks
This commit is contained in:
parent
6e1254fd54
commit
57b3a2e05e
|
@ -10,6 +10,7 @@ import {
|
|||
import {
|
||||
ActiveExecutions,
|
||||
Db,
|
||||
ExternalHooks,
|
||||
GenericHelpers,
|
||||
IWorkflowBase,
|
||||
IWorkflowExecutionDataProcess,
|
||||
|
@ -103,6 +104,10 @@ export class Execute extends Command {
|
|||
// Wait till the n8n-packages have been read
|
||||
await loadNodesAndCredentialsPromise;
|
||||
|
||||
// Load all external hooks
|
||||
const externalHooks = ExternalHooks();
|
||||
await externalHooks.init();
|
||||
|
||||
// Add the found types to an instance other parts of the application can use
|
||||
const nodeTypes = NodeTypes();
|
||||
await nodeTypes.init(loadNodesAndCredentials.nodeTypes);
|
||||
|
|
|
@ -5,7 +5,6 @@ import {
|
|||
} from 'n8n-core';
|
||||
import { Command, flags } from '@oclif/command';
|
||||
const open = require('open');
|
||||
// import { dirname } from 'path';
|
||||
|
||||
import * as config from '../config';
|
||||
import {
|
||||
|
@ -113,8 +112,6 @@ export class Start extends Command {
|
|||
const externalHooks = ExternalHooks();
|
||||
await externalHooks.init();
|
||||
|
||||
// await externalHooks.run('credentials.new');
|
||||
|
||||
// Add the found types to an instance other parts of the application can use
|
||||
const nodeTypes = NodeTypes();
|
||||
await nodeTypes.init(loadNodesAndCredentials.nodeTypes);
|
||||
|
|
|
@ -6,7 +6,6 @@ import {
|
|||
|
||||
import * as config from '../config';
|
||||
|
||||
// export EXTERNAL_HOOK_FILES=/data/packages/cli/dist/src/externalHooksTemp/test-hooks.js
|
||||
|
||||
class ExternalHooksClass implements IExternalHooksClass {
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ import {
|
|||
IExecutionsListResponse,
|
||||
IExecutionsStopData,
|
||||
IExecutionsSummary,
|
||||
IExternalHooks,
|
||||
IExternalHooksClass,
|
||||
IN8nUISettings,
|
||||
IPackageVersions,
|
||||
IWorkflowBase,
|
||||
|
@ -94,7 +94,7 @@ class App {
|
|||
testWebhooks: TestWebhooks.TestWebhooks;
|
||||
endpointWebhook: string;
|
||||
endpointWebhookTest: string;
|
||||
externalHooks: IExternalHooks;
|
||||
externalHooks: IExternalHooksClass;
|
||||
saveDataErrorExecution: string;
|
||||
saveDataSuccessExecution: string;
|
||||
saveManualExecutions: boolean;
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
import {
|
||||
WorkflowExecuteMode,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
IExternalHooks,
|
||||
IExternalHooksFunctions,
|
||||
IWorkflowBase,
|
||||
IWorkflowDb,
|
||||
} from '../';
|
||||
|
||||
|
||||
export = {
|
||||
credentials: {
|
||||
create: [
|
||||
async function (this: IExternalHooksFunctions) {
|
||||
// Here any additional code can run or the creation blocked
|
||||
// throw new Error('No additional credentials can be created.');
|
||||
},
|
||||
],
|
||||
},
|
||||
workflow: {
|
||||
execute: [
|
||||
async function (this: IExternalHooksFunctions, workflowData: IWorkflowDb, mode: WorkflowExecuteMode) {
|
||||
console.log('execute: ' + mode);
|
||||
// if (mode === 'integrated') {
|
||||
// throw new Error('Workflow can not be executed.');
|
||||
// }
|
||||
}
|
||||
],
|
||||
update: [
|
||||
async function (this: IExternalHooksFunctions, workflowData: IWorkflowBase) {
|
||||
console.log('update workflow hook');
|
||||
|
||||
// const responseData = await this.dbCollections.Workflow!.findOne(workflowData.id);
|
||||
// console.log('workflowData');
|
||||
// console.log(responseData);
|
||||
// console.log(workflowData);
|
||||
|
||||
// Here any additional code can run or the creation blocked
|
||||
// throw new Error('Workflow can not be updated.');
|
||||
},
|
||||
],
|
||||
},
|
||||
} as IExternalHooks;
|
Loading…
Reference in a new issue