Skip to content

EventLogMessage.ts

Defines protocol messages for event-log remote clients and servers.

This module is the shared boundary between EventLogRemote clients and event-log servers. It defines store ids, protocol errors, the hello/authenticate session handshake, remote calls for writes and changes, and message formats for encrypted or plaintext journal entries.

Since v4.0.0



Schema for branded event-log store ids.

Signature

declare const StoreId: Schema.brand<Schema.String, "effect/eventlog/EventLog/StoreId">

Source

Since v4.0.0

Branded string identifying a logical event-log store.

Signature

type StoreId = string & Brand<StoreIdTypeId>

Source

Since v4.0.0

RPC middleware that authenticates event-log requests and provides the client Identity to authenticated handlers.

Signature

declare class EventLogAuthentication

Source

Since v4.0.0

Schema for an authentication request containing the client public key, Ed25519 signing public key, signature over the session challenge payload, and algorithm name.

Signature

declare class Authenticate

Source

Since v4.0.0

RPC used to authenticate a remote event-log session after HelloRpc.

Signature

declare class AuthenticateRpc

Source

Since v4.0.0

RPC used to stream remote event-log changes for a public key and store id starting at a sequence number.

Details

Responses are encoded as either SingleMessage values or ChunkedMessage parts.

Signature

declare class ChangesRpc

Source

Since v4.0.0

Represents one part of a large encoded event-log payload.

When to use

Use to divide data into chunks and join to reassemble all chunks with the same id once every part has arrived.

Signature

declare class ChunkedMessage

Source

Since v4.0.0

Signature

declare const initialJoinState: () => Map<number, { readonly parts: Array<Uint8Array>; count: number; bytes: number }>

Source

Splits binary event-log message data into numbered chunks.

Signature

declare const split: (id: number, data: Uint8Array) => NonEmptyReadonlyArray<ChunkedMessage>

Source

Since v4.0.0

Reassembles all chunks for a message id into the original binary payload.

Signature

declare const join: (
map: Map<number, { readonly parts: Array<Uint8Array>; count: number; bytes: number }>,
part: ChunkedMessage
) => Uint8Array<ArrayBuffer> | undefined

Source

Since v4.0.0

Error returned by event-log remote RPCs.

Details

It records the request tag, optional identity and store information, a protocol error code, and a human-readable message.

Signature

declare class EventLogProtocolError

Source

Since v4.0.0

RPC group containing the event-log remote handshake, authentication, write, and changes endpoints.

Signature

declare class EventLogRemoteRpcs

Source

Since v4.0.0

Response sent by the remote server during the authentication handshake.

Details

It contains the server remote id and a challenge that must be signed by the client.

Signature

declare class HelloResponse

Source

Since v4.0.0

RPC used to start an event-log remote session and receive a HelloResponse.

Signature

declare class HelloRpc

Source

Since v4.0.0

Represents an entire encoded event-log payload in one transport frame.

Signature

declare class SingleMessage

Source

Since v4.0.0

RPC used to send one chunk of a large encoded write payload.

Signature

declare class WriteChunkedRpc

Source

Since v4.0.0

Schema for encrypted event-log write payloads sent to a remote store.

Details

It includes the client public key, target store id, AES-GCM initialization vector, and encrypted entries.

Signature

declare class WriteEntries

Source

Since v4.0.0

Schema for plaintext event-log write payloads sent to a remote store.

Signature

declare class WriteEntriesUnencrypted

Source

Since v4.0.0

RPC used to send an encoded write payload that fits in one message.

Signature

declare class WriteSingleRpc

Source

Since v4.0.0

Runtime brand identifier for event-log store ids.

Signature

declare const StoreIdTypeId: "effect/eventlog/EventLog/StoreId"

Source

Since v4.0.0

Type-level identifier used to brand event-log store ids.

Signature

type StoreIdTypeId = "effect/eventlog/EventLog/StoreId"

Source

Since v4.0.0