Classes

c
BaseRepository<Entity, Id extends EntityKey = string>(_dataSource: DataSource)

Shared repository implementation that normalizes options and delegates data operations to a DataSource.

c
BigtableAdapter(
options: BigtableAdapterOptions,
loader?: BigtableClientLoader
)

The Bigtable adapter.

c
BigtableTransactionScopeError(message: string)

Thrown when a Bigtable transaction is asked to write a second row.

  • name: string

    Discriminant for consumers that cannot use instanceof across realms.

c
CosmosAdapter(options: CosmosAdapterOptions)

The Cosmos adapter — an Azure Cosmos DB NoSQL-API backend.

c
CosmosConcurrentModificationError(message: string)

Thrown when a Cosmos update loses an optimistic-concurrency race.

  • name: string

    Discriminant for consumers that cannot use instanceof across realms.

c
CosmosTransactionScopeError(message: string)

Thrown when a Cosmos transaction is asked to do something a transactional batch cannot express.

  • name: string

    Discriminant for consumers that cannot use instanceof across realms.

c
DatabaseUnavailableError(
message: string,
options?: { cause?: unknown; }
)

Thrown when the database, its connection pool, or its network is temporarily unreachable (X35-2, M90f). The operation did not happen and may be retried.

  • name: string

    Discriminant for consumers that cannot use instanceof across realms.

c
DynamoAdapter(options: DynamoAdapterOptions)

The DynamoDB adapter — a key-value store backend served through the portable data-access contract.

c
MemoryAdapter

In-memory implementation of IDatabaseAdapter.

c
MongoAdapter(options: MongoAdapterOptions)

The Mongo adapter — a document-store backend over the native driver.

c
MongoTransactionUnavailableError(
message: string,
options?: ErrorOptions
)

Thrown by MongoAdapter.beginTransaction on a deployment without a replica set.

  • name: string

    Discriminant for consumers that cannot use instanceof across realms.

c
SerializationConflictError(
message: string,
options?: { cause?: unknown; }
)

Thrown when the database rejected a write because a concurrent transaction changed the same data (X38-1, M90f). The operation did not happen and may be retried.

  • name: string

    Discriminant for consumers that cannot use instanceof across realms.

c
UnitOfWork(
_transaction: ITransaction,
_repoFactory: (entity: string) => IRepository<unknown>,
_adapterType?: DatabaseAdapterType
)

Concrete Unit of Work that holds a transaction and delegates repository creation to the database service within the transaction boundary.

c
UnsupportedFilterOperatorError(
operator: string,
connector: string | undefined,
message: string
)

Thrown at translation time when a filter operator cannot be honoured by the active backend with the connector in use.

  • connector: string | undefined

    The connector the operator failed on, or undefined when the connector could not be determined. 'sqlite' names the concrete refusal; undefined means the adapter could not identify its connector and the provider option is the fix.

  • name: string

    Discriminant for consumers that cannot use instanceof across realms.

  • operator: string

    The filter operator that could not be translated (e.g. 'contains').

c
UnsupportedIsolationLevelError(
adapter: string,
level: string
)

Thrown when a database adapter cannot honour a requested transaction isolation level.

  • name: string

    Discriminant for consumers that cannot use instanceof across realms.

c
UnsupportedMigrationError(message: string)

Thrown by IDatabaseService.migrate because programmatic migrations are not implemented by the current adapters.

  • name: string

    Discriminant for consumers that cannot use instanceof across realms.

c
UnsupportedQueryFeatureError(
feature: string,
adapter: string,
message: string,
options?: ErrorOptions
)

Thrown when an adapter refuses a query feature that is expressible in the portable IDataSource contract but not supported by the active backend.

  • adapter: string

    The adapter name (e.g. 'prisma', 'drizzle', 'memory').

  • feature: string

    The query feature that could not be honoured (e.g. 'composite-key').

  • name: string

    Discriminant for consumers that cannot use instanceof across realms.

c
UnsupportedRawQueryError(
adapter: string,
message: string
)

Thrown by MongoAdapter.rawQuery — MongoDB has no SQL, so a raw query is refused by name rather than emulated (the silent-divergence defect M70j closed). The error names the adapter and points at the injected client for native commands.

  • adapter: string

    The adapter name that refused the raw query (e.g. 'mongodb').

  • name: string

    Discriminant for consumers that cannot use instanceof across realms.

Functions

f
createInjectedDynamoLoader(client: IDynamoClient): DynamoClientLoader

Creates the no-import arm of the DynamoDB client seam.

f
decodeCursor(token: string): CursorPayload | null

Decode a cursor token to its CursorPayload, or null when the token is malformed.

f
encodeCursor(payload: CursorPayload): string

Encode a CursorPayload as a base64url-encoded JSON token.

