// src/schemas/registry.ts // Backend Schema Registry — single source of truth for all rclone backend field definitions. // IMPORTANT: FieldDef.key values MUST match rclone config key names exactly. // These keys are used by Phase 2 generators to build rclone.conf INI content. // Verify against https://rclone.org/azureblob/ and https://rclone.org/s3/ before Phase 2. export type BackendType = 'azureblob' | 's3' | 's3-compatible' | 'onedrive' | 'sftp' | 'gcs' | 'b2'; export interface FieldDef { key: string; // MUST match rclone config key exactly (snake_case) label: string; inputType: 'text' | 'password' | 'select' | 'toggle'; required: boolean; placeholder?: string; helpText?: string; options?: { value: string; label: string }[]; // for inputType: 'select' } // NOTE: 'sftp' entry is intentionally missing — Plan 02 (06-02-PLAN.md) adds it. // The type cast below suppresses the incomplete-record error until that plan runs. // eslint-disable-next-line @typescript-eslint/no-explicit-any export const BACKEND_REGISTRY = { azureblob: { displayName: 'Azure Blob Storage', description: 'Microsoft Azure cloud storage', fields: [ { key: 'account', label: 'Storage Account Name', inputType: 'text', required: true, placeholder: 'mystorageaccount', helpText: 'The storage account name (not the full URL)', }, { key: 'key', label: 'Access Key', inputType: 'password', required: false, helpText: 'Base64-encoded storage account key. Provide either this or a SAS URL, not both.', }, { key: 'sas_url', label: 'SAS URL', inputType: 'password', required: false, placeholder: 'https://mystorageaccount.blob.core.windows.net/?sv=...', helpText: 'Full SAS URL including account and container. Provide either this or an access key, not both.', }, ], }, s3: { displayName: 'Amazon S3', description: 'AWS Simple Storage Service', fields: [ { key: 'provider', label: 'Provider', inputType: 'select', required: true, options: [{ value: 'AWS', label: 'Amazon S3' }], }, { key: 'access_key_id', label: 'Access Key ID', inputType: 'text', required: true, placeholder: 'AKIAIOSFODNN7EXAMPLE', }, { key: 'secret_access_key', label: 'Secret Access Key', inputType: 'password', required: true, }, { key: 'region', label: 'Region', inputType: 'text', required: true, placeholder: 'us-east-1', }, ], }, 's3-compatible': { displayName: 'S3-Compatible', description: 'Wasabi, MinIO, Cloudflare R2, and others', fields: [ { key: 'provider', label: 'Provider', inputType: 'select', required: true, options: [{ value: 'Other', label: 'S3-Compatible' }], helpText: 'Covers Wasabi, MinIO, Cloudflare R2, and any S3-compatible storage', }, { key: 'access_key_id', label: 'Access Key ID', inputType: 'text', required: true, }, { key: 'secret_access_key', label: 'Secret Access Key', inputType: 'password', required: true, }, { key: 'endpoint', label: 'Endpoint URL', inputType: 'text', required: true, placeholder: 'https://s3.wasabisys.com', helpText: 'The S3-compatible endpoint URL for your storage provider', }, { key: 'region', label: 'Region', inputType: 'text', required: false, placeholder: 'us-east-1', helpText: 'Optional for most S3-compatible providers', }, ], }, onedrive: { displayName: 'OneDrive', description: 'Microsoft OneDrive (paste pre-obtained rclone token)', fields: [ { key: 'token', label: 'OAuth Token (JSON)', inputType: 'password', required: true, placeholder: '{"access_token":"...","token_type":"Bearer","refresh_token":"...","expiry":"..."}', helpText: 'Paste the JSON token from: rclone authorize "onedrive"', }, { key: 'drive_id', label: 'Drive ID', inputType: 'text', required: true, placeholder: 'b!...', helpText: 'The drive ID from your OneDrive. Found in the rclone authorize output.', }, { key: 'drive_type', label: 'Drive Type', inputType: 'select', required: true, options: [ { value: 'personal', label: 'Personal' }, { value: 'business', label: 'Business' }, { value: 'documentLibrary', label: 'SharePoint Document Library' }, ], helpText: 'Personal for consumer OneDrive, Business for Microsoft 365', }, ], }, gcs: { displayName: 'Google Cloud Storage', description: 'Google Cloud Storage', fields: [ { key: 'project_number', label: 'Project Number', inputType: 'text', required: true, placeholder: '123456789', helpText: 'Your GCP project number (not project ID)', }, { key: 'service_account_credentials', label: 'Service Account JSON', inputType: 'password', required: true, placeholder: '{"type":"service_account","project_id":"..."}', helpText: 'Paste the full content of your service account JSON key file', }, ], }, b2: { displayName: 'Backblaze B2', description: 'Backblaze B2 Cloud Storage', fields: [ { key: 'account', label: 'Application Key ID', inputType: 'text', required: true, placeholder: 'your-application-key-id', helpText: 'The applicationKeyId — not the master account ID', }, { key: 'key', label: 'Application Key', inputType: 'password', required: true, helpText: 'The application key (secret value from the B2 dashboard)', }, ], }, } as Record;