// This file is auto-generated by @hey-api/openapi-ts

export type ClientOptions = {
  baseUrl: `${string}://${string}` | (string & {})
}

/**
 * Configuration for inserting data with ad-hoc queries
 *
 * An ad-hoc input adapters cannot be usefully configured as part of pipeline
 * configuration.  Instead, use ad-hoc queries through the UI, the REST API, or
 * the `fda` command-line tool.
 */
export type AdHocInputConfig = {
  /**
   * Autogenerated name.
   */
  name: string
}

/**
 * URL-encoded `format` argument to the `/query` endpoint.
 */
export type AdHocResultFormat = 'text' | 'json' | 'parquet' | 'arrow_ipc' | 'hash'

/**
 * Arguments to the `/query` endpoint.
 *
 * The arguments can be provided in two ways:
 *
 * - In case a normal HTTP connection is established to the endpoint,
 * these arguments are passed as URL-encoded parameters.
 * Note: this mode is deprecated and will be removed in the future.
 *
 * - If a Websocket connection is opened to `/query`, the arguments are passed
 * to the server over the websocket as a JSON encoded string.
 */
export type AdhocQueryArgs = {
  format?: AdHocResultFormat
  /**
   * The SQL query to run.
   */
  sql?: string
}

/**
 * API key descriptor.
 */
export type ApiKeyDescr = {
  id: ApiKeyId
  name: string
  scopes: Array<ApiPermission>
}

/**
 * API key identifier.
 */
export type ApiKeyId = string

/**
 * Permission types for invoking API endpoints.
 */
export type ApiPermission = 'Read' | 'Write'

export type Auth = {
  credentials?: Credentials | null
  jwt?: string | null
  nkey?: string | null
  token?: string | null
  user_and_password?: UserAndPassword | null
}

export type AuthProvider =
  | {
      AwsCognito: ProviderAwsCognito
    }
  | {
      GenericOidc: ProviderGenericOidc
    }

export type BootstrapPolicy = 'allow' | 'reject' | 'await_approval'

/**
 * Controls how caches are shared across a foreground/background worker pair.
 */
export type BufferCacheAllocationStrategy = 'shared_per_worker_pair' | 'per_thread' | 'global'

/**
 * Selects which eviction strategy backs a cache instance.
 */
export type BufferCacheStrategy = 's3_fifo' | 'lru'

/**
 * Information about the build of the platform.
 */
export type BuildInformation = {
  /**
   * CPU of build machine.
   */
  build_cpu: string
  /**
   * OS of build machine.
   */
  build_os: string
  /**
   * Timestamp of the build.
   */
  build_timestamp: string
  /**
   * Whether the build is optimized for performance.
   */
  cargo_debug: string
  /**
   * Dependencies used during the build.
   */
  cargo_dependencies: string
  /**
   * Features enabled during the build.
   */
  cargo_features: string
  /**
   * Optimization level of the build.
   */
  cargo_opt_level: string
  /**
   * Target triple of the build.
   */
  cargo_target_triple: string
  /**
   * Rust version of the build used.
   */
  rustc_version: string
}

export type CalciteId =
  | {
      partial: number
    }
  | {
      final: number
    }
  | {
      and: Array<CalciteId>
    }
  | {
      seq: Array<CalciteId>
    }
  | {
      [key: string]: unknown
    }
  | null

/**
 * The Calcite plan representation of a dataflow graph.
 */
export type CalcitePlan = {
  rels: Array<Rel>
}

/**
 * Information about a failed checkpoint.
 */
export type CheckpointFailure = {
  /**
   * Error message associated with the failure.
   */
  error: string
  /**
   * Sequence number of the failed checkpoint.
   */
  sequence_number: number
}

/**
 * Holds meta-data about a checkpoint that was taken for persistent storage
 * and recovery of a circuit's state.
 */
export type CheckpointMetadata = {
  /**
   * Fingerprint of the circuit at the time of the checkpoint.
   */
  fingerprint: number
  /**
   * An optional name for the checkpoint.
   */
  identifier?: string | null
  /**
   * Total number of records processed.
   */
  processed_records?: number | null
  /**
   * Total size of the checkpoint files in bytes.
   */
  size?: number | null
  /**
   * Total number of steps made.
   */
  steps?: number | null
  /**
   * A unique identifier for the given checkpoint.
   *
   * This is used to identify the checkpoint in the file-system hierarchy.
   */
  uuid: string
}

/**
 * Response to a checkpoint request.
 */
export type CheckpointResponse = {
  checkpoint_sequence_number: number
}

/**
 * Checkpoint status returned by the `/checkpoint_status` endpoint.
 */
export type CheckpointStatus = {
  failure?: CheckpointFailure | null
  /**
   * Most recently successful checkpoint.
   */
  success?: number | null
}

/**
 * Information about a failed checkpoint sync.
 */
export type CheckpointSyncFailure = {
  /**
   * Error message associated with the failure.
   */
  error: string
  /**
   * UUID of the failed checkpoint.
   */
  uuid: string
}

/**
 * Checkpoint status returned by the `/checkpoint/sync_status` endpoint.
 */
export type CheckpointSyncStatus = {
  failure?: CheckpointSyncFailure | null
  /**
   * Most recently successful automated periodic checkpoint sync.
   */
  periodic?: string | null
  /**
   * Most recently successful checkpoint sync.
   */
  success?: string | null
}

/**
 * A set of updates to a SQL table or view.
 *
 * The `sequence_number` field stores the offset of the chunk relative to the
 * start of the stream and can be used to implement reliable delivery.
 * The payload is stored in the `bin_data`, `text_data`, or `json_data` field
 * depending on the data format used.
 */
export type Chunk = {
  /**
   * Base64 encoded binary payload, e.g., bincode.
   */
  bin_data?: Blob | File | null
  /**
   * JSON payload.
   */
  json_data?: {
    [key: string]: unknown
  } | null
  sequence_number: number
  /**
   * Text payload, e.g., CSV.
   */
  text_data?: string | null
}

export type ClockConfig = {
  clock_resolution_usecs: number
}

/**
 * Brief cluster monitoring event with only the identifier, timestamp and health conclusions.
 */
export type ClusterMonitorEvent = {
  api_status: MonitorStatus
  compiler_status: MonitorStatus
  id: ClusterMonitorEventId
  /**
   * Timestamp at which the event was recorded in the database. Because collecting the data for
   * the health checks can take time, this timestamp is approximate.
   */
  recorded_at: string
  runner_status: MonitorStatus
}

export type ClusterMonitorEventFieldSelector = 'all' | 'status'

/**
 * Cluster monitor event identifier.
 */
export type ClusterMonitorEventId = string

/**
 * Cluster monitor event information which has a selected subset of optional fields.
 * If an optional field is not selected (i.e., is `None`), it will not be serialized.
 */
export type ClusterMonitorEventSelectedInfo = {
  all_healthy: boolean
  api_resources_info?: string | null
  api_self_info?: string | null
  api_status: MonitorStatus
  compiler_resources_info?: string | null
  compiler_self_info?: string | null
  compiler_status: MonitorStatus
  id: ClusterMonitorEventId
  recorded_at: string
  runner_resources_info?: string | null
  runner_self_info?: string | null
  runner_status: MonitorStatus
}

/**
 * A SQL column type description.
 *
 * Matches the Calcite JSON format.
 */
export type ColumnType = {
  component?: ColumnType | null
  /**
   * The fields of the type (if available).
   *
   * For example this would specify the fields of a `CREATE TYPE` construct.
   *
   * ```sql
   * CREATE TYPE person_typ AS (
   * firstname       VARCHAR(30),
   * lastname        VARCHAR(30),
   * address         ADDRESS_TYP
   * );
   * ```
   *
   * Would lead to the following `fields` value:
   *
   * ```sql
   * [
   * ColumnType { name: "firstname, ... },
   * ColumnType { name: "lastname", ... },
   * ColumnType { name: "address", fields: [ ... ] }
   * ]
   * ```
   */
  fields?: Array<Field> | null
  key?: ColumnType | null
  /**
   * Does the type accept NULL values?
   */
  nullable: boolean
  /**
   * Precision of the type.
   *
   * # Examples
   * - `VARCHAR` sets precision to `-1`.
   * - `VARCHAR(255)` sets precision to `255`.
   * - `BIGINT`, `DATE`, `FLOAT`, `DOUBLE`, `GEOMETRY`, etc. sets precision
   * to None
   * - `TIME`, `TIMESTAMP` set precision to `0`.
   */
  precision?: number | null
  /**
   * The scale of the type.
   *
   * # Example
   * - `DECIMAL(1,2)` sets scale to `2`.
   */
  scale?: number | null
  type?: SqlType
  value?: ColumnType | null
}

export type CombinedDesiredStatus =
  | 'Stopped'
  | 'Unavailable'
  | 'Standby'
  | 'Paused'
  | 'Running'
  | 'Suspended'

export type CombinedStatus =
  | 'Stopped'
  | 'Provisioning'
  | 'Unavailable'
  | 'Coordination'
  | 'Standby'
  | 'AwaitingApproval'
  | 'Initializing'
  | 'Bootstrapping'
  | 'Replaying'
  | 'Paused'
  | 'Running'
  | 'Suspended'
  | 'Stopping'

/**
 * Summary of transaction commit progress.
 */
export type CommitProgressSummary = {
  /**
   * Number of operators that have been fully flushed.
   */
  completed: number
  /**
   * Number of operators that are currently being flushed.
   */
  in_progress: number
  /**
   * Number of records processed by operators that are currently being flushed.
   */
  in_progress_processed_records: number
  /**
   * Total number of records that operators that are currently being flushed need to process.
   */
  in_progress_total_records: number
  /**
   * Number of operators that haven't started flushing.
   */
  remaining: number
}

/**
 * Enumeration of possible compilation profiles that can be passed to the Rust compiler
 * as an argument via `cargo build --profile <>`. A compilation profile affects among
 * other things the compilation speed (how long till the program is ready to be run)
 * and runtime speed (the performance while running).
 */
export type CompilationProfile = 'dev' | 'unoptimized' | 'optimized' | 'optimized_symbols'

/**
 * A watermark that has been fully processed by the pipeline.
 */
export type CompletedWatermark = {
  /**
   * Timestamp when all outputs produced from this input have been pushed to all output endpoints.
   */
  completed_at: string
  /**
   * Timestamp when the data was ingested from the wire.
   */
  ingested_at: string
  /**
   * Metadata that describes the position in the input stream (e.g., Kafka partition/offset pairs).
   */
  metadata: {
    [key: string]: unknown
  }
  /**
   * Timestamp when the data was processed by the circuit.
   */
  processed_at: string
}

/**
 * Completion token status returned by the `/completion_status` endpoint.
 */
export type CompletionStatus = 'complete' | 'inprogress'

/**
 * URL-encoded arguments to the `/completion_status` endpoint.
 */
export type CompletionStatusArgs = {
  /**
   * Completion token returned by the `/completion_token` or `/ingress`
   * endpoint.
   */
  token: string
}

/**
 * Response to a completion token status request.
 */
export type CompletionStatusResponse = {
  status: CompletionStatus
  /**
   * If all of the data associated with the token has been processed through
   * the pipeline, this is the final step that includes at least one record.
   * When the pipeline's `total_completed_steps` reaches this value, the
   * token has been completed.
   *
   * This is `None` before the data associated with the token has been
   * processed through the pipeline.
   */
  step?: number | null
}

/**
 * Response to a completion token creation request.
 */
export type CompletionTokenResponse = {
  /**
   * Completion token.
   *
   * An opaque string associated with the current position in the input stream
   * generated by an input connector.
   * Pass this string to the `/completion_status` endpoint to check whether all
   * inputs associated with the token have been fully processed by the pipeline.
   */
  token: string
}

export type Condition = {
  literal?: boolean
  op?: Op | null
  operands?: Array<Operand> | null
  [key: string]: unknown | boolean | Op | null | Array<Operand> | null | undefined
}

export type Configuration = {
  build_info: BuildInformation
  /**
   * Build source: "ci" for GitHub Actions builds, "source" for local builds
   */
  build_source: string
  /**
   * URL that navigates to the changelog of the current version
   */
  changelog_url: string
  /**
   * Feldera edition: "Open source" or "Enterprise"
   */
  edition: string
  license_validity?: LicenseValidity | null
  /**
   * Specific revision corresponding to the edition `version` (e.g., git commit hash).
   */
  revision: string
  /**
   * Specific revision corresponding to the default runtime version of the platform (e.g., git commit hash).
   */
  runtime_revision: string
  /**
   * Telemetry key.
   */
  telemetry: string
  /**
   * List of unstable features that are enabled.
   */
  unstable_features?: string | null
  update_info?: UpdateInformation | null
  /**
   * The version corresponding to the type of `edition`.
   * Format is `x.y.z`.
   */
  version: string
}

/**
 * Options for connecting to a NATS server.
 */
export type ConnectOptions = {
  auth?: Auth
  /**
   * Connection timeout
   *
   * How long to wait when establishing the initial connection to the
   * NATS server.
   */
  connection_timeout_secs?: number
  /**
   * Request timeout in seconds.
   *
   * How long to wait for responses to requests.
   */
  request_timeout_secs?: number
  /**
   * NATS server URL (e.g., "nats://localhost:4222").
   */
  server_url: string
}

/**
 * A data connector's configuration
 */
export type ConnectorConfig = OutputBufferConfig & {
  format?: FormatConfig | null
  /**
   * Name of the index that the connector is attached to.
   *
   * This property is valid for output connectors only.  It is used with data
   * transports and formats that expect output updates in the form of key/value
   * pairs, where the key typically represents a unique id associated with the
   * table or view.
   *
   * To support such output formats, an output connector can be attached to an
   * index created using the SQL CREATE INDEX statement.  An index of a table
   * or view contains the same updates as the table or view itself, indexed by
   * one or more key columns.
   *
   * See individual connector documentation for details on how they work
   * with indexes.
   */
  index?: string | null
  /**
   * Arbitrary user-defined text labels associated with the connector.
   *
   * These labels can be used in conjunction with the `start_after` property
   * to control the start order of connectors.
   */
  labels?: Array<string>
  /**
   * Maximum number of records from this connector to process in a single batch.
   *
   * When set, this caps how many records are taken from the connector’s input
   * buffer and pushed through the circuit at once.
   *
   * This is typically configured lower than `max_queued_records` to allow the
   * connector time to restart and refill its buffer while a batch is being
   * processed.
   *
   * Not all input adapters honor this limit.
   *
   * If this is not set, the batch size is derived from `max_worker_batch_size`.
   */
  max_batch_size?: number | null
  /**
   * Backpressure threshold.
   *
   * Maximal number of records queued by the endpoint before the endpoint
   * is paused by the backpressure mechanism.
   *
   * For input endpoints, this setting bounds the number of records that have
   * been received from the input transport but haven't yet been consumed by
   * the circuit since the circuit, since the circuit is still busy processing
   * previous inputs.
   *
   * For output endpoints, this setting bounds the number of records that have
   * been produced by the circuit but not yet sent via the output transport endpoint
   * nor stored in the output buffer (see `enable_output_buffer`).
   *
   * Note that this is not a hard bound: there can be a small delay between
   * the backpressure mechanism is triggered and the endpoint is paused, during
   * which more data may be queued.
   *
   * The default is 1 million.
   */
  max_queued_records?: number
  /**
   * Maximum number of records processed per batch, per worker thread.
   *
   * When `max_batch_size` is not set, this setting is used to cap
   * the number of records that can be taken from the connector’s input
   * buffer and pushed through the circuit at once.  The effective batch size is computed as:
   * `max_worker_batch_size × workers`.
   *
   * This provides an alternative to `max_batch_size` that automatically adjusts batch
   * size as the number of worker threads changes to maintain constant amount of
   * work per worker per batch.
   *
   * Defaults to 10,000 records per worker.
   */
  max_worker_batch_size?: number | null
  /**
   * Create connector in paused state.
   *
   * The default is `false`.
   */
  paused?: boolean
  preprocessor?: Array<PreprocessorConfig> | null
  /**
   * Start the connector after all connectors with specified labels.
   *
   * This property is used to control the start order of connectors.
   * The connector will not start until all connectors with the specified
   * labels have finished processing all inputs.
   */
  start_after?: Array<string> | null
  transport: TransportConfig
}

export type ConnectorError = {
  /**
   * Sequence number of the error.
   *
   * The client can use this field to detect gaps in the error list reported
   * by the pipeline. When the connector reports a large number of errors, the
   * pipeline will only preserve and report the most recent errors of each kind.
   */
  index: number
  /**
   * Error message.
   */
  message: string
  /**
   * Optional tag for the error.
   *
   * The tag is used to group errors by their type.
   */
  tag?: string | null
  /**
   * Timestamp when the error occurred, serialized as RFC3339 with microseconds.
   */
  timestamp: string
}

export type ConnectorHealth = {
  description?: string | null
  status: ConnectorHealthStatus
}

export type ConnectorHealthStatus = 'Healthy' | 'Unhealthy'

/**
 * Aggregated connector error statistics.
 *
 * This structure contains the sum of all error counts across all input and output connectors
 * for a pipeline.
 */
export type ConnectorStats = {
  /**
   * Total number of errors across all connectors.
   *
   * This is the sum of:
   * - `num_transport_errors` from all input connectors
   * - `num_parse_errors` from all input connectors
   * - `num_encode_errors` from all output connectors
   * - `num_transport_errors` from all output connectors
   */
  num_errors: number
}

/**
 * Connector transaction phase with debugging label.
 */
export type ConnectorTransactionPhase = {
  /**
   * Optional label for debugging.
   */
  label?: string | null
  phase: TransactionPhase
}

export type ConsumerConfig = {
  deliver_policy: DeliverPolicy
  description?: string | null
  filter_subjects?: Array<string>
  max_batch?: number | null
  max_bytes?: number | null
  max_expires?: string | null
  max_waiting?: number
  metadata?: {
    [key: string]: string
  }
  name?: string | null
  rate_limit?: number
  replay_policy?: ReplayPolicy
}

/**
 * Complete pipeline statistics returned by the `/stats` endpoint.
 *
 * This schema definition matches the serialized JSON structure from
 * `adapters::controller::ControllerStatus`. The actual implementation with
 * atomics and mutexes lives in the adapters crate, which uses ExternalControllerStatus to
 * register this OpenAPI schema, making it available to pipeline-manager
 * without requiring a direct dependency on the adapters crate.
 */
export type ControllerStatus = {
  global_metrics: GlobalControllerMetrics
  /**
   * Input endpoint configs and metrics.
   */
  inputs: Array<InputEndpointStatus>
  /**
   * Output endpoint configs and metrics.
   */
  outputs: Array<OutputEndpointStatus>
  suspend_error?: SuspendError | null
}

export type Credentials =
  | {
      FromString: string
    }
  | {
      FromFile: string
    }

/**
 * The JSON representation of a dataflow graph.
 */
export type Dataflow = {
  calcite_plan: {
    [key: string]: CalcitePlan
  }
  mir: {
    [key: string]: MirNode
  }
}

/**
 * Configuration for generating random data for a table.
 */
export type DatagenInputConfig = {
  /**
   * The sequence of generations to perform.
   *
   * If not set, the generator will produce a single sequence with default settings.
   * If set, the generator will produce the specified sequences in sequential order.
   *
   * Note that if one of the sequences before the last one generates an unlimited number of rows
   * the following sequences will not be executed.
   */
  plan?: Array<GenerationPlan>
  /**
   * Optional seed for the random generator.
   *
   * Setting this to a fixed value will make the generator produce the same sequence of records
   * every time the pipeline is run.
   *
   * # Notes
   * - To ensure the set of generated input records is deterministic across multiple runs,
   * apart from setting a seed, `workers` also needs to remain unchanged.
   * - The input will arrive in non-deterministic order if `workers > 1`.
   */
  seed?: number | null
  /**
   * By default, the data generator does not request [transactions].  Set
   * this to a nonzero value for the data generator to automatically
   * orchestrate transactions of approximately the specified number of rows.
   *
   * [transactions]: https://docs.feldera.com/pipelines/transactions
   */
  transaction_size?: number | null
  /**
   * Number of workers to use for generating data.
   */
  workers?: number
}

/**
 * Strategy used to generate values.
 */
export type DatagenStrategy =
  | 'increment'
  | 'uniform'
  | 'zipf'
  | 'word'
  | 'words'
  | 'sentence'
  | 'sentences'
  | 'paragraph'
  | 'paragraphs'
  | 'first_name'
  | 'last_name'
  | 'title'
  | 'suffix'
  | 'name'
  | 'name_with_title'
  | 'domain_suffix'
  | 'email'
  | 'username'
  | 'password'
  | 'field'
  | 'position'
  | 'seniority'
  | 'job_title'
  | 'ipv4'
  | 'ipv6'
  | 'ip'
  | 'mac_address'
  | 'user_agent'
  | 'rfc_status_code'
  | 'valid_status_code'
  | 'company_suffix'
  | 'company_name'
  | 'buzzword'
  | 'buzzword_middle'
  | 'buzzword_tail'
  | 'catch_phrase'
  | 'bs_verb'
  | 'bs_adj'
  | 'bs_noun'
  | 'bs'
  | 'profession'
  | 'industry'
  | 'currency_code'
  | 'currency_name'
  | 'currency_symbol'
  | 'credit_card_number'
  | 'city_prefix'
  | 'city_suffix'
  | 'city_name'
  | 'country_name'
  | 'country_code'
  | 'street_suffix'
  | 'street_name'
  | 'time_zone'
  | 'state_name'
  | 'state_abbr'
  | 'secondary_address_type'
  | 'secondary_address'
  | 'zip_code'
  | 'post_code'
  | 'building_number'
  | 'latitude'
  | 'longitude'
  | 'isbn'
  | 'isbn13'
  | 'isbn10'
  | 'phone_number'
  | 'cell_number'
  | 'file_path'
  | 'file_name'
  | 'file_extension'
  | 'dir_path'

export type DeliverPolicy =
  | 'All'
  | 'Last'
  | 'New'
  | {
      ByStartSequence: {
        start_sequence: number
      }
    }
  | {
      ByStartTime: {
        start_time: string
      }
    }
  | 'LastPerSubject'

/**
 * Delta table read mode.
 *
 * Three options are available:
 *
 * * `snapshot` - read a snapshot of the table and stop.
 *
 * * `follow` - continuously ingest changes to the table, starting from a specified version
 * or timestamp.
 *
 * * `snapshot_and_follow` - read a snapshot of the table before switching to continuous ingestion
 * mode.
 */
export type DeltaTableIngestMode = 'snapshot' | 'follow' | 'snapshot_and_follow' | 'cdc'

