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,11 +8,7 @@ import {
NodeOperationError,
} from 'n8n-workflow';
import {
apiRequest,
apiRequestAllItems,
IRecord,
} from './GenericFunction';
import { apiRequest, apiRequestAllItems, IRecord } from './GenericFunction';
export class Stackby implements INodeType {
description: INodeTypeDescription = {
@@ -93,10 +87,7 @@ export class Stackby implements INodeType {
type: 'string',
displayOptions: {
show: {
operation: [
'read',
'delete',
],
operation: ['read', 'delete'],
},
},
default: '',
@@ -113,9 +104,7 @@ export class Stackby implements INodeType {
type: 'boolean',
displayOptions: {
show: {
operation: [
'list',
],
operation: ['list'],
},
},
default: true,
@@ -127,12 +116,8 @@ export class Stackby implements INodeType {
type: 'number',
displayOptions: {
show: {
'operation': [
'list',
],
'returnAll': [
false,
],
operation: ['list'],
returnAll: [false],
},
},
typeOptions: {
@@ -148,9 +133,7 @@ export class Stackby implements INodeType {
type: 'collection',
displayOptions: {
show: {
operation: [
'list',
],
operation: ['list'],
},
},
default: {},
@@ -162,7 +145,8 @@ export class Stackby implements INodeType {
type: 'string',
default: '',
placeholder: 'All Stories',
description: 'The name or ID of a view in the Stories table. If set, only the records in that view will be returned. The records will be sorted according to the order of the view.',
description:
'The name or ID of a view in the Stories table. If set, only the records in that view will be returned. The records will be sorted according to the order of the view.',
},
],
},
@@ -175,15 +159,14 @@ export class Stackby implements INodeType {
type: 'string',
displayOptions: {
show: {
operation: [
'append',
],
operation: ['append'],
},
},
default: '',
required: true,
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',
},
],
};
@@ -203,8 +186,11 @@ export class Stackby implements INodeType {
const rowIds = this.getNodeParameter('id', i) as string;
qs.rowIds = [rowIds];
responseData = await apiRequest.call(this, 'GET', `/rowlist/${stackId}/${table}`, {}, qs);
// tslint:disable-next-line: no-any
returnData.push.apply(returnData, responseData.map((data: any) => data.field));
returnData.push.apply(
returnData,
// tslint:disable-next-line:no-any
responseData.map((data: any) => data.field),
);
} catch (error) {
if (this.continueOnFail()) {
returnData.push({ error: error.message });
@@ -222,7 +208,13 @@ export class Stackby implements INodeType {
const rowIds = this.getNodeParameter('id', i) as string;
qs.rowIds = [rowIds];
responseData = await apiRequest.call(this, 'DELETE', `/rowdelete/${stackId}/${table}`, {}, qs);
responseData = await apiRequest.call(
this,
'DELETE',
`/rowdelete/${stackId}/${table}`,
{},
qs,
);
responseData = responseData.records;
returnData.push.apply(returnData, responseData);
} catch (error) {
@@ -243,13 +235,17 @@ export class Stackby implements INodeType {
const stackId = this.getNodeParameter('stackId', i) as string;
const table = encodeURI(this.getNodeParameter('table', i) as string);
const columns = this.getNodeParameter('columns', i) as string;
const columnList = columns.split(',').map(column => column.trim());
const columnList = columns.split(',').map((column) => column.trim());
// tslint:disable-next-line: no-any
const record: { [key: string]: any } = {};
for (const column of columnList) {
if (items[i].json[column] === undefined) {
throw new NodeOperationError(this.getNode(), `Column ${column} does not exist on input`, { itemIndex: i });
throw new NodeOperationError(
this.getNode(),
`Column ${column} does not exist on input`,
{ itemIndex: i },
);
} else {
record[column] = items[i].json[column];
}
@@ -263,11 +259,16 @@ export class Stackby implements INodeType {
}
for (const key of Object.keys(records)) {
responseData = await apiRequest.call(this, 'POST', `/rowcreate/${key}`, { records: records[key] });
responseData = await apiRequest.call(this, 'POST', `/rowcreate/${key}`, {
records: records[key],
});
}
// tslint:disable-next-line: no-any
returnData.push.apply(returnData, responseData.map((data: any) => data.field));
returnData.push.apply(
returnData,
// tslint:disable-next-line:no-any
responseData.map((data: any) => data.field),
);
} catch (error) {
if (this.continueOnFail()) {
returnData.push({ error: error.message });
@@ -291,14 +292,29 @@ export class Stackby implements INodeType {
}
if (returnAll === true) {
responseData = await apiRequestAllItems.call(this, 'GET', `/rowlist/${stackId}/${table}`, {}, qs);
responseData = await apiRequestAllItems.call(
this,
'GET',
`/rowlist/${stackId}/${table}`,
{},
qs,
);
} else {
qs.maxrecord = this.getNodeParameter('limit', 0) as number;
responseData = await apiRequest.call(this, 'GET', `/rowlist/${stackId}/${table}`, {}, qs);
responseData = await apiRequest.call(
this,
'GET',
`/rowlist/${stackId}/${table}`,
{},
qs,
);
}
// tslint:disable-next-line: no-any
returnData.push.apply(returnData, responseData.map((data: any) => data.field));
returnData.push.apply(
returnData,
// tslint:disable-next-line:no-any
responseData.map((data: any) => data.field),
);
} catch (error) {
if (this.continueOnFail()) {
returnData.push({ error: error.message });