f
withIsolationSupport<TDatabase extends object>(bridge: DrizzleTransactionBridge<TDatabase>): DrizzleTransactionBridge<TDatabase>

Declares that an application-owned Drizzle bridge forwards transaction options to its driver.

Interfaces

I
BigtableAdapterOptionsBase

The options both BigtableAdapterOptions arms share.

  • instance: string

    The Bigtable instance the tables live in. Required on both arms: a table is addressed as project/instance/table, and neither an injected client nor a project id encodes the instance.

  • maxPageFetches: number

    How many server round trips one findPage may take before it returns a bounded — but explicitly non-terminal — page. Defaults to 10.

  • tables: Readonly<Record<string, BigtableEntityMapping>>

    Per-entity table, row-key, column and value-encoding overrides, keyed by the entity name passed to getRepository().

I
BigtableCell

One stored cell: the raw value bytes, as text.

  • value: string

    The cell value, as the text the adapter's value codec wrote.

I
BigtableClientConfiguration

Client construction settings consumed by the lazy SDK arm.

I
BigtableClientLoader

The deferred client-resolution seam the adapter lifecycle drives.

I
BigtableDatabaseOptions

The 'bigtable' arm — a Google Cloud Bigtable wide-column backend.

I
BigtableEntityMapping

How one entity name maps onto a physical Bigtable table.

I
BigtableReadOptions

What a read asks the server for.

I
BigtableReadRow

One row as a read returns it.

I
BigtableRowBoundary

One end of a row-key range.

I
BigtableRowKeyMapping

How an entity's logical fields compose its single row key.

  • fields: readonly string[]

    The logical fields the row key is composed from, in order. The order is load-bearing: it is both the byte order the key sorts in and the order the portable cursor carries key values in.

  • prefix: string

    A constant prefix prepended to every row key of this entity.

  • separator: string

    The separator joining the fields. Defaults to '#'. Ignored for a single-field key, which is the field's own string form.

I
BigtableRowRange

A row-key range. An omitted end is unbounded in that direction.

I
BigtableValueRange

An exact byte range a cell value must fall in.

I
CosmosAccessCondition

One access condition — the optimistic-concurrency guard the replace path uses.

I
CosmosAdapterOptionsBase

The options both CosmosAdapterOptions arms share — everything that is required or optional regardless of how the client is supplied.

I
CosmosBatchDeleteOperation

A batch operation removing one document.

I
CosmosBatchInsertOperation

A batch operation inserting a whole document. The id is optional: the service mints one when the body carries none.

I
CosmosBatchPatchOperation

A batch operation carrying patch operations rather than a whole document.

I
CosmosBatchReplaceOperation

A batch operation overwriting a whole document, which therefore names the document it replaces.

I
CosmosBatchResponse

The response a transactional batch answers with.

I
CosmosContainerDefinition

The container definition the partition-key resolver reads.

I
CosmosDatabaseOptions

The arm selecting the Cosmos adapter over the @azure/cosmos SDK — Azure Cosmos DB's NoSQL (SQL) API.

I
CosmosEntityMapping

How one entity name maps onto a physical Cosmos container.

I
CosmosFeedResponse

A materialized query response.

I
CosmosItemResponse

The response envelope every single-item operation answers with.

I
CosmosPatchOperation

One JSON-patch-shaped operation. The adapter only emits set, and only for top-level fields, so the "cannot create a path whose parent is absent" limitation measured on the SDK is unreachable through it.

I
CosmosQueryParameter

One named query parameter. Values are always bound rather than interpolated, so a value can never be read as SQL.

I
CosmosQuerySpec

A parameterized Cosmos SQL query — the shape items.query accepts.

I
CosmosRequestOptions

Per-request options the adapter passes to a single-item operation.

I
CountOptions

Options for IRepository.count.

I
CursorPayload

The decoded contents of a cursor minted by encodeCursor: the values of every ordered field (in orderBy order) plus the primary-key column values (for tiebreaker lookups) plus a stable fingerprint of the sort specification. The fingerprint is what a fingerprint mismatch on decode detects.

  • keyValues: ReadonlyArray<CursorValue>

    The primary-key column values (in key-column order), from the row the cursor was minted against. Used by keysetPredicate as the tiebreaker fallback when a key column is absent from orderBy.

  • orderedValues: ReadonlyArray<CursorValue>

    The value of every ordered field (in orderBy declaration order), from the row the cursor was minted against. Index i is the value of the i-th entry of Object.entries(orderBy).

  • sortFingerprint: string

    A stable fingerprint of the resolved sort specification: each ordered field paired with its direction, in order. A cursor minted under one sort and presented under another has a different fingerprint, so the caller is refused by name rather than served a silently wrong page.

I
CustomDatabaseOptions