/**
 * Delta table input connector configuration.
 */
export type DeltaTableReaderConfig = {
  /**
   * A predicate that determines whether the record represents a deletion.
   *
   * This setting is only valid in the `cdc` mode. It specifies a predicate applied to
   * each row in the Delta table to determine whether the row represents a deletion event.
   * Its value must be a valid Boolean SQL expression that can be used in a query of the
   * form `SELECT * from <table> WHERE <cdc_delete_filter>`.
   */
  cdc_delete_filter?: string | null
  /**
   * An expression that determines the ordering of updates in the Delta table.
   *
   * This setting is only valid in the `cdc` mode. It specifies a predicate applied to
   * each row in the Delta table to determine the order in which updates in the table should
   * be applied. Its value must be a valid SQL expression that can be used in a query of the
   * form `SELECT * from <table> ORDER BY <cdc_order_by>`.
   */
  cdc_order_by?: string | null
  /**
   * Optional timestamp for the snapshot in the ISO-8601/RFC-3339 format, e.g.,
   * "2024-12-09T16:09:53+00:00".
   *
   * When this option is set, the connector finds and opens the version of the table as of the
   * specified point in time (based on the server time recorded in the transaction log, not the
   * event time encoded in the data).  In `snapshot` and `snapshot_and_follow` modes, it
   * retrieves the snapshot of this version of the table.  In `follow`, `snapshot_and_follow`, and
   * `cdc` modes, it follows transaction log records **after** this version.
   *
   * Note: at most one of `version` and `datetime` options can be specified.
   * When neither of the two options is specified, the latest committed version of the table
   * is used.
   */
  datetime?: string | null
  /**
   * Optional final table version.
   *
   * Valid only when the connector is configured in `follow`, `snapshot_and_follow`, or `cdc` mode.
   *
   * When set, the connector will stop scanning the table’s transaction log after reaching this version or any greater version.
   * This bound is inclusive: if the specified version appears in the log, it will be processed before signaling end-of-input.
   */
  end_version?: number | null
  /**
   * Optional row filter.
   *
   * When specified, only rows that satisfy the filter condition are read from the delta table.
   * The condition must be a valid SQL Boolean expression that can be used in
   * the `where` clause of the `select * from my_table where ...` query.
   */
  filter?: string | null
  /**
   * Maximum number of concurrent object store reads performed by all Delta Lake connectors.
   *
   * This setting is used to limit the number of concurrent reads of the object store in a
   * pipeline with a large number of Delta Lake connectors. When multiple connectors are simultaneously
   * reading from the object store, this can lead to transport timeouts.
   *
   * When enabled, this setting limits the number of concurrent reads across all connectors.
   * This is a global setting that affects all Delta Lake connectors, and not just the connector
   * where it is specified. It should therefore be used at most once in a pipeline.  If multiple
   * connectors specify this setting, they must all use the same value.
   *
   * The default value is 6.
   */
  max_concurrent_readers?: number | null
  mode: DeltaTableIngestMode
  /**
   * The number of parallel parsing tasks the connector uses to process data read from the
   * table. Increasing this value can enhance performance by allowing more concurrent processing.
   * Recommended range: 1–10. The default is 4.
   */
  num_parsers?: number
  /**
   * Don't read unused columns from the Delta table.
   *
   * When set to `true`, this option instructs the connector to avoid reading
   * columns from the Delta table that are not used in any view definitions.
   * To be skipped, the columns must be either nullable or have default
   * values. This can improve ingestion performance, especially for wide
   * tables.
   *
   * Note: The simplest way to exclude unused columns is to omit them from the Feldera SQL table
   * declaration. The connector never reads columns that aren't declared in the SQL schema.
   * Additionally, the SQL compiler emits warnings for declared but unused columns—use these as
   * a guide to optimize your schema.
   */
  skip_unused_columns?: boolean
  /**
   * Optional snapshot filter.
   *
   * This option is only valid when `mode` is set to `snapshot` or `snapshot_and_follow`.
   *
   * When specified, only rows that satisfy the filter condition are included in the
   * snapshot.  The condition must be a valid SQL Boolean expression that can be used in
   * the `where` clause of the `select * from snapshot where ...` query.
   *
   * Unlike the `filter` option, which applies to all records retrieved from the table, this
   * filter only applies to rows in the initial snapshot of the table.
   * For instance, it can be used to specify the range of event times to include in the snapshot,
   * e.g.: `ts BETWEEN TIMESTAMP '2005-01-01 00:00:00' AND TIMESTAMP '2010-12-31 23:59:59'`.
   *
   * This option can be used together with the `filter` option. During the initial snapshot,
   * only rows that satisfy both `filter` and `snapshot_filter` are retrieved from the Delta table.
   * When subsequently following changes in the the transaction log (`mode = snapshot_and_follow`),
   * all rows that meet the `filter` condition are ingested, regardless of `snapshot_filter`.
   */
  snapshot_filter?: string | null
  /**
   * Table column that serves as an event timestamp.
   *
   * When this option is specified, and `mode` is one of `snapshot` or `snapshot_and_follow`,
   * table rows are ingested in the timestamp order, respecting the
   * [`LATENESS`](https://docs.feldera.com/sql/streaming#lateness-expressions)
   * property of the column: each ingested row has a timestamp no more than `LATENESS`
   * time units earlier than the most recent timestamp of any previously ingested row.
   * The ingestion is performed by partitioning the table into timestamp ranges of width
   * `LATENESS`. Each range is processed sequentially, in increasing timestamp order.
   *
   * # Example
   *
   * Consider a table with timestamp column of type `TIMESTAMP` and lateness attribute
   * `INTERVAL 1 DAY`. Assuming that the oldest timestamp in the table is
   * `2024-01-01T00:00:00``, the connector will fetch all records with timestamps
   * from `2024-01-01`, then all records for `2024-01-02`, `2024-01-03`, etc., until all records
   * in the table have been ingested.
   *
   * # Requirements
   *
   * * The timestamp column must be of a supported type: integer, `DATE`, or `TIMESTAMP`.
   * * The timestamp column must be declared with non-zero `LATENESS`.
   * * For efficient ingest, the table must be optimized for timestamp-based
   * queries using partitioning, Z-ordering, or liquid clustering.
   */
  timestamp_column?: string | null
  transaction_mode?: DeltaTableTransactionMode
  /**
   * Table URI.
   *
   * Example: "s3://feldera-fraud-detection-data/demographics_train"
   */
  uri: string
  /**
   * Enable verbose logging.
   *
   * When enabled, the connector will log detailed information at INFO level.
   *
   * Supported values:
   * * 0 - no verbose logging
   * * 1 - log all Delta log entries in follow and cdc modes.
   * * >1 - reserved for future use
   */
  verbose?: number
  /**
   * Optional table version.
   *
   * When this option is set, the connector finds and opens the specified version of the table.
   * In `snapshot` and `snapshot_and_follow` modes, it retrieves the snapshot of this version of
   * the table.  In `follow`, `snapshot_and_follow`, and `cdc` modes, it follows transaction log records
   * **after** this version.
   *
   * Note: at most one of `version` and `datetime` options can be specified.
   * When neither of the two options is specified, the latest committed version of the table
   * is used.
   */
  version?: number | null
  [key: string]:
    | string
    | string
    | null
    | string
    | null
    | string
    | null
    | number
    | null
    | string
    | null
    | number
    | null
    | DeltaTableIngestMode
    | number
    | boolean
    | string
    | null
    | string
    | null
    | DeltaTableTransactionMode
    | number
    | null
    | undefined
}

/**
 * Delta table transaction mode.
 *
 * Determines how the connector breaks up its input into transactions.
 *
 * * `none` - the connector does not break up its input into transactions.
 * * `snapshot` - ingest the initial snapshot of the table in one or several transactions. If the connector is
 * configured in the `snapshot_and_follow` mode, it will ingest the transaction log of the table without transactions.
 * * `always` - all updates generated by the connector are broken up into transactions, both during the initial snapshot
 * and when following the transaction log.
 *
 * # How table snapshot is ingested using transactions
 *
 * If the connector is configured in the `snapshot` or `snapshot_and_follow` mode, and its
 * `transaction_mode` is set to `snapshot` or `always`, it will ingest the snapshot of the
 * table in one or several transactions. The exact behavior depends on the value of the `timestamp_column` option.
 * If `timestamp_column` is not set, the connector will ingest the snapshot of the table in one big transaction.
 *
 * If `timestamp_column` is set, the connector will ingest the snapshot of the table in a series of batches, one for
 * each timestamp range of width equal to the `LATENESS` attribute of the `timestamp_column`. Each range will be
 * ingested in a separate transaction.
 *
 * See `timestamp_column` documentation for more details.
 *
 * # How transaction log is ingested using transactions
 *
 * If the connector is configured in the `follow`, `snapshot_and_follow`, or `cdc` mode, and its
 * `transaction_mode` is set to `always`, it will ingest the transaction log of the table in a series of transactions,
 * generating exactly one transaction for each entry in the table's transaction log.
 *
 * In other words, Feldera transaction boundaries will precisely match the transaction boundaries of the Delta Lake table.
 */
export type DeltaTableTransactionMode = 'none' | 'snapshot' | 'always'

/**
 * Delta table write mode.
 *
 * Determines how the Delta table connector handles an existing table at the target location.
 */
export type DeltaTableWriteMode = 'append' | 'truncate' | 'error_if_exists'

/**
 * Delta table output connector configuration.
 */
export type DeltaTableWriterConfig = {
  /**
   * Maximum number of retries for failed operations.
   *
   * The connector performs retries on several levels: individual S3 operations, Delta Lake transaction commits,
   * and overall operation retries. This setting controls the overall operation retries. When a write to the table
   * fails, because of an S3 timeout or any other reason that was not resolved by lower-level retries, the connector
   * will retry the entire operation.
   *
   * When not specified, the connector performs infinite retries. When set to 0, the connector doesn't
   * retry failed operations.
   */
  max_retries?: number | null
  mode?: DeltaTableWriteMode
  /**
   * Table URI.
   */
  uri: string
  [key: string]: string | number | null | DeltaTableWriteMode | undefined
}

export type Demo = {
  /**
   * Description of the demo (parsed from SQL preamble).
   */
  description: string
  /**
   * Name of the demo (parsed from SQL preamble).
   */
  name: string
  /**
   * Program SQL code.
   */
  program_code: string
  /**
   * Title of the demo (parsed from SQL preamble).
   */
  title: string
  /**
   * User defined function (UDF) Rust code.
   */
  udf_rust: string
  /**
   * User defined function (UDF) TOML dependencies.
   */
  udf_toml: string
}

/**
 * Optional settings for tweaking Feldera internals.
 */
export type DevTweaks = {
  /**
   * Enable adaptive joins.
   *
   * Adaptive joins dynamically change their partitioning policy to avoid skew.
   *
   * Adaptive joins are disabled by default.
   */
  adaptive_joins?: boolean | null
  /**
   * Factor that discourages the use of the Balance policy in a perfectly balanced collection.
   *
   * Assuming a perfectly balanced key distribution, the Balance policy is slightly less efficient than Shard,
   * since it requires computing the hash of the entire key/value pair. This factor discourages the use of this policy
   * if the skew is `<balancer_balance_tax`.
   *
   * The default value is 1.1.
   */
  balancer_balance_tax?: number | null
  /**
   * The balancer threshold for checking for an improved partitioning policy for a stream.
   *
   * Finding a good partitioning policy for a circuit involves solving an optimization problem,
   * which can be relatively expensive. Instead of doing this on every step, the balancer only
   * checks for an improved partitioning policy if the key distribution of a stream has changed
   * significantly since the current solution was computed.  Specifically, it only kicks in when
   * the size of at least one shard of at least one stream in the cluster has changed by more than
   * this threshold.
   *
   * The default value is 0.1.
   */
  balancer_key_distribution_refresh_threshold?: number | null
  /**
   * The minimum absolute improvement threshold for the balancer.
   *
   * This parameter prevents the join balancer from making changes to the
   * partitioning policy if the improvement is not significant, since the overhead
   * of such rebalancing, especially when performed frequently, can exceed the benefits.
   *
   * A rebalancing is considered significant if the absolute estimated improvement for the cluster
   * of joins where the rebalancing is applied is at least this threshold. The cost model used by
   * the balancer is based on the number of records in the largest partition of a collection.
   *
   * A rebalancing is applied if both this threshold and `balancer_min_relative_improvement_threshold` are met.
   *
   * The default value is 10,000.
   */
  balancer_min_absolute_improvement_threshold?: number | null
  /**
   * The minimum relative improvement threshold for the join balancer.
   *
   * This parameter prevents the join balancer from making changes to the
   * partitioning policy if the improvement is not significant, since the overhead
   * of such rebalancing, especially when performed frequently, can exceed the benefits.
   *
   * A rebalancing is considered significant if the relative estimated improvement for the cluster
   * of joins where the rebalancing is applied is at least this threshold.
   *
   * A rebalancing is applied if both this threshold and `balancer_min_absolute_improvement_threshold` are met.
   *
   * The default value is 1.2.
   */
  balancer_min_relative_improvement_threshold?: number | null
  /**
   * False-positive rate for Bloom filters on batches on storage, as a
   * fraction f, where 0 < f < 1.
   *
   * The false-positive rate trades off between the amount of memory used by
   * Bloom filters and how frequently storage needs to be searched for keys
   * that are not actually present.  Typical false-positive rates and their
   * corresponding memory costs are:
   *
   * - 0.1: 4.8 bits per key
   * - 0.01: 9.6 bits per key
   * - 0.001: 14.4 bits per key
   * - 0.0001: 19.2 bits per key (default)
   *
   * Values outside the valid range, such as 0.0, disable Bloom filters.
   */
  bloom_false_positive_rate?: number | null
  buffer_cache_allocation_strategy?: BufferCacheAllocationStrategy | null
  buffer_cache_strategy?: BufferCacheStrategy | null
  /**
   * Override the number of buckets/shards used by sharded buffer caches.
   *
   * This only applies when `buffer_cache_strategy = "s3_fifo"`. Values are
   * rounded up to the next power of two because the current implementation
   * shards by `hash(key) & (n - 1)`.
   */
  buffer_max_buckets?: number | null
  /**
   * Target number of cached bytes retained in each `FBuf` slab size class.
   *
   * The default value is [`FBufSlabs::DEFAULT_BYTES_PER_CLASS`].
   */
  fbuf_slab_bytes_per_class?: number | null
  /**
   * Whether to asynchronously fetch keys needed for the distinct operator
   * from storage.  Asynchronous fetching should be faster for high-latency
   * storage, such as object storage, but it could use excessive amounts of
   * memory if the number of keys fetched is very large.
   */
  fetch_distinct?: boolean | null
  /**
   * Whether to asynchronously fetch keys needed for the join operator from
   * storage.  Asynchronous fetching should be faster for high-latency
   * storage, such as object storage, but it could use excessive amounts of
   * memory if the number of keys fetched is very large.
   */
  fetch_join?: boolean | null
  /**
   * Maximum batch size in records for level 0 merges.
   */
  max_level0_batch_size_records?: number | null
  merger?: MergerType | null
  /**
   * The number of merger threads.
   *
   * The default value is equal to the number of worker threads.
   */
  merger_threads?: number | null
  /**
   * Controls the maximal number of records output by splitter operators
   * (joins, distinct, aggregation, rolling window and group operators) at
   * each step.
   *
   * The default value is 10,000 records.
   */
  splitter_chunk_size_records?: number | null
  /**
   * Attempt to print a stack trace on stack overflow.
   *
   * To be used for debugging only; do not enable in production.
   */
  stack_overflow_backtrace?: boolean | null
  /**
   * If set, the maximum amount of storage, in MiB, for the POSIX backend to
   * allow to be in use before failing all writes with [StorageFull].  This
   * is useful for testing on top of storage that does not implement its own
   * quota mechanism.
   *
   * [StorageFull]: std::io::ErrorKind::StorageFull
   */
  storage_mb_max?: number | null
}

export type DisplaySchedule =
  | 'Once'
  | 'Session'
  | {
      /**
       * Display it again after a certain period of time after it is dismissed
       */
      Every: {
        seconds: number
      }
    }
  | 'Always'

/**
 * Information returned by REST API endpoints on error.
 */
export type ErrorResponse = {
  /**
   * Detailed error metadata.
   * The contents of this field is determined by `error_code`.
   */
  details: unknown
  /**
   * Error code is a string that specifies this error type.
   */
  error_code: string
  /**
   * Human-readable error message.
   */
  message: string
}

/**
 * Extended cluster monitoring event with full details.
 */
export type ExtendedClusterMonitorEvent = {
  /**
   * Human-readable API server(s) status report of the resources backing the API server(s)
   * -- in particular, the Kubernetes objects.
   */
  api_resources_info: string
  /**
   * Human-readable API server(s) status report.
   */
  api_self_info: string
  api_status: MonitorStatus
  /**
   * Human-readable API server(s) status report of the resources backing the compiler server(s)
   * -- in particular, the Kubernetes objects.
   */
  compiler_resources_info: string
  /**
   * Human-readable compiler server(s) status report.
   */
  compiler_self_info: string
  compiler_status: MonitorStatus
  id: ClusterMonitorEventId
  /**
   * Timestamp at which the event was recorded in the database. Because collecting the data for
   * the health checks can take time, this timestamp is approximate.
   */
  recorded_at: string
  /**
   * Human-readable API server(s) status report of the resources backing the runner
   * -- in particular, the Kubernetes objects.
   */
  runner_resources_info: string
  /**
   * Human-readable runner status report.
   */
  runner_self_info: string
  runner_status: MonitorStatus
}

/**
 * A SQL field.
 *
 * Matches the SQL compiler JSON format.
 */
export type Field = SqlIdentifier & {
  columntype: ColumnType
  default?: string | null
  lateness?: string | null
  unused: boolean
  watermark?: string | null
}

/**
 * Configuration for local file system access.
 */
export type FileBackendConfig = {
  /**
   * Whether to use background threads for file I/O.
   *
   * Background threads should improve performance, but they can reduce
   * performance if too few cores are available. This is provided for
   * debugging and fine-tuning and should ordinarily be left unset.
   */
  async_threads?: boolean | null
  /**
   * Per-I/O operation sleep duration, in milliseconds.
   *
   * This is for simulating slow storage devices.  Do not use this in
   * production.
   */
  ioop_delay?: number | null
  sync?: SyncConfig | null
}

/**
 * Configuration for reading data from a file with `FileInputTransport`
 */
export type FileInputConfig = {
  /**
   * Read buffer size.
   *
   * Default: when this parameter is not specified, a platform-specific
   * default is used.
   */
  buffer_size_bytes?: number | null
  /**
   * Enable file following.
   *
   * When `false`, the endpoint outputs an `InputConsumer::eoi`
   * message and stops upon reaching the end of file.  When `true`, the
   * endpoint will keep watching the file and outputting any new content
   * appended to it.
   */
  follow?: boolean
  /**
   * File path.
   *
   * This may be a file name or a `file://` URL with an absolute path.
   */
  path: string
}

/**
 * Configuration for writing data to a file with `FileOutputTransport`.
 */
export type FileOutputConfig = {
  /**
   * File path.
   */
  path: string
}

/**
 * Data format specification used to parse raw data received from the
 * endpoint or to encode data sent to the endpoint.
 */
export type FormatConfig = {
  /**
   * Format-specific parser or encoder configuration.
   */
  config?: {
    [key: string]: unknown
  }
  /**
   * Format name, e.g., "csv", "json", "bincode", etc.
   */
  name: string
}

/**
 * Fault-tolerance configuration.
 *
 * The default [FtConfig] (via [FtConfig::default]) disables fault tolerance,
 * which is the configuration that one gets if [RuntimeConfig] omits fault
 * tolerance configuration.
 *
 * The default value for [FtConfig::model] enables fault tolerance, as
 * `Some(FtModel::default())`.  This is the configuration that one gets if
 * [RuntimeConfig] includes a fault tolerance configuration but does not
 * specify a particular model.
 */
export type FtConfig = {
  /**
   * Interval between automatic checkpoints, in seconds.
   *
   * The default is 60 seconds.  Values less than 1 or greater than 3600 will
   * be forced into that range.
   */
  checkpoint_interval_secs?: number | null
  model?: FtModel | 'none'
}

/**
 * Fault tolerance model.
 *
 * The ordering is significant: we consider [Self::ExactlyOnce] to be a "higher
 * level" of fault tolerance than [Self::AtLeastOnce].
 */
export type FtModel = 'at_least_once' | 'exactly_once'

/**
 * A random generation plan for a table that generates either a limited amount of rows or runs continuously.
 */
export type GenerationPlan = {
  /**
   * Specifies the values that the generator should produce.
   */
  fields?: {
    [key: string]: RngFieldSettings
  }
  /**
   * Total number of new rows to generate.
   *
   * If not set, the generator will produce new/unique records as long as the pipeline is running.
   * If set to 0, the table will always remain empty.
   * If set, the generator will produce new records until the specified limit is reached.
   *
   * Note that if the table has one or more primary keys that don't use the `increment` strategy to
   * generate the key there is a potential that an update is generated instead of an insert. In
   * this case it's possible the total number of records is less than the specified limit.
   */
  limit?: number | null
  /**
   * Non-zero number of rows to generate per second.
   *
   * If not set, the generator will produce rows as fast as possible.
   */
  rate?: number | null
  /**
   * When multiple workers are used, each worker will pick a consecutive "chunk" of
   * records to generate.
   *
   * By default, if not specified, the generator will use the formula `min(rate, 10_000)`
   * to determine it. This works well in most situations. However, if you're
   * running tests with lateness and many workers you can e.g., reduce the
   * chunk size to make sure a smaller range of records is being ingested in parallel.
   *
   * This also controls the sizes of input batches.  If, for example, `rate`
   * and `worker_chunk_size` are both 1000, with a single worker, the
   * generator will output 1000 records once a second.  But if we reduce
   * `worker_chunk_size` to 100 without changing `rate`, the generator will
   * instead output 100 records 10 times per second.
   *
   * # Example
   * Assume you generate a total of 125 records with 4 workers and a chunk size of 25.
   * In this case, worker A will generate records 0..25, worker B will generate records 25..50,
   * etc. A, B, C, and D will generate records in parallel. The first worker to finish its chunk
   * will pick up the last chunk of records (100..125) to generate.
   */
  worker_chunk_size?: number | null
}

/**
 * Query parameters to GET a cluster monitor event.
 */
export type GetClusterEventParameters = {
  selector?: ClusterMonitorEventFieldSelector
}

/**
 * Query parameters to GET a pipeline or a list of pipelines.
 */
