import type { components } from "../lib/openapi.js"; import { type LocalFileEntry, type SkippedFile } from "./local-files.js"; import { type Configuration, type Resource, type ResourceGroup } from "./types.js"; type Email = components["schemas"]["Email"]; /** * The editor mode ("plaintext" = markdown, "fancy" = HTML) is expressed by * the API as a comment prefixed to the body. Locally we round-trip it as an * explicit frontmatter field so pushing never silently flips an email's * format. */ export type LocalEmail = Partial & { editor_mode?: string; }; export interface RelativeImageReference { match: string; altText: string; relativePath: string; index: number; } export type FrontMatterFields = Pick; export declare const FRONT_MATTER_FIELDS: (keyof FrontMatterFields)[]; export declare const FRONT_MATTER_FIELD_TO_DEFAULT_VALUE: { [K in keyof FrontMatterFields]?: FrontMatterFields[K]; }; export declare function editorModeFromBody(body: string | null | undefined): string | undefined; /** * Deserialize markdown content into email data */ export declare function deserialize(content: string): { email: LocalEmail; isValid: boolean; error?: string; }; /** * Serialize email data into markdown content. The editor-mode sigil is * lifted out of the body into an `editor_mode` frontmatter field so files * stay readable while the mode still round-trips. */ export declare function serialize(email: LocalEmail): string; /** * Canonical, order-independent representation used to decide whether a local * email differs from its remote counterpart. Applies frontmatter defaults to * both sides (a file omitting `featured` means `featured: false`), trims * bodies, and compares the effective editor mode — so semantically equal * emails never generate a PATCH, regardless of API key order or trailing * whitespace. */ export declare function canonicalizeForDiff(email: LocalEmail): string; export declare function findRelativeImageReferences(content: string): RelativeImageReference[]; export declare function replaceImageReference(content: string, originalReference: string, newUrl: string, altText: string): string; type SyncedImageInfo = { localPath: string; url: string; }; export declare function resolveRelativeImageReferences(content: string, baseDir: string, syncedImages: Record): string; export declare function convertAbsoluteToRelativeImages(content: string, emailDir: string, syncedImages: Record): string; export declare const REMOTE_EMAILS_RESOURCE: Resource; export type LocalEmailEntry = LocalFileEntry; export declare function readLocalEmails(configuration: Configuration): Promise<{ entries: LocalEmailEntry[]; skipped: SkippedFile[]; }>; export declare const LOCAL_EMAILS_RESOURCE: Resource; export declare const EMAILS_RESOURCE: ResourceGroup; export {};