mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
refactor: Lint for no unneeded backticks (#5057) (no-changelog)
* ✨ Create rule `no-unneeded-backticks` * 👕 Enable rule * ⚡ Run rule on `cli` * ⚡ Run rule on `core` * ⚡ Run rule on `workflow` * ⚡ Rule rule on `design-system` * ⚡ Run rule on `node-dev` * ⚡ Run rule on `editor-ui` * ⚡ Run rule on `nodes-base`
This commit is contained in:
@@ -62,7 +62,8 @@ import { WorkflowRunner } from '@/WorkflowRunner';
|
||||
import { ExternalHooks } from '@/ExternalHooks';
|
||||
import { whereClause } from './UserManagement/UserManagementHelper';
|
||||
|
||||
const WEBHOOK_PROD_UNREGISTERED_HINT = `The workflow must be active for a production URL to run successfully. You can activate the workflow using the toggle in the top-right of the editor. Note that unlike test URL calls, production URL calls aren't shown on the canvas (only in the executions list)`;
|
||||
const WEBHOOK_PROD_UNREGISTERED_HINT =
|
||||
"The workflow must be active for a production URL to run successfully. You can activate the workflow using the toggle in the top-right of the editor. Note that unlike test URL calls, production URL calls aren't shown on the canvas (only in the executions list)";
|
||||
|
||||
export class ActiveWorkflowRunner {
|
||||
private activeWorkflows: ActiveWorkflows | null = null;
|
||||
@@ -118,11 +119,11 @@ export class ActiveWorkflowRunner {
|
||||
workflowName: workflowData.name,
|
||||
workflowId: workflowData.id,
|
||||
});
|
||||
console.log(` => Started`);
|
||||
console.log(' => Started');
|
||||
} catch (error) {
|
||||
ErrorReporter.error(error);
|
||||
console.log(
|
||||
` => ERROR: Workflow could not be activated on first try, keep on trying`,
|
||||
' => ERROR: Workflow could not be activated on first try, keep on trying',
|
||||
);
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
console.log(` ${error.message}`);
|
||||
@@ -773,7 +774,7 @@ export class ActiveWorkflowRunner {
|
||||
workflowData?: IWorkflowDb,
|
||||
): Promise<void> {
|
||||
if (this.activeWorkflows === null) {
|
||||
throw new Error(`The "activeWorkflows" instance did not get initialized yet.`);
|
||||
throw new Error('The "activeWorkflows" instance did not get initialized yet.');
|
||||
}
|
||||
|
||||
let workflowInstance: Workflow;
|
||||
@@ -806,7 +807,7 @@ export class ActiveWorkflowRunner {
|
||||
if (!canBeActivated) {
|
||||
Logger.error(`Unable to activate workflow "${workflowData.name}"`);
|
||||
throw new Error(
|
||||
`The workflow can not be activated because it does not contain any nodes which could start the workflow. Only workflows which have trigger or webhook nodes can be activated.`,
|
||||
'The workflow can not be activated because it does not contain any nodes which could start the workflow. Only workflows which have trigger or webhook nodes can be activated.',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1001,7 +1002,7 @@ export class ActiveWorkflowRunner {
|
||||
return;
|
||||
}
|
||||
|
||||
throw new Error(`The "activeWorkflows" instance did not get initialized yet.`);
|
||||
throw new Error('The "activeWorkflows" instance did not get initialized yet.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ export class Push {
|
||||
this.channel.on('disconnect', (channel: string, res: Response) => {
|
||||
if (res.req !== undefined) {
|
||||
const { sessionId } = res.req.query;
|
||||
Logger.debug(`Remove editor-UI session`, { sessionId });
|
||||
Logger.debug('Remove editor-UI session', { sessionId });
|
||||
delete this.connections[sessionId as string];
|
||||
}
|
||||
});
|
||||
@@ -27,7 +27,7 @@ export class Push {
|
||||
* @param {Response} res The response
|
||||
*/
|
||||
add(sessionId: string, req: Request, res: Response) {
|
||||
Logger.debug(`Add editor-UI session`, { sessionId });
|
||||
Logger.debug('Add editor-UI session', { sessionId });
|
||||
|
||||
if (this.connections[sessionId] !== undefined) {
|
||||
// Make sure to remove existing connection with the same session
|
||||
|
||||
@@ -1031,7 +1031,7 @@ class App {
|
||||
const parameters = toHttpNodeParameters(curlCommand);
|
||||
return ResponseHelper.flattenObject(parameters, 'parameters');
|
||||
} catch (e) {
|
||||
throw new ResponseHelper.BadRequestError(`Invalid cURL command`);
|
||||
throw new ResponseHelper.BadRequestError('Invalid cURL command');
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
@@ -18,7 +18,8 @@ import * as Push from '@/Push';
|
||||
import * as ResponseHelper from '@/ResponseHelper';
|
||||
import * as WebhookHelpers from '@/WebhookHelpers';
|
||||
|
||||
const WEBHOOK_TEST_UNREGISTERED_HINT = `Click the 'Execute workflow' button on the canvas, then try again. (In test mode, the webhook only works for one call after you click this button)`;
|
||||
const WEBHOOK_TEST_UNREGISTERED_HINT =
|
||||
"Click the 'Execute workflow' button on the canvas, then try again. (In test mode, the webhook only works for one call after you click this button)";
|
||||
|
||||
export class TestWebhooks {
|
||||
private testWebhookData: {
|
||||
|
||||
@@ -127,7 +127,7 @@ export function usersNamespace(this: N8nApp): void {
|
||||
const usersToSetUp = Object.keys(createUsers).filter((email) => createUsers[email] === null);
|
||||
const total = usersToSetUp.length;
|
||||
|
||||
Logger.debug(total > 1 ? `Creating ${total} user shells...` : `Creating 1 user shell...`);
|
||||
Logger.debug(total > 1 ? `Creating ${total} user shells...` : 'Creating 1 user shell...');
|
||||
|
||||
try {
|
||||
await Db.transaction(async (transactionManager) => {
|
||||
@@ -156,7 +156,7 @@ export function usersNamespace(this: N8nApp): void {
|
||||
}
|
||||
|
||||
Logger.info('Created user shell(s) successfully', { userId: req.user.id });
|
||||
Logger.verbose(total > 1 ? `${total} user shells created` : `1 user shell created`, {
|
||||
Logger.verbose(total > 1 ? `${total} user shells created` : '1 user shell created', {
|
||||
userShells: createUsers,
|
||||
});
|
||||
|
||||
@@ -200,7 +200,7 @@ export function usersNamespace(this: N8nApp): void {
|
||||
domain: baseUrl,
|
||||
email,
|
||||
});
|
||||
resp.error = `Email could not be sent`;
|
||||
resp.error = 'Email could not be sent';
|
||||
}
|
||||
return resp;
|
||||
}),
|
||||
@@ -211,7 +211,7 @@ export function usersNamespace(this: N8nApp): void {
|
||||
Logger.debug(
|
||||
usersPendingSetup.length > 1
|
||||
? `Sent ${usersPendingSetup.length} invite emails successfully`
|
||||
: `Sent 1 invite email successfully`,
|
||||
: 'Sent 1 invite email successfully',
|
||||
{ userShells: createUsers },
|
||||
);
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ export function executeErrorWorkflow(
|
||||
workflowData.settings.errorWorkflow.toString() === workflowData.id.toString()
|
||||
)
|
||||
) {
|
||||
Logger.verbose(`Start external error workflow`, {
|
||||
Logger.verbose('Start external error workflow', {
|
||||
executionId,
|
||||
errorWorkflowId: workflowData.settings.errorWorkflow.toString(),
|
||||
workflowId: workflowData.id,
|
||||
@@ -177,7 +177,7 @@ export function executeErrorWorkflow(
|
||||
workflowData.id !== undefined &&
|
||||
workflowData.nodes.some((node) => node.type === ERROR_TRIGGER_TYPE)
|
||||
) {
|
||||
Logger.verbose(`Start internal error workflow`, { executionId, workflowId: workflowData.id });
|
||||
Logger.verbose('Start internal error workflow', { executionId, workflowId: workflowData.id });
|
||||
void getWorkflowOwner(workflowData.id).then((user) => {
|
||||
void WorkflowHelpers.executeErrorWorkflow(
|
||||
workflowData.id!.toString(),
|
||||
@@ -293,7 +293,7 @@ function hookFunctionsPush(): IWorkflowExecuteHooks {
|
||||
],
|
||||
workflowExecuteBefore: [
|
||||
async function (this: WorkflowHooks): Promise<void> {
|
||||
Logger.debug(`Executing hook (hookFunctionsPush)`, {
|
||||
Logger.debug('Executing hook (hookFunctionsPush)', {
|
||||
executionId: this.executionId,
|
||||
sessionId: this.sessionId,
|
||||
workflowId: this.workflowData.id,
|
||||
@@ -324,7 +324,7 @@ function hookFunctionsPush(): IWorkflowExecuteHooks {
|
||||
fullRunData: IRun,
|
||||
newStaticData: IDataObject,
|
||||
): Promise<void> {
|
||||
Logger.debug(`Executing hook (hookFunctionsPush)`, {
|
||||
Logger.debug('Executing hook (hookFunctionsPush)', {
|
||||
executionId: this.executionId,
|
||||
sessionId: this.sessionId,
|
||||
workflowId: this.workflowData.id,
|
||||
@@ -490,7 +490,7 @@ function hookFunctionsSave(parentProcessMode?: string): IWorkflowExecuteHooks {
|
||||
fullRunData: IRun,
|
||||
newStaticData: IDataObject,
|
||||
): Promise<void> {
|
||||
Logger.debug(`Executing hook (hookFunctionsSave)`, {
|
||||
Logger.debug('Executing hook (hookFunctionsSave)', {
|
||||
executionId: this.executionId,
|
||||
workflowId: this.workflowData.id,
|
||||
});
|
||||
@@ -830,7 +830,7 @@ export async function getWorkflowData(
|
||||
): Promise<IWorkflowBase> {
|
||||
if (workflowInfo.id === undefined && workflowInfo.code === undefined) {
|
||||
throw new Error(
|
||||
`No information about the workflow to execute found. Please provide either the "id" or "code"!`,
|
||||
'No information about the workflow to execute found. Please provide either the "id" or "code"!',
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ const setupUserManagement = async () => {
|
||||
`INSERT INTO user (id, globalRoleId) values ("${uuid()}", ${instanceOwnerRole[0].insertId})`,
|
||||
);
|
||||
await connection.query(
|
||||
`INSERT INTO "settings" (key, value, loadOnStartup) values ('userManagement.isInstanceOwnerSetUp', 'false', true), ('userManagement.skipInstanceOwnerSetup', 'false', true)`,
|
||||
"INSERT INTO \"settings\" (key, value, loadOnStartup) values ('userManagement.isInstanceOwnerSetUp', 'false', true), ('userManagement.skipInstanceOwnerSetup', 'false', true)",
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ export class DbRevertMigrationCommand extends Command {
|
||||
connection = Db.collections.Credentials.manager.connection;
|
||||
|
||||
if (!connection) {
|
||||
throw new Error(`No database connection available.`);
|
||||
throw new Error('No database connection available.');
|
||||
}
|
||||
|
||||
const connectionOptions: ConnectionOptions = Object.assign(connection.options, {
|
||||
|
||||
@@ -26,7 +26,7 @@ import { findCliWorkflowStart } from '@/utils';
|
||||
export class Execute extends Command {
|
||||
static description = '\nExecutes a given workflow';
|
||||
|
||||
static examples = [`$ n8n execute --id=5`, `$ n8n execute --file=workflow.json`];
|
||||
static examples = ['$ n8n execute --id=5', '$ n8n execute --file=workflow.json'];
|
||||
|
||||
static flags = {
|
||||
help: flags.help({ char: 'h' }),
|
||||
@@ -59,12 +59,12 @@ export class Execute extends Command {
|
||||
const loadNodesAndCredentialsPromise = loadNodesAndCredentials.init();
|
||||
|
||||
if (!flags.id && !flags.file) {
|
||||
console.info(`Either option "--id" or "--file" have to be set!`);
|
||||
console.info('Either option "--id" or "--file" have to be set!');
|
||||
return;
|
||||
}
|
||||
|
||||
if (flags.id && flags.file) {
|
||||
console.info(`Either "id" or "file" can be set never both!`);
|
||||
console.info('Either "id" or "file" can be set never both!');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,12 +58,12 @@ export class ExecuteBatch extends Command {
|
||||
static instanceOwner: User;
|
||||
|
||||
static examples = [
|
||||
`$ n8n executeBatch`,
|
||||
`$ n8n executeBatch --concurrency=10 --skipList=/data/skipList.txt`,
|
||||
`$ n8n executeBatch --debug --output=/data/output.json`,
|
||||
`$ n8n executeBatch --ids=10,13,15 --shortOutput`,
|
||||
`$ n8n executeBatch --snapshot=/data/snapshots --shallow`,
|
||||
`$ n8n executeBatch --compare=/data/previousExecutionData --retries=2`,
|
||||
'$ n8n executeBatch',
|
||||
'$ n8n executeBatch --concurrency=10 --skipList=/data/skipList.txt',
|
||||
'$ n8n executeBatch --debug --output=/data/output.json',
|
||||
'$ n8n executeBatch --ids=10,13,15 --shortOutput',
|
||||
'$ n8n executeBatch --snapshot=/data/snapshots --shallow',
|
||||
'$ n8n executeBatch --compare=/data/previousExecutionData --retries=2',
|
||||
];
|
||||
|
||||
static flags = {
|
||||
@@ -205,11 +205,11 @@ export class ExecuteBatch extends Command {
|
||||
if (flags.snapshot !== undefined) {
|
||||
if (fs.existsSync(flags.snapshot)) {
|
||||
if (!fs.lstatSync(flags.snapshot).isDirectory()) {
|
||||
console.log(`The parameter --snapshot must be an existing directory`);
|
||||
console.log('The parameter --snapshot must be an existing directory');
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
console.log(`The parameter --snapshot must be an existing directory`);
|
||||
console.log('The parameter --snapshot must be an existing directory');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -218,11 +218,11 @@ export class ExecuteBatch extends Command {
|
||||
if (flags.compare !== undefined) {
|
||||
if (fs.existsSync(flags.compare)) {
|
||||
if (!fs.lstatSync(flags.compare).isDirectory()) {
|
||||
console.log(`The parameter --compare must be an existing directory`);
|
||||
console.log('The parameter --compare must be an existing directory');
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
console.log(`The parameter --compare must be an existing directory`);
|
||||
console.log('The parameter --compare must be an existing directory');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ export class ExecuteBatch extends Command {
|
||||
if (flags.output !== undefined) {
|
||||
if (fs.existsSync(flags.output)) {
|
||||
if (fs.lstatSync(flags.output).isDirectory()) {
|
||||
console.log(`The parameter --output must be a writable file`);
|
||||
console.log('The parameter --output must be a writable file');
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -251,7 +251,7 @@ export class ExecuteBatch extends Command {
|
||||
|
||||
if (matchedIds.length === 0) {
|
||||
console.log(
|
||||
`The parameter --ids must be a list of numeric IDs separated by a comma or a file with this content.`,
|
||||
'The parameter --ids must be a list of numeric IDs separated by a comma or a file with this content.',
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -294,11 +294,11 @@ export class ExecuteBatch extends Command {
|
||||
const query = Db.collections.Workflow.createQueryBuilder('workflows');
|
||||
|
||||
if (ids.length > 0) {
|
||||
query.andWhere(`workflows.id in (:...ids)`, { ids });
|
||||
query.andWhere('workflows.id in (:...ids)', { ids });
|
||||
}
|
||||
|
||||
if (skipIds.length > 0) {
|
||||
query.andWhere(`workflows.id not in (:...skipIds)`, { skipIds });
|
||||
query.andWhere('workflows.id not in (:...skipIds)', { skipIds });
|
||||
}
|
||||
|
||||
// eslint-disable-next-line prefer-const
|
||||
|
||||
@@ -18,11 +18,11 @@ export class ExportCredentialsCommand extends Command {
|
||||
static description = 'Export credentials';
|
||||
|
||||
static examples = [
|
||||
`$ n8n export:credentials --all`,
|
||||
`$ n8n export:credentials --id=5 --output=file.json`,
|
||||
`$ n8n export:credentials --all --output=backups/latest.json`,
|
||||
`$ n8n export:credentials --backup --output=backups/latest/`,
|
||||
`$ n8n export:credentials --all --decrypted --output=backups/decrypted.json`,
|
||||
'$ n8n export:credentials --all',
|
||||
'$ n8n export:credentials --id=5 --output=file.json',
|
||||
'$ n8n export:credentials --all --output=backups/latest.json',
|
||||
'$ n8n export:credentials --backup --output=backups/latest/',
|
||||
'$ n8n export:credentials --all --decrypted --output=backups/decrypted.json',
|
||||
];
|
||||
|
||||
static flags = {
|
||||
@@ -69,25 +69,25 @@ export class ExportCredentialsCommand extends Command {
|
||||
}
|
||||
|
||||
if (!flags.all && !flags.id) {
|
||||
console.info(`Either option "--all" or "--id" have to be set!`);
|
||||
console.info('Either option "--all" or "--id" have to be set!');
|
||||
return;
|
||||
}
|
||||
|
||||
if (flags.all && flags.id) {
|
||||
console.info(`You should either use "--all" or "--id" but never both!`);
|
||||
console.info('You should either use "--all" or "--id" but never both!');
|
||||
return;
|
||||
}
|
||||
|
||||
if (flags.separate) {
|
||||
try {
|
||||
if (!flags.output) {
|
||||
console.info(`You must inform an output directory via --output when using --separate`);
|
||||
console.info('You must inform an output directory via --output when using --separate');
|
||||
return;
|
||||
}
|
||||
|
||||
if (fs.existsSync(flags.output)) {
|
||||
if (!fs.lstatSync(flags.output).isDirectory()) {
|
||||
console.info(`The parameter --output must be a directory`);
|
||||
console.info('The parameter --output must be a directory');
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@@ -106,7 +106,7 @@ export class ExportCredentialsCommand extends Command {
|
||||
} else if (flags.output) {
|
||||
if (fs.existsSync(flags.output)) {
|
||||
if (fs.lstatSync(flags.output).isDirectory()) {
|
||||
console.info(`The parameter --output must be a writeable file`);
|
||||
console.info('The parameter --output must be a writeable file');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,10 +14,10 @@ export class ExportWorkflowsCommand extends Command {
|
||||
static description = 'Export workflows';
|
||||
|
||||
static examples = [
|
||||
`$ n8n export:workflow --all`,
|
||||
`$ n8n export:workflow --id=5 --output=file.json`,
|
||||
`$ n8n export:workflow --all --output=backups/latest/`,
|
||||
`$ n8n export:workflow --backup --output=backups/latest/`,
|
||||
'$ n8n export:workflow --all',
|
||||
'$ n8n export:workflow --id=5 --output=file.json',
|
||||
'$ n8n export:workflow --all --output=backups/latest/',
|
||||
'$ n8n export:workflow --backup --output=backups/latest/',
|
||||
];
|
||||
|
||||
static flags = {
|
||||
@@ -60,25 +60,25 @@ export class ExportWorkflowsCommand extends Command {
|
||||
}
|
||||
|
||||
if (!flags.all && !flags.id) {
|
||||
console.info(`Either option "--all" or "--id" have to be set!`);
|
||||
console.info('Either option "--all" or "--id" have to be set!');
|
||||
return;
|
||||
}
|
||||
|
||||
if (flags.all && flags.id) {
|
||||
console.info(`You should either use "--all" or "--id" but never both!`);
|
||||
console.info('You should either use "--all" or "--id" but never both!');
|
||||
return;
|
||||
}
|
||||
|
||||
if (flags.separate) {
|
||||
try {
|
||||
if (!flags.output) {
|
||||
console.info(`You must inform an output directory via --output when using --separate`);
|
||||
console.info('You must inform an output directory via --output when using --separate');
|
||||
return;
|
||||
}
|
||||
|
||||
if (fs.existsSync(flags.output)) {
|
||||
if (!fs.lstatSync(flags.output).isDirectory()) {
|
||||
console.info(`The parameter --output must be a directory`);
|
||||
console.info('The parameter --output must be a directory');
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@@ -97,7 +97,7 @@ export class ExportWorkflowsCommand extends Command {
|
||||
} else if (flags.output) {
|
||||
if (fs.existsSync(flags.output)) {
|
||||
if (fs.lstatSync(flags.output).isDirectory()) {
|
||||
console.info(`The parameter --output must be a writeable file`);
|
||||
console.info('The parameter --output must be a writeable file');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import { SETTINGS_LICENSE_CERT_KEY } from '@/constants';
|
||||
export class ClearLicenseCommand extends Command {
|
||||
static description = 'Clear license';
|
||||
|
||||
static examples = [`$ n8n clear:license`];
|
||||
static examples = ['$ n8n clear:license'];
|
||||
|
||||
async run() {
|
||||
const logger = getLogger();
|
||||
|
||||
@@ -55,10 +55,10 @@ export class Start extends Command {
|
||||
static description = 'Starts n8n. Makes Web-UI available and starts active workflows';
|
||||
|
||||
static examples = [
|
||||
`$ n8n start`,
|
||||
`$ n8n start --tunnel`,
|
||||
`$ n8n start -o`,
|
||||
`$ n8n start --tunnel -o`,
|
||||
'$ n8n start',
|
||||
'$ n8n start --tunnel',
|
||||
'$ n8n start -o',
|
||||
'$ n8n start --tunnel -o',
|
||||
];
|
||||
|
||||
static flags = {
|
||||
@@ -117,7 +117,7 @@ export class Start extends Command {
|
||||
setTimeout(() => {
|
||||
// In case that something goes wrong with shutdown we
|
||||
// kill after max. 30 seconds no matter what
|
||||
console.log(`process exited after 30s`);
|
||||
console.log('process exited after 30s');
|
||||
exit();
|
||||
}, 30000);
|
||||
|
||||
@@ -499,7 +499,7 @@ export class Start extends Command {
|
||||
if (flags.open) {
|
||||
Start.openBrowser();
|
||||
}
|
||||
this.log(`\nPress "o" to open in Browser.`);
|
||||
this.log('\nPress "o" to open in Browser.');
|
||||
process.stdin.on('data', (key: string) => {
|
||||
if (key === 'o') {
|
||||
Start.openBrowser();
|
||||
|
||||
@@ -13,8 +13,8 @@ export class UpdateWorkflowCommand extends Command {
|
||||
static description = 'Update workflows';
|
||||
|
||||
static examples = [
|
||||
`$ n8n update:workflow --all --active=false`,
|
||||
`$ n8n update:workflow --id=5 --active=true`,
|
||||
'$ n8n update:workflow --all --active=false',
|
||||
'$ n8n update:workflow --id=5 --active=true',
|
||||
];
|
||||
|
||||
static flags = {
|
||||
@@ -39,24 +39,24 @@ export class UpdateWorkflowCommand extends Command {
|
||||
const { flags } = this.parse(UpdateWorkflowCommand);
|
||||
|
||||
if (!flags.all && !flags.id) {
|
||||
console.info(`Either option "--all" or "--id" have to be set!`);
|
||||
console.info('Either option "--all" or "--id" have to be set!');
|
||||
return;
|
||||
}
|
||||
|
||||
if (flags.all && flags.id) {
|
||||
console.info(
|
||||
`Either something else on top should be "--all" or "--id" can be set never both!`,
|
||||
'Either something else on top should be "--all" or "--id" can be set never both!',
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const updateQuery: IDataObject = {};
|
||||
if (flags.active === undefined) {
|
||||
console.info(`No update flag like "--active=true" has been set!`);
|
||||
console.info('No update flag like "--active=true" has been set!');
|
||||
return;
|
||||
}
|
||||
if (!['false', 'true'].includes(flags.active)) {
|
||||
console.info(`Valid values for flag "--active" are only "false" or "true"!`);
|
||||
console.info('Valid values for flag "--active" are only "false" or "true"!');
|
||||
return;
|
||||
}
|
||||
updateQuery.active = flags.active === 'true';
|
||||
|
||||
@@ -31,7 +31,7 @@ let processExitCode = 0;
|
||||
export class Webhook extends Command {
|
||||
static description = 'Starts n8n webhook process. Intercepts only production URLs.';
|
||||
|
||||
static examples = [`$ n8n webhook`];
|
||||
static examples = ['$ n8n webhook'];
|
||||
|
||||
static flags = {
|
||||
help: flags.help({ char: 'h' }),
|
||||
@@ -44,7 +44,7 @@ export class Webhook extends Command {
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
||||
static async stopProcess() {
|
||||
LoggerProxy.info(`\nStopping n8n...`);
|
||||
LoggerProxy.info('\nStopping n8n...');
|
||||
|
||||
const exit = () => {
|
||||
CrashJournal.cleanup().finally(() => {
|
||||
|
||||
@@ -47,7 +47,7 @@ import { generateFailedExecutionFromError } from '@/WorkflowHelpers';
|
||||
export class Worker extends Command {
|
||||
static description = '\nStarts a n8n worker';
|
||||
|
||||
static examples = [`$ n8n worker --concurrency=5`];
|
||||
static examples = ['$ n8n worker --concurrency=5'];
|
||||
|
||||
static flags = {
|
||||
help: flags.help({ char: 'h' }),
|
||||
@@ -72,7 +72,7 @@ export class Worker extends Command {
|
||||
* get removed.
|
||||
*/
|
||||
static async stopProcess() {
|
||||
LoggerProxy.info(`Stopping n8n...`);
|
||||
LoggerProxy.info('Stopping n8n...');
|
||||
|
||||
// Stop accepting new jobs
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
|
||||
@@ -833,7 +833,7 @@ export const schema = {
|
||||
env: 'N8N_VERSION_NOTIFICATIONS_ENDPOINT',
|
||||
},
|
||||
infoUrl: {
|
||||
doc: `Url in New Versions Panel with more information on updating one's instance.`,
|
||||
doc: "Url in New Versions Panel with more information on updating one's instance.",
|
||||
format: String,
|
||||
default: 'https://docs.n8n.io/getting-started/installation/updating.html',
|
||||
env: 'N8N_VERSION_NOTIFICATIONS_INFO_URL',
|
||||
|
||||
@@ -60,7 +60,7 @@ EECredentialsController.get(
|
||||
const includeDecryptedData = req.query.includeData === 'true';
|
||||
|
||||
if (Number.isNaN(Number(credentialId))) {
|
||||
throw new ResponseHelper.BadRequestError(`Credential ID must be a number.`);
|
||||
throw new ResponseHelper.BadRequestError('Credential ID must be a number.');
|
||||
}
|
||||
|
||||
let credential = (await EECredentials.get(
|
||||
@@ -77,7 +77,7 @@ EECredentialsController.get(
|
||||
const userSharing = credential.shared?.find((shared) => shared.user.id === req.user.id);
|
||||
|
||||
if (!userSharing && req.user.globalRole.name !== 'owner') {
|
||||
throw new ResponseHelper.UnauthorizedError(`Forbidden.`);
|
||||
throw new ResponseHelper.UnauthorizedError('Forbidden.');
|
||||
}
|
||||
|
||||
credential = EECredentials.addOwnerAndSharings(credential);
|
||||
@@ -124,7 +124,7 @@ EECredentialsController.post(
|
||||
const sharing = await EECredentials.getSharing(req.user, credentials.id);
|
||||
if (!ownsCredential) {
|
||||
if (!sharing) {
|
||||
throw new ResponseHelper.UnauthorizedError(`Forbidden`);
|
||||
throw new ResponseHelper.UnauthorizedError('Forbidden');
|
||||
}
|
||||
|
||||
const decryptedData = await EECredentials.decrypt(encryptionKey, sharing.credentials);
|
||||
|
||||
@@ -75,7 +75,7 @@ credentialsController.get(
|
||||
const includeDecryptedData = req.query.includeData === 'true';
|
||||
|
||||
if (Number.isNaN(Number(credentialId))) {
|
||||
throw new ResponseHelper.BadRequestError(`Credential ID must be a number.`);
|
||||
throw new ResponseHelper.BadRequestError('Credential ID must be a number.');
|
||||
}
|
||||
|
||||
const sharing = await CredentialsService.getSharing(req.user, credentialId, ['credentials']);
|
||||
|
||||
@@ -5,7 +5,7 @@ import config from '@/config';
|
||||
const dbType = config.getEnv('database.type');
|
||||
|
||||
const timestampSyntax = {
|
||||
sqlite: `STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW')`,
|
||||
sqlite: "STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW')",
|
||||
postgresdb: 'CURRENT_TIMESTAMP(3)',
|
||||
mysqldb: 'CURRENT_TIMESTAMP(3)',
|
||||
mariadb: 'CURRENT_TIMESTAMP(3)',
|
||||
|
||||
@@ -155,7 +155,7 @@ export class ExecutionsService {
|
||||
filter: req.query.filter,
|
||||
});
|
||||
throw new ResponseHelper.InternalServerError(
|
||||
`Parameter "filter" contained invalid JSON string.`,
|
||||
'Parameter "filter" contained invalid JSON string.',
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -211,7 +211,7 @@ export class ExecutionsService {
|
||||
}
|
||||
|
||||
if (executingWorkflowIds.length > 0) {
|
||||
rangeQuery.push(`id NOT IN (:...executingWorkflowIds)`);
|
||||
rangeQuery.push('id NOT IN (:...executingWorkflowIds)');
|
||||
rangeQueryParams.executingWorkflowIds = executingWorkflowIds;
|
||||
}
|
||||
|
||||
@@ -440,7 +440,7 @@ export class ExecutionsService {
|
||||
}
|
||||
} catch (error) {
|
||||
throw new ResponseHelper.InternalServerError(
|
||||
`Parameter "filter" contained invalid JSON string.`,
|
||||
'Parameter "filter" contained invalid JSON string.',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ workflowsController.get(
|
||||
* GET /workflows/new
|
||||
*/
|
||||
workflowsController.get(
|
||||
`/new`,
|
||||
'/new',
|
||||
ResponseHelper.send(async (req: WorkflowRequest.NewName) => {
|
||||
const requestedName =
|
||||
req.query.name && req.query.name !== ''
|
||||
@@ -148,14 +148,14 @@ workflowsController.get(
|
||||
* GET /workflows/from-url
|
||||
*/
|
||||
workflowsController.get(
|
||||
`/from-url`,
|
||||
'/from-url',
|
||||
ResponseHelper.send(async (req: express.Request): Promise<IWorkflowResponse> => {
|
||||
if (req.query.url === undefined) {
|
||||
throw new ResponseHelper.BadRequestError(`The parameter "url" is missing!`);
|
||||
throw new ResponseHelper.BadRequestError('The parameter "url" is missing!');
|
||||
}
|
||||
if (!/^http[s]?:\/\/.*\.json$/i.exec(req.query.url as string)) {
|
||||
throw new ResponseHelper.BadRequestError(
|
||||
`The parameter "url" is not valid! It does not seem to be a URL pointing to a n8n workflow JSON file.`,
|
||||
'The parameter "url" is not valid! It does not seem to be a URL pointing to a n8n workflow JSON file.',
|
||||
);
|
||||
}
|
||||
let workflowData: IWorkflowResponse | undefined;
|
||||
@@ -163,7 +163,7 @@ workflowsController.get(
|
||||
const { data } = await axios.get<IWorkflowResponse>(req.query.url as string);
|
||||
workflowData = data;
|
||||
} catch (error) {
|
||||
throw new ResponseHelper.BadRequestError(`The URL does not point to valid JSON file!`);
|
||||
throw new ResponseHelper.BadRequestError('The URL does not point to valid JSON file!');
|
||||
}
|
||||
|
||||
// Do a very basic check if it is really a n8n-workflow-json
|
||||
@@ -176,7 +176,7 @@ workflowsController.get(
|
||||
Array.isArray(workflowData.connections)
|
||||
) {
|
||||
throw new ResponseHelper.BadRequestError(
|
||||
`The data in the file does not seem to be a n8n workflow JSON file!`,
|
||||
'The data in the file does not seem to be a n8n workflow JSON file!',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ workflowsController.get(
|
||||
* PATCH /workflows/:id
|
||||
*/
|
||||
workflowsController.patch(
|
||||
`/:id`,
|
||||
'/:id',
|
||||
ResponseHelper.send(async (req: WorkflowRequest.Update) => {
|
||||
const { id: workflowId } = req.params;
|
||||
|
||||
@@ -253,7 +253,7 @@ workflowsController.patch(
|
||||
* DELETE /workflows/:id
|
||||
*/
|
||||
workflowsController.delete(
|
||||
`/:id`,
|
||||
'/:id',
|
||||
ResponseHelper.send(async (req: WorkflowRequest.Delete) => {
|
||||
const { id: workflowId } = req.params;
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ export class WorkflowsService {
|
||||
filter,
|
||||
});
|
||||
throw new ResponseHelper.InternalServerError(
|
||||
`Parameter "filter" contained invalid JSON string.`,
|
||||
'Parameter "filter" contained invalid JSON string.',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user