n8n-nodes-notion-advanced 1.1.15-beta → 1.1.18-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.
@@ -0,0 +1,13 @@
1
+ import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription, IDataObject } from 'n8n-workflow';
2
+ export declare class NotionAITool implements INodeType {
3
+ description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
+ static createPageWithContent(executeFunctions: IExecuteFunctions, itemIndex: number): Promise<IDataObject>;
6
+ static addContentToPage(executeFunctions: IExecuteFunctions, itemIndex: number): Promise<IDataObject>;
7
+ static searchPages(executeFunctions: IExecuteFunctions, itemIndex: number): Promise<IDataObject>;
8
+ static updatePageProperties(executeFunctions: IExecuteFunctions, itemIndex: number): Promise<IDataObject>;
9
+ static createDatabaseEntry(executeFunctions: IExecuteFunctions, itemIndex: number): Promise<IDataObject>;
10
+ static queryDatabase(executeFunctions: IExecuteFunctions, itemIndex: number): Promise<IDataObject>;
11
+ static parseContentToBlocks(content: string): IDataObject[];
12
+ static parsePropertiesToUpdate(propertiesString: string): IDataObject;
13
+ }
@@ -281,22 +281,22 @@ export class NotionAITool implements INodeType {
281
281
 
282
282
  switch (operation) {
283
283
  case 'createPageWithContent':
284
- result = await NotionAITool.prototype.createPageWithContent.call(this, i);
284
+ result = await NotionAITool.createPageWithContent(this, i);
285
285
  break;
286
286
  case 'addContentToPage':
287
- result = await NotionAITool.prototype.addContentToPage.call(this, i);
287
+ result = await NotionAITool.addContentToPage(this, i);
288
288
  break;
289
289
  case 'searchPages':
290
- result = await NotionAITool.prototype.searchPages.call(this, i);
290
+ result = await NotionAITool.searchPages(this, i);
291
291
  break;
292
292
  case 'updatePageProperties':
293
- result = await NotionAITool.prototype.updatePageProperties.call(this, i);
293
+ result = await NotionAITool.updatePageProperties(this, i);
294
294
  break;
295
295
  case 'createDatabaseEntry':
296
- result = await NotionAITool.prototype.createDatabaseEntry.call(this, i);
296
+ result = await NotionAITool.createDatabaseEntry(this, i);
297
297
  break;
298
298
  case 'queryDatabase':
299
- result = await NotionAITool.prototype.queryDatabase.call(this, i);
299
+ result = await NotionAITool.queryDatabase(this, i);
300
300
  break;
301
301
  default:
302
302
  throw new NodeOperationError(this.getNode(), `Unknown operation: ${operation}`);
@@ -322,13 +322,13 @@ export class NotionAITool implements INodeType {
322
322
  return [this.helpers.returnJsonArray(responseData)];
323
323
  }
324
324
 
325
- private async createPageWithContent(this: IExecuteFunctions, itemIndex: number): Promise<IDataObject> {
326
- const pageTitle = this.getNodeParameter('pageTitle', itemIndex) as string;
327
- const parentId = this.getNodeParameter('parentId', itemIndex) as string;
328
- const content = this.getNodeParameter('content', itemIndex, '') as string;
329
- const additionalOptions = this.getNodeParameter('additionalOptions', itemIndex, {}) as IDataObject;
325
+ static async createPageWithContent(executeFunctions: IExecuteFunctions, itemIndex: number): Promise<IDataObject> {
326
+ const pageTitle = executeFunctions.getNodeParameter('pageTitle', itemIndex) as string;
327
+ const parentId = executeFunctions.getNodeParameter('parentId', itemIndex) as string;
328
+ const content = executeFunctions.getNodeParameter('content', itemIndex, '') as string;
329
+ const additionalOptions = executeFunctions.getNodeParameter('additionalOptions', itemIndex, {}) as IDataObject;
330
330
 
331
- const resolvedParentId = await resolvePageId.call(this, parentId);
331
+ const resolvedParentId = await resolvePageId.call(executeFunctions, parentId);
332
332
 
333
333
  // Create the page first
334
334
  const pageBody: IDataObject = {
@@ -348,13 +348,13 @@ export class NotionAITool implements INodeType {
348
348
  pageBody.cover = { type: 'external', external: { url: additionalOptions.coverUrl as string } };
349
349
  }
350
350
 
351
- const page = await notionApiRequest.call(this, 'POST', '/pages', pageBody);
351
+ const page = await notionApiRequest.call(executeFunctions, 'POST', '/pages', pageBody);
352
352
 
353
353
  // If content is provided, add it to the page
354
354
  if (content) {
355
- const blocks = NotionAITool.prototype.parseContentToBlocks.call(this, content);
355
+ const blocks = NotionAITool.parseContentToBlocks(content);
356
356
  if (blocks.length > 0) {
357
- await notionApiRequest.call(this, 'PATCH', `/blocks/${page.id}/children`, {
357
+ await notionApiRequest.call(executeFunctions, 'PATCH', `/blocks/${page.id}/children`, {
358
358
  children: blocks,
359
359
  });
360
360
  }
@@ -368,18 +368,18 @@ export class NotionAITool implements INodeType {
368
368
  };
369
369
  }
370
370
 
371
- private async addContentToPage(this: IExecuteFunctions, itemIndex: number): Promise<IDataObject> {
372
- const targetPageId = this.getNodeParameter('targetPageId', itemIndex) as string;
373
- const content = this.getNodeParameter('content', itemIndex) as string;
371
+ static async addContentToPage(executeFunctions: IExecuteFunctions, itemIndex: number): Promise<IDataObject> {
372
+ const targetPageId = executeFunctions.getNodeParameter('targetPageId', itemIndex) as string;
373
+ const content = executeFunctions.getNodeParameter('content', itemIndex) as string;
374
374
 
375
- const resolvedPageId = await resolvePageId.call(this, targetPageId);
376
- const blocks = NotionAITool.prototype.parseContentToBlocks.call(this, content);
375
+ const resolvedPageId = await resolvePageId.call(executeFunctions, targetPageId);
376
+ const blocks = NotionAITool.parseContentToBlocks(content);
377
377
 
378
378
  if (blocks.length === 0) {
379
- throw new NodeOperationError(this.getNode(), 'No valid content blocks found to add');
379
+ throw new NodeOperationError(executeFunctions.getNode(), 'No valid content blocks found to add');
380
380
  }
381
381
 
382
- const result = await notionApiRequest.call(this, 'PATCH', `/blocks/${resolvedPageId}/children`, {
382
+ const result = await notionApiRequest.call(executeFunctions, 'PATCH', `/blocks/${resolvedPageId}/children`, {
383
383
  children: blocks,
384
384
  });
385
385
 
@@ -391,9 +391,9 @@ export class NotionAITool implements INodeType {
391
391
  };
392
392
  }
393
393
 
394
- private async searchPages(this: IExecuteFunctions, itemIndex: number): Promise<IDataObject> {
395
- const searchQuery = this.getNodeParameter('searchQuery', itemIndex, '') as string;
396
- const additionalOptions = this.getNodeParameter('additionalOptions', itemIndex, {}) as IDataObject;
394
+ static async searchPages(executeFunctions: IExecuteFunctions, itemIndex: number): Promise<IDataObject> {
395
+ const searchQuery = executeFunctions.getNodeParameter('searchQuery', itemIndex, '') as string;
396
+ const additionalOptions = executeFunctions.getNodeParameter('additionalOptions', itemIndex, {}) as IDataObject;
397
397
  const maxResults = (additionalOptions.maxResults as number) || 20;
398
398
 
399
399
  const body: IDataObject = {
@@ -409,7 +409,7 @@ export class NotionAITool implements INodeType {
409
409
  value: 'page',
410
410
  };
411
411
 
412
- const response = await notionApiRequest.call(this, 'POST', '/search', body);
412
+ const response = await notionApiRequest.call(executeFunctions, 'POST', '/search', body);
413
413
 
414
414
  return {
415
415
  totalResults: response.results?.length || 0,
@@ -418,14 +418,14 @@ export class NotionAITool implements INodeType {
418
418
  };
419
419
  }
420
420
 
421
- private async updatePageProperties(this: IExecuteFunctions, itemIndex: number): Promise<IDataObject> {
422
- const targetPageId = this.getNodeParameter('targetPageId', itemIndex) as string;
423
- const propertiesToUpdate = this.getNodeParameter('propertiesToUpdate', itemIndex) as string;
421
+ static async updatePageProperties(executeFunctions: IExecuteFunctions, itemIndex: number): Promise<IDataObject> {
422
+ const targetPageId = executeFunctions.getNodeParameter('targetPageId', itemIndex) as string;
423
+ const propertiesToUpdate = executeFunctions.getNodeParameter('propertiesToUpdate', itemIndex) as string;
424
424
 
425
- const resolvedPageId = await resolvePageId.call(this, targetPageId);
426
- const properties = NotionAITool.prototype.parsePropertiesToUpdate.call(this, propertiesToUpdate);
425
+ const resolvedPageId = await resolvePageId.call(executeFunctions, targetPageId);
426
+ const properties = NotionAITool.parsePropertiesToUpdate(propertiesToUpdate);
427
427
 
428
- const result = await notionApiRequest.call(this, 'PATCH', `/pages/${resolvedPageId}`, {
428
+ const result = await notionApiRequest.call(executeFunctions, 'PATCH', `/pages/${resolvedPageId}`, {
429
429
  properties,
430
430
  });
431
431
 
@@ -437,14 +437,14 @@ export class NotionAITool implements INodeType {
437
437
  };
438
438
  }
439
439
 
440
- private async createDatabaseEntry(this: IExecuteFunctions, itemIndex: number): Promise<IDataObject> {
441
- const parentId = this.getNodeParameter('parentId', itemIndex) as string;
442
- const entryProperties = this.getNodeParameter('entryProperties', itemIndex) as string;
440
+ static async createDatabaseEntry(executeFunctions: IExecuteFunctions, itemIndex: number): Promise<IDataObject> {
441
+ const parentId = executeFunctions.getNodeParameter('parentId', itemIndex) as string;
442
+ const entryProperties = executeFunctions.getNodeParameter('entryProperties', itemIndex) as string;
443
443
 
444
- const resolvedParentId = await resolvePageId.call(this, parentId);
445
- const properties = NotionAITool.prototype.parsePropertiesToUpdate.call(this, entryProperties);
444
+ const resolvedParentId = await resolvePageId.call(executeFunctions, parentId);
445
+ const properties = NotionAITool.parsePropertiesToUpdate(entryProperties);
446
446
 
447
- const result = await notionApiRequest.call(this, 'POST', '/pages', {
447
+ const result = await notionApiRequest.call(executeFunctions, 'POST', '/pages', {
448
448
  parent: { database_id: resolvedParentId },
449
449
  properties,
450
450
  });
@@ -457,13 +457,13 @@ export class NotionAITool implements INodeType {
457
457
  };
458
458
  }
459
459
 
460
- private async queryDatabase(this: IExecuteFunctions, itemIndex: number): Promise<IDataObject> {
461
- const databaseId = this.getNodeParameter('databaseId', itemIndex) as string;
462
- const queryFilter = this.getNodeParameter('queryFilter', itemIndex, '') as string;
463
- const additionalOptions = this.getNodeParameter('additionalOptions', itemIndex, {}) as IDataObject;
460
+ static async queryDatabase(executeFunctions: IExecuteFunctions, itemIndex: number): Promise<IDataObject> {
461
+ const databaseId = executeFunctions.getNodeParameter('databaseId', itemIndex) as string;
462
+ const queryFilter = executeFunctions.getNodeParameter('queryFilter', itemIndex, '') as string;
463
+ const additionalOptions = executeFunctions.getNodeParameter('additionalOptions', itemIndex, {}) as IDataObject;
464
464
  const maxResults = (additionalOptions.maxResults as number) || 20;
465
465
 
466
- const resolvedDatabaseId = await resolvePageId.call(this, databaseId);
466
+ const resolvedDatabaseId = await resolvePageId.call(executeFunctions, databaseId);
467
467
  const body: IDataObject = {
468
468
  page_size: Math.min(maxResults, 100),
469
469
  };
@@ -482,7 +482,7 @@ export class NotionAITool implements INodeType {
482
482
  }
483
483
  }
484
484
 
485
- const response = await notionApiRequest.call(this, 'POST', `/databases/${resolvedDatabaseId}/query`, body);
485
+ const response = await notionApiRequest.call(executeFunctions, 'POST', `/databases/${resolvedDatabaseId}/query`, body);
486
486
 
487
487
  return {
488
488
  databaseId: resolvedDatabaseId,
@@ -492,7 +492,7 @@ export class NotionAITool implements INodeType {
492
492
  };
493
493
  }
494
494
 
495
- private parseContentToBlocks(content: string): IDataObject[] {
495
+ static parseContentToBlocks(content: string): IDataObject[] {
496
496
  const blocks: IDataObject[] = [];
497
497
  const lines = content.split('\n');
498
498
 
@@ -580,7 +580,7 @@ export class NotionAITool implements INodeType {
580
580
  return blocks;
581
581
  }
582
582
 
583
- private parsePropertiesToUpdate(propertiesString: string): IDataObject {
583
+ static parsePropertiesToUpdate(propertiesString: string): IDataObject {
584
584
  try {
585
585
  // Try to parse as JSON first
586
586
  return JSON.parse(propertiesString);
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-notion-advanced",
3
- "version": "1.1.15-beta",
3
+ "version": "1.1.18-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",
@@ -63,16 +63,16 @@
63
63
  },
64
64
  "packageManager": "pnpm@7.18.0",
65
65
  "devDependencies": {
66
- "@types/node": "^18.16.16",
67
- "@typescript-eslint/eslint-plugin": "^5.59.7",
68
- "@typescript-eslint/parser": "^5.59.7",
66
+ "@types/node": "^24.1.0",
67
+ "@typescript-eslint/eslint-plugin": "^8.38.0",
68
+ "@typescript-eslint/parser": "^8.38.0",
69
69
  "copyfiles": "^2.4.1",
70
- "eslint": "^8.41.0",
70
+ "eslint": "^9.32.0",
71
71
  "eslint-plugin-n8n-nodes-base": "^1.11.0",
72
- "prettier": "^2.8.8",
72
+ "prettier": "^3.6.2",
73
73
  "typescript": "^5.1.3"
74
74
  },
75
75
  "peerDependencies": {
76
- "n8n-workflow": "*"
76
+ "n8n-workflow": "^1.82.0"
77
77
  }
78
78
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-notion-advanced",
3
- "version": "1.1.15-beta",
3
+ "version": "1.1.18-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",
@@ -63,16 +63,16 @@
63
63
  },
64
64
  "packageManager": "pnpm@7.18.0",
65
65
  "devDependencies": {
66
- "@types/node": "^18.16.16",
67
- "@typescript-eslint/eslint-plugin": "^5.59.7",
68
- "@typescript-eslint/parser": "^5.59.7",
66
+ "@types/node": "^24.1.0",
67
+ "@typescript-eslint/eslint-plugin": "^8.38.0",
68
+ "@typescript-eslint/parser": "^8.38.0",
69
69
  "copyfiles": "^2.4.1",
70
- "eslint": "^8.41.0",
70
+ "eslint": "^9.32.0",
71
71
  "eslint-plugin-n8n-nodes-base": "^1.11.0",
72
- "prettier": "^2.8.8",
72
+ "prettier": "^3.6.2",
73
73
  "typescript": "^5.1.3"
74
74
  },
75
75
  "peerDependencies": {
76
- "n8n-workflow": "*"
76
+ "n8n-workflow": "^1.82.0"
77
77
  }
78
78
  }