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

@@ -2,7 +2,7 @@ import type { OptionsWithUri } from 'request';
import type { IExecuteFunctions, ILoadOptionsFunctions } from 'n8n-core';
import type { IDataObject } from 'n8n-workflow';
import type { JsonObject, IDataObject } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow';
export async function philipsHueApiRequest(
@@ -30,7 +30,7 @@ export async function philipsHueApiRequest(
options.headers = Object.assign({}, options.headers, headers);
}
if (Object.keys(body).length === 0) {
if (Object.keys(body as IDataObject).length === 0) {
delete options.body;
}
@@ -38,20 +38,19 @@ export async function philipsHueApiRequest(
delete options.qs;
}
//@ts-ignore
const response = await this.helpers.requestOAuth2.call(this, 'philipsHueOAuth2Api', options, {
tokenType: 'Bearer',
});
return response;
} catch (error) {
throw new NodeApiError(this.getNode(), error);
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
export async function getUser(this: IExecuteFunctions | ILoadOptionsFunctions): Promise<any> {
const { whitelist } = await philipsHueApiRequest.call(this, 'GET', '/api/0/config', {}, {});
//check if there is a n8n user
for (const user of Object.keys(whitelist)) {
for (const user of Object.keys(whitelist as IDataObject)) {
if (whitelist[user].name === 'n8n') {
return user;
}