/** * @fileoverview Public client-manager contracts. Implementations live in sibling * files: {@link BaseClientManager} (REST + Schema Registry) in * `base-client-manager.ts`, and concrete subclasses ({@link DirectClientManager} * for api-key auth + native Kafka, plus the OAuth variant) alongside it. */ import { KafkaJS } from "@confluentinc/kafka-javascript"; import type { SchemaRegistryClient } from "@confluentinc/schemaregistry"; import type { paths } from "@src/confluent/openapi-schema.js"; import type { Client } from "openapi-fetch"; /** * Typed openapi-fetch client over the project's OpenAPI {@link paths}. * Shared alias so every REST surface in the codebase (cloud, flink, * tableflow, kafka REST, schema-registry REST, telemetry) advertises and * returns the same shape without restating the path-template generic. */ export type ConfluentRestClient = Client; /** * Interface for managing Kafka client connections and operations. */ export interface KafkaClientManager { /** Gets the main Kafka client instance */ getKafkaClient(): KafkaJS.Kafka; /** Gets a connected admin client for Kafka administration operations */ getAdminClient(): Promise; /** Gets a connected producer client for publishing messages */ getProducer(): Promise; /** Gets a connected consumer client for subscribing to topics */ getConsumer(sessionId?: string): Promise; /** Disconnects and cleans up all client connections */ disconnect(): Promise; } /** * Interface for managing Confluent Cloud REST client connections. */ export interface ConfluentCloudRestClientManager { /** Gets a configured REST client for Confluent Cloud Flink operations */ getConfluentCloudFlinkRestClient(): ConfluentRestClient; /** Gets a configured REST client for general Confluent Cloud operations */ getConfluentCloudRestClient(): ConfluentRestClient; /** Gets a configured REST client for Tableflow operations */ getConfluentCloudTableflowRestClient(): ConfluentRestClient; /** Gets a configured REST client for Confluent Cloud Schema Registry operations */ getConfluentCloudSchemaRegistryRestClient(): ConfluentRestClient; /** * Env-aware REST client for Schema Registry operations. Use from handlers * that need OAuth support; the existing sync getter above stays in use by * direct-only handlers (catalog/tag/search) and is unaffected by this * method. * * Under direct, `envId` is ignored; a client is built against the * `schema_registry.endpoint` from the connection config (same configuration * source as the sync getter). Under OAuth, `envId` is required: a fresh * client is built per call against the resolved SR host for the env's SR * cluster, with bearer auth + the `target-sr-cluster` default header. */ getSchemaRegistryRestClient(envId?: string): Promise; /** * Gets a configured REST client for Confluent Cloud Kafka operations. * * Under direct, args are ignored; a client is built against * `conn.kafka.rest_endpoint` from the connection config. Under OAuth, both * `clusterId` and `envId` are required: a fresh client is built per call * against the resolved `spec.http_endpoint` for the given cluster. */ getConfluentCloudKafkaRestClient(clusterId?: string, envId?: string): Promise; /** Gets a configured REST client for Confluent Cloud Telemetry/Metrics API */ getConfluentCloudTelemetryRestClient(): ConfluentRestClient; } /** * Interface for managing Schema Registry client connections. */ export interface SchemaRegistryClientHandler { getSchemaRegistryClient(): SchemaRegistryClient; } export interface ClientManager extends KafkaClientManager, ConfluentCloudRestClientManager, SchemaRegistryClientHandler { getSchemaRegistryClient(): SchemaRegistryClient; } //# sourceMappingURL=client-manager.d.ts.map