Merge branch '3-add-routing' into 4-add-broadcaster
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import type { BaseStream } from '../services/stream/base-stream.js';
|
||||
|
||||
export type RouteSendOptions = {
|
||||
|
||||
/** Defaults to `response`; any other value sends an application event. */
|
||||
type?: string;
|
||||
|
||||
@@ -15,6 +16,7 @@ export type RouteSendOptions = {
|
||||
* connection lifetime are shared with other requests on the same connection.
|
||||
*/
|
||||
export interface RouteStream {
|
||||
|
||||
/** Connection shared by every request on the same transport session. */
|
||||
readonly connection: BaseStream;
|
||||
|
||||
@@ -29,6 +31,7 @@ export type RouteHandler = (stream: RouteStream) => void | Promise<void>;
|
||||
|
||||
/** An exact application route with no transport-specific metadata. */
|
||||
export type RouteDefinition = {
|
||||
|
||||
/** Exact route name. Parameter and wildcard syntax are not supported. */
|
||||
url: string;
|
||||
handler: RouteHandler;
|
||||
|
||||
@@ -5,6 +5,7 @@ import type { BaseStream } from './stream/base-stream.ts';
|
||||
|
||||
/** Canonical request produced by every transport adapter. */
|
||||
export type ApplicationRequest = {
|
||||
|
||||
/** Exact application route name. */
|
||||
path: string;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/** A normal request/response result before transport encoding. */
|
||||
export type StreamResponse = {
|
||||
|
||||
/** Optional correlation ID for multiplexed transports. */
|
||||
id?: string;
|
||||
|
||||
@@ -15,6 +16,7 @@ export type StreamResponse = {
|
||||
|
||||
/** An application event before a transport applies its wire encoding. */
|
||||
export type StreamEvent = {
|
||||
|
||||
/** Optional event or correlation ID. */
|
||||
id?: string;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user