Skip to content

API Reference

SametGoktepe edited this page Jun 17, 2026 · 1 revision

Public exports per package. This is a typed-reference index — for narrative explanations, follow the links into the deeper pages.

For the canonical, always-up-to-date source: each package's dist/index.d.ts (shipped in the npm tarball).


@eventferry/core

import {
  // Orchestration
  Relay,
  type RelayOptions,
  type RelayHooks,
  type RetryConfig,
  type DlqConfig,

  // Type-safe events
  defineOutbox,
  type OutboxRegistry,
  type TopicDefinition,
  type EnqueueInput,
  type OutboxConsumer,
  type OutboxProducer,
  OutboxValidationError,

  // Types
  type OutboxRecord,
  type OutboxMessageInput,
  type OutboxStore,
  type Publisher,
  type PublishableMessage,
  type PublishResult,
  type PublishErrorKind,
  type Serializer,
  type Logger,
  type Tracing,

  // Standard Schema interop
  type StandardSchemaV1,
} from "@eventferry/core";
Surface Page
Relay + retry / DLQ config Core Concepts, Reliability and Error Handling, Dead-Letter Queue
defineOutbox, OutboxValidationError Type-Safe Events
PublishErrorKind taxonomy Reliability and Error Handling

@eventferry/postgres

import {
  PostgresStore,
  type PostgresStoreOptions,
  createMigrationSql,

  PostgresStreamingRelay,
  type PostgresStreamingRelayOptions,

  PostgresNotifyWaker,
  type PostgresNotifyWakerOptions,
} from "@eventferry/postgres";

Page: Postgres Adapter


@eventferry/mysql

import {
  MysqlStore,
  type MysqlStoreOptions,
  createMigrationSql,

  MysqlBinlogRelay,
  type MysqlBinlogRelayOptions,
} from "@eventferry/mysql";

Page: MySQL Adapter


@eventferry/kafka

import {
  // Publisher
  KafkaPublisher,
  type KafkaPublisherOptions,
  type DriverKind,                         // "kafkajs" | "confluent"

  // Connection config
  type KafkaConnectionConfig,
  type TlsConfig,
  type SaslConfig,
  type SaslPasswordConfig,
  type SaslOauthbearerConfig,
  type OauthBearerToken,

  // Producer behavior
  type ProducerBehaviorConfig,
  type KafkaJsPartitionerChoice,           // "default" | "legacy" | "java-compatible"
  type LibrdkafkaStats,

  // Hooks + tracing
  type KafkaPublisherHooks,
  type KafkaTracer,
  type SpanLike,
  type SpanAttributeValue,
  NoopKafkaTracer,

  // Admin
  type KafkaAdmin,
  type KafkaDriverAdmin,
  type TopicCreateSpec,
  type TopicMetadata,
  type PartitionMetadata,
  type PartitionGrowSpec,

  // Health
  type HealthStatus,

  // Driver layer (advanced)
  KafkaJsDriver,
  ConfluentDriver,
  type KafkaDriver,
  buildConfluentClientConfig,
  classifyKafkajsError,
  classifyConfluentError,
} from "@eventferry/kafka";

Subpath:

import {
  decode,
  decodeHeaders,
  extractTraceContext,
  type IncomingKafkaMessage,
  type IncomingHeaders,
  type DecodedHeaders,
  type DecodedMessage,
  type DecodeOptions,
  type Decoder,
  type TraceContext,
} from "@eventferry/kafka/consume";
Surface Page
KafkaPublisher configuration Kafka Publisher
TlsConfig, SaslConfig Authentication and TLS
ProducerBehaviorConfig knobs Kafka Publisher
KafkaPublisherHooks, KafkaTracer Observability
KafkaAdmin, TopicCreateSpec, etc. Admin Operations
HealthStatus Observability
decode, extractTraceContext Consuming Events
classifyKafkajsError, classifyConfluentError Reliability and Error Handling

@eventferry/schema-registry

import {
  SchemaRegistrySerializer,
  type SchemaRegistrySerializerOptions,
  type SchemaSpec,
  type SchemaType,                         // "AVRO" | "PROTOBUF" | "JSON"
  type SubjectNameStrategy,                // "TopicNameStrategy" | "RecordNameStrategy" | "TopicRecordNameStrategy"
  type SchemaRegistryAuth,
  type SchemaRegistryClient,
} from "@eventferry/schema-registry";

Page: Schema Registry


@eventferry/kafka-iam

import {
  createMskIamSasl,
  type MskIamSaslOptions,
  type MskIamSigner,
} from "@eventferry/kafka-iam";

Page: AWS MSK IAM


@eventferry/all

Re-exports everything from core + postgres + mysql + kafka + schema-registry. Same names, no namespacing:

import {
  Relay,
  PostgresStore,
  MysqlStore,
  KafkaPublisher,
  SchemaRegistrySerializer,
  defineOutbox,
  // ...everything from the inner packages
} from "@eventferry/all";

@eventferry/kafka-iam is not re-exported by @eventferry/all (AWS-specific). Install separately if needed.

Page: Packages


Method index by interface

OutboxStore

interface OutboxStore<Tx = unknown> {
  enqueue(tx: Tx, msg: OutboxMessageInput): Promise<string>;
  claimBatch(size: number): Promise<OutboxRecord[]>;
  markDone(recordIds: string[]): Promise<void>;
  markFailed(recordId: string, nextRetryAt: Date | null, status: "failed" | "dead"): Promise<void>;
  requeue?(recordId: string, retryAt: Date): Promise<void>;          // optional
  purgeDone?(opts: { olderThanMs: number; batchSize: number }): Promise<number>;
  init?(): Promise<void>;
  close?(): Promise<void>;
}

Publisher

interface Publisher {
  connect(): Promise<void>;
  disconnect(): Promise<void>;
  publish(messages: PublishableMessage[]): Promise<PublishResult[]>;
  publishToDlq?(message: PublishableMessage, error: Error): Promise<void>;
  readonly transactional?: boolean;
}

KafkaDriver

interface KafkaDriver {
  connect(): Promise<void>;
  disconnect(): Promise<void>;
  sendBatch(messages: PublishableMessage[]): Promise<PublishResult[]>;
  readonly transactional: boolean;
  admin?(): Promise<KafkaDriverAdmin>;
}

KafkaAdmin

interface KafkaAdmin {
  listTopics(): Promise<string[]>;
  describeTopics(topics: string[]): Promise<TopicMetadata[]>;
  createTopics(specs: TopicCreateSpec[]): Promise<void>;
  createPartitions(specs: PartitionGrowSpec[]): Promise<void>;
  close(): Promise<void>;
}

KafkaTracer

interface KafkaTracer {
  startPublishSpan(name: string, attributes: Record<string, SpanAttributeValue>): SpanLike;
  inject?(span: SpanLike, headers: Record<string, string>): void;
}

Serializer

interface Serializer {
  readonly contentType: string;
  serialize(record: OutboxRecord): Promise<Buffer>;
}

PublishErrorKind reference

type PublishErrorKind =
  | "retriable"      // transient — retry per backoff
  | "fatal"          // skip retry, DLQ immediately
  | "poison"         // record-level rejection, DLQ immediately
  | "backpressure"   // requeue without attempts++
  | "quota"          // retry with quotaMultiplier × backoff
  | "fenced";        // producer epoch fenced

Full mapping table → Reliability and Error Handling.


HealthStatus

interface HealthStatus {
  ok: boolean;
  latencyMs: number;
  timestamp: number;
  error?: Error;
}

publisher.healthCheck({ timeoutMs }) returns this. See Observability.

Clone this wiki locally