fix(core): Remove linting exceptions in nodes-base, @typescript-eslint/no-unsafe-argument (no-changelog)

This commit is contained in:
Michael Kret
2023-02-28 05:39:43 +02:00
committed by GitHub
parent 3172ea376e
commit bb4db58819
560 changed files with 2227 additions and 1919 deletions

View File

@@ -34,5 +34,5 @@ export async function createContact(
const responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
return this.helpers.returnJsonArray(responseData);
return this.helpers.returnJsonArray(responseData as IDataObject);
}

View File

@@ -16,5 +16,5 @@ export async function deleteContact(
const body = {} as IDataObject;
const responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
return this.helpers.returnJsonArray(responseData);
return this.helpers.returnJsonArray(responseData as IDataObject);
}

View File

@@ -16,5 +16,5 @@ export async function getContact(
const body = {} as IDataObject;
const responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
return this.helpers.returnJsonArray(responseData);
return this.helpers.returnJsonArray(responseData as IDataObject);
}

View File

@@ -22,6 +22,6 @@ export async function getAll(
} else {
const limit = this.getNodeParameter('limit', index);
responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
return this.helpers.returnJsonArray(responseData.contacts.splice(0, limit));
return this.helpers.returnJsonArray(responseData.contacts.splice(0, limit) as IDataObject[]);
}
}

View File

@@ -37,5 +37,5 @@ export async function updateContact(
const responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
return this.helpers.returnJsonArray(responseData);
return this.helpers.returnJsonArray(responseData as IDataObject);
}

View File

@@ -51,5 +51,5 @@ export async function addCustomer(
const responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
return this.helpers.returnJsonArray(responseData.customer);
return this.helpers.returnJsonArray(responseData.customer as IDataObject);
}

View File

@@ -16,5 +16,5 @@ export async function deleteCustomer(
const body = {} as IDataObject;
const responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
return this.helpers.returnJsonArray(responseData);
return this.helpers.returnJsonArray(responseData as IDataObject[]);
}

View File

@@ -16,5 +16,5 @@ export async function getCustomer(
const body = {} as IDataObject;
const responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
return this.helpers.returnJsonArray(responseData.customer);
return this.helpers.returnJsonArray(responseData.customer as IDataObject);
}

View File

@@ -36,6 +36,6 @@ export async function getAll(
return this.helpers.returnJsonArray(responseData);
} else {
responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
return this.helpers.returnJsonArray(responseData.customers);
return this.helpers.returnJsonArray(responseData.customers as IDataObject[]);
}
}

View File

@@ -1,6 +1,6 @@
import type { IExecuteFunctions } from 'n8n-core';
import type { IDataObject, INodeExecutionData } from 'n8n-workflow';
import type { IDataObject, INodeExecutionData, JsonObject } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow';
import { apiRequest } from '../../../transport';
@@ -53,10 +53,10 @@ export async function updateCustomer(
const responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
if (!responseData.customer) {
throw new NodeApiError(this.getNode(), responseData, {
throw new NodeApiError(this.getNode(), responseData as JsonObject, {
httpCode: '404',
message: 'Customer ID not found',
});
}
return this.helpers.returnJsonArray(responseData.customer);
return this.helpers.returnJsonArray(responseData.customer as IDataObject[]);
}

View File

@@ -28,5 +28,5 @@ export async function addAlert(
const responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
return this.helpers.returnJsonArray(responseData.alert);
return this.helpers.returnJsonArray(responseData.alert as IDataObject);
}

View File

@@ -16,5 +16,5 @@ export async function deleteAlert(
const body = {} as IDataObject;
const responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
return this.helpers.returnJsonArray(responseData);
return this.helpers.returnJsonArray(responseData as IDataObject[]);
}

View File

@@ -16,5 +16,5 @@ export async function getAlert(
const body = {} as IDataObject;
const responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
return this.helpers.returnJsonArray(responseData.rmm_alert);
return this.helpers.returnJsonArray(responseData.rmm_alert as IDataObject[]);
}

View File

@@ -34,6 +34,6 @@ export async function getAll(
return this.helpers.returnJsonArray(responseData);
} else {
responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
return this.helpers.returnJsonArray(responseData.rmm_alerts);
return this.helpers.returnJsonArray(responseData.rmm_alerts as IDataObject[]);
}
}

View File

@@ -20,5 +20,5 @@ export async function muteAlert(
body.mute_for = mute;
const responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
return this.helpers.returnJsonArray(responseData);
return this.helpers.returnJsonArray(responseData as IDataObject[]);
}

View File

@@ -1,6 +1,6 @@
import type { IExecuteFunctions } from 'n8n-core';
import type { INodeExecutionData } from 'n8n-workflow';
import type { INodeExecutionData, JsonObject } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow';
import * as customer from './customer';
@@ -51,7 +51,7 @@ export async function router(this: IExecuteFunctions): Promise<INodeExecutionDat
);
operationResult.push(...executionErrorData);
} else {
throw new NodeApiError(this.getNode(), err, { itemIndex: i });
throw new NodeApiError(this.getNode(), err as JsonObject, { itemIndex: i });
}
}
}

View File

@@ -33,5 +33,5 @@ export async function createTicket(
const responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
return this.helpers.returnJsonArray(responseData.ticket);
return this.helpers.returnJsonArray(responseData.ticket as IDataObject[]);
}

View File

@@ -16,5 +16,5 @@ export async function deleteTicket(
const body = {} as IDataObject;
const responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
return this.helpers.returnJsonArray(responseData);
return this.helpers.returnJsonArray(responseData as IDataObject[]);
}

View File

@@ -16,5 +16,5 @@ export async function getTicket(
const body = {} as IDataObject;
const responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
return this.helpers.returnJsonArray(responseData.ticket);
return this.helpers.returnJsonArray(responseData.ticket as IDataObject[]);
}

View File

@@ -30,6 +30,6 @@ export async function getAll(
return this.helpers.returnJsonArray(responseData);
} else {
responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
return this.helpers.returnJsonArray(responseData.tickets);
return this.helpers.returnJsonArray(responseData.tickets as IDataObject[]);
}
}

View File

@@ -37,5 +37,5 @@ export async function updateTicket(
const responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
return this.helpers.returnJsonArray(responseData.ticket);
return this.helpers.returnJsonArray(responseData.ticket as IDataObject[]);
}

View File

@@ -6,6 +6,7 @@ import type {
ICredentialTestFunctions,
IDataObject,
IHttpRequestOptions,
JsonObject,
} from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow';
@@ -34,7 +35,7 @@ export async function apiRequest(
try {
return await this.helpers.httpRequest(options);
} catch (error) {
throw new NodeApiError(this.getNode(), error);
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
@@ -53,7 +54,7 @@ export async function apiRequestAllItems(
do {
responseData = await apiRequest.call(this, method, endpoint, body, query);
query.page++;
returnData = returnData.concat(responseData[endpoint]);
returnData = returnData.concat(responseData[endpoint] as IDataObject[]);
} while (responseData[endpoint].length !== 0);
return returnData;
}