import { ColorScheme } from '@keystar/ui/types'; import { ReactElement } from 'react'; import { ComponentSchema, FormField, SlugFormField } from "./form/api.js"; import type { Locale } from "./app/l10n/locales.js"; import { RepoConfig } from "./app/repo-config.js"; export type DataFormat = 'json' | 'yaml'; export type Format = DataFormat | { data?: DataFormat; contentField?: string | [string, ...string[]]; }; export type EntryLayout = 'content' | 'form'; export type Glob = '*' | '**'; export type Collection, SlugField extends string> = { label: string; path?: `${string}/${Glob}` | `${string}/${Glob}/${string}`; entryLayout?: EntryLayout; format?: Format; previewUrl?: string; columns?: string[]; template?: string; parseSlugForSort?: (slug: string) => string | number; slugField: SlugField; schema: Schema; }; export type Singleton> = { label: string; path?: string; entryLayout?: EntryLayout; format?: Format; previewUrl?: string; schema: Schema; }; type CommonConfig = { locale?: Locale; cloud?: { project: string; }; ui?: UserInterface; }; type CommonRemoteStorageConfig = { pathPrefix?: string; branchPrefix?: string; }; type BrandMark = (props: { colorScheme: Exclude; }) => ReactElement; export declare const NAVIGATION_DIVIDER_KEY = "---"; type UserInterface = { brand?: { mark?: BrandMark; name: string; }; navigation?: Navigation<(keyof Collections & string) | (keyof Singletons & string) | typeof NAVIGATION_DIVIDER_KEY>; }; type Navigation = K[] | { [section: string]: K[]; }; type GitHubStorageConfig = { kind: 'github'; repo: RepoConfig; /** * Enable internal username/password authentication instead of GitHub OAuth. * When enabled, users will authenticate with a username and password, * and an internal GitHub token will be used for API access. * Requires KEYSTATIC_GITHUB_INTERNAL_TOKEN and KEYSTATIC_INTERNAL_AUTH_CREDENTIALS environment variables. */ internalAuth?: boolean; } & CommonRemoteStorageConfig; export type GitHubConfig, string>; } = { [key: string]: Collection, string>; }, Singletons extends { [key: string]: Singleton>; } = { [key: string]: Singleton>; }> = { storage: GitHubStorageConfig; collections?: Collections; singletons?: Singletons; } & CommonConfig; type LocalStorageConfig = { kind: 'local'; }; export type LocalConfig, string>; } = { [key: string]: Collection, string>; }, Singletons extends { [key: string]: Singleton>; } = { [key: string]: Singleton>; }> = { storage: LocalStorageConfig; collections?: Collections; singletons?: Singletons; } & CommonConfig; type CloudStorageConfig = { kind: 'cloud'; } & CommonRemoteStorageConfig; export type CloudConfig, string>; } = { [key: string]: Collection, string>; }, Singletons extends { [key: string]: Singleton>; } = { [key: string]: Singleton>; }> = { storage: CloudStorageConfig; cloud: { project: string; }; collections?: Collections; singletons?: Singletons; } & CommonConfig; export type Config, string>; } = { [key: string]: Collection, string>; }, Singletons extends { [key: string]: Singleton>; } = { [key: string]: Singleton>; }> = { storage: LocalStorageConfig | GitHubStorageConfig | CloudStorageConfig; collections?: Collections; singletons?: Singletons; } & ({} extends Collections ? {} : { collections: Collections; }) & ({} extends Singletons ? {} : { singletons: Singletons; }) & CommonConfig; export declare function config, string>; }, Singletons extends { [key: string]: Singleton>; }>(config: Config): Config; export declare function collection, SlugField extends { [K in keyof Schema]: Schema[K] extends SlugFormField ? K : never; }[keyof Schema]>(collection: Collection & { columns?: { [K in keyof Schema]: Schema[K] extends FormField | SlugFormField ? K & string : never; }[keyof Schema][]; }): Collection; export declare function singleton>(collection: Singleton): Singleton; export {};