refactor(core): Remove linting exceptions in nodes-base (#4794)

*  enabled array-type

*  await-thenable on

*  ban-types on

*  default-param-last on

*  dot-notation on

*  member-delimiter-style on

*  no-duplicate-imports on

*  no-empty-interface on

*  no-floating-promises on

*  no-for-in-array on

*  no-invalid-void-type on

*  no-loop-func on

*  no-shadow on

*  ban-ts-comment re enabled

*  @typescript-eslint/lines-between-class-members on

* address my own comment

* @typescript-eslint/return-await on

* @typescript-eslint/promise-function-async on

* @typescript-eslint/no-unnecessary-boolean-literal-compare on

* @typescript-eslint/no-unnecessary-type-assertion on

* prefer-const on

* @typescript-eslint/prefer-optional-chain on

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
Michael Kret
2022-12-02 22:54:28 +02:00
committed by GitHub
parent 8101c05d6f
commit 61e26804ba
796 changed files with 3735 additions and 2847 deletions

View File

@@ -7,6 +7,7 @@ import {
INodePropertyOptions,
INodeType,
INodeTypeDescription,
LoggerProxy as Logger,
NodeApiError,
NodeOperationError,
} from 'n8n-workflow';
@@ -60,8 +61,6 @@ import { userFields, userOperations } from './UserDescription';
import { documentFields, documentOperations } from './DocumentDescription';
import { LoggerProxy as Logger } from 'n8n-workflow';
export class Salesforce implements INodeType {
description: INodeTypeDescription = {
displayName: 'Salesforce',
@@ -1291,7 +1290,7 @@ export class Salesforce implements INodeType {
const options = this.getNodeParameter('options', i);
try {
if (returnAll) {
qs.q = getQuery(options, 'Lead', returnAll) as string;
qs.q = getQuery(options, 'Lead', returnAll);
responseData = await salesforceApiRequestAllItems.call(
this,
'records',
@@ -1302,7 +1301,7 @@ export class Salesforce implements INodeType {
);
} else {
const limit = this.getNodeParameter('limit', i);
qs.q = getQuery(options, 'Lead', returnAll, limit) as string;
qs.q = getQuery(options, 'Lead', returnAll, limit);
responseData = await salesforceApiRequestAllItems.call(
this,
'records',
@@ -1637,7 +1636,7 @@ export class Salesforce implements INodeType {
const options = this.getNodeParameter('options', i);
try {
if (returnAll) {
qs.q = getQuery(options, 'Contact', returnAll) as string;
qs.q = getQuery(options, 'Contact', returnAll);
responseData = await salesforceApiRequestAllItems.call(
this,
'records',
@@ -1648,7 +1647,7 @@ export class Salesforce implements INodeType {
);
} else {
const limit = this.getNodeParameter('limit', i);
qs.q = getQuery(options, 'Contact', returnAll, limit) as string;
qs.q = getQuery(options, 'Contact', returnAll, limit);
responseData = await salesforceApiRequestAllItems.call(
this,
'records',
@@ -1727,8 +1726,7 @@ export class Salesforce implements INodeType {
const additionalFields = this.getNodeParameter('additionalFields', i);
const body: IDataObject = {};
if (customFieldsUi) {
const customFields = (customFieldsUi as IDataObject)
.customFieldsValues as IDataObject[];
const customFields = customFieldsUi.customFieldsValues as IDataObject[];
if (customFields) {
for (const customField of customFields) {
//@ts-ignore
@@ -1762,8 +1760,7 @@ export class Salesforce implements INodeType {
body.RecordTypeId = updateFields.recordTypeId as string;
}
if (customFieldsUi) {
const customFields = (customFieldsUi as IDataObject)
.customFieldsValues as IDataObject[];
const customFields = customFieldsUi.customFieldsValues as IDataObject[];
if (customFields) {
for (const customField of customFields) {
//@ts-ignore
@@ -1793,7 +1790,7 @@ export class Salesforce implements INodeType {
const options = this.getNodeParameter('options', i);
try {
if (returnAll) {
qs.q = getQuery(options, customObject, returnAll) as string;
qs.q = getQuery(options, customObject, returnAll);
responseData = await salesforceApiRequestAllItems.call(
this,
'records',
@@ -1804,7 +1801,7 @@ export class Salesforce implements INodeType {
);
} else {
const limit = this.getNodeParameter('limit', i);
qs.q = getQuery(options, customObject, returnAll, limit) as string;
qs.q = getQuery(options, customObject, returnAll, limit);
responseData = await salesforceApiRequestAllItems.call(
this,
'records',
@@ -1846,17 +1843,17 @@ export class Salesforce implements INodeType {
},
};
if (additionalFields.ownerId) {
body.entity_content['ownerId'] = additionalFields.ownerId as string;
body.entity_content.ownerId = additionalFields.ownerId as string;
}
if (additionalFields.linkToObjectId) {
body.entity_content['FirstPublishLocationId'] =
body.entity_content.FirstPublishLocationId =
additionalFields.linkToObjectId as string;
}
if (items[i].binary && items[i].binary![binaryPropertyName]) {
const binaryData = items[i].binary![binaryPropertyName];
const dataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
body.entity_content['PathOnClient'] = `${title}.${
body.entity_content.PathOnClient = `${title}.${
additionalFields.fileExtension || binaryData.fileExtension
}`;
data = {
@@ -1869,7 +1866,7 @@ export class Salesforce implements INodeType {
VersionData: {
value: dataBuffer,
options: {
filename: body.entity_content['PathOnClient'],
filename: body.entity_content.PathOnClient,
},
},
};
@@ -2038,7 +2035,7 @@ export class Salesforce implements INodeType {
const options = this.getNodeParameter('options', i);
try {
if (returnAll) {
qs.q = getQuery(options, 'Opportunity', returnAll) as string;
qs.q = getQuery(options, 'Opportunity', returnAll);
responseData = await salesforceApiRequestAllItems.call(
this,
'records',
@@ -2049,7 +2046,7 @@ export class Salesforce implements INodeType {
);
} else {
const limit = this.getNodeParameter('limit', i);
qs.q = getQuery(options, 'Opportunity', returnAll, limit) as string;
qs.q = getQuery(options, 'Opportunity', returnAll, limit);
responseData = await salesforceApiRequestAllItems.call(
this,
'records',
@@ -2328,7 +2325,7 @@ export class Salesforce implements INodeType {
const options = this.getNodeParameter('options', i);
try {
if (returnAll) {
qs.q = getQuery(options, 'Account', returnAll) as string;
qs.q = getQuery(options, 'Account', returnAll);
responseData = await salesforceApiRequestAllItems.call(
this,
'records',
@@ -2339,7 +2336,7 @@ export class Salesforce implements INodeType {
);
} else {
const limit = this.getNodeParameter('limit', i);
qs.q = getQuery(options, 'Account', returnAll, limit) as string;
qs.q = getQuery(options, 'Account', returnAll, limit);
responseData = await salesforceApiRequestAllItems.call(
this,
'records',
@@ -2543,7 +2540,7 @@ export class Salesforce implements INodeType {
const options = this.getNodeParameter('options', i);
try {
if (returnAll) {
qs.q = getQuery(options, 'Case', returnAll) as string;
qs.q = getQuery(options, 'Case', returnAll);
responseData = await salesforceApiRequestAllItems.call(
this,
'records',
@@ -2554,7 +2551,7 @@ export class Salesforce implements INodeType {
);
} else {
const limit = this.getNodeParameter('limit', i);
qs.q = getQuery(options, 'Case', returnAll, limit) as string;
qs.q = getQuery(options, 'Case', returnAll, limit);
responseData = await salesforceApiRequestAllItems.call(
this,
'records',
@@ -2806,7 +2803,7 @@ export class Salesforce implements INodeType {
const options = this.getNodeParameter('options', i);
try {
if (returnAll) {
qs.q = getQuery(options, 'Task', returnAll) as string;
qs.q = getQuery(options, 'Task', returnAll);
responseData = await salesforceApiRequestAllItems.call(
this,
'records',
@@ -2817,7 +2814,7 @@ export class Salesforce implements INodeType {
);
} else {
const limit = this.getNodeParameter('limit', i);
qs.q = getQuery(options, 'Task', returnAll, limit) as string;
qs.q = getQuery(options, 'Task', returnAll, limit);
responseData = await salesforceApiRequestAllItems.call(
this,
'records',
@@ -2938,7 +2935,7 @@ export class Salesforce implements INodeType {
const options = this.getNodeParameter('options', i);
try {
if (returnAll) {
qs.q = getQuery(options, 'Attachment', returnAll) as string;
qs.q = getQuery(options, 'Attachment', returnAll);
responseData = await salesforceApiRequestAllItems.call(
this,
'records',
@@ -2949,7 +2946,7 @@ export class Salesforce implements INodeType {
);
} else {
const limit = this.getNodeParameter('limit', i);
qs.q = getQuery(options, 'Attachment', returnAll, limit) as string;
qs.q = getQuery(options, 'Attachment', returnAll, limit);
responseData = await salesforceApiRequestAllItems.call(
this,
'records',
@@ -2993,7 +2990,7 @@ export class Salesforce implements INodeType {
const options = this.getNodeParameter('options', i);
try {
if (returnAll) {
qs.q = getQuery(options, 'User', returnAll) as string;
qs.q = getQuery(options, 'User', returnAll);
responseData = await salesforceApiRequestAllItems.call(
this,
'records',
@@ -3004,7 +3001,7 @@ export class Salesforce implements INodeType {
);
} else {
const limit = this.getNodeParameter('limit', i);
qs.q = getQuery(options, 'User', returnAll, limit) as string;
qs.q = getQuery(options, 'User', returnAll, limit);
responseData = await salesforceApiRequestAllItems.call(
this,
'records',
@@ -3030,11 +3027,10 @@ export class Salesforce implements INodeType {
} else {
// Input variables are defined in UI
const setInputVariable = this.getNodeParameter('variablesUi', i, {}) as IDataObject;
if (setInputVariable!.variablesValues !== undefined) {
for (const inputVariableData of setInputVariable!
.variablesValues as IDataObject[]) {
if (setInputVariable.variablesValues !== undefined) {
for (const inputVariableData of setInputVariable.variablesValues as IDataObject[]) {
// @ts-ignore
variables[inputVariableData!.name as string] = inputVariableData!.value;
variables[inputVariableData.name as string] = inputVariableData.value;
}
}
}
@@ -3053,7 +3049,7 @@ export class Salesforce implements INodeType {
const returnAll = this.getNodeParameter('returnAll', i);
responseData = await salesforceApiRequest.call(this, 'GET', '/actions/custom/flow');
responseData = responseData.actions;
if (returnAll === false) {
if (!returnAll) {
const limit = this.getNodeParameter('limit', i);
responseData = responseData.splice(0, limit);
}