fix(Notion Node): Regex for block id (#8860)

This commit is contained in:
Michael Kret
2024-03-13 13:57:17 +02:00
committed by GitHub
parent e78cc2d8d2
commit a1f6c570d6
5 changed files with 124 additions and 10 deletions

View File

@@ -11,6 +11,7 @@ import { jsonParse, NodeApiError } from 'n8n-workflow';
import type { SortData, FileRecord } from '../shared/GenericFunctions';
import {
downloadFiles,
extractBlockId,
extractDatabaseId,
extractDatabaseMentionRLC,
extractPageId,
@@ -45,6 +46,7 @@ export class NotionV2 implements INodeType {
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const items = this.getInputData();
const nodeVersion = this.getNode().typeVersion;
const resource = this.getNodeParameter('resource', 0);
const operation = this.getNodeParameter('operation', 0);
@@ -60,9 +62,7 @@ export class NotionV2 implements INodeType {
if (operation === 'append') {
for (let i = 0; i < itemsLength; i++) {
try {
const blockId = extractPageId(
this.getNodeParameter('blockId', i, '', { extractValue: true }) as string,
);
const blockId = extractBlockId.call(this, nodeVersion, i);
const blockValues = this.getNodeParameter(
'blockUi.blockValues',
i,
@@ -100,9 +100,7 @@ export class NotionV2 implements INodeType {
if (operation === 'getAll') {
for (let i = 0; i < itemsLength; i++) {
try {
const blockId = extractPageId(
this.getNodeParameter('blockId', i, '', { extractValue: true }) as string,
);
const blockId = extractBlockId.call(this, nodeVersion, i);
const returnAll = this.getNodeParameter('returnAll', i);
const fetchNestedBlocks = this.getNodeParameter('fetchNestedBlocks', i) as boolean;
@@ -148,8 +146,6 @@ export class NotionV2 implements INodeType {
..._data,
}));
const nodeVersion = this.getNode().typeVersion;
if (nodeVersion > 2) {
const simplifyOutput = this.getNodeParameter('simplifyOutput', i) as boolean;