Classes

c
ClientCircuitOpenError(message: string)

Thrown when the circuit breaker for the target origin is open.

c
OpenApiCodegenError(
message: string,
path?: string,
method?: string
)

Thrown by generateOpenApiClient() with path/method diagnostics when the OpenAPI document is malformed or contains unsupported constructs.

Functions

f
createBearerAuthInterceptor(token: string | (() => Promise<string>)): ClientRequestInterceptor

Create a request interceptor that sets Authorization: Bearer <token>.

f
f
createDefaultClientTiming(): IClientTiming

Factory returning the default IClientTiming backed by performance.now() and setTimeout.

f
generateOpenApiClient(
document: SdkOpenApiDocument,
options?: OpenApiCodegenOptions
): string

Generate TypeScript client source from an OpenAPI 3.1 document. Pure function with zero I/O and deterministic output.

Interfaces

I
CircuitBreakerPolicy

Circuit breaker policy consumed by the ResiliencePlugin's breaker pattern.

  • resetTimeout: number

    Cooldown in milliseconds before an open breaker moves to half-open.

  • threshold: number

    Failures within the timeout window that trip the breaker open.

  • timeout: number

    Rolling failure window in milliseconds; failures older than this (measured by the monotonic clock) are dropped before the threshold check.

I
ClientOptions

Options passed to createClient().

I
ClientRateLimitPolicy

Per-origin sliding-window rate-limit configuration.

I
ClientRequest

An outbound JSON request described by application or generated code.

I
ClientRequestContext

Mutable context passed to a ClientRequestInterceptor so it can inspect and modify the resolved URL and headers before the request executes.

I
ClientResponse

A successful parsed response returned by IHttpClient.request.

I
IClientTiming

Monotonic-time and sleep abstraction used by retry, breaker, and rate-limiter.

I
IHttpClient

The public HTTP client contract returned by createClient().

I
IRealtimeClient

A running realtime WebSocket client.

I
ISseClient

A running SSE client returned by createSseClient.

I
IWebSocketTransport

Minimal structural WebSocket surface used by the client.

I
OpenApiCodegenOptions

Options for generateOpenApiClient.

  • apiTypeName: string

    Name of the exported interface describing the generated client, and the factory's return type. Defaults to 'Api'.

  • factoryName: string

    Name of the exported factory function. Defaults to 'createApi'.

  • sdkImport: string

    Import specifier for SDK types. Defaults to '@setu-ts/sdk'.

I
RawSseEvent

The source frame given to a custom SSE payload parser.

I
RealtimeClientOptions

Configuration for createRealtimeClient.

I
RealtimeMessage

One parsed application message received from the server.

I
RealtimeReconnectOptions

Bounded reconnect policy for a realtime connection.

I
RetryPolicy

Retry policy consumed by the ResiliencePlugin's retry pattern.

I
SdkOpenApiDocument

Top-level OpenAPI 3.1 document consumed by {@code generateOpenApiClient}.

I
SdkOpenApiResponse

A single response description keyed by status code or range.

I
SseClientOptions

Configuration for createSseClient.

I
SseEvent

One parsed SSE event delivered to an application.

I
SseReconnectOptions

Reconnection policy for an SSE stream.

Type Aliases

T
BackoffStrategy = "fixed" | "exponential"

Backoff strategy applied to a RetryPolicy's base delay.

T
ClientRequestInterceptor = (ctx: ClientRequestContext) => void | Promise<void>

A request interceptor called once (before any retry attempt) in registration order. Receives a mutable ClientRequestContext.

T
ClientResponseInterceptor<T> = (
response: ClientResponse<T>,
request: ClientRequestContext
) => ClientResponse<T> | Promise<ClientResponse<T>>

A response interceptor called after a successful JSON parse, in registration order. Skipped entirely when the request throws.

T
RealtimeClientState = "connecting" | "open" | "closed"

Lifecycle states a realtime client reports.

T
SseClientState = "connecting" | "open" | "closed"

The lifecycle state of an SSE client.

T
SseEventMap = Record<string, unknown>

A map from SSE event names to their parsed payload types.

T
WebSocketFactory = (url: string) => IWebSocketTransport

Injectable constructor seam for the global WebSocket.