mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
refactor(core): Remove linting exceptions in nodes-base (#4794)
* ⚡ enabled array-type * ⚡ await-thenable on * ⚡ ban-types on * ⚡ default-param-last on * ⚡ dot-notation on * ⚡ member-delimiter-style on * ⚡ no-duplicate-imports on * ⚡ no-empty-interface on * ⚡ no-floating-promises on * ⚡ no-for-in-array on * ⚡ no-invalid-void-type on * ⚡ no-loop-func on * ⚡ no-shadow on * ⚡ ban-ts-comment re enabled * ⚡ @typescript-eslint/lines-between-class-members on * address my own comment * @typescript-eslint/return-await on * @typescript-eslint/promise-function-async on * @typescript-eslint/no-unnecessary-boolean-literal-compare on * @typescript-eslint/no-unnecessary-type-assertion on * prefer-const on * @typescript-eslint/prefer-optional-chain on Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
@@ -318,7 +318,7 @@ export class NotionV2 implements INodeType {
|
||||
this.getNodeParameter('databaseId', i, '', { extractValue: true }) as string,
|
||||
);
|
||||
responseData = await notionApiRequest.call(this, 'GET', `/databases/${databaseId}`);
|
||||
if (simple === true) {
|
||||
if (simple) {
|
||||
responseData = simplifyObjects(responseData, download)[0];
|
||||
}
|
||||
|
||||
@@ -346,11 +346,11 @@ export class NotionV2 implements INodeType {
|
||||
body,
|
||||
);
|
||||
} else {
|
||||
body['page_size'] = this.getNodeParameter('limit', i);
|
||||
body.page_size = this.getNodeParameter('limit', i);
|
||||
responseData = await notionApiRequest.call(this, 'POST', `/search`, body);
|
||||
responseData = responseData.results;
|
||||
}
|
||||
if (simple === true) {
|
||||
if (simple) {
|
||||
responseData = simplifyObjects(responseData, download);
|
||||
}
|
||||
|
||||
@@ -376,11 +376,11 @@ export class NotionV2 implements INodeType {
|
||||
};
|
||||
|
||||
if (text) {
|
||||
body['query'] = text;
|
||||
body.query = text;
|
||||
}
|
||||
if (options.sort) {
|
||||
const sort = (((options.sort as IDataObject) || {}).sortValue as IDataObject) || {};
|
||||
body['sort'] = sort;
|
||||
const sort = ((options.sort as IDataObject)?.sortValue as IDataObject) || {};
|
||||
body.sort = sort;
|
||||
}
|
||||
if (returnAll) {
|
||||
responseData = await notionApiRequestAllItems.call(
|
||||
@@ -402,7 +402,7 @@ export class NotionV2 implements INodeType {
|
||||
responseData = responseData.splice(0, qs.limit);
|
||||
}
|
||||
|
||||
if (simple === true) {
|
||||
if (simple) {
|
||||
responseData = simplifyObjects(responseData, download);
|
||||
}
|
||||
|
||||
@@ -446,25 +446,25 @@ export class NotionV2 implements INodeType {
|
||||
],
|
||||
};
|
||||
}
|
||||
body.parent['database_id'] = this.getNodeParameter('databaseId', i, '', {
|
||||
body.parent.database_id = this.getNodeParameter('databaseId', i, '', {
|
||||
extractValue: true,
|
||||
}) as string;
|
||||
const properties = this.getNodeParameter(
|
||||
const propertiesValues = this.getNodeParameter(
|
||||
'propertiesUi.propertyValues',
|
||||
i,
|
||||
[],
|
||||
) as IDataObject[];
|
||||
if (properties.length !== 0) {
|
||||
if (propertiesValues.length !== 0) {
|
||||
body.properties = Object.assign(
|
||||
body.properties,
|
||||
mapProperties(properties, timezone, 2) as IDataObject,
|
||||
mapProperties(propertiesValues, timezone, 2) as IDataObject,
|
||||
);
|
||||
}
|
||||
const blockValues = this.getNodeParameter('blockUi.blockValues', i, []) as IDataObject[];
|
||||
extractDatabaseMentionRLC(blockValues);
|
||||
body.children = formatBlocks(blockValues);
|
||||
responseData = await notionApiRequest.call(this, 'POST', '/pages', body);
|
||||
if (simple === true) {
|
||||
if (simple) {
|
||||
responseData = simplifyObjects(responseData);
|
||||
}
|
||||
|
||||
@@ -483,7 +483,7 @@ export class NotionV2 implements INodeType {
|
||||
);
|
||||
const simple = this.getNodeParameter('simple', i) as boolean;
|
||||
responseData = await notionApiRequest.call(this, 'GET', `/pages/${pageId}`);
|
||||
if (simple === true) {
|
||||
if (simple) {
|
||||
responseData = simplifyObjects(responseData, download);
|
||||
}
|
||||
|
||||
@@ -537,7 +537,7 @@ export class NotionV2 implements INodeType {
|
||||
}
|
||||
if (sort) {
|
||||
//@ts-expect-error
|
||||
body['sorts'] = mapSorting(sort);
|
||||
body.sorts = mapSorting(sort);
|
||||
}
|
||||
if (returnAll) {
|
||||
responseData = await notionApiRequestAllItems.call(
|
||||
@@ -559,10 +559,10 @@ export class NotionV2 implements INodeType {
|
||||
);
|
||||
responseData = responseData.results;
|
||||
}
|
||||
if (download === true) {
|
||||
if (download) {
|
||||
responseData = await downloadFiles.call(this, responseData);
|
||||
}
|
||||
if (simple === true) {
|
||||
if (simple) {
|
||||
responseData = simplifyObjects(responseData, download);
|
||||
}
|
||||
|
||||
@@ -593,7 +593,7 @@ export class NotionV2 implements INodeType {
|
||||
body.properties = mapProperties(properties, timezone, 2) as IDataObject;
|
||||
}
|
||||
responseData = await notionApiRequest.call(this, 'PATCH', `/pages/${pageId}`, body);
|
||||
if (simple === true) {
|
||||
if (simple) {
|
||||
responseData = simplifyObjects(responseData, false);
|
||||
}
|
||||
|
||||
@@ -649,7 +649,7 @@ export class NotionV2 implements INodeType {
|
||||
responseData = await notionApiRequest.call(this, 'PATCH', `/pages/${pageId}`, {
|
||||
archived: true,
|
||||
});
|
||||
if (simple === true) {
|
||||
if (simple) {
|
||||
responseData = simplifyObjects(responseData, download);
|
||||
}
|
||||
|
||||
@@ -669,7 +669,7 @@ export class NotionV2 implements INodeType {
|
||||
parent: {},
|
||||
properties: {},
|
||||
};
|
||||
body.parent['page_id'] = extractPageId(
|
||||
body.parent.page_id = extractPageId(
|
||||
this.getNodeParameter('pageId', i, '', { extractValue: true }) as string,
|
||||
);
|
||||
body.properties = formatTitle(this.getNodeParameter('title', i) as string);
|
||||
@@ -677,7 +677,7 @@ export class NotionV2 implements INodeType {
|
||||
extractDatabaseMentionRLC(blockValues);
|
||||
body.children = formatBlocks(blockValues);
|
||||
responseData = await notionApiRequest.call(this, 'POST', '/pages', body);
|
||||
if (simple === true) {
|
||||
if (simple) {
|
||||
responseData = simplifyObjects(responseData, download);
|
||||
}
|
||||
|
||||
@@ -698,15 +698,15 @@ export class NotionV2 implements INodeType {
|
||||
const body: IDataObject = {};
|
||||
|
||||
if (text) {
|
||||
body['query'] = text;
|
||||
body.query = text;
|
||||
}
|
||||
if (options.filter) {
|
||||
const filter = (((options.filter as IDataObject) || {}).filters as IDataObject[]) || [];
|
||||
body['filter'] = filter;
|
||||
const filter = ((options.filter as IDataObject)?.filters as IDataObject[]) || [];
|
||||
body.filter = filter;
|
||||
}
|
||||
if (options.sort) {
|
||||
const sort = (((options.sort as IDataObject) || {}).sortValue as IDataObject) || {};
|
||||
body['sort'] = sort;
|
||||
const sort = ((options.sort as IDataObject)?.sortValue as IDataObject) || {};
|
||||
body.sort = sort;
|
||||
}
|
||||
if (returnAll) {
|
||||
responseData = await notionApiRequestAllItems.call(
|
||||
@@ -728,7 +728,7 @@ export class NotionV2 implements INodeType {
|
||||
responseData = responseData.splice(0, qs.limit);
|
||||
}
|
||||
|
||||
if (simple === true) {
|
||||
if (simple) {
|
||||
responseData = simplifyObjects(responseData, download);
|
||||
}
|
||||
|
||||
@@ -741,7 +741,7 @@ export class NotionV2 implements INodeType {
|
||||
}
|
||||
}
|
||||
|
||||
if (download === true) {
|
||||
if (download) {
|
||||
const rawData = returnData.map((data) => data.json);
|
||||
return this.prepareOutputData(rawData as INodeExecutionData[]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user