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
}| Field | Type | Description |
|---|---|---|
id | string | Server-assigned breaker ID. |
slug | string | Human-readable slug used in SDK methods. |
state | TBreakerStateValue | Current breaker state. |
updatedAt | string | ISO-8601 timestamp of the last state change. |
retryAfter | string | null | ISO-8601 timestamp after which the breaker may transition out of open. |
TBreakerStateValue
type TBreakerStateValue = 'open' | 'closed' | 'half-open'| Value | Meaning |
|---|---|
'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
}| Field | Type | Default | Description |
|---|---|---|---|
windowSizeMs | number | 10000 | Aggregation window in milliseconds. |
flushIntervalMs | number | 15000 | Flush interval in milliseconds. |
maxLatencySamples | number | 1000 | Max latency samples per window. |
enabled | boolean | true | Whether metrics collection is enabled. |
Pass Partial<TMetricsConfig> to client constructors to override individual fields.