n8n-nodes-notion-advanced 1.1.13-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
- const { NodeConnectionType, NodeOperationError } = require('n8n-workflow');
2
-
3
- const {
4
- notionApiRequest,
5
- validateCredentials,
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() {
@@ -20,8 +17,24 @@ class NotionAITool {
20
17
  defaults: {
21
18
  name: 'Notion AI Tool',
22
19
  },
23
- inputs: [NodeConnectionType.Main],
24
- outputs: [NodeConnectionType.Main],
20
+ inputs: ['main'],
21
+ outputs: ['main'],
22
+ codex: {
23
+ categories: ['Productivity', 'AI', 'Documentation'],
24
+ subcategories: {
25
+ 'Productivity': ['Notion', 'Knowledge Management'],
26
+ 'AI': ['AI Agent Tools', 'Natural Language Processing'],
27
+ 'Documentation': ['Page Creation', 'Content Management']
28
+ },
29
+ resources: {
30
+ primaryDocumentation: [
31
+ {
32
+ url: 'https://github.com/AZ-IT-US/n8n-notion-advanced-node#ai-tool-usage',
33
+ },
34
+ ],
35
+ },
36
+ alias: ['notion', 'productivity', 'ai-tool', 'pages', 'database'],
37
+ },
25
38
  credentials: [
26
39
  {
27
40
  name: 'notionApi',
@@ -276,9 +289,9 @@ class NotionAITool {
276
289
  const responseData = [];
277
290
 
278
291
  // Validate credentials
279
- const isValid = await validateCredentials.call(this);
292
+ const isValid = await NotionUtils_1.validateCredentials.call(this);
280
293
  if (!isValid) {
281
- throw new NodeOperationError(this.getNode(), 'Invalid Notion API credentials');
294
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Invalid Notion API credentials');
282
295
  }
283
296
 
284
297
  for (let i = 0; i < items.length; i++) {
@@ -306,7 +319,7 @@ class NotionAITool {
306
319
  result = await this.queryDatabase(i);
307
320
  break;
308
321
  default:
309
- throw new NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
322
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
310
323
  }
311
324
 
312
325
  responseData.push({
@@ -335,14 +348,14 @@ class NotionAITool {
335
348
  const content = this.getNodeParameter('content', itemIndex, '');
336
349
  const additionalOptions = this.getNodeParameter('additionalOptions', itemIndex, {});
337
350
 
338
- const resolvedParentId = await resolvePageId.call(this, parentId);
351
+ const resolvedParentId = await NotionUtils_1.resolvePageId.call(this, parentId);
339
352
 
340
353
  // Create the page first
341
354
  const pageBody = {
342
355
  parent: { page_id: resolvedParentId },
343
356
  properties: {
344
357
  title: {
345
- title: [createRichText(pageTitle)],
358
+ title: [NotionUtils_1.createRichText(pageTitle)],
346
359
  },
347
360
  },
348
361
  };
@@ -355,13 +368,13 @@ class NotionAITool {
355
368
  pageBody.cover = { type: 'external', external: { url: additionalOptions.coverUrl } };
356
369
  }
357
370
 
358
- const page = await notionApiRequest.call(this, 'POST', '/pages', pageBody);
371
+ const page = await NotionUtils_1.notionApiRequest.call(this, 'POST', '/pages', pageBody);
359
372
 
360
373
  // If content is provided, add it to the page
361
374
  if (content) {
362
375
  const blocks = this.parseContentToBlocks(content);
363
376
  if (blocks.length > 0) {
364
- await notionApiRequest.call(this, 'PATCH', `/blocks/${page.id}/children`, {
377
+ await NotionUtils_1.notionApiRequest.call(this, 'PATCH', `/blocks/${page.id}/children`, {
365
378
  children: blocks,
366
379
  });
367
380
  }
@@ -379,14 +392,14 @@ class NotionAITool {
379
392
  const targetPageId = this.getNodeParameter('targetPageId', itemIndex);
380
393
  const content = this.getNodeParameter('content', itemIndex);
381
394
 
382
- const resolvedPageId = await resolvePageId.call(this, targetPageId);
395
+ const resolvedPageId = await NotionUtils_1.resolvePageId.call(this, targetPageId);
383
396
  const blocks = this.parseContentToBlocks(content);
384
397
 
385
398
  if (blocks.length === 0) {
386
- 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');
387
400
  }
388
401
 
389
- const result = await notionApiRequest.call(this, 'PATCH', `/blocks/${resolvedPageId}/children`, {
402
+ const result = await NotionUtils_1.notionApiRequest.call(this, 'PATCH', `/blocks/${resolvedPageId}/children`, {
390
403
  children: blocks,
391
404
  });
392
405
 
@@ -417,7 +430,7 @@ class NotionAITool {
417
430
  value: 'page',
418
431
  };
419
432
 
420
- const response = await notionApiRequest.call(this, 'POST', '/search', body);
433
+ const response = await NotionUtils_1.notionApiRequest.call(this, 'POST', '/search', body);
421
434
 
422
435
  return {
423
436
  totalResults: response.results?.length || 0,
@@ -430,10 +443,10 @@ class NotionAITool {
430
443
  const targetPageId = this.getNodeParameter('targetPageId', itemIndex);
431
444
  const propertiesToUpdate = this.getNodeParameter('propertiesToUpdate', itemIndex);
432
445
 
433
- const resolvedPageId = await resolvePageId.call(this, targetPageId);
446
+ const resolvedPageId = await NotionUtils_1.resolvePageId.call(this, targetPageId);
434
447
  const properties = this.parsePropertiesToUpdate(propertiesToUpdate);
435
448
 
436
- const result = await notionApiRequest.call(this, 'PATCH', `/pages/${resolvedPageId}`, {
449
+ const result = await NotionUtils_1.notionApiRequest.call(this, 'PATCH', `/pages/${resolvedPageId}`, {
437
450
  properties,
438
451
  });
439
452
 
@@ -449,10 +462,10 @@ class NotionAITool {
449
462
  const parentId = this.getNodeParameter('parentId', itemIndex);
450
463
  const entryProperties = this.getNodeParameter('entryProperties', itemIndex);
451
464
 
452
- const resolvedParentId = await resolvePageId.call(this, parentId);
465
+ const resolvedParentId = await NotionUtils_1.resolvePageId.call(this, parentId);
453
466
  const properties = this.parsePropertiesToUpdate(entryProperties);
454
467
 
455
- const result = await notionApiRequest.call(this, 'POST', '/pages', {
468
+ const result = await NotionUtils_1.notionApiRequest.call(this, 'POST', '/pages', {
456
469
  parent: { database_id: resolvedParentId },
457
470
  properties,
458
471
  });
@@ -471,7 +484,7 @@ class NotionAITool {
471
484
  const additionalOptions = this.getNodeParameter('additionalOptions', itemIndex, {});
472
485
  const maxResults = additionalOptions.maxResults || 20;
473
486
 
474
- const resolvedDatabaseId = await resolvePageId.call(this, databaseId);
487
+ const resolvedDatabaseId = await NotionUtils_1.resolvePageId.call(this, databaseId);
475
488
  const body = {
476
489
  page_size: Math.min(maxResults, 100),
477
490
  };
@@ -490,7 +503,7 @@ class NotionAITool {
490
503
  }
491
504
  }
492
505
 
493
- 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);
494
507
 
495
508
  return {
496
509
  databaseId: resolvedDatabaseId,
@@ -514,7 +527,7 @@ class NotionAITool {
514
527
  object: 'block',
515
528
  type: 'heading_1',
516
529
  heading_1: {
517
- rich_text: [createRichText(line.substring(2))],
530
+ rich_text: [NotionUtils_1.createRichText(line.substring(2))],
518
531
  },
519
532
  });
520
533
  } else if (line.startsWith('## ')) {
@@ -522,7 +535,7 @@ class NotionAITool {
522
535
  object: 'block',
523
536
  type: 'heading_2',
524
537
  heading_2: {
525
- rich_text: [createRichText(line.substring(3))],
538
+ rich_text: [NotionUtils_1.createRichText(line.substring(3))],
526
539
  },
527
540
  });
528
541
  } else if (line.startsWith('### ')) {
@@ -530,7 +543,7 @@ class NotionAITool {
530
543
  object: 'block',
531
544
  type: 'heading_3',
532
545
  heading_3: {
533
- rich_text: [createRichText(line.substring(4))],
546
+ rich_text: [NotionUtils_1.createRichText(line.substring(4))],
534
547
  },
535
548
  });
536
549
  } else if (line.startsWith('- ') || line.startsWith('* ')) {
@@ -538,7 +551,7 @@ class NotionAITool {
538
551
  object: 'block',
539
552
  type: 'bulleted_list_item',
540
553
  bulleted_list_item: {
541
- rich_text: [createRichText(line.substring(2))],
554
+ rich_text: [NotionUtils_1.createRichText(line.substring(2))],
542
555
  },
543
556
  });
544
557
  } else if (line.match(/^\d+\. /)) {
@@ -546,7 +559,7 @@ class NotionAITool {
546
559
  object: 'block',
547
560
  type: 'numbered_list_item',
548
561
  numbered_list_item: {
549
- rich_text: [createRichText(line.replace(/^\d+\. /, ''))],
562
+ rich_text: [NotionUtils_1.createRichText(line.replace(/^\d+\. /, ''))],
550
563
  },
551
564
  });
552
565
  } else if (line.startsWith('> ')) {
@@ -554,7 +567,7 @@ class NotionAITool {
554
567
  object: 'block',
555
568
  type: 'quote',
556
569
  quote: {
557
- rich_text: [createRichText(line.substring(2))],
570
+ rich_text: [NotionUtils_1.createRichText(line.substring(2))],
558
571
  },
559
572
  });
560
573
  } else if (line.startsWith('```')) {
@@ -569,7 +582,7 @@ class NotionAITool {
569
582
  object: 'block',
570
583
  type: 'code',
571
584
  code: {
572
- rich_text: [createRichText(codeLines.join('\n'))],
585
+ rich_text: [NotionUtils_1.createRichText(codeLines.join('\n'))],
573
586
  language: 'plain text',
574
587
  },
575
588
  });
@@ -579,7 +592,7 @@ class NotionAITool {
579
592
  object: 'block',
580
593
  type: 'paragraph',
581
594
  paragraph: {
582
- rich_text: [createRichText(line)],
595
+ rich_text: [NotionUtils_1.createRichText(line)],
583
596
  },
584
597
  });
585
598
  }
@@ -608,7 +621,7 @@ class NotionAITool {
608
621
  while ((match = pattern.exec(propertiesString)) !== null) {
609
622
  const [, key, value] = match;
610
623
  properties[key.trim()] = {
611
- rich_text: [createRichText(value.trim())],
624
+ rich_text: [NotionUtils_1.createRichText(value.trim())],
612
625
  };
613
626
  }
614
627
  }
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-notion-advanced",
3
- "version": "1.1.13-beta",
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.13-beta",
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",