mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
fix(core): Remove linting exceptions in nodes-base, @typescript-eslint/no-unsafe-argument (no-changelog)
This commit is contained in:
@@ -2,7 +2,7 @@ import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type { IExecuteFunctions, ILoadOptionsFunctions } from 'n8n-core';
|
||||
|
||||
import type { IDataObject, INodePropertyOptions } from 'n8n-workflow';
|
||||
import type { IDataObject, INodePropertyOptions, JsonObject } from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function homeAssistantApiRequest(
|
||||
@@ -32,7 +32,7 @@ export async function homeAssistantApiRequest(
|
||||
};
|
||||
|
||||
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 {
|
||||
@@ -40,7 +40,7 @@ export async function homeAssistantApiRequest(
|
||||
return await this.helpers.request(options);
|
||||
}
|
||||
} catch (error) {
|
||||
throw new NodeApiError(this.getNode(), error);
|
||||
throw new NodeApiError(this.getNode(), error as JsonObject);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,13 +72,18 @@ export async function getHomeAssistantServices(
|
||||
if (domain === '') {
|
||||
// If no domain specified return domains
|
||||
const domains = services.map(({ domain: service }: IDataObject) => service as string).sort();
|
||||
returnData.push(...domains.map((service: string) => ({ name: service, value: service })));
|
||||
returnData.push(
|
||||
...(domains.map((service: string) => ({
|
||||
name: service,
|
||||
value: service,
|
||||
})) as INodePropertyOptions[]),
|
||||
);
|
||||
return returnData;
|
||||
} else {
|
||||
// If we have a domain, return all relevant services
|
||||
const domainServices = services.filter((service: IDataObject) => service.domain === domain);
|
||||
for (const domainService of domainServices) {
|
||||
for (const [serviceID, value] of Object.entries(domainService.services)) {
|
||||
for (const [serviceID, value] of Object.entries(domainService.services as IDataObject)) {
|
||||
const serviceProperties = value as IDataObject;
|
||||
const serviceName = serviceProperties.description || serviceID;
|
||||
returnData.push({
|
||||
|
||||
Reference in New Issue
Block a user