export type GetPipelineParameters = {
  selector?: PipelineFieldSelector
}

/**
 * Global controller metrics.
 */
export type GlobalControllerMetrics = {
  /**
   * The pipeline has been resumed from a checkpoint and is currently bootstrapping new and modified views.
   */
  bootstrap_in_progress: boolean
  /**
   * Total number of bytes currently buffered by all endpoints.
   */
  buffered_input_bytes: number
  /**
   * Total number of records currently buffered by all endpoints.
   */
  buffered_input_records: number
  commit_progress?: CommitProgressSummary | null
  /**
   * CPU time used by the pipeline across all threads, in milliseconds.
   */
  cpu_msecs: number
  /**
   * Uniquely identifies the pipeline process that started at start_time.
   */
  incarnation_uuid: string
  /**
   * Time at which the pipeline process from which we resumed started, in seconds since the epoch.
   */
  initial_start_time: number
  memory_pressure: MemoryPressure
  /**
   * Memory pressure epoch.
   */
  memory_pressure_epoch: number
  /**
   * If the pipeline is stalled because one or more output connectors' output
   * buffers are full, this is the number of milliseconds that the current
   * stall has lasted.
   *
   * If this is nonzero, then the output connectors causing the stall can be
   * identified by noticing `ExternalOutputEndpointMetrics::queued_records`
   * is greater than or equal to `ConnectorConfig::max_queued_records`.
   *
   * In the ordinary case, the pipeline is not stalled, and this value is 0.
   */
  output_stall_msecs: number
  /**
   * True if the pipeline has processed all input data to completion.
   */
  pipeline_complete: boolean
  /**
   * Resident set size of the pipeline process, in bytes.
   */
  rss_bytes: number
  /**
   * Time elapsed while the pipeline is executing a step, multiplied by the number of threads, in milliseconds.
   */
  runtime_elapsed_msecs: number
  /**
   * Time at which the pipeline process started, in seconds since the epoch.
   */
  start_time: number
  state: PipelineState
  /**
   * Current storage usage in bytes.
   */
  storage_bytes: number
  /**
   * Storage usage integrated over time, in megabytes * seconds.
   */
  storage_mb_secs: number
  /**
   * Total number of input records processed to completion.
   */
  total_completed_records: number
  /**
   * Number of steps whose input records have been processed to completion.
   *
   * A record is processed to completion if it has been processed by the DBSP engine and
   * all outputs derived from it have been processed by all output connectors.
   *
   * # Interpretation
   *
   * This is a count, not a step number.  If `total_completed_steps` is 0, no
   * steps have been processed to completion.  If `total_completed_steps >
   * 0`, then the last step whose input records have been processed to
   * completion is `total_completed_steps - 1`. A record that was ingested
   * when `total_initiated_steps` was `n` is fully processed when
   * `total_completed_steps >= n`.
   */
  total_completed_steps: number
  /**
   * Number of steps that have been initiated.
   *
   * # Interpretation
   *
   * This is a count, not a step number.  If `total_initiated_steps` is 0, no
   * steps have been initiated.  If `total_initiated_steps > 0`, then step
   * `total_initiated_steps - 1` has been started and all steps previous to
   * that have been completely processed by the circuit.
   */
  total_initiated_steps: number
  /**
   * Total number of bytes received from all endpoints.
   */
  total_input_bytes: number
  /**
   * Total number of records received from all endpoints.
   */
  total_input_records: number
  /**
   * Total bytes of input records processed by the DBSP engine.
   */
  total_processed_bytes: number
  /**
   * Total number of input records processed by the DBSP engine.
   */
  total_processed_records: number
  /**
   * ID of the current transaction or 0 if no transaction is in progress.
   */
  transaction_id: number
  transaction_initiators: TransactionInitiators
  /**
   * Elapsed time in milliseconds, according to `transaction_status`:
   *
   * - [TransactionStatus::TransactionInProgress]: Time that this transaction
   * has been in progress.
   *
   * - [TransactionStatus::CommitInProgress]: Time that this transaction has
   * been committing.
   */
  transaction_msecs?: number | null
  /**
   * Number of records in this transaction, according to
   * `transaction_status`:
   *
   * - [TransactionStatus::TransactionInProgress]: Number of records added so
   * far.  More records might be added.
   *
   * - [TransactionStatus::CommitInProgress]: Final number of records.
   */
  transaction_records?: number | null
  transaction_status: TransactionStatus
  /**
   * Time since the pipeline process started, including time that the
   * pipeline was running or paused.
   *
   * This is the elapsed time since `start_time`.
   */
  uptime_msecs: number
}

/**
 * AWS Glue catalog config.
 */
export type GlueCatalogConfig = {
  /**
   * Access key id used to access the Glue catalog.
   */
  'glue.access-key-id'?: string | null
  /**
   * Configure an alternative endpoint of the Glue service for Glue catalog to access.
   *
   * Example: `"https://glue.us-east-1.amazonaws.com"`
   */
  'glue.endpoint'?: string | null
  /**
   * The 12-digit ID of the Glue catalog.
   */
  'glue.id'?: string | null
  /**
   * Profile used to access the Glue catalog.
   */
  'glue.profile-name'?: string | null
  /**
   * Region of the Glue catalog.
   */
  'glue.region'?: string | null
  /**
   * Secret access key used to access the Glue catalog.
   */
  'glue.secret-access-key'?: string | null
  'glue.session-token'?: string | null
  /**
   * Location for table metadata.
   *
   * Example: `"s3://my-data-warehouse/tables/"`
   */
  'glue.warehouse'?: string | null
}

export type HealthStatus = {
  all_healthy: boolean
  api: ServiceStatus
  compiler: ServiceStatus
  runner: ServiceStatus
}

/**
 * Configuration for reading data via HTTP.
 *
 * HTTP input adapters cannot be usefully configured as part of pipeline
 * configuration.  Instead, instantiate them through the REST API as
 * `/pipelines/{pipeline_name}/ingress/{table_name}`.
 */
export type HttpInputConfig = {
  /**
   * Autogenerated name.
   */
  name: string
}

export type IcebergCatalogType = 'rest' | 'glue'

/**
 * Iceberg table read mode.
 *
 * Three options are available:
 *
 * * `snapshot` - read a snapshot of the table and stop.
 *
 * * `follow` - continuously ingest changes to the table, starting from a specified snapshot
 * or timestamp.
 *
 * * `snapshot_and_follow` - read a snapshot of the table before switching to continuous ingestion
 * mode.
 */
export type IcebergIngestMode = 'snapshot' | 'follow' | 'snapshot_and_follow'

/**
 * Iceberg input connector configuration.
 */
export type IcebergReaderConfig = GlueCatalogConfig &
  RestCatalogConfig & {
    catalog_type?: IcebergCatalogType | null
    /**
     * Optional timestamp for the snapshot in the ISO-8601/RFC-3339 format, e.g.,
     * "2024-12-09T16:09:53+00:00".
     *
     * When this option is set, the connector finds and opens the snapshot of the table as of the
     * specified point in time (based on the server time recorded in the transaction
     * log, not the event time encoded in the data).  In `snapshot` and `snapshot_and_follow`
     * modes, it retrieves this snapshot.  In `follow` and `snapshot_and_follow` modes, it
     * follows transaction log records **after** this snapshot.
     *
     * Note: at most one of `snapshot_id` and `datetime` options can be specified.
     * When neither of the two options is specified, the latest committed version of the table
     * is used.
     */
    datetime?: string | null
    /**
     * Location of the table metadata JSON file.
     *
     * This propery is used to access an Iceberg table without a catalog. It is mutually
     * exclusive with the `catalog_type` property.
     */
    metadata_location?: string | null
    mode: IcebergIngestMode
    /**
     * Optional row filter.
     *
     * This option is only valid when `mode` is set to `snapshot` or `snapshot_and_follow`.
     *
     * When specified, only rows that satisfy the filter condition are included in the
     * snapshot.  The condition must be a valid SQL Boolean expression that can be used in
     * the `where` clause of the `select * from snapshot where ...` query.
     *
     * This option can be used to specify the range of event times to include in the snapshot,
     * e.g.: `ts BETWEEN '2005-01-01 00:00:00' AND '2010-12-31 23:59:59'`.
     */
    snapshot_filter?: string | null
    /**
     * Optional snapshot id.
     *
     * When this option is set, the connector finds the specified snapshot of the table.
     * In `snapshot` and `snapshot_and_follow` modes, it loads this snapshot.
     * In `follow` and `snapshot_and_follow` modes, it follows table updates
     * **after** this snapshot.
     *
     * Note: at most one of `snapshot_id` and `datetime` options can be specified.
     * When neither of the two options is specified, the latest committed version of the table
     * is used.
     */
    snapshot_id?: number | null
    /**
     * Specifies the Iceberg table name in the "namespace.table" format.
     *
     * This option is applicable when an Iceberg catalog is configured using the `catalog_type` property.
     */
    table_name?: string | null
    /**
     * Table column that serves as an event timestamp.
     *
     * When this option is specified, and `mode` is one of `snapshot` or `snapshot_and_follow`,
     * table rows are ingested in the timestamp order, respecting the
     * [`LATENESS`](https://docs.feldera.com/sql/streaming#lateness-expressions)
     * property of the column: each ingested row has a timestamp no more than `LATENESS`
     * time units earlier than the most recent timestamp of any previously ingested row.
     * The ingestion is performed by partitioning the table into timestamp ranges of width
     * `LATENESS`. Each range is processed sequentially, in increasing timestamp order.
     *
     * # Example
     *
     * Consider a table with timestamp column of type `TIMESTAMP` and lateness attribute
     * `INTERVAL 1 DAY`. Assuming that the oldest timestamp in the table is
     * `2024-01-01T00:00:00``, the connector will fetch all records with timestamps
     * from `2024-01-01`, then all records for `2024-01-02`, `2024-01-03`, etc., until all records
     * in the table have been ingested.
     *
     * # Requirements
     *
     * * The timestamp column must be of a supported type: integer, `DATE`, or `TIMESTAMP`.
     * * The timestamp column must be declared with non-zero `LATENESS`.
     * * For efficient ingest, the table must be optimized for timestamp-based
     * queries using partitioning, Z-ordering, or liquid clustering.
     */
    timestamp_column?: string | null
    [key: string]:
      | string
      | IcebergCatalogType
      | null
      | string
      | null
      | string
      | null
      | IcebergIngestMode
      | string
      | null
      | number
      | null
      | string
      | null
      | string
      | null
      | undefined
  }

/**
 * Describes an input connector configuration
 */
export type InputEndpointConfig = ConnectorConfig & {
  /**
   * The name of the input stream of the circuit that this endpoint is
   * connected to.
   */
  stream: string
}

/**
 * Performance metrics for an input endpoint.
 */
export type InputEndpointMetrics = {
  /**
   * Number of bytes currently buffered by the endpoint (not yet consumed by the circuit).
   */
  buffered_bytes: number
  /**
   * Number of records currently buffered by the endpoint (not yet consumed by the circuit).
   */
  buffered_records: number
  /**
   * True if end-of-input has been signaled.
   */
  end_of_input: boolean
  /**
   * Number of parse errors.
   */
  num_parse_errors: number
  /**
   * Number of transport errors.
   */
  num_transport_errors: number
  /**
   * Total bytes pushed to the endpoint since it was created.
   */
  total_bytes: number
  /**
   * Total records pushed to the endpoint since it was created.
   */
  total_records: number
}

/**
 * Input endpoint status information.
 */
export type InputEndpointStatus = {
  /**
   * Endpoint is currently a barrier to checkpointing and suspend.
   */
  barrier: boolean
  completed_frontier?: CompletedWatermark | null
  config: ShortEndpointConfig
  /**
   * Endpoint name.
   */
  endpoint_name: string
  /**
   * The first fatal error that occurred at the endpoint.
   */
  fatal_error?: string | null
  health?: ConnectorHealth | null
  metrics: InputEndpointMetrics
  /**
   * Recent parse errors on this endpoint.
   */
  parse_errors?: Array<ConnectorError> | null
  /**
   * Endpoint has been paused by the user.
   */
  paused: boolean
  /**
   * Recent transport errors on this endpoint.
   */
  transport_errors?: Array<ConnectorError> | null
}

/**
 * The specified units for SQL Interval types.
 *
 * `INTERVAL 1 DAY`, `INTERVAL 1 DAY TO HOUR`, `INTERVAL 1 DAY TO MINUTE`,
 * would yield `Day`, `DayToHour`, `DayToMinute`, as the `IntervalUnit` respectively.
 */
export type IntervalUnit =
  | 'Day'
  | 'DayToHour'
  | 'DayToMinute'
  | 'DayToSecond'
  | 'Hour'
  | 'HourToMinute'
  | 'HourToSecond'
  | 'Minute'
  | 'MinuteToSecond'
  | 'Month'
  | 'Second'
  | 'Year'
  | 'YearToMonth'

/**
 * Whether JSON values can span multiple lines.
 */
export type JsonLines = 'multiple' | 'single'

/**
 * Supported JSON data change event formats.
 *
 * Each element in a JSON-formatted input stream specifies
 * an update to one or more records in an input table.  We support
 * several different ways to represent such updates.
 *
 * ### `InsertDelete`
 *
 * Each element in the input stream consists of an "insert" or "delete"
 * command and a record to be inserted to or deleted from the input table.
 *
 * ```json
 * {"insert": {"column1": "hello, world!", "column2": 100}}
 * ```
 *
 * ### `Weighted`
 *
 * Each element in the input stream consists of a record and a weight
 * which indicates how many times the row appears.
 *
 * ```json
 * {"weight": 2, "data": {"column1": "hello, world!", "column2": 100}}
 * ```
 *
 * Note that the line above would be equivalent to the following input in the `InsertDelete` format:
 *
 * ```json
 * {"insert": {"column1": "hello, world!", "column2": 100}}
 * {"insert": {"column1": "hello, world!", "column2": 100}}
 * ```
 *
 * Similarly, negative weights are equivalent to deletions:
 *
 * ```json
 * {"weight": -1, "data": {"column1": "hello, world!", "column2": 100}}
 * ```
 *
 * is equivalent to in the `InsertDelete` format:
 *
 * ```json
 * {"delete": {"column1": "hello, world!", "column2": 100}}
 * ```
 *
 * ### `Debezium`
 *
 * Debezium CDC format.  Refer to [Debezium input connector documentation](https://docs.feldera.com/connectors/sources/debezium) for details.
 *
 * ### `Snowflake`
 *
 * Uses flat structure so that fields can get parsed directly into SQL
 * columns.  Defines three metadata fields:
 *
 * * `__action` - "insert" or "delete"
 * * `__stream_id` - unique 64-bit ID of the output stream (records within
 * a stream are totally ordered)
 * * `__seq_number` - monotonically increasing sequence number relative to
 * the start of the stream.
 *
 * ```json
 * {"PART":1,"VENDOR":2,"EFFECTIVE_SINCE":"2019-05-21","PRICE":"10000","__action":"insert","__stream_id":4523666124030717756,"__seq_number":1}
 * ```
 *
 * ### `Raw`
 *
 * This format is suitable for insert-only streams (no deletions).
 * Each element in the input stream contains a record without any
 * additional envelope that gets inserted in the input table.
 */
export type JsonUpdateFormat =
  | 'insert_delete'
  | 'weighted'
  | 'debezium'
  | 'snowflake'
  | 'raw'
  | 'redis'

/**
 * Kafka message header.
 */
export type KafkaHeader = {
  key: string
  value?: KafkaHeaderValue | null
}

/**
 * Kafka header value encoded as a UTF-8 string or a byte array.
 */
export type KafkaHeaderValue = Blob | File

/**
 * Configuration for reading data from Kafka topics with `InputTransport`.
 */
export type KafkaInputConfig = {
  /**
   * Maximum timeout in seconds to wait for the endpoint to join the Kafka
   * consumer group during initialization.
   */
  group_join_timeout_secs?: number
  /**
   * Whether to include Kafka headers in the record metadata.
   *
   * When `true`, Kafka message headers are available via the `CONNECTOR_METADATA()` function.
   * See <https://docs.feldera.com/connectors/sources/kafka#metadata> for details.
   */
  include_headers?: boolean | null
  /**
   * Whether to include Kafka message offset in the record metadata.
   *
   * When `true`, Kafka message offset is available via the `CONNECTOR_METADATA()` function.
   * See <https://docs.feldera.com/connectors/sources/kafka#metadata> for details.
   */
  include_offset?: boolean | null
  /**
   * Whether to include Kafka partition in the record metadata.
   *
   * When `true`, Kafka partition from which the message was read is available via the `CONNECTOR_METADATA()` function.
   * See <https://docs.feldera.com/connectors/sources/kafka#metadata> for details.
   */
  include_partition?: boolean | null
  /**
   * Whether to include Kafka message timestamp in the record metadata.
   *
   * When `true`, Kafka message timestamp is available via the `CONNECTOR_METADATA()` function.
   * See <https://docs.feldera.com/connectors/sources/kafka#metadata> for details.
   */
  include_timestamp?: boolean | null
  /**
   * Whether to include Kafka topic in the record metadata.
   *
   * When `true`, Kafka topic from which the message was read is available via the `CONNECTOR_METADATA()` function.
   * See <https://docs.feldera.com/connectors/sources/kafka#metadata> for details.
   */
  include_topic?: boolean | null
  log_level?: KafkaLogLevel | null
  /**
   * The list of Kafka partitions to read from.
   *
   * Only the specified partitions will be consumed. If this field is not set,
   * the connector will consume from all available partitions.
   *
   * If `start_from` is set to `offsets` and this field is provided, the
   * number of partitions must exactly match the number of offsets, and the
   * order of partitions must correspond to the order of offsets.
   *
   * If offsets are provided for all partitions, this field can be omitted.
   */
  partitions?: Array<number> | null
  /**
   * Set to 1 or more to fix the number of threads used to poll
   * `rdkafka`. Multiple threads can increase performance with small Kafka
   * messages; for large messages, one thread is enough. In either case, too
   * many threads can harm performance. If unset, the default is 3, which
   * helps with small messages but will not harm performance with large
   * messagee
   */
  poller_threads?: number | null
  /**
   * The AWS region to use while connecting to AWS Managed Streaming for Kafka (MSK).
   */
  region?: string | null
  /**
   * By default, if the input connector resumes from a checkpoint and the
   * data where it needs to resume has expired from the Kafka topic, the
   * input connector fails initialization and the pipeline will fail to start.
   *
   * Set this to true to change the behavior so that, if data is not
   * available on resume, the input connector starts from the earliest
   * offsets that are now available.
   */
  resume_earliest_if_data_expires: boolean
  start_from?: KafkaStartFromConfig
  /**
   * When lateness is enabled on a Feldera table, Feldera only produces
   * correct output if input arrives approximately in order within the bounds
   * of the lateness.  The Feldera Kafka input connector can reorder input
   * when there are multiple partitions:
   *
   * - If partitions start at different times, then reading all the
   * partitions in parallel will naturally consume data out of order.
   *
   * - Even if they start at the same time, partitions might contain events
   * at different rates.
   *
   * - Even if the partitions start at the same time and have the same number
   * of events per unit time, if partitions are spread across brokers,
   * different brokers may fetch data at different rates.
   *
   * - Even if all of the partitions are on a single broker, one cannot
   * expect all of the partitions to naturally remain exactly in sync
   * forever.
   *
   * Setting this option to `true` addresses the issue by synchronizing
   * ingestion across partitions, ingesting records in order of their Kafka
   * event timestamps.
   *
   * Pitfalls of this solution include:
   *
   * - Kafka event timestamps are not necessarily monotonically increasing
   * even within a single partition.  If timestamps jump backward beyond
   * the lateness, then this can also cause correctness problems.
   *
   * (This can be avoided by keeping clocks on Kafka producers and brokers
   * synchronized.)
   *
   * - If an event with a timestamp far in the future is added to a
   * partition, that event, and all those that follow it, will never be
   * processed.
   *
   * - If one or a few partitions have timestamps far behind the others, only
   * those partitions will be processed until all the old events are
   * processed.  (This is the flip side of the previous pitfall.)
   *
   * - One or more empty partitions will prevent any data from being
   * processed at all, because there is no way to know the timestamp for
   * the first event that will be added to that partition.
   *
   * - In a topic with `N` nonempty partitions, at least `N - 1` events will
   * always be left unprocessed (one in each of `N - 1` partitions), because
   * there is no way to know the timestamp for the next event to be added to
   * the partition whose events have been completely processed.
   */
  synchronize_partitions?: boolean
  /**
   * Topic to subscribe to.
   */
  topic: string
  [key: string]:
    | string
    | number
    | boolean
    | null
    | boolean
    | null
    | boolean
    | null
    | boolean
    | null
    | boolean
    | null
    | KafkaLogLevel
    | null
    | Array<number>
    | null
    | number
    | null
    | string
    | null
    | boolean
    | KafkaStartFromConfig
    | undefined
}

/**
 * Kafka logging levels.
 */
export type KafkaLogLevel =
  | 'emerg'
  | 'alert'
  | 'critical'
  | 'error'
  | 'warning'
  | 'notice'
  | 'info'
  | 'debug'

/**
 * Configuration for writing data to a Kafka topic with `OutputTransport`.
 */
export type KafkaOutputConfig = {
  fault_tolerance?: KafkaOutputFtConfig | null
  /**
   * Kafka headers to be added to each message produced by this connector.
   */
  headers?: Array<KafkaHeader>
  /**
   * Maximum timeout in seconds to wait for the endpoint to connect to
   * a Kafka broker.
   *
   * Defaults to 60.
   */
  initialization_timeout_secs?: number
  /**
   * If specified, this service is used to provide defaults for the Kafka options.
   */
  kafka_service?: string | null
  log_level?: KafkaLogLevel | null
  /**
   * The AWS region to use while connecting to AWS Managed Streaming for Kafka (MSK).
   */
  region?: string | null
  /**
   * Topic to write to.
   */
  topic: string
  [key: string]:
    | string
    | KafkaOutputFtConfig
    | null
    | Array<KafkaHeader>
    | number
    | string
    | null
    | KafkaLogLevel
    | null
    | string
    | null
    | undefined
}

/**
 * Fault tolerance configuration for Kafka output connector.
 */
export type KafkaOutputFtConfig = {
  /**
   * Options passed to `rdkafka` for consumers only, as documented at
   * [`librdkafka`
   * options](https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md).
   *
   * These options override `kafka_options` for consumers, and may be empty.
   */
  consumer_options?: {
    [key: string]: string
  }
  /**
   * Options passed to `rdkafka` for producers only, as documented at
   * [`librdkafka`
   * options](https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md).
   *
   * These options override `kafka_options` for producers, and may be empty.
   */
  producer_options?: {
    [key: string]: string
  }
}

