mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
refactor: Format nodes-base package (A-F) (#3800)
* 🔨 prettier formated nodes - A * 🔨 prettier formated nodes - B * ⚡ prettier formated nodes - C * ⚡ prettier formated nodes - D * ⚡ prettier formated nodes - E-F * 🎨 Adjust nodes-base formatting command (#3805) * Format additional files in nodes A-F (#3811) * ⚡ fixes * 🎨 Add Mindee to ignored dirs Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
@@ -11,7 +9,6 @@ import {
|
||||
|
||||
import { disqusApiRequest, disqusApiRequestAllItems } from './GenericFunctions';
|
||||
|
||||
|
||||
export class Disqus implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'Disqus',
|
||||
@@ -58,9 +55,7 @@ export class Disqus implements INodeType {
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'forum',
|
||||
],
|
||||
resource: ['forum'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -103,12 +98,8 @@ export class Disqus implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
resource: [
|
||||
'forum',
|
||||
],
|
||||
operation: ['get'],
|
||||
resource: ['forum'],
|
||||
},
|
||||
},
|
||||
description: 'The short name(aka ID) of the forum to get',
|
||||
@@ -120,12 +111,8 @@ export class Disqus implements INodeType {
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
resource: [
|
||||
'forum',
|
||||
],
|
||||
operation: ['get'],
|
||||
resource: ['forum'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -201,12 +188,8 @@ export class Disqus implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getPosts',
|
||||
],
|
||||
resource: [
|
||||
'forum',
|
||||
],
|
||||
operation: ['getPosts'],
|
||||
resource: ['forum'],
|
||||
},
|
||||
},
|
||||
description: 'The short name(aka ID) of the forum to get',
|
||||
@@ -217,12 +200,8 @@ export class Disqus implements INodeType {
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'forum',
|
||||
],
|
||||
operation: [
|
||||
'getPosts',
|
||||
],
|
||||
resource: ['forum'],
|
||||
operation: ['getPosts'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
@@ -234,15 +213,9 @@ export class Disqus implements INodeType {
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'forum',
|
||||
],
|
||||
operation: [
|
||||
'getPosts',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
resource: ['forum'],
|
||||
operation: ['getPosts'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
@@ -259,12 +232,8 @@ export class Disqus implements INodeType {
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getPosts',
|
||||
],
|
||||
resource: [
|
||||
'forum',
|
||||
],
|
||||
operation: ['getPosts'],
|
||||
resource: ['forum'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -393,12 +362,8 @@ export class Disqus implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getCategories',
|
||||
],
|
||||
resource: [
|
||||
'forum',
|
||||
],
|
||||
operation: ['getCategories'],
|
||||
resource: ['forum'],
|
||||
},
|
||||
},
|
||||
description: 'The short name(aka ID) of the forum to get Categories',
|
||||
@@ -409,12 +374,8 @@ export class Disqus implements INodeType {
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'forum',
|
||||
],
|
||||
operation: [
|
||||
'getCategories',
|
||||
],
|
||||
resource: ['forum'],
|
||||
operation: ['getCategories'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
@@ -426,15 +387,9 @@ export class Disqus implements INodeType {
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'forum',
|
||||
],
|
||||
operation: [
|
||||
'getCategories',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
resource: ['forum'],
|
||||
operation: ['getCategories'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
@@ -451,12 +406,8 @@ export class Disqus implements INodeType {
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getCategories',
|
||||
],
|
||||
resource: [
|
||||
'forum',
|
||||
],
|
||||
operation: ['getCategories'],
|
||||
resource: ['forum'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -492,12 +443,8 @@ export class Disqus implements INodeType {
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getThreads',
|
||||
],
|
||||
resource: [
|
||||
'forum',
|
||||
],
|
||||
operation: ['getThreads'],
|
||||
resource: ['forum'],
|
||||
},
|
||||
},
|
||||
description: 'The short name(aka ID) of the forum to get Threads',
|
||||
@@ -508,12 +455,8 @@ export class Disqus implements INodeType {
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'forum',
|
||||
],
|
||||
operation: [
|
||||
'getThreads',
|
||||
],
|
||||
resource: ['forum'],
|
||||
operation: ['getThreads'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
@@ -525,15 +468,9 @@ export class Disqus implements INodeType {
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'forum',
|
||||
],
|
||||
operation: [
|
||||
'getThreads',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
resource: ['forum'],
|
||||
operation: ['getThreads'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
@@ -550,12 +487,8 @@ export class Disqus implements INodeType {
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getThreads',
|
||||
],
|
||||
resource: [
|
||||
'forum',
|
||||
],
|
||||
operation: ['getThreads'],
|
||||
resource: ['forum'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -627,19 +560,18 @@ export class Disqus implements INodeType {
|
||||
name: 'threadId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Looks up a thread by ID. You may pass us the "ident" query type instead of an ID by including "forum". You may pass us the "link" query type to filter by URL. You must pass the "forum" if you do not have the Pro API Access addon.',
|
||||
description:
|
||||
'Looks up a thread by ID. You may pass us the "ident" query type instead of an ID by including "forum". You may pass us the "link" query type to filter by URL. You must pass the "forum" if you do not have the Pro API Access addon.',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
|
||||
|
||||
const resource = this.getNodeParameter('resource', 0) as string;
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
|
||||
@@ -648,7 +580,6 @@ export class Disqus implements INodeType {
|
||||
let body: IDataObject | Buffer;
|
||||
let qs: IDataObject;
|
||||
|
||||
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
try {
|
||||
body = {};
|
||||
@@ -677,7 +608,6 @@ export class Disqus implements INodeType {
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
} else if (operation === 'getPosts') {
|
||||
// ----------------------------------
|
||||
// getPosts
|
||||
@@ -698,8 +628,13 @@ export class Disqus implements INodeType {
|
||||
|
||||
try {
|
||||
let responseData: IDataObject = {};
|
||||
if(returnAll) {
|
||||
responseData.response = await disqusApiRequestAllItems.call(this, requestMethod, qs, endpoint);
|
||||
if (returnAll) {
|
||||
responseData.response = await disqusApiRequestAllItems.call(
|
||||
this,
|
||||
requestMethod,
|
||||
qs,
|
||||
endpoint,
|
||||
);
|
||||
} else {
|
||||
const limit = this.getNodeParameter('limit', i) as string;
|
||||
qs.limit = limit;
|
||||
@@ -709,8 +644,7 @@ export class Disqus implements INodeType {
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
} else if (operation === 'getCategories') {
|
||||
} else if (operation === 'getCategories') {
|
||||
// ----------------------------------
|
||||
// getCategories
|
||||
// ----------------------------------
|
||||
@@ -730,19 +664,28 @@ export class Disqus implements INodeType {
|
||||
try {
|
||||
let responseData: IDataObject = {};
|
||||
|
||||
if(returnAll) {
|
||||
responseData.response = await disqusApiRequestAllItems.call(this, requestMethod, qs, endpoint);
|
||||
if (returnAll) {
|
||||
responseData.response = await disqusApiRequestAllItems.call(
|
||||
this,
|
||||
requestMethod,
|
||||
qs,
|
||||
endpoint,
|
||||
);
|
||||
} else {
|
||||
const limit = this.getNodeParameter('limit', i) as string;
|
||||
qs.limit = limit;
|
||||
responseData = await disqusApiRequest.call(this, requestMethod, qs, endpoint) as IDataObject;
|
||||
responseData = (await disqusApiRequest.call(
|
||||
this,
|
||||
requestMethod,
|
||||
qs,
|
||||
endpoint,
|
||||
)) as IDataObject;
|
||||
}
|
||||
returnData.push.apply(returnData, responseData.response as IDataObject[]) ;
|
||||
returnData.push.apply(returnData, responseData.response as IDataObject[]);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
} else if (operation === 'getThreads') {
|
||||
} else if (operation === 'getThreads') {
|
||||
// ----------------------------------
|
||||
// getThreads
|
||||
// ----------------------------------
|
||||
@@ -763,8 +706,13 @@ export class Disqus implements INodeType {
|
||||
|
||||
try {
|
||||
let responseData: IDataObject = {};
|
||||
if(returnAll) {
|
||||
responseData.response = await disqusApiRequestAllItems.call(this, requestMethod, qs, endpoint);
|
||||
if (returnAll) {
|
||||
responseData.response = await disqusApiRequestAllItems.call(
|
||||
this,
|
||||
requestMethod,
|
||||
qs,
|
||||
endpoint,
|
||||
);
|
||||
} else {
|
||||
const limit = this.getNodeParameter('limit', i) as string;
|
||||
qs.limit = limit;
|
||||
@@ -774,13 +722,17 @@ export class Disqus implements INodeType {
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
} else {
|
||||
throw new NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`, { itemIndex: i });
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
`The operation "${operation}" is not known!`,
|
||||
{ itemIndex: i },
|
||||
);
|
||||
}
|
||||
|
||||
} else {
|
||||
throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, { itemIndex: i });
|
||||
throw new NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, {
|
||||
itemIndex: i,
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
|
||||
Reference in New Issue
Block a user