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

@@ -11,7 +11,7 @@ import type {
} from 'n8n-workflow';
import { jsonParse, NodeApiError } from 'n8n-workflow';
import type { SortData } from '../GenericFunctions';
import type { SortData, FileRecord } from '../GenericFunctions';
import {
downloadFiles,
extractDatabaseId,
@@ -55,7 +55,7 @@ export class NotionV2 implements INodeType {
extractValue: true,
}) as string;
const { properties } = await notionApiRequest.call(this, 'GET', `/databases/${databaseId}`);
for (const key of Object.keys(properties)) {
for (const key of Object.keys(properties as IDataObject)) {
//remove parameters that cannot be set from the API.
if (
![
@@ -65,7 +65,7 @@ export class NotionV2 implements INodeType {
'last_edited_by',
'formula',
'rollup',
].includes(properties[key].type)
].includes(properties[key].type as string)
) {
returnData.push({
name: `${key}`,
@@ -90,7 +90,7 @@ export class NotionV2 implements INodeType {
extractValue: true,
}) as string;
const { properties } = await notionApiRequest.call(this, 'GET', `/databases/${databaseId}`);
for (const key of Object.keys(properties)) {
for (const key of Object.keys(properties as IDataObject)) {
returnData.push({
name: `${key}`,
value: `${key}|${properties[key].type}`,
@@ -161,7 +161,7 @@ export class NotionV2 implements INodeType {
parent: { database_id: databaseId },
} = await notionApiRequest.call(this, 'GET', `/pages/${pageId}`);
const { properties } = await notionApiRequest.call(this, 'GET', `/databases/${databaseId}`);
for (const key of Object.keys(properties)) {
for (const key of Object.keys(properties as IDataObject)) {
//remove parameters that cannot be set from the API.
if (
![
@@ -171,7 +171,7 @@ export class NotionV2 implements INodeType {
'last_edited_by',
'formula',
'rollup',
].includes(properties[key].type)
].includes(properties[key].type as string)
) {
returnData.push({
name: `${key}`,
@@ -261,7 +261,7 @@ export class NotionV2 implements INodeType {
);
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(block),
this.helpers.returnJsonArray(block as IDataObject),
{ itemData: { item: i } },
);
returnData.push(...executionData);
@@ -302,7 +302,7 @@ export class NotionV2 implements INodeType {
}));
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
this.helpers.returnJsonArray(responseData as IDataObject),
{ itemData: { item: i } },
);
returnData.push(...executionData);
@@ -323,7 +323,7 @@ export class NotionV2 implements INodeType {
}
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
this.helpers.returnJsonArray(responseData as IDataObject),
{ itemData: { item: i } },
);
returnData.push(...executionData);
@@ -355,7 +355,7 @@ export class NotionV2 implements INodeType {
}
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
this.helpers.returnJsonArray(responseData as IDataObject),
{ itemData: { item: i } },
);
returnData.push(...executionData);
@@ -407,7 +407,7 @@ export class NotionV2 implements INodeType {
}
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
this.helpers.returnJsonArray(responseData as IDataObject),
{ itemData: { item: i } },
);
returnData.push(...executionData);
@@ -422,7 +422,7 @@ export class NotionV2 implements INodeType {
}) as string;
const { properties } = await notionApiRequest.call(this, 'GET', `/databases/${databaseId}`);
let titleKey = '';
for (const key of Object.keys(properties)) {
for (const key of Object.keys(properties as IDataObject)) {
if (properties[key].type === 'title') {
titleKey = key;
}
@@ -479,7 +479,7 @@ export class NotionV2 implements INodeType {
}
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
this.helpers.returnJsonArray(responseData as IDataObject),
{ itemData: { item: i } },
);
returnData.push(...executionData);
@@ -498,7 +498,7 @@ export class NotionV2 implements INodeType {
}
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
this.helpers.returnJsonArray(responseData as IDataObject),
{ itemData: { item: i } },
);
returnData.push(...executionData);
@@ -569,14 +569,14 @@ export class NotionV2 implements INodeType {
responseData = responseData.results;
}
if (download) {
responseData = await downloadFiles.call(this, responseData);
responseData = await downloadFiles.call(this, responseData as FileRecord[]);
}
if (simple) {
responseData = simplifyObjects(responseData, download);
}
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
this.helpers.returnJsonArray(responseData as IDataObject),
{ itemData: { item: i } },
);
returnData.push(...executionData);
@@ -607,7 +607,7 @@ export class NotionV2 implements INodeType {
}
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
this.helpers.returnJsonArray(responseData as IDataObject),
{ itemData: { item: i } },
);
returnData.push(...executionData);
@@ -622,7 +622,7 @@ export class NotionV2 implements INodeType {
responseData = await notionApiRequest.call(this, 'GET', `/users/${userId}`);
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
this.helpers.returnJsonArray(responseData as IDataObject),
{ itemData: { item: i } },
);
returnData.push(...executionData);
@@ -640,7 +640,7 @@ export class NotionV2 implements INodeType {
}
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
this.helpers.returnJsonArray(responseData as IDataObject),
{ itemData: { item: i } },
);
returnData.push(...executionData);
@@ -663,7 +663,7 @@ export class NotionV2 implements INodeType {
}
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
this.helpers.returnJsonArray(responseData as IDataObject),
{ itemData: { item: i } },
);
returnData.push(...executionData);
@@ -700,7 +700,7 @@ export class NotionV2 implements INodeType {
}
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
this.helpers.returnJsonArray(responseData as IDataObject),
{ itemData: { item: i } },
);
returnData.push(...executionData);
@@ -751,7 +751,7 @@ export class NotionV2 implements INodeType {
}
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(responseData),
this.helpers.returnJsonArray(responseData as IDataObject),
{ itemData: { item: i } },
);
returnData.push(...executionData);