/**
 * Where to begin reading a Kafka topic.
 */
export type KafkaStartFromConfig =
  | 'earliest'
  | 'latest'
  | {
      /**
       * Start from particular offsets in the topic.
       *
       * The number of offsets must match the number of partitions in the topic.
       */
      offsets: Array<number>
    }
  | {
      /**
       * Start from a particular timestamp in the topic.
       *
       * Kafka timestamps are in milliseconds since the epoch.
       */
      timestamp: number
    }

export type LicenseInformation = {
  /**
   * Timestamp when the server responded.
   */
  current: string
  /**
   * Optional description of the advantages of extending the license / upgrading from a trial
   */
  description_html: string
  /**
   * URL that navigates the user to extend / upgrade their license
   */
  extension_url?: string | null
  /**
   * Whether the license is a trial
   */
  is_trial: boolean
  remind_schedule: DisplaySchedule
  /**
   * Timestamp from which the user should be reminded of the license expiring soon
   */
  remind_starting_at?: string | null
  /**
   * Timestamp at which point the license expires
   */
  valid_until?: string | null
}

export type LicenseValidity =
  | {
      Exists: LicenseInformation
    }
  | {
      /**
       * Either the license key is invalid according to the server, or the request that checks with
       * the server failed (e.g., if it could not reach the server).
       */
      DoesNotExistOrNotConfirmed: string
    }

/**
 * Memory pressure level.
 *
 * The current memory pressure level is computed as a function of the current process
 * resident set size (RSS) and the user-configured memory limit (`max_rss`).
 *
 * As the memory pressure level increases, the system will apply increasing backpressure to
 * push state cached in memory to storage.
 *
 * - `Low`: less than 85% of the user-configured memory limit has been allocated.
 * - `Moderate`: between 85% and 90% of the user-configured memory limit has been allocated.
 * - `High`: between 90% and 95% of the user-configured memory limit has been allocated.
 * - `Critical`: more than 95% of the user-configured memory limit has been allocated.
 */
export type MemoryPressure = 'low' | 'moderate' | 'high' | 'critical'

/**
 * Which merger to use.
 */
export type MergerType = 'push_merger' | 'list_merger'

/**
 * Circuit metrics output format.
 * - `prometheus`: [format](https://github.com/prometheus/docs/blob/4b1b80f5f660a2f8dc25a54f52a65a502f31879a/docs/instrumenting/exposition_formats.md) expected by Prometheus
 * - `json`: JSON format
 */
export type MetricsFormat = 'prometheus' | 'json'

/**
 * Query parameters to retrieve pipeline circuit metrics.
 */
export type MetricsParameters = {
  format?: MetricsFormat
}

export type MirInput = {
  node: string
  output: number
  [key: string]: unknown | string | number
}

export type MirNode = {
  calcite?: CalciteId | null
  inputs?: Array<MirInput>
  operation: string
  outputs?: Array<MirInput | null> | null
  persistent_id?: string | null
  positions?: Array<SourcePosition>
  table?: string | null
  view?: string | null
  [key: string]:
    | unknown
    | CalciteId
    | null
    | Array<MirInput>
    | string
    | Array<MirInput | null>
    | null
    | string
    | null
    | Array<SourcePosition>
    | string
    | null
    | string
    | null
    | undefined
}

export type MonitorStatus = 'InitialUnhealthy' | 'Unhealthy' | 'Healthy'

/**
 * Configuration for a multihost Feldera pipeline.
 *
 * This configuration is primarily for the coordinator.
 */
export type MultihostConfig = {
  /**
   * Number of hosts to launch.
   *
   * For the configuration to be truly multihost, this should be at least 2.
   * A value of 1 still runs the multihost coordinator but it only
   * coordinates a single host.
   */
  hosts: number
}

export type NatsInputConfig = {
  connection_config: ConnectOptions
  consumer_config: ConsumerConfig
  /**
   * Maximum time in seconds to wait for the next message before running
   * a stream/server health check. Must be at least 1.
   */
  inactivity_timeout_secs?: number
  /**
   * Delay between automatic reconnect attempts while in retry mode.
   * Must be at least 1.
   */
  retry_interval_secs?: number
  stream_name: string
}

/**
 * Request to create a new API key.
 */
export type NewApiKeyRequest = {
  /**
   * Key name.
   */
  name: string
}

/**
 * Response to a successful API key creation.
 */
export type NewApiKeyResponse = {
  /**
   * Generated secret API key. There is no way to retrieve this
   * key again through the API, so store it securely.
   */
  api_key: string
  id: ApiKeyId
  /**
   * API key name provided by the user.
   */
  name: string
}

/**
 * Configuration for generating Nexmark input data.
 *
 * This connector must be used exactly three times in a pipeline if it is used
 * at all, once for each [`NexmarkTable`].
 */
export type NexmarkInputConfig = {
  options?: NexmarkInputOptions | null
  table: NexmarkTable
}

/**
 * Configuration for generating Nexmark input data.
 */
export type NexmarkInputOptions = {
  /**
   * Number of events to generate and submit together, per thread.
   *
   * Each thread generates this many records, which are then combined with
   * the records generated by the other threads, to form combined input
   * batches of size `threads × batch_size_per_thread`.
   */
  batch_size_per_thread?: number
  /**
   * Number of events to generate.
   */
  events?: number
  /**
   * Maximum number of events to submit in a single step, per thread.
   *
   * This should really be per worker thread, not per generator thread, but
   * the connector does not know how many worker threads there are.
   *
   * This stands in for `max_batch_size` from the connector configuration
   * because it must be a constant across all three of the nexmark tables.
   */
  max_step_size_per_thread?: number
  /**
   * Number of event generator threads.
   *
   * It's reasonable to choose the same number of generator threads as worker
   * threads.
   */
  threads?: number
}

/**
 * Table in Nexmark.
 */
export type NexmarkTable = 'bid' | 'auction' | 'person'

export type ObjectStorageConfig = {
  /**
   * URL.
   *
   * The following URL schemes are supported:
   *
   * * S3:
   * - `s3://<bucket>/<path>`
   * - `s3a://<bucket>/<path>`
   * - `https://s3.<region>.amazonaws.com/<bucket>`
   * - `https://<bucket>.s3.<region>.amazonaws.com`
   * - `https://ACCOUNT_ID.r2.cloudflarestorage.com/bucket`
   * * Google Cloud Storage:
   * - `gs://<bucket>/<path>`
   * * Microsoft Azure Blob Storage:
   * - `abfs[s]://<container>/<path>` (according to [fsspec](https://github.com/fsspec/adlfs))
   * - `abfs[s]://<file_system>@<account_name>.dfs.core.windows.net/<path>`
   * - `abfs[s]://<file_system>@<account_name>.dfs.fabric.microsoft.com/<path>`
   * - `az://<container>/<path>` (according to [fsspec](https://github.com/fsspec/adlfs))
   * - `adl://<container>/<path>` (according to [fsspec](https://github.com/fsspec/adlfs))
   * - `azure://<container>/<path>` (custom)
   * - `https://<account>.dfs.core.windows.net`
   * - `https://<account>.blob.core.windows.net`
   * - `https://<account>.blob.core.windows.net/<container>`
   * - `https://<account>.dfs.fabric.microsoft.com`
   * - `https://<account>.dfs.fabric.microsoft.com/<container>`
   * - `https://<account>.blob.fabric.microsoft.com`
   * - `https://<account>.blob.fabric.microsoft.com/<container>`
   *
   * Settings derived from the URL will override other settings.
   */
  url: string
  [key: string]: string
}

export type Op = {
  kind: string
  name: string
  syntax: string
  [key: string]: unknown | string
}

export type Operand = {
  input?: number | null
  name?: string | null
  [key: string]: unknown | number | null | string | null | undefined
}

export type OutputBufferConfig = {
  /**
   * Enable output buffering.
   *
   * The output buffering mechanism allows decoupling the rate at which the pipeline
   * pushes changes to the output transport from the rate of input changes.
   *
   * By default, output updates produced by the pipeline are pushed directly to
   * the output transport. Some destinations may prefer to receive updates in fewer
   * bigger batches. For instance, when writing Parquet files, producing
   * one bigger file every few minutes is usually better than creating
   * small files every few milliseconds.
   *
   * To achieve such input/output decoupling, users can enable output buffering by
   * setting the `enable_output_buffer` flag to `true`.  When buffering is enabled, output
   * updates produced by the pipeline are consolidated in an internal buffer and are
   * pushed to the output transport when one of several conditions is satisfied:
   *
   * * data has been accumulated in the buffer for more than `max_output_buffer_time_millis`
   * milliseconds.
   * * buffer size exceeds `max_output_buffer_size_records` records.
   *
   * This flag is `false` by default.
   */
  enable_output_buffer?: boolean
  /**
   * Maximum number of updates to be kept in the output buffer.
   *
   * This parameter bounds the maximal size of the buffer.
   * Note that the size of the buffer is not always equal to the
   * total number of updates output by the pipeline. Updates to the
   * same record can overwrite or cancel previous updates.
   *
   * By default, the buffer can grow indefinitely until one of
   * the other output conditions is satisfied.
   *
   * NOTE: this configuration option requires the `enable_output_buffer` flag
   * to be set.
   */
  max_output_buffer_size_records?: number
  /**
   * Maximum time in milliseconds data is kept in the output buffer.
   *
   * By default, data is kept in the buffer indefinitely until one of
   * the other output conditions is satisfied.  When this option is
   * set the buffer will be flushed at most every
   * `max_output_buffer_time_millis` milliseconds.
   *
   * NOTE: this configuration option requires the `enable_output_buffer` flag
   * to be set.
   */
  max_output_buffer_time_millis?: number
}

/**
 * Describes an output connector configuration
 */
export type OutputEndpointConfig = ConnectorConfig & {
  /**
   * The name of the output stream of the circuit that this endpoint is
   * connected to.
   */
  stream: string
}

/**
 * Performance metrics for an output endpoint.
 */
export type OutputEndpointMetrics = {
  /**
   * Number of batches in the buffer.
   */
  buffered_batches: number
  /**
   * Number of records pushed to the output buffer.
   */
  buffered_records: number
  /**
   * Extra memory in use beyond that used for queuing records.
   */
  memory: number
  /**
   * Number of encoding errors.
   */
  num_encode_errors: number
  /**
   * Number of transport errors.
   */
  num_transport_errors: number
  /**
   * Number of queued batches.
   */
  queued_batches: number
  /**
   * Number of queued records.
   */
  queued_records: number
  /**
   * The number of input records processed by the circuit.
   *
   * This metric tracks the end-to-end progress of the pipeline: the output
   * of this endpoint is equal to the output of the circuit after
   * processing `total_processed_input_records` records.
   *
   * In a multihost pipeline, this count reflects only the input records
   * processed on the same host as the output endpoint, which is not usually
   * meaningful.
   */
  total_processed_input_records: number
  /**
   * The number of steps whose input records have been processed by the
   * endpoint.
   *
   * This is meaningful in a multihost pipeline because steps are
   * synchronized across all of the hosts.
   *
   * # Interpretation
   *
   * This is a count, not a step number.  If `total_processed_steps` is 0, no
   * steps have been processed to completion.  If `total_processed_steps >
   * 0`, then the last step whose input records have been processed to
   * completion is `total_processed_steps - 1`. A record that was ingested in
   * step `n` is fully processed when `total_processed_steps > n`.
   */
  total_processed_steps: number
  /**
   * Bytes sent on the underlying transport.
   */
  transmitted_bytes: number
  /**
   * Records sent on the underlying transport.
   */
  transmitted_records: number
}

/**
 * Output endpoint status information.
 */
export type OutputEndpointStatus = {
  config: ShortEndpointConfig
  /**
   * Recent encoding errors on this endpoint.
   */
  encode_errors?: Array<ConnectorError> | null
  /**
   * Endpoint name.
   */
  endpoint_name: string
  /**
   * The first fatal error that occurred at the endpoint.
   */
  fatal_error?: string | null
  health?: ConnectorHealth | null
  metrics: OutputEndpointMetrics
  /**
   * Recent transport errors on this endpoint.
   */
  transport_errors?: Array<ConnectorError> | null
}

/**
 * Program information is the result of the SQL compilation.
 */
export type PartialProgramInfo = {
  /**
   * Input connectors derived from the schema.
   */
  input_connectors: {
    [key: string]: InputEndpointConfig
  }
  /**
   * Output connectors derived from the schema.
   */
  output_connectors: {
    [key: string]: OutputEndpointConfig
  }
  schema: ProgramSchema
  /**
   * Generated user defined function (UDF) stubs Rust code: stubs.rs
   */
  udf_stubs: string
}

/**
 * Partially update the pipeline (PATCH).
 *
 * Note that the patching only applies to the main fields, not subfields.
 * For instance, it is not possible to update only the number of workers;
 * it is required to again pass the whole runtime configuration with the
 * change.
 */
export type PatchPipeline = {
  description?: string | null
  name?: string | null
  program_code?: string | null
  program_config?: ProgramConfig | null
  runtime_config?: RuntimeConfig | null
  udf_rust?: string | null
  udf_toml?: string | null
}

/**
 * Reasons why a pipeline does not support suspend and resume operations.
 */
export type PermanentSuspendError =
  | 'StorageRequired'
  | 'EnterpriseFeature'
  | {
      UnsupportedInputEndpoint: string
    }

/**
 * Pipeline deployment configuration.
 * It represents configuration entries directly provided by the user
 * (e.g., runtime configuration) and entries derived from the schema
 * of the compiled program (e.g., connectors). Storage configuration,
 * if applicable, is set by the runner.
 */
export type PipelineConfig = {
  /**
   * Deprecated: setting this true or false does not have an effect anymore.
   */
  checkpoint_during_suspend?: boolean
  /**
   * Real-time clock resolution in microseconds.
   *
   * This parameter controls the execution of queries that use the `NOW()` function.  The output of such
   * queries depends on the real-time clock and can change over time without any external
   * inputs.  If the query uses `NOW()`, the pipeline will update the clock value and trigger incremental
   * recomputation at most each `clock_resolution_usecs` microseconds.  If the query does not use
   * `NOW()`, then clock value updates are suppressed and the pipeline ignores this setting.
   *
   * It is set to 1 second (1,000,000 microseconds) by default.
   */
  clock_resolution_usecs?: number | null
  /**
   * Enable CPU profiler.
   *
   * The default value is `true`.
   */
  cpu_profiler?: boolean
  dev_tweaks?: DevTweaks
  /**
   * Environment variables for the pipeline process.
   *
   * These are key-value pairs injected into the pipeline process environment.
   * Some variable names are reserved by the platform and cannot be overridden
   * (for example `RUST_LOG`, and variables in the `FELDERA_`,
   * `KUBERNETES_`, and `TOKIO_` namespaces).
   */
  env?: {
    [key: string]: string
  }
  fault_tolerance?: FtConfig
  /**
   * Number of DBSP hosts.
   *
   * The worker threads are evenly divided among the hosts.  For single-host
   * deployments, this should be 1 (the default).
   *
   * Multihost pipelines are an enterprise-only preview feature.
   */
  hosts?: number
  /**
   * Sets the number of available runtime threads for the http server.
   *
   * In most cases, this does not need to be set explicitly and
   * the default is sufficient. Can be increased in case the
   * pipeline HTTP API operations are a bottleneck.
   *
   * If not specified, the default is set to `workers`.
   */
  http_workers?: number | null
  /**
   * Specification of additional (sidecar) containers.
   */
  init_containers?: unknown
  /**
   * Sets the number of available runtime threads for async IO tasks.
   *
   * This affects some networking and file I/O operations
   * especially adapters and ad-hoc queries.
   *
   * In most cases, this does not need to be set explicitly and
   * the default is sufficient. Can be increased in case
   * ingress, egress or ad-hoc queries are a bottleneck.
   *
   * If not specified, the default is set to `workers`.
   */
  io_workers?: number | null
  /**
   * Log filtering directives.
   *
   * If set to a valid [tracing-subscriber] filter, this controls the log
   * messages emitted by the pipeline process.  Otherwise, or if the filter
   * has invalid syntax, messages at "info" severity and higher are written
   * to the log and all others are discarded.
   *
   * [tracing-subscriber]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#directives
   */
  logging?: string | null
  /**
   * Maximal delay in microseconds to wait for `min_batch_size_records` to
   * get buffered by the controller, defaults to 0.
   */
  max_buffering_delay_usecs?: number
  /**
   * The maximum number of connectors initialized in parallel during pipeline
   * startup.
   *
   * At startup, the pipeline must initialize all of its input and output connectors.
   * Depending on the number and types of connectors, this can take a long time.
   * To accelerate the process, multiple connectors are initialized concurrently.
   * This option controls the maximum number of connectors that can be initialized
   * in parallel.
   *
   * The default is 10.
   */
  max_parallel_connector_init?: number | null
  /**
   * The maximum amount of memory, in Megabytes, that the pipeline is allowed to use
   * on each host.
   *
   * Setting this property activates memory pressure monitoring and backpressure
   * mechanisms. The pipeline will track the amount of remaining memory and
   * report the memory pressure level via the `memory_pressure` metric.
   *
   * As the memory pressure increases, the system will apply increasing backpressure
   * to push state cached in memory to storage, preventing the pipeline from running
   * out of memory at the cost of some performance degradation.
   *
   * It is strongly recommended to set this property to prevent the pipeline from
   * running out of memory. The setting should not exceed the memory limit of the pipeline
   * instance.
   *
   * When `max_rss_mb` is not specified but `resources.memory_mb_max` is set, the
   * latter is used as the effective memory cap for the pipeline.
   *
   * See [documentation on the pipeline's memory usage](https://docs.feldera.com/operations/memory)
   * for more details.
   */
  max_rss_mb?: number | null
  /**
   * Minimal input batch size.
   *
   * The controller delays pushing input records to the circuit until at
   * least `min_batch_size_records` records have been received (total
   * across all endpoints) or `max_buffering_delay_usecs` microseconds
   * have passed since at least one input records has been buffered.
   * Defaults to 0.
   */
  min_batch_size_records?: number
  /**
   * Optionally, a list of CPU numbers for CPUs to which the pipeline may pin
   * its worker threads.  Specify at least twice as many CPU numbers as
   * workers.  CPUs are generally numbered starting from 0.  The pipeline
   * might not be able to honor CPU pinning requests.
   *
   * CPU pinning can make pipelines run faster and perform more consistently,
   * as long as different pipelines running on the same machine are pinned to
   * different CPUs.
   */
  pin_cpus?: Array<number>
  pipeline_template_configmap?: PipelineTemplateConfig | null
  /**
   * Timeout in seconds for the `Provisioning` phase of the pipeline.
   * Setting this value will override the default of the runner.
   */
  provisioning_timeout_secs?: number | null
  resources?: ResourceConfig
  storage?: StorageOptions | null
  /**
   * Enable pipeline tracing.
   */
  tracing?: boolean
  /**
   * Jaeger tracing endpoint to send tracing information to.
   */
  tracing_endpoint_jaeger?: string
  /**
   * Number of DBSP worker threads.
   *
   * Each DBSP "foreground" worker thread is paired with a "background"
   * thread for LSM merging, making the total number of threads twice the
   * specified number.
   *
   * The typical sweet spot for the number of workers is between 4 and 16.
   * Each worker increases overall memory consumption for data structures
   * used during a step.
   */
  workers?: number
} & {
  /**
   * Name given by the tenant to the pipeline. It is only unique within the same tenant, and can
   * be changed by the tenant when the pipeline is stopped.
   *
   * Given a specific tenant, it can be used to find/identify a specific pipeline of theirs.
   */
  given_name?: string | null
  /**
   * Input endpoint configuration.
   */
  inputs?: {
    [key: string]: InputEndpointConfig
  }
  multihost?: MultihostConfig | null
  /**
   * Unique system-generated name of the pipeline (format: `pipeline-<uuid>`).
   * It is unique across all tenants and cannot be changed.
   *
   * The `<uuid>` is also used in the naming of various resources that back the pipeline,
   * and as such this name is useful to find/identify corresponding resources.
   */
  name?: string | null
  /**
   * Output endpoint configuration.
   */
  outputs?: {
    [key: string]: OutputEndpointConfig
  }
  program_ir?: ProgramIr | null
  /**
   * Directory containing values of secrets.
   *
   * If this is not set, a default directory is used.
   */
  secrets_dir?: string | null
  storage_config?: StorageConfig | null
}

/**
 * Summary of changes in the pipeline between checkpointed and new versions.
 */
export type PipelineDiff = {
  added_input_connectors: Array<string>
  added_output_connectors: Array<string>
  modified_input_connectors: Array<string>
  modified_output_connectors: Array<string>
  program_diff?: ProgramDiff | null
  program_diff_error?: string | null
  removed_input_connectors: Array<string>
  removed_output_connectors: Array<string>
}

export type PipelineFieldSelector = 'all' | 'status' | 'status_with_connectors'

/**
 * Pipeline identifier.
 */
export type PipelineId = string

/**
 * Pipeline information.
 * It both includes fields which are user-provided and system-generated.
 */
export type PipelineInfo = {
  created_at: string
  deployment_desired_status: CombinedDesiredStatus
  deployment_desired_status_since: string
  deployment_error?: ErrorResponse | null
  deployment_id?: string | null
  deployment_initial?: RuntimeDesiredStatus | null
  deployment_resources_desired_status: ResourcesDesiredStatus
  deployment_resources_desired_status_since: string
  deployment_resources_status: ResourcesStatus
  deployment_resources_status_details?: unknown
  deployment_resources_status_since: string
  deployment_runtime_desired_status?: RuntimeDesiredStatus | null
  deployment_runtime_desired_status_since?: string | null
  deployment_runtime_status?: RuntimeStatus | null
  deployment_runtime_status_details?: unknown
  deployment_runtime_status_since?: string | null
  deployment_status: CombinedStatus
  deployment_status_since: string
  description: string
  id: PipelineId
  name: string
  platform_version: string
  program_code: string
  program_config: ProgramConfig
  program_error: ProgramError
  program_info?: PartialProgramInfo | null
  program_status: ProgramStatus
  program_status_since: string
  program_version: Version
  refresh_version: Version
  runtime_config: RuntimeConfig
  storage_status: StorageStatus
  udf_rust: string
  udf_toml: string
  version: Version
}

/**
 * Pipeline information which has a selected subset of optional fields.
 * It both includes fields which are user-provided and system-generated.
 * If an optional field is not selected (i.e., is `None`), it will not be serialized.
 */
