import type { PageLocalization, SeoMetadata, SiteLocales } from "@pantheon-systems/css-client"; /** Describes what features are available with the current store backend. */ export interface StoreCapabilities { /** Multi-branch support. */ branching: boolean; /** Version history. */ versioning: boolean; /** Real-time collaboration. */ realtime: boolean; /** Branch merge / conflict resolution. */ merge: boolean; } /** * The shape of a document's stored page data, enough to classify its route without reading it. * `patch` is a semantic patch over `basePath` with `operationCount` operations; `page` is full * page data; `other` is anything else. */ export interface RouteSummary { shape: "patch" | "page" | "other"; basePath?: string; operationCount?: number; } /** Minimal document metadata returned by listDocuments. */ export interface DocumentMeta { path: string; templateId?: string | null; /** * Summary of what reading this document from the same store returns; `null` when it has no * readable data. Absent when the store cannot describe that read, in which case callers must * read the document itself. */ routeSummary?: RouteSummary | null; } export interface StoredDocumentMeta extends DocumentMeta { id: string; } export interface DocumentSnapshotReader { getByDocument(doc: StoredDocumentMeta): Promise; } /** Optional metadata when creating/updating a page. */ export interface PageSetOptions { templateId?: string; templateVersion?: number; } /** * What a public read of a page delivered beside its data. Every field is * absent when the delivery carried none. */ export interface DeliveredPageFields { metadata?: SeoMetadata; /** The page's locale and its locale variants. */ localization?: PageLocalization; /** The locales the site publishes in and its fallback policy. */ siteLocales?: SiteLocales; } /** Page data store — keyed by route path (e.g. "/", "/about", "/jedi/:id"). */ export interface PageStore { get(path: string): Promise; /** * What the latest public read of the page at `path` delivered beside its data, * or `undefined` when there was none: no public read, a read that found no * page, or an editor read in progress. Reads nothing itself. */ getDeliveredFields?(path: string): DeliveredPageFields | undefined; set(path: string, value: unknown, options?: PageSetOptions): Promise; delete(path: string): Promise; has(path: string): Promise; keys(): Promise; /** List documents with metadata. Falls back to keys() when not available. */ listDocuments?(): Promise; } /** Editor metadata store — keyed by route path. */ export interface EditorMetaStore { get(path: string): Record | undefined; set(path: string, row: Record): void; delete(path: string): void; } /** Global remote datasource definitions store. */ export interface RemoteDatasourceDefStore { list(): unknown[]; save(remoteDatasources: unknown[]): void; }