-
Notifications
You must be signed in to change notification settings - Fork 0
Compatibility
dynamodb-toolkit publishes as a single ESM package — one source tree, .d.ts sidecars next to every .js, zero build step. This page summarizes what consumers can expect across TypeScript, CommonJS, and alternative JavaScript runtimes, and points at the tests that demonstrate each path.
See also (AWS JS SDK v3): Package overview. Vocabulary: Concepts.
Every .js file in src/ has a hand-written .d.ts sidecar. The published package exports both from the same entry, so TypeScript consumers get typings automatically:
import {Adapter, type Raw, raw} from 'dynamodb-toolkit';
import {buildUpdate, type ConditionClause} from 'dynamodb-toolkit/expressions';
import {type TransactWriteDescriptor} from 'dynamodb-toolkit/batch';- No build step, no generation round-trip. Sidecars are authored by hand, reviewed like source, and shipped verbatim.
-
Generics where they help.
Adapter<TItem, TKey>binds the item shape to method signatures;buildUpdate<T>/buildCondition<T>preserve caller-suppliedparamstyping. -
Type-checking in this repo runs over
tests/**/*as well assrc/**/*— any.tsfile dropped intotests/is picked up bynpm run ts-checkfor free. -
Runnable TS smoke test:
tests/test-typed.tsexercises the typed public surface (typedAdapter, typed condition clauses, typed descriptor unions, thereturnFailedItemoption). Invoke vianpm run ts-test(Node 22+; tape-six runs.tsnatively — notsx/ts-nodeneeded).
The package itself is "type": "module", but CJS consumers can pull it in with require() on current Node 20+ (require(esm) shipped unflagged in Node 20.19 for the 20.x line and 22.12 for 22.x):
const {Adapter, raw} = require('dynamodb-toolkit');
const {buildUpdate} = require('dynamodb-toolkit/expressions');
const {applyTransaction} = require('dynamodb-toolkit/batch');-
Uses sync
require(). Noawait import()needed — the source has no top-levelawait. -
All sub-exports available from CJS: main entry,
/expressions,/batch,/mass,/paths,/rest-core,/handler. -
Runnable CJS smoke test:
tests/test-smoke.cjsimports every sub-export viarequire()and exercises a minimal flow (builders, Adapter constructor,Rawround-trip). Part of the defaultnpm testunder Node.
The same source tree is tested on three JS runtimes:
| Runtime | Script | Notes |
|---|---|---|
| Node | npm test |
Default. Includes .cjs tests via tape-six's Node-only glob. |
| Deno | npm run test:deno |
Runs the .js / .mjs suite. .cjs tests skipped by config (Node-only). |
| Bun | npm run test:bun |
Runs the .js / .mjs suite. .cjs tests skipped by config (Node-only). |
Cross-runtime test counts match exactly (same .js / .mjs suite); the .cjs smoke-test is the only delta, and it's scoped to Node because require(esm) is the Node-specific story. Everything else — ESM imports, the Adapter, the expression builders, batch/transaction chunking, the REST handler — is portable.
If you ship a library that consumes dynamodb-toolkit and you also target Deno or Bun, the same support matrix applies to your consumers: the package works in any runtime that supports ESM, and the typings work in any editor / type-checker that understands .d.ts.
Start here
- Getting started
- Concepts
- Key and field design
- Compatibility
- Migration: v2 to v3
- SDK v2 to v3 cheat sheet
Guides
- Hierarchical data walkthrough
- Key expression patterns
- Multi-type tables
- Pagination
- Mass operation semantics
- URL schema design
Adapter
- Adapter
- Constructor options
- CRUD methods
- Mass methods
- Batch builders
- Hooks
- Raw marker
- Indirect indices
- Transaction auto-upgrade
Expression builders
Batch / transactions / mass / paths
REST surface
Framework adapters
Recipes
- Recipes index
- List records of a tier
- Per-tier sparse GSI markers
- Tier within a partition
- Reservation with auto-release
- Keys-only GSI, runtime projection
- Cascade subtree operations
- Querying subtrees with buildKey
- Filter URL grammar
- Text search
- Provisioning workflow
- Resumable mass operations
History