EventLogMessage.ts
EventLogMessage.ts overview
Section titled “EventLogMessage.ts overview”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
Exports Grouped by Category
Section titled “Exports Grouped by Category”- StoreId
- middleware
- protocols
- Authenticate (class)
- AuthenticateRpc (class)
- ChangesRpc (class)
- ChunkedMessage (class)
- EventLogProtocolError (class)
- EventLogRemoteRpcs (class)
- HelloResponse (class)
- HelloRpc (class)
- SingleMessage (class)
- WriteChunkedRpc (class)
- WriteEntries (class)
- WriteEntriesUnencrypted (class)
- WriteSingleRpc (class)
- type IDs
StoreId
Section titled “StoreId”StoreId
Section titled “StoreId”Schema for branded event-log store ids.
Signature
declare const StoreId: Schema.brand<Schema.String, "effect/eventlog/EventLog/StoreId">Since v4.0.0
StoreId (type alias)
Section titled “StoreId (type alias)”Branded string identifying a logical event-log store.
Signature
type StoreId = string & Brand<StoreIdTypeId>Since v4.0.0
middleware
Section titled “middleware”EventLogAuthentication (class)
Section titled “EventLogAuthentication (class)”RPC middleware that authenticates event-log requests and provides the client
Identity to authenticated handlers.
Signature
declare class EventLogAuthenticationSince v4.0.0
protocols
Section titled “protocols”Authenticate (class)
Section titled “Authenticate (class)”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 AuthenticateSince v4.0.0
AuthenticateRpc (class)
Section titled “AuthenticateRpc (class)”RPC used to authenticate a remote event-log session after HelloRpc.
Signature
declare class AuthenticateRpcSince v4.0.0
ChangesRpc (class)
Section titled “ChangesRpc (class)”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 ChangesRpcSince v4.0.0
ChunkedMessage (class)
Section titled “ChunkedMessage (class)”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 ChunkedMessageSince v4.0.0
initialJoinState (static method)
Section titled “initialJoinState (static method)”Signature
declare const initialJoinState: () => Map<number, { readonly parts: Array<Uint8Array>; count: number; bytes: number }>split (static method)
Section titled “split (static method)”Splits binary event-log message data into numbered chunks.
Signature
declare const split: (id: number, data: Uint8Array) => NonEmptyReadonlyArray<ChunkedMessage>Since v4.0.0
join (static method)
Section titled “join (static method)”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> | undefinedSince v4.0.0
EventLogProtocolError (class)
Section titled “EventLogProtocolError (class)”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 EventLogProtocolErrorSince v4.0.0
EventLogRemoteRpcs (class)
Section titled “EventLogRemoteRpcs (class)”RPC group containing the event-log remote handshake, authentication, write, and changes endpoints.
Signature
declare class EventLogRemoteRpcsSince v4.0.0
HelloResponse (class)
Section titled “HelloResponse (class)”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 HelloResponseSince v4.0.0
HelloRpc (class)
Section titled “HelloRpc (class)”RPC used to start an event-log remote session and receive a HelloResponse.
Signature
declare class HelloRpcSince v4.0.0
SingleMessage (class)
Section titled “SingleMessage (class)”Represents an entire encoded event-log payload in one transport frame.
Signature
declare class SingleMessageSince v4.0.0
WriteChunkedRpc (class)
Section titled “WriteChunkedRpc (class)”RPC used to send one chunk of a large encoded write payload.
Signature
declare class WriteChunkedRpcSince v4.0.0
WriteEntries (class)
Section titled “WriteEntries (class)”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 WriteEntriesSince v4.0.0
WriteEntriesUnencrypted (class)
Section titled “WriteEntriesUnencrypted (class)”Schema for plaintext event-log write payloads sent to a remote store.
Signature
declare class WriteEntriesUnencryptedSince v4.0.0
WriteSingleRpc (class)
Section titled “WriteSingleRpc (class)”RPC used to send an encoded write payload that fits in one message.
Signature
declare class WriteSingleRpcSince v4.0.0
type IDs
Section titled “type IDs”StoreIdTypeId
Section titled “StoreIdTypeId”Runtime brand identifier for event-log store ids.
Signature
declare const StoreIdTypeId: "effect/eventlog/EventLog/StoreId"Since v4.0.0
StoreIdTypeId (type alias)
Section titled “StoreIdTypeId (type alias)”Type-level identifier used to brand event-log store ids.
Signature
type StoreIdTypeId = "effect/eventlog/EventLog/StoreId"Since v4.0.0