/** * Initial messages for worker-backed RPC protocols. * * A worker-backed RPC client can send one schema-encoded value before normal RPC * requests are handled. This module defines the `InitialMessage` service, a * helper for encoding that value while collecting transferables, a layer for * providing it to the client protocol, and a decoder for reading it from the * worker server protocol. * * @stability unstable * @since 4.0.0 */ import type { NoSuchElementError } from "../Cause.ts"; import * as Context from "../Context.ts"; import * as Effect from "../Effect.ts"; import * as Layer from "../Layer.ts"; import * as Schema from "../Schema.ts"; import type { Protocol } from "./RpcServer.ts"; declare const InitialMessage_base: Context.ServiceClass>; /** * Context service that supplies the initial RPC worker message as encoded data * paired with any transferables that should be posted with it. * * @stability unstable * @category services * @since 4.0.0 */ export declare class InitialMessage extends InitialMessage_base { } /** * Types related to the encoded initial message exchanged with an RPC worker. * * @stability unstable * @since 4.0.0 */ export declare namespace InitialMessage { /** * Tagged wire representation of an RPC worker initial message after schema * encoding. * * @stability unstable * @category models * @since 4.0.0 */ interface Encoded { readonly _tag: "InitialMessage"; readonly value: unknown; } } /** * Runs an effect, encodes its result with the schema's JSON codec, and returns * the encoded value together with collected transferables. * * @stability unstable * @category encoding * @since 4.0.0 */ export declare const makeInitialMessage: (schema: S, effect: Effect.Effect) => Effect.Effect], E | Schema.SchemaError, S["EncodingServices"] | R2>; /** * Provides the `InitialMessage` service from a schema and build effect, * capturing the layer context and dying if schema encoding fails. * * @stability unstable * @category layers * @since 4.0.0 */ export declare const layerInitialMessage: (schema: S, build: Effect.Effect) => Layer.Layer; /** * Reads the protocol initial message and decodes it with the supplied schema, * failing if no initial message is available or decoding fails. * * @stability unstable * @category decoding * @since 4.0.0 */ export declare const initialMessage: (schema: S) => Effect.Effect; export {}; //# sourceMappingURL=RpcWorker.d.ts.map