mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
n8n-3867-progressively-apply-prettier-to-all (#3873)
* 🔨 formatting nodes with prettier
This commit is contained in:
@@ -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!`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user