export type PipelineSelectedInfo = {
  connectors?: ConnectorStats | null
  created_at: string
  deployment_desired_status: CombinedDesiredStatus
  deployment_desired_status_since: string
  deployment_error?: ErrorResponse | null
  deployment_id?: string | null
  deployment_initial?: RuntimeDesiredStatus | null
  deployment_resources_desired_status: ResourcesDesiredStatus
  deployment_resources_desired_status_since: string
  deployment_resources_status: ResourcesStatus
  deployment_resources_status_details?: unknown
  deployment_resources_status_since: string
  deployment_runtime_desired_status?: RuntimeDesiredStatus | null
  deployment_runtime_desired_status_since?: string | null
  deployment_runtime_status?: RuntimeStatus | null
  deployment_runtime_status_details?: unknown
  deployment_runtime_status_since?: string | null
  deployment_status: CombinedStatus
  deployment_status_since: string
  description: string
  id: PipelineId
  name: string
  platform_version: string
  program_code?: string | null
  program_config?: ProgramConfig | null
  program_error?: ProgramError | null
  program_info?: PartialProgramInfo | null
  program_status: ProgramStatus
  program_status_since: string
  program_version: Version
  refresh_version: Version
  runtime_config?: RuntimeConfig | null
  storage_status: StorageStatus
  udf_rust?: string | null
  udf_toml?: string | null
  version: Version
}

/**
 * Pipeline state.
 */
export type PipelineState = 'Paused' | 'Running' | 'Terminated'

/**
 * Configuration for supplying a custom pipeline StatefulSet template via a Kubernetes ConfigMap.
 *
 * Operators can provide a custom StatefulSet YAML that the Kubernetes runner will use when
 * creating pipeline StatefulSets for a pipeline. The custom template must be stored as the
 * value of a key in a ConfigMap in the same namespace as the pipeline; set `name` to the
 * ConfigMap name and `key` to the entry that contains the template.
 *
 * Recommendations and requirements:
 * - **Start from the default template and modify it as needed.** The default template is present
 * in ConfigMap named as `<release-name>-pipeline-template`, with key `pipelineTemplate` in the release
 * namespace and should be used as a reference.
 * - The template must contain a valid Kubernetes `StatefulSet` manifest in YAML form. The
 * runner substitutes variables in the template before parsing; therefore the final YAML
 * must be syntactically valid.
 * - The runner performs simple string substitution for the following placeholders. Please ensure these
 * placeholders are placed at appropriate location for their semantics:
 * - `{id}`: pipeline Kubernetes name (used for object names and labels)
 * - `{namespace}`: Kubernetes namespace where the pipeline runs
 * - `{pipeline_executor_image}`: container image used to run the pipeline executor
 * - `{binary_ref}`: program binary reference passed as an argument
 * - `{program_info_ref}`: program info reference passed as an argument
 * - `{pipeline_storage_path}`: mount path for persistent pipeline storage
 * - `{storage_class_name}`: storage class name to use for PVCs (if applicable)
 * - `{deployment_id}`: UUID identifying the deployment instance
 * - `{deployment_initial}`: initial desired runtime status (e.g., `provisioning`)
 * - `{bootstrap_policy}`: bootstrap policy value when applicable
 */
export type PipelineTemplateConfig = {
  /**
   * Key in the ConfigMap containing the pipeline template.
   *
   * If not set, defaults to `pipelineTemplate`.
   */
  key?: string
  /**
   * Name of the ConfigMap containing the pipeline template.
   */
  name: string
}

/**
 * Create a new pipeline (POST), or fully update an existing pipeline (PUT).
 * Fields which are optional and not provided will be set to their empty type value
 * (for strings: an empty string `""`, for objects: an empty dictionary `{}`).
 */
export type PostPutPipeline = {
  description?: string | null
  name: string
  program_code: string
  program_config?: ProgramConfig | null
  runtime_config?: RuntimeConfig | null
  udf_rust?: string | null
  udf_toml?: string | null
}

/**
 * Query parameters to POST a pipeline stop.
 */
export type PostStopPipelineParameters = {
  /**
   * The `force` parameter determines whether to immediately deprovision the pipeline compute
   * resources (`force=true`) or first attempt to atomically checkpoint before doing so
   * (`force=false`, which is the default).
   */
  force?: boolean
}

/**
 * Postgres input connector configuration.
 */
export type PostgresReaderConfig = {
  /**
   * Path to a file containing a sequence of CA certificates in PEM format.
   */
  ssl_ca_location?: string | null
  /**
   * A sequence of CA certificates in PEM format.
   */
  ssl_ca_pem?: string | null
  /**
   * The path to the certificate chain file.
   * The file must contain a sequence of PEM-formatted certificates,
   * the first being the leaf certificate, and the remainder forming
   * the chain of certificates up to and including the trusted root certificate.
   */
  ssl_certificate_chain_location?: string | null
  /**
   * The client certificate key in PEM format.
   */
  ssl_client_key?: string | null
  /**
   * Path to the client certificate key.
   */
  ssl_client_key_location?: string | null
  /**
   * Path to the client certificate.
   */
  ssl_client_location?: string | null
  /**
   * The client certificate in PEM format.
   */
  ssl_client_pem?: string | null
  /**
   * True to enable hostname verification when using TLS. True by default.
   */
  verify_hostname?: boolean | null
} & {
  /**
   * Query that specifies what data to fetch from postgres.
   */
  query: string
  /**
   * Postgres URI.
   * See: <https://docs.rs/tokio-postgres/0.7.12/tokio_postgres/config/struct.Config.html>
   */
  uri: string
}

/**
 * TLS/SSL configuration for PostgreSQL connectors.
 */
export type PostgresTlsConfig = {
  /**
   * Path to a file containing a sequence of CA certificates in PEM format.
   */
  ssl_ca_location?: string | null
  /**
   * A sequence of CA certificates in PEM format.
   */
  ssl_ca_pem?: string | null
  /**
   * The path to the certificate chain file.
   * The file must contain a sequence of PEM-formatted certificates,
   * the first being the leaf certificate, and the remainder forming
   * the chain of certificates up to and including the trusted root certificate.
   */
  ssl_certificate_chain_location?: string | null
  /**
   * The client certificate key in PEM format.
   */
  ssl_client_key?: string | null
  /**
   * Path to the client certificate key.
   */
  ssl_client_key_location?: string | null
  /**
   * Path to the client certificate.
   */
  ssl_client_location?: string | null
  /**
   * The client certificate in PEM format.
   */
  ssl_client_pem?: string | null
  /**
   * True to enable hostname verification when using TLS. True by default.
   */
  verify_hostname?: boolean | null
}

/**
 * PostgreSQL write mode.
 *
 * Determines how the PostgreSQL output connector writes data to the target table.
 */
export type PostgresWriteMode = 'materialized' | 'cdc'

/**
 * Postgres output connector configuration.
 */
export type PostgresWriterConfig = {
  /**
   * Path to a file containing a sequence of CA certificates in PEM format.
   */
  ssl_ca_location?: string | null
  /**
   * A sequence of CA certificates in PEM format.
   */
  ssl_ca_pem?: string | null
  /**
   * The path to the certificate chain file.
   * The file must contain a sequence of PEM-formatted certificates,
   * the first being the leaf certificate, and the remainder forming
   * the chain of certificates up to and including the trusted root certificate.
   */
  ssl_certificate_chain_location?: string | null
  /**
   * The client certificate key in PEM format.
   */
  ssl_client_key?: string | null
  /**
   * Path to the client certificate key.
   */
  ssl_client_key_location?: string | null
  /**
   * Path to the client certificate.
   */
  ssl_client_location?: string | null
  /**
   * The client certificate in PEM format.
   */
  ssl_client_pem?: string | null
  /**
   * True to enable hostname verification when using TLS. True by default.
   */
  verify_hostname?: boolean | null
} & {
  /**
   * Name of the operation metadata column in CDC mode.
   *
   * Only used when `mode = "cdc"`. This column will contain:
   * - `"i"` for insert operations
   * - `"u"` for upsert operations
   * - `"d"` for delete operations
   *
   * Default: `"__feldera_op"`
   */
  cdc_op_column?: string
  /**
   * Name of the timestamp metadata column in CDC mode.
   *
   * Only used when `mode = "cdc"`. This column will contain the timestamp
   * (in RFC 3339 format) when the batch of updates was output
   * by the pipeline.
   *
   * Default: `"__feldera_ts"`
   */
  cdc_ts_column?: string
  /**
   * The maximum buffer size in for a single operation.
   * Note that the buffers of `INSERT`, `UPDATE` and `DELETE` queries are
   * separate.
   * Default: 1 MiB
   */
  max_buffer_size_bytes?: number
  /**
   * The maximum number of records in a single buffer.
   */
  max_records_in_buffer?: number | null
  mode?: PostgresWriteMode
  /**
   * Specifies how the connector handles conflicts when executing an `INSERT`
   * into a table with a primary key. By default, an existing row with the same
   * key is overwritten. Setting this flag to `true` preserves the existing row
   * and ignores the new insert.
   *
   * This setting does not affect `UPDATE` statements, which always replace the
   * value associated with the key.
   *
   * This setting is not supported when `mode = "cdc"`, since all operations
   * are performed as append-only `INSERT`s into the target table.
   * Any conflict in CDC mode will result in an error.
   *
   * Default: `false`
   */
  on_conflict_do_nothing?: boolean
  /**
   * The table to write the output to.
   */
  table: string
  /**
   * The number of threads to use during encoding.
   *
   * Default: 1
   */
  threads?: number
  /**
   * Postgres URI.
   * See: <https://docs.rs/tokio-postgres/0.7.12/tokio_postgres/config/struct.Config.html>
   */
  uri: string
}

/**
 * Configuration for describing a preprocessor
 */
export type PreprocessorConfig = {
  /**
   * Arbitrary additional configuration.
   */
  config: unknown
  /**
   * True if the preprocessor is message-oriented: true if each preprocessor
   * output record corresponds to a whole number of of parser records.
   */
  message_oriented: boolean
  /**
   * Name of the preprocessor.
   * All preprocessors with the same name will perform the same task.
   */
  name: string
}

/**
 * Program configuration.
 */
export type ProgramConfig = {
  /**
   * If `true` (default), when a prior compilation with the same checksum
   * already exists, the output of that (i.e., binary) is used.
   * Set `false` to always trigger a new compilation, which might take longer
   * and as well can result in overriding an existing binary.
   */
  cache?: boolean
  profile?: CompilationProfile | null
  /**
   * Override runtime version of the pipeline being executed.
   *
   * Warning: This setting is experimental and may change in the future.
   * Requires the platform to run with the unstable feature `runtime_version`
   * enabled. Should only be used for testing purposes, and requires
   * network access.
   *
   * A runtime version can be specified in the form of a version
   * or SHA taken from the `feldera/feldera` repository main branch.
   *
   * Examples: `v0.96.0` or `f4dcac0989ca0fda7d2eb93602a49d007cb3b0ae`
   *
   * A platform of version `0.x.y` may be capable of running future and past
   * runtimes with versions `>=0.x.y` and `<=0.x.y` until breaking API changes happen,
   * the exact bounds for each platform version are unspecified until we reach a
   * stable version. Compatibility is only guaranteed if platform and runtime version
   * are exact matches.
   *
   * Note that any enterprise features are currently considered to be part of
   * the platform.
   *
   * If not set (null), the runtime version will be the same as the platform version.
   */
  runtime_version?: string | null
}

/**
 * Summary of changes in the program between checkpointed and new versions.
 */
export type ProgramDiff = {
  added_tables: Array<string>
  added_views: Array<string>
  modified_tables: Array<string>
  modified_views: Array<string>
  removed_tables: Array<string>
  removed_views: Array<string>
}

/**
 * Log, warning and error information about the program compilation.
 */
export type ProgramError = {
  rust_compilation?: RustCompilationInfo | null
  sql_compilation?: SqlCompilationInfo | null
  /**
   * System error that occurred.
   * - Set `Some(...)` upon transition to `SystemError`
   * - Set `None` upon transition to `Pending`
   */
  system_error?: string | null
}

/**
 * Program information is the output of the SQL compiler.
 *
 * It includes information needed for Rust compilation (e.g., generated Rust code)
 * as well as only for runtime (e.g., schema, input/output connectors).
 */
export type ProgramInfo = {
  dataflow?: Dataflow | null
  /**
   * Input connectors derived from the schema.
   */
  input_connectors: {
    [key: string]: InputEndpointConfig
  }
  /**
   * Generated main program Rust code: main.rs
   */
  main_rust?: string
  /**
   * Output connectors derived from the schema.
   */
  output_connectors: {
    [key: string]: OutputEndpointConfig
  }
  schema: ProgramSchema
  /**
   * Generated user defined function (UDF) stubs Rust code: stubs.rs
   */
  udf_stubs?: string
}

/**
 * Program information included in the pipeline configuration.
 */
export type ProgramIr = {
  /**
   * The MIR of the program.
   */
  mir: {
    [key: string]: MirNode
  }
  program_schema: ProgramSchema
}

/**
 * A struct containing the tables (inputs) and views for a program.
 *
 * Parse from the JSON data-type of the DDL generated by the SQL compiler.
 */
export type ProgramSchema = {
  inputs: Array<Relation>
  outputs: Array<Relation>
}

/**
 * Program compilation status.
 */
export type ProgramStatus =
  | 'Pending'
  | 'CompilingSql'
  | 'SqlCompiled'
  | 'CompilingRust'
  | 'Success'
  | 'SqlError'
  | 'RustError'
  | 'SystemError'

export type PropertyValue = {
  key_position: SourcePosition
  value: string
  value_position: SourcePosition
}

export type ProviderAwsCognito = {
  issuer: string
  login_url: string
  logout_url: string
}

export type ProviderGenericOidc = {
  client_id: string
  extra_oidc_scopes: Array<string>
  issuer: string
}

/**
 * Google Pub/Sub input connector configuration.
 */
export type PubSubInputConfig = {
  /**
   * gRPC connection timeout.
   */
  connect_timeout_seconds?: number | null
  /**
   * The content of a Google Cloud credentials JSON file.
   *
   * When this option is specified, the connector will use the provided credentials for
   * authentication.  Otherwise, it will use Application Default Credentials (ADC) configured
   * in the environment where the Feldera service is running.  See
   * [Google Cloud documentation](https://cloud.google.com/docs/authentication/provide-credentials-adc)
   * for information on configuring application default credentials.
   *
   * When running Feldera in an environment where ADC are not configured,
   * e.g., a Docker container, use this option to ship Google Cloud credentials from another environment.
   * For example, if you use the
   * [`gcloud auth application-default login`](https://cloud.google.com/pubsub/docs/authentication#client-libs)
   * command for authentication in your local development environment, ADC are stored in the
   * `.config/gcloud/application_default_credentials.json` file in your home directory.
   */
  credentials?: string | null
  /**
   * Set in order to use a Pub/Sub [emulator](https://cloud.google.com/pubsub/docs/emulator)
   * instead of the production service, e.g., 'localhost:8681'.
   */
  emulator?: string | null
  /**
   * Override the default service endpoint 'pubsub.googleapis.com'
   */
  endpoint?: string | null
  /**
   * gRPC channel pool size.
   */
  pool_size?: number | null
  /**
   * Google Cloud project_id.
   *
   * When not specified, the connector will use the project id associated
   * with the authenticated account.
   */
  project_id?: string | null
  /**
   * Reset subscription's backlog to a given snapshot on startup,
   * using the Pub/Sub `Seek` API.
   *
   * This option is mutually exclusive with the `timestamp` option.
   */
  snapshot?: string | null
  /**
   * Subscription name.
   */
  subscription: string
  /**
   * gRPC request timeout.
   */
  timeout_seconds?: number | null
  /**
   * Reset subscription's backlog to a given timestamp on startup,
   * using the Pub/Sub `Seek` API.
   *
   * The value of this option is an ISO 8601-encoded UTC time, e.g., "2024-08-17T16:39:57-08:00".
   *
   * This option is mutually exclusive with the `snapshot` option.
   */
  timestamp?: string | null
}

/**
 * Redis output connector configuration.
 */
export type RedisOutputConfig = {
  /**
   * The URL format: `redis://[<username>][:<password>@]<hostname>[:port][/[<db>][?protocol=<protocol>]]`
   * This is parsed by the [redis](https://docs.rs/redis/latest/redis/#connection-parameters) crate.
   */
  connection_string: string
  /**
   * Separator used to join multiple components into a single key.
   * ":" by default.
   */
  key_separator?: string
}

export type Rel = {
  aggs?: Array<unknown> | null
  all?: boolean | null
  condition?: Condition | null
  exprs?: Array<Operand> | null
  fields?: Array<string> | null
  group?: Array<number> | null
  id: number
  inputs?: Array<number>
  joinType?: string | null
  relOp: string
  /**
   * This is a vector where the elements concatenated form a fully qualified table name.
   *
   * e.g., usually is of the form `[$namespace, $table] / [schema, table]`
   */
  table?: Array<string> | null
  [key: string]:
    | unknown
    | Array<unknown>
    | null
    | boolean
    | null
    | Condition
    | null
    | Array<Operand>
    | null
    | Array<string>
    | null
    | Array<number>
    | null
    | number
    | Array<number>
    | string
    | null
    | string
    | Array<string>
    | null
    | undefined
}

/**
 * A SQL table or view. It has a name and a list of fields.
 *
 * Matches the Calcite JSON format.
 */
export type Relation = SqlIdentifier & {
  fields: Array<Field>
  materialized?: boolean
  properties?: {
    [key: string]: PropertyValue
  }
}

export type ReplayPolicy = 'Instant' | 'Original'

export type ResourceConfig = {
  /**
   * The maximum number of CPU cores to reserve
   * for an instance of this pipeline
   */
  cpu_cores_max?: number | null
  /**
   * The minimum number of CPU cores to reserve
   * for an instance of this pipeline
   */
  cpu_cores_min?: number | null
  /**
   * The maximum memory in Megabytes to reserve
   * for an instance of this pipeline
   */
  memory_mb_max?: number | null
  /**
   * The minimum memory in Megabytes to reserve
   * for an instance of this pipeline
   */
  memory_mb_min?: number | null
  /**
   * Kubernetes namespace to use for an instance of this pipeline.
   * The namespace determines the scope of names for resources created
   * for the pipeline.
   * If not set, the pipeline will be deployed in the same namespace
   * as the control-plane.
   */
  namespace?: string | null
  /**
   * Kubernetes service account name to use for an instance of this pipeline.
   * The account determines permissions and access controls.
   */
  service_account_name?: string | null
  /**
   * Storage class to use for an instance of this pipeline.
   * The class determines storage performance such as IOPS and throughput.
   */
  storage_class?: string | null
  /**
   * The total storage in Megabytes to reserve
   * for an instance of this pipeline
   */
  storage_mb_max?: number | null
}

export type ResourcesDesiredStatus = 'Stopped' | 'Provisioned'

/**
 * Pipeline resources status.
 *
 * ```text
 * /start (early start failed)
 * ┌───────────────────┐
 * │                   ▼
 * Stopped ◄────────── Stopping
 * /start │                   ▲
 * │                   │ /stop?force=true
 * │                   │ OR: timeout (from Provisioning)
 * ▼                   │ OR: fatal runtime or resource error
 * ⌛Provisioning ────────────│ OR: runtime status is Suspended
 * │                   │
 * │                   │
 * ▼                   │
 * Provisioned ─────────────┘
 * ```
 *
 * ### Desired and actual status
 *
 * We use the desired state model to manage the lifecycle of a pipeline. In this model, the
 * pipeline has two status attributes associated with it: the **desired** status, which represents
 * what the user would like the pipeline to do, and the **current** status, which represents the
 * actual (last observed) status of the pipeline. The pipeline runner service continuously monitors
 * the desired status field to decide where to steer the pipeline towards.
 *
 * There are two desired statuses:
 * - `Provisioned` (set by invoking `/start`)
 * - `Stopped` (set by invoking `/stop?force=true`)
 *
 * The user can monitor the current status of the pipeline via the `GET /v0/pipelines/{name}`
 * endpoint. In a typical scenario, the user first sets the desired status, e.g., by invoking the
 * `/start` endpoint, and then polls the `GET /v0/pipelines/{name}` endpoint to monitor the actual
 * status of the pipeline until its `deployment_resources_status` attribute changes to
 * `Provisioned` indicating that the pipeline has been successfully provisioned, or `Stopped` with
 * `deployment_error` being set.
 */
export type ResourcesStatus = 'Stopped' | 'Provisioning' | 'Provisioned' | 'Stopping'

/**
 * Iceberg REST catalog config.
 */
export type RestCatalogConfig = {
  /**
   * Logical name of target resource or service.
   */
  'rest.audience'?: string | null
  /**
   * Credential to use for OAuth2 credential flow when initializing the catalog.
   *
   * A key and secret pair separated by ":" (key is optional).
   */
  'rest.credential'?: string | null
  /**
   * Additional HTTP request headers added to each catalog REST API call.
   */
  'rest.headers'?: Array<Array<string>> | null
  /**
   * Authentication URL to use for client credentials authentication (default: uri + 'v1/oauth/tokens')
   */
  'rest.oauth2-server-uri'?: string | null
  /**
   * Customize table storage paths.
   *
   * When combined with the `warehouse` property, the prefix determines
   * how table data is organized within the storage.
   */
  'rest.prefix'?: string | null
  /**
   * URI for the target resource or service.
   */
  'rest.resource'?: string | null
  'rest.scope'?: string | null
  /**
   * Bearer token value to use for `Authorization` header.
   */
  'rest.token'?: string | null
  /**
   * URI identifying the REST catalog server.
   */
  'rest.uri'?: string | null
  /**
   * The default location for managed tables created by the catalog.
   */
  'rest.warehouse'?: string | null
}

/**
 * Configuration for generating random data for a field of a table.
 */
