Some cleanup

This commit is contained in:
Jan Oberhauser 2021-03-25 11:23:54 +01:00
parent 5f96f01f24
commit 0c0c0bda67
8 changed files with 23 additions and 24 deletions

View file

@ -21,7 +21,7 @@ import {
WorkflowCredentials,
WorkflowHelpers,
WorkflowRunner,
} from "../src";
} from '../src';
export class Execute extends Command {
@ -127,7 +127,7 @@ export class Execute extends Command {
// Check if the workflow contains the required "Start" node
// "requiredNodeTypes" are also defined in editor-ui/views/NodeView.vue
const requiredNodeTypes = ['n8n-nodes-base.start'];
let startNode: INode | undefined= undefined;
let startNode: INode | undefined = undefined;
for (const node of workflowData!.nodes) {
if (requiredNodeTypes.includes(node.type)) {
startNode = node;

View file

@ -140,7 +140,7 @@ export class ExportCredentialsCommand extends Command {
let fileContents: string, i: number;
for (i = 0; i < credentials.length; i++) {
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);
}
console.log('Successfully exported', i, 'credentials.');

View file

@ -116,7 +116,7 @@ export class ExportWorkflowsCommand extends Command {
let fileContents: string, i: number;
for (i = 0; i < workflows.length; i++) {
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);
}
console.log('Successfully exported', i, 'workflows.');

View file

@ -17,11 +17,12 @@ import {
Db,
ExternalHooks,
GenericHelpers,
IExecutionsCurrentSummary,
LoadNodesAndCredentials,
NodeTypes,
Server,
TestWebhooks,
} from "../src";
} from '../src';
import { IDataObject } from 'n8n-workflow';
@ -97,7 +98,7 @@ export class Start extends Command {
// Wait for active workflow executions to finish
const activeExecutionsInstance = ActiveExecutions.getInstance();
let executingWorkflows = activeExecutionsInstance.getActiveExecutions();
let executingWorkflows = activeExecutionsInstance.getActiveExecutions() as IExecutionsCurrentSummary[];
let count = 0;
while (executingWorkflows.length !== 0) {
@ -132,7 +133,7 @@ export class Start extends Command {
await (async () => {
try {
// 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}`);
processExistCode = 1;
@ -183,7 +184,7 @@ export class Start extends Command {
cumulativeTimeout += now - lastTimer;
lastTimer = now;
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);
}
}
@ -224,7 +225,7 @@ export class Start extends Command {
if (dbType === 'sqlite') {
const shouldRunVacuum = config.get('database.sqlite.executeVacuumOnStartup') as number;
if (shouldRunVacuum) {
Db.collections.Execution!.query("VACUUM;");
Db.collections.Execution!.query('VACUUM;');
}
}
@ -283,7 +284,7 @@ export class Start extends Command {
Start.openBrowser();
}
this.log(`\nPress "o" to open in Browser.`);
process.stdin.on("data", (key : string) => {
process.stdin.on('data', (key: string) => {
if (key === 'o') {
Start.openBrowser();
inputText = '';

View file

@ -9,7 +9,7 @@ import {
import {
Db,
GenericHelpers,
} from "../../src";
} from '../../src';
export class UpdateWorkflowCommand extends Command {

View file

@ -17,7 +17,7 @@ import {
NodeTypes,
TestWebhooks,
WebhookServer,
} from "../src";
} from '../src';
import { IDataObject } from 'n8n-workflow';
@ -166,7 +166,7 @@ export class Webhook extends Command {
cumulativeTimeout += now - lastTimer;
lastTimer = now;
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);
}
}

View file

@ -35,7 +35,7 @@ import {
ResponseHelper,
WorkflowCredentials,
WorkflowExecuteAdditionalData,
} from "../src";
} from '../src';
import * as config from '../config';
import * as Bull from 'bull';
@ -241,7 +241,7 @@ export class Worker extends Command {
cumulativeTimeout += now - lastTimer;
lastTimer = now;
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);
}
}

View file

@ -92,9 +92,7 @@ import {
import {
FindManyOptions,
FindOneOptions,
LessThan,
LessThanOrEqual,
MoreThanOrEqual,
Not,
} from 'typeorm';