/** * Blob Offloading for Dexie Cloud * * Handles uploading large blobs to blob storage before sync, * and resolving BlobRefs when reading from the database. */ import { DBOperationsSet } from 'dexie-cloud-common'; import { BlobRef, BlobRefOrigType, isBlobRef as isBlobRefFromResolve } from './blobResolve'; export declare const DEFAULT_MAX_STRING_LENGTH = 32768; export type { BlobRef, BlobRefOrigType }; export declare const isBlobRef: typeof isBlobRefFromResolve; /** * Check if a value should be offloaded to blob storage * Performance-optimized for hot path traversal. */ export declare function shouldOffloadBlob(value: unknown): value is Blob | ArrayBuffer | ArrayBufferView; /** * Upload a blob to the blob storage endpoint */ export declare function uploadBlob(databaseUrl: string, getCachedAccessToken: () => Promise, blob: Blob | ArrayBuffer | ArrayBufferView): Promise; export declare function offloadBlobsAndMarkDirty(obj: unknown, databaseUrl: string, getCachedAccessToken: () => Promise, maxStringLength?: number): Promise; /** * Recursively scan an object for large blobs and upload them * Returns a new object with blobs replaced by BlobRefs */ export declare function offloadBlobs(obj: unknown, databaseUrl: string, getCachedAccessToken: () => Promise, maxStringLength?: number, dirtyFlag?: { dirty: boolean; }, visited?: WeakSet): Promise; /** * Process a DBOperationsSet and offload any large blobs * Returns a new DBOperationsSet with blobs replaced by BlobRefs */ export declare function offloadBlobsInOperations(operations: DBOperationsSet, databaseUrl: string, getCachedAccessToken: () => Promise, maxStringLength?: number): Promise; /** * Check if there are any large blobs in the operations that need offloading * This is a quick check to avoid unnecessary processing */ export declare function hasLargeBlobsInOperations(operations: DBOperationsSet, maxStringLength?: number): boolean;