interface DynamoEntityMapping
Since 0.1.0

How one entity name maps onto a physical DynamoDB table.

A DynamoDB Key map is order-insensitive. Unlike Mongo's compound _id — which is matched by order-sensitive subdocument equality — a Key map of {partitionKey, sortKey} and one of {sortKey, partitionKey} retrieve the same item (measured, M80 plan §1A P2). No canonical ordering is therefore imposed on the key records a caller supplies, and Mongo's declared-order canonicalisation must not be ported across. The ONE place column order matters is the resolved target's keyColumns (partition then sort), because the cursor codec needs a stable order to carry values in.

Properties

readonly
optional
table: string

The table name. Defaults to the entity name itself, so getRepository('users') needs no mapping at all.

readonly
partitionKey: string

The table's partition-key attribute.

Required — unlike the scalar 'id' default the other adapters assume — because DynamoDB has no implicit key to guess: a table's key schema is a physical fact, and the attribute_exists / attribute_not_exists write guards and every key builder read this attribute by name. The 'id' default applies only to an entity with no mapping entry at all.

readonly
optional
sortKey: string

The table's sort-key attribute, when the table is keyed by partition AND sort.

When present, a scalar key is no longer a complete key — GetItem naming only the partition key is a ValidationException (M80 plan §1A P3) — and the sort key is the one field the adapter serves orderBy on natively (M80 plan §1A Q4).

readonly
optional
indexes: Readonly<Record<string, DynamoIndexMapping>>

The table's configured global secondary indexes, keyed by index name.

The access-path resolver selects an index when the caller's filter constrains that index's partition key; it invents no portable way to ask for one (M79's out-of-scope list).

readonly
optional
dateAttributes: Readonly<Record<string, DynamoDateEncoding>>

The encoding each date-bearing attribute is stored under.

A Date in an ordered comparison is converted to the attribute's declared encoding — 'iso' (ISO-8601 string) or 'epochMs' (epoch-milliseconds number). With no declaration for the attribute, the comparison is refused by name: DynamoDB has no date type, so the adapter cannot know how the stored value is encoded (M80 plan §1A F7).

Usage

import { type DynamoEntityMapping } from "database-plugin/src/index.ts";