The arm supplying an externally-implemented backend.

  • adapter: IDatabaseAdapter

    The backend to use, already constructed. The plugin calls connect() on it during register() and disconnect() during shutdown; it never constructs or replaces it.

  • type: "custom"

    Selects the external-adapter arm.

I
DatabaseAdapterOptions

Adapter-specific configuration passed to the database adapter.

  • drizzleInstance: DrizzleDatabaseIdentity

    Inject the application's opaque configured Drizzle database, created by createDrizzleDatabase(database, transactionBridge). Required when type: 'drizzle' — see DrizzleAdapterOptions, which makes that a compile error rather than a startup throw. The explicit bridge positively guarantees Promise-aware native callback semantics instead of inferring them from a structural transaction method.

  • drizzleTables: Record<string, unknown>

    Registry mapping entity name → a real Drizzle table definition. Required when type: 'drizzle' — see DrizzleAdapterOptions, which makes that a compile error rather than a startup throw.

  • logQueries: boolean

    When true, log SQL queries to the registered logger.

  • prismaClient: unknown

    Inject an application-generated Prisma v7 client. This is required for the Prisma adapter because generated-client output belongs to the application rather than this package — see PrismaAdapterOptions, which makes that a compile error rather than a startup throw.

  • provider: PrismaSqlProvider

    The SQL connector the injected Prisma client is bound to.

  • transactionTimeout: number

    Timeout (ms) for Prisma interactive transactions. Defaults to 30_000. Prisma's default is ~5s which is too short for a full Unit of Work.

  • url: string

    Database connection URL (e.g., postgresql://localhost:5432/mydb).

I
DatabaseConnectionOptions

The options every DatabasePluginOptions arm shares.

I
DatabasePoolCapacity

A point-in-time reading of the database driver's connection-pool counters (M90b).

I
DrizzleAdapterOptions

DatabaseAdapterOptions narrowed for the Drizzle arm: the configured instance and the table registry are both required.

I
DrizzleCompositeKeyOptions

Per-entity overrides for the Drizzle adapter.

I
DrizzleDatabase

Opaque configuration for one exact Drizzle database and async transaction bridge.

I
DrizzleDatabaseIdentity

Erased identity of a package-created Drizzle configuration.

I
DrizzleDatabaseOptions

The arm selecting the Drizzle adapter.

I
DynamoAdapterOptionsBase

The options both DynamoAdapterOptions arms share — everything that is optional regardless of how the client is supplied.

I
DynamoAttributeValue

A DynamoDB attribute value in the subset the adapter reads and writes.

I
DynamoClientConfiguration

AWS client construction settings consumed by the lazy SDK arm.

I
DynamoClientLoader

The deferred client-resolution seam used by the adapter lifecycle.

I
DynamoConditionExpression

A conditional expression used to prevent an unintended write.

I
DynamoDatabaseOptions

The arm selecting the DynamoDB adapter over the AWS SDK v3 client.

I
DynamoDeleteItemCommandInput

Input for DynamoDB DeleteItem.

I
DynamoDeleteItemCommandOutput

Output from DynamoDB DeleteItem.

I
DynamoEntityMapping

How one entity name maps onto a physical DynamoDB table.

I
DynamoExpressionAttributes

Expression aliases shared by all command shapes.

I
DynamoGetItemCommandInput

Input for DynamoDB GetItem.

I
DynamoGetItemCommandOutput

Output from DynamoDB GetItem.

I
DynamoIndexMapping

A configured global secondary index and its key schema.

I
DynamoPutItemCommandInput

Input for DynamoDB PutItem.

I
DynamoPutItemCommandOutput

Output from DynamoDB PutItem.

I
DynamoQueryCommandInput

Input for DynamoDB Query.

I
DynamoReadCommandInput

Shared fields for a DynamoDB query or scan.

I
DynamoReadCommandOutput

The common DynamoDB Query and Scan response shape.

I
DynamoSdkClient

The native DynamoDB SDK client operations driven by the facade.

I
DynamoSdkCommand

A native DynamoDB SDK command accepted by DynamoSdkClient.

I
DynamoTransactDelete

A transactional Delete operation.

I
DynamoTransactPut

A transactional Put operation.

I
DynamoTransactUpdate

A transactional Update operation.

I
DynamoTransactWriteItem

One transaction operation accepted by DynamoDB TransactWriteItems.

I
DynamoTransactWriteItemsCommandInput

Input for DynamoDB TransactWriteItems.

I
DynamoUpdateItemCommandInput

Input for DynamoDB UpdateItem.

I
DynamoUpdateItemCommandOutput

Output from DynamoDB UpdateItem.

I
FindOptions

Options for IRepository.findAll.

I
IAdapterTransaction

A transaction handle that can also open entity data sources bound to itself.

I
IBigtableClient

The Bigtable client the adapter drives.

I
IBigtableInstance

One Bigtable instance.

I
IBigtableTable

One table's data-plane surface.

I
ICosmosClient

A structural subset of the SDK CosmosClient — the members the adapter drives.

I
ICosmosContainer

A structural subset of the SDK Container — the members the adapter drives.

I
ICosmosDatabase

A structural subset of the SDK Database.

I
ICosmosItem

A structural subset of the SDK Item handle — one document addressed by its id and partition key.

I
ICosmosItems

A structural subset of the SDK Items collection — the members the data source drives.

I
ICosmosQueryIterator

A query iterator, narrowed to the one member the adapter uses.

I
IDatabaseAdapter

The full database backend port: lifecycle plus data access.

I
IDatabaseService

High-level database service combining repository access, unit of work, raw queries, and lifecycle management.

I
IMongoClient

A structural subset of the driver MongoClient — the members the adapter drives.

I
IMongoCollectionFindOneAndUpdateOptions

The native driver findOneAndUpdate options the adapter passes through.

I
IMongoCursor

A structural subset of the driver's cursor returned from find().

I
IMongoDatabase

A structural subset of the driver Database — what the collection resolver reads.

I
IMongoObjectId

A structural subset of the driver ObjectId — enough for the conversion rules the mapping owns.

I
IMongoObjectIdCtor

The driver ObjectId constructor shape.

I
IMongoSession

A structural subset of the driver ClientSession — the members the transaction path calls.

I
IRepository

Generic repository providing CRUD operations over an entity type.

I
IUnitOfWork

Unit of Work: transaction-scoped repository access.

I
MemoryDatabaseOptions

The arm selecting the zero-dependency in-memory adapter, which is also what an omitted type means.

I
MongoAdapterOptionsBase

The options both MongoAdapterOptions arms share — everything that is optional regardless of how the client is supplied.

I
MongoDatabaseOptions

The arm selecting the Mongo adapter over the native mongodb driver.

I
MongoEntityMapping

How one entity name maps onto a physical Mongo collection.

I
MongoOptions

Operation options the data source passes to every driver call — the session a transaction-scoped data source binds to.

I
NormalizedQuery

A repository query with every option resolved to a concrete value — the shape a IDataSource evaluates.

I
Page

A single page of entities returned by IRepository.findPage, plus the cursor that continues to the next page (or null when the page is the last).

I
PageResult

A single page of rows returned by IDataSource.findPage, plus the cursor that continues to the next page (or null when the page is the last).

I
PrismaAdapterOptions

DatabaseAdapterOptions narrowed for the Prisma arm: the injected client is required.

I
PrismaCompositeKeyOptions

Per-entity overrides for the Prisma adapter.

I
PrismaDatabaseOptions

The arm selecting the Prisma adapter.

I
TransactionOptions

Optional controls for opening a transaction.

Type Aliases

T
BigtableValueEncoding = "tagged" | "raw"

How a value round-trips through a cell.

T
CosmosPartitionKeyValue =
string
| number
| boolean
| null
| readonly (string | number | boolean | null)[]

A partition-key value as Cosmos accepts it: a JSON scalar, or an array of them for a hierarchical (MultiHash) partition key.

T
CursorValue = string | number | Date

A scalar value retained by a portable keyset cursor.

T
DynamoDateEncoding = "iso" | "epochMs"

The storage encoding a date-bearing attribute is declared to use.

T
DynamoTransactWriteItemsCommandOutput = Record<never, never>

Output from DynamoDB TransactWriteItems.

T
EntityKey = string | number | Readonly<Record<string, string | number>>

A primary key value: a scalar string, a scalar number, or a composite key expressed as a readonly record of named columns to values.

T
FilterOperator = "eq" | "contains" | "gt" | "gte" | "lt" | "lte" | "in"

Operators supported by a portable repository filter comparison.

T
MongoWriteOptions = MongoOptions

Write-path operation options the data source passes to the driver.

T
OrderDirection = "asc" | "desc"

Sort direction for a single field.

T
PageOptions = FindOptions

Options for IRepository.findPage — the parameter shape.

T
SqlJsonDialect = "postgresql" | "mysql" | "sqlite"

The SQL dialects whose JSON extraction syntax this module can emit.

T
DataSource = IDataSource

The data-access seam adapter-specific implementations provide, keeping BaseRepository decoupled from concrete ORM clients.

Usage

import * as Database_plugin_with_repository_pattern__Unit_of_Work__and_ORM_adapters___Provides__DatabasePlugin__for_registering_database_access_through_the_framework_s_plugin_system__Supports_Prisma__Drizzle__and_in_memory_adapters__Every_export_is_documented_in_PUBLIC_API_md__AI_GUIDELINES__10__ from "database-plugin/src/index.ts";