import type { ReplicationOptions, ReplicationPullOptions, ReplicationPushOptions } from '../../types/index.d.ts'; import { SignalingOptions } from './signaling.ts'; export type GoogleDriveCheckpointType = { modifiedTime: string; /** * There is no way to do a comparison (> or >=) * on fileNames or ids in google drive. * Also modifiedTime can be sometimes the same * on multiple files. * Therefore we might overfetch documents and * after the request removed the ones that have been known before. */ docIdsWithSameModifiedTime: string[]; }; export interface DriveFileMetadata { id: string; name: string; mimeType: string; parents?: string[]; modifiedTime?: string; size?: string; // Drive returns size as string fileSize?: string; // v2 etag?: string; } export type GoogleDriveOptions = { oauthClientId: string; authToken: string; /** * like "https://www.googleapis.com" * No trailing slash! */ apiEndpoint?: string; /** * Path to a folder in Google Drive where all data is stored. * Example: 'rxdb-replication/my-app' */ folderPath: string; /** * Time in milliseconds. */ transactionTimeout?: number; }; export type GoogleDriveOptionsWithDefaults = { oauthClientId: string; authToken: string; /** * like "https://www.googleapis.com" * No trailing slash! */ apiEndpoint: string; folderPath: string; /** * Time in milliseconds. */ transactionTimeout: number; }; export interface DriveFileListResponse { nextPageToken?: string; files: DriveFileMetadata[]; } export type GoogleDriveSyncPullOptions = Omit, 'handler' | 'stream$'>; export type GoogleDriveSyncPushOptions = Omit, 'handler'>; export type SyncOptionsGoogleDrive = Omit< ReplicationOptions, 'pull' | 'push' > & { googleDrive: GoogleDriveOptions; signalingOptions?: SignalingOptions; pull?: GoogleDriveSyncPullOptions; push?: GoogleDriveSyncPushOptions; };