Function: channelSubject()
Makaio Framework / bus-core / channelSubject
Function: channelSubject()
Section titled “Function: channelSubject()”channelSubject<
T>(schema):ChannelSubjectSchema<T>
Defined in: ../../../packages/bus-core/src/utils/channel-schema.ts:54
Create a channel-only subject schema wrapper.
Channel subjects are rejected by public bus methods and are only routable through the DirectChannel encrypted point-to-point transport. Use this for subjects that must never travel over the public bus.
Type Parameters
Section titled “Type Parameters”T extends EventSchema | RequestSchema
Parameters
Section titled “Parameters”schema
Section titled “schema”T
The event or request schema to mark as channel-only
Returns
Section titled “Returns”ChannelSubjectSchema<T>
A ChannelSubjectSchema wrapper
Example
Section titled “Example”import { channelSubject } from '@makaio/bus-core';
const DirectSchemas = { // Channel event - encrypted, point-to-point only message: channelSubject(z.object({ text: z.string() })),
// Channel request - encrypted request-response pair ping: channelSubject({ request: z.object({ ts: z.number() }), response: z.object({ ts: z.number() }), }),};