import * as Context from "../Context.ts"; import * as Effect from "../Effect.ts"; import * as Layer from "../Layer.ts"; import * as Queue from "../Queue.ts"; import * as RpcClient from "../rpc/RpcClient.ts"; import type { RpcClientError } from "../rpc/RpcClientError.ts"; import type * as Schema from "../Schema.ts"; import type * as Scope from "../Scope.ts"; import { type Entry, type EventJournal, type EventJournalError, RemoteEntry, type RemoteId } from "./EventJournal.ts"; import { type Identity, Registry } from "./EventLog.ts"; import { EventLogEncryption } from "./EventLogEncryption.ts"; import { ChunkedMessage, EventLogProtocolError, type HelloResponse, type StoreId, type WriteAck } from "./EventLogMessage.ts"; declare const EventLogRemote_base: Context.ServiceClass Effect.Effect, never, Scope.Scope>; readonly write: (options: { readonly identity: Identity["Service"]; readonly storeId: StoreId; readonly entries: ReadonlyArray; }) => Effect.Effect | void, EventLogRemoteError>; readonly whenAuthenticated: (effect: Effect.Effect) => Effect.Effect; }>; /** * Service that represents a remote event-log replica. * * **When to use** * * Use to access or provide a remote event-log replica that can write local * entries and stream remote changes. * * **Details** * * It can write local entries to the remote, stream remote changes from a sequence * number, and run effects only after the supplied identity has authenticated. * * Built-in remotes acknowledge writes instead of echoing them through `changes`. * Custom remotes may return `void` from `write` to confirm uploads through * `changes` instead. * * @stability unstable * @category services * @since 4.0.0 */ export declare class EventLogRemote extends EventLogRemote_base { } declare const EventLogRemoteError_base: new = {}>(args: import("../Types.ts").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("../Cause.ts").YieldableError & { readonly _tag: "EventLogRemoteError"; } & Readonly; /** * Error raised by `EventLogRemote` operations, recording the failed method and * underlying cause. * * @stability unstable * @category errors * @since 4.0.0 */ export declare class EventLogRemoteError extends EventLogRemoteError_base<{ readonly method: string; readonly cause: unknown; }> { /** * Returns `true` when the value is an `EventLogRemoteError`. * * @stability unstable * @since 4.0.0 */ static is(u: unknown): u is EventLogRemoteError; } declare const EventLogRemoteClient_base: Context.ServiceClass(input: { readonly publicKey: string; readonly signingPublicKey: Uint8Array; readonly signature: Uint8Array; readonly algorithm: "Ed25519"; }, options?: { readonly headers?: import("../http/Headers.ts").Input | undefined; readonly context?: Context.Context | undefined; readonly discard?: Discard | undefined; } | undefined) => Effect.Effect; readonly "EventLog.Changes": (input: { readonly publicKey: string; readonly storeId: string & import("../Brand.ts").Brand<"effect/eventlog/EventLog/StoreId">; readonly startSequence: number; }, options?: { readonly asQueue?: AsQueue | undefined; readonly streamBufferSize?: number | undefined; readonly headers?: import("../http/Headers.ts").Input | undefined; readonly context?: Context.Context | undefined; } | undefined) => AsQueue extends true ? Effect.Effect | EventLogProtocolError | RpcClientError>, never, Scope.Scope> : import("../Stream.ts").Stream; readonly "EventLog.Hello": (input: void, options?: { readonly headers?: import("../http/Headers.ts").Input | undefined; readonly context?: Context.Context | undefined; readonly discard?: Discard | undefined; } | undefined) => Effect.Effect; readonly "EventLog.WriteChunked": (input: { readonly _tag?: "Chunked"; readonly id: number; readonly part: readonly [number, number]; readonly data: Uint8Array; }, options?: { readonly headers?: import("../http/Headers.ts").Input | undefined; readonly context?: Context.Context | undefined; readonly discard?: Discard | undefined; } | undefined) => Effect.Effect & import("../Brand.ts").Brand<"effect/eventlog/EventJournal/EntryId">; readonly sequence: number; }[], EventLogProtocolError | RpcClientError | (Discard extends true ? never : EventLogProtocolError), never>; readonly "EventLog.WriteSingle": (input: { readonly data: Uint8Array; }, options?: { readonly headers?: import("../http/Headers.ts").Input | undefined; readonly context?: Context.Context | undefined; readonly discard?: Discard | undefined; } | undefined) => Effect.Effect & import("../Brand.ts").Brand<"effect/eventlog/EventJournal/EntryId">; readonly sequence: number; }[], EventLogProtocolError | RpcClientError | (Discard extends true ? never : EventLogProtocolError), never>; }>; /** * Service that provides a typed RPC client for the `EventLogRemoteRpcs` protocol. * * **When to use** * * Use to provide the RPC client used by remote event-log replicas to * authenticate, write entries, and subscribe to changes. * * @stability unstable * @category services * @since 4.0.0 */ export declare class EventLogRemoteClient extends EventLogRemoteClient_base { static readonly layer: Layer.Layer; } /** * Creates an `EventLogRemote` from custom write encoding and change decoding * functions. * * **Details** * * The remote performs the hello/authentication handshake, retries after forbidden * responses by re-authenticating, chunks large writes, and registers itself with * the `Registry` for the current scope. * * @stability unstable * @category constructors * @since 4.0.0 */ export declare const makeWith: (args_0: { readonly encodeWrite: (options: { readonly identity: Identity["Service"]; readonly entries: ReadonlyArray; readonly storeId: StoreId; }) => Effect.Effect, Schema.SchemaError>; readonly decodeChanges: (identity: Identity["Service"], storeId: StoreId, data: Uint8Array, knownEntries?: EventJournal["Service"]["entriesById"]) => Effect.Effect, Schema.SchemaError | EventJournalError>; }) => Effect.Effect<{ readonly id: RemoteId; /** * The lowest sequence the remote assigns, or 0 when omitted. */ readonly firstSequence?: number | undefined; readonly changes: (options: { readonly identity: Identity["Service"]; readonly storeId: StoreId; readonly startSequence: number; /** * Looks up locally stored entries by id, so the remote can reuse them * instead of decoding the matching changes. */ readonly knownEntries?: EventJournal["Service"]["entriesById"] | undefined; }) => Effect.Effect, never, Scope.Scope>; readonly write: (options: { readonly identity: Identity["Service"]; readonly storeId: StoreId; readonly entries: ReadonlyArray; }) => Effect.Effect | void, EventLogRemoteError>; readonly whenAuthenticated: (effect: Effect.Effect) => Effect.Effect; }, EventLogRemoteError, EventLogRemoteClient | Registry | Scope.Scope>; /** * Creates an `EventLogRemote` that encrypts outgoing entries and decrypts * incoming changes with `EventLogEncryption`. * * @stability unstable * @category constructors * @since 4.0.0 */ export declare const makeEncrypted: Effect.Effect<{ readonly id: RemoteId; /** * The lowest sequence the remote assigns, or 0 when omitted. */ readonly firstSequence?: number | undefined; readonly changes: (options: { readonly identity: Identity["Service"]; readonly storeId: StoreId; readonly startSequence: number; /** * Looks up locally stored entries by id, so the remote can reuse them * instead of decoding the matching changes. */ readonly knownEntries?: EventJournal["Service"]["entriesById"] | undefined; }) => Effect.Effect, never, Scope.Scope>; readonly write: (options: { readonly identity: Identity["Service"]; readonly storeId: StoreId; readonly entries: ReadonlyArray; }) => Effect.Effect | void, EventLogRemoteError>; readonly whenAuthenticated: (effect: Effect.Effect) => Effect.Effect; }, EventLogRemoteError, EventLogEncryption | EventLogRemoteClient | Registry | Scope.Scope>; /** * Creates an `EventLogRemote` that sends and receives plaintext entry payloads. * * @stability unstable * @category constructors * @since 4.0.0 */ export declare const makeUnencrypted: Effect.Effect; /** * Provides an encrypted `EventLogRemote` using the remote RPC client and the * default Web Crypto encryption layer. * * @stability unstable * @category layers * @since 4.0.0 */ export declare const layerEncrypted: Layer.Layer; /** * Provides an unencrypted `EventLogRemote` using the remote RPC client. * * @stability unstable * @category layers * @since 4.0.0 */ export declare const layerUnencrypted: Layer.Layer; export {}; //# sourceMappingURL=EventLogRemote.d.ts.map