mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
⚡ Cleanup of external hooks
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
ActiveExecutions,
|
ActiveExecutions,
|
||||||
Db,
|
Db,
|
||||||
|
ExternalHooks,
|
||||||
GenericHelpers,
|
GenericHelpers,
|
||||||
IWorkflowBase,
|
IWorkflowBase,
|
||||||
IWorkflowExecutionDataProcess,
|
IWorkflowExecutionDataProcess,
|
||||||
@@ -103,6 +104,10 @@ export class Execute extends Command {
|
|||||||
// Wait till the n8n-packages have been read
|
// Wait till the n8n-packages have been read
|
||||||
await loadNodesAndCredentialsPromise;
|
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
|
// Add the found types to an instance other parts of the application can use
|
||||||
const nodeTypes = NodeTypes();
|
const nodeTypes = NodeTypes();
|
||||||
await nodeTypes.init(loadNodesAndCredentials.nodeTypes);
|
await nodeTypes.init(loadNodesAndCredentials.nodeTypes);
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import {
|
|||||||
} from 'n8n-core';
|
} from 'n8n-core';
|
||||||
import { Command, flags } from '@oclif/command';
|
import { Command, flags } from '@oclif/command';
|
||||||
const open = require('open');
|
const open = require('open');
|
||||||
// import { dirname } from 'path';
|
|
||||||
|
|
||||||
import * as config from '../config';
|
import * as config from '../config';
|
||||||
import {
|
import {
|
||||||
@@ -113,8 +112,6 @@ export class Start extends Command {
|
|||||||
const externalHooks = ExternalHooks();
|
const externalHooks = ExternalHooks();
|
||||||
await externalHooks.init();
|
await externalHooks.init();
|
||||||
|
|
||||||
// await externalHooks.run('credentials.new');
|
|
||||||
|
|
||||||
// Add the found types to an instance other parts of the application can use
|
// Add the found types to an instance other parts of the application can use
|
||||||
const nodeTypes = NodeTypes();
|
const nodeTypes = NodeTypes();
|
||||||
await nodeTypes.init(loadNodesAndCredentials.nodeTypes);
|
await nodeTypes.init(loadNodesAndCredentials.nodeTypes);
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import {
|
|||||||
|
|
||||||
import * as config from '../config';
|
import * as config from '../config';
|
||||||
|
|
||||||
// export EXTERNAL_HOOK_FILES=/data/packages/cli/dist/src/externalHooksTemp/test-hooks.js
|
|
||||||
|
|
||||||
class ExternalHooksClass implements IExternalHooksClass {
|
class ExternalHooksClass implements IExternalHooksClass {
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ import {
|
|||||||
IExecutionsListResponse,
|
IExecutionsListResponse,
|
||||||
IExecutionsStopData,
|
IExecutionsStopData,
|
||||||
IExecutionsSummary,
|
IExecutionsSummary,
|
||||||
IExternalHooks,
|
IExternalHooksClass,
|
||||||
IN8nUISettings,
|
IN8nUISettings,
|
||||||
IPackageVersions,
|
IPackageVersions,
|
||||||
IWorkflowBase,
|
IWorkflowBase,
|
||||||
@@ -94,7 +94,7 @@ class App {
|
|||||||
testWebhooks: TestWebhooks.TestWebhooks;
|
testWebhooks: TestWebhooks.TestWebhooks;
|
||||||
endpointWebhook: string;
|
endpointWebhook: string;
|
||||||
endpointWebhookTest: string;
|
endpointWebhookTest: string;
|
||||||
externalHooks: IExternalHooks;
|
externalHooks: IExternalHooksClass;
|
||||||
saveDataErrorExecution: string;
|
saveDataErrorExecution: string;
|
||||||
saveDataSuccessExecution: string;
|
saveDataSuccessExecution: string;
|
||||||
saveManualExecutions: boolean;
|
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;
|
|
||||||
Reference in New Issue
Block a user