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

@@ -4,6 +4,7 @@ import type {
INodeExecutionData,
INodeType,
INodeTypeDescription,
JsonObject,
} from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow';
import { flowApiRequest, FlowApiRequestAllItems } from './GenericFunctions';
@@ -124,7 +125,7 @@ export class Flow implements INodeType {
responseData = await flowApiRequest.call(this, 'POST', '/tasks', body);
responseData = responseData.task;
} catch (error) {
throw new NodeApiError(this.getNode(), error);
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
//https://developer.getflow.com/api/#tasks_update-a-task
@@ -192,7 +193,7 @@ export class Flow implements INodeType {
responseData = await flowApiRequest.call(this, 'PUT', `/tasks/${taskId}`, body);
responseData = responseData.task;
} catch (error) {
throw new NodeApiError(this.getNode(), error);
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
//https://developer.getflow.com/api/#tasks_get-task
@@ -206,7 +207,7 @@ export class Flow implements INodeType {
try {
responseData = await flowApiRequest.call(this, 'GET', `/tasks/${taskId}`, {}, qs);
} catch (error) {
throw new NodeApiError(this.getNode(), error);
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
//https://developer.getflow.com/api/#tasks_get-tasks
@@ -257,13 +258,13 @@ export class Flow implements INodeType {
responseData = responseData.tasks;
}
} catch (error) {
throw new NodeApiError(this.getNode(), error, { itemIndex: i });
throw new NodeApiError(this.getNode(), error as JsonObject, { itemIndex: i });
}
}
}
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
this.helpers.returnJsonArray(responseData as IDataObject[]),
{ itemData: { item: i } },
);
returnData.push(...executionData);

View File

@@ -193,7 +193,7 @@ export class FlowTrigger implements INodeType {
async webhook(this: IWebhookFunctions): Promise<IWebhookResponseData> {
const req = this.getRequestObject();
return {
workflowData: [this.helpers.returnJsonArray(req.body)],
workflowData: [this.helpers.returnJsonArray(req.body as IDataObject[])],
};
}
}

View File

@@ -5,7 +5,7 @@ import type {
IHookFunctions,
ILoadOptionsFunctions,
} from 'n8n-core';
import type { IDataObject } from 'n8n-workflow';
import type { IDataObject, JsonObject } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow';
export async function flowApiRequest(
@@ -29,14 +29,14 @@ export async function flowApiRequest(
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);
}
}
@@ -67,7 +67,7 @@ export async function FlowApiRequestAllItems(
});
uri = responseData.headers.link;
// @ts-ignore
returnData.push.apply(returnData, responseData.body[propertyName]);
returnData.push.apply(returnData, responseData.body[propertyName] as IDataObject[]);
} while (responseData.headers.link !== undefined && responseData.headers.link !== '');
return returnData;