/** * @license * Copyright 2025 Steven Roussey * SPDX-License-Identifier: Apache-2.0 */ import { DataPortSchemaObject, FromSchema, TypedArraySchemaOptions } from "@workglow/util/schema"; import { type ITabularMigration, type ITabularMigrationApplier } from "../migrations"; import { BaseTabularStorage, ClientProvidedKeysOption, KeyGenerationStrategy } from "./BaseTabularStorage"; import { AnyTabularStorage, AutoGeneratedKeys, CoveringIndexQueryOptions, DeleteSearchCriteria, InsertEntity, QueryOptions, SearchCriteria, SimplifyPrimaryKey, TabularChangePayload, TabularSubscribeOptions } from "./ITabularStorage"; export declare const MEMORY_TABULAR_REPOSITORY: import("@workglow/util").ServiceToken; /** Non-persistent tabular storage backed by a `Map` keyed by row fingerprint. */ export declare class InMemoryTabularStorage, Entity = FromSchema, PrimaryKey = SimplifyPrimaryKey, Value = Omit, InsertType extends InsertEntity> = InsertEntity>> extends BaseTabularStorage { values: Map; private autoIncrementCounter; /** Tracks whether the last put was an insert vs update — read by subscribeToChanges. */ private _lastPutWasInsert; constructor(schema: Schema, primaryKeyNames: PrimaryKeyNames, indexes?: readonly (keyof NoInfer | readonly (keyof NoInfer)[])[], clientProvidedKeys?: ClientProvidedKeysOption, tabularMigrations?: ReadonlyArray, migrationName?: string, uniqueIndexes?: readonly (readonly (keyof NoInfer)[])[]); setupDatabase(): Promise; /** In-memory rows do not survive a process restart. */ isDurable(): boolean; getMigrationApplier(): ITabularMigrationApplier | null; protected generateKeyValue(columnName: string, strategy: KeyGenerationStrategy): string | number; put(value: InsertType): Promise; putBulk(values: InsertType[]): Promise; /** * Scan the row Map and reject `entityToStore` if any *other* row (different * fingerprint id) already shares the same value tuple for any declared * unique-index tuple. Matches the DB-level `CREATE UNIQUE INDEX` semantics * the SQLite/Postgres backends emit so contract tests can exercise the * constraint without standing up a real DB. */ private assertUniqueIndexes; /** * Capture the mutable state required to roll back a batch op: the row * entries (a clone of the live `Map`) and the autoincrement counter. The * result is opaque to callers; pair with {@link restoreMutableState}. */ protected snapshotMutableState(): { readonly entries: ReadonlyArray; readonly counter: number; }; /** * Restore the row Map and autoincrement counter from a prior * {@link snapshotMutableState} result. Used by atomic batch overrides * (vector `putBulk`) to undo partial writes when a mid-batch error fires. */ protected restoreMutableState(snapshot: { readonly entries: ReadonlyArray; readonly counter: number; }): void; get(key: PrimaryKey): Promise; delete(value: PrimaryKey | Entity): Promise; deleteAll(): Promise; getAll(options?: QueryOptions): Promise; size(): Promise; getOffsetPage(offset: number, limit: number): Promise; deleteSearch(criteria: DeleteSearchCriteria): Promise; query(criteria: SearchCriteria, options?: QueryOptions): Promise; queryIndex(criteria: SearchCriteria, options: CoveringIndexQueryOptions): Promise[]>; /** InMemory is both client and server, so changes flow through local events. */ subscribeToChanges(callback: (change: TabularChangePayload) => void, options?: TabularSubscribeOptions): () => void; destroy(): void; } //# sourceMappingURL=InMemoryTabularStorage.d.ts.map