/** * @since 1.0.0 */ import * as MsgPack from "@effect/platform/MsgPack"; import * as Context from "effect/Context"; import * as DateTime from "effect/DateTime"; import * as Effect from "effect/Effect"; import * as Layer from "effect/Layer"; import type * as Queue from "effect/Queue"; import * as Schema from "effect/Schema"; import type { Scope } from "effect/Scope"; declare const EventJournal_base: Context.TagClass, EventJournalError>; /** * Write an event to the journal, performing an effect before committing the * event. */ readonly write: (options: { readonly event: string; readonly primaryKey: string; readonly payload: Uint8Array; readonly effect: (entry: Entry) => Effect.Effect; }) => Effect.Effect; /** * Write events from a remote source to the journal. */ readonly writeFromRemote: (options: { readonly remoteId: RemoteId; readonly entries: ReadonlyArray; readonly compact?: ((uncommitted: ReadonlyArray) => Effect.Effect, remoteEntries: ReadonlyArray]>, EventJournalError>) | undefined; readonly effect: (options: { readonly entry: Entry; readonly conflicts: ReadonlyArray; }) => Effect.Effect; }) => Effect.Effect; /** * Return the uncommitted entries for a remote source. */ readonly withRemoteUncommited: (remoteId: RemoteId, f: (entries: ReadonlyArray) => Effect.Effect) => Effect.Effect; /** * Retrieve the last known sequence number for a remote source. */ readonly nextRemoteSequence: (remoteId: RemoteId) => Effect.Effect; /** * The entries added to the local journal. */ readonly changes: Effect.Effect, never, Scope>; /** * Remove all data */ readonly destroy: Effect.Effect; }>; /** * @since 1.0.0 * @category tags */ export declare class EventJournal extends EventJournal_base { } /** * @since 1.0.0 * @category errors */ export declare const ErrorTypeId: unique symbol; /** * @since 1.0.0 * @category errors */ export type ErrorTypeId = typeof ErrorTypeId; declare const EventJournalError_base: Schema.TaggedClass; } & { method: typeof Schema.String; cause: typeof Schema.Defect; }>; /** * @since 1.0.0 * @category errors */ export declare class EventJournalError extends EventJournalError_base { /** * @since 1.0.0 */ readonly [ErrorTypeId]: ErrorTypeId; } /** * @since 1.0.0 * @category remote */ export declare const RemoteIdTypeId: unique symbol; /** * @since 1.0.0 * @category remote */ export declare const RemoteId: Schema.brand; /** * @since 1.0.0 * @category remote */ export type RemoteId = typeof RemoteId.Type; /** * @since 1.0.0 * @category remote */ export declare const makeRemoteId: () => RemoteId; /** * @since 1.0.0 * @category entry */ export declare const EntryIdTypeId: unique symbol; /** * @since 1.0.0 * @category entry */ export declare const EntryId: Schema.brand; /** * @since 1.0.0 * @category entry */ export type EntryId = typeof EntryId.Type; /** * @since 1.0.0 * @category entry */ export declare const makeEntryId: (options?: { msecs?: number; }) => EntryId; /** * @since 1.0.0 * @category entry */ export declare const entryIdMillis: (entryId: EntryId) => number; declare const Entry_base: Schema.Class; event: typeof Schema.String; primaryKey: typeof Schema.String; payload: typeof Schema.Uint8ArrayFromSelf; }, Schema.Struct.Encoded<{ id: Schema.brand; event: typeof Schema.String; primaryKey: typeof Schema.String; payload: typeof Schema.Uint8ArrayFromSelf; }>, never, { readonly id: Uint8Array & import("effect/Brand").Brand; } & { readonly event: string; } & { readonly primaryKey: string; } & { readonly payload: Uint8Array; }, {}, {}>; /** * @since 1.0.0 * @category entry */ export declare class Entry extends Entry_base { /** * @since 1.0.0 */ static arrayMsgPack: Schema.Array$>; /** * @since 1.0.0 */ static encodeArray: (a: readonly Entry[], overrideOptions?: import("effect/SchemaAST").ParseOptions) => Effect.Effect[], import("effect/ParseResult").ParseError, never>; /** * @since 1.0.0 */ static decodeArray: (i: readonly Uint8Array[], overrideOptions?: import("effect/SchemaAST").ParseOptions) => Effect.Effect; /** * @since 1.0.0 */ get idString(): string; /** * @since 1.0.0 */ get createdAtMillis(): number; /** * @since 1.0.0 */ get createdAt(): DateTime.Utc; } declare const RemoteEntry_base: Schema.Class, never, { readonly remoteSequence: number; } & { readonly entry: Entry; }, {}, {}>; /** * @since 1.0.0 * @category entry */ export declare class RemoteEntry extends RemoteEntry_base { } /** * @since 1.0.0 * @category memory */ export declare const makeMemory: Effect.Effect; /** * @since 1.0.0 * @category memory */ export declare const layerMemory: Layer.Layer; /** * @since 1.0.0 * @category indexed db */ export declare const makeIndexedDb: (options?: { readonly database?: string; }) => Effect.Effect; /** * @since 1.0.0 * @category indexed db */ export declare const layerIndexedDb: (options?: { readonly database?: string; }) => Layer.Layer; export {}; //# sourceMappingURL=EventJournal.d.ts.map