Defjs
Core

EventStreamDefinition

Contract that describes an SSE endpoint for defineEventStream.

@defjs/core · Type

Signature

type EventStreamDefinition<
  TInput extends AnyStruct | undefined = undefined,
  TEvents extends EventStructs = EventStructs,
  TError extends AnyStruct | undefined = undefined,
> = EventStreamDefinitionBase<TEvents> &
  EventStreamErrorField<TError> & {
    builder?: OutboundBuilder;
    input?: TInput;
  };

The composed members are:

  • events, maxBufferSize, and maxQueueSize (both limits are required positive safe integers), optional method, operation, and a required path.

  • error, required only when TError is a struct. It decodes the body of a failed handshake (a non-2xx response). The kind rule is the same as for HTTP: string is text, blob and file are blobs, arrayBuffer is bytes, and everything else is JSON.

  • input and builder. The request shape matches HTTP, including body; GET and HEAD cannot return a body. A declared input always requires an explicit builder. input only defines the parameters; the builder alone decides where each value goes. Only definitions without input may omit builder.

EventStreamDefinitionBase and EventStreamErrorField are internal helper types.

Members

Prop

Type

events TEvents
maxBufferSize number
maxQueueSize number
method? string | undefined
operation? string | undefined
path string
error? TError | undefined
builder? OutboundBuilder | undefined
input? TInput | undefined
Edit this page on GitHub
Released under the MIT License. · Copyright © 2026 MunMunMiao