n8n-nodes-notion-advanced 1.1.14-beta → 1.1.15-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,8 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
createRichText,
|
7
|
-
resolvePageId,
|
8
|
-
} = require('./NotionUtils');
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.NotionAITool = void 0;
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
5
|
+
const NotionUtils_1 = require("./NotionUtils");
|
9
6
|
|
10
7
|
class NotionAITool {
|
11
8
|
constructor() {
|
@@ -292,9 +289,9 @@ class NotionAITool {
|
|
292
289
|
const responseData = [];
|
293
290
|
|
294
291
|
// Validate credentials
|
295
|
-
const isValid = await validateCredentials.call(this);
|
292
|
+
const isValid = await NotionUtils_1.validateCredentials.call(this);
|
296
293
|
if (!isValid) {
|
297
|
-
throw new NodeOperationError(this.getNode(), 'Invalid Notion API credentials');
|
294
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Invalid Notion API credentials');
|
298
295
|
}
|
299
296
|
|
300
297
|
for (let i = 0; i < items.length; i++) {
|
@@ -322,7 +319,7 @@ class NotionAITool {
|
|
322
319
|
result = await this.queryDatabase(i);
|
323
320
|
break;
|
324
321
|
default:
|
325
|
-
throw new NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
322
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
|
326
323
|
}
|
327
324
|
|
328
325
|
responseData.push({
|
@@ -351,14 +348,14 @@ class NotionAITool {
|
|
351
348
|
const content = this.getNodeParameter('content', itemIndex, '');
|
352
349
|
const additionalOptions = this.getNodeParameter('additionalOptions', itemIndex, {});
|
353
350
|
|
354
|
-
const resolvedParentId = await resolvePageId.call(this, parentId);
|
351
|
+
const resolvedParentId = await NotionUtils_1.resolvePageId.call(this, parentId);
|
355
352
|
|
356
353
|
// Create the page first
|
357
354
|
const pageBody = {
|
358
355
|
parent: { page_id: resolvedParentId },
|
359
356
|
properties: {
|
360
357
|
title: {
|
361
|
-
title: [createRichText(pageTitle)],
|
358
|
+
title: [NotionUtils_1.createRichText(pageTitle)],
|
362
359
|
},
|
363
360
|
},
|
364
361
|
};
|
@@ -371,13 +368,13 @@ class NotionAITool {
|
|
371
368
|
pageBody.cover = { type: 'external', external: { url: additionalOptions.coverUrl } };
|
372
369
|
}
|
373
370
|
|
374
|
-
const page = await notionApiRequest.call(this, 'POST', '/pages', pageBody);
|
371
|
+
const page = await NotionUtils_1.notionApiRequest.call(this, 'POST', '/pages', pageBody);
|
375
372
|
|
376
373
|
// If content is provided, add it to the page
|
377
374
|
if (content) {
|
378
375
|
const blocks = this.parseContentToBlocks(content);
|
379
376
|
if (blocks.length > 0) {
|
380
|
-
await notionApiRequest.call(this, 'PATCH', `/blocks/${page.id}/children`, {
|
377
|
+
await NotionUtils_1.notionApiRequest.call(this, 'PATCH', `/blocks/${page.id}/children`, {
|
381
378
|
children: blocks,
|
382
379
|
});
|
383
380
|
}
|
@@ -395,14 +392,14 @@ class NotionAITool {
|
|
395
392
|
const targetPageId = this.getNodeParameter('targetPageId', itemIndex);
|
396
393
|
const content = this.getNodeParameter('content', itemIndex);
|
397
394
|
|
398
|
-
const resolvedPageId = await resolvePageId.call(this, targetPageId);
|
395
|
+
const resolvedPageId = await NotionUtils_1.resolvePageId.call(this, targetPageId);
|
399
396
|
const blocks = this.parseContentToBlocks(content);
|
400
397
|
|
401
398
|
if (blocks.length === 0) {
|
402
|
-
throw new NodeOperationError(this.getNode(), 'No valid content blocks found to add');
|
399
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'No valid content blocks found to add');
|
403
400
|
}
|
404
401
|
|
405
|
-
const result = await notionApiRequest.call(this, 'PATCH', `/blocks/${resolvedPageId}/children`, {
|
402
|
+
const result = await NotionUtils_1.notionApiRequest.call(this, 'PATCH', `/blocks/${resolvedPageId}/children`, {
|
406
403
|
children: blocks,
|
407
404
|
});
|
408
405
|
|
@@ -433,7 +430,7 @@ class NotionAITool {
|
|
433
430
|
value: 'page',
|
434
431
|
};
|
435
432
|
|
436
|
-
const response = await notionApiRequest.call(this, 'POST', '/search', body);
|
433
|
+
const response = await NotionUtils_1.notionApiRequest.call(this, 'POST', '/search', body);
|
437
434
|
|
438
435
|
return {
|
439
436
|
totalResults: response.results?.length || 0,
|
@@ -446,10 +443,10 @@ class NotionAITool {
|
|
446
443
|
const targetPageId = this.getNodeParameter('targetPageId', itemIndex);
|
447
444
|
const propertiesToUpdate = this.getNodeParameter('propertiesToUpdate', itemIndex);
|
448
445
|
|
449
|
-
const resolvedPageId = await resolvePageId.call(this, targetPageId);
|
446
|
+
const resolvedPageId = await NotionUtils_1.resolvePageId.call(this, targetPageId);
|
450
447
|
const properties = this.parsePropertiesToUpdate(propertiesToUpdate);
|
451
448
|
|
452
|
-
const result = await notionApiRequest.call(this, 'PATCH', `/pages/${resolvedPageId}`, {
|
449
|
+
const result = await NotionUtils_1.notionApiRequest.call(this, 'PATCH', `/pages/${resolvedPageId}`, {
|
453
450
|
properties,
|
454
451
|
});
|
455
452
|
|
@@ -465,10 +462,10 @@ class NotionAITool {
|
|
465
462
|
const parentId = this.getNodeParameter('parentId', itemIndex);
|
466
463
|
const entryProperties = this.getNodeParameter('entryProperties', itemIndex);
|
467
464
|
|
468
|
-
const resolvedParentId = await resolvePageId.call(this, parentId);
|
465
|
+
const resolvedParentId = await NotionUtils_1.resolvePageId.call(this, parentId);
|
469
466
|
const properties = this.parsePropertiesToUpdate(entryProperties);
|
470
467
|
|
471
|
-
const result = await notionApiRequest.call(this, 'POST', '/pages', {
|
468
|
+
const result = await NotionUtils_1.notionApiRequest.call(this, 'POST', '/pages', {
|
472
469
|
parent: { database_id: resolvedParentId },
|
473
470
|
properties,
|
474
471
|
});
|
@@ -487,7 +484,7 @@ class NotionAITool {
|
|
487
484
|
const additionalOptions = this.getNodeParameter('additionalOptions', itemIndex, {});
|
488
485
|
const maxResults = additionalOptions.maxResults || 20;
|
489
486
|
|
490
|
-
const resolvedDatabaseId = await resolvePageId.call(this, databaseId);
|
487
|
+
const resolvedDatabaseId = await NotionUtils_1.resolvePageId.call(this, databaseId);
|
491
488
|
const body = {
|
492
489
|
page_size: Math.min(maxResults, 100),
|
493
490
|
};
|
@@ -506,7 +503,7 @@ class NotionAITool {
|
|
506
503
|
}
|
507
504
|
}
|
508
505
|
|
509
|
-
const response = await notionApiRequest.call(this, 'POST', `/databases/${resolvedDatabaseId}/query`, body);
|
506
|
+
const response = await NotionUtils_1.notionApiRequest.call(this, 'POST', `/databases/${resolvedDatabaseId}/query`, body);
|
510
507
|
|
511
508
|
return {
|
512
509
|
databaseId: resolvedDatabaseId,
|
@@ -530,7 +527,7 @@ class NotionAITool {
|
|
530
527
|
object: 'block',
|
531
528
|
type: 'heading_1',
|
532
529
|
heading_1: {
|
533
|
-
rich_text: [createRichText(line.substring(2))],
|
530
|
+
rich_text: [NotionUtils_1.createRichText(line.substring(2))],
|
534
531
|
},
|
535
532
|
});
|
536
533
|
} else if (line.startsWith('## ')) {
|
@@ -538,7 +535,7 @@ class NotionAITool {
|
|
538
535
|
object: 'block',
|
539
536
|
type: 'heading_2',
|
540
537
|
heading_2: {
|
541
|
-
rich_text: [createRichText(line.substring(3))],
|
538
|
+
rich_text: [NotionUtils_1.createRichText(line.substring(3))],
|
542
539
|
},
|
543
540
|
});
|
544
541
|
} else if (line.startsWith('### ')) {
|
@@ -546,7 +543,7 @@ class NotionAITool {
|
|
546
543
|
object: 'block',
|
547
544
|
type: 'heading_3',
|
548
545
|
heading_3: {
|
549
|
-
rich_text: [createRichText(line.substring(4))],
|
546
|
+
rich_text: [NotionUtils_1.createRichText(line.substring(4))],
|
550
547
|
},
|
551
548
|
});
|
552
549
|
} else if (line.startsWith('- ') || line.startsWith('* ')) {
|
@@ -554,7 +551,7 @@ class NotionAITool {
|
|
554
551
|
object: 'block',
|
555
552
|
type: 'bulleted_list_item',
|
556
553
|
bulleted_list_item: {
|
557
|
-
rich_text: [createRichText(line.substring(2))],
|
554
|
+
rich_text: [NotionUtils_1.createRichText(line.substring(2))],
|
558
555
|
},
|
559
556
|
});
|
560
557
|
} else if (line.match(/^\d+\. /)) {
|
@@ -562,7 +559,7 @@ class NotionAITool {
|
|
562
559
|
object: 'block',
|
563
560
|
type: 'numbered_list_item',
|
564
561
|
numbered_list_item: {
|
565
|
-
rich_text: [createRichText(line.replace(/^\d+\. /, ''))],
|
562
|
+
rich_text: [NotionUtils_1.createRichText(line.replace(/^\d+\. /, ''))],
|
566
563
|
},
|
567
564
|
});
|
568
565
|
} else if (line.startsWith('> ')) {
|
@@ -570,7 +567,7 @@ class NotionAITool {
|
|
570
567
|
object: 'block',
|
571
568
|
type: 'quote',
|
572
569
|
quote: {
|
573
|
-
rich_text: [createRichText(line.substring(2))],
|
570
|
+
rich_text: [NotionUtils_1.createRichText(line.substring(2))],
|
574
571
|
},
|
575
572
|
});
|
576
573
|
} else if (line.startsWith('```')) {
|
@@ -585,7 +582,7 @@ class NotionAITool {
|
|
585
582
|
object: 'block',
|
586
583
|
type: 'code',
|
587
584
|
code: {
|
588
|
-
rich_text: [createRichText(codeLines.join('\n'))],
|
585
|
+
rich_text: [NotionUtils_1.createRichText(codeLines.join('\n'))],
|
589
586
|
language: 'plain text',
|
590
587
|
},
|
591
588
|
});
|
@@ -595,7 +592,7 @@ class NotionAITool {
|
|
595
592
|
object: 'block',
|
596
593
|
type: 'paragraph',
|
597
594
|
paragraph: {
|
598
|
-
rich_text: [createRichText(line)],
|
595
|
+
rich_text: [NotionUtils_1.createRichText(line)],
|
599
596
|
},
|
600
597
|
});
|
601
598
|
}
|
@@ -624,7 +621,7 @@ class NotionAITool {
|
|
624
621
|
while ((match = pattern.exec(propertiesString)) !== null) {
|
625
622
|
const [, key, value] = match;
|
626
623
|
properties[key.trim()] = {
|
627
|
-
rich_text: [createRichText(value.trim())],
|
624
|
+
rich_text: [NotionUtils_1.createRichText(value.trim())],
|
628
625
|
};
|
629
626
|
}
|
630
627
|
}
|
package/dist/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "n8n-nodes-notion-advanced",
|
3
|
-
"version": "1.1.
|
3
|
+
"version": "1.1.15-beta",
|
4
4
|
"description": "Advanced n8n Notion nodes: Full-featured workflow node + AI Agent Tool for intelligent Notion automation with 25+ block types (BETA)",
|
5
5
|
"scripts": {
|
6
6
|
"build": "node dev-notes/build-for-install.js",
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "n8n-nodes-notion-advanced",
|
3
|
-
"version": "1.1.
|
3
|
+
"version": "1.1.15-beta",
|
4
4
|
"description": "Advanced n8n Notion nodes: Full-featured workflow node + AI Agent Tool for intelligent Notion automation with 25+ block types (BETA)",
|
5
5
|
"scripts": {
|
6
6
|
"build": "node dev-notes/build-for-install.js",
|