import { ApexAnnotation, ApexClass, ApexComment, ApexCommentBlock, ApexConstructor, ApexDatatype, ApexEnum, ApexInterface, ApexMethod, ApexProperty, ApexTrigger, ApexVariable, ParserData, Position, SObject, Token } from "@aurahelper/core"; /** * Class to parse an Apex Class file, content or tokens to extract the class information like fields, methods, variables, constructors, inner classes... and much more. */ export declare class ApexParser { systemData?: ParserData; tokens: Token[]; tokensLength: number; filePath?: string; content: string | undefined; nodesMap: { [key: string]: any; }; accessModifier?: Token; definitionModifier?: Token; sharingModifier?: Token; staticKeyword?: Token; webservice?: Token; final?: Token; override?: Token; transient?: Token; testMethod?: Token; annotation?: ApexAnnotation; comment?: ApexComment | ApexCommentBlock; datatype?: ApexDatatype; cursorPosition?: Position; declarationOnly: boolean; nComments: number; nAnnotations: number; node?: ApexTrigger | ApexClass | ApexInterface | ApexEnum; tabSize: number; /** * Create Apex Parser instance to parse Apex Files * @param {string | Token[]} [filePathOrTokens] File path or file tokens (tokenized with ApexTokenizer class) * @param {ParserData} [systemData] Parser Data object with data from Project and Salesforce to identify tokens with more precission */ constructor(filePathOrTokens?: string | Token[], systemData?: ParserData); /** * Method to set the tab size * @param {number} tabSize Tab size value * @returns {ApexParser} Returns the ApexParser instance */ setTabSize(tabSize: number): ApexParser; /** * Method to set apex file tokens (tokenized with ApexTokenizer class) * @param {Token[]} tokens Apex file tokens * @returns {ApexParser} Returns the ApexParser instance */ setTokens(tokens: Token[]): ApexParser; /** * Method to set Parser Data object with data from Project and Salesforce to identify tokens with more precission * @param {ParserData} systemData Parser data object * @returns {ApexParser} Returns the ApexParser instance */ setSystemData(systemData: ParserData): ApexParser; /** * Method to set the file path * @param {string} filePath file path value * @returns {ApexParser} Returns the ApexParser instance */ setFilePath(filePath: string): ApexParser; /** * Method to set apex file content * @param {string} content file content value * @returns {ApexParser} Returns the ApexParser instance */ setContent(content: string): ApexParser; /** * Method to set the cursor position to get PositionData with parsed node * @param {Position} position Position object with cursor position data * @returns {ApexParser} Returns the ApexParser instance */ setCursorPosition(position: Position): ApexParser; /** * Method to indicate to parser to analize only the next declaration from cursor position * @param {boolean} declarationOnly True to analize declaration only, false to parse entire file * @returns {ApexParser} Returns the ApexParser instance */ isDeclarationOnly(declarationOnly: boolean): ApexParser; /** * Method to get the file tokens * @returns {token[]} Return file tokens */ getTokens(): Token[]; /** * Method to parse Apex file and get Node information * @returns {ApexTrigger | ApexClass | ApexInterface | ApexEnum} Return the Apex Node from the parsed file */ parse(): ApexTrigger | ApexClass | ApexInterface | ApexEnum; /** * Method to resolve resolve extend and implement references from Apex Class or Apex Interface * @param {ApexClass | ApexInterface} node Node to resolve references * @returns */ resolveReferences(node?: ApexClass | ApexInterface): ApexClass | ApexEnum | ApexTrigger; /** * Method to resolve a datatype reference to get the Class, interface, SObject or other datatype * @param {string} datatype Datatype to resolve * @returns {ApexClass | ApexInterface | ApexEnum | SObject | undefined} Return the resolved datatype or undefined if cant resolve it */ resolveDatatype(datatype: string): ApexClass | ApexInterface | ApexEnum | SObject | undefined; /** * Static method to parse and save the specified class data on async mode * @param {string} filePath Apex file path * @param {string} targetfolder Target folder to save * @param {ParserData} [systemData] Parser Data object with data from Project and Salesforce to identify tokens with more precission * @returns {Promise} Return a promise with the saved node */ static saveClassData(filePath: string, targetfolder: string, systemData?: ParserData): Promise; /** * Static method to parse and save the specified class data on sync mode * @param {string} filePath Apex file path * @param {string} targetfolder Target folder to save * @param {ParserData} [systemData] Parser Data object with data from Project and Salesforce to identify tokens with more precission * @returns {ApexClass | ApexInterface | ApexEnum | ApexTrigger | undefined} Return a the saved node or undefined if not exists */ static saveClassDataSync(filePath: string, targetfolder: string, systemData?: ParserData): ApexClass | ApexInterface | ApexEnum | ApexTrigger | undefined; /** * Static method to parse and save the several classes data on async mode * @param {string[]} filePaths File paths to parse and save * @param {string} targetfolder Target folder to save * @param {ParserData} [systemData] Parser Data object with data from Project and Salesforce to identify tokens with more precission * @returns {Promise} Return an empty promise when finish */ static saveClassesData(filePaths: string[], targetfolder: string, systemData?: ParserData): Promise; /** * Method to parse and save all classes from a specified folder on async mode * @param {string} classesPath Classes folder path * @param {string} targetfolder Target folder to save * @param {ParserData} [systemData] Parser Data object with data from Project and Salesforce to identify tokens with more precission * @param {boolean} [multiThread] True to use several threads to analize classes, false to use single thread. * @returns {Promise} Return an empty promise when process finish */ static saveAllClassesData(classesPath: string, targetfolder: string, systemData?: ParserData, _multiThread?: boolean): Promise; /** * Method to check if a class or interface has the specified method * @param {ApexClass | ApexInterface} classOrInterface Class or interface to check if method exists * @param {ApexMethod} method Method to check * @returns {boolean} Return true if method exists, false in otherwise */ static isMethodExists(classOrInterface: ApexClass | ApexInterface, method: ApexMethod): boolean; /** * Method to check if a class or interface has the specified constructor * @param {ApexClass | ApexInterface} classOrInterface Class or interface to check if constructor exists * @param {ApexConstructor} constructor Constructor to check * @returns {boolean} Return true if constructor exists, false in otherwise */ static isConstructorExists(classOrInterface: ApexClass | ApexInterface, constructor: ApexConstructor): boolean; /** * Method to check if a class or interface has the specified field * @param {ApexClass | ApexInterface} classOrInterface Class or interface to check if field exists * @param {ApexVariable | ApexProperty} variable Field to check * @returns {boolean} Return true if field exists, false in otherwise */ static isFieldExists(classOrInterface: ApexClass | ApexInterface, variable: ApexVariable | ApexProperty): boolean; /** * Method to check if a class or interface has the specified class * @param {ApexClass | ApexInterface} classOrInterface Class or interface to check if class exists * @param {ApexClass} apexClass Class to check * @returns {boolean} Return true if class exists, false in otherwise */ static isClassExists(classOrInterface: ApexClass | ApexInterface, apexClass: ApexClass): boolean; /** * Method to check if a class or interface has the specified interface * @param {ApexClass | ApexInterface} classOrInterface Class or interface to check if interface exists * @param {ApexInterface} apexInterface Interface to check * @returns {boolean} Return true if interface exists, false in otherwise */ static isInterfaceExists(classOrInterface: ApexClass | ApexInterface, apexInterface: ApexInterface): boolean; /** * Method to check if a class or interface has the specified enum * @param {ApexClass | ApexInterface} classOrInterface Class or interface to check if enum exists * @param {ApexEnum} apexEnum Enum to check * @returns {boolean} Return true if enum exists, false in otherwise */ static isEnumExists(classOrInterface: ApexClass | ApexInterface, apexEnum: ApexEnum): boolean; /** * Method to check if a class or interface extends from the specified class * @param {ApexClass | ApexInterface} classOrInterface Class or interface to check if extends from the specified type * @param {ApexClass} extendsType Class to check * @returns {boolean} Return true if extends from class, false in otherwise */ static extendsFrom(classOrInterface: ApexClass, extendsType: ApexClass): boolean; /** * Method to check if a class or interface implments from the specified interface * @param {ApexClass | ApexInterface} classOrInterface Class or interface to check if implements from the specified type * @param {ApexInterface} implementsType Interface to check * @returns {boolean} Return true if implments from interface, false in otherwise */ static implementsFrom(classOrInterface: ApexClass | ApexInterface, implementsType: ApexInterface): boolean; }