Skip to content
Effect Days 2026 Get your ticket

Envelope

19 exports Added in v1.0.0 Source

Constructors

makeRequest

Added in v1.0.0 Source

Signature

declare function makeRequest<Rpc extends Any>(options: {
readonly address: EntityAddress;
readonly headers: Headers;
readonly payload: Payload<Rpc>;
readonly requestId: Snowflake;
readonly sampled?: boolean;
readonly spanId?: string;
readonly tag: Tag<Rpc>;
readonly traceId?: string;
}): Request<Rpc>

Models

AckChunk

Added in v1.0.0 Source

Signature

declare class AckChunk extends {
[key: string]: any;
} {
[key: string]: any;
constructor(...args: [props?: {
[key: string]: any;
}, options?: MakeOptions]);
readonly [TypeId]: typeof TypeId;
withRequestId(requestId: Snowflake): AckChunk;
}

Envelope type

Added in v1.0.0 Source

Signature

type Envelope<R extends Rpc.Any> = Request<R> | AckChunk | Interrupt

Interrupt

Added in v1.0.0 Source

Signature

declare class Interrupt extends {
[key: string]: any;
} {
[key: string]: any;
constructor(...args: [props?: {
[key: string]: any;
}, options?: MakeOptions]);
readonly [TypeId]: typeof TypeId;
withRequestId(requestId: Snowflake): Interrupt;
}

Request interface

Added in v1.0.0 Source

Signature

interface Request<in out Rpc extends Rpc.Any> {
readonly _tag: "Request";
readonly [TypeId]: typeof TypeId;
readonly address: EntityAddress;
readonly headers: Headers;
readonly payload: Payload<Rpc>;
readonly requestId: Snowflake;
readonly sampled?: boolean;
readonly spanId?: string;
readonly tag: Tag<Rpc>;
readonly traceId?: string;
}

Other

Envelope

Added in v1.0.0 Source

Request

Added in v1.0.0 Source

Primary Key

primaryKey

Added in v1.0.0 Source

Signature

declare function primaryKey<R extends Any>(envelope: Envelope<R>): string | null

Signature

declare function primaryKeyByAddress(options: {
readonly address: EntityAddress;
readonly id: string;
readonly tag: string;
}): string

Refinements

isEnvelope

Added in v1.0.0 Source

Signature

declare function isEnvelope(u: unknown): u is Envelope<any>

Serialization / Deserialization

Signature

declare const EnvelopeFromSelf: Schema.Schema<Envelope.Any, Envelope.Any>

Signature

declare const PartialEncoded: Schema.Union<[Schema.Struct<{
_tag: Schema.Literal<["Request"]>;
address: typeof EntityAddress;
headers: Schema.Schema<Headers.Headers, ReadonlyRecord<string, string>>;
payload: typeof Schema.Unknown;
requestId: Schema.Schema<Snowflake, string>;
sampled: Schema.optional<typeof Schema.Boolean>;
spanId: Schema.optional<typeof Schema.String>;
tag: typeof Schema.String;
traceId: Schema.optional<typeof Schema.String>;
}>, typeof AckChunk, typeof Interrupt]>

Signature

declare const PartialEncodedArray: Schema.Schema<Array<Envelope.PartialEncoded>, Array<Envelope.Encoded>>

Signature

declare const PartialEncodedFromSelf: Schema.Union<[Schema.Struct<{
_tag: Schema.Literal<["Request"]>;
address: Schema.Schema<EntityAddress>;
headers: Schema.Schema<Headers.Headers>;
payload: typeof Schema.Unknown;
requestId: Schema.Schema<Snowflake>;
sampled: Schema.optional<typeof Schema.Boolean>;
spanId: Schema.optional<typeof Schema.String>;
tag: typeof Schema.String;
traceId: Schema.optional<typeof Schema.String>;
}>, Schema.Schema<AckChunk>, Schema.Schema<Interrupt>]>

Signature

declare const PartialEncodedRequest: Schema.Struct<{
_tag: Schema.Literal<["Request"]>;
address: typeof EntityAddress;
headers: Schema.Schema<Headers.Headers, ReadonlyRecord<string, string>>;
payload: typeof Schema.Unknown;
requestId: Schema.Schema<Snowflake, string>;
sampled: Schema.optional<typeof Schema.Boolean>;
spanId: Schema.optional<typeof Schema.String>;
tag: typeof Schema.String;
traceId: Schema.optional<typeof Schema.String>;
}>

Signature

declare const PartialEncodedRequestFromSelf: Schema.Struct<{
_tag: Schema.Literal<["Request"]>;
address: Schema.Schema<EntityAddress>;
headers: Schema.Schema<Headers.Headers>;
payload: typeof Schema.Unknown;
requestId: Schema.Schema<Snowflake>;
sampled: Schema.optional<typeof Schema.Boolean>;
spanId: Schema.optional<typeof Schema.String>;
tag: typeof Schema.String;
traceId: Schema.optional<typeof Schema.String>;
}>

Signature

declare const RequestFromSelf: Schema.Schema<Request.Any, Request.Any>

Type Ids

TypeId

Added in v1.0.0 Source

Signature

declare const TypeId: unique symbol

TypeId type

Added in v1.0.0 Source

Signature

type TypeId = typeof TypeId