/** * @since 1.0.0 */ import * as Headers from "@effect/platform/Headers"; import type * as Rpc from "@effect/rpc/Rpc"; import type { ReadonlyRecord } from "effect/Record"; import * as Schema from "effect/Schema"; import { EntityAddress } from "./EntityAddress.js"; import { type Snowflake } from "./Snowflake.js"; /** * @since 1.0.0 * @category type ids */ export declare const TypeId: unique symbol; /** * @since 1.0.0 * @category type ids */ export type TypeId = typeof TypeId; /** * @since 1.0.0 * @category models */ export type Envelope = Request | AckChunk | Interrupt; /** * @since 1.0.0 */ export declare namespace Envelope { /** * @since 1.0.0 * @category models */ type Any = Envelope; /** * @since 1.0.0 * @category models */ type Encoded = Request.Encoded | typeof AckChunk.Encoded | typeof Interrupt.Encoded; /** * @since 1.0.0 * @category models */ type PartialEncoded = Request.PartialEncoded | AckChunk | Interrupt; } /** * @since 1.0.0 * @category models */ export interface Request { readonly [TypeId]: TypeId; readonly _tag: "Request"; readonly requestId: Snowflake; readonly address: EntityAddress; readonly tag: Rpc.Tag; readonly payload: Rpc.Payload; readonly headers: Headers.Headers; readonly traceId?: string | undefined; readonly spanId?: string | undefined; readonly sampled?: boolean | undefined; } declare const AckChunk_base: Schema.TaggedClass; } & { id: Schema.Schema; address: typeof EntityAddress; requestId: Schema.Schema; replyId: Schema.Schema; }>; /** * @since 1.0.0 * @category models */ export declare class AckChunk extends AckChunk_base { /** * @since 1.0.0 */ readonly [TypeId]: TypeId; /** * @since 1.0.0 */ withRequestId(requestId: Snowflake): AckChunk; } declare const Interrupt_base: Schema.TaggedClass; } & { id: Schema.Schema; address: typeof EntityAddress; requestId: Schema.Schema; }>; /** * @since 1.0.0 * @category models */ export declare class Interrupt extends Interrupt_base { /** * @since 1.0.0 */ readonly [TypeId]: TypeId; /** * @since 1.0.0 */ withRequestId(requestId: Snowflake): Interrupt; } /** * @since 1.0.0 */ export declare namespace Request { /** * @since 1.0.0 * @category models */ type Any = Request; /** * @since 1.0.0 * @category models */ interface Encoded { readonly _tag: "Request"; readonly requestId: string; readonly address: typeof EntityAddress.Encoded; readonly tag: string; readonly payload: unknown; readonly headers: ReadonlyRecord; readonly traceId?: string | undefined; readonly spanId?: string | undefined; readonly sampled?: boolean | undefined; } /** * @since 1.0.0 * @category models */ interface PartialEncoded { readonly _tag: "Request"; readonly requestId: Snowflake; readonly address: EntityAddress; readonly tag: string; readonly payload: unknown; readonly headers: Headers.Headers; readonly traceId?: string | undefined; readonly spanId?: string | undefined; readonly sampled?: boolean | undefined; } } /** * @since 1.0.0 * @category refinements */ export declare const isEnvelope: (u: unknown) => u is Envelope; /** * @since 1.0.0 * @category constructors */ export declare const makeRequest: (options: { readonly requestId: Snowflake; readonly address: EntityAddress; readonly tag: Rpc.Tag; readonly payload: Rpc.Payload; readonly headers: Headers.Headers; readonly traceId?: string | undefined; readonly spanId?: string | undefined; readonly sampled?: boolean | undefined; }) => Request; /** * @since 1.0.0 * @category serialization / deserialization */ export declare const EnvelopeFromSelf: Schema.Schema; /** * @since 1.0.0 * @category serialization / deserialization */ export declare const RequestFromSelf: Schema.Schema; /** * @since 1.0.0 * @category serialization / deserialization */ export declare const PartialEncodedRequest: Schema.Struct<{ _tag: Schema.Literal<["Request"]>; requestId: Schema.Schema; address: typeof EntityAddress; tag: typeof Schema.String; payload: typeof Schema.Unknown; headers: Schema.Schema>; traceId: Schema.optional; spanId: Schema.optional; sampled: Schema.optional; }>; /** * @since 1.0.0 * @category serialization / deserialization */ export declare const PartialEncoded: Schema.Union<[ Schema.Struct<{ _tag: Schema.Literal<["Request"]>; requestId: Schema.Schema; address: typeof EntityAddress; tag: typeof Schema.String; payload: typeof Schema.Unknown; headers: Schema.Schema>; traceId: Schema.optional; spanId: Schema.optional; sampled: Schema.optional; }>, typeof AckChunk, typeof Interrupt ]>; /** * @since 1.0.0 * @category serialization / deserialization */ export declare const PartialEncodedArray: Schema.Schema, Array>; /** * @since 1.0.0 * @category serialization / deserialization */ export declare const PartialEncodedRequestFromSelf: Schema.Struct<{ _tag: Schema.Literal<["Request"]>; requestId: Schema.Schema; address: Schema.Schema; tag: typeof Schema.String; payload: typeof Schema.Unknown; headers: Schema.Schema; traceId: Schema.optional; spanId: Schema.optional; sampled: Schema.optional; }>; /** * @since 1.0.0 * @category serialization / deserialization */ export declare const PartialEncodedFromSelf: Schema.Union<[ Schema.Struct<{ _tag: Schema.Literal<["Request"]>; requestId: Schema.Schema; address: Schema.Schema; tag: typeof Schema.String; payload: typeof Schema.Unknown; headers: Schema.Schema; traceId: Schema.optional; spanId: Schema.optional; sampled: Schema.optional; }>, Schema.Schema, Schema.Schema ]>; /** * @since 1.0.0 * @category primary key */ export declare const primaryKey: (envelope: Envelope) => string | null; /** * @since 1.0.0 * @category primary key */ export declare const primaryKeyByAddress: (options: { readonly address: EntityAddress; readonly tag: string; readonly id: string; }) => string; export {}; //# sourceMappingURL=Envelope.d.ts.map