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

@@ -147,7 +147,7 @@ export class Bitwarden implements INodeType {
const endpoint = `/public/collections/${id}`;
responseData = await bitwardenApiRequest.call(this, 'GET', endpoint, {}, {});
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
this.helpers.returnJsonArray(responseData as IDataObject[]),
{ itemData: { item: i } },
);
@@ -160,7 +160,7 @@ export class Bitwarden implements INodeType {
const endpoint = '/public/collections';
responseData = await handleGetAll.call(this, i, 'GET', endpoint, {}, {});
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
this.helpers.returnJsonArray(responseData as IDataObject[]),
{ itemData: { item: i } },
);
@@ -199,7 +199,7 @@ export class Bitwarden implements INodeType {
const endpoint = `/public/collections/${id}`;
responseData = await bitwardenApiRequest.call(this, 'PUT', endpoint, {}, body);
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
this.helpers.returnJsonArray(responseData as IDataObject[]),
{ itemData: { item: i } },
);
@@ -220,7 +220,7 @@ export class Bitwarden implements INodeType {
const endpoint = '/public/events';
responseData = await handleGetAll.call(this, i, 'GET', endpoint, qs, {});
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
this.helpers.returnJsonArray(responseData as IDataObject[]),
{ itemData: { item: i } },
);
@@ -260,7 +260,7 @@ export class Bitwarden implements INodeType {
const endpoint = '/public/groups';
responseData = await bitwardenApiRequest.call(this, 'POST', endpoint, {}, body);
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
this.helpers.returnJsonArray(responseData as IDataObject[]),
{ itemData: { item: i } },
);
@@ -288,7 +288,7 @@ export class Bitwarden implements INodeType {
const endpoint = `/public/groups/${id}`;
responseData = await bitwardenApiRequest.call(this, 'GET', endpoint, {}, {});
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
this.helpers.returnJsonArray(responseData as IDataObject[]),
{ itemData: { item: i } },
);
@@ -301,7 +301,7 @@ export class Bitwarden implements INodeType {
const endpoint = '/public/groups';
responseData = await handleGetAll.call(this, i, 'GET', endpoint, {}, {});
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
this.helpers.returnJsonArray(responseData as IDataObject[]),
{ itemData: { item: i } },
);
@@ -316,7 +316,7 @@ export class Bitwarden implements INodeType {
responseData = await bitwardenApiRequest.call(this, 'GET', endpoint, {}, {});
responseData = responseData.map((memberId: string) => ({ memberId }));
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
this.helpers.returnJsonArray(responseData as IDataObject[]),
{ itemData: { item: i } },
);
@@ -378,7 +378,7 @@ export class Bitwarden implements INodeType {
const endpoint = `/public/groups/${groupId}`;
responseData = await bitwardenApiRequest.call(this, 'PUT', endpoint, {}, body);
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
this.helpers.returnJsonArray(responseData as IDataObject[]),
{ itemData: { item: i } },
);
@@ -439,7 +439,7 @@ export class Bitwarden implements INodeType {
const endpoint = '/public/members/';
responseData = await bitwardenApiRequest.call(this, 'POST', endpoint, {}, body);
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
this.helpers.returnJsonArray(responseData as IDataObject[]),
{ itemData: { item: i } },
);
@@ -468,7 +468,7 @@ export class Bitwarden implements INodeType {
const endpoint = `/public/members/${id}`;
responseData = await bitwardenApiRequest.call(this, 'GET', endpoint, {}, {});
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
this.helpers.returnJsonArray(responseData as IDataObject[]),
{ itemData: { item: i } },
);
@@ -481,7 +481,7 @@ export class Bitwarden implements INodeType {
const endpoint = '/public/members';
responseData = await handleGetAll.call(this, i, 'GET', endpoint, {}, {});
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
this.helpers.returnJsonArray(responseData as IDataObject[]),
{ itemData: { item: i } },
);
@@ -496,7 +496,7 @@ export class Bitwarden implements INodeType {
responseData = await bitwardenApiRequest.call(this, 'GET', endpoint, {}, {});
responseData = responseData.map((groupId: string) => ({ groupId }));
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
this.helpers.returnJsonArray(responseData as IDataObject[]),
{ itemData: { item: i } },
);
returnData.push(...executionData);
@@ -542,7 +542,7 @@ export class Bitwarden implements INodeType {
const endpoint = `/public/members/${id}`;
responseData = await bitwardenApiRequest.call(this, 'PUT', endpoint, {}, body);
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
this.helpers.returnJsonArray(responseData as IDataObject[]),
{ itemData: { item: i } },
);
returnData.push(...executionData);

View File

@@ -1,6 +1,11 @@
import type { IExecuteFunctions } from 'n8n-core';
import type { IDataObject, ILoadOptionsFunctions, INodePropertyOptions } from 'n8n-workflow';
import type {
IDataObject,
ILoadOptionsFunctions,
INodePropertyOptions,
JsonObject,
} from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow';
import type { OptionsWithUri } from 'request';
@@ -61,7 +66,7 @@ export async function bitwardenApiRequest(
try {
return await this.helpers.request(options);
} catch (error) {
throw new NodeApiError(this.getNode(), error);
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
@@ -95,7 +100,7 @@ export async function getAccessToken(
const { access_token } = await this.helpers.request(options);
return access_token;
} catch (error) {
throw new NodeApiError(this.getNode(), error);
throw new NodeApiError(this.getNode(), error as JsonObject);
}
}
@@ -130,7 +135,7 @@ export async function loadResource(this: ILoadOptionsFunctions, resource: string
const token = await getAccessToken.call(this);
const endpoint = `/public/${resource}`;
const { data } = await bitwardenApiRequest.call(this, 'GET', endpoint, {}, {}, token);
const { data } = await bitwardenApiRequest.call(this, 'GET', endpoint, {}, {}, token as string);
data.forEach(({ id, name, externalId }: { id: string; name: string; externalId?: string }) => {
returnData.push({