export type RngFieldSettings = {
  /**
   * The frequency rank exponent for the Zipf distribution.
   *
   * - This value is only used if the strategy is set to `Zipf`.
   * - The default value is 1.0.
   */
  e?: number
  /**
   * Specifies the values that the generator should produce in case the field is a struct type.
   */
  fields?: {
    [key: string]: RngFieldSettings
  } | null
  key?: RngFieldSettings | null
  /**
   * Percentage of records where this field should be set to NULL.
   *
   * If not set, the generator will produce only records with non-NULL values.
   * If set to `1..=100`, the generator will produce records with NULL values with the specified percentage.
   */
  null_percentage?: number | null
  /**
   * An optional, exclusive range [a, b) to limit the range of values the generator should produce.
   *
   * - For integer/floating point types specifies min/max values as an integer.
   * If not set, the generator will produce values for the entire range of the type for number types.
   * - For string/binary types specifies min/max length as an integer, values are required to be >=0.
   * If not set, a range of [0, 25) is used by default.
   * - For timestamp types specifies the min/max as two strings in the RFC 3339 format
   * (e.g., ["2021-01-01T00:00:00Z", "2022-01-02T00:00:00Z"]).
   * Alternatively, the range values can be specified as a number of non-leap
   * milliseconds since January 1, 1970 0:00:00.000 UTC (aka “UNIX timestamp”).
   * If not set, a range of ["1970-01-01T00:00:00Z", "2100-01-01T00:00:00Z") or [0, 4102444800000)
   * is used by default.
   * - For time types specifies the min/max as two strings in the "HH:MM:SS" format.
   * Alternatively, the range values can be specified in milliseconds as two positive integers.
   * If not set, the range is 24h.
   * - For date types, the min/max range is specified as two strings in the "YYYY-MM-DD" format.
   * Alternatively, two integers that represent number of days since January 1, 1970 can be used.
   * If not set, a range of ["1970-01-01", "2100-01-01") or [0, 54787) is used by default.
   * - For array types specifies the min/max number of elements as an integer.
   * If not set, a range of [0, 5) is used by default. Range values are required to be >=0.
   * - For map types specifies the min/max number of key-value pairs as an integer.
   * If not set, a range of [0, 5) is used by default.
   * - For struct/boolean/null types `range` is ignored.
   */
  range?: {
    [key: string]: unknown
  }
  /**
   * A scale factor to apply a multiplier to the generated value.
   *
   * - For integer/floating point types, the value is multiplied by the scale factor.
   * - For timestamp types, the generated value (milliseconds) is multiplied by the scale factor.
   * - For time types, the generated value (milliseconds) is multiplied by the scale factor.
   * - For date types, the generated value (days) is multiplied by the scale factor.
   * - For string/binary/array/map/struct/boolean/null types, the scale factor is ignored.
   *
   * - If `values` is specified, the scale factor is ignored.
   * - If `range` is specified and the range is required to be positive (struct, map, array etc.)
   * the scale factor is required to be positive too.
   *
   * The default scale factor is 1.
   */
  scale?: number
  strategy?: DatagenStrategy
  value?: RngFieldSettings | null
  /**
   * An optional set of values the generator will pick from.
   *
   * If set, the generator will pick values from the specified set.
   * If not set, the generator will produce values according to the specified range.
   * If set to an empty set, the generator will produce NULL values.
   * If set to a single value, the generator will produce only that value.
   *
   * Note that `range` is ignored if `values` is set.
   */
  values?: Array<{
    [key: string]: unknown
  }> | null
}

/**
 * Global pipeline configuration settings. This is the publicly
 * exposed type for users to configure pipelines.
 */
export type RuntimeConfig = {
  /**
   * Deprecated: setting this true or false does not have an effect anymore.
   */
  checkpoint_during_suspend?: boolean
  /**
   * Real-time clock resolution in microseconds.
   *
   * This parameter controls the execution of queries that use the `NOW()` function.  The output of such
   * queries depends on the real-time clock and can change over time without any external
   * inputs.  If the query uses `NOW()`, the pipeline will update the clock value and trigger incremental
   * recomputation at most each `clock_resolution_usecs` microseconds.  If the query does not use
   * `NOW()`, then clock value updates are suppressed and the pipeline ignores this setting.
   *
   * It is set to 1 second (1,000,000 microseconds) by default.
   */
  clock_resolution_usecs?: number | null
  /**
   * Enable CPU profiler.
   *
   * The default value is `true`.
   */
  cpu_profiler?: boolean
  dev_tweaks?: DevTweaks
  /**
   * Environment variables for the pipeline process.
   *
   * These are key-value pairs injected into the pipeline process environment.
   * Some variable names are reserved by the platform and cannot be overridden
   * (for example `RUST_LOG`, and variables in the `FELDERA_`,
   * `KUBERNETES_`, and `TOKIO_` namespaces).
   */
  env?: {
    [key: string]: string
  }
  fault_tolerance?: FtConfig
  /**
   * Number of DBSP hosts.
   *
   * The worker threads are evenly divided among the hosts.  For single-host
   * deployments, this should be 1 (the default).
   *
   * Multihost pipelines are an enterprise-only preview feature.
   */
  hosts?: number
  /**
   * Sets the number of available runtime threads for the http server.
   *
   * In most cases, this does not need to be set explicitly and
   * the default is sufficient. Can be increased in case the
   * pipeline HTTP API operations are a bottleneck.
   *
   * If not specified, the default is set to `workers`.
   */
  http_workers?: number | null
  /**
   * Specification of additional (sidecar) containers.
   */
  init_containers?: unknown
  /**
   * Sets the number of available runtime threads for async IO tasks.
   *
   * This affects some networking and file I/O operations
   * especially adapters and ad-hoc queries.
   *
   * In most cases, this does not need to be set explicitly and
   * the default is sufficient. Can be increased in case
   * ingress, egress or ad-hoc queries are a bottleneck.
   *
   * If not specified, the default is set to `workers`.
   */
  io_workers?: number | null
  /**
   * Log filtering directives.
   *
   * If set to a valid [tracing-subscriber] filter, this controls the log
   * messages emitted by the pipeline process.  Otherwise, or if the filter
   * has invalid syntax, messages at "info" severity and higher are written
   * to the log and all others are discarded.
   *
   * [tracing-subscriber]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#directives
   */
  logging?: string | null
  /**
   * Maximal delay in microseconds to wait for `min_batch_size_records` to
   * get buffered by the controller, defaults to 0.
   */
  max_buffering_delay_usecs?: number
  /**
   * The maximum number of connectors initialized in parallel during pipeline
   * startup.
   *
   * At startup, the pipeline must initialize all of its input and output connectors.
   * Depending on the number and types of connectors, this can take a long time.
   * To accelerate the process, multiple connectors are initialized concurrently.
   * This option controls the maximum number of connectors that can be initialized
   * in parallel.
   *
   * The default is 10.
   */
  max_parallel_connector_init?: number | null
  /**
   * The maximum amount of memory, in Megabytes, that the pipeline is allowed to use
   * on each host.
   *
   * Setting this property activates memory pressure monitoring and backpressure
   * mechanisms. The pipeline will track the amount of remaining memory and
   * report the memory pressure level via the `memory_pressure` metric.
   *
   * As the memory pressure increases, the system will apply increasing backpressure
   * to push state cached in memory to storage, preventing the pipeline from running
   * out of memory at the cost of some performance degradation.
   *
   * It is strongly recommended to set this property to prevent the pipeline from
   * running out of memory. The setting should not exceed the memory limit of the pipeline
   * instance.
   *
   * When `max_rss_mb` is not specified but `resources.memory_mb_max` is set, the
   * latter is used as the effective memory cap for the pipeline.
   *
   * See [documentation on the pipeline's memory usage](https://docs.feldera.com/operations/memory)
   * for more details.
   */
  max_rss_mb?: number | null
  /**
   * Minimal input batch size.
   *
   * The controller delays pushing input records to the circuit until at
   * least `min_batch_size_records` records have been received (total
   * across all endpoints) or `max_buffering_delay_usecs` microseconds
   * have passed since at least one input records has been buffered.
   * Defaults to 0.
   */
  min_batch_size_records?: number
  /**
   * Optionally, a list of CPU numbers for CPUs to which the pipeline may pin
   * its worker threads.  Specify at least twice as many CPU numbers as
   * workers.  CPUs are generally numbered starting from 0.  The pipeline
   * might not be able to honor CPU pinning requests.
   *
   * CPU pinning can make pipelines run faster and perform more consistently,
   * as long as different pipelines running on the same machine are pinned to
   * different CPUs.
   */
  pin_cpus?: Array<number>
  pipeline_template_configmap?: PipelineTemplateConfig | null
  /**
   * Timeout in seconds for the `Provisioning` phase of the pipeline.
   * Setting this value will override the default of the runner.
   */
  provisioning_timeout_secs?: number | null
  resources?: ResourceConfig
  storage?: StorageOptions | null
  /**
   * Enable pipeline tracing.
   */
  tracing?: boolean
  /**
   * Jaeger tracing endpoint to send tracing information to.
   */
  tracing_endpoint_jaeger?: string
  /**
   * Number of DBSP worker threads.
   *
   * Each DBSP "foreground" worker thread is paired with a "background"
   * thread for LSM merging, making the total number of threads twice the
   * specified number.
   *
   * The typical sweet spot for the number of workers is between 4 and 16.
   * Each worker increases overall memory consumption for data structures
   * used during a step.
   */
  workers?: number
}

export type RuntimeDesiredStatus =
  | 'Unavailable'
  | 'Coordination'
  | 'Standby'
  | 'Paused'
  | 'Running'
  | 'Suspended'

/**
 * Runtime status of the pipeline.
 *
 * Of the statuses, only `Unavailable` is determined by the runner. All other statuses are
 * determined by the pipeline and taken over by the runner.
 */
export type RuntimeStatus =
  | 'Unavailable'
  | 'Coordination'
  | 'Standby'
  | 'Initializing'
  | 'AwaitingApproval'
  | 'Bootstrapping'
  | 'Replaying'
  | 'Paused'
  | 'Running'
  | 'Suspended'

/**
 * Rust compilation information.
 */
export type RustCompilationInfo = {
  /**
   * Exit code of the `cargo` compilation command.
   */
  exit_code: number
  /**
   * Output printed to stderr by the `cargo` compilation command.
   */
  stderr: string
  /**
   * Output printed to stdout by the `cargo` compilation command.
   */
  stdout: string
}

/**
 * Configuration for reading data from AWS S3.
 */
export type S3InputConfig = {
  /**
   * AWS Access Key id. This property must be specified unless `no_sign_request` is set to `true`.
   */
  aws_access_key_id?: string | null
  /**
   * Secret Access Key. This property must be specified unless `no_sign_request` is set to `true`.
   */
  aws_secret_access_key?: string | null
  /**
   * S3 bucket name to access.
   */
  bucket_name: string
  /**
   * The endpoint URL used to communicate with this service. Can be used to make this connector
   * talk to non-AWS services with an S3 API.
   */
  endpoint_url?: string | null
  /**
   * Read a single object specified by a key.
   */
  key?: string | null
  /**
   * Controls the number of S3 objects fetched in parallel.
   *
   * Increasing this value can improve throughput by enabling greater concurrency.
   * However, higher concurrency may lead to timeouts or increased memory usage due to in-memory buffering.
   *
   * Recommended range: 1–10. Default: 8.
   */
  max_concurrent_fetches?: number
  /**
   * Retry `max_retries` times with exponential backoff.
   * If the object changes during a retry attempt, the remaining part of the object will not be processed.
   * Recommended range: 3-10. Default: 5.
   */
  max_retries?: number
  /**
   * Do not sign requests. This is equivalent to the `--no-sign-request` flag in the AWS CLI.
   */
  no_sign_request?: boolean
  /**
   * Read all objects whose keys match a prefix. Set to an empty string to read all objects in the bucket.
   */
  prefix?: string | null
  /**
   * AWS region.
   */
  region: string
}

/**
 * One sample of time-series data.
 */
export type SampleStatistics = {
  /**
   * Memory usage in bytes.
   */
  m: number
  /**
   * Records processed.
   */
  r: number
  /**
   * Storage usage in bytes.
   */
  s: number
  /**
   * Sample time.
   */
  t: string
}

export type ServiceStatus = {
  checked_at: string
  healthy: boolean
  message: string
  unchanged_since: string
}

export type SessionInfo = {
  tenant_id: TenantId
  /**
   * Current user's tenant name
   */
  tenant_name: string
}

/**
 * Schema definition for endpoint config that only includes the stream field.
 */
export type ShortEndpointConfig = {
  /**
   * The name of the stream.
   */
  stream: string
}

export type SourcePosition = {
  end_column: number
  end_line_number: number
  start_column: number
  start_line_number: number
}

/**
 * SQL compilation information.
 */
export type SqlCompilationInfo = {
  /**
   * Exit code of the SQL compiler.
   */
  exit_code: number
  /**
   * Messages (warnings and errors) generated by the SQL compiler.
   */
  messages: Array<SqlCompilerMessage>
}

/**
 * A SQL compiler error.
 *
 * The SQL compiler returns a list of errors in the following JSON format if
 * it's invoked with the `-je` option.
 *
 * ```ignore
 * [ {
 * "start_line_number" : 2,
 * "start_column" : 4,
 * "end_line_number" : 2,
 * "end_column" : 8,
 * "warning" : false,
 * "error_type" : "PRIMARY KEY cannot be nullable",
 * "message" : "PRIMARY KEY column 'C' has type INTEGER, which is nullable",
 * "snippet" : "    2|   c INT PRIMARY KEY\n         ^^^^^\n    3|);\n"
 * } ]
 * ```
 */
export type SqlCompilerMessage = {
  end_column: number
  end_line_number: number
  error_type: string
  message: string
  snippet?: string | null
  start_column: number
  start_line_number: number
  warning: boolean
}

/**
 * An SQL identifier.
 *
 * This struct is used to represent SQL identifiers in a canonical form.
 * We store table names or field names as identifiers in the schema.
 */
export type SqlIdentifier = {
  case_sensitive: boolean
  name: string
}

/**
 * The available SQL types as specified in `CREATE` statements.
 */
export type SqlType =
  | 'Boolean'
  | 'TinyInt'
  | 'SmallInt'
  | 'Int'
  | 'BigInt'
  | 'UTinyInt'
  | 'USmallInt'
  | 'UInt'
  | 'UBigInt'
  | 'Real'
  | 'Double'
  | 'Decimal'
  | 'Char'
  | 'Varchar'
  | 'Binary'
  | 'Varbinary'
  | 'Time'
  | 'Date'
  | 'Timestamp'
  | {
      Interval: IntervalUnit
    }
  | 'Array'
  | 'Struct'
  | 'Map'
  | 'Null'
  | 'Uuid'
  | 'Variant'

export type StartFromCheckpoint = 'latest' | string | null

/**
 * Response to a `/start_transaction` request.
 */
export type StartTransactionResponse = {
  transaction_id: number
}

/**
 * Backend storage configuration.
 */
export type StorageBackendConfig =
  | {
      name: 'default'
    }
  | {
      config: FileBackendConfig
      name: 'file'
    }
  | {
      config: ObjectStorageConfig
      name: 'object'
    }

/**
 * How to cache access to storage within a Feldera pipeline.
 */
export type StorageCacheConfig = 'page_cache' | 'feldera_cache'

/**
 * Storage compression algorithm.
 */
export type StorageCompression = 'default' | 'none' | 'snappy'

/**
 * Configuration for persistent storage in a [`PipelineConfig`].
 */
export type StorageConfig = {
  cache?: StorageCacheConfig
  /**
   * A directory to keep pipeline state, as a path on the filesystem of the
   * machine or container where the pipeline will run.
   *
   * When storage is enabled, this directory stores the data for
   * [StorageBackendConfig::Default].
   *
   * When fault tolerance is enabled, this directory stores checkpoints and
   * the log.
   */
  path: string
}

/**
 * Storage configuration for a pipeline.
 */
export type StorageOptions = {
  backend?: StorageBackendConfig
  /**
   * The maximum size of the in-memory storage cache, in MiB.
   *
   * If set, the specified cache size is spread across all the foreground and
   * background threads. If unset, each foreground or background thread cache
   * is limited to 256 MiB.
   */
  cache_mib?: number | null
  compression?: StorageCompression
  /**
   * For a batch of data passed through the pipeline during a single step,
   * the minimum estimated number of bytes to write it to storage.
   *
   * This is provided for debugging and fine-tuning and should ordinarily be
   * left unset.  A value of 0 will write even empty batches to storage, and
   * nonzero values provide a threshold.  `usize::MAX`, the default,
   * effectively disables storage for such batches.  If it is set to another
   * value, it should ordinarily be greater than or equal to
   * `min_storage_bytes`.
   */
  min_step_storage_bytes?: number | null
  /**
   * For a batch of data maintained as part of a persistent index during a
   * pipeline run, the minimum estimated number of bytes to write it to
   * storage.
   *
   * This is provided for debugging and fine-tuning and should ordinarily be
   * left unset.
   *
   * A value of 0 will write even empty batches to storage, and nonzero
   * values provide a threshold.  `usize::MAX` would effectively disable
   * storage for such batches.  The default is 10,048,576 (10 MiB).
   */
  min_storage_bytes?: number | null
}

/**
 * Storage status.
 *
 * The storage status can only transition when the resources status is `Stopped`.
 *
 * ```text
 * Cleared ───┐
 * ▲       │
 * /clear │       │
 * │       │
 * Clearing   │
 * ▲       │
 * │       │
 * InUse ◄───┘
 * ```
 */
export type StorageStatus = 'Cleared' | 'InUse' | 'Clearing'

/**
 * Whether a pipeline supports checkpointing and suspend-and-resume.
 */
export type SuspendError =
  | {
      /**
       * Pipeline does not support suspend-and-resume.
       *
       * These reasons only change if the pipeline's configuration changes, e.g.
       * if a pipeline has an input connector that does not support
       * suspend-and-resume, and then that input connector is removed.
       */
      Permanent: Array<PermanentSuspendError>
    }
  | {
      /**
       * Pipeline supports suspend-and-resume, but a suspend requested now will
       * be delayed.
       */
      Temporary: Array<TemporarySuspendError>
    }

export type SyncConfig = {
  /**
   * The access key used to authenticate with the storage provider.
   *
   * If not provided, rclone will fall back to environment-based credentials, such as
   * `RCLONE_S3_ACCESS_KEY_ID`. In Kubernetes environments using IRSA (IAM Roles for Service Accounts),
   * this can be left empty to allow automatic authentication via the pod's service account.
   */
  access_key?: string | null
  /**
   * The name of the storage bucket.
   *
   * This may include a path to a folder inside the bucket (e.g., `my-bucket/data`).
   */
  bucket: string
  /**
   * The number of checkers to run in parallel.
   * Default: 20
   */
  checkers?: number | null
  /**
   * The endpoint URL for the storage service.
   *
   * This is typically required for custom or local S3-compatible storage providers like MinIO.
   * Example: `http://localhost:9000`
   *
   * Relevant rclone config key: [`endpoint`](https://rclone.org/s3/#s3-endpoint)
   */
  endpoint?: string | null
  /**
   * When true, the pipeline will fail to initialize if fetching the
   * specified checkpoint fails (missing, download error).
   * When false, the pipeline will start from scratch instead.
   *
   * False by default.
   */
  fail_if_no_checkpoint?: boolean
  /**
   * Extra flags to pass to `rclone`.
   *
   * WARNING: Supplying incorrect or conflicting flags can break `rclone`.
   * Use with caution.
   *
   * Refer to the docs to see the supported flags:
   * - [Global flags](https://rclone.org/flags/)
   * - [S3 specific flags](https://rclone.org/s3/)
   */
  flags?: Array<string> | null
  /**
   * Set to skip post copy check of checksums, and only check the file sizes.
   * This can significantly improve the throughput.
   * Defualt: false
   */
  ignore_checksum?: boolean | null
  /**
   * Use multi-thread download for files above this size.
   * Format: `[size][Suffix]` (Example: 1G, 500M)
   * Supported suffixes: k|M|G|T
   * Default: 100M
   */
  multi_thread_cutoff?: string | null
  /**
   * Number of streams to use for multi-thread downloads.
   * Default: 10
   */
  multi_thread_streams?: number | null
  /**
   * The name of the cloud storage provider (e.g., `"AWS"`, `"Minio"`).
   *
   * Used for provider-specific behavior in rclone.
   * If omitted, defaults to `"Other"`.
   *
   * See [rclone S3 provider documentation](https://rclone.org/s3/#s3-provider)
   */
  provider?: string | null
  /**
   * The interval (in seconds) between each attempt to fetch the latest
   * checkpoint from object store while in standby mode.
   *
   * Applies only when `start_from_checkpoint` is set to `latest`.
   *
   * Default: 10 seconds
   */
  pull_interval?: number
  /**
   * The interval (in seconds) between each push of checkpoints to object store.
   *
   * Default: disabled (no periodic push).
   */
  push_interval?: number | null
  /**
   * A read-only bucket used as a fallback checkpoint source.
   *
   * When the pipeline has no local checkpoint and `bucket` contains no
   * checkpoint either, it will attempt to fetch the checkpoint from this
   * location instead.  All connection settings (`endpoint`, `region`,
   * `provider`, `access_key`, `secret_key`) are shared with `bucket`.
   *
   * The pipeline **never writes** to `read_bucket`.
   *
   * Must point to a different location than `bucket`.
   */
  read_bucket?: string | null
  /**
   * The region that this bucket is in.
   *
   * Leave empty for Minio or the default region (`us-east-1` for AWS).
   */
  region?: string | null
  /**
   * The minimum age (in days) a checkpoint must reach before it becomes
   * eligible for deletion. All younger checkpoints will be preserved.
   *
   * Default: 30
   */
  retention_min_age?: number
  /**
   * The minimum number of checkpoints to retain in object store.
   * No checkpoints will be deleted if the total count is below this threshold.
   *
   * Default: 10
   */
  retention_min_count?: number
  /**
   * The secret key used together with the access key for authentication.
   *
   * If not provided, rclone will fall back to environment-based credentials, such as
   * `RCLONE_S3_SECRET_ACCESS_KEY`. In Kubernetes environments using IRSA (IAM Roles for Service Accounts),
   * this can be left empty to allow automatic authentication via the pod's service account.
   */
  secret_key?: string | null
  /**
   * When `true`, the pipeline starts in **standby** mode; processing doesn't
   * start until activation (`POST /activate`).
   * If this pipeline was previously activated and the storage has not been
   * cleared, the pipeline will auto activate, no newer checkpoints will be
   * fetched.
   *
   * Standby behavior depends on `start_from_checkpoint`:
   * - If `latest`, pipeline continuously fetches the latest available
   * checkpoint until activated.
   * - If checkpoint UUID, pipeline fetches this checkpoint once and waits
   * in standby until activated.
   *
   * Default: `false`
   */
  standby?: boolean
  start_from_checkpoint?: StartFromCheckpoint | null
  /**
   * The number of file transfers to run in parallel.
   * Default: 20
   */
  transfers?: number | null
  /**
   * The number of chunks of the same file that are uploaded for multipart uploads.
   * Default: 10
   */
  upload_concurrency?: number | null
}

/**
 * Reasons why a pipeline cannot be suspended at this time.
 */
export type TemporarySuspendError =
  | 'Replaying'
  | 'Bootstrapping'
  | 'TransactionInProgress'
  | {
      InputEndpointBarrier: string
    }
  | 'Coordination'

