/** * Abstract integration provider interface. * * Relayfile supports multiple integration providers (Nango, Composio, etc.) * for syncing external service data into the Relayfile filesystem. * * Each provider maps its own webhook/event format into Relayfile's canonical * path + semantics model. */ import type { RelayFileClient } from "./client.js"; import type { FileQueryItem, FilesystemEvent, QueuedResponse } from "./types.js"; /** Normalized webhook input from any provider */ export interface WebhookInput { /** Provider name (e.g., "github", "slack", "zendesk") */ provider: string; /** Object type / model (e.g., "tickets", "commits", "messages") */ objectType: string; /** Unique object ID within the provider */ objectId: string; /** Event type (e.g., "created", "updated", "deleted") */ eventType: string; /** Raw payload data */ payload: Record; /** Optional relations to other objects */ relations?: string[]; /** Provider-specific metadata (connection IDs, user IDs, etc.) */ metadata?: Record; } /** Options for listing files from a specific provider */ export interface ListProviderFilesOptions { provider: string; objectType?: string; status?: string; limit?: number; signal?: AbortSignal; } /** Options for watching provider events */ export interface WatchProviderEventsOptions { provider: string; pollIntervalMs?: number; cursor?: string; signal?: AbortSignal; } export declare function computeCanonicalPath(provider: string, objectType: string, objectId: string): string; export declare abstract class IntegrationProvider { protected readonly client: RelayFileClient; abstract readonly name: string; constructor(client: RelayFileClient); /** * Ingest a webhook event from this provider into Relayfile. * Each provider implementation normalizes its event format to WebhookInput, * then writes it to the canonical path. */ abstract ingestWebhook(workspaceId: string, rawInput: unknown, signal?: AbortSignal): Promise; /** * Query files from a specific provider. */ getProviderFiles(workspaceId: string, options: ListProviderFilesOptions): Promise; /** * Watch for file events from a specific provider. */ watchProviderEvents(workspaceId: string, options: WatchProviderEventsOptions): AsyncGenerator; }