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

@@ -7,7 +7,7 @@ import type {
ILoadOptionsFunctions,
} from 'n8n-core';
import type { IDataObject } from 'n8n-workflow';
import type { IDataObject, JsonObject } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow';
import get from 'lodash.get';
@@ -16,12 +16,11 @@ export async function travisciApiRequest(
this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions,
method: string,
resource: string,
body: any = {},
body: IDataObject | string = {},
qs: IDataObject = {},
uri?: string,
option: IDataObject = {},
): Promise<any> {
) {
const credentials = await this.getCredentials('travisCiApi');
let options: OptionsWithUri = {
headers: {
@@ -37,13 +36,13 @@ export async function travisciApiRequest(
json: true,
};
options = Object.assign({}, options, option);
if (Object.keys(options.body).length === 0) {
if (Object.keys(options.body as IDataObject).length === 0) {
delete options.body;
}
try {
return await this.helpers.request(options);
} catch (error) {
throw new NodeApiError(this.getNode(), error);
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
@@ -57,21 +56,21 @@ export async function travisciApiRequestAllItems(
method: string,
resource: string,
body: any = {},
body: IDataObject = {},
query: IDataObject = {},
): Promise<any> {
) {
const returnData: IDataObject[] = [];
let responseData;
do {
responseData = await travisciApiRequest.call(this, method, resource, body, query);
const path = get(responseData, '@pagination.next.@href');
const path = get(responseData, '@pagination.next.@href') as string;
if (path !== undefined) {
const parsedPath = new URLSearchParams(path);
query = Object.fromEntries(parsedPath);
}
returnData.push.apply(returnData, responseData[propertyName]);
returnData.push.apply(returnData, responseData[propertyName] as IDataObject[]);
} while (responseData['@pagination'].is_last !== true);
return returnData;
}