export type TenantId = string

/**
 * Time series to make graphs in the web console easier.
 */
export type TimeSeries = {
  /**
   * Current time as of the creation of the structure.
   */
  now: string
  /**
   * Time series.
   *
   * These report 60 seconds of samples, one per second.
   */
  samples: Array<SampleStatistics>
}

/**
 * Information about entities that initiated the current transaction.
 */
export type TransactionInitiators = {
  initiated_by_api?: TransactionPhase | null
  /**
   * Transaction phases initiated by connectors, indexed by endpoint name.
   */
  initiated_by_connectors: {
    [key: string]: ConnectorTransactionPhase
  }
  /**
   * ID assigned to the transaction (None if no transaction is in progress).
   */
  transaction_id?: number | null
}

/**
 * Transaction phase.
 */
export type TransactionPhase = 'Started' | 'Committed'

/**
 * Transaction status summarized as a single value.
 */
export type TransactionStatus = 'NoTransaction' | 'TransactionInProgress' | 'CommitInProgress'

/**
 * Transport-specific endpoint configuration passed to
 * `crate::OutputTransport::new_endpoint`
 * and `crate::InputTransport::new_endpoint`.
 */
export type TransportConfig =
  | {
      config: FileInputConfig
      name: 'file_input'
    }
  | {
      config: FileOutputConfig
      name: 'file_output'
    }
  | {
      config: NatsInputConfig
      name: 'nats_input'
    }
  | {
      config: KafkaInputConfig
      name: 'kafka_input'
    }
  | {
      config: KafkaOutputConfig
      name: 'kafka_output'
    }
  | {
      config: PubSubInputConfig
      name: 'pub_sub_input'
    }
  | {
      config: UrlInputConfig
      name: 'url_input'
    }
  | {
      config: S3InputConfig
      name: 's3_input'
    }
  | {
      config: DeltaTableReaderConfig
      name: 'delta_table_input'
    }
  | {
      config: DeltaTableWriterConfig
      name: 'delta_table_output'
    }
  | {
      config: RedisOutputConfig
      name: 'redis_output'
    }
  | {
      config: IcebergReaderConfig
      name: 'iceberg_input'
    }
  | {
      config: PostgresReaderConfig
      name: 'postgres_input'
    }
  | {
      config: PostgresWriterConfig
      name: 'postgres_output'
    }
  | {
      config: DatagenInputConfig
      name: 'datagen'
    }
  | {
      config: NexmarkInputConfig
      name: 'nexmark'
    }
  | {
      config: HttpInputConfig
      name: 'http_input'
    }
  | {
      name: 'http_output'
    }
  | {
      config: AdHocInputConfig
      name: 'ad_hoc_input'
    }
  | {
      config: ClockConfig
      name: 'clock_input'
    }

export type UpdateInformation = {
  /**
   * URL that navigates the user to instructions on how to update their deployment's version
   */
  instructions_url: string
  /**
   * Whether the current version matches the latest version
   */
  is_latest_version: boolean
  /**
   * Latest version corresponding to the edition
   */
  latest_version: string
  remind_schedule: DisplaySchedule
}

/**
 * Configuration for reading data from an HTTP or HTTPS URL with
 * `UrlInputTransport`.
 */
export type UrlInputConfig = {
  /**
   * URL.
   */
  path: string
  /**
   * Timeout before disconnection when paused, in seconds.
   *
   * If the pipeline is paused, or if the input adapter reads data faster
   * than the pipeline can process it, then the controller will pause the
   * input adapter. If the input adapter stays paused longer than this
   * timeout, it will drop the network connection to the server. It will
   * automatically reconnect when the input adapter starts running again.
   */
  pause_timeout?: number
}

export type UserAndPassword = {
  password: string
  user: string
}

/**
 * Version number.
 */
export type Version = number

export type GetConfigAuthenticationData = {
  body?: never
  path?: never
  query?: never
  url: '/config/authentication'
}

export type GetConfigAuthenticationErrors = {
  /**
   * Request failed.
   */
  500: ErrorResponse
}

export type GetConfigAuthenticationError =
  GetConfigAuthenticationErrors[keyof GetConfigAuthenticationErrors]

export type GetConfigAuthenticationResponses = {
  /**
   * The response body contains Authentication Provider configuration, or is empty if no auth is configured.
   */
  200: AuthProvider
}

export type GetConfigAuthenticationResponse =
  GetConfigAuthenticationResponses[keyof GetConfigAuthenticationResponses]

export type ListApiKeysData = {
  body?: never
  path?: never
  query?: never
  url: '/v0/api_keys'
}

export type ListApiKeysErrors = {
  500: ErrorResponse
}

export type ListApiKeysError = ListApiKeysErrors[keyof ListApiKeysErrors]

export type ListApiKeysResponses = {
  /**
   * API keys retrieved successfully
   */
  200: Array<ApiKeyDescr>
}

export type ListApiKeysResponse = ListApiKeysResponses[keyof ListApiKeysResponses]

export type PostApiKeyData = {
  body: NewApiKeyRequest
  path?: never
  query?: never
  url: '/v0/api_keys'
}

export type PostApiKeyErrors = {
  /**
   * API key with that name already exists
   */
  409: ErrorResponse
}

export type PostApiKeyError = PostApiKeyErrors[keyof PostApiKeyErrors]

export type PostApiKeyResponses = {
  /**
   * API key created successfully
   */
  201: NewApiKeyResponse
}

export type PostApiKeyResponse = PostApiKeyResponses[keyof PostApiKeyResponses]

export type DeleteApiKeyData = {
  body?: never
  path: {
    /**
     * Unique API key name
     */
    api_key_name: string
  }
  query?: never
  url: '/v0/api_keys/{api_key_name}'
}

export type DeleteApiKeyErrors = {
  /**
   * API key with that name does not exist
   */
  404: ErrorResponse
}

export type DeleteApiKeyError = DeleteApiKeyErrors[keyof DeleteApiKeyErrors]

export type DeleteApiKeyResponses = {
  /**
   * API key deleted successfully
   */
  200: unknown
}

export type GetApiKeyData = {
  body?: never
  path: {
    /**
     * Unique API key name
     */
    api_key_name: string
  }
  query?: never
  url: '/v0/api_keys/{api_key_name}'
}

export type GetApiKeyErrors = {
  /**
   * API key with that name does not exist
   */
  404: ErrorResponse
}

export type GetApiKeyError = GetApiKeyErrors[keyof GetApiKeyErrors]

export type GetApiKeyResponses = {
  /**
   * API key retrieved successfully
   */
  200: ApiKeyDescr
}

export type GetApiKeyResponse = GetApiKeyResponses[keyof GetApiKeyResponses]

export type ListClusterEventsData = {
  body?: never
  path?: never
  query?: never
  url: '/v0/cluster/events'
}

export type ListClusterEventsErrors = {
  500: ErrorResponse
  501: ErrorResponse
}

export type ListClusterEventsError = ListClusterEventsErrors[keyof ListClusterEventsErrors]

export type ListClusterEventsResponses = {
  200: Array<ClusterMonitorEventSelectedInfo>
}

export type ListClusterEventsResponse = ListClusterEventsResponses[keyof ListClusterEventsResponses]

export type GetClusterEventData = {
  body?: never
  path: {
    /**
     * Cluster monitor event identifier or `latest`
     */
    event_id: string
  }
  query?: {
    /**
     * The `selector` parameter limits which fields are returned.
     * Limiting which fields is particularly handy for instance when frequently
     * monitoring over low bandwidth connections while being only interested
     * in status.
     */
    selector?: ClusterMonitorEventFieldSelector
  }
  url: '/v0/cluster/events/{event_id}'
}

export type GetClusterEventErrors = {
  404: ErrorResponse
  500: ErrorResponse
  501: ErrorResponse
}

export type GetClusterEventError = GetClusterEventErrors[keyof GetClusterEventErrors]

export type GetClusterEventResponses = {
  200: ClusterMonitorEventSelectedInfo
}

export type GetClusterEventResponse = GetClusterEventResponses[keyof GetClusterEventResponses]

export type GetClusterHealthData = {
  body?: never
  path?: never
  query?: never
  url: '/v0/cluster_healthz'
}

export type GetClusterHealthErrors = {
  /**
   * One or more services unhealthy
   */
  503: HealthStatus
}

export type GetClusterHealthError = GetClusterHealthErrors[keyof GetClusterHealthErrors]

export type GetClusterHealthResponses = {
  /**
   * All services healthy
   */
  200: HealthStatus
}

export type GetClusterHealthResponse = GetClusterHealthResponses[keyof GetClusterHealthResponses]

export type GetConfigData = {
  body?: never
  path?: never
  query?: never
  url: '/v0/config'
}

export type GetConfigErrors = {
  /**
   * Request failed.
   */
  500: ErrorResponse
}

export type GetConfigError = GetConfigErrors[keyof GetConfigErrors]

export type GetConfigResponses = {
  /**
   * The response body contains basic configuration information about this host.
   */
  200: Configuration
}

export type GetConfigResponse = GetConfigResponses[keyof GetConfigResponses]

export type GetConfigDemosData = {
  body?: never
  path?: never
  query?: never
  url: '/v0/config/demos'
}

export type GetConfigDemosErrors = {
  /**
   * Failed to read demos from the demos directories
   */
  500: ErrorResponse
}

export type GetConfigDemosError = GetConfigDemosErrors[keyof GetConfigDemosErrors]

export type GetConfigDemosResponses = {
  /**
   * List of demos
   */
  200: Array<Demo>
}

export type GetConfigDemosResponse = GetConfigDemosResponses[keyof GetConfigDemosResponses]

export type GetConfigSessionData = {
  body?: never
  path?: never
  query?: never
  url: '/v0/config/session'
}

export type GetConfigSessionErrors = {
  /**
   * Request failed.
   */
  500: ErrorResponse
}

export type GetConfigSessionError = GetConfigSessionErrors[keyof GetConfigSessionErrors]

export type GetConfigSessionResponses = {
  /**
   * The response body contains current session information including tenant details.
   */
  200: SessionInfo
}

export type GetConfigSessionResponse = GetConfigSessionResponses[keyof GetConfigSessionResponses]

export type GetMetricsData = {
  body?: never
  path?: never
  query?: never
  url: '/v0/metrics'
}

export type GetMetricsResponses = {
  /**
   * Metrics of all running pipelines belonging to this tenant in Prometheus format
   */
  200: Blob | File
}

export type GetMetricsResponse = GetMetricsResponses[keyof GetMetricsResponses]

export type ListPipelinesData = {
  body?: never
  path?: never
  query?: {
    /**
     * The `selector` parameter limits which fields are returned for a pipeline.
     * Limiting which fields is particularly handy for instance when frequently
     * monitoring over low bandwidth connections while being only interested
     * in pipeline status.
     */
    selector?: PipelineFieldSelector
  }
  url: '/v0/pipelines'
}

export type ListPipelinesErrors = {
  500: ErrorResponse
}

export type ListPipelinesError = ListPipelinesErrors[keyof ListPipelinesErrors]

export type ListPipelinesResponses = {
  /**
   * List of pipelines retrieved successfully
   */
  200: Array<PipelineSelectedInfo>
}

export type ListPipelinesResponse = ListPipelinesResponses[keyof ListPipelinesResponses]

export type PostPipelineData = {
  body: PostPutPipeline
  path?: never
  query?: never
  url: '/v0/pipelines'
}

export type PostPipelineErrors = {
  400: ErrorResponse
  /**
   * Cannot create pipeline as the name already exists
   */
  409: ErrorResponse
  500: ErrorResponse
}

export type PostPipelineError = PostPipelineErrors[keyof PostPipelineErrors]

export type PostPipelineResponses = {
  /**
   * Pipeline successfully created
   */
  201: PipelineInfo
}

export type PostPipelineResponse = PostPipelineResponses[keyof PostPipelineResponses]

export type DeletePipelineData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: never
  url: '/v0/pipelines/{pipeline_name}'
}

export type DeletePipelineErrors = {
  /**
   * Pipeline must be fully stopped and cleared to be deleted
   */
  400: ErrorResponse
  /**
   * Pipeline with that name does not exist
   */
  404: ErrorResponse
  500: ErrorResponse
}

export type DeletePipelineError = DeletePipelineErrors[keyof DeletePipelineErrors]

export type DeletePipelineResponses = {
  /**
   * Pipeline successfully deleted
   */
  200: unknown
}

export type GetPipelineData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: {
    /**
     * The `selector` parameter limits which fields are returned for a pipeline.
     * Limiting which fields is particularly handy for instance when frequently
     * monitoring over low bandwidth connections while being only interested
     * in pipeline status.
     */
    selector?: PipelineFieldSelector
  }
  url: '/v0/pipelines/{pipeline_name}'
}

export type GetPipelineErrors = {
  /**
   * Pipeline with that name does not exist
   */
  404: ErrorResponse
  500: ErrorResponse
}

export type GetPipelineError = GetPipelineErrors[keyof GetPipelineErrors]

export type GetPipelineResponses = {
  /**
   * Pipeline retrieved successfully
   */
  200: PipelineSelectedInfo
}

export type GetPipelineResponse = GetPipelineResponses[keyof GetPipelineResponses]

export type PatchPipelineData = {
  body: PatchPipeline
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: never
  url: '/v0/pipelines/{pipeline_name}'
}

export type PatchPipelineErrors = {
  400: ErrorResponse
  /**
   * Pipeline with that name does not exist
   */
  404: ErrorResponse
  /**
   * Cannot rename pipeline as the name already exists
   */
  409: ErrorResponse
  500: ErrorResponse
}

export type PatchPipelineError = PatchPipelineErrors[keyof PatchPipelineErrors]

export type PatchPipelineResponses = {
  /**
   * Pipeline successfully updated
   */
  200: PipelineInfo
}

export type PatchPipelineResponse = PatchPipelineResponses[keyof PatchPipelineResponses]

export type PutPipelineData = {
  body: PostPutPipeline
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: never
  url: '/v0/pipelines/{pipeline_name}'
}

export type PutPipelineErrors = {
  400: ErrorResponse
  /**
   * Cannot rename pipeline as the new name already exists
   */
  409: ErrorResponse
  500: ErrorResponse
}

export type PutPipelineError = PutPipelineErrors[keyof PutPipelineErrors]

export type PutPipelineResponses = {
  /**
   * Pipeline successfully updated
   */
  200: PipelineInfo
  /**
   * Pipeline successfully created
   */
  201: PipelineInfo
}

export type PutPipelineResponse = PutPipelineResponses[keyof PutPipelineResponses]

export type PostPipelineActivateData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: {
    initial?: RuntimeDesiredStatus
  }
  url: '/v0/pipelines/{pipeline_name}/activate'
}

export type PostPipelineActivateErrors = {
  /**
   * Pipeline with that name does not exist
   */
  404: ErrorResponse
  500: ErrorResponse
  503: ErrorResponse
}

export type PostPipelineActivateError = PostPipelineActivateErrors[keyof PostPipelineActivateErrors]

export type PostPipelineActivateResponses = {
  /**
   * Pipeline activation initiated
   */
  202: CheckpointResponse
}

export type PostPipelineActivateResponse =
  PostPipelineActivateResponses[keyof PostPipelineActivateResponses]

export type PostPipelineApproveData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: never
  url: '/v0/pipelines/{pipeline_name}/approve'
}

export type PostPipelineApproveErrors = {
  /**
   * Pipeline with that name does not exist
   */
  404: ErrorResponse
  500: ErrorResponse
  503: ErrorResponse
}

export type PostPipelineApproveError = PostPipelineApproveErrors[keyof PostPipelineApproveErrors]

export type PostPipelineApproveResponses = {
  /**
   * Pipeline activation initiated
   */
  202: CheckpointResponse
}

export type PostPipelineApproveResponse =
  PostPipelineApproveResponses[keyof PostPipelineApproveResponses]

export type CheckpointPipelineData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: never
  url: '/v0/pipelines/{pipeline_name}/checkpoint'
}

export type CheckpointPipelineErrors = {
  /**
   * Pipeline with that name does not exist
   */
  404: ErrorResponse
  500: ErrorResponse
  503: ErrorResponse
}

export type CheckpointPipelineError = CheckpointPipelineErrors[keyof CheckpointPipelineErrors]

export type CheckpointPipelineResponses = {
  /**
   * Checkpoint initiated
   */
  200: CheckpointResponse
}

export type CheckpointPipelineResponse =
  CheckpointPipelineResponses[keyof CheckpointPipelineResponses]

export type SyncCheckpointData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: never
  url: '/v0/pipelines/{pipeline_name}/checkpoint/sync'
}

export type SyncCheckpointErrors = {
  /**
   * No checkpoints found
   */
  404: ErrorResponse
  500: ErrorResponse
  503: ErrorResponse
}

export type SyncCheckpointError = SyncCheckpointErrors[keyof SyncCheckpointErrors]

export type SyncCheckpointResponses = {
  /**
   * Checkpoint synced to object store
   */
  200: CheckpointResponse
}

export type SyncCheckpointResponse = SyncCheckpointResponses[keyof SyncCheckpointResponses]

export type GetCheckpointSyncStatusData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: never
  url: '/v0/pipelines/{pipeline_name}/checkpoint/sync_status'
}

export type GetCheckpointSyncStatusErrors = {
  /**
   * Pipeline with that name does not exist
   */
  404: ErrorResponse
  500: ErrorResponse
  503: ErrorResponse
}

export type GetCheckpointSyncStatusError =
  GetCheckpointSyncStatusErrors[keyof GetCheckpointSyncStatusErrors]

export type GetCheckpointSyncStatusResponses = {
  /**
   * Checkpoint sync status retrieved successfully
   */
  200: CheckpointSyncStatus
}

export type GetCheckpointSyncStatusResponse =
  GetCheckpointSyncStatusResponses[keyof GetCheckpointSyncStatusResponses]

export type GetCheckpointStatusData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: never
  url: '/v0/pipelines/{pipeline_name}/checkpoint_status'
}

export type GetCheckpointStatusErrors = {
  /**
   * Pipeline with that name does not exist
   */
  404: ErrorResponse
  500: ErrorResponse
  503: ErrorResponse
}

export type GetCheckpointStatusError = GetCheckpointStatusErrors[keyof GetCheckpointStatusErrors]

export type GetCheckpointStatusResponses = {
  /**
   * Checkpoint status retrieved successfully
   */
  200: CheckpointStatus
}

export type GetCheckpointStatusResponse =
  GetCheckpointStatusResponses[keyof GetCheckpointStatusResponses]

export type GetCheckpointsData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: never
  url: '/v0/pipelines/{pipeline_name}/checkpoints'
}

export type GetCheckpointsErrors = {
  /**
   * Pipeline with that name does not exist
   */
  404: ErrorResponse
  500: ErrorResponse
  503: ErrorResponse
}

export type GetCheckpointsError = GetCheckpointsErrors[keyof GetCheckpointsErrors]

export type GetCheckpointsResponses = {
  /**
   * Checkpoints retrieved successfully
   */
  200: CheckpointMetadata
}

export type GetCheckpointsResponse = GetCheckpointsResponses[keyof GetCheckpointsResponses]

export type GetPipelineCircuitJsonProfileData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: never
  url: '/v0/pipelines/{pipeline_name}/circuit_json_profile'
}

export type GetPipelineCircuitJsonProfileErrors = {
  /**
   * Pipeline with that name does not exist
   */
  404: ErrorResponse
  500: ErrorResponse
  503: ErrorResponse
}

export type GetPipelineCircuitJsonProfileError =
  GetPipelineCircuitJsonProfileErrors[keyof GetPipelineCircuitJsonProfileErrors]

export type GetPipelineCircuitJsonProfileResponses = {
  /**
   * Circuit performance profile in JSON format
   */
  200: {
    [key: string]: unknown
  }
}

export type GetPipelineCircuitJsonProfileResponse =
  GetPipelineCircuitJsonProfileResponses[keyof GetPipelineCircuitJsonProfileResponses]

export type GetPipelineCircuitProfileData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: never
  url: '/v0/pipelines/{pipeline_name}/circuit_profile'
}

export type GetPipelineCircuitProfileErrors = {
  /**
   * Pipeline with that name does not exist
   */
  404: ErrorResponse
  500: ErrorResponse
  503: ErrorResponse
}

export type GetPipelineCircuitProfileError =
  GetPipelineCircuitProfileErrors[keyof GetPipelineCircuitProfileErrors]

export type GetPipelineCircuitProfileResponses = {
  /**
   * Circuit performance profile
   */
  200: {
    [key: string]: unknown
  }
}

export type GetPipelineCircuitProfileResponse =
  GetPipelineCircuitProfileResponses[keyof GetPipelineCircuitProfileResponses]

export type PostPipelineClearData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: never
  url: '/v0/pipelines/{pipeline_name}/clear'
}

export type PostPipelineClearErrors = {
  /**
   * Action could not be performed
   */
  400: ErrorResponse
  /**
   * Pipeline with that name does not exist
   */
  404: ErrorResponse
  500: ErrorResponse
}

export type PostPipelineClearError = PostPipelineClearErrors[keyof PostPipelineClearErrors]

export type PostPipelineClearResponses = {
  /**
   * Action is accepted and is being performed
   */
  202: unknown
}

export type CommitTransactionData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: never
  url: '/v0/pipelines/{pipeline_name}/commit_transaction'
}

export type CommitTransactionErrors = {
  /**
   * Another transaction is already in progress.
   */
  409: ErrorResponse
  500: ErrorResponse
  503: ErrorResponse
}

export type CommitTransactionError = CommitTransactionErrors[keyof CommitTransactionErrors]

export type CommitTransactionResponses = {
  /**
   * Commit operation initiated.
   */
  200: unknown
}

export type CompletionStatusData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query: {
    /**
     * Completion token returned by the '/ingress' or '/completion_status' endpoint.
     */
    token: string
  }
  url: '/v0/pipelines/{pipeline_name}/completion_status'
}

export type CompletionStatusErrors = {
  /**
   * An invalid completion token was provided
   */
  400: ErrorResponse
  /**
   * Pipeline with that name does not exist
   */
  404: ErrorResponse
  /**
   * Completion token was created by a previous incarnation of the pipeline and is not valid for the current incarnation. This indicates that the pipeline was suspended and resumed from a checkpoint or restarted after a failure.
   */
  410: ErrorResponse
  500: ErrorResponse
  503: ErrorResponse
}

export type CompletionStatusError = CompletionStatusErrors[keyof CompletionStatusErrors]

