Skip to main content
Openfuse
Reference

TypeScript Types

All exported TypeScript types

All types are exported from the package root:

import type {
  TOpenfuseCloudOptions,
  TOpenfuseOptions,
  TProtectOptions,
  TBreaker,
  TBreakerStateValue,
  TBreakerStateResponse,
  TMetricsConfig,
} from '@openfuseio/sdk'

TOpenfuseCloudOptions

Constructor options for OpenfuseCloud.

type TOpenfuseCloudOptions = {
  system: string
  clientId: string
  clientSecret: string
  metrics?: Partial<TMetricsConfig>
  instanceId?: string
}

TOpenfuseOptions

Constructor options for Openfuse (self-hosted).

type TOpenfuseOptions = {
  baseUrl: string
  system: string
  clientId: string
  clientSecret: string
  metrics?: Partial<TMetricsConfig>
  instanceId?: string
}

TProtectOptions<T>

Options for BreakerHandle.protect().

type TProtectOptions<T> = {
  timeout?: number
  fallback?: () => Promise<T> | T
  signal?: AbortSignal
}

TBreaker

A circuit breaker and its current state. Returned by status() and breakers().

type TBreaker = {
  id: string
  slug: string
  state: TBreakerStateValue
  updatedAt?: string
  retryAfter?: string | null
}
FieldTypeDescription
idstringServer-assigned breaker ID.
slugstringHuman-readable slug used in SDK methods.
stateTBreakerStateValueCurrent breaker state.
updatedAtstringISO-8601 timestamp of the last state change.
retryAfterstring | nullISO-8601 timestamp after which the breaker may transition out of open.

TBreakerStateValue

type TBreakerStateValue = 'open' | 'closed' | 'half-open'
ValueMeaning
'closed'Traffic flows normally.
'open'Traffic is blocked. Fallbacks are triggered.
'half-open'Probe requests allowed to test recovery.

TBreakerStateResponse

Breaker state as returned by the state endpoint.

type TBreakerStateResponse = {
  state: TBreakerStateValue
  updatedAt?: string
}

TMetricsConfig

Configuration for client-side metrics aggregation.

type TMetricsConfig = {
  windowSizeMs: number
  flushIntervalMs: number
  maxLatencySamples: number
  enabled: boolean
}
FieldTypeDefaultDescription
windowSizeMsnumber10000Aggregation window in milliseconds.
flushIntervalMsnumber15000Flush interval in milliseconds.
maxLatencySamplesnumber1000Max latency samples per window.
enabledbooleantrueWhether metrics collection is enabled.

Pass Partial<TMetricsConfig> to client constructors to override individual fields.

On this page