Skip to content

Adapter

Eugene Lazutkin edited this page Apr 23, 2026 · 34 revisions

Adapter

See also (AWS JS SDK v3): DynamoDBDocumentClient · SDK Command pages linked from each sub-page. Vocabulary: Concepts.

Adapter is the toolkit's composition root. One Adapter typically maps to one logical entity (often one table). It owns long-lived state (client, table, keyFields, searchable, indirectIndices, hooks) and delegates real work to orthogonal sub-modules.

import {Adapter} from 'dynamodb-toolkit';

const adapter = new Adapter({
  client: docClient,
  table: 'planets',
  keyFields: ['name']
});

Surface

Section Content
Adapter: Constructor options Required + optional constructor fields
Adapter: CRUD methods getByKey, getByKeys, getList, getListByParams, post, put, patch, delete, clone, move
Adapter: Mass methods putItems, deleteByKeys, deleteListByParams, cloneByKeys, cloneListByParams, moveByKeys, moveListByParams
Adapter: Batch builders makeGet, makeCheck, makePost, makePut, makePatch, makeDelete
Adapter: Hooks prepare, prepareKey, prepareListInput, updateInput, revive, validateItem, checkConsistency
Adapter: Raw marker The Raw<T> bypass marker + raw(item) helper
Adapter: Indirect indices Sparse GSI second-hop reads
Adapter: Transaction auto-upgrade When checkConsistency returns extra checks

Lower-level access without the Adapter

The Adapter is a convenience layer. If you only want a slice of the toolkit:

import {applyBatch, applyTransaction, getBatch} from 'dynamodb-toolkit/batch';
import {paginateList, iterateItems} from 'dynamodb-toolkit/mass';
import {buildUpdate, addProjection, buildSearch} from 'dynamodb-toolkit/expressions';
import {getPath, setPath, applyPatch} from 'dynamodb-toolkit/paths';

These sub-exports work standalone and don't require an Adapter instance.

Clone this wiki locally