export type CompletionStatusResponses = {
  /**
   * The pipeline has finished processing inputs associated with the provided completion token.
   */
  200: CompletionStatusResponse
  /**
   * The pipeline is still processing inputs associated with the provided completion token.
   */
  202: CompletionStatusResponse
}

export type CompletionStatusResponse2 = CompletionStatusResponses[keyof CompletionStatusResponses]

export type GetPipelineDataflowGraphData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: never
  url: '/v0/pipelines/{pipeline_name}/dataflow_graph'
}

export type GetPipelineDataflowGraphErrors = {
  /**
   * Pipeline with that name does not exist or dataflow graph is not available
   */
  404: ErrorResponse
  500: ErrorResponse
}

export type GetPipelineDataflowGraphError =
  GetPipelineDataflowGraphErrors[keyof GetPipelineDataflowGraphErrors]

export type GetPipelineDataflowGraphResponses = {
  /**
   * Dataflow graph retrieved successfully
   */
  200: {
    [key: string]: unknown
  }
}

export type GetPipelineDataflowGraphResponse =
  GetPipelineDataflowGraphResponses[keyof GetPipelineDataflowGraphResponses]

export type PostPipelineDismissErrorData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: never
  url: '/v0/pipelines/{pipeline_name}/dismiss_error'
}

export type PostPipelineDismissErrorErrors = {
  /**
   * Action could not be performed
   */
  400: ErrorResponse
  /**
   * Pipeline with that name does not exist
   */
  404: ErrorResponse
  500: ErrorResponse
}

export type PostPipelineDismissErrorError =
  PostPipelineDismissErrorErrors[keyof PostPipelineDismissErrorErrors]

export type PostPipelineDismissErrorResponses = {
  /**
   * Deployment error has been dismissed
   */
  200: unknown
}

export type HttpOutputData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
    /**
     * SQL table name. Unquoted SQL names have to be capitalized. Quoted SQL names have to exactly match the case from the SQL program.
     */
    table_name: string
  }
  query: {
    /**
     * Output data format, e.g., 'csv' or 'json'.
     */
    format: string
    /**
     * Set to `true` to group updates in this stream into JSON arrays (used in conjunction with `format=json`). The default value is `false`
     */
    array?: boolean | null
    /**
     * Apply backpressure on the pipeline when the HTTP client cannot receive data fast enough.
     * When this flag is set to false (the default), the HTTP connector drops data chunks if the client is not keeping up with its output.  This prevents a slow HTTP client from slowing down the entire pipeline.
     * When the flag is set to true, the connector waits for the client to receive each chunk and blocks the pipeline if the client cannot keep up.
     */
    backpressure?: boolean | null
  }
  url: '/v0/pipelines/{pipeline_name}/egress/{table_name}'
}

export type HttpOutputErrors = {
  400: ErrorResponse
  /**
   * Pipeline and/or table/view with that name does not exist
   */
  404: ErrorResponse
  500: ErrorResponse
  503: ErrorResponse
}

export type HttpOutputError = HttpOutputErrors[keyof HttpOutputErrors]

export type HttpOutputResponses = {
  /**
   * Connection to the endpoint successfully established. The body of the response contains a stream of data chunks.
   */
  200: Chunk
}

export type HttpOutputResponse = HttpOutputResponses[keyof HttpOutputResponses]

export type GetPipelineHeapProfileData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: never
  url: '/v0/pipelines/{pipeline_name}/heap_profile'
}

export type GetPipelineHeapProfileErrors = {
  /**
   * Getting a heap profile is not supported on this platform
   */
  400: ErrorResponse
  /**
   * Pipeline with that name does not exist
   */
  404: ErrorResponse
  500: ErrorResponse
  503: ErrorResponse
}

export type GetPipelineHeapProfileError =
  GetPipelineHeapProfileErrors[keyof GetPipelineHeapProfileErrors]

export type GetPipelineHeapProfileResponses = {
  /**
   * Heap usage profile as a gzipped protobuf that can be inspected by the pprof tool
   */
  200: Blob | File
}

export type GetPipelineHeapProfileResponse =
  GetPipelineHeapProfileResponses[keyof GetPipelineHeapProfileResponses]

export type HttpInputData = {
  /**
   * Input data in the specified format
   */
  body: string
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
    /**
     * SQL table name. Unquoted SQL names have to be capitalized. Quoted SQL names have to exactly match the case from the SQL program.
     */
    table_name: string
  }
  query: {
    /**
     * When `true`, push data to the pipeline even if the pipeline is paused. The default value is `false`
     */
    force: boolean
    /**
     * Input data format, e.g., 'csv' or 'json'.
     */
    format: string
    /**
     * Set to `true` if updates in this stream are packaged into JSON arrays (used in conjunction with `format=json`). The default values is `false`.
     */
    array?: boolean | null
    /**
     * JSON data change event format (used in conjunction with `format=json`).  The default value is 'insert_delete'.
     */
    update_format?: JsonUpdateFormat | null
  }
  url: '/v0/pipelines/{pipeline_name}/ingress/{table_name}'
}

export type HttpInputErrors = {
  400: ErrorResponse
  /**
   * Pipeline and/or table with that name does not exist
   */
  404: ErrorResponse
  500: ErrorResponse
  503: ErrorResponse
}

export type HttpInputError = HttpInputErrors[keyof HttpInputErrors]

export type HttpInputResponses = {
  /**
   * Data successfully delivered to the pipeline. The body of the response contains a completion token that can be passed to the '/completion_status' endpoint to check whether the pipeline has fully processed the data.
   */
  200: CompletionTokenResponse
}

export type HttpInputResponse = HttpInputResponses[keyof HttpInputResponses]

export type GetPipelineLogsData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: never
  url: '/v0/pipelines/{pipeline_name}/logs'
}

export type GetPipelineLogsErrors = {
  /**
   * Pipeline with that name does not exist
   */
  404: ErrorResponse
  500: ErrorResponse
  503: ErrorResponse
}

export type GetPipelineLogsError = GetPipelineLogsErrors[keyof GetPipelineLogsErrors]

export type GetPipelineLogsResponses = {
  /**
   * Pipeline logs retrieved successfully
   */
  200: Blob | File
}

export type GetPipelineLogsResponse = GetPipelineLogsResponses[keyof GetPipelineLogsResponses]

export type GetPipelineMetricsData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: {
    format?: MetricsFormat
  }
  url: '/v0/pipelines/{pipeline_name}/metrics'
}

export type GetPipelineMetricsErrors = {
  /**
   * Pipeline with that name does not exist
   */
  404: ErrorResponse
  500: ErrorResponse
  503: ErrorResponse
}

export type GetPipelineMetricsError = GetPipelineMetricsErrors[keyof GetPipelineMetricsErrors]

export type GetPipelineMetricsResponses = {
  /**
   * Pipeline circuit metrics retrieved successfully
   */
  200: Blob | File
}

export type GetPipelineMetricsResponse =
  GetPipelineMetricsResponses[keyof GetPipelineMetricsResponses]

export type PostPipelinePauseData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: never
  url: '/v0/pipelines/{pipeline_name}/pause'
}

export type PostPipelinePauseErrors = {
  /**
   * Action could not be performed
   */
  400: ErrorResponse
  /**
   * Pipeline with that name does not exist
   */
  404: ErrorResponse
  500: ErrorResponse
}

export type PostPipelinePauseError = PostPipelinePauseErrors[keyof PostPipelinePauseErrors]

export type PostPipelinePauseResponses = {
  /**
   * Action is accepted and is being performed
   */
  202: unknown
}

export type PipelineAdhocSqlData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query: {
    /**
     * SQL query to execute
     */
    sql: string
    /**
     * Input data format, e.g., 'text', 'json' or 'parquet'
     */
    format: AdHocResultFormat
  }
  url: '/v0/pipelines/{pipeline_name}/query'
}

export type PipelineAdhocSqlErrors = {
  /**
   * Invalid SQL query
   */
  400: ErrorResponse
  /**
   * Pipeline with that name does not exist
   */
  404: ErrorResponse
  500: ErrorResponse
  503: ErrorResponse
}

export type PipelineAdhocSqlError = PipelineAdhocSqlErrors[keyof PipelineAdhocSqlErrors]

export type PipelineAdhocSqlResponses = {
  /**
   * Ad-hoc SQL query result
   */
  200: Blob | File
}

export type PipelineAdhocSqlResponse = PipelineAdhocSqlResponses[keyof PipelineAdhocSqlResponses]

export type PostPipelineRebalanceData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: never
  url: '/v0/pipelines/{pipeline_name}/rebalance'
}

export type PostPipelineRebalanceErrors = {
  /**
   * Pipeline with that name does not exist
   */
  404: ErrorResponse
  500: ErrorResponse
}

export type PostPipelineRebalanceError =
  PostPipelineRebalanceErrors[keyof PostPipelineRebalanceErrors]

export type PostPipelineRebalanceResponses = {
  /**
   * Rebalancing started successfully
   */
  200: unknown
}

export type PostPipelineResumeData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: never
  url: '/v0/pipelines/{pipeline_name}/resume'
}

export type PostPipelineResumeErrors = {
  /**
   * Action could not be performed
   */
  400: ErrorResponse
  /**
   * Pipeline with that name does not exist
   */
  404: ErrorResponse
  500: ErrorResponse
}

export type PostPipelineResumeError = PostPipelineResumeErrors[keyof PostPipelineResumeErrors]

export type PostPipelineResumeResponses = {
  /**
   * Action is accepted and is being performed
   */
  202: unknown
}

export type GetPipelineSamplyProfileData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: {
    /**
     * In a multihost pipeline, the ordinal of the pipeline to sample.
     */
    ordinal?: number
    /**
     * If true, returns 204 redirect with Retry-After header if profile collection is in progress.
     * If false or not provided, returns the last collected profile.
     */
    latest?: boolean
  }
  url: '/v0/pipelines/{pipeline_name}/samply_profile'
}

export type GetPipelineSamplyProfileErrors = {
  /**
   * No samply profile exists for the pipeline, create one by calling `POST /pipelines/{pipeline_name}/samply_profile?duration_secs=30`
   */
  400: ErrorResponse
  /**
   * Pipeline with that name does not exist
   */
  404: ErrorResponse
  500: ErrorResponse
  503: ErrorResponse
}

export type GetPipelineSamplyProfileError =
  GetPipelineSamplyProfileErrors[keyof GetPipelineSamplyProfileErrors]

export type GetPipelineSamplyProfileResponses = {
  /**
   * Samply profile as a gzip containing the profile that can be inspected by the samply tool. Note: may return 204 No Content with Retry-After header if latest=true and profiling is in progress.
   */
  200: Blob | File
}

export type GetPipelineSamplyProfileResponse =
  GetPipelineSamplyProfileResponses[keyof GetPipelineSamplyProfileResponses]

export type StartSamplyProfileData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: {
    /**
     * In a multihost pipeline, the ordinal of the pipeline to sample.
     */
    ordinal?: number
    /**
     * The number of seconds to sample for the profile.
     */
    duration_secs?: number
  }
  url: '/v0/pipelines/{pipeline_name}/samply_profile'
}

export type StartSamplyProfileErrors = {
  /**
   * Pipeline with that name does not exist
   */
  404: ErrorResponse
  /**
   * Samply profile collection is already in progress
   */
  409: ErrorResponse
  500: ErrorResponse
  503: ErrorResponse
}

export type StartSamplyProfileError = StartSamplyProfileErrors[keyof StartSamplyProfileErrors]

export type StartSamplyProfileResponses = {
  /**
   * Started profiling the pipeline with the Samply tool
   */
  202: unknown
}

export type PostPipelineStartData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: {
    /**
     * The `initial` parameter determines whether to after provisioning the pipeline make it
     * become `standby`, `paused` or `running` (only valid values).
     */
    initial?: string
    bootstrap_policy?: BootstrapPolicy
    dismiss_error?: boolean
  }
  url: '/v0/pipelines/{pipeline_name}/start'
}

export type PostPipelineStartErrors = {
  /**
   * Action could not be performed
   */
  400: ErrorResponse
  /**
   * Pipeline with that name does not exist
   */
  404: ErrorResponse
  500: ErrorResponse
}

export type PostPipelineStartError = PostPipelineStartErrors[keyof PostPipelineStartErrors]

export type PostPipelineStartResponses = {
  /**
   * Action is accepted and is being performed
   */
  202: unknown
}

export type StartTransactionData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: never
  url: '/v0/pipelines/{pipeline_name}/start_transaction'
}

export type StartTransactionErrors = {
  /**
   * Another transaction is already in progress.
   */
  409: ErrorResponse
  500: ErrorResponse
  503: ErrorResponse
}

export type StartTransactionError = StartTransactionErrors[keyof StartTransactionErrors]

export type StartTransactionResponses = {
  /**
   * Transaction successfully started.
   */
  200: StartTransactionResponse
}

export type StartTransactionResponse2 = StartTransactionResponses[keyof StartTransactionResponses]

export type GetPipelineStatsData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: never
  url: '/v0/pipelines/{pipeline_name}/stats'
}

export type GetPipelineStatsErrors = {
  /**
   * Pipeline with that name does not exist
   */
  404: ErrorResponse
  500: ErrorResponse
  503: ErrorResponse
}

export type GetPipelineStatsError = GetPipelineStatsErrors[keyof GetPipelineStatsErrors]

export type GetPipelineStatsResponses = {
  /**
   * Pipeline statistics retrieved successfully
   */
  200: ControllerStatus
}

export type GetPipelineStatsResponse = GetPipelineStatsResponses[keyof GetPipelineStatsResponses]

export type PostPipelineStopData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: {
    /**
     * The `force` parameter determines whether to immediately deprovision the pipeline compute
     * resources (`force=true`) or first attempt to atomically checkpoint before doing so
     * (`force=false`, which is the default).
     */
    force?: boolean
  }
  url: '/v0/pipelines/{pipeline_name}/stop'
}

export type PostPipelineStopErrors = {
  /**
   * Action could not be performed
   */
  400: ErrorResponse
  /**
   * Pipeline with that name does not exist
   */
  404: ErrorResponse
  /**
   * Action is not supported
   */
  405: ErrorResponse
  500: ErrorResponse
  /**
   * Action is not implemented because it is only available in the Enterprise edition
   */
  501: ErrorResponse
  /**
   * Action can not be performed (maybe because the pipeline is already suspended)
   */
  503: ErrorResponse
}

export type PostPipelineStopError = PostPipelineStopErrors[keyof PostPipelineStopErrors]

export type PostPipelineStopResponses = {
  /**
   * Action is accepted and is being performed
   */
  202: unknown
}

export type GetPipelineSupportBundleData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: {
    /**
     * Whether to collect new data from the running pipeline (default: true)
     * When false, only previously collected data will be included in the bundle
     */
    collect?: boolean
    /**
     * Whether to collect circuit profile data (default: true)
     */
    circuit_profile?: boolean
    /**
     * Whether to collect heap profile data (default: true)
     */
    heap_profile?: boolean
    /**
     * Whether to collect metrics data (default: true)
     */
    metrics?: boolean
    /**
     * Whether to collect logs data (default: true)
     */
    logs?: boolean
    /**
     * Whether to collect stats data (default: true)
     */
    stats?: boolean
    /**
     * Whether to collect pipeline configuration data (default: true)
     */
    pipeline_config?: boolean
    /**
     * Whether to collect system configuration data (default: true)
     */
    system_config?: boolean
    /**
     * Whether to collect dataflow graph data (default: true)
     */
    dataflow_graph?: boolean
  }
  url: '/v0/pipelines/{pipeline_name}/support_bundle'
}

export type GetPipelineSupportBundleErrors = {
  /**
   * Pipeline with that name does not exist
   */
  404: ErrorResponse
  500: ErrorResponse
  503: ErrorResponse
}

export type GetPipelineSupportBundleError =
  GetPipelineSupportBundleErrors[keyof GetPipelineSupportBundleErrors]

export type GetPipelineSupportBundleResponses = {
  /**
   * Support bundle containing diagnostic information
   */
  200: Blob | File
}

export type GetPipelineSupportBundleResponse =
  GetPipelineSupportBundleResponses[keyof GetPipelineSupportBundleResponses]

export type CompletionTokenData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
    /**
     * SQL table name. Unquoted SQL names have to be capitalized. Quoted SQL names have to exactly match the case from the SQL program.
     */
    table_name: string
    /**
     * Unique input connector name
     */
    connector_name: string
  }
  query?: never
  url: '/v0/pipelines/{pipeline_name}/tables/{table_name}/connectors/{connector_name}/completion_token'
}

export type CompletionTokenErrors = {
  /**
   * Specified pipeline, table, or connector does not exist
   */
  404: ErrorResponse
  500: ErrorResponse
  503: ErrorResponse
}

export type CompletionTokenError = CompletionTokenErrors[keyof CompletionTokenErrors]

export type CompletionTokenResponses = {
  /**
   * Completion token that can be passed to the '/completion_status' endpoint.
   */
  200: CompletionTokenResponse
}

export type CompletionTokenResponse2 = CompletionTokenResponses[keyof CompletionTokenResponses]

export type GetPipelineInputConnectorStatusData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
    /**
     * Unique table name
     */
    table_name: string
    /**
     * Unique input connector name
     */
    connector_name: string
  }
  query?: never
  url: '/v0/pipelines/{pipeline_name}/tables/{table_name}/connectors/{connector_name}/stats'
}

export type GetPipelineInputConnectorStatusErrors = {
  /**
   * Pipeline, table and/or input connector with that name does not exist
   */
  404: ErrorResponse
  500: ErrorResponse
  503: ErrorResponse
}

export type GetPipelineInputConnectorStatusError =
  GetPipelineInputConnectorStatusErrors[keyof GetPipelineInputConnectorStatusErrors]

export type GetPipelineInputConnectorStatusResponses = {
  /**
   * Input connector status retrieved successfully
   */
  200: InputEndpointStatus
}

export type GetPipelineInputConnectorStatusResponse =
  GetPipelineInputConnectorStatusResponses[keyof GetPipelineInputConnectorStatusResponses]

export type PostPipelineInputConnectorActionData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
    /**
     * SQL table name
     */
    table_name: string
    /**
     * Input connector name
     */
    connector_name: string
    action: string
  }
  query?: never
  url: '/v0/pipelines/{pipeline_name}/tables/{table_name}/connectors/{connector_name}/{action}'
}

export type PostPipelineInputConnectorActionErrors = {
  /**
   * Pipeline, table and/or input connector with that name does not exist
   */
  404: ErrorResponse
  500: ErrorResponse
  503: ErrorResponse
}

export type PostPipelineInputConnectorActionError =
  PostPipelineInputConnectorActionErrors[keyof PostPipelineInputConnectorActionErrors]

export type PostPipelineInputConnectorActionResponses = {
  /**
   * Action has been processed
   */
  200: unknown
}

export type PostPipelineTestingData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: {
    set_platform_version?: string | null
  }
  url: '/v0/pipelines/{pipeline_name}/testing'
}

export type PostPipelineTestingErrors = {
  /**
   * Pipeline with that name does not exist
   */
  404: ErrorResponse
  /**
   * Endpoint is disabled. Set FELDERA_UNSTABLE_FEATURES="testing" to enable.
   */
  405: ErrorResponse
}

export type PostPipelineTestingError = PostPipelineTestingErrors[keyof PostPipelineTestingErrors]

export type PostPipelineTestingResponses = {
  /**
   * Request successfully processed
   */
  200: unknown
}

export type GetPipelineTimeSeriesData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: never
  url: '/v0/pipelines/{pipeline_name}/time_series'
}

export type GetPipelineTimeSeriesErrors = {
  /**
   * Pipeline with that name does not exist
   */
  404: ErrorResponse
  500: ErrorResponse
  503: ErrorResponse
}

export type GetPipelineTimeSeriesError =
  GetPipelineTimeSeriesErrors[keyof GetPipelineTimeSeriesErrors]

export type GetPipelineTimeSeriesResponses = {
  /**
   * Pipeline time series retrieved successfully
   */
  200: TimeSeries
}

export type GetPipelineTimeSeriesResponse =
  GetPipelineTimeSeriesResponses[keyof GetPipelineTimeSeriesResponses]

export type GetPipelineTimeSeriesStreamData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: never
  url: '/v0/pipelines/{pipeline_name}/time_series_stream'
}

export type GetPipelineTimeSeriesStreamErrors = {
  /**
   * Pipeline with that name does not exist
   */
  404: ErrorResponse
  500: ErrorResponse
  503: ErrorResponse
}

export type GetPipelineTimeSeriesStreamError =
  GetPipelineTimeSeriesStreamErrors[keyof GetPipelineTimeSeriesStreamErrors]

export type GetPipelineTimeSeriesStreamResponses = {
  /**
   * Pipeline time series stream established successfully
   */
  200: string
}

export type GetPipelineTimeSeriesStreamResponse =
  GetPipelineTimeSeriesStreamResponses[keyof GetPipelineTimeSeriesStreamResponses]

export type PostUpdateRuntimeData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
  }
  query?: never
  url: '/v0/pipelines/{pipeline_name}/update_runtime'
}

export type PostUpdateRuntimeErrors = {
  400: ErrorResponse
  /**
   * Pipeline with that name does not exist
   */
  404: ErrorResponse
  500: ErrorResponse
}

export type PostUpdateRuntimeError = PostUpdateRuntimeErrors[keyof PostUpdateRuntimeErrors]

export type PostUpdateRuntimeResponses = {
  /**
   * Pipeline successfully updated
   */
  200: PipelineInfo
}

export type PostUpdateRuntimeResponse = PostUpdateRuntimeResponses[keyof PostUpdateRuntimeResponses]

export type GetPipelineOutputConnectorStatusData = {
  body?: never
  path: {
    /**
     * Unique pipeline name
     */
    pipeline_name: string
    /**
     * SQL view name
     */
    view_name: string
    /**
     * Output connector name
     */
    connector_name: string
  }
  query?: never
  url: '/v0/pipelines/{pipeline_name}/views/{view_name}/connectors/{connector_name}/stats'
}

export type GetPipelineOutputConnectorStatusErrors = {
  /**
   * Pipeline, view and/or output connector with that name does not exist
   */
  404: ErrorResponse
  500: ErrorResponse
  503: ErrorResponse
}

export type GetPipelineOutputConnectorStatusError =
  GetPipelineOutputConnectorStatusErrors[keyof GetPipelineOutputConnectorStatusErrors]

export type GetPipelineOutputConnectorStatusResponses = {
  /**
   * Output connector status retrieved successfully
   */
  200: OutputEndpointStatus
}

export type GetPipelineOutputConnectorStatusResponse =
  GetPipelineOutputConnectorStatusResponses[keyof GetPipelineOutputConnectorStatusResponses]
