import { t as Database } from "./types-BCOU_CXE.mjs"; import { d as ImportSource, g as ProbeResult } from "./types-C2avdenh.mjs"; import { Kysely } from "kysely"; import { slugify } from "@premium-cms/admin/slugify"; import { PortableTextBlock } from "@premium-cms/gutenberg-to-portable-text"; import { Readable } from "node:stream"; //#region src/database/repositories/byline.d.ts interface ContentBylineInput { bylineId: string; roleLabel?: string | null; } //#endregion //#region src/utils/slugify.d.ts /** * Decode a URI-encoded slug parameter. * * Browsers percent-encode non-ASCII characters in URLs, so a slug like * "మేష-రాసి" arrives as "%e0%b0%ae%e0%b1%87%e0%b0%b7-%e0%b0%b0%e0%b0%be%e0%b0%b8%e0%b0%bf". * Call this on `Astro.params.slug` before using it in database lookups. */ declare function decodeSlug(raw: string | undefined): string | undefined; //#endregion //#region src/cli/wxr/parser.d.ts /** * Parsed WordPress export data */ interface WxrData { /** Site metadata */ site: WxrSite; /** Posts (including custom post types) */ posts: WxrPost[]; /** Media attachments */ attachments: WxrAttachment[]; /** Categories */ categories: WxrCategory[]; /** Tags */ tags: WxrTag[]; /** Authors */ authors: WxrAuthor[]; /** All taxonomy terms (including custom taxonomies and nav_menu) */ terms: WxrTerm[]; /** Parsed navigation menus */ navMenus: WxrNavMenu[]; } interface WxrSite { title?: string; link?: string; description?: string; language?: string; baseSiteUrl?: string; baseBlogUrl?: string; } interface WxrPost { id?: number; title?: string; link?: string; pubDate?: string; creator?: string; guid?: string; description?: string; content?: string; excerpt?: string; postDate?: string; postDateGmt?: string; postModified?: string; postModifiedGmt?: string; commentStatus?: string; pingStatus?: string; status?: string; postType?: string; postName?: string; postPassword?: string; isSticky?: boolean; /** Parent post ID for hierarchical content (pages) */ postParent?: number; /** Menu order for sorting */ menuOrder?: number; categories: string[]; tags: string[]; /** Custom taxonomy assignments beyond categories/tags */ customTaxonomies?: Map; /** * Display labels for per-item category/tag/custom-taxonomy assignments, * captured from `Label` * text content. Used by the importer to back-fill term labels when a * `` or `` block wasn't present at the top of the * WXR (older / hand-edited exports). Keyed by * `${normalisedTaxonomy}\u0000${slug}` so categories and tags don't * collide. */ taxonomyLabels?: Map; meta: Map; /** * BCP 47 locale code extracted from a detected multilingual plugin * (WPML's `_icl_lang_code` or Polylang's per-post language taxonomy). * Absent when no per-post locale could be determined. */ locale?: string; /** * Source-side translation group ID extracted from a detected multilingual * plugin (WPML's `trid` / `_icl_translation_id`, or a synthesized id derived * from Polylang's `_translations` meta). Posts sharing a `translationGroup` * are translations of one another. The string is opaque -- consumers use it * only as a key to link posts. */ translationGroup?: string; } interface WxrAttachment { id?: number; title?: string; url?: string; postDate?: string; meta: Map; } interface WxrCategory { id?: number; nicename?: string; name?: string; parent?: string; description?: string; } interface WxrTag { id?: number; slug?: string; name?: string; description?: string; } /** * Generic taxonomy term (categories, tags, nav_menu, custom taxonomies) */ interface WxrTerm { id: number; taxonomy: string; slug: string; name: string; parent?: string; description?: string; } /** * Navigation menu structure */ interface WxrNavMenu { id: number; name: string; label: string; items: WxrNavMenuItem[]; } /** * Navigation menu item */ interface WxrNavMenuItem { id: number; menuId: number; parentId?: number; sortOrder: number; type: "custom" | "post_type" | "taxonomy"; objectType?: string; objectId?: number; url?: string; title: string; target?: string; classes?: string; } interface WxrAuthor { id?: number; login?: string; email?: string; displayName?: string; firstName?: string; lastName?: string; } /** * Parse a WordPress WXR export file */ declare function parseWxr(stream: Readable): Promise; /** * Parse a WordPress WXR export from a string * * Uses the non-streaming SAX parser API for compatibility with * environments that don't have Node.js streams (e.g., Cloudflare Workers). */ declare function parseWxrString(xml: string): Promise; //#endregion //#region src/import/sections.d.ts /** * Result of sections import operation */ interface SectionsImportResult { /** Number of sections created */ sectionsCreated: number; /** Number of sections skipped (already exist) */ sectionsSkipped: number; /** Errors encountered during import */ errors: Array<{ title: string; error: string; }>; } /** * Import reusable blocks (wp_block post type) from WXR as sections * * @param posts - All posts from WXR (will filter to wp_block) * @param db - Database connection * @returns Import result with counts */ declare function importReusableBlocksAsSections(posts: WxrPost[], db: Kysely): Promise; //#endregion //#region src/import/registry.d.ts /** * Register an import source */ declare function registerSource(source: ImportSource): void; /** * Get a source by ID */ declare function getSource(id: string): ImportSource | undefined; /** * Get all registered sources */ declare function getAllSources(): ImportSource[]; /** * Get sources that can handle file uploads */ declare function getFileSources(): ImportSource[]; /** * Get sources that can probe URLs */ declare function getUrlSources(): ImportSource[]; /** * Probe a URL against all registered sources * * Returns probe results sorted by confidence (definite > likely > possible) */ declare function probeUrl(url: string): Promise; /** * Clear all registered sources (useful for testing) */ declare function clearSources(): void; //#endregion //#region src/import/sources/wxr.d.ts declare const wxrSource: ImportSource; /** * Parse a WXR date with the correct fallback chain: * 1. GMT date (always UTC, most reliable) * 2. pubDate (RFC 2822, includes timezone offset) * 3. Site-local date (MySQL datetime without timezone, imprecise but best available) * * Returns undefined when none of the inputs yield a valid date. * Callers that need a guaranteed Date should use `?? new Date()`. */ declare function parseWxrDate(gmtDate: string | undefined, pubDate: string | undefined, localDate: string | undefined): Date | undefined; //#endregion //#region src/import/sources/wordpress-rest.d.ts declare const wordpressRestSource: ImportSource; //#endregion //#region src/import/sources/wordpress-plugin.d.ts /** * Fetch taxonomies from plugin API */ declare function fetchPluginTaxonomies(siteUrl: string, authToken: string): Promise; }>>; //#endregion export { decodeSlug as C, parseWxrString as S, ContentBylineInput as T, WxrPost as _, clearSources as a, WxrTerm as b, getSource as c, registerSource as d, importReusableBlocksAsSections as f, WxrData as g, WxrCategory as h, wxrSource as i, getUrlSources as l, WxrAuthor as m, wordpressRestSource as n, getAllSources as o, WxrAttachment as p, parseWxrDate as r, getFileSources as s, fetchPluginTaxonomies as t, probeUrl as u, WxrSite as v, slugify as w, parseWxr as x, WxrTag as y }; //# sourceMappingURL=index-BFUET8yL.d.mts.map