import { P as ProcedureHandlerContext, a as PayloadType, M as MaybeDisposable, A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, b as AnyProcedure } from '../services-DPANPmhb.js'; export { B as BaseErrorSchemaType, C as CANCEL_CODE, c as CallOptions, d as Client, e as ClientOptions, E as Err, f as ErrResult, g as INVALID_REQUEST_CODE, O as Ok, h as OkResult, i as ProcErrors, j as ProcHandler, k as ProcInit, l as ProcRequest, m as ProcResponse, n as ProcType, o as Procedure, p as ProcedureErrorSchemaType, q as ProcedureMap, R as RPCProcedure, r as RawReadable, s as Readable, t as ReadableBrokenError, u as ReadableResult, v as ReaderErrorSchema, w as ResponseData, x as Result, y as ResultUnwrapErr, z as ResultUnwrapOk, S as SerializedProcedureSchema, D as SerializedProcedureSchemaProtocolv1, F as SerializedServerSchema, G as SerializedServerSchemaProtocolv1, H as SerializedServiceSchema, J as SerializedServiceSchemaProtocolv1, K as Service, L as ServiceConfiguration, N as StreamProcedure, Q as SubscriptionProcedure, U as UNCAUGHT_ERROR_CODE, T as UNEXPECTED_DISCONNECT_CODE, V as UploadProcedure, W as ValidProcType, X as Writable, Y as createClient, Z as createServiceSchema, _ as flattenErrorType, $ as serializeSchema, a0 as serializeSchemaV1Compat } from '../services-DPANPmhb.js'; import { Static, TSchema } from 'typebox'; import { T as TransportClientId, O as OpaqueTransportMessage, C as CustomHandshakeErrorCodeSchema } from '../message-C2qDAau6.js'; import { C as Connection, r as ServerHandshakeOptions } from '../transport-DF2T202E.js'; export { s as createClientHandshakeOptions, t as createServerHandshakeOptions } from '../transport-DF2T202E.js'; import { S as ServerTransport } from '../server-D88e2r09.js'; import '@opentelemetry/api'; import '../client-C8pwDvTN.js'; import '../index-CIMpdW6z.js'; import '../types-BGGvYIJM.js'; import '../adapter-K2HsfQLt.js'; type StreamId = string; /** * Represents a server with a set of services. Use {@link createServer} to create it. * @template Services - The type of services provided by the server. */ interface Server> { /** * Services defined for this server. */ services: InstantiatedServiceSchemaMap; /** * A set of stream ids that are currently open. */ streams: Map>; close: () => Promise; } interface ProcStream { streamId: StreamId; from: TransportClientId; procedureName: string; serviceName: string; sessionMetadata: ParsedMetadata; procedure: AnyProcedure; handleMsg: (msg: OpaqueTransportMessage) => void; handleSessionDisconnect: () => void; } interface MiddlewareContext extends Readonly, 'cancel'>> { readonly streamId: StreamId; readonly procedureName: string; readonly serviceName: string; } interface MiddlewareParam { readonly ctx: MiddlewareContext; readonly reqInit: Static; next: () => void; } /** * Middleware is a function that can inspect requests as they are received. * For now modification of the request is not supported behavior. */ type Middleware = (param: MiddlewareParam) => void; /** * Creates a server instance that listens for incoming messages from a transport and routes them to the appropriate service and procedure. * The server tracks the state of each service along with open streams and the extended context object. * @param transport - The transport to listen to. * @param services - An object containing all the services to be registered on the server. * @param handshakeOptions - An optional object containing additional handshake options to be passed to the transport. * @param extendedContext - An optional object containing additional context to be passed to all services. * @returns A promise that resolves to a server instance with the registered services. */ declare function createServer, Context extends MaybeDisposable = MaybeDisposable, RejectionCodeSchema extends CustomHandshakeErrorCodeSchema = never>(transport: ServerTransport, services: Services, providedServerOptions?: Partial<{ handshakeOptions?: ServerHandshakeOptions; extendedContext?: Context; /** * Maximum number of cancelled streams to keep track of to avoid * cascading stream errors. */ maxCancelledStreamTombstonesPerSession?: number; /** * Middlewares run before procedure handlers allowing you to inspect requests and responses.. */ middlewares?: Array; }>): Server; var version = "0.223.0"; export { MaybeDisposable, type Middleware, type MiddlewareContext, type MiddlewareParam, PayloadType, ProcedureHandlerContext, version as RIVER_VERSION, type Server, createServer };