DynamoDbRepository
Defined in: dynamodb/src/lib/dynamodb-repository.ts:30
Type Parameters
Section titled “Type Parameters”T extends Record<string, unknown>
D = Partial<T>
Implements
Section titled “Implements”Repository<T,D>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new DynamoDbRepository<
T,D>(app):DynamoDbRepository<T,D>
Defined in: dynamodb/src/lib/dynamodb-repository.ts:80
Parameters
Section titled “Parameters”Returns
Section titled “Returns”DynamoDbRepository<T, D>
Properties
Section titled “Properties”_txItems?
Section titled “_txItems?”
protectedoptional_txItems?:TransactWriteItem[]
Defined in: dynamodb/src/lib/dynamodb-repository.ts:78
Buffered write operations when running inside withTransaction().
client
Section titled “client”
protectedreadonlyclient:DynamoDBClient
Defined in: dynamodb/src/lib/dynamodb-repository.ts:33
createdAtField
Section titled “createdAtField”
readonlycreatedAtField:string="createdAt"
Defined in: dynamodb/src/lib/dynamodb-repository.ts:59
Attribute written for auto-managed creation timestamps.
Default
Section titled “Default”"createdAt"fieldMap
Section titled “fieldMap”
readonlyfieldMap:Record<string,string> ={}
Defined in: dynamodb/src/lib/dynamodb-repository.ts:68
Entity-field-to-attribute overrides, for a table whose attribute names don’t match
the entity (e.g. a brownfield table using snake_case). Applies to every field,
including partitionKey/sortKey — they are ordinary attributes in DynamoDB.
Default
Section titled “Default”{}lastKey?
Section titled “lastKey?”
optionallastKey?:Record<string,AttributeValue>
Defined in: dynamodb/src/lib/dynamodb-repository.ts:75
The LastEvaluatedKey from the most recent paginated findAll() call. Use as _startKey on the next call.
partitionKey
Section titled “partitionKey”
readonlypartitionKey:string="id"
Defined in: dynamodb/src/lib/dynamodb-repository.ts:42
The partition key attribute name for the table.
Default
Section titled “Default”"id"sortKey?
Section titled “sortKey?”
readonlyoptionalsortKey?:string
Defined in: dynamodb/src/lib/dynamodb-repository.ts:49
Optional sort key attribute name. When set, findById expects a composite
key object { pk: partitionValue, sk: sortValue } and Query is used
instead of GetItem.
tableName
Section titled “tableName”
abstractreadonlytableName:string
Defined in: dynamodb/src/lib/dynamodb-repository.ts:36
DynamoDB table name.
timestamps
Section titled “timestamps”
readonlytimestamps:boolean=true
Defined in: dynamodb/src/lib/dynamodb-repository.ts:56
When true, save / saveAll / updateById / patchById automatically
write createdAt and updatedAt ISO-8601 timestamps.
Default
Section titled “Default”trueupdatedAtField
Section titled “updatedAtField”
readonlyupdatedAtField:string="updatedAt"
Defined in: dynamodb/src/lib/dynamodb-repository.ts:61
Attribute written for auto-managed update timestamps.
Default
Section titled “Default”"updatedAt"Methods
Section titled “Methods”buildKey()
Section titled “buildKey()”
protectedbuildKey(id):Record<string,AttributeValue>
Defined in: dynamodb/src/lib/dynamodb-repository.ts:125
Build a consistent key map for GetItem / DeleteItem / UpdateItem.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Record<string, AttributeValue>
count()
Section titled “count()”count(
params?):Promise<number>
Defined in: dynamodb/src/lib/dynamodb-repository.ts:663
Parameters
Section titled “Parameters”params?
Section titled “params?”Returns
Section titled “Returns”Promise<number>
Implementation of
Section titled “Implementation of”deleteById()
Section titled “deleteById()”deleteById(
id):Promise<T>
Defined in: dynamodb/src/lib/dynamodb-repository.ts:624
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<T>
Implementation of
Section titled “Implementation of”describe()
Section titled “describe()”describe():
RepositoryCapabilities
Defined in: dynamodb/src/lib/dynamodb-repository.ts:139
Optional capability introspection. All
Returns
Section titled “Returns”Mantlejs
Section titled “Mantlejs”adapters implement it; user repositories may omit it.
Implementation of
Section titled “Implementation of”findAll()
Section titled “findAll()”findAll(
params?):Promise<T[]>
Defined in: dynamodb/src/lib/dynamodb-repository.ts:154
Parameters
Section titled “Parameters”params?
Section titled “params?”Returns
Section titled “Returns”Promise<T[]>
Implementation of
Section titled “Implementation of”findById()
Section titled “findById()”findById(
id):Promise<T|null>
Defined in: dynamodb/src/lib/dynamodb-repository.ts:409
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<T | null>
Implementation of
Section titled “Implementation of”findPage()
Section titled “findPage()”findPage(
params?):Promise<CursorPage<T>>
Defined in: dynamodb/src/lib/dynamodb-repository.ts:181
Fetch one page of results using native DynamoDB cursor pagination. The returned cursor
is the LastEvaluatedKey encoded as base64 JSON — pass it back as params.cursor for the
next page. Stateless: unlike lastKey, nothing is stored on the repository instance.
Uses Query when a sort key is defined and the where clause pins the partition key,
otherwise Scan. skip and sort are rejected — offsets and cross-page ordering don’t
compose with cursors.
Parameters
Section titled “Parameters”params?
Section titled “params?”QueryParams & object
Returns
Section titled “Returns”Promise<CursorPage<T>>
Implementation of
Section titled “Implementation of”fromItem()
Section titled “fromItem()”
protectedfromItem(item):T
Defined in: dynamodb/src/lib/dynamodb-repository.ts:119
Unmarshall a DynamoDB attribute map to a plain object.
Parameters
Section titled “Parameters”Record<string, AttributeValue>
Returns
Section titled “Returns”T
patchById()
Section titled “patchById()”patchById(
id,data):Promise<T>
Defined in: dynamodb/src/lib/dynamodb-repository.ts:553
Parameters
Section titled “Parameters”D
Returns
Section titled “Returns”Promise<T>
Implementation of
Section titled “Implementation of”save()
Section titled “save()”save(
data):Promise<T>
Defined in: dynamodb/src/lib/dynamodb-repository.ts:423
Parameters
Section titled “Parameters”D
Returns
Section titled “Returns”Promise<T>
Implementation of
Section titled “Implementation of”saveAll()
Section titled “saveAll()”saveAll(
data):Promise<T[]>
Defined in: dynamodb/src/lib/dynamodb-repository.ts:444
Parameters
Section titled “Parameters”D[]
Returns
Section titled “Returns”Promise<T[]>
Implementation of
Section titled “Implementation of”toEntityField()
Section titled “toEntityField()”
protectedtoEntityField(field):string
Defined in: dynamodb/src/lib/dynamodb-repository.ts:103
Translates an attribute name back to its entity field name — the inverse of toField.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”string
toField()
Section titled “toField()”
protectedtoField(field):string
Defined in: dynamodb/src/lib/dynamodb-repository.ts:98
Translates an entity field name to its attribute name (fieldMap override, else identity).
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”string
toItem()
Section titled “toItem()”
protectedtoItem(data):Record<string,AttributeValue>
Defined in: dynamodb/src/lib/dynamodb-repository.ts:109
Marshall a plain object to DynamoDB attribute values, omitting undefined/null keys.
Parameters
Section titled “Parameters”Record<string, unknown>
Returns
Section titled “Returns”Record<string, AttributeValue>
updateById()
Section titled “updateById()”updateById(
id,data):Promise<T>
Defined in: dynamodb/src/lib/dynamodb-repository.ts:483
Parameters
Section titled “Parameters”D
Returns
Section titled “Returns”Promise<T>
Implementation of
Section titled “Implementation of”withTransaction()
Section titled “withTransaction()”withTransaction<
R>(callback):Promise<R>
Defined in: dynamodb/src/lib/dynamodb-repository.ts:713
Execute a set of repository write operations atomically via DynamoDB TransactWriteItems. Supports up to 100 write operations per transaction.
Note: in transaction mode, mutation methods (save, updateById, patchById, deleteById) return the input data immediately rather than the persisted item, since TransactWriteItems does not support ReturnValues.
Type Parameters
Section titled “Type Parameters”R
Parameters
Section titled “Parameters”callback
Section titled “callback”(repo) => Promise<R>
Returns
Section titled “Returns”Promise<R>
wrapError()
Section titled “wrapError()”
protectedwrapError(err):Error
Defined in: dynamodb/src/lib/dynamodb-repository.ts:743
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”Error