n8n-3867-progressively-apply-prettier-to-all (#3873)

* 🔨 formatting nodes with prettier
This commit is contained in:
Michael Kret
2022-08-17 18:50:24 +03:00
committed by GitHub
parent f2d326c7f0
commit 91d7e16c81
1072 changed files with 42357 additions and 59109 deletions

View File

@@ -1,6 +1,4 @@
import {
IExecuteFunctions,
} from 'n8n-core';
import { IExecuteFunctions } from 'n8n-core';
import {
IDataObject,
@@ -8,23 +6,18 @@ import {
INodeType,
INodeTypeDescription,
JsonObject,
NodeOperationError
NodeOperationError,
} from 'n8n-workflow';
import {
nodeDescription,
} from './mongo.node.options';
import { nodeDescription } from './mongo.node.options';
import {
MongoClient,
ObjectID,
} from 'mongodb';
import { MongoClient, ObjectID } from 'mongodb';
import {
getItemCopy,
handleDateFields,
handleDateFieldsWithDotNotation,
validateAndResolveMongoCredentials
validateAndResolveMongoCredentials,
} from './mongo.node.utils';
export class MongoDb implements INodeType {
@@ -69,7 +62,7 @@ export class MongoDb implements INodeType {
returnItems = this.helpers.returnJsonArray(queryResult as IDataObject[]);
} catch (error) {
if (this.continueOnFail()) {
returnItems = this.helpers.returnJsonArray({ error: (error as JsonObject).message } );
returnItems = this.helpers.returnJsonArray({ error: (error as JsonObject).message });
} else {
throw error;
}
@@ -92,7 +85,6 @@ export class MongoDb implements INodeType {
throw error;
}
}
} else if (operation === 'find') {
// ----------------------------------
// find
@@ -127,7 +119,7 @@ export class MongoDb implements INodeType {
returnItems = this.helpers.returnJsonArray(queryResult as IDataObject[]);
} catch (error) {
if (this.continueOnFail()) {
returnItems = this.helpers.returnJsonArray({ error: (error as JsonObject).message } );
returnItems = this.helpers.returnJsonArray({ error: (error as JsonObject).message });
} else {
throw error;
}
@@ -140,8 +132,8 @@ export class MongoDb implements INodeType {
// Prepare the data to insert and copy it to be returned
const fields = (this.getNodeParameter('fields', 0) as string)
.split(',')
.map(f => f.trim())
.filter(f => !!f);
.map((f) => f.trim())
.filter((f) => !!f);
const options = this.getNodeParameter('options', 0) as IDataObject;
const insertItems = getItemCopy(items, fields);
@@ -179,8 +171,8 @@ export class MongoDb implements INodeType {
const fields = (this.getNodeParameter('fields', 0) as string)
.split(',')
.map(f => f.trim())
.filter(f => !!f);
.map((f) => f.trim())
.filter((f) => !!f);
const options = this.getNodeParameter('options', 0) as IDataObject;
@@ -188,7 +180,8 @@ export class MongoDb implements INodeType {
updateKey = updateKey.trim();
const updateOptions = (this.getNodeParameter('upsert', 0) as boolean)
? { upsert: true } : undefined;
? { upsert: true }
: undefined;
if (!fields.includes(updateKey)) {
fields.push(updateKey);
@@ -229,9 +222,14 @@ export class MongoDb implements INodeType {
returnItems = this.helpers.returnJsonArray(updateItems as IDataObject[]);
} else {
if (this.continueOnFail()) {
returnItems = this.helpers.returnJsonArray({ json: { error: `The operation "${operation}" is not supported!` } });
returnItems = this.helpers.returnJsonArray({
json: { error: `The operation "${operation}" is not supported!` },
});
} else {
throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not supported!`);
throw new NodeOperationError(
this.getNode(),
`The operation "${operation}" is not supported!`,
);
}
}