import type { TokenFinalResponse } from 'dexie-cloud-common'; import type { LoginHints } from './DexieCloudAPI'; export interface PeriodicSyncOptions { minInterval?: number; } export interface DexieCloudOptions { databaseUrl: string; requireAuth?: boolean | LoginHints; tryUseServiceWorker?: boolean; periodicSync?: PeriodicSyncOptions; customLoginGui?: boolean; unsyncedTables?: string[]; unsyncedProperties?: { [tableName: string]: string[]; }; nameSuffix?: boolean; disableWebSocket?: boolean; disableEagerSync?: boolean; fetchTokens?: (tokenParams: { public_key: string; hints?: { userId?: string; email?: string; }; }) => Promise; awarenessProtocol?: typeof import('y-protocols/awareness'); /** Enable social/OAuth authentication. * - true (default): Fetch providers from server, show if available * - false: Disable OAuth, always use OTP flow * * Use `false` for backward compatibility if your custom login UI * doesn't handle the `DXCSelect` interaction type yet. */ socialAuth?: boolean; /** Redirect URI for OAuth callback. * Defaults to window.location.href for web SPAs. * * For Capacitor/native apps, set this to a custom URL scheme: * ``` * oauthRedirectUri: 'myapp://' * ``` */ oauthRedirectUri?: string; /** How to handle blob downloads from cloud storage. * * - 'eager' (default): Download blobs in background immediately after sync. * Best for offline-first apps that need all data available offline ASAP. * * - 'lazy': Download blobs on-demand when accessed. * Best for apps with large media that may not all be needed offline. */ blobMode?: 'eager' | 'lazy'; /** String length threshold (in characters) for offloading to blob storage during sync. * * Strings longer than this threshold are uploaded as blobs during sync, * reducing sync payload size. The original string is kept intact in IndexedDB. * * Set to `Infinity` to disable string offloading. * Minimum value is 100 to prevent accidental offloading of primary keys. * Maximum value is 32768 (server limit). * * @default 32768 */ largeStringThreshold?: number; /** * @deprecated Use `largeStringThreshold` instead. */ maxStringLength?: number; }