Skip to content

@codesoul-co/hypha-adapters-local / runtime-event-store

Using this module

Use the Runtime event store module for creating, recording, or reading Event contracts. It exports 1 class, 2 interfaces.

Import from the package entrypoint

ts
import {
  SQLiteDurableEventStore,
} from '@codesoul-co/hypha-adapters-local';

import type {
  SQLiteDurableEventStoreOptions,
  SQLiteImportedEventResetResult,
} from '@codesoul-co/hypha-adapters-local';

Usage patterns

  • Use the 2 type/interface exports as static contracts in application code, adapters, or tests. Import them with import type; they do not exist at runtime.
  • The module exposes 1 class as constructable runtime implementations. Each symbol entry lists its constructor and public methods.

Public exports

SymbolKindSignatureDescription
SQLiteDurableEventStoreclassnew SQLiteDurableEventStore(options: SQLiteDurableEventStoreOptions): SQLiteDurableEventStoreSQLite Durable Event Store class with 10 public constructor or member entries; its exact declarations are listed below.
SQLiteDurableEventStoreOptionsinterfaceinterface SQLiteDurableEventStoreOptionsSQLite Durable Event Store Options interface with 3 public fields or methods.
SQLiteImportedEventResetResultinterfaceinterface SQLiteImportedEventResetResultSQLite Imported Event Reset Result interface with 3 public fields or methods.

SQLiteDurableEventStore

SQLite Durable Event Store class with 10 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { SQLiteDurableEventStore } from '@codesoul-co/hypha-adapters-local';
  • Source module: runtime-event-store

Declaration

text
export declare class SQLiteDurableEventStore implements DurableEventStore, CanonicalEventScanPort {
    constructor(options: SQLiteDurableEventStoreOptions);
    append(request: EventAppendRequest): Promise<EventAppendResult>;
    readStream(scope: EventStreamScope, fromSequence?: number): Promise<PersistedFrameworkEvent[]>;
    readById(scope: EventStreamScope, eventId: string): Promise<PersistedFrameworkEvent | null>;
    getStreamHead(scope: EventStreamScope): Promise<EventStreamHead | null>;
    listStreamHeads(request?: ListEventStreamHeadsRequest): Promise<ListEventStreamHeadsResult>;
    health(): Promise<ProviderHealth>;
    resetUnauditedImportedEvents(): Promise<SQLiteImportedEventResetResult>;
    scanCanonicalEvents(request: ScanCanonicalEventsRequest): Promise<ScanCanonicalEventsResult>;
    close(): void;
}

Public members

MemberKindSignatureDescription
appendmethodappend(request: EventAppendRequest): Promise<EventAppendResult>Public method; parameters and return type are shown in the signature.
closemethodclose(): voidPublic method; parameters and return type are shown in the signature.
constructorconstructor(options: SQLiteDurableEventStoreOptions): SQLiteDurableEventStoreCreates an instance of this class.
getStreamHeadmethodgetStreamHead(scope: EventStreamScope): Promise<EventStreamHead | null>Public method; parameters and return type are shown in the signature.
healthmethodhealth(): Promise<ProviderHealth>Public method; parameters and return type are shown in the signature.
listStreamHeadsmethodlistStreamHeads(request?: ListEventStreamHeadsRequest): Promise<ListEventStreamHeadsResult>Public method; parameters and return type are shown in the signature.
readByIdmethodreadById(scope: EventStreamScope, eventId: string): Promise<PersistedFrameworkEvent | null>Public method; parameters and return type are shown in the signature.
readStreammethodreadStream(scope: EventStreamScope, fromSequence?: number): Promise<PersistedFrameworkEvent[]>Public method; parameters and return type are shown in the signature.
resetUnauditedImportedEventsmethodresetUnauditedImportedEvents(): Promise<SQLiteImportedEventResetResult>Clears only an incomplete compatibility import. A successful integrity watermark or any live/non-imported Event makes the operation fail closed.
scanCanonicalEventsmethodscanCanonicalEvents(request: ScanCanonicalEventsRequest): Promise<ScanCanonicalEventsResult>Public method; parameters and return type are shown in the signature.

SQLiteDurableEventStoreOptions

SQLite Durable Event Store Options interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { SQLiteDurableEventStoreOptions } from '@codesoul-co/hypha-adapters-local';
  • Source module: runtime-event-store

Declaration

text
export interface SQLiteDurableEventStoreOptions {
    filename: string;
    schemaRegistry: EventSchemaRegistry;
    now?: () => string;
}

Contract members

MemberKindSignatureDescription
filenamepropertyfilename: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
nowmethodnow?(): stringPublic method; parameters and return type are shown in the signature.
schemaRegistrypropertyschemaRegistry: EventSchemaRegistryPublic property; its type, readonly modifier and optionality are shown in the signature.

SQLiteImportedEventResetResult

SQLite Imported Event Reset Result interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { SQLiteImportedEventResetResult } from '@codesoul-co/hypha-adapters-local';
  • Source module: runtime-event-store

Declaration

text
export interface SQLiteImportedEventResetResult {
    reset: boolean;
    deletedEvents: number;
    reason: 'empty' | 'reset' | 'audited_history' | 'non_imported_events';
}

Contract members

MemberKindSignatureDescription
deletedEventspropertydeletedEvents: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
reasonpropertyreason: "empty" | "reset" | "audited_history" | "non_imported_events"Public property; its type, readonly modifier and optionality are shown in the signature.
resetpropertyreset: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.