import type { BulkWriteRow, RxDocumentData, RxDocumentWriteData, RxStorageInstance, RxStorageInstanceReplicationState, RxStorageReplicationMeta, WithDeletedAndAttachments } from '../types/index.js'; export declare function docStateToWriteDoc(databaseInstanceToken: string, hasAttachments: boolean, keepMeta: boolean, docState: WithDeletedAndAttachments, previous?: RxDocumentData): RxDocumentWriteData; export declare function writeDocToDocState(writeDoc: RxDocumentData, keepAttachments: boolean, keepMeta: boolean): WithDeletedAndAttachments; export declare function stripAttachmentsDataFromMetaWriteRows(state: RxStorageInstanceReplicationState, rows: BulkWriteRow>[]): BulkWriteRow>[]; /** * Serialises attachment data in a document clone so it can safely be stored * as JSON in a remote storage that does not natively support attachments * (e.g. Google Drive, OneDrive). * * - When `serializeData` is true: Blob values are extracted and stored as * base64 strings in the top-level `_attachments_data` field, while * `_attachments` is stripped to clean stubs via `stripAttachmentsDataFromDocument`. * - When `serializeData` is false: `_attachments` is set to `{}` so that * attachment stubs (without binary data) are never persisted. This * prevents the downstream replication protocol from trying to write * attachment data it does not have when a peer pulls the document. * * The function returns a NEW document object; the original is not mutated. */ export declare function serializeDocAttachments(doc: T, serializeData: boolean): Promise; /** * Strips both `_attachments` data and the serialised `_attachments_data` field * from a document, leaving only the structural attachment metadata * (digest / length / type). Used to compare two document states without * being affected by attachment binary data that lives in different shapes on * each side (Blobs in memory vs base64 in the serialised JSON file). */ export declare function stripAllAttachmentDataForComparison(doc: T): T; /** * Converts attachment data stored in `_attachments_data` back to Blobs in the * document, so that the downstream replication protocol can write them to the * fork storage instance correctly. * * Mutates the document in place and removes the `_attachments_data` field. */ export declare function deserializeDocAttachments(doc: any): Promise; export declare function getUnderlyingPersistentStorage(instance: RxStorageInstance): RxStorageInstance;