mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(core): Remove linting exceptions in nodes-base, @typescript-eslint/no-unsafe-argument (no-changelog)
This commit is contained in:
@@ -7,6 +7,7 @@ import type {
|
||||
INodeType,
|
||||
INodeTypeBaseDescription,
|
||||
INodeTypeDescription,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError, NodeOperationError, sleep } from 'n8n-workflow';
|
||||
|
||||
@@ -23,6 +24,8 @@ interface OptionDataParamters {
|
||||
[key: string]: OptionData;
|
||||
}
|
||||
|
||||
type OptionsWithUriKeys = keyof OptionsWithUri;
|
||||
|
||||
export class HttpRequestV1 implements INodeType {
|
||||
description: INodeTypeDescription;
|
||||
|
||||
@@ -826,7 +829,9 @@ export class HttpRequestV1 implements INodeType {
|
||||
// If it is not an object && bodyContentType is not 'raw' it must be JSON so parse it
|
||||
try {
|
||||
// @ts-ignore
|
||||
requestOptions[optionData.name] = JSON.parse(requestOptions[optionData.name]);
|
||||
requestOptions[optionData.name] = JSON.parse(
|
||||
requestOptions[optionData.name as OptionsWithUriKeys] as string,
|
||||
);
|
||||
} catch (error) {
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
@@ -985,7 +990,7 @@ export class HttpRequestV1 implements INodeType {
|
||||
if (response!.status !== 'fulfilled') {
|
||||
if (!this.continueOnFail()) {
|
||||
// throw error;
|
||||
throw new NodeApiError(this.getNode(), response);
|
||||
throw new NodeApiError(this.getNode(), response as JsonObject);
|
||||
} else {
|
||||
// Return the actual reason as error
|
||||
returnItems.push({
|
||||
@@ -1040,14 +1045,14 @@ export class HttpRequestV1 implements INodeType {
|
||||
newItem.json = returnItem;
|
||||
|
||||
newItem.binary![dataPropertyName] = await this.helpers.prepareBinaryData(
|
||||
response!.body,
|
||||
response!.body as Buffer,
|
||||
fileName,
|
||||
);
|
||||
} else {
|
||||
newItem.json = items[itemIndex].json;
|
||||
|
||||
newItem.binary![dataPropertyName] = await this.helpers.prepareBinaryData(
|
||||
response!,
|
||||
response! as Buffer,
|
||||
fileName,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import type {
|
||||
INodeType,
|
||||
INodeTypeBaseDescription,
|
||||
INodeTypeDescription,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError, NodeOperationError, sleep } from 'n8n-workflow';
|
||||
|
||||
@@ -25,6 +26,7 @@ interface OptionDataParamters {
|
||||
[key: string]: OptionData;
|
||||
}
|
||||
|
||||
type OptionsWithUriKeys = keyof OptionsWithUri;
|
||||
export class HttpRequestV2 implements INodeType {
|
||||
description: INodeTypeDescription;
|
||||
|
||||
@@ -864,7 +866,9 @@ export class HttpRequestV2 implements INodeType {
|
||||
// If it is not an object && bodyContentType is not 'raw' it must be JSON so parse it
|
||||
try {
|
||||
// @ts-ignore
|
||||
requestOptions[optionData.name] = JSON.parse(requestOptions[optionData.name]);
|
||||
requestOptions[optionData.name] = JSON.parse(
|
||||
requestOptions[optionData.name as OptionsWithUriKeys] as string,
|
||||
);
|
||||
} catch (error) {
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
@@ -1037,7 +1041,7 @@ export class HttpRequestV2 implements INodeType {
|
||||
if (response!.status !== 'fulfilled') {
|
||||
if (!this.continueOnFail()) {
|
||||
// throw error;
|
||||
throw new NodeApiError(this.getNode(), response);
|
||||
throw new NodeApiError(this.getNode(), response as JsonObject);
|
||||
} else {
|
||||
// Return the actual reason as error
|
||||
returnItems.push({
|
||||
@@ -1092,14 +1096,14 @@ export class HttpRequestV2 implements INodeType {
|
||||
newItem.json = returnItem;
|
||||
|
||||
newItem.binary![dataPropertyName] = await this.helpers.prepareBinaryData(
|
||||
response!.body,
|
||||
response!.body as Buffer,
|
||||
fileName,
|
||||
);
|
||||
} else {
|
||||
newItem.json = items[itemIndex].json;
|
||||
|
||||
newItem.binary![dataPropertyName] = await this.helpers.prepareBinaryData(
|
||||
response!,
|
||||
response! as Buffer,
|
||||
fileName,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import type {
|
||||
INodeType,
|
||||
INodeTypeBaseDescription,
|
||||
INodeTypeDescription,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
import { jsonParse, NodeApiError, NodeOperationError, sleep } from 'n8n-workflow';
|
||||
|
||||
@@ -1307,9 +1308,9 @@ export class HttpRequestV3 implements INodeType {
|
||||
if (response!.status !== 'fulfilled') {
|
||||
if (!this.continueOnFail()) {
|
||||
if (autoDetectResponseFormat && response.reason.error instanceof Buffer) {
|
||||
response.reason.error = Buffer.from(response.reason.error).toString();
|
||||
response.reason.error = Buffer.from(response.reason.error as Buffer).toString();
|
||||
}
|
||||
throw new NodeApiError(this.getNode(), response);
|
||||
throw new NodeApiError(this.getNode(), response as JsonObject);
|
||||
} else {
|
||||
// Return the actual reason as error
|
||||
returnItems.push({
|
||||
@@ -1349,7 +1350,7 @@ export class HttpRequestV3 implements INodeType {
|
||||
0,
|
||||
false,
|
||||
) as boolean;
|
||||
const data = Buffer.from(response.body).toString();
|
||||
const data = Buffer.from(response.body as Buffer).toString();
|
||||
response.body = jsonParse(data, {
|
||||
...(neverError
|
||||
? { fallbackValue: {} }
|
||||
@@ -1359,7 +1360,7 @@ export class HttpRequestV3 implements INodeType {
|
||||
responseFormat = 'file';
|
||||
} else {
|
||||
responseFormat = 'text';
|
||||
const data = Buffer.from(response.body).toString();
|
||||
const data = Buffer.from(response.body as Buffer).toString();
|
||||
response.body = !data ? undefined : data;
|
||||
}
|
||||
}
|
||||
@@ -1408,14 +1409,14 @@ export class HttpRequestV3 implements INodeType {
|
||||
newItem.json = returnItem;
|
||||
|
||||
newItem.binary![outputPropertyName] = await this.helpers.prepareBinaryData(
|
||||
response!.body,
|
||||
response!.body as Buffer,
|
||||
fileName,
|
||||
);
|
||||
} else {
|
||||
newItem.json = items[itemIndex].json;
|
||||
|
||||
newItem.binary![outputPropertyName] = await this.helpers.prepareBinaryData(
|
||||
response!,
|
||||
response! as Buffer,
|
||||
fileName,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user