mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-11 12:57:29 -08:00
⚡ Some cleanup
This commit is contained in:
parent
5f96f01f24
commit
0c0c0bda67
|
@ -21,7 +21,7 @@ import {
|
||||||
WorkflowCredentials,
|
WorkflowCredentials,
|
||||||
WorkflowHelpers,
|
WorkflowHelpers,
|
||||||
WorkflowRunner,
|
WorkflowRunner,
|
||||||
} from "../src";
|
} from '../src';
|
||||||
|
|
||||||
|
|
||||||
export class Execute extends Command {
|
export class Execute extends Command {
|
||||||
|
@ -127,7 +127,7 @@ export class Execute extends Command {
|
||||||
// Check if the workflow contains the required "Start" node
|
// Check if the workflow contains the required "Start" node
|
||||||
// "requiredNodeTypes" are also defined in editor-ui/views/NodeView.vue
|
// "requiredNodeTypes" are also defined in editor-ui/views/NodeView.vue
|
||||||
const requiredNodeTypes = ['n8n-nodes-base.start'];
|
const requiredNodeTypes = ['n8n-nodes-base.start'];
|
||||||
let startNode: INode | undefined= undefined;
|
let startNode: INode | undefined = undefined;
|
||||||
for (const node of workflowData!.nodes) {
|
for (const node of workflowData!.nodes) {
|
||||||
if (requiredNodeTypes.includes(node.type)) {
|
if (requiredNodeTypes.includes(node.type)) {
|
||||||
startNode = node;
|
startNode = node;
|
||||||
|
|
|
@ -140,7 +140,7 @@ export class ExportCredentialsCommand extends Command {
|
||||||
let fileContents: string, i: number;
|
let fileContents: string, i: number;
|
||||||
for (i = 0; i < credentials.length; i++) {
|
for (i = 0; i < credentials.length; i++) {
|
||||||
fileContents = JSON.stringify(credentials[i], null, flags.pretty ? 2 : undefined);
|
fileContents = JSON.stringify(credentials[i], null, flags.pretty ? 2 : undefined);
|
||||||
const filename = (flags.output!.endsWith(path.sep) ? flags.output! : flags.output + path.sep) + credentials[i].id + ".json";
|
const filename = (flags.output!.endsWith(path.sep) ? flags.output! : flags.output + path.sep) + credentials[i].id + '.json';
|
||||||
fs.writeFileSync(filename, fileContents);
|
fs.writeFileSync(filename, fileContents);
|
||||||
}
|
}
|
||||||
console.log('Successfully exported', i, 'credentials.');
|
console.log('Successfully exported', i, 'credentials.');
|
||||||
|
|
|
@ -116,7 +116,7 @@ export class ExportWorkflowsCommand extends Command {
|
||||||
let fileContents: string, i: number;
|
let fileContents: string, i: number;
|
||||||
for (i = 0; i < workflows.length; i++) {
|
for (i = 0; i < workflows.length; i++) {
|
||||||
fileContents = JSON.stringify(workflows[i], null, flags.pretty ? 2 : undefined);
|
fileContents = JSON.stringify(workflows[i], null, flags.pretty ? 2 : undefined);
|
||||||
const filename = (flags.output!.endsWith(path.sep) ? flags.output! : flags.output + path.sep) + workflows[i].id + ".json";
|
const filename = (flags.output!.endsWith(path.sep) ? flags.output! : flags.output + path.sep) + workflows[i].id + '.json';
|
||||||
fs.writeFileSync(filename, fileContents);
|
fs.writeFileSync(filename, fileContents);
|
||||||
}
|
}
|
||||||
console.log('Successfully exported', i, 'workflows.');
|
console.log('Successfully exported', i, 'workflows.');
|
||||||
|
|
|
@ -17,11 +17,12 @@ import {
|
||||||
Db,
|
Db,
|
||||||
ExternalHooks,
|
ExternalHooks,
|
||||||
GenericHelpers,
|
GenericHelpers,
|
||||||
|
IExecutionsCurrentSummary,
|
||||||
LoadNodesAndCredentials,
|
LoadNodesAndCredentials,
|
||||||
NodeTypes,
|
NodeTypes,
|
||||||
Server,
|
Server,
|
||||||
TestWebhooks,
|
TestWebhooks,
|
||||||
} from "../src";
|
} from '../src';
|
||||||
import { IDataObject } from 'n8n-workflow';
|
import { IDataObject } from 'n8n-workflow';
|
||||||
|
|
||||||
|
|
||||||
|
@ -97,7 +98,7 @@ export class Start extends Command {
|
||||||
|
|
||||||
// Wait for active workflow executions to finish
|
// Wait for active workflow executions to finish
|
||||||
const activeExecutionsInstance = ActiveExecutions.getInstance();
|
const activeExecutionsInstance = ActiveExecutions.getInstance();
|
||||||
let executingWorkflows = activeExecutionsInstance.getActiveExecutions();
|
let executingWorkflows = activeExecutionsInstance.getActiveExecutions() as IExecutionsCurrentSummary[];
|
||||||
|
|
||||||
let count = 0;
|
let count = 0;
|
||||||
while (executingWorkflows.length !== 0) {
|
while (executingWorkflows.length !== 0) {
|
||||||
|
@ -132,7 +133,7 @@ export class Start extends Command {
|
||||||
await (async () => {
|
await (async () => {
|
||||||
try {
|
try {
|
||||||
// Start directly with the init of the database to improve startup time
|
// Start directly with the init of the database to improve startup time
|
||||||
const startDbInitPromise = Db.init().catch(error => {
|
const startDbInitPromise = Db.init().catch((error: Error) => {
|
||||||
console.error(`There was an error initializing DB: ${error.message}`);
|
console.error(`There was an error initializing DB: ${error.message}`);
|
||||||
|
|
||||||
processExistCode = 1;
|
processExistCode = 1;
|
||||||
|
@ -183,7 +184,7 @@ export class Start extends Command {
|
||||||
cumulativeTimeout += now - lastTimer;
|
cumulativeTimeout += now - lastTimer;
|
||||||
lastTimer = now;
|
lastTimer = now;
|
||||||
if (cumulativeTimeout > redisConnectionTimeoutLimit) {
|
if (cumulativeTimeout > redisConnectionTimeoutLimit) {
|
||||||
console.error('Unable to connect to Redis after ' + redisConnectionTimeoutLimit + ". Exiting process.");
|
console.error('Unable to connect to Redis after ' + redisConnectionTimeoutLimit + '. Exiting process.');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -224,7 +225,7 @@ export class Start extends Command {
|
||||||
if (dbType === 'sqlite') {
|
if (dbType === 'sqlite') {
|
||||||
const shouldRunVacuum = config.get('database.sqlite.executeVacuumOnStartup') as number;
|
const shouldRunVacuum = config.get('database.sqlite.executeVacuumOnStartup') as number;
|
||||||
if (shouldRunVacuum) {
|
if (shouldRunVacuum) {
|
||||||
Db.collections.Execution!.query("VACUUM;");
|
Db.collections.Execution!.query('VACUUM;');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,7 +284,7 @@ export class Start extends Command {
|
||||||
Start.openBrowser();
|
Start.openBrowser();
|
||||||
}
|
}
|
||||||
this.log(`\nPress "o" to open in Browser.`);
|
this.log(`\nPress "o" to open in Browser.`);
|
||||||
process.stdin.on("data", (key : string) => {
|
process.stdin.on('data', (key: string) => {
|
||||||
if (key === 'o') {
|
if (key === 'o') {
|
||||||
Start.openBrowser();
|
Start.openBrowser();
|
||||||
inputText = '';
|
inputText = '';
|
||||||
|
|
|
@ -9,7 +9,7 @@ import {
|
||||||
import {
|
import {
|
||||||
Db,
|
Db,
|
||||||
GenericHelpers,
|
GenericHelpers,
|
||||||
} from "../../src";
|
} from '../../src';
|
||||||
|
|
||||||
|
|
||||||
export class UpdateWorkflowCommand extends Command {
|
export class UpdateWorkflowCommand extends Command {
|
||||||
|
|
|
@ -17,7 +17,7 @@ import {
|
||||||
NodeTypes,
|
NodeTypes,
|
||||||
TestWebhooks,
|
TestWebhooks,
|
||||||
WebhookServer,
|
WebhookServer,
|
||||||
} from "../src";
|
} from '../src';
|
||||||
import { IDataObject } from 'n8n-workflow';
|
import { IDataObject } from 'n8n-workflow';
|
||||||
|
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ export class Webhook extends Command {
|
||||||
cumulativeTimeout += now - lastTimer;
|
cumulativeTimeout += now - lastTimer;
|
||||||
lastTimer = now;
|
lastTimer = now;
|
||||||
if (cumulativeTimeout > redisConnectionTimeoutLimit) {
|
if (cumulativeTimeout > redisConnectionTimeoutLimit) {
|
||||||
console.error('Unable to connect to Redis after ' + redisConnectionTimeoutLimit + ". Exiting process.");
|
console.error('Unable to connect to Redis after ' + redisConnectionTimeoutLimit + '. Exiting process.');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ import {
|
||||||
ResponseHelper,
|
ResponseHelper,
|
||||||
WorkflowCredentials,
|
WorkflowCredentials,
|
||||||
WorkflowExecuteAdditionalData,
|
WorkflowExecuteAdditionalData,
|
||||||
} from "../src";
|
} from '../src';
|
||||||
|
|
||||||
import * as config from '../config';
|
import * as config from '../config';
|
||||||
import * as Bull from 'bull';
|
import * as Bull from 'bull';
|
||||||
|
@ -241,7 +241,7 @@ export class Worker extends Command {
|
||||||
cumulativeTimeout += now - lastTimer;
|
cumulativeTimeout += now - lastTimer;
|
||||||
lastTimer = now;
|
lastTimer = now;
|
||||||
if (cumulativeTimeout > redisConnectionTimeoutLimit) {
|
if (cumulativeTimeout > redisConnectionTimeoutLimit) {
|
||||||
console.error('Unable to connect to Redis after ' + redisConnectionTimeoutLimit + ". Exiting process.");
|
console.error('Unable to connect to Redis after ' + redisConnectionTimeoutLimit + '. Exiting process.');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,9 +92,7 @@ import {
|
||||||
import {
|
import {
|
||||||
FindManyOptions,
|
FindManyOptions,
|
||||||
FindOneOptions,
|
FindOneOptions,
|
||||||
LessThan,
|
|
||||||
LessThanOrEqual,
|
LessThanOrEqual,
|
||||||
MoreThanOrEqual,
|
|
||||||
Not,
|
Not,
|
||||||
} from 'typeorm';
|
} from 'typeorm';
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue