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,
@@ -12,9 +10,7 @@ import {
NodeOperationError,
} from 'n8n-workflow';
import {
mediumApiRequest,
} from './GenericFunctions';
import { mediumApiRequest } from './GenericFunctions';
export class Medium implements INodeType {
description: INodeTypeDescription = {
@@ -37,9 +33,7 @@ export class Medium implements INodeType {
required: true,
displayOptions: {
show: {
authentication: [
'accessToken',
],
authentication: ['accessToken'],
},
},
},
@@ -48,9 +42,7 @@ export class Medium implements INodeType {
required: true,
displayOptions: {
show: {
authentication: [
'oAuth2',
],
authentication: ['oAuth2'],
},
},
},
@@ -96,9 +88,7 @@ export class Medium implements INodeType {
noDataExpression: true,
displayOptions: {
show: {
resource: [
'post',
],
resource: ['post'],
},
},
options: [
@@ -121,12 +111,8 @@ export class Medium implements INodeType {
type: 'boolean',
displayOptions: {
show: {
resource: [
'post',
],
operation: [
'create',
],
resource: ['post'],
operation: ['create'],
},
},
default: false,
@@ -138,22 +124,17 @@ export class Medium implements INodeType {
type: 'options',
displayOptions: {
show: {
resource: [
'post',
],
operation: [
'create',
],
publication: [
true,
],
resource: ['post'],
operation: ['create'],
publication: [true],
},
},
typeOptions: {
loadOptionsMethod: 'getPublications',
},
default: '',
description: 'Publication IDs. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
description:
'Publication IDs. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
},
{
displayName: 'Title',
@@ -164,12 +145,8 @@ export class Medium implements INodeType {
required: true,
displayOptions: {
show: {
operation: [
'create',
],
resource: [
'post',
],
operation: ['create'],
resource: ['post'],
},
},
description: 'Title of the post. Max Length : 100 characters.',
@@ -181,12 +158,8 @@ export class Medium implements INodeType {
required: true,
displayOptions: {
show: {
operation: [
'create',
],
resource: [
'post',
],
operation: ['create'],
resource: ['post'],
},
},
type: 'options',
@@ -214,12 +187,8 @@ export class Medium implements INodeType {
},
displayOptions: {
show: {
operation: [
'create',
],
resource: [
'post',
],
operation: ['create'],
resource: ['post'],
},
},
description: 'The body of the post, in a valid semantic HTML fragment, or Markdown',
@@ -231,12 +200,8 @@ export class Medium implements INodeType {
placeholder: 'Add Field',
displayOptions: {
show: {
operation: [
'create',
],
resource: [
'post',
],
operation: ['create'],
resource: ['post'],
},
},
default: {},
@@ -246,7 +211,8 @@ export class Medium implements INodeType {
name: 'canonicalUrl',
type: 'string',
default: '',
description: 'The original home of this content, if it was originally published elsewhere',
description:
'The original home of this content, if it was originally published elsewhere',
},
{
displayName: 'License',
@@ -327,7 +293,8 @@ export class Medium implements INodeType {
type: 'string',
default: '',
placeholder: 'open-source,mlh,fellowship',
description: 'Comma-separated strings to be used as tags for post classification. Max allowed tags: 5. Max tag length: 25 characters.',
description:
'Comma-separated strings to be used as tags for post classification. Max allowed tags: 5. Max tag length: 25 characters.',
},
],
},
@@ -338,9 +305,7 @@ export class Medium implements INodeType {
noDataExpression: true,
displayOptions: {
show: {
resource: [
'publication',
],
resource: ['publication'],
},
},
options: [
@@ -362,12 +327,8 @@ export class Medium implements INodeType {
type: 'boolean',
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'publication',
],
operation: ['getAll'],
resource: ['publication'],
},
},
default: false,
@@ -379,15 +340,9 @@ export class Medium implements INodeType {
type: 'number',
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'publication',
],
returnAll: [
false,
],
operation: ['getAll'],
resource: ['publication'],
returnAll: [false],
},
},
typeOptions: {
@@ -406,11 +361,7 @@ export class Medium implements INodeType {
async getPublications(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const returnData: INodePropertyOptions[] = [];
//Get the User Id
const user = await mediumApiRequest.call(
this,
'GET',
`/me`,
);
const user = await mediumApiRequest.call(this, 'GET', `/me`);
const userId = user.data.id;
//Get all publications of that user
@@ -430,12 +381,10 @@ export class Medium implements INodeType {
}
return returnData;
},
},
};
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const items = this.getInputData();
const returnData: IDataObject[] = [];
@@ -469,22 +418,29 @@ export class Medium implements INodeType {
title,
contentFormat,
content,
};
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
if (additionalFields.tags) {
const tags = additionalFields.tags as string;
bodyRequest.tags = tags.split(',').map(name => {
bodyRequest.tags = tags.split(',').map((name) => {
const returnValue = name.trim();
if (returnValue.length > 25) {
throw new NodeOperationError(this.getNode(), `The tag "${returnValue}" is to long. Maximum lenght of a tag is 25 characters.`, { itemIndex: i });
throw new NodeOperationError(
this.getNode(),
`The tag "${returnValue}" is to long. Maximum lenght of a tag is 25 characters.`,
{ itemIndex: i },
);
}
return returnValue;
});
if ((bodyRequest.tags as string[]).length > 5) {
throw new NodeOperationError(this.getNode(), 'To many tags got used. Maximum 5 can be set.', { itemIndex: i });
throw new NodeOperationError(
this.getNode(),
'To many tags got used. Maximum 5 can be set.',
{ itemIndex: i },
);
}
}
@@ -514,15 +470,8 @@ export class Medium implements INodeType {
bodyRequest,
qs,
);
}
else {
const responseAuthorId = await mediumApiRequest.call(
this,
'GET',
'/me',
{},
qs,
);
} else {
const responseAuthorId = await mediumApiRequest.call(this, 'GET', '/me', {}, qs);
const authorId = responseAuthorId.data.id;
responseData = await mediumApiRequest.call(
@@ -546,11 +495,7 @@ export class Medium implements INodeType {
const returnAll = this.getNodeParameter('returnAll', i) as string;
const user = await mediumApiRequest.call(
this,
'GET',
`/me`,
);
const user = await mediumApiRequest.call(this, 'GET', `/me`);
const userId = user.data.id;
//Get all publications of that user