/** * Apple Notes Exporter * * A library for exporting Apple Notes folders to the file system via AppleScript. * * This library provides functions to list available Apple Notes folders and export them * recursively to HTML files. It works by invoking an AppleScript that interacts * with the Notes app. * * ## Requirements * * - **macOS only** - This library relies on AppleScript and the Notes app, which are * only available on macOS. * - Automation permissions for the Notes app must be granted in System Settings * * @module */ /** * An Apple Notes exporter that can list folders and export notes. * * Use `Exporter.create()` for the default vendored script, or * `Exporter.withScriptPath()` for a custom script. * * @example * ```typescript * import { Exporter } from 'apple-notes-exporter'; * * const exporter = Exporter.create(); * await exporter.listFolders(); * await exporter.exportFolder('My Notes', './exports'); * ``` */ export declare class Exporter { private readonly scriptSource; private constructor(); /** * Creates a new exporter using the vendored AppleScript. * * This is the recommended way to create an exporter for most use cases. * * @returns A new Exporter instance. * * @example * ```typescript * const exporter = Exporter.create(); * await exporter.listFolders(); * ``` */ static create(): Exporter; /** * Creates a new exporter using a custom AppleScript at the specified path. * * @param scriptPath - Path to the AppleScript file. * @returns A new Exporter instance. * @throws {ScriptNotFoundError} If the script file does not exist. * * @example * ```typescript * const exporter = Exporter.withScriptPath('./custom_script.applescript'); * ``` */ static withScriptPath(scriptPath: string): Exporter; /** * Lists all available top-level folders across all Apple Notes accounts. * * The output is printed to stdout by the AppleScript. * * @example * ```typescript * const exporter = Exporter.create(); * await exporter.listFolders(); * ``` */ listFolders(): Promise; /** * Lists all available top-level folders (synchronous version). */ listFoldersSync(): void; /** * Exports a folder recursively to HTML files. * * The folder search uses breadth-first search and looks at all levels * (not just top-level) to find the folder. Once found, it exports that * folder and all its subfolders recursively. * * This method searches all accounts for the folder. If a folder with the * same name exists in multiple accounts, use `exportFolderFromAccount` * to specify which account to use. * * @param folder - The folder name to export. * @param outputDir - The directory where exported notes will be saved. * Will be created if it doesn't exist. * * @example * ```typescript * const exporter = Exporter.create(); * await exporter.exportFolder('My Notes', './exports'); * ``` */ exportFolder(folder: string, outputDir: string): Promise; /** * Exports a folder recursively to HTML files (synchronous version). */ exportFolderSync(folder: string, outputDir: string): void; /** * Exports a folder from a specific account recursively to HTML files. * * This is useful when a folder with the same name exists in multiple accounts. * The folder search uses breadth-first search and looks at all levels * (not just top-level) to find the folder within the specified account. * * @param account - The account name (e.g., "iCloud", "Google", "On My Mac"). * @param folder - The folder name to export. * @param outputDir - The directory where exported notes will be saved. * Will be created if it doesn't exist. * * @example * ```typescript * const exporter = Exporter.create(); * * // Export "Work" folder from iCloud account * await exporter.exportFolderFromAccount('iCloud', 'Work', './exports'); * * // Export "Work" folder from Google account * await exporter.exportFolderFromAccount('Google', 'Work', './google_exports'); * ``` */ exportFolderFromAccount(account: string, folder: string, outputDir: string): Promise; /** * Exports a folder from a specific account (synchronous version). */ exportFolderFromAccountSync(account: string, folder: string, outputDir: string): void; private exportFolderImpl; private exportFolderImplSync; private prepareOutputDir; private runScript; private runScriptSync; private runEmbeddedScript; private runEmbeddedScriptSync; private runScriptFile; private runScriptFileSync; } //# sourceMappingURL=exporter.d.ts.map