Skip to content

@codesoul-co/hypha-memory / structured-memory-persistence

Using this module

Use the Structured memory persistence module for persisting and reading data at this boundary. It exports 2 classes, 2 interfaces.

Import from the package entrypoint

ts
import {
  StructuredMemoryIndexOutboxStore,
  StructuredMemoryPersistenceUnitOfWork,
} from '@codesoul-co/hypha-memory';

import type {
  StructuredMemoryIndexOutboxStoreOptions,
  StructuredMemoryPersistenceUnitOfWorkOptions,
} from '@codesoul-co/hypha-memory';

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 2 classes as constructable runtime implementations. Each symbol entry lists its constructor and public methods.

Public exports

SymbolKindSignatureDescription
StructuredMemoryIndexOutboxStoreclassnew StructuredMemoryIndexOutboxStore(options: StructuredMemoryIndexOutboxStoreOptions): StructuredMemoryIndexOutboxStoreStructured Memory Index Outbox Store class with 8 public constructor or member entries; its exact declarations are listed below.
StructuredMemoryPersistenceUnitOfWorkclassnew StructuredMemoryPersistenceUnitOfWork(options: StructuredMemoryPersistenceUnitOfWorkOptions): StructuredMemoryPersistenceUnitOfWorkStructured Memory Persistence Unit Of Work class with 5 public constructor or member entries; its exact declarations are listed below.
StructuredMemoryIndexOutboxStoreOptionsinterfaceinterface StructuredMemoryIndexOutboxStoreOptionsStructured Memory Index Outbox Store Options interface with 3 public fields or methods.
StructuredMemoryPersistenceUnitOfWorkOptionsinterfaceinterface StructuredMemoryPersistenceUnitOfWorkOptionsStructured Memory Persistence Unit Of Work Options interface with 4 public fields or methods.

StructuredMemoryIndexOutboxStore

Structured Memory Index Outbox Store class with 8 public constructor or member entries; its exact declarations are listed below.

Declaration

text
export declare class StructuredMemoryIndexOutboxStore implements MemoryIndexOutboxStore {
    constructor(options: StructuredMemoryIndexOutboxStoreOptions);
    enqueue(record: MemoryIndexOutboxRecord): Promise<void>;
    lease(owner: string, now: string, leaseUntil: string, limit: number): Promise<MemoryIndexOutboxRecord[]>;
    renew(id: string, owner: string, leaseToken: string, now: string, leaseUntil: string): Promise<boolean>;
    complete(id: string, owner: string, leaseToken: string, now: string): Promise<boolean>;
    fail(id: string, owner: string, leaseToken: string, now: string, error: NormalizedMemoryError, retryAt: string, deadLetter?: boolean): Promise<boolean>;
    list(): Promise<MemoryIndexOutboxRecord[]>;
    transaction<T>(fn: (store: MemoryIndexOutboxStore) => Promise<T>): Promise<T>;
}

Public members

MemberKindSignatureDescription
completemethodcomplete(id: string, owner: string, leaseToken: string, now: string): Promise<boolean>Public method; parameters and return type are shown in the signature.
constructorconstructor(options: StructuredMemoryIndexOutboxStoreOptions): StructuredMemoryIndexOutboxStoreCreates an instance of this class.
enqueuemethodenqueue(record: MemoryIndexOutboxRecord): Promise<void>Public method; parameters and return type are shown in the signature.
failmethodfail(id: string, owner: string, leaseToken: string, now: string, error: NormalizedMemoryError, retryAt: string, deadLetter?: boolean): Promise<boolean>Public method; parameters and return type are shown in the signature.
leasemethodlease(owner: string, now: string, leaseUntil: string, limit: number): Promise<MemoryIndexOutboxRecord[]>Public method; parameters and return type are shown in the signature.
listmethodlist(): Promise<MemoryIndexOutboxRecord[]>Public method; parameters and return type are shown in the signature.
renewmethodrenew(id: string, owner: string, leaseToken: string, now: string, leaseUntil: string): Promise<boolean>Public method; parameters and return type are shown in the signature.
transactionmethodtransaction<T>(fn: (store: MemoryIndexOutboxStore) => Promise<T>): Promise<T>Public method; parameters and return type are shown in the signature.

StructuredMemoryPersistenceUnitOfWork

Structured Memory Persistence Unit Of Work class with 5 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { StructuredMemoryPersistenceUnitOfWork } from '@codesoul-co/hypha-memory';
  • Source module: structured-memory-persistence

Declaration

text
export declare class StructuredMemoryPersistenceUnitOfWork implements MemoryPersistenceUnitOfWork {
    readonly capabilities: MemoryPersistenceCapabilities;
    readonly recordStore: StructuredManagedMemoryRecordStore;
    readonly outboxStore: StructuredMemoryIndexOutboxStore;
    constructor(options: StructuredMemoryPersistenceUnitOfWorkOptions);
    transaction<T>(fn: (stores: MemoryPersistenceTransaction) => Promise<T>): Promise<T>;
}

Public members

MemberKindSignatureDescription
capabilitiespropertyreadonly capabilities: MemoryPersistenceCapabilitiesPublic property; its type, readonly modifier and optionality are shown in the signature.
constructorconstructor(options: StructuredMemoryPersistenceUnitOfWorkOptions): StructuredMemoryPersistenceUnitOfWorkCreates an instance of this class.
outboxStorepropertyreadonly outboxStore: StructuredMemoryIndexOutboxStorePublic property; its type, readonly modifier and optionality are shown in the signature.
recordStorepropertyreadonly recordStore: StructuredManagedMemoryRecordStorePublic property; its type, readonly modifier and optionality are shown in the signature.
transactionmethodtransaction<T>(fn: (stores: MemoryPersistenceTransaction) => Promise<T>): Promise<T>Public method; parameters and return type are shown in the signature.

StructuredMemoryIndexOutboxStoreOptions

Structured Memory Index Outbox Store Options interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { StructuredMemoryIndexOutboxStoreOptions } from '@codesoul-co/hypha-memory';
  • Source module: structured-memory-persistence

Declaration

text
export interface StructuredMemoryIndexOutboxStoreOptions {
    provider: StructuredStoreProvider;
    table?: string;
    inTransaction?: boolean;
}

Contract members

MemberKindSignatureDescription
inTransactionpropertyinTransaction?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
providerpropertyprovider: StructuredStoreProviderPublic property; its type, readonly modifier and optionality are shown in the signature.
tablepropertytable?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

StructuredMemoryPersistenceUnitOfWorkOptions

Structured Memory Persistence Unit Of Work Options interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { StructuredMemoryPersistenceUnitOfWorkOptions } from '@codesoul-co/hypha-memory';
  • Source module: structured-memory-persistence

Declaration

text
export interface StructuredMemoryPersistenceUnitOfWorkOptions {
    provider: StructuredStoreProvider;
    currentTable?: string;
    versionsTable?: string;
    outboxTable?: string;
}

Contract members

MemberKindSignatureDescription
currentTablepropertycurrentTable?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
outboxTablepropertyoutboxTable?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
providerpropertyprovider: StructuredStoreProviderPublic property; its type, readonly modifier and optionality are shown in the signature.
versionsTablepropertyversionsTable?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.