Skip to content

Interface: MakaioBusContext

Makaio Framework


Makaio Framework / bus-core / MakaioBusContext

Defined in: ../../../packages/bus-core/src/types/bus.ts:42

Internal bus context containing handler registries and shared state.

Enables creation of isolated bus instances (e.g., for testing) by providing separate handler maps per instance.

Handler arrays are sorted by priority (highest first), with registration order preserved for handlers with equal priority.

anyHandlers: Set<AnyHandler>

Defined in: ../../../packages/bus-core/src/types/bus.ts:46


eventHandlers: Map<string, HandlerEntry<EventHandler<unknown>>[]>

Defined in: ../../../packages/bus-core/src/types/bus.ts:43


interceptorHandlers: Map<string, InterceptorEntry<InterceptorHandler<unknown>>[]>

Defined in: ../../../packages/bus-core/src/types/bus.ts:45


namespaceRegistry: object

Defined in: ../../../packages/bus-core/src/types/bus.ts:48

__resetNamespaces: (() => void) | undefined

Internal

Reset all registered namespaces (for testing only).

extendSubjectSchema(fullSubjectKey, additionalFields): void

Additively extend a registered subject’s schema with new fields.

For request subjects, extends the request and/or response ZodObject via .extend(). For event subjects, extends the event ZodObject directly. Successive calls accumulate fields; if a later extension redefines an existing key, the later definition wins (Zod .extend() semantics).

string

Fully-qualified key (e.g., “session.list”)

Readonly<{[k: string]: $ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>; }> | { request?: Readonly<{[k: string]: $ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>; }>; response?: Readonly<{[k: string]: $ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>; }>; }

For request subjects: { request?, response? } each a record of Zod field definitions. For event subjects: a flat record of Zod field definitions.

void

Error if the subject is not registered or the existing schema is not a ZodObject

getSchema(subject): BaseSubjectSchema | undefined

Get the schema for a registered subject. Returns the unwrapped schema (LocalSubjectSchema and ChannelSubjectSchema wrappers are removed during registration).

string | SubjectDefinition

Subject identifier (e.g., “adapter.getCapabilities”)

BaseSubjectSchema | undefined

Schema if found, undefined otherwise

isLocalSubject(subject): boolean

Check if a subject was registered as a local-only subject.

Local subjects must never be routed over transports. The __local flag is stripped by unwrapSchema, so locality is tracked in a separate set populated at registration time.

string

Full subject identifier (e.g., “widget.register”)

boolean

True if the subject was wrapped with localSubject()

isRequestSubject(subject): boolean

Check if a subject is registered as a request subject.

string

Subject identifier

boolean

True if subject exists and is a request schema

listRegisteredSubjects(): RegisteredSubjectSchema[]

List all registered subjects with their runtime schema metadata.

RegisteredSubjectSchema[]

Registered subjects sorted by fully-qualified subject key

registerNamespace<Domain, Schemas>(domain, schemas, options?): BusNamespace<Domain, SubjectRecordFromSchemaRecord<Schemas>, { [KeyType in PropertyKey]: AllPropertiesOfUnion<FilterablePayload<SubjectRecordFromSchemaRecord<Schemas>[keyof Schemas & string]>>[KeyType] }, Schemas>

Register a namespace in the runtime registry.

The FilterPayload type parameter is computed eagerly from the schemas, enabling type-safe filtering via withFilter().

Domain extends string

Schemas extends Record<string, SubjectSchema>

Domain

Domain string

Schemas

SubjectNamespace object

NamespaceRegistrationOptions

Registration options (e.g., skipBusValidation)

BusNamespace<Domain, SubjectRecordFromSchemaRecord<Schemas>, { [KeyType in PropertyKey]: AllPropertiesOfUnion<FilterablePayload<SubjectRecordFromSchemaRecord<Schemas>[keyof Schemas & string]>>[KeyType] }, Schemas>

The registered namespace with pre-computed FilterPayload type

shouldSkipValidation(subject): boolean

Check if validation should be skipped for a subject.

Returns true if the subject belongs to a namespace registered with skipBusValidation: true.

string

Full subject identifier (e.g., “adapter:github-copilot.sdk.event”)

boolean

True if validation should be skipped


remoteEventHandlers: Map<string, Set<string>>

Defined in: ../../../packages/bus-core/src/types/bus.ts:60

Set of transport names that have subscribed to each subject with event-only handlers (i.e. subscribe messages whose priority array was empty).

Tracked separately from remoteRequestHandlers because event-only subscriptions produce no priority entries yet must still influence advertised-state decisions: if a remote has event-only handlers for a subject, peers should still receive a subscribe (with an empty priority array) rather than an unsubscribe.


remoteRequestHandlers: Map<string, object[]>

Defined in: ../../../packages/bus-core/src/types/bus.ts:50

Remote handler priorities from subscribe messages; keyed by subject pattern.


requestHandlers: Map<string, HandlerEntry<RequestHandler<unknown, unknown>>[]>

Defined in: ../../../packages/bus-core/src/types/bus.ts:44


transportRegistry: object

Defined in: ../../../packages/bus-core/src/types/bus.ts:47

all(): BusTransport[]

BusTransport[]

getPendingReady(): Promise<void>[]

Return all unresolved transport ready promises for dispatch-level gating.

Use Promise.all(registry.getPendingReady()) to await full initialization.

Promise<void>[]

Array of pending ready promises (empty when all transports are ready)

getTransport<K>(name): BusTransportRegistry[K] | undefined

K extends keyof BusTransportRegistry

K

BusTransportRegistry[K] | undefined

names(): keyof BusTransportRegistry[]

keyof BusTransportRegistry[]

registerTransport<K>(name, transport): TransportRegistration

K extends keyof BusTransportRegistry

K

BusTransportRegistry[K]

TransportRegistration

setLifecycleEmitter(emitter): void

Set the lifecycle emitter used to publish BusLifecycle.connected / BusLifecycle.disconnected events whenever a transport connects or disconnects.

Called once by the owning bus after construction. Subsequent transport registrations automatically pick up the emitter through the closure.

TransportLifecycleEmitter

Lifecycle emitter to install.

void