/** * Media Preservation Utility * * This utility ensures that media fields are properly preserved during translation. * It handles: * - Extracting media IDs for Strapi v5 updates * - Preserving media references while translating text fields (like alt) * - Detecting and handling media fields in components */ type DataObject = Record; declare class MediaPreserver { private componentSchemas; constructor(); /** * Load all component schemas from the file system */ private loadComponentSchemas; /** * Recursively load schemas from directory */ private loadSchemasFromDirectory; /** * Check if a field is a media field based on component schema */ isMediaField(componentName: string, fieldName: string): boolean; /** * Get all media field names for a component */ getMediaFields(componentName: string): string[]; /** * Extract media ID from a media object * Strapi v5 expects media fields to be IDs, not full objects */ extractMediaId(mediaData: unknown): number | null; /** * Process a component to preserve media fields * Returns the component with media fields as IDs instead of full objects */ preserveMediaInComponent(component: DataObject): DataObject; /** * Process an entire entity to preserve media fields in all components */ preserveMediaInEntity(entity: DataObject): DataObject; /** * Check if a value looks like a Strapi media object * Media objects have specific properties that distinguish them from regular components * We need to be strict to avoid false positives (e.g., grid-item has id + url but is not media) */ isMediaObject(value: unknown): boolean; /** * Recursively process any object and convert media objects to IDs * This is a fallback for cases where we don't have component schema info */ convertMediaObjectsToIds(data: unknown): unknown; } declare const _default: MediaPreserver; export default _default;