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

@@ -18,6 +18,7 @@ import type {
ICredentialDataDecryptedObject,
ICredentialTestFunctions,
IHttpRequestOptions,
JsonObject,
} from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow';
@@ -64,15 +65,15 @@ export async function awsApiRequest(
if (error?.response?.data || error?.response?.body) {
const errorMessage = error?.response?.data || error?.response?.body;
if (errorMessage.includes('AccessDeniedException')) {
const user = JSON.parse(errorMessage).Message.split(' ')[1];
throw new NodeApiError(this.getNode(), error, {
const user = JSON.parse(errorMessage as string).Message.split(' ')[1];
throw new NodeApiError(this.getNode(), error as JsonObject, {
message: 'Unauthorized — please check your AWS policy configuration',
description: `Make sure an identity-based policy allows user ${user} to perform textract:AnalyzeExpense`,
});
}
}
throw new NodeApiError(this.getNode(), error); // no XML parsing needed
throw new NodeApiError(this.getNode(), error as JsonObject); // no XML parsing needed
}
}
@@ -86,7 +87,7 @@ export async function awsApiRequestREST(
): Promise<any> {
const response = await awsApiRequest.call(this, service, method, path, body, headers);
try {
return JSON.parse(response);
return JSON.parse(response as string);
} catch (error) {
return response;
}
@@ -103,7 +104,7 @@ export async function awsApiRequestSOAP(
const response = await awsApiRequest.call(this, service, method, path, body, headers);
try {
return await new Promise((resolve, reject) => {
parseString(response, { explicitArray: false }, (err, data) => {
parseString(response as string, { explicitArray: false }, (err, data) => {
if (err) {
return reject(err);
}
@@ -177,7 +178,7 @@ export async function validateCredentials(
const response = await this.helpers.request(options);
return new Promise((resolve, reject) => {
parseString(response, { explicitArray: false }, (err, data) => {
parseString(response as string, { explicitArray: false }, (err, data) => {
if (err) {
return reject(err);
}