import * as Context from "../Context.ts"; import * as Effect from "../Effect.ts"; import * as Layer from "../Layer.ts"; import type * as Rpc from "../rpc/Rpc.ts"; import type * as RpcGroup from "../rpc/RpcGroup.ts"; import * as Stream from "../Stream.ts"; import type { EntryId, RemoteId } from "./EventJournal.ts"; import { EventLogAuthentication, EventLogProtocolError, EventLogRemoteRpcs, type StoreId, type WriteAck } from "./EventLogMessage.ts"; /** * Provides RPC authentication middleware that reads the authenticated * `EventLog.Identity` from client annotations. * * **Details** * * Requests without an identity fail with a forbidden `EventLogProtocolError`. * * @stability unstable * @category layers * @since 4.0.0 */ export declare const layerAuthMiddleware: Layer.Layer; /** * Creates the shared RPC handlers for the event-log remote protocol. * * **Details** * * The layer manages hello challenges, verifies session authentication, reassembles * chunked writes, delegates write and change handling to the supplied callbacks, * and frames large change payloads into chunks. * * Use the connection's `ConnectionWrites.track` in `onWrite` and * `ConnectionWrites.filter` in `changes` to suppress its own write echoes. * * @stability unstable * @category layers * @since 4.0.0 */ export declare const layerRpcHandlers: (options: { readonly remoteId: RemoteId; readonly firstSequence?: number | undefined; readonly authorizeIdentity?: (publicKey: string) => Effect.Effect; readonly getOrCreateSessionAuthBinding: (publicKey: string, signingPublicKey: Uint8Array) => Effect.Effect>; readonly onWrite: (data: Uint8Array, authenticatedPublicKeys: ReadonlySet, writes: ConnectionWrites) => Effect.Effect, EventLogProtocolError>; readonly changes: (options: { readonly publicKey: string; readonly storeId: StoreId; readonly startSequence: number; readonly writes: ConnectionWrites; }) => Stream.Stream, unknown>; }) => Layer.Layer> | EventLogAuthentication>; declare const ChunkedMessageState_base: Context.Reference; count: number; bytes: number; }>>; /** * Annotation that stores partial `ChunkedMessage` data while chunked writes are * being reassembled. * * **When to use** * * Use to keep per-client chunk assembly state while handling chunked event-log * writes. * * @stability unstable * @category services * @since 4.0.0 */ export declare class ChunkedMessageState extends ChunkedMessageState_base { } /** * Tracks writes to suppress their echoes on the same RPC connection. * * **Details** * * Only tracks entries for stores with an open change stream. * * @stability unstable * @category models * @since 4.0.6 */ export declare class ConnectionWrites { private readonly streams; /** * Runs a storage write while suppressing its entries on this connection's streams. * * @stability unstable * @since 4.0.6 */ track(options: { readonly publicKey: string; readonly storeId: StoreId; readonly entryIds: ReadonlyArray; }, write: Effect.Effect, E, R>): Effect.Effect, E, R>; /** * Filters this connection's writes from a store's change stream. An item can * hold several entries; `sequence` returns its highest one. * * @stability unstable * @since 4.0.6 */ filter(options: { readonly publicKey: string; readonly storeId: StoreId; readonly entryIds: (item: A) => ReadonlyArray; readonly sequence: (item: A) => number; }, stream: Stream.Stream): Stream.Stream; } declare const AuthenticatedIdentities_base: Context.ServiceClass>; /** * Annotation containing the public keys authenticated on an RPC connection. * * @stability unstable * @category services * @since 4.0.0 */ export declare class AuthenticatedIdentities extends AuthenticatedIdentities_base { } export {}; //# sourceMappingURL=EventLogServer.d.ts.map