n8n-nodes-notion-advanced
Version:
Advanced n8n Notion nodes: Full-featured workflow node + AI Agent Tool for intelligent Notion automation with 25+ block types (BETA)
90 lines (89 loc) • 4.55 kB
TypeScript
import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription, IDataObject } from 'n8n-workflow';
interface TagMatch {
start: number;
end: number;
match: string;
processor: (match: string, group1?: string, group2?: string, group3?: string) => string;
groups: string[];
replacement?: string;
}
interface XMLNode {
id: string;
tagName: string;
start: number;
end: number;
match: string;
processor: (...args: string[]) => IDataObject | null;
groups: string[];
children: XMLNode[];
parent?: XMLNode;
depth: number;
innerContent: string;
replacement?: string;
listProcessor?: (content: string, blocks: IDataObject[]) => void;
}
interface HierarchyNode {
block: IDataObject;
children: HierarchyNode[];
metadata?: {
sourcePosition?: number;
xmlNodeId?: string;
tagName?: string;
};
}
export declare class NotionAITool implements INodeType {
description: INodeTypeDescription;
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
static getFlexibleParameter(executeFunctions: IExecuteFunctions, itemIndex: number, primaryName: string, alternativeNames?: string[], defaultValue?: any): any;
static createPageWithContent(executeFunctions: IExecuteFunctions, itemIndex: number): Promise<IDataObject>;
static addContentToPage(executeFunctions: IExecuteFunctions, itemIndex: number): Promise<IDataObject>;
static searchPages(executeFunctions: IExecuteFunctions, itemIndex: number): Promise<IDataObject>;
static updatePageProperties(executeFunctions: IExecuteFunctions, itemIndex: number): Promise<IDataObject>;
static createDatabaseEntry(executeFunctions: IExecuteFunctions, itemIndex: number): Promise<IDataObject>;
static queryDatabase(executeFunctions: IExecuteFunctions, itemIndex: number): Promise<IDataObject>;
static parseContentToBlocks(content: string): IDataObject[];
static resolveOverlaps(matches: TagMatch[]): TagMatch[];
static validateXmlTag(match: string, tagName: string): boolean;
static optimizedReplace(content: string, matches: {
start: number;
end: number;
replacement: string;
match: string;
}[]): string;
static getUtf8BytePosition(str: string, charIndex: number): number;
static buildXMLTree(content: string, tagProcessors: any[]): XMLNode[];
static xmlTreeToHierarchy(nodes: XMLNode[]): HierarchyNode[];
static hierarchyToNotionBlocks(hierarchy: HierarchyNode[]): IDataObject[];
static processXMLTreeDepthFirst(nodes: XMLNode[], blocks: IDataObject[], placeholderCounter: {
value: number;
}): Map<string, string>;
static applyHierarchicalReplacements(content: string, nodes: XMLNode[], replacements: Map<string, string>): string;
static getAllNodesFromTree(nodes: XMLNode[]): XMLNode[];
static processXmlTags(content: string, blocks: IDataObject[]): string;
static cleanupAllPlaceholders(content: string): string;
static decodeHtmlEntities(content: string): string;
static cleanupRemainingHtml(content: string, placeholderPrefix?: string): string;
static processNestedHtmlInListItem(content: string): string;
static convertInlineHtmlToMarkdown(content: string): string;
static buildListHierarchy(listContent: string, listType: 'bulleted_list_item' | 'numbered_list_item', childHierarchyNodes: HierarchyNode[]): HierarchyNode | null;
static getListItemPositions(content: string): Array<{
start: number;
end: number;
}>;
static mapChildBlocksToListItems(listContent: string, childBlocks: IDataObject[], childNodes: XMLNode[]): Map<number, IDataObject[]>;
static processNestedListWithChildBlocks(listContent: string, listType: 'bulleted_list_item' | 'numbered_list_item', blocks: IDataObject[], listItemChildBlocks: Map<number, IDataObject[]>): void;
static processNestedList(listContent: string, listType: 'bulleted_list_item' | 'numbered_list_item', blocks: IDataObject[], childNodes?: XMLNode[]): void;
static extractListItemsWithBranching(content: string): Array<{
text: string;
children: Array<{
type: string;
content: string;
}>;
}>;
static extractListItems(content: string): string[];
static getCalloutEmoji(type: string): string;
static getCalloutColor(type: string): string;
static parseBasicMarkdown(text: string): IDataObject[];
static parsePropertiesToUpdate(propertiesString: string): IDataObject;
}
export {};