/** * Pipeline Operations Types (v1 + v2) * * Types for pipeline configuration and operations. * * @packageDocumentation */ import type { PipelineError } from '../shared/types'; /** * v1 State values (operational mode). * Source: `api/src/redis_di_api/v1/modules/shared/response.py` - State enum * * Describes what the pipeline is currently doing: * - `cdc`: Pipeline is running Change Data Capture * - `initial-sync`: Pipeline is performing initial synchronization * - `not-running`: Pipeline is not running */ export type PipelineStateValueV1 = 'cdc' | 'initial-sync' | 'not-running'; /** * v1 RdiStatus values (component readiness). * Source: `api/src/redis_di_api/v1/modules/status/common.py` - RdiStatus enum * * Describes the readiness state of a component or pipeline: * - `ready`: Component/pipeline is ready * - `not-ready`: Component/pipeline is not ready (starting, error, etc.) * - `stopped`: Component/pipeline is stopped */ export type RdiStatusValueV1 = 'ready' | 'not-ready' | 'stopped'; /** * v2 Status values (combined operational state). * Source: `api/src/redis_di_api/v2/models/status.py` - Status enum * * Unified status that combines operational mode and readiness: * - `started`: Pipeline is running * - `stopped`: Pipeline is stopped * - `error`: Pipeline encountered an error * - `creating`: Pipeline is being created * - `updating`: Pipeline is being updated * - `deleting`: Pipeline is being deleted * - `starting`: Pipeline is starting * - `stopping`: Pipeline is stopping * - `resetting`: Pipeline is resetting * - `pending`: Pipeline is pending action * - `unknown`: Status is unknown */ export type PipelineStatusValueV2 = 'started' | 'stopped' | 'error' | 'creating' | 'updating' | 'deleting' | 'starting' | 'stopping' | 'resetting' | 'pending' | 'unknown'; /** * Pipeline status value for SDK consumers. * Combines v2 status values with v1-specific readiness values. * * This type is the normalized status returned by all SDK methods. * It includes all v2 values plus v1-specific 'ready' and 'not-ready'. */ export type PipelineStatusValue = PipelineStatusValueV2 | 'ready' | 'not-ready'; /** * @deprecated Use `PipelineStatusValue` instead. * Kept for backwards compatibility. */ export type UnifiedPipelineStatusValue = PipelineStatusValue; /** * @deprecated Use `RdiStatusValueV1` instead. * Kept for backwards compatibility. */ export type RdiStatusValue = RdiStatusValueV1; /** * @deprecated Use `PipelineStateValueV1` instead. * Kept for backwards compatibility. */ export type PipelineStateValue = PipelineStateValueV1; /** * Task status values (v1). * Based on official RDI SDK: `sdk/docs/Models/TaskStatus.md` */ export type TaskStatusValue = 'pending' | 'running' | 'completed' | 'failed'; /** * Pipeline component status (v2). * Based on official RDI SDK: `sdk/typescript/src/models/PipelineComponentResponse.ts` */ export interface PipelineComponentStatus { /** Component name */ name: string; /** Component type */ type?: string; /** Source this collector belongs to, when the component is source-specific. */ source?: string; /** Component info/description */ info?: string; /** Component status */ status?: PipelineStatusValue; /** Number of running replicas, reported for the Flink processor. */ replicas?: number; /** Optional errors */ errors?: PipelineError[]; /** Metric collections */ metricCollections?: string[]; } /** * Task info (v1). * Based on official RDI SDK: `sdk/docs/Models/Task.md` */ export interface RdiTask { /** Task name */ name: string; /** Task status */ status: TaskStatusValue; /** Task error */ error?: string; /** Task creation timestamp */ createdAt?: string; } /** * Entity info (v1). * Based on official RDI SDK: `sdk/docs/Models/Entity.md` */ export interface RdiEntity { /** Component status (v1 readiness) */ status: RdiStatusValueV1; /** Whether component is connected */ connected?: boolean; /** Component version */ version?: string; /** Error message */ error?: string; } /** * Pipeline info (v1). * Based on official RDI SDK: `sdk/docs/Models/Pipeline.md` */ export interface RdiPipeline { /** Pipeline status (v1 readiness) */ status: RdiStatusValueV1; /** Pipeline state (v1 operational mode) */ state: PipelineStateValueV1; /** Last error message */ lastError?: string; /** Pipeline tasks */ tasks?: RdiTask[]; } /** * Response from GET /api/v1/status (v1). * Based on official RDI SDK: `sdk/docs/Models/StatusResponse.md` */ export interface RdiStatusResponse { /** Component entities by name */ components?: Record; /** Pipeline status by name */ pipelines?: Record; } /** * Response from GET /api/v2/pipelines/{name}/status (v2). * Based on official RDI SDK: `sdk/docs/Models/PipelineStatusResponse.md` */ export interface PipelineStatus { /** Current status (v1 or v2 status values) */ status?: PipelineStatusValue; /** * When the current status was entered (ISO 8601, v2 only). * Source: `PipelineStatusResponse.status_changed_at`. */ statusChangedAt?: string; /** Optional errors */ errors?: PipelineError[]; /** Pipeline components status */ components?: PipelineComponentStatus[]; /** Whether this is the current pipeline version */ current?: boolean; } /** * Status response for SDK. * Normalizes v1 StatusResponse and v2 PipelineStatusResponse. */ export interface StatusResponse { /** Pipeline name (from SDK parameter or v1 pipelines keys) */ pipelineName?: string; /** * Overall pipeline status (normalized). * For v2: uses PipelineStatusValueV2 values directly. * For v1: maps RdiStatusValueV1 + PipelineStateValueV1 to PipelineStatusValue. */ status?: PipelineStatusValue; /** * Pipeline state (v1 native, v2 derived from every collector metric collection). * Values: 'cdc' | 'initial-sync' | 'not-running' * * For v2 this is the *least-advanced* state across collectors: a pipeline with * one source still in `initial-sync` reads `initial-sync` even when the rest * already stream, and a single `not-running` collector makes it `not-running`. */ state?: PipelineStateValueV1; /** * Run state per collector, keyed by source name (v2 only, derived from each * `collector-` metric collection). {@link state} is the * least-advanced of these. */ collectorStates?: Record; /** * When the current status was entered (ISO 8601, v2 only) — the basis for * "status since" / uptime displays. Not reported by v1. */ statusChangedAt?: string; /** Pipeline errors */ errors?: PipelineError[]; /** Pipeline components (v2 or normalized from v1) */ components?: PipelineComponentStatus[]; /** Whether this is the current pipeline version (v2 only) */ current?: boolean; /** Last error message (from v1 RdiPipeline.lastError) */ lastError?: string; /** Pipeline tasks (from v1 RdiPipeline.tasks) */ tasks?: RdiTask[]; /** Raw v1 response (for advanced use cases) */ rawV1Response?: RdiStatusResponse; } /** * @deprecated Use `StatusResponse` instead. * Kept for backwards compatibility. */ export type UnifiedStatusResponse = StatusResponse; /** * Database connection configuration. */ export interface ConnectionConfig { /** Host address */ host: string; /** Port number */ port: number; /** Connection type (e.g., "redis", "mysql", "postgresql") */ type: string; /** Username for authentication */ user?: string; /** Password (may contain secret references like ${secret:...}) */ password?: string; /** Database name (e.g., "XE" for Oracle, "inventory" for MySQL) */ database?: string; } /** * Target database configuration. */ export interface TargetConfig { /** Connection settings */ connection: ConnectionConfig; } /** * Flat target connection request used for testing a target connection. */ export interface TargetDbRequest { /** Host address */ host: string; /** Port number */ port: number; /** Username for authentication */ username?: string; /** Password for authentication */ password?: string; /** Whether SSL should be used */ ssl?: boolean; } /** * Flat source connection request used for testing a source connection. */ export interface SourceDbConnectionTest { /** Source database type (e.g. mysql, postgresql) */ type: string; /** Host address */ host: string; /** Port number */ port: number; /** Username for authentication */ username: string; /** Password for authentication */ password: string; /** Optional list of database names */ databases?: string[]; } /** * Source database configuration. */ /** * Per-table configuration within a source. * * Relational sources set `columns` and `keys`, where `keys` must be a non-empty * subset of `columns`. MongoDB sources set neither — `columns` is rejected for * MongoDB connections by the RDI config schema, so a selected collection is an * empty entry (`{}`), meaning "capture this collection with all of its fields". */ export interface TableConfig { /** Columns to include. Omitted for MongoDB collections. */ columns?: string[]; /** * Identifier columns (PK/UC or user-chosen). When set, must be non-empty and a * subset of explicit `columns`. With `columns: ['*']`, keys name identifier columns separately. * Omitted for MongoDB collections. */ keys?: string[]; /** * Fields to exclude from capture. MongoDB only — the collector turns these into * `field.exclude.list`. * * Nothing writes this today: the UI sends MongoDB field exclusions as an * `advanced.source['field.exclude.list']` property instead. */ exclude_columns?: string[]; /** Optional custom SQL for snapshot filtering. */ snapshot_sql?: string; } export interface SourceConfig { /** * Whether this source's collector is enabled. * * When `false`, the collector is disabled and produces no events — stop-per-source * sets this, and add-source writes it while a source is tested but not yet * deployed. Treat a missing value as enabled: configs written before this flag * existed carry only running sources. */ active?: boolean; /** Connection settings */ connection: ConnectionConfig; /** List of databases to sync */ databases?: string[]; /** Logging configuration */ logging?: { level: string; }; /** * Table configurations keyed by `"SCHEMA.TABLE"` name. * * Presence of the key is what selects the table; tables omitted from the record * are not synced. Relational entries carry `columns` (selected columns) and * `keys` (identifier columns, a non-empty subset of `columns`). MongoDB * collections carry neither, so they are empty entries. * * @example * { * "SCHEMA1.CUSTOMERS": { "columns": ["customerid", "country"], "keys": ["customerid"] }, * "SCHEMA1.ORDERS": { "columns": ["orderid", "amount"], "keys": ["orderid"] } * } * * @example MongoDB * { "shop.orders": {}, "shop.customers": {} } */ tables?: Record; /** Source type (e.g., "cdc", "snapshot") */ type?: string; /** * Advanced Debezium connector properties, grouped by category. * * @example * { * source: { "database.pdb.name": "XEPDB1", "poll.interval.ms": 100 }, * } */ advanced?: { /** Collector source (Debezium / cdc) properties */ source?: Record; /** Flink collector source properties (Spanner sources) */ flink?: Record; /** RIOT-X collector source properties (Snowflake sources) */ riotx?: Record; /** Collector sink properties */ sink?: Record; }; } /** * Processor configuration for data transformation. */ export interface ProcessorTaskManagerConfig { /** Number of Flink TaskManager replicas to run. */ replicas?: number; } export interface ProcessorResourcesConfig { /** Flink TaskManager resource configuration. */ taskManager?: ProcessorTaskManagerConfig; } export interface ProcessorAdvancedConfig { /** Flink processor resource configuration. */ resources?: ProcessorResourcesConfig; } export interface ProcessorConfig { /** Processing duration in milliseconds */ duration?: number; /** Number of records to read in each batch */ read_batch_size?: number; /** Target Redis data type (e.g., "hash", "json", "string") */ target_data_type?: 'hash' | 'json' | 'string'; /** Number of records to write in each batch */ write_batch_size?: number; /** Advanced Flink processor configuration. */ advanced?: ProcessorAdvancedConfig; } /** * Secret provider object configuration. */ export interface SecretProviderObject { /** Object name identifier */ objectName: string; /** Secret key within the secret */ secretKey: string; /** Path to the secret in the provider */ secretPath: string; } /** * Secret provider configuration. */ export interface SecretProviderConfig { /** Provider type (e.g., "vault", "aws-secrets-manager") */ type: string; /** Provider-specific parameters */ parameters: { /** Secret objects to fetch */ objects?: SecretProviderObject[]; /** Role name for authentication (Vault) */ roleName?: string; /** Vault server address */ vaultAddress?: string; /** Additional parameters */ [key: string]: unknown; }; } /** * Job configuration within a pipeline. */ export interface JobSchemaResponse { [key: string]: unknown; } export interface JobConfig { /** Job name */ name: string; /** Source database name */ source: { table: string | string[]; db?: string | string[]; schema?: string | string[]; row_format?: string; case_insensitive?: boolean; server_name?: string | string[]; }; /** Output config */ output?: Record[]; /** Optional transformation rules */ transform?: Record[]; } /** * Pipeline configuration structure. * Based on official RDI SDK: `sdk/docs/Models/Config.md` */ export interface PipelineConfig { /** Target database configurations (key: target name) */ targets?: Record; /** Source database configurations (key: source name) */ sources?: Record; /** Job configurations */ jobs: JobConfig[]; /** Processor settings */ processors?: ProcessorConfig; /** Secret provider configurations (key: provider name) */ 'secret-providers'?: Record; /** Pipeline metadata */ metadata?: Record; } /** * Response from v2 pipeline operations. * Based on official RDI SDK: `sdk/docs/Models/PipelineResponse.md` */ export interface PipelineResponse { /** Pipeline name */ name: string; /** Whether pipeline is active */ active: boolean; /** Pipeline configuration */ config: PipelineConfig; /** Current pipeline status (v1 or v2 status values) */ status?: PipelineStatusValue; /** Pipeline errors */ errors?: PipelineError[]; /** Pipeline components */ components?: PipelineComponentStatus[]; /** Whether this is the current pipeline version */ current?: boolean; } /** * Response from SDK pipeline operations. * Used by pipeline control operations (start, stop, reset) and patch operations. */ export interface PipelineOperationResponse { /** Action ID for async tracking (from ActionIdResponse.action_id) */ actionId?: string; /** Pipeline name (from PipelineResponse.name or SDK method parameter) */ pipelineName?: string; /** Whether pipeline is active (from PipelineResponse) */ active?: boolean; /** Pipeline configuration (from PipelineResponse) */ config?: PipelineConfig; /** Pipeline status (normalized to PipelineStatusValue) */ status?: PipelineStatusValue; /** Pipeline errors (from PipelineResponse) */ errors?: PipelineError[]; /** Pipeline components (from PipelineResponse) */ components?: PipelineComponentStatus[]; /** Whether this is the current pipeline version (from PipelineResponse) */ current?: boolean; } /** * @deprecated Use `PipelineOperationResponse` instead. * Kept for backwards compatibility. */ export type UnifiedPipelineResponse = PipelineOperationResponse; /** * Request body for v1 pipeline patch operations. * Uses JSON Merge Patch semantics. */ export type PatchRequestV1 = Partial; export interface ConnectionConfigPatch extends Partial { cdcDatabase?: string | null; cdcSchema?: string | null; } export interface AdvancedConfigPatch { source?: Record | null; riotx?: Record | null; flink?: Record | null; sink?: Record | null; } export interface SourceConfigPatch extends Partial> { /** Connection fields can be changed independently through JSON Merge Patch. */ connection?: ConnectionConfigPatch; /** Null removes a legacy or unused advanced subgroup. */ advanced?: AdvancedConfigPatch; } /** * Config in merge-patch form. Keyed sections accept `null` for a single entry, * which deletes it (RFC 7386) — that is how one source is removed without * rewriting the whole config. */ export interface PatchConfig extends Partial> { /** * Source database configurations; individual source objects are partial because PATCH * uses JSON Merge Patch semantics. `null` deletes that source. */ sources?: Record; /** Secret provider configurations; `null` deletes that provider */ 'secret-providers'?: Record; } /** * Unified request body for pipeline patch operations. * Used with `PATCH /api/v1/pipelines` (V1 extracts `config`) and * `PATCH /api/v2/pipelines/{name}` (V2 passes the body as-is). * Uses JSON Merge Patch semantics. */ export interface PatchRequest { /** Whether pipeline is active */ active?: boolean; /** Pipeline configuration (partial update) */ config?: PatchConfig; } /** * Request body for creating a new pipeline (v2). * Based on official RDI SDK: `sdk/typescript/src/models/PipelineCreateRequest.ts` */ export interface CreatePipelineRequest { /** Pipeline name (required for v2) */ name?: string; /** Whether pipeline should be active after creation */ active?: boolean; /** Pipeline configuration */ config?: PipelineConfig; } /** * Request body for creating a pipeline (v1). * v1 uses a flat config structure. */ export type CreatePipelineRequestV1 = PipelineConfig; /** * Request body for updating a pipeline completely (v2). * Based on official RDI SDK: `sdk/typescript/src/models/PipelineUpdateRequest.ts` * * Used with PUT /api/v2/pipelines/{name} - full replacement, or creates if doesn't exist. */ export interface UpdatePipelineRequest { /** Whether pipeline should be active */ active?: boolean; /** Pipeline configuration (full replacement) */ config?: PipelineConfig; } /** * Request body for updating a pipeline (v1). * v1 uses POST /api/v1/pipelines which acts as upsert (same as create). */ export type UpdatePipelineRequestV1 = PipelineConfig; /** * Request body for storing multiple secret values across secret groups (v1). * Matches the generated Speakeasy SDK contract for PUT /api/v1/secrets. */ export type SecretsRequest = Record>; /** * Request body for storing multiple key-value pairs under a single secret group (v1). * Matches the generated Speakeasy SDK contract for PUT /api/v1/secrets/{secret_name}. */ export interface SetMultiKeySecretRequest { /** Secret group name */ secretName: string; /** Key-value pairs to store in that group */ body: Record; } /** * Normalized response from target connection validation. */ export interface TargetTestResponse { /** Whether the target connection is valid */ connected: boolean; /** Validation or connection error message */ error: string; /** Field-specific validation errors, when available */ invalidProperties?: Record; } /** * Normalized response from source connection validation. */ export interface SourceTestResponse { /** Whether the source connection is valid */ connected: boolean; /** Validation or connection error message */ error: string; /** Field-specific validation errors, when available */ invalidProperties?: Record; } /** * Raw response body from GET /api/v1/pipelines/config/schemas. * * The OpenAPI spec types the response as an opaque object (additionalProperties: true), * so we expose it as `Record` and let the JSON-schema parser in * `components/PipelineForm/schemas/configSchema` interpret the structure. */ export type ConfigSchemaResponse = Record;