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.
|
284
|
+
result = await NotionAITool.createPageWithContent(this, i);
|
285
285
|
break;
|
286
286
|
case 'addContentToPage':
|
287
|
-
result = await NotionAITool.
|
287
|
+
result = await NotionAITool.addContentToPage(this, i);
|
288
288
|
break;
|
289
289
|
case 'searchPages':
|
290
|
-
result = await NotionAITool.
|
290
|
+
result = await NotionAITool.searchPages(this, i);
|
291
291
|
break;
|
292
292
|
case 'updatePageProperties':
|
293
|
-
result = await NotionAITool.
|
293
|
+
result = await NotionAITool.updatePageProperties(this, i);
|
294
294
|
break;
|
295
295
|
case 'createDatabaseEntry':
|
296
|
-
result = await NotionAITool.
|
296
|
+
result = await NotionAITool.createDatabaseEntry(this, i);
|
297
297
|
break;
|
298
298
|
case 'queryDatabase':
|
299
|
-
result = await NotionAITool.
|
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
|
-
|
326
|
-
const pageTitle =
|
327
|
-
const parentId =
|
328
|
-
const content =
|
329
|
-
const additionalOptions =
|
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(
|
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(
|
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.
|
355
|
+
const blocks = NotionAITool.parseContentToBlocks(content);
|
356
356
|
if (blocks.length > 0) {
|
357
|
-
await notionApiRequest.call(
|
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
|
-
|
372
|
-
const targetPageId =
|
373
|
-
const content =
|
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(
|
376
|
-
const blocks = NotionAITool.
|
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(
|
379
|
+
throw new NodeOperationError(executeFunctions.getNode(), 'No valid content blocks found to add');
|
380
380
|
}
|
381
381
|
|
382
|
-
const result = await notionApiRequest.call(
|
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
|
-
|
395
|
-
const searchQuery =
|
396
|
-
const additionalOptions =
|
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(
|
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
|
-
|
422
|
-
const targetPageId =
|
423
|
-
const propertiesToUpdate =
|
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(
|
426
|
-
const properties = NotionAITool.
|
425
|
+
const resolvedPageId = await resolvePageId.call(executeFunctions, targetPageId);
|
426
|
+
const properties = NotionAITool.parsePropertiesToUpdate(propertiesToUpdate);
|
427
427
|
|
428
|
-
const result = await notionApiRequest.call(
|
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
|
-
|
441
|
-
const parentId =
|
442
|
-
const entryProperties =
|
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(
|
445
|
-
const properties = NotionAITool.
|
444
|
+
const resolvedParentId = await resolvePageId.call(executeFunctions, parentId);
|
445
|
+
const properties = NotionAITool.parsePropertiesToUpdate(entryProperties);
|
446
446
|
|
447
|
-
const result = await notionApiRequest.call(
|
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
|
-
|
461
|
-
const databaseId =
|
462
|
-
const queryFilter =
|
463
|
-
const additionalOptions =
|
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(
|
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(
|
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
|
-
|
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
|
-
|
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.
|
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": "^
|
67
|
-
"@typescript-eslint/eslint-plugin": "^
|
68
|
-
"@typescript-eslint/parser": "^
|
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": "^
|
70
|
+
"eslint": "^9.32.0",
|
71
71
|
"eslint-plugin-n8n-nodes-base": "^1.11.0",
|
72
|
-
"prettier": "^
|
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.
|
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": "^
|
67
|
-
"@typescript-eslint/eslint-plugin": "^
|
68
|
-
"@typescript-eslint/parser": "^
|
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": "^
|
70
|
+
"eslint": "^9.32.0",
|
71
71
|
"eslint-plugin-n8n-nodes-base": "^1.11.0",
|
72
|
-
"prettier": "^
|
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
|
}
|