mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
n8n-3867-progressively-apply-prettier-to-all (#3873)
* 🔨 formatting nodes with prettier
This commit is contained in:
@@ -9,10 +9,7 @@ import {
|
||||
|
||||
import pgPromise from 'pg-promise';
|
||||
|
||||
import {
|
||||
pgInsert,
|
||||
pgQuery,
|
||||
} from '../Postgres/Postgres.node.functions';
|
||||
import { pgInsert, pgQuery } from '../Postgres/Postgres.node.functions';
|
||||
|
||||
export class QuestDb implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
@@ -69,15 +66,14 @@ export class QuestDb implements INodeType {
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'executeQuery',
|
||||
],
|
||||
operation: ['executeQuery'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
placeholder: 'SELECT id, name FROM product WHERE quantity > $1 AND price <= $2',
|
||||
required: true,
|
||||
description: 'The SQL query to execute. You can use n8n expressions or $1 and $2 in conjunction with query parameters.',
|
||||
description:
|
||||
'The SQL query to execute. You can use n8n expressions or $1 and $2 in conjunction with query parameters.',
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
@@ -89,9 +85,7 @@ export class QuestDb implements INodeType {
|
||||
type: 'hidden', // Schema is used by pgInsert
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'insert',
|
||||
],
|
||||
operation: ['insert'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -103,9 +97,7 @@ export class QuestDb implements INodeType {
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'insert',
|
||||
],
|
||||
operation: ['insert'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -123,7 +115,8 @@ export class QuestDb implements INodeType {
|
||||
},
|
||||
default: '',
|
||||
placeholder: 'id,name,description',
|
||||
description: 'Comma-separated list of the properties which should used as columns for the new rows',
|
||||
description:
|
||||
'Comma-separated list of the properties which should used as columns for the new rows',
|
||||
},
|
||||
{
|
||||
displayName: 'Return Fields',
|
||||
@@ -148,9 +141,7 @@ export class QuestDb implements INodeType {
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'executeQuery',
|
||||
],
|
||||
operation: ['executeQuery'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -171,7 +162,8 @@ export class QuestDb implements INodeType {
|
||||
},
|
||||
],
|
||||
default: 'independently',
|
||||
description: 'The way queries should be sent to database. Can be used in conjunction with <b>Continue on Fail</b>. See <a href="https://docs.n8n.io/nodes/n8n-nodes-base.questDb/">the docs</a> for more examples.',
|
||||
description:
|
||||
'The way queries should be sent to database. Can be used in conjunction with <b>Continue on Fail</b>. See <a href="https://docs.n8n.io/nodes/n8n-nodes-base.questDb/">the docs</a> for more examples.',
|
||||
},
|
||||
{
|
||||
displayName: 'Query Parameters',
|
||||
@@ -179,14 +171,13 @@ export class QuestDb implements INodeType {
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
'/operation': [
|
||||
'executeQuery',
|
||||
],
|
||||
'/operation': ['executeQuery'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
placeholder: 'quantity,price',
|
||||
description: 'Comma-separated list of properties which should be used as query parameters',
|
||||
description:
|
||||
'Comma-separated list of properties which should be used as query parameters',
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -197,9 +188,7 @@ export class QuestDb implements INodeType {
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'insert',
|
||||
],
|
||||
operation: ['insert'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -236,7 +225,14 @@ export class QuestDb implements INodeType {
|
||||
const additionalFields = this.getNodeParameter('additionalFields', 0) as IDataObject;
|
||||
const mode = (additionalFields.mode || 'independently') as string;
|
||||
|
||||
const queryResult = await pgQuery(this.getNodeParameter, pgp, db, items, this.continueOnFail(), mode);
|
||||
const queryResult = await pgQuery(
|
||||
this.getNodeParameter,
|
||||
pgp,
|
||||
db,
|
||||
items,
|
||||
this.continueOnFail(),
|
||||
mode,
|
||||
);
|
||||
|
||||
returnItems = this.helpers.returnJsonArray(queryResult);
|
||||
} else if (operation === 'insert') {
|
||||
@@ -252,14 +248,20 @@ export class QuestDb implements INodeType {
|
||||
const table = this.getNodeParameter('table', 0) as string;
|
||||
|
||||
const insertData = await db.any('SELECT ${columns:name} from ${table:name}', {
|
||||
columns: returnFields.split(',').map(value => value.trim()).filter(value => !!value),
|
||||
columns: returnFields
|
||||
.split(',')
|
||||
.map((value) => value.trim())
|
||||
.filter((value) => !!value),
|
||||
table,
|
||||
});
|
||||
|
||||
returnItems = this.helpers.returnJsonArray(insertData);
|
||||
} else {
|
||||
await pgp.end();
|
||||
throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not supported!`);
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
`The operation "${operation}" is not supported!`,
|
||||
);
|
||||
}
|
||||
|
||||
// Close the connection
|
||||
|
||||
Reference in New Issue
Block a user