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,16 +1,8 @@
import {
OptionsWithUri,
} from 'request';
import { OptionsWithUri } from 'request';
import {
IExecuteFunctions,
IExecuteSingleFunctions,
ILoadOptionsFunctions,
} from 'n8n-core';
import { IExecuteFunctions, IExecuteSingleFunctions, ILoadOptionsFunctions } from 'n8n-core';
import {
IDataObject, NodeApiError,
} from 'n8n-workflow';
import { IDataObject, NodeApiError } from 'n8n-workflow';
export async function googleApiRequest(
this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions,
@@ -20,7 +12,8 @@ export async function googleApiRequest(
qs: IDataObject = {},
uri?: string,
headers: IDataObject = {},
): Promise<any> { // tslint:disable-line:no-any
// tslint:disable-next-line:no-any
): Promise<any> {
const options: OptionsWithUri = {
headers: {
'Content-Type': 'application/json',
@@ -40,11 +33,7 @@ export async function googleApiRequest(
delete options.body;
}
//@ts-ignore
return await this.helpers.requestOAuth2.call(
this,
'googleTasksOAuth2Api',
options,
);
return await this.helpers.requestOAuth2.call(this, 'googleTasksOAuth2Api', options);
} catch (error) {
throw new NodeApiError(this.getNode(), error);
}
@@ -57,26 +46,18 @@ export async function googleApiRequestAllItems(
endpoint: string,
body: IDataObject = {},
query: IDataObject = {},
): Promise<any> { // tslint:disable-line:no-any
// tslint:disable-next-line:no-any
): Promise<any> {
const returnData: IDataObject[] = [];
let responseData;
query.maxResults = 100;
do {
responseData = await googleApiRequest.call(
this,
method,
endpoint,
body,
query,
);
responseData = await googleApiRequest.call(this, method, endpoint, body, query);
query.pageToken = responseData['nextPageToken'];
returnData.push.apply(returnData, responseData[propertyName]);
} while (
responseData['nextPageToken'] !== undefined &&
responseData['nextPageToken'] !== ''
);
} while (responseData['nextPageToken'] !== undefined && responseData['nextPageToken'] !== '');
return returnData;
}

View File

@@ -1,6 +1,4 @@
import {
IExecuteFunctions,
} from 'n8n-core';
import { IExecuteFunctions } from 'n8n-core';
import {
IDataObject,
@@ -11,15 +9,9 @@ import {
INodeTypeDescription,
} from 'n8n-workflow';
import {
googleApiRequest,
googleApiRequestAllItems,
} from './GenericFunctions';
import { googleApiRequest, googleApiRequestAllItems } from './GenericFunctions';
import {
taskFields,
taskOperations,
} from './TaskDescription';
import { taskFields, taskOperations } from './TaskDescription';
export class GoogleTasks implements INodeType {
description: INodeTypeDescription = {
@@ -64,9 +56,7 @@ export class GoogleTasks implements INodeType {
loadOptions: {
// Get all the tasklists to display them to user so that he can select them easily
async getTasks(
this: ILoadOptionsFunctions,
): Promise<INodePropertyOptions[]> {
async getTasks(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const returnData: INodePropertyOptions[] = [];
const tasks = await googleApiRequestAllItems.call(
this,
@@ -104,10 +94,7 @@ export class GoogleTasks implements INodeType {
//https://developers.google.com/tasks/v1/reference/tasks/insert
const taskId = this.getNodeParameter('task', i) as string;
body.title = this.getNodeParameter('title', i) as string;
const additionalFields = this.getNodeParameter(
'additionalFields',
i,
) as IDataObject;
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
if (additionalFields.parent) {
qs.parent = additionalFields.parent as string;
@@ -172,10 +159,12 @@ export class GoogleTasks implements INodeType {
//https://developers.google.com/tasks/v1/reference/tasks/list
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
const taskListId = this.getNodeParameter('task', i) as string;
const { showCompleted = true, showDeleted = false, showHidden = false, ...options } = this.getNodeParameter(
'additionalFields',
i,
) as IDataObject;
const {
showCompleted = true,
showDeleted = false,
showHidden = false,
...options
} = this.getNodeParameter('additionalFields', i) as IDataObject;
if (options.completedMax) {
qs.completedMax = options.completedMax as string;
}
@@ -223,10 +212,7 @@ export class GoogleTasks implements INodeType {
//https://developers.google.com/tasks/v1/reference/tasks/patch
const taskListId = this.getNodeParameter('task', i) as string;
const taskId = this.getNodeParameter('taskId', i) as string;
const updateFields = this.getNodeParameter(
'updateFields',
i,
) as IDataObject;
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
if (updateFields.previous) {
qs.previous = updateFields.previous as string;

View File

@@ -1,6 +1,4 @@
import {
INodeProperties,
} from 'n8n-workflow';
import { INodeProperties } from 'n8n-workflow';
export const taskOperations: INodeProperties[] = [
{
@@ -10,9 +8,7 @@ export const taskOperations: INodeProperties[] = [
noDataExpression: true,
displayOptions: {
show: {
resource: [
'task',
],
resource: ['task'],
},
},
options: [
@@ -59,19 +55,16 @@ export const taskFields: INodeProperties[] = [
displayName: 'TaskList Name or ID',
name: 'task',
type: 'options',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
typeOptions: {
loadOptionsMethod: 'getTasks',
},
required: true,
displayOptions: {
show: {
operation: [
'create',
],
resource: [
'task',
],
operation: ['create'],
resource: ['task'],
},
},
default: '',
@@ -84,12 +77,8 @@ export const taskFields: INodeProperties[] = [
description: 'Title of the task',
displayOptions: {
show: {
operation: [
'create',
],
resource: [
'task',
],
operation: ['create'],
resource: ['task'],
},
},
},
@@ -101,12 +90,8 @@ export const taskFields: INodeProperties[] = [
default: {},
displayOptions: {
show: {
operation: [
'create',
],
resource: [
'task',
],
operation: ['create'],
resource: ['task'],
},
},
options: [
@@ -115,7 +100,8 @@ export const taskFields: INodeProperties[] = [
name: 'completed',
type: 'dateTime',
default: '',
description: 'Completion date of the task (as a RFC 3339 timestamp). This field is omitted if the task has not been completed.',
description:
'Completion date of the task (as a RFC 3339 timestamp). This field is omitted if the task has not been completed.',
},
{
displayName: 'Deleted',
@@ -143,14 +129,16 @@ export const taskFields: INodeProperties[] = [
name: 'parent',
type: 'string',
default: '',
description: 'Parent task identifier. If the task is created at the top level, this parameter is omitted.',
description:
'Parent task identifier. If the task is created at the top level, this parameter is omitted.',
},
{
displayName: 'Previous',
name: 'previous',
type: 'string',
default: '',
description: 'Previous sibling task identifier. If the task is created at the first position among its siblings, this parameter is omitted.',
description:
'Previous sibling task identifier. If the task is created at the first position among its siblings, this parameter is omitted.',
},
{
displayName: 'Status',
@@ -169,7 +157,6 @@ export const taskFields: INodeProperties[] = [
default: '',
description: 'Current status of the task',
},
],
},
/* -------------------------------------------------------------------------- */
@@ -179,19 +166,16 @@ export const taskFields: INodeProperties[] = [
displayName: 'TaskList Name or ID',
name: 'task',
type: 'options',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
typeOptions: {
loadOptionsMethod: 'getTasks',
},
required: true,
displayOptions: {
show: {
operation: [
'delete',
],
resource: [
'task',
],
operation: ['delete'],
resource: ['task'],
},
},
default: '',
@@ -203,12 +187,8 @@ export const taskFields: INodeProperties[] = [
required: true,
displayOptions: {
show: {
operation: [
'delete',
],
resource: [
'task',
],
operation: ['delete'],
resource: ['task'],
},
},
default: '',
@@ -220,19 +200,16 @@ export const taskFields: INodeProperties[] = [
displayName: 'TaskList Name or ID',
name: 'task',
type: 'options',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
typeOptions: {
loadOptionsMethod: 'getTasks',
},
required: true,
displayOptions: {
show: {
operation: [
'get',
],
resource: [
'task',
],
operation: ['get'],
resource: ['task'],
},
},
default: '',
@@ -244,12 +221,8 @@ export const taskFields: INodeProperties[] = [
required: true,
displayOptions: {
show: {
operation: [
'get',
],
resource: [
'task',
],
operation: ['get'],
resource: ['task'],
},
},
default: '',
@@ -261,19 +234,16 @@ export const taskFields: INodeProperties[] = [
displayName: 'TaskList Name or ID',
name: 'task',
type: 'options',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
typeOptions: {
loadOptionsMethod: 'getTasks',
},
required: true,
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'task',
],
operation: ['getAll'],
resource: ['task'],
},
},
default: '',
@@ -284,12 +254,8 @@ export const taskFields: INodeProperties[] = [
type: 'boolean',
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'task',
],
operation: ['getAll'],
resource: ['task'],
},
},
default: false,
@@ -301,15 +267,9 @@ export const taskFields: INodeProperties[] = [
type: 'number',
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'task',
],
returnAll: [
false,
],
operation: ['getAll'],
resource: ['task'],
returnAll: [false],
},
},
typeOptions: {
@@ -327,12 +287,8 @@ export const taskFields: INodeProperties[] = [
default: {},
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'task',
],
operation: ['getAll'],
resource: ['task'],
},
},
options: [
@@ -341,14 +297,16 @@ export const taskFields: INodeProperties[] = [
name: 'completedMax',
type: 'dateTime',
default: '',
description: 'Upper bound for a task completion date (as a RFC 3339 timestamp) to filter by',
description:
'Upper bound for a task completion date (as a RFC 3339 timestamp) to filter by',
},
{
displayName: 'Completed Min',
name: 'completedMin',
type: 'dateTime',
default: '',
description: 'Lower bound for a task completion date (as a RFC 3339 timestamp) to filter by',
description:
'Lower bound for a task completion date (as a RFC 3339 timestamp) to filter by',
},
{
displayName: 'Due Min',
@@ -370,7 +328,8 @@ export const taskFields: INodeProperties[] = [
type: 'boolean',
default: true,
// eslint-disable-next-line n8n-nodes-base/node-param-description-unencoded-angle-brackets
description: 'Whether completed tasks are returned in the result. <strong>Show Hidden</strong> must also be True to show tasks completed in first party clients such as the web UI or Google\'s mobile apps.',
description:
"Whether completed tasks are returned in the result. <strong>Show Hidden</strong> must also be True to show tasks completed in first party clients such as the web UI or Google's mobile apps.",
},
{
displayName: 'Show Deleted',
@@ -391,7 +350,8 @@ export const taskFields: INodeProperties[] = [
name: 'updatedMin',
type: 'dateTime',
default: '',
description: 'Lower bound for a task last modification time (as a RFC 3339 timestamp) to filter by',
description:
'Lower bound for a task last modification time (as a RFC 3339 timestamp) to filter by',
},
],
},
@@ -402,19 +362,16 @@ export const taskFields: INodeProperties[] = [
displayName: 'TaskList Name or ID',
name: 'task',
type: 'options',
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
description:
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
typeOptions: {
loadOptionsMethod: 'getTasks',
},
required: true,
displayOptions: {
show: {
operation: [
'update',
],
resource: [
'task',
],
operation: ['update'],
resource: ['task'],
},
},
default: '',
@@ -426,12 +383,8 @@ export const taskFields: INodeProperties[] = [
required: true,
displayOptions: {
show: {
operation: [
'update',
],
resource: [
'task',
],
operation: ['update'],
resource: ['task'],
},
},
default: '',
@@ -444,12 +397,8 @@ export const taskFields: INodeProperties[] = [
default: {},
displayOptions: {
show: {
operation: [
'update',
],
resource: [
'task',
],
operation: ['update'],
resource: ['task'],
},
},
options: [
@@ -458,7 +407,8 @@ export const taskFields: INodeProperties[] = [
name: 'completed',
type: 'dateTime',
default: '',
description: 'Completion date of the task (as a RFC 3339 timestamp). This field is omitted if the task has not been completed.',
description:
'Completion date of the task (as a RFC 3339 timestamp). This field is omitted if the task has not been completed.',
},
{
@@ -490,7 +440,8 @@ export const taskFields: INodeProperties[] = [
name: 'previous',
type: 'string',
default: '',
description: 'Previous sibling task identifier. If the task is created at the first position among its siblings, this parameter is omitted.',
description:
'Previous sibling task identifier. If the task is created at the first position among its siblings, this parameter is omitted.',
},
{
displayName: 'Status',