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,
@@ -10,10 +8,7 @@ import {
NodeOperationError,
} from 'n8n-workflow';
import {
hackerNewsApiRequest,
hackerNewsApiRequestAllItems,
} from './GenericFunctions';
import { hackerNewsApiRequest, hackerNewsApiRequestAllItems } from './GenericFunctions';
export class HackerNews implements INodeType {
description: INodeTypeDescription = {
@@ -56,7 +51,6 @@ export class HackerNews implements INodeType {
default: 'article',
},
// ----------------------------------
// Operations
// ----------------------------------
@@ -67,9 +61,7 @@ export class HackerNews implements INodeType {
noDataExpression: true,
displayOptions: {
show: {
resource: [
'all',
],
resource: ['all'],
},
},
options: [
@@ -89,9 +81,7 @@ export class HackerNews implements INodeType {
noDataExpression: true,
displayOptions: {
show: {
resource: [
'article',
],
resource: ['article'],
},
},
options: [
@@ -111,9 +101,7 @@ export class HackerNews implements INodeType {
noDataExpression: true,
displayOptions: {
show: {
resource: [
'user',
],
resource: ['user'],
},
},
options: [
@@ -138,12 +126,8 @@ export class HackerNews implements INodeType {
description: 'The ID of the Hacker News article to be returned',
displayOptions: {
show: {
resource: [
'article',
],
operation: [
'get',
],
resource: ['article'],
operation: ['get'],
},
},
},
@@ -156,12 +140,8 @@ export class HackerNews implements INodeType {
description: 'The Hacker News user to be returned',
displayOptions: {
show: {
resource: [
'user',
],
operation: [
'get',
],
resource: ['user'],
operation: ['get'],
},
},
},
@@ -173,12 +153,8 @@ export class HackerNews implements INodeType {
description: 'Whether to return all results or only up to a given limit',
displayOptions: {
show: {
resource: [
'all',
],
operation: [
'getAll',
],
resource: ['all'],
operation: ['getAll'],
},
},
},
@@ -193,15 +169,9 @@ export class HackerNews implements INodeType {
description: 'Max number of results to return',
displayOptions: {
show: {
resource: [
'all',
],
operation: [
'getAll',
],
returnAll: [
false,
],
resource: ['all'],
operation: ['getAll'],
returnAll: [false],
},
},
},
@@ -213,12 +183,8 @@ export class HackerNews implements INodeType {
default: {},
displayOptions: {
show: {
resource: [
'article',
],
operation: [
'get',
],
resource: ['article'],
operation: ['get'],
},
},
options: [
@@ -239,12 +205,8 @@ export class HackerNews implements INodeType {
default: {},
displayOptions: {
show: {
resource: [
'all',
],
operation: [
'getAll',
],
resource: ['all'],
operation: ['getAll'],
},
},
options: [
@@ -299,7 +261,6 @@ export class HackerNews implements INodeType {
],
};
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const items = this.getInputData();
const returnData: IDataObject[] = [];
@@ -316,7 +277,6 @@ export class HackerNews implements INodeType {
if (resource === 'all') {
if (operation === 'getAll') {
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
const keyword = additionalFields.keyword as string;
const tags = additionalFields.tags as string[];
@@ -333,36 +293,41 @@ export class HackerNews implements INodeType {
}
endpoint = 'search?';
} else {
throw new NodeOperationError(this.getNode(), `The operation '${operation}' is unknown!`, { itemIndex: i });
throw new NodeOperationError(
this.getNode(),
`The operation '${operation}' is unknown!`,
{ itemIndex: i },
);
}
} else if (resource === 'article') {
if (operation === 'get') {
endpoint = `items/${this.getNodeParameter('articleId', i)}`;
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
includeComments = additionalFields.includeComments as boolean;
} else {
throw new NodeOperationError(this.getNode(), `The operation '${operation}' is unknown!`, { itemIndex: i });
throw new NodeOperationError(
this.getNode(),
`The operation '${operation}' is unknown!`,
{ itemIndex: i },
);
}
} else if (resource === 'user') {
if (operation === 'get') {
endpoint = `users/${this.getNodeParameter('username', i)}`;
} else {
throw new NodeOperationError(this.getNode(), `The operation '${operation}' is unknown!`, { itemIndex: i });
throw new NodeOperationError(
this.getNode(),
`The operation '${operation}' is unknown!`,
{ itemIndex: i },
);
}
} else {
throw new NodeOperationError(this.getNode(), `The resource '${resource}' is unknown!`, { itemIndex: i });
throw new NodeOperationError(this.getNode(), `The resource '${resource}' is unknown!`, {
itemIndex: i,
});
}
let responseData;
if (returnAll === true) {
responseData = await hackerNewsApiRequestAllItems.call(this, 'GET', endpoint, qs);
@@ -392,6 +357,5 @@ export class HackerNews implements INodeType {
}
return [this.helpers.returnJsonArray(returnData)];
}
}