import { f as FieldType, n as CollectionAdminConfig } from "./types-BjBDp25t.mjs"; import { t as Database } from "./types-BCOU_CXE.mjs"; import { d as Storage } from "./types-D_DWe7k9.mjs"; import { i as SiteSettings } from "./types-Blb-MRC3.mjs"; import { Kysely } from "kysely"; //#region src/seed/types.d.ts /** * Root seed file structure */ interface SeedFile { /** JSON schema reference (optional) */ $schema?: string; /** Seed format version */ version: "1"; /** * Default locale for locale-bearing rows (menus, taxonomies, content) that * omit an explicit `locale`. Lets a non-`en` single-locale project survive an * `export-seed` → `seed` round-trip: `apply` runs outside the Astro runtime * (no i18n config), so without this it would backfill the omitted locale as * `en`. See #1421. */ defaultLocale?: string; /** Metadata about the seed */ meta?: { name?: string; description?: string; author?: string; }; /** Site settings */ settings?: Partial; /** Collection definitions */ collections?: SeedCollection[]; /** Taxonomy definitions */ taxonomies?: SeedTaxonomy[]; /** Navigation menus */ menus?: SeedMenu[]; /** Redirect rules */ redirects?: SeedRedirect[]; /** Widget areas */ widgetAreas?: SeedWidgetArea[]; /** Sections (reusable content blocks, like WP patterns/reusable blocks) */ sections?: SeedSection[]; /** Bylines used for presentation credits */ bylines?: SeedByline[]; /** Sample content (organized by collection) */ content?: Record; } /** * Collection definition in seed */ interface SeedCollection { /** Where entries live: "db" (default) or "git" (files in the site repo). */ storage?: "db" | "git"; slug: string; label: string; labelSingular?: string; description?: string; icon?: string; admin?: CollectionAdminConfig; supports?: ("drafts" | "revisions" | "preview" | "scheduling" | "search" | "seo")[]; urlPattern?: string; /** Require a slug before an entry can be published. Defaults to true. */ routable?: boolean; /** * Omit this collection from the admin sidebar. It stays reachable through * the API, MCP, plugin hooks, and direct `/content/:collection` URLs. */ hidden?: boolean; /** * Explicit position in the admin sidebar (ascending). Collections without * a `sortOrder` keep the alphabetical order and follow the ordered ones. */ sortOrder?: number; /** Enable comments on this collection */ commentsEnabled?: boolean; /** Field slug powering the admin list Title column (defaults to title display) */ titleField?: string; /** Field slug (a datetime field) powering the admin list Date column (defaults to last-updated) */ dateField?: string; fields: SeedField[]; } /** * Field definition in seed */ interface SeedField { slug: string; label: string; type: FieldType; required?: boolean; unique?: boolean; searchable?: boolean; indexed?: boolean; defaultValue?: unknown; validation?: Record; widget?: string; options?: Record; } /** * Taxonomy definition in seed. For multi-locale exports each locale variant * is its own entry, linked via `translationOf` (referencing another entry's `id`). */ interface SeedTaxonomy { /** Optional seed-local id, e.g. "tax:category:en". Target of `translationOf`. */ id?: string; name: string; label: string; labelSingular?: string; hierarchical: boolean; collections: string[]; locale?: string; translationOf?: string; terms?: SeedTaxonomyTerm[]; } /** * Taxonomy term in seed */ interface SeedTaxonomyTerm { /** Optional seed-local id, e.g. "term:category:news:en". */ id?: string; slug: string; label: string; description?: string; parent?: string; locale?: string; translationOf?: string; } /** * Menu definition in seed */ interface SeedMenu { /** Optional seed-local id, e.g. "menu:primary:en". */ id?: string; name: string; label: string; locale?: string; translationOf?: string; items: SeedMenuItem[]; } /** * Menu item in seed */ interface SeedMenuItem { /** Optional seed-local id, e.g. "item:primary:home:en". */ id?: string; type: string; label?: string; url?: string; ref?: string; collection?: string; target?: "_blank" | "_self"; titleAttr?: string; cssClasses?: string; locale?: string; translationOf?: string; children?: SeedMenuItem[]; } /** * Redirect definition in seed */ interface SeedRedirect { source: string; destination: string; type?: 301 | 302 | 307 | 308; enabled?: boolean; groupName?: string | null; } /** * Widget area definition in seed */ interface SeedWidgetArea { name: string; label: string; description?: string; widgets: SeedWidget[]; } /** * Widget in seed */ interface SeedWidget { type: "content" | "menu" | "component"; title?: string; content?: Array<{ _type: string; _key?: string; [key: string]: unknown; }>; menuName?: string; componentId?: string; props?: Record; } /** * Section (reusable content block) in seed */ interface SeedSection { slug: string; title: string; description?: string; /** Search keywords */ keywords?: string[]; /** Portable Text content */ content: Array<{ _type: string; _key?: string; [key: string]: unknown; }>; /** Source: "theme" for seed-provided, "import" for WP imports */ source?: "theme" | "import"; } /** * Byline profile in seed */ interface SeedByline { /** Seed-local ID for byline references in content entries */ id: string; slug: string; displayName: string; bio?: string; websiteUrl?: string; isGuest?: boolean; /** * Avatar for the byline, seeded as an already-stored media item. Unlike a * content `$media` reference, nothing is downloaded: the caller supplies the * `storageKey` of a file that already exists in the configured storage (the * common case when seeding alongside a media migration). A `media` row is * created and linked via `avatarMediaId`. */ avatar?: SeedBylineAvatar; } interface SeedBylineAvatar { /** Storage key of an avatar file that already exists in the configured storage. */ storageKey: string; /** Alt text for the avatar image. */ alt?: string; /** Filename for the media record. Defaults to the storage key's basename. */ filename?: string; /** MIME type for the media record. Defaults to `image/jpeg`. */ mimeType?: string; width?: number; height?: number; } /** * Content entry in seed */ interface SeedContentEntry { /** Seed-local ID for $ref resolution */ id: string; /** URL slug. May be omitted for entries in non-routable collections. */ slug?: string | null; /** Publication status */ status?: "published" | "draft"; /** Content data (field slug -> value) */ data: Record; /** Taxonomy term assignments (taxonomy name -> term slugs) */ taxonomies?: Record; /** Ordered byline credits for this entry */ bylines?: SeedBylineCredit[]; /** BCP 47 locale code. When omitted, defaults to defaultLocale. */ locale?: string; /** * Seed-local ID of the source content entry this translates. * Must reference another entry's `id` in the same collection. */ translationOf?: string; } interface SeedBylineCredit { /** Seed byline ID from root `bylines[]` */ byline: string; roleLabel?: string; } /** * Options for applying a seed */ interface SeedApplyOptions { /** * Include sample data: content entries, bylines, and taxonomy terms * (default: false). Schema and structure (collections, fields, taxonomy * definitions, menus, settings, redirects, widget areas, sections) are * always applied. */ includeContent?: boolean; /** How to handle conflicts (default: "skip") */ onConflict?: "skip" | "update" | "error"; /** Base path for local media files (for $media.file resolution) */ mediaBasePath?: string; /** * Storage adapter for media uploads. * Required if seed contains $media references with URLs. */ storage?: Storage; /** * Skip downloading and storing media for $media references. * * When true, $media references are resolved to a MediaValue * that uses the original external URL directly as the `src`, * with provider set to "external". No storage adapter is needed. * * Useful for playground/demo environments where media storage * is unavailable or undesirable. */ skipMediaDownload?: boolean; } /** * Result of applying a seed */ interface SeedApplyResult { collections: { created: number; skipped: number; updated: number; }; fields: { created: number; skipped: number; updated: number; }; taxonomies: { created: number; terms: number; }; bylines: { created: number; skipped: number; updated: number; }; menus: { created: number; items: number; }; redirects: { created: number; skipped: number; updated: number; }; widgetAreas: { created: number; widgets: number; }; sections: { created: number; skipped: number; updated: number; }; settings: { applied: number; }; content: { created: number; skipped: number; updated: number; }; media: { created: number; skipped: number; }; } /** * Validation result */ interface ValidationResult { valid: boolean; errors: string[]; warnings: string[]; } //#endregion //#region src/seed/apply.d.ts /** * Apply a seed file to the database * * This function is idempotent - safe to run multiple times. * * @param db - Kysely database instance * @param seed - Seed file to apply * @param options - Application options * @returns Result summary */ declare function applySeed(db: Kysely, seed: SeedFile, options?: SeedApplyOptions): Promise; //#endregion //#region src/seed/default.d.ts declare const defaultSeed: SeedFile; //#endregion //#region src/seed/load.d.ts /** * Load the seed file (user seed or default). */ declare function loadSeed(): Promise; /** * Load the user's seed file, or null if none exists. */ declare function loadUserSeed(): Promise; //#endregion //#region src/seed/validate.d.ts /** * Validate a seed file * * @param data - Unknown data to validate as a seed file * @returns Validation result with errors and warnings */ declare function validateSeed(data: unknown): ValidationResult; //#endregion export { SeedTaxonomyTerm as _, applySeed as a, ValidationResult as b, SeedCollection as c, SeedFile as d, SeedMenu as f, SeedTaxonomy as g, SeedSection as h, defaultSeed as i, SeedContentEntry as l, SeedRedirect as m, loadSeed as n, SeedApplyOptions as o, SeedMenuItem as p, loadUserSeed as r, SeedApplyResult as s, validateSeed as t, SeedField as u, SeedWidget as v, SeedWidgetArea as y }; //# sourceMappingURL=validate-3945fzPI.d.mts.map