import type { GetKeysOptions, StorageValue } from 'unstorage'; import type { MDCParserResult } from '@nuxtjs/mdc'; import { type ParseExtReturn } from './internal.js'; export type { ParseExtReturn }; export type StaticContent = Omit & ({ type: 'json'; content: null | (T extends unknown ? Record : T); } | { type: 'toml'; content: null | (T extends unknown ? Record : T); } | { type: 'yaml'; content: null | (T extends unknown ? Record : T); } | { type: 'markdown'; content: null | MDCParserResult; } | { type: 'unknown' | 'raw'; content: null | (T extends unknown ? StorageValue : T); }); /** * Retrieves and parses static content from the CMS assets storage. * * @param path - The path to the content file, with or without extension * @param base - Optional base directory to scope the search * @param opts - Optional configuration options for storage key retrieval * @typeParam T - The expected return type of the content * * @returns A promise resolving to a `StaticContent` object containing: * - `file`: Original file path * - `type`: Content type ('json', 'toml', 'yaml', 'markdown', or 'unknown' | 'raw') * - `content`: The parsed content based on the file type, or null if not found * - `env`: Optional deployment target ('dev', 'demo', or undefined) * - `path`: The file path without extension * - `ext`: The file extension * * @example * // With extension * const article = await queryStaticContent
('blog/my-post.md'); * * @example * // Without extension (will find the first matching file) * const config = await queryStaticContent('settings/config'); * * @example * // With base directory * const posts = await queryStaticContent('latest', 'blog'); */ export declare function queryStaticContent(path?: string, base?: string, opts?: GetKeysOptions): Promise | undefined>; /** * Lists all static content files in the CMS assets storage with parsed metadata. * * @param base - Optional base directory to scope the search * @param opts - Optional configuration options for storage key retrieval * * @returns A promise resolving to an array of `ParseExtReturn` objects containing: * - `file`: Original file path * - `type`: Content type ('json', 'toml', 'yaml', 'markdown', or 'unknown') * - `env`: Optional deployment target ('dev', 'demo', or undefined) * - `path`: The normalized file path without extension * - `ext`: The file extension * * @example * // List all content files * const allFiles = await listStaticContent(); * * @example * // List content files in specific directory * const blogPosts = await listStaticContent('blog'); */ export declare function listStaticContent(base?: string, opts?: GetKeysOptions): Promise; /** * Provides access to the CMS assets storage driver. * * @returns A storage driver instance for the 'assets:cms' namespace * * @example * // Get the storage driver * const storage = useStaticContent(); * * @example * // Use the storage driver to get content directly * const rawContent = await useStaticContent().getItem('blog:post.md'); */ export declare function useStaticContent(): any;