import { type AppLike, type NameLike } from "./slim_bindings"; import { type UniffiByteArray, type UniffiGcObject, type UniffiHandle, FfiConverterObject, FfiConverterObjectWithCallbacks, RustBuffer, UniffiAbstractObject, destructorGuardSymbol, pointerLiteralSymbol, uniffiTypeNameSymbol } from "@ubjs/core"; /** * Per-message context for a multicast RPC response — identifies which group * member sent the response. */ export type RpcMessageContext = { /** * The SLIM name of the group member that sent this response. */ source: NameLike; }; /** * Generated factory for {@link RpcMessageContext} record objects. */ export declare const RpcMessageContext: Readonly<{ create: (partial: Partial & Required>) => RpcMessageContext; new: (partial: Partial & Required>) => RpcMessageContext; defaults: () => Partial; }>; /** * A single item in a multicast response stream, pairing the response payload * with the identity of the member that produced it. */ export type RpcMulticastItem = { /** * Context identifying the source member. */ context: RpcMessageContext; /** * The encoded response payload (raw bytes). */ message: ArrayBuffer; }; /** * Generated factory for {@link RpcMulticastItem} record objects. */ export declare const RpcMulticastItem: Readonly<{ create: (partial: Partial & Required>) => RpcMulticastItem; new: (partial: Partial & Required>) => RpcMulticastItem; defaults: () => Partial; }>; /** * gRPC status codes */ export declare enum RpcCode { /** * Success */ Ok = 0, /** * The operation was cancelled */ Cancelled = 1, /** * Unknown error */ Unknown = 2, /** * Client specified an invalid argument */ InvalidArgument = 3, /** * Deadline exceeded before operation could complete */ DeadlineExceeded = 4, /** * Some requested entity was not found */ NotFound = 5, /** * Some entity that we attempted to create already exists */ AlreadyExists = 6, /** * The caller does not have permission to execute the specified operation */ PermissionDenied = 7, /** * Some resource has been exhausted */ ResourceExhausted = 8, /** * The system is not in a state required for the operation's execution */ FailedPrecondition = 9, /** * The operation was aborted */ Aborted = 10, /** * Operation was attempted past the valid range */ OutOfRange = 11, /** * Operation is not implemented or not supported */ Unimplemented = 12, /** * Internal errors */ Internal = 13, /** * The service is currently unavailable */ Unavailable = 14, /** * Unrecoverable data loss or corruption */ DataLoss = 15, /** * The request does not have valid authentication credentials */ Unauthenticated = 16 } export declare enum RpcError_Tags { Rpc = "Rpc", MulticastRpc = "MulticastRpc", MulticastSessionClosed = "MulticastSessionClosed" } /** * UniFFI-compatible RPC error * * This represents RPC errors with gRPC-compatible status codes. */ export declare const RpcError: Readonly<{ instanceOf: (obj: any) => obj is RpcError; Rpc: { new (inner: { code: RpcCode; message: string; details?: ArrayBuffer; }): { readonly tag: RpcError_Tags.Rpc; readonly inner: Readonly<{ code: RpcCode; message: string; details?: ArrayBuffer; }>; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "RpcError"; name: string; message: string; stack?: string; }; "new"(inner: { code: RpcCode; message: string; details?: ArrayBuffer; }): { readonly tag: RpcError_Tags.Rpc; readonly inner: Readonly<{ code: RpcCode; message: string; details?: ArrayBuffer; }>; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "RpcError"; name: string; message: string; stack?: string; }; instanceOf(obj: any): obj is { readonly tag: RpcError_Tags.Rpc; readonly inner: Readonly<{ code: RpcCode; message: string; details?: ArrayBuffer; }>; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "RpcError"; name: string; message: string; stack?: string; }; hasInner(obj: any): obj is { readonly tag: RpcError_Tags.Rpc; readonly inner: Readonly<{ code: RpcCode; message: string; details?: ArrayBuffer; }>; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "RpcError"; name: string; message: string; stack?: string; }; getInner(obj: { readonly tag: RpcError_Tags.Rpc; readonly inner: Readonly<{ code: RpcCode; message: string; details?: ArrayBuffer; }>; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "RpcError"; name: string; message: string; stack?: string; }): Readonly<{ code: RpcCode; message: string; details?: ArrayBuffer; }>; captureStackTrace(targetObject: object, constructorOpt?: Function): void; prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any; stackTraceLimit: number; }; MulticastRpc: { new (inner: { origin: string; code: RpcCode; message: string; details?: ArrayBuffer; }): { readonly tag: RpcError_Tags.MulticastRpc; readonly inner: Readonly<{ origin: string; code: RpcCode; message: string; details?: ArrayBuffer; }>; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "RpcError"; name: string; message: string; stack?: string; }; "new"(inner: { origin: string; code: RpcCode; message: string; details?: ArrayBuffer; }): { readonly tag: RpcError_Tags.MulticastRpc; readonly inner: Readonly<{ origin: string; code: RpcCode; message: string; details?: ArrayBuffer; }>; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "RpcError"; name: string; message: string; stack?: string; }; instanceOf(obj: any): obj is { readonly tag: RpcError_Tags.MulticastRpc; readonly inner: Readonly<{ origin: string; code: RpcCode; message: string; details?: ArrayBuffer; }>; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "RpcError"; name: string; message: string; stack?: string; }; hasInner(obj: any): obj is { readonly tag: RpcError_Tags.MulticastRpc; readonly inner: Readonly<{ origin: string; code: RpcCode; message: string; details?: ArrayBuffer; }>; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "RpcError"; name: string; message: string; stack?: string; }; getInner(obj: { readonly tag: RpcError_Tags.MulticastRpc; readonly inner: Readonly<{ origin: string; code: RpcCode; message: string; details?: ArrayBuffer; }>; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "RpcError"; name: string; message: string; stack?: string; }): Readonly<{ origin: string; code: RpcCode; message: string; details?: ArrayBuffer; }>; captureStackTrace(targetObject: object, constructorOpt?: Function): void; prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any; stackTraceLimit: number; }; MulticastSessionClosed: { new (inner: { completed: bigint; total: bigint; received: Array; missing: Array; }): { readonly tag: RpcError_Tags.MulticastSessionClosed; readonly inner: Readonly<{ completed: bigint; total: bigint; received: Array; missing: Array; }>; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "RpcError"; name: string; message: string; stack?: string; }; "new"(inner: { completed: bigint; total: bigint; received: Array; missing: Array; }): { readonly tag: RpcError_Tags.MulticastSessionClosed; readonly inner: Readonly<{ completed: bigint; total: bigint; received: Array; missing: Array; }>; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "RpcError"; name: string; message: string; stack?: string; }; instanceOf(obj: any): obj is { readonly tag: RpcError_Tags.MulticastSessionClosed; readonly inner: Readonly<{ completed: bigint; total: bigint; received: Array; missing: Array; }>; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "RpcError"; name: string; message: string; stack?: string; }; hasInner(obj: any): obj is { readonly tag: RpcError_Tags.MulticastSessionClosed; readonly inner: Readonly<{ completed: bigint; total: bigint; received: Array; missing: Array; }>; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "RpcError"; name: string; message: string; stack?: string; }; getInner(obj: { readonly tag: RpcError_Tags.MulticastSessionClosed; readonly inner: Readonly<{ completed: bigint; total: bigint; received: Array; missing: Array; }>; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "RpcError"; name: string; message: string; stack?: string; }): Readonly<{ completed: bigint; total: bigint; received: Array; missing: Array; }>; captureStackTrace(targetObject: object, constructorOpt?: Function): void; prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any; stackTraceLimit: number; }; }>; /** * UniFFI-compatible RPC error * * This represents RPC errors with gRPC-compatible status codes. */ export type RpcError = InstanceType; export declare enum MulticastStreamMessage_Tags { Data = "Data", Error = "Error", End = "End" } /** * Message from a multicast response stream. */ export declare const MulticastStreamMessage: Readonly<{ instanceOf: (obj: any) => obj is MulticastStreamMessage; Data: { new (inner: { item: RpcMulticastItem; }): { readonly tag: MulticastStreamMessage_Tags.Data; readonly inner: Readonly<{ item: RpcMulticastItem; }>; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage"; }; "new"(inner: { item: RpcMulticastItem; }): { readonly tag: MulticastStreamMessage_Tags.Data; readonly inner: Readonly<{ item: RpcMulticastItem; }>; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage"; }; instanceOf(obj: any): obj is { readonly tag: MulticastStreamMessage_Tags.Data; readonly inner: Readonly<{ item: RpcMulticastItem; }>; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage"; }; }; Error: { new (inner: { error: RpcError; }): { readonly tag: MulticastStreamMessage_Tags.Error; readonly inner: Readonly<{ error: RpcError; }>; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage"; }; "new"(inner: { error: RpcError; }): { readonly tag: MulticastStreamMessage_Tags.Error; readonly inner: Readonly<{ error: RpcError; }>; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage"; }; instanceOf(obj: any): obj is { readonly tag: MulticastStreamMessage_Tags.Error; readonly inner: Readonly<{ error: RpcError; }>; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage"; }; }; End: { new (): { readonly tag: MulticastStreamMessage_Tags.End; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage"; }; "new"(): { readonly tag: MulticastStreamMessage_Tags.End; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage"; }; instanceOf(obj: any): obj is { readonly tag: MulticastStreamMessage_Tags.End; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage"; }; }; }>; /** * Message from a multicast response stream. */ export type MulticastStreamMessage = InstanceType; export declare enum StreamMessage_Tags { Data = "Data", Error = "Error", End = "End" } /** * Message from a stream */ export declare const StreamMessage: Readonly<{ instanceOf: (obj: any) => obj is StreamMessage; Data: { new (v0: ArrayBuffer): { readonly tag: StreamMessage_Tags.Data; readonly inner: Readonly<[ArrayBuffer]>; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "StreamMessage"; }; "new"(v0: ArrayBuffer): { readonly tag: StreamMessage_Tags.Data; readonly inner: Readonly<[ArrayBuffer]>; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "StreamMessage"; }; instanceOf(obj: any): obj is { readonly tag: StreamMessage_Tags.Data; readonly inner: Readonly<[ArrayBuffer]>; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "StreamMessage"; }; }; Error: { new (v0: RpcError): { readonly tag: StreamMessage_Tags.Error; readonly inner: Readonly<[RpcError]>; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "StreamMessage"; }; "new"(v0: RpcError): { readonly tag: StreamMessage_Tags.Error; readonly inner: Readonly<[RpcError]>; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "StreamMessage"; }; instanceOf(obj: any): obj is { readonly tag: StreamMessage_Tags.Error; readonly inner: Readonly<[RpcError]>; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "StreamMessage"; }; }; End: { new (): { readonly tag: StreamMessage_Tags.End; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "StreamMessage"; }; "new"(): { readonly tag: StreamMessage_Tags.End; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "StreamMessage"; }; instanceOf(obj: any): obj is { readonly tag: StreamMessage_Tags.End; /** * @private * This field is private and should not be used, use `tag` instead. */ readonly [uniffiTypeNameSymbol]: "StreamMessage"; }; }; }>; /** * Message from a stream */ export type StreamMessage = InstanceType; /** * Bidirectional stream handler for stream-to-stream RPC calls * * Allows sending and receiving messages concurrently. */ export interface BidiStreamHandlerLike { /** * Close the request stream (no more messages will be sent) */ closeSend(): void; /** * Close the request stream (async version) */ closeSendAsync(asyncOpts_?: { signal: AbortSignal; }): Promise; /** * Receive the next response message (blocking version) */ recv(): StreamMessage; /** * Receive the next response message (async version) */ recvAsync(asyncOpts_?: { signal: AbortSignal; }): Promise; /** * Send a request message to the stream (blocking version) */ send(data: ArrayBuffer): void; /** * Send a request message to the stream (async version) */ sendAsync(data: ArrayBuffer, asyncOpts_?: { signal: AbortSignal; }): Promise; } /** * @deprecated Use `BidiStreamHandlerLike` instead. */ export type BidiStreamHandlerInterface = BidiStreamHandlerLike; /** * Bidirectional stream handler for stream-to-stream RPC calls * * Allows sending and receiving messages concurrently. */ export declare class BidiStreamHandler extends UniffiAbstractObject implements BidiStreamHandlerLike { readonly [uniffiTypeNameSymbol] = "BidiStreamHandler"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; private constructor(); /** * Close the request stream (no more messages will be sent) */ closeSend(): void; /** * Close the request stream (async version) */ closeSendAsync(asyncOpts_?: { signal: AbortSignal; }): Promise; /** * Receive the next response message (blocking version) */ recv(): StreamMessage; /** * Receive the next response message (async version) */ recvAsync(asyncOpts_?: { signal: AbortSignal; }): Promise; /** * Send a request message to the stream (blocking version) */ send(data: ArrayBuffer): void; /** * Send a request message to the stream (async version) */ sendAsync(data: ArrayBuffer, asyncOpts_?: { signal: AbortSignal; }): Promise; uniffiDestroy(): void; static instanceOf(obj_: any): obj_ is BidiStreamHandler; } /** * Bidirectional stream handler for multicast stream-to-unary and * stream-to-stream RPC calls. * * Send request messages via [`send`](Self::send) / [`send_async`](Self::send_async), * close the request stream via [`close_send`](Self::close_send), and receive * responses via [`recv`](Self::recv) / [`recv_async`](Self::recv_async). Each * response item carries the source member's identity. */ export interface MulticastBidiStreamHandlerLike { /** * Close the request stream — signals that no more messages will be sent * (blocking). */ closeSend(): void; /** * Close the request stream (async). */ closeSendAsync(asyncOpts_?: { signal: AbortSignal; }): Promise; /** * Receive the next response item (blocking). */ recv(): MulticastStreamMessage; /** * Receive the next response item (async). */ recvAsync(asyncOpts_?: { signal: AbortSignal; }): Promise; /** * Send a request message to the stream (blocking). */ send(data: ArrayBuffer): void; /** * Send a request message to the stream (async). */ sendAsync(data: ArrayBuffer, asyncOpts_?: { signal: AbortSignal; }): Promise; } /** * @deprecated Use `MulticastBidiStreamHandlerLike` instead. */ export type MulticastBidiStreamHandlerInterface = MulticastBidiStreamHandlerLike; /** * Bidirectional stream handler for multicast stream-to-unary and * stream-to-stream RPC calls. * * Send request messages via [`send`](Self::send) / [`send_async`](Self::send_async), * close the request stream via [`close_send`](Self::close_send), and receive * responses via [`recv`](Self::recv) / [`recv_async`](Self::recv_async). Each * response item carries the source member's identity. */ export declare class MulticastBidiStreamHandler extends UniffiAbstractObject implements MulticastBidiStreamHandlerLike { readonly [uniffiTypeNameSymbol] = "MulticastBidiStreamHandler"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; private constructor(); /** * Close the request stream — signals that no more messages will be sent * (blocking). */ closeSend(): void; /** * Close the request stream (async). */ closeSendAsync(asyncOpts_?: { signal: AbortSignal; }): Promise; /** * Receive the next response item (blocking). */ recv(): MulticastStreamMessage; /** * Receive the next response item (async). */ recvAsync(asyncOpts_?: { signal: AbortSignal; }): Promise; /** * Send a request message to the stream (blocking). */ send(data: ArrayBuffer): void; /** * Send a request message to the stream (async). */ sendAsync(data: ArrayBuffer, asyncOpts_?: { signal: AbortSignal; }): Promise; uniffiDestroy(): void; static instanceOf(obj_: any): obj_ is MulticastBidiStreamHandler; } /** * Response stream reader for multicast RPC calls. * * Allows pulling `RpcMulticastItem`s from a GROUP response stream one at a * time. Each item carries the source member's identity alongside the payload. */ export interface MulticastResponseReaderLike { /** * Pull the next item from the multicast response stream (blocking). */ next(): MulticastStreamMessage; /** * Pull the next item from the multicast response stream (async). */ nextAsync(asyncOpts_?: { signal: AbortSignal; }): Promise; } /** * @deprecated Use `MulticastResponseReaderLike` instead. */ export type MulticastResponseReaderInterface = MulticastResponseReaderLike; /** * Response stream reader for multicast RPC calls. * * Allows pulling `RpcMulticastItem`s from a GROUP response stream one at a * time. Each item carries the source member's identity alongside the payload. */ export declare class MulticastResponseReader extends UniffiAbstractObject implements MulticastResponseReaderLike { readonly [uniffiTypeNameSymbol] = "MulticastResponseReader"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; private constructor(); /** * Pull the next item from the multicast response stream (blocking). */ next(): MulticastStreamMessage; /** * Pull the next item from the multicast response stream (async). */ nextAsync(asyncOpts_?: { signal: AbortSignal; }): Promise; uniffiDestroy(): void; static instanceOf(obj_: any): obj_ is MulticastResponseReader; } /** * Request stream writer for stream-to-unary RPC calls * * Allows sending multiple request messages and getting a final response. */ export interface RequestStreamWriterLike { /** * Finalize the stream and get the response (async version) * * **Deprecated**: Use [`finalize_stream_async`](Self::finalize_stream_async) instead. */ finalizeAsync(asyncOpts_?: { signal: AbortSignal; }): Promise; /** * Finalize the stream and get the response (blocking version) */ finalizeStream(): ArrayBuffer; /** * Finalize the stream and get the response (async version) */ finalizeStreamAsync(asyncOpts_?: { signal: AbortSignal; }): Promise; /** * Send a request message to the stream (blocking version) */ send(data: ArrayBuffer): void; /** * Send a request message to the stream (async version) */ sendAsync(data: ArrayBuffer, asyncOpts_?: { signal: AbortSignal; }): Promise; } /** * @deprecated Use `RequestStreamWriterLike` instead. */ export type RequestStreamWriterInterface = RequestStreamWriterLike; /** * Request stream writer for stream-to-unary RPC calls * * Allows sending multiple request messages and getting a final response. */ export declare class RequestStreamWriter extends UniffiAbstractObject implements RequestStreamWriterLike { readonly [uniffiTypeNameSymbol] = "RequestStreamWriter"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; private constructor(); /** * Finalize the stream and get the response (async version) * * **Deprecated**: Use [`finalize_stream_async`](Self::finalize_stream_async) instead. */ finalizeAsync(asyncOpts_?: { signal: AbortSignal; }): Promise; /** * Finalize the stream and get the response (blocking version) */ finalizeStream(): ArrayBuffer; /** * Finalize the stream and get the response (async version) */ finalizeStreamAsync(asyncOpts_?: { signal: AbortSignal; }): Promise; /** * Send a request message to the stream (blocking version) */ send(data: ArrayBuffer): void; /** * Send a request message to the stream (async version) */ sendAsync(data: ArrayBuffer, asyncOpts_?: { signal: AbortSignal; }): Promise; uniffiDestroy(): void; static instanceOf(obj_: any): obj_ is RequestStreamWriter; } /** * Response stream reader for unary-to-stream RPC calls * * Allows pulling messages from a server response stream one at a time. */ export interface ResponseStreamReaderLike { /** * Pull the next message from the response stream (blocking version) * * Returns a StreamMessage indicating the result */ next(): StreamMessage; /** * Pull the next message from the response stream (async version) * * Returns a StreamMessage indicating the result */ nextAsync(asyncOpts_?: { signal: AbortSignal; }): Promise; } /** * @deprecated Use `ResponseStreamReaderLike` instead. */ export type ResponseStreamReaderInterface = ResponseStreamReaderLike; /** * Response stream reader for unary-to-stream RPC calls * * Allows pulling messages from a server response stream one at a time. */ export declare class ResponseStreamReader extends UniffiAbstractObject implements ResponseStreamReaderLike { readonly [uniffiTypeNameSymbol] = "ResponseStreamReader"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; private constructor(); /** * Pull the next message from the response stream (blocking version) * * Returns a StreamMessage indicating the result */ next(): StreamMessage; /** * Pull the next message from the response stream (async version) * * Returns a StreamMessage indicating the result */ nextAsync(asyncOpts_?: { signal: AbortSignal; }): Promise; uniffiDestroy(): void; static instanceOf(obj_: any): obj_ is ResponseStreamReader; } /** * Client-side channel for making RPC calls. * * Manages a single persistent SLIM session: either a `PointToPoint` session * to a single remote server, or a `Multicast` (GROUP) session shared across * multiple remote servers. The session is lazily initialised and recreated * when dead. * * ## Constructor * * - `new_with_members_internal(app, members)` — Smart constructor: * - **1 member**: creates a P2P channel. * - **Many members**: creates a GROUP channel with a generated session name * and auto-invites all members on the first multicast call. */ export interface ChannelLike { /** * Broadcast a request stream to all GROUP members and stream their * responses. * * Semantically equivalent to `call_multicast_stream_unary` at the * transport level; the difference (one vs many responses per member) is * determined by the server handler. */ callMulticastStreamStream(serviceName: string, methodName: string, timeout: number | undefined, metadata: Map | undefined): MulticastBidiStreamHandlerLike; /** * Broadcast a request stream to all GROUP members and collect their * responses. * * Returns a handler that lets you send requests and receive responses * concurrently. Use `send` / `send_async` to push request messages, * `close_send` / `close_send_async` to signal end-of-requests, and * `recv` / `recv_async` to pull response items. */ callMulticastStreamUnary(serviceName: string, methodName: string, timeout: number | undefined, metadata: Map | undefined): MulticastBidiStreamHandlerLike; /** * Broadcast one request to all GROUP members and collect their responses. * * Returns a reader from which each member's response (wrapped in * `MulticastStreamMessage`) can be pulled one at a time (blocking). */ callMulticastUnary(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map | undefined): MulticastResponseReaderLike; /** * Broadcast one request to all GROUP members and collect their responses * (async). */ callMulticastUnaryAsync(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map | undefined, asyncOpts_?: { signal: AbortSignal; }): Promise; /** * Broadcast one request to all GROUP members and stream their responses * (blocking). * * Semantically identical to `call_multicast_unary` at the transport level; * the difference is that each member may send multiple responses before its * EOS, which the server handler determines. */ callMulticastUnaryStream(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map | undefined): MulticastResponseReaderLike; /** * Broadcast one request to all GROUP members and stream their responses * (async). */ callMulticastUnaryStreamAsync(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map | undefined, asyncOpts_?: { signal: AbortSignal; }): Promise; callStreamStream(serviceName: string, methodName: string, timeout: number | undefined, metadata: Map | undefined): BidiStreamHandlerLike; callStreamUnary(serviceName: string, methodName: string, timeout: number | undefined, metadata: Map | undefined): RequestStreamWriterLike; callUnary(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map | undefined): ArrayBuffer; callUnaryAsync(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map | undefined, asyncOpts_?: { signal: AbortSignal; }): Promise; callUnaryStream(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map | undefined): ResponseStreamReaderLike; callUnaryStreamAsync(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map | undefined, asyncOpts_?: { signal: AbortSignal; }): Promise; /** * Async FFI wrapper for [`Channel::close`]. */ closeAsync(timeout: number | undefined, asyncOpts_?: { signal: AbortSignal; }): Promise; /** * Blocking FFI wrapper for [`Channel::close`]. */ closeBlocking(timeout: number | undefined): void; } /** * @deprecated Use `ChannelLike` instead. */ export type ChannelInterface = ChannelLike; /** * Client-side channel for making RPC calls. * * Manages a single persistent SLIM session: either a `PointToPoint` session * to a single remote server, or a `Multicast` (GROUP) session shared across * multiple remote servers. The session is lazily initialised and recreated * when dead. * * ## Constructor * * - `new_with_members_internal(app, members)` — Smart constructor: * - **1 member**: creates a P2P channel. * - **Many members**: creates a GROUP channel with a generated session name * and auto-invites all members on the first multicast call. */ export declare class Channel extends UniffiAbstractObject implements ChannelLike { readonly [uniffiTypeNameSymbol] = "Channel"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; constructor(app: AppLike, remote: NameLike); static newGroup(app: AppLike, members: Array): ChannelLike; static newGroupWithConnection(app: AppLike, members: Array, connectionId: bigint | undefined): ChannelLike; static newWithConnection(app: AppLike, remote: NameLike, connectionId: bigint | undefined): ChannelLike; /** * Broadcast a request stream to all GROUP members and stream their * responses. * * Semantically equivalent to `call_multicast_stream_unary` at the * transport level; the difference (one vs many responses per member) is * determined by the server handler. */ callMulticastStreamStream(serviceName: string, methodName: string, timeout: number | undefined, metadata: Map | undefined): MulticastBidiStreamHandlerLike; /** * Broadcast a request stream to all GROUP members and collect their * responses. * * Returns a handler that lets you send requests and receive responses * concurrently. Use `send` / `send_async` to push request messages, * `close_send` / `close_send_async` to signal end-of-requests, and * `recv` / `recv_async` to pull response items. */ callMulticastStreamUnary(serviceName: string, methodName: string, timeout: number | undefined, metadata: Map | undefined): MulticastBidiStreamHandlerLike; /** * Broadcast one request to all GROUP members and collect their responses. * * Returns a reader from which each member's response (wrapped in * `MulticastStreamMessage`) can be pulled one at a time (blocking). */ callMulticastUnary(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map | undefined): MulticastResponseReaderLike; /** * Broadcast one request to all GROUP members and collect their responses * (async). */ callMulticastUnaryAsync(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map | undefined, asyncOpts_?: { signal: AbortSignal; }): Promise; /** * Broadcast one request to all GROUP members and stream their responses * (blocking). * * Semantically identical to `call_multicast_unary` at the transport level; * the difference is that each member may send multiple responses before its * EOS, which the server handler determines. */ callMulticastUnaryStream(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map | undefined): MulticastResponseReaderLike; /** * Broadcast one request to all GROUP members and stream their responses * (async). */ callMulticastUnaryStreamAsync(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map | undefined, asyncOpts_?: { signal: AbortSignal; }): Promise; callStreamStream(serviceName: string, methodName: string, timeout: number | undefined, metadata: Map | undefined): BidiStreamHandlerLike; callStreamUnary(serviceName: string, methodName: string, timeout: number | undefined, metadata: Map | undefined): RequestStreamWriterLike; callUnary(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map | undefined): ArrayBuffer; callUnaryAsync(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map | undefined, asyncOpts_?: { signal: AbortSignal; }): Promise; callUnaryStream(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map | undefined): ResponseStreamReaderLike; callUnaryStreamAsync(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map | undefined, asyncOpts_?: { signal: AbortSignal; }): Promise; /** * Async FFI wrapper for [`Channel::close`]. */ closeAsync(timeout: number | undefined, asyncOpts_?: { signal: AbortSignal; }): Promise; /** * Blocking FFI wrapper for [`Channel::close`]. */ closeBlocking(timeout: number | undefined): void; uniffiDestroy(): void; static instanceOf(obj_: any): obj_ is Channel; } /** * Context passed to RPC handlers * * Contains all contextual information about an RPC call including: * - Session information (source, destination, session ID) * - Metadata (key-value pairs) * - Deadline/timeout information * - Message routing details */ export interface ContextLike { /** * Get the deadline for this RPC call */ deadline(): Date; /** * Check if the deadline has been exceeded */ isDeadlineExceeded(): boolean; /** * Get the rpc session metadata */ metadata(): Map; /** * The verified issuer (`iss`) of the peer that sent this request, when * it is known. */ peerIssuer(): string | undefined; /** * The verified subject (`sub`) of the peer that sent this request: its MLS * sender with MLS, otherwise the peer that set up the session; see * [`SessionContext::peer_identity`]. */ peerSubject(): string | undefined; /** * Get the remaining time until deadline * * Returns Duration::ZERO if the deadline has already passed */ remainingTime(): number; /** * Get the session ID */ sessionId(): string; } /** * @deprecated Use `ContextLike` instead. */ export type ContextInterface = ContextLike; /** * Context passed to RPC handlers * * Contains all contextual information about an RPC call including: * - Session information (source, destination, session ID) * - Metadata (key-value pairs) * - Deadline/timeout information * - Message routing details */ export declare class Context extends UniffiAbstractObject implements ContextLike { readonly [uniffiTypeNameSymbol] = "Context"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; private constructor(); /** * Get the deadline for this RPC call */ deadline(): Date; /** * Check if the deadline has been exceeded */ isDeadlineExceeded(): boolean; /** * Get the rpc session metadata */ metadata(): Map; /** * The verified issuer (`iss`) of the peer that sent this request, when * it is known. */ peerIssuer(): string | undefined; /** * The verified subject (`sub`) of the peer that sent this request: its MLS * sender with MLS, otherwise the peer that set up the session; see * [`SessionContext::peer_identity`]. */ peerSubject(): string | undefined; /** * Get the remaining time until deadline * * Returns Duration::ZERO if the deadline has already passed */ remainingTime(): number; /** * Get the session ID */ sessionId(): string; uniffiDestroy(): void; static instanceOf(obj_: any): obj_ is Context; } /** * Request stream reader * * Allows pulling messages from a client request stream. * This wraps the underlying async stream and provides a blocking interface * suitable for UniFFI callback traits. */ export interface RequestStreamLike { /** * Pull the next message from the stream (blocking version) * * Returns a StreamMessage indicating the result */ next(): StreamMessage; /** * Pull the next message from the stream (async version) * * Returns a StreamMessage indicating the result */ nextAsync(asyncOpts_?: { signal: AbortSignal; }): Promise; } /** * @deprecated Use `RequestStreamLike` instead. */ export type RequestStreamInterface = RequestStreamLike; /** * Request stream reader * * Allows pulling messages from a client request stream. * This wraps the underlying async stream and provides a blocking interface * suitable for UniFFI callback traits. */ export declare class RequestStream extends UniffiAbstractObject implements RequestStreamLike { readonly [uniffiTypeNameSymbol] = "RequestStream"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; private constructor(); /** * Pull the next message from the stream (blocking version) * * Returns a StreamMessage indicating the result */ next(): StreamMessage; /** * Pull the next message from the stream (async version) * * Returns a StreamMessage indicating the result */ nextAsync(asyncOpts_?: { signal: AbortSignal; }): Promise; uniffiDestroy(): void; static instanceOf(obj_: any): obj_ is RequestStream; } /** * Response stream writer * * Allows pushing messages to a client response stream. * This wraps an async channel sender and provides a blocking interface * suitable for UniFFI callback traits. */ export interface ResponseSinkLike { /** * Close the response stream (blocking version) * * Signals that no more messages will be sent. * The stream will end gracefully. */ close(): void; /** * Close the response stream (async version) * * Signals that no more messages will be sent. * The stream will end gracefully. */ closeAsync(asyncOpts_?: { signal: AbortSignal; }): Promise; /** * Check if the sink has been closed (blocking version) */ isClosed(): boolean; /** * Check if the sink has been closed (async version) */ isClosedAsync(asyncOpts_?: { signal: AbortSignal; }): Promise; /** * Send a message to the response stream (blocking version) * * Returns an error if the stream has been closed or if sending fails. */ send(data: ArrayBuffer): void; /** * Send a message to the response stream (async version) * * Returns an error if the stream has been closed or if sending fails. */ sendAsync(data: ArrayBuffer, asyncOpts_?: { signal: AbortSignal; }): Promise; /** * Send an error to the response stream and close it (blocking version) * * This terminates the stream with an error status. */ sendError(error: RpcError): void; /** * Send an error to the response stream and close it (async version) * * This terminates the stream with an error status. */ sendErrorAsync(error: RpcError, asyncOpts_?: { signal: AbortSignal; }): Promise; } /** * @deprecated Use `ResponseSinkLike` instead. */ export type ResponseSinkInterface = ResponseSinkLike; /** * Response stream writer * * Allows pushing messages to a client response stream. * This wraps an async channel sender and provides a blocking interface * suitable for UniFFI callback traits. */ export declare class ResponseSink extends UniffiAbstractObject implements ResponseSinkLike { readonly [uniffiTypeNameSymbol] = "ResponseSink"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; private constructor(); /** * Close the response stream (blocking version) * * Signals that no more messages will be sent. * The stream will end gracefully. */ close(): void; /** * Close the response stream (async version) * * Signals that no more messages will be sent. * The stream will end gracefully. */ closeAsync(asyncOpts_?: { signal: AbortSignal; }): Promise; /** * Check if the sink has been closed (blocking version) */ isClosed(): boolean; /** * Check if the sink has been closed (async version) */ isClosedAsync(asyncOpts_?: { signal: AbortSignal; }): Promise; /** * Send a message to the response stream (blocking version) * * Returns an error if the stream has been closed or if sending fails. */ send(data: ArrayBuffer): void; /** * Send a message to the response stream (async version) * * Returns an error if the stream has been closed or if sending fails. */ sendAsync(data: ArrayBuffer, asyncOpts_?: { signal: AbortSignal; }): Promise; /** * Send an error to the response stream and close it (blocking version) * * This terminates the stream with an error status. */ sendError(error: RpcError): void; /** * Send an error to the response stream and close it (async version) * * This terminates the stream with an error status. */ sendErrorAsync(error: RpcError, asyncOpts_?: { signal: AbortSignal; }): Promise; uniffiDestroy(): void; static instanceOf(obj_: any): obj_ is ResponseSink; } /** * Stream-to-Stream RPC handler trait * * Implement this trait to handle stream-to-stream RPC calls. * The handler receives multiple requests via the stream and sends multiple responses via the sink. */ export interface StreamStreamHandler { /** * Handle a stream-to-stream RPC call * * # Arguments * * `stream` - Request stream to pull messages from * * `context` - RPC context with metadata and session information * * `sink` - Response sink to send streaming responses * * # Returns * Ok(()) if handling succeeded, or an error * * # Note * You must call `sink.close()` or `sink.send_error()` when done. */ handle(stream: RequestStreamLike, context: ContextLike, sink: ResponseSinkLike, asyncOpts_?: { signal: AbortSignal; }): Promise; } /** * Stream-to-Stream RPC handler trait * * Implement this trait to handle stream-to-stream RPC calls. * The handler receives multiple requests via the stream and sends multiple responses via the sink. */ export declare class StreamStreamHandlerImpl extends UniffiAbstractObject implements StreamStreamHandler { readonly [uniffiTypeNameSymbol] = "StreamStreamHandlerImpl"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; private constructor(); /** * Handle a stream-to-stream RPC call * * # Arguments * * `stream` - Request stream to pull messages from * * `context` - RPC context with metadata and session information * * `sink` - Response sink to send streaming responses * * # Returns * Ok(()) if handling succeeded, or an error * * # Note * You must call `sink.close()` or `sink.send_error()` when done. */ handle(stream: RequestStreamLike, context: ContextLike, sink: ResponseSinkLike, asyncOpts_?: { signal: AbortSignal; }): Promise; uniffiDestroy(): void; static instanceOf(obj_: any): obj_ is StreamStreamHandlerImpl; } /** * Stream-to-Unary RPC handler trait * * Implement this trait to handle stream-to-unary RPC calls. * The handler receives multiple requests via the stream and returns a single response. */ export interface StreamUnaryHandler { /** * Handle a stream-to-unary RPC call * * # Arguments * * `stream` - Request stream to pull messages from * * `context` - RPC context with metadata and session information * * # Returns * The response message bytes or an error */ handle(stream: RequestStreamLike, context: ContextLike, asyncOpts_?: { signal: AbortSignal; }): Promise; } /** * Stream-to-Unary RPC handler trait * * Implement this trait to handle stream-to-unary RPC calls. * The handler receives multiple requests via the stream and returns a single response. */ export declare class StreamUnaryHandlerImpl extends UniffiAbstractObject implements StreamUnaryHandler { readonly [uniffiTypeNameSymbol] = "StreamUnaryHandlerImpl"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; private constructor(); /** * Handle a stream-to-unary RPC call * * # Arguments * * `stream` - Request stream to pull messages from * * `context` - RPC context with metadata and session information * * # Returns * The response message bytes or an error */ handle(stream: RequestStreamLike, context: ContextLike, asyncOpts_?: { signal: AbortSignal; }): Promise; uniffiDestroy(): void; static instanceOf(obj_: any): obj_ is StreamUnaryHandlerImpl; } /** * Unary-to-Stream RPC handler trait * * Implement this trait to handle unary-to-stream RPC calls. * The handler receives a single request and sends multiple responses via the sink. */ export interface UnaryStreamHandler { /** * Handle a unary-to-stream RPC call * * # Arguments * * `request` - The request message bytes * * `context` - RPC context with metadata and session information * * `sink` - Response sink to send streaming responses * * # Returns * Ok(()) if handling succeeded, or an error * * # Note * You must call `sink.close()` or `sink.send_error()` when done. */ handle(request: ArrayBuffer, context: ContextLike, sink: ResponseSinkLike, asyncOpts_?: { signal: AbortSignal; }): Promise; } /** * Unary-to-Stream RPC handler trait * * Implement this trait to handle unary-to-stream RPC calls. * The handler receives a single request and sends multiple responses via the sink. */ export declare class UnaryStreamHandlerImpl extends UniffiAbstractObject implements UnaryStreamHandler { readonly [uniffiTypeNameSymbol] = "UnaryStreamHandlerImpl"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; private constructor(); /** * Handle a unary-to-stream RPC call * * # Arguments * * `request` - The request message bytes * * `context` - RPC context with metadata and session information * * `sink` - Response sink to send streaming responses * * # Returns * Ok(()) if handling succeeded, or an error * * # Note * You must call `sink.close()` or `sink.send_error()` when done. */ handle(request: ArrayBuffer, context: ContextLike, sink: ResponseSinkLike, asyncOpts_?: { signal: AbortSignal; }): Promise; uniffiDestroy(): void; static instanceOf(obj_: any): obj_ is UnaryStreamHandlerImpl; } /** * Unary-to-Unary RPC handler trait * * Implement this trait to handle unary-to-unary RPC calls. * The handler receives a single request and returns a single response. */ export interface UnaryUnaryHandler { /** * Handle a unary-to-unary RPC call * * # Arguments * * `request` - The request message bytes * * `context` - RPC context with metadata and session information * * # Returns * The response message bytes or an error */ handle(request: ArrayBuffer, context: ContextLike, asyncOpts_?: { signal: AbortSignal; }): Promise; } /** * Unary-to-Unary RPC handler trait * * Implement this trait to handle unary-to-unary RPC calls. * The handler receives a single request and returns a single response. */ export declare class UnaryUnaryHandlerImpl extends UniffiAbstractObject implements UnaryUnaryHandler { readonly [uniffiTypeNameSymbol] = "UnaryUnaryHandlerImpl"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; private constructor(); /** * Handle a unary-to-unary RPC call * * # Arguments * * `request` - The request message bytes * * `context` - RPC context with metadata and session information * * # Returns * The response message bytes or an error */ handle(request: ArrayBuffer, context: ContextLike, asyncOpts_?: { signal: AbortSignal; }): Promise; uniffiDestroy(): void; static instanceOf(obj_: any): obj_ is UnaryUnaryHandlerImpl; } /** * RPC Server * * Handles incoming RPC requests by creating sessions and dispatching * to registered service handlers. * * # Example * * ```ignore * # use slim_bindings::{Server, Context, RpcError, Decoder, Encoder, App, Name}; * # use std::sync::Arc; * # fn main() -> Result<(), Box> { * # use slim_bindings::{IdentityProviderConfig, IdentityVerifierConfig}; * # let app_name = Arc::new(Name::new("test".to_string(), "app".to_string(), "v1".to_string())); * # let provider = IdentityProviderConfig::SharedSecret { id: "test".to_string(), data: "secret".to_string() }; * # let verifier = IdentityVerifierConfig::SharedSecret { id: "test".to_string(), data: "secret".to_string() }; * # let app = App::new(app_name, provider, verifier)?; * # let core_app = app.inner(); * # let notification_rx = app.notification_receiver(); * # #[derive(Default)] * # struct Request {} * # impl Decoder for Request { * # fn decode(_buf: impl Into>) -> Result { Ok(Request::default()) } * # } * # #[derive(Default)] * # struct Response {} * # impl Encoder for Response { * # fn encode(self) -> Result, RpcError> { Ok(vec![]) } * # } * let base_name = Name::new("org".to_string(), "namespace".to_string(), "service".to_string()); * let server = Server::new_with_shared_rx_and_connection(core_app, base_name.as_slim_name(), None, notification_rx, None); * * // Register handlers * server.register_unary_unary_internal( * "MyService", * "MyMethod", * |request: Request, _ctx: Context| async move { * Ok(Response::default()) * } * ); * # Ok(()) * # } * ``` */ export interface ServerLike { registerStreamStream(serviceName: string, methodName: string, handler: StreamStreamHandler): void; registerStreamUnary(serviceName: string, methodName: string, handler: StreamUnaryHandler): void; registerUnaryStream(serviceName: string, methodName: string, handler: UnaryStreamHandler): void; registerUnaryUnary(serviceName: string, methodName: string, handler: UnaryUnaryHandler): void; /** * Async FFI wrapper for [`Server::serve`]. */ serveAsync(asyncOpts_?: { signal: AbortSignal; }): Promise; /** * Blocking FFI wrapper for [`Server::serve`]. */ serveBlocking(): void; /** * Async FFI wrapper for [`Server::shutdown`]. */ shutdownAsync(asyncOpts_?: { signal: AbortSignal; }): Promise; /** * Blocking FFI wrapper for [`Server::shutdown`]. */ shutdownBlocking(): void; } /** * @deprecated Use `ServerLike` instead. */ export type ServerInterface = ServerLike; /** * RPC Server * * Handles incoming RPC requests by creating sessions and dispatching * to registered service handlers. * * # Example * * ```ignore * # use slim_bindings::{Server, Context, RpcError, Decoder, Encoder, App, Name}; * # use std::sync::Arc; * # fn main() -> Result<(), Box> { * # use slim_bindings::{IdentityProviderConfig, IdentityVerifierConfig}; * # let app_name = Arc::new(Name::new("test".to_string(), "app".to_string(), "v1".to_string())); * # let provider = IdentityProviderConfig::SharedSecret { id: "test".to_string(), data: "secret".to_string() }; * # let verifier = IdentityVerifierConfig::SharedSecret { id: "test".to_string(), data: "secret".to_string() }; * # let app = App::new(app_name, provider, verifier)?; * # let core_app = app.inner(); * # let notification_rx = app.notification_receiver(); * # #[derive(Default)] * # struct Request {} * # impl Decoder for Request { * # fn decode(_buf: impl Into>) -> Result { Ok(Request::default()) } * # } * # #[derive(Default)] * # struct Response {} * # impl Encoder for Response { * # fn encode(self) -> Result, RpcError> { Ok(vec![]) } * # } * let base_name = Name::new("org".to_string(), "namespace".to_string(), "service".to_string()); * let server = Server::new_with_shared_rx_and_connection(core_app, base_name.as_slim_name(), None, notification_rx, None); * * // Register handlers * server.register_unary_unary_internal( * "MyService", * "MyMethod", * |request: Request, _ctx: Context| async move { * Ok(Response::default()) * } * ); * # Ok(()) * # } * ``` */ export declare class Server extends UniffiAbstractObject implements ServerLike { readonly [uniffiTypeNameSymbol] = "Server"; readonly [destructorGuardSymbol]: UniffiGcObject; readonly [pointerLiteralSymbol]: UniffiHandle; /** * Create a new RPC server * * This is the primary constructor for creating an RPC server instance * that can handle incoming RPC requests over SLIM. * * # Arguments * * `app` - The SLIM application instance that provides the underlying * network transport and session management * * `base_name` - The base name for this service (e.g., org.namespace.service). * This name is used to construct subscription names for RPC methods. * * # Returns * A new RPC server instance wrapped in an Arc for shared ownership */ constructor(app: AppLike, baseName: NameLike); /** * Create a new RPC server with optional connection ID * * The connection ID is used to set up routing before serving RPC requests, * enabling multi-hop RPC calls through specific connections. * * # Arguments * * `app` - The SLIM application instance that provides the underlying * network transport and session management * * `base_name` - The base name for this service (e.g., org.namespace.service). * This name is used to construct subscription names for RPC methods. * * `connection_id` - Optional connection ID for routing setup * * # Returns * A new RPC server instance wrapped in an Arc for shared ownership */ static newWithConnection(app: AppLike, baseName: NameLike, connectionId: bigint | undefined): ServerLike; registerStreamStream(serviceName: string, methodName: string, handler: StreamStreamHandler): void; registerStreamUnary(serviceName: string, methodName: string, handler: StreamUnaryHandler): void; registerUnaryStream(serviceName: string, methodName: string, handler: UnaryStreamHandler): void; registerUnaryUnary(serviceName: string, methodName: string, handler: UnaryUnaryHandler): void; /** * Async FFI wrapper for [`Server::serve`]. */ serveAsync(asyncOpts_?: { signal: AbortSignal; }): Promise; /** * Blocking FFI wrapper for [`Server::serve`]. */ serveBlocking(): void; /** * Async FFI wrapper for [`Server::shutdown`]. */ shutdownAsync(asyncOpts_?: { signal: AbortSignal; }): Promise; /** * Blocking FFI wrapper for [`Server::shutdown`]. */ shutdownBlocking(): void; uniffiDestroy(): void; static instanceOf(obj_: any): obj_ is Server; } /** * This should be called before anything else. * * It is likely that this is being done for you by the library's `index.ts`. * * It checks versions of uniffi between when the Rust scaffolding was generated * and when the bindings were generated. * * It also initializes the machinery to enable Rust to talk back to Javascript. */ declare function uniffiEnsureInitialized(): void; declare const _default: Readonly<{ initialize: typeof uniffiEnsureInitialized; converters: { FfiConverterTypeBidiStreamHandler: FfiConverterObject; FfiConverterTypeChannel: FfiConverterObject; FfiConverterTypeContext: FfiConverterObject; FfiConverterTypeMulticastBidiStreamHandler: FfiConverterObject; FfiConverterTypeMulticastResponseReader: FfiConverterObject; FfiConverterTypeMulticastStreamMessage: { read(from: RustBuffer): MulticastStreamMessage; write(value: MulticastStreamMessage, into: RustBuffer): void; allocationSize(value: MulticastStreamMessage): number; lift(value: UniffiByteArray): MulticastStreamMessage; lower(value: MulticastStreamMessage, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray; }; FfiConverterTypeRequestStream: FfiConverterObject; FfiConverterTypeRequestStreamWriter: FfiConverterObject; FfiConverterTypeResponseSink: FfiConverterObject; FfiConverterTypeResponseStreamReader: FfiConverterObject; FfiConverterTypeRpcCode: { read(from: RustBuffer): RpcCode; write(value: RpcCode, into: RustBuffer): void; allocationSize(value: RpcCode): number; lift(value: UniffiByteArray): RpcCode; lower(value: RpcCode, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray; }; FfiConverterTypeRpcError: { read(from: RustBuffer): RpcError; write(value: RpcError, into: RustBuffer): void; allocationSize(value: RpcError): number; lift(value: UniffiByteArray): RpcError; lower(value: RpcError, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray; }; FfiConverterTypeRpcMessageContext: { read(from: RustBuffer): RpcMessageContext; write(value: RpcMessageContext, into: RustBuffer): void; allocationSize(value: RpcMessageContext): number; lift(value: UniffiByteArray): RpcMessageContext; lower(value: RpcMessageContext, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray; }; FfiConverterTypeRpcMulticastItem: { read(from: RustBuffer): RpcMulticastItem; write(value: RpcMulticastItem, into: RustBuffer): void; allocationSize(value: RpcMulticastItem): number; lift(value: UniffiByteArray): RpcMulticastItem; lower(value: RpcMulticastItem, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray; }; FfiConverterTypeServer: FfiConverterObject; FfiConverterTypeStreamMessage: { read(from: RustBuffer): StreamMessage; write(value: StreamMessage, into: RustBuffer): void; allocationSize(value: StreamMessage): number; lift(value: UniffiByteArray): StreamMessage; lower(value: StreamMessage, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray; }; FfiConverterTypeStreamStreamHandler: FfiConverterObjectWithCallbacks; FfiConverterTypeStreamUnaryHandler: FfiConverterObjectWithCallbacks; FfiConverterTypeUnaryStreamHandler: FfiConverterObjectWithCallbacks; FfiConverterTypeUnaryUnaryHandler: FfiConverterObjectWithCallbacks; }; }>; export default _default;