import type { ContentTypeProps } from 'contentful-management'; /** * Serialized representation of a Contentful CMA entry for session storage. * Fields use the CMA locale-keyed format: { fieldId: { locale: value } } */ export interface SerializedEntry { sys: { id: string; version: number; publishedVersion?: number; publishedAt?: string; contentType: { sys: { id: string; }; }; createdAt: string; updatedAt: string; }; fields: Record>; } /** * A node in the content tree representing a single entry's position within a page. * Stored depth-first so iteration order matches visual display order. */ export interface TreeNode { entryId: string; ref: string; parentId: string | null; parentField: string | null; depth: number; } /** * A single field change to be applied on save. */ export interface FieldPatch { fieldId: string; locale: string; value: unknown; appliedAt: string; } /** Root entry kinds for a cms-edit session (maps from Contentful content type id via {@link mapContentTypeIdToRootEntryType}). */ export type RootEntryType = 'page' | 'article' | 'articleType' | 'tag' | 'navigation' | 'template' | 'batch'; /** * Maps a CMA content type id to the session root kind. Unknown ids default to `page` (e.g. `--id` on a component). */ export declare function mapContentTypeIdToRootEntryType(contentTypeId: string): RootEntryType; /** Sentinel root entry ID for batch edit sessions (multiple unrelated entries by ID). */ export declare const BATCH_ROOT_ENTRY_ID = "__batch__"; /** How the session was opened — tree (page open) or batch (entry ID edits). */ export type SessionKind = 'tree' | 'batch'; /** * The full session state persisted between CLI commands. */ export interface SessionState { version: 1; spaceKey: string; spaceId: string; environment: string; defaultLocale: string; rootEntryId: string; rootEntryType: RootEntryType; /** Defaults to 'tree' when omitted (backward compatible). */ sessionKind?: SessionKind; fetchedAt: string; /** All fetched entries keyed by entry ID */ entries: Record; /** Original entry state at open time (for diff) */ originalEntries: Record; /** @c0 → entryId */ refs: Record; /** entryId → @c0 */ refsByEntry: Record; /** Depth-first ordered tree nodes */ treeNodes: TreeNode[]; /** Entry IDs that have been locally modified */ modifiedEntryIds: string[]; /** Draft-only entry IDs to delete on save (from remove operations) */ pendingDeletions: string[]; /** Cached CMA content type definitions (reused across CLI invocations for this session) */ contentTypes?: Record; } export type EntryStatus = 'published' | 'draft' | 'pending' | 'changed'; /** * Derives the display status of an entry. * * - changed: has unsaved local patches * - draft: never published * - pending: published but has newer draft on Contentful * - published: published and no pending changes */ export declare function getEntryStatus(entry: SerializedEntry, isLocallyModified: boolean): EntryStatus; /** * Returns the display type label for any content type. * Looks for a ${ctId}Type discriminator field (e.g. componentType, collectionType, * externalComponentType) and renders as TypeName[value] when present. * Falls back to the capitalised content type ID for types without a discriminator. */ export declare function getEntryTypeLabel(entry: SerializedEntry, locale: string): string; /** * Returns the best display label (cmsLabel or heading or entry ID). */ export declare function getEntryLabel(entry: SerializedEntry, locale: string): string; /** The content array fields that can contain linked entries. */ export declare const CONTENT_ARRAY_FIELDS: readonly ["topContent", "content", "bottomContent", "contents", "structuredData", "indexPageStructuredData", "links"]; //# sourceMappingURL=state.d.ts.map