import { BaseAdapter, AdapterConfig, SyncQuery, PushOptions, SyncResult, TableSchema, SyncMigration, ColumnDef } from '../sync-adapter.js'; import { ActiveRecord } from '../activerecord.js'; export interface RestAdapterConfig extends AdapterConfig { /** Base URL for the REST API */ url: string; /** Optional auth token */ authToken?: string; /** Optional API key */ apiKey?: string; /** Custom headers to send with each request */ headers?: Record; /** Request timeout in milliseconds (default: 30000) */ timeout?: number; /** Endpoint path pattern (default: /{table}) */ endpointPattern?: string; } /** * Generic REST API Sync Adapter * * Works with any RESTful backend that exposes the following endpoints: * * | Method | Endpoint | Purpose | * |--------|----------|---------| * | GET | `/health` | Optional health check during `connect()` | * | GET | `/{table}?since=&limit=&offset=` | Pull records from remote | * | POST | `/{table}` | Push records to remote (body: JSON array) | * | GET | `/schema/{table}` | Fetch remote schema | * | POST | `/migrations` | Apply a migration (body: `{ version, name }`) | * * The `/{table}` path is configurable via `endpointPattern` (default: `/{table}`). * * Authentication is sent via `Authorization: Bearer ` or `X-API-Key: `. * All requests include `Content-Type: application/json`. * * Conflict resolution is handled by `BaseAdapter.resolveConflict()` and does not * require a dedicated endpoint — conflicts are detected during pull/push and * resolved client-side before the record is persisted. */ export declare class RestAdapter extends BaseAdapter { private abortController?; connect(config: RestAdapterConfig): Promise; disconnect(): Promise; /** * Pull records from the REST API */ pull(query: SyncQuery): Promise; /** * Push records to the REST API */ push(records: T[], options?: PushOptions): Promise; /** * Ensure a table exists on the remote, creating it if missing. * POSTs to /schema with { table, columns } — server creates if absent. */ ensureTable(table: string, columns?: ColumnDef[]): Promise; /** * Get schema from REST API * Assumes endpoint /schema/{table} exists */ getRemoteSchema(table: string): Promise; /** * Apply migration via REST API * Assumes endpoint /migrations exists */ applyMigration(migration: SyncMigration): Promise; /** * Build endpoint URL from pattern */ private buildEndpoint; /** * Make HTTP request with auth and timeout */ private request; } //# sourceMappingURL=rest-adapter.d.ts.map