dynamodb-data-types is a JavaScript utility library designed to simplify the interaction with Amazon DynamoDB's native data type representations. It provides functions to convert standard JavaScript objects into DynamoDB's attribute value format (marshalling) and vice-versa (unmarshalling), handling complex nested structures and various primitive types. The library's current stable version is 4.0.1. Its release cadence is moderate, with major versions introducing significant features like the `UpdateExpression` builder in v4.0.0. A key differentiator is its focus on accurately handling DynamoDB's specific type mappings (e.g., numbers as strings `{N: '1'}`, sets, lists, maps, booleans, and nulls), alongside its ability to construct complex `UpdateExpression` payloads, including automatic handling of DynamoDB reserved keywords and proper `ExpressionAttributeValues` and `ExpressionAttributeNames` generation. This functionality reduces boilerplate code and common errors when performing update operations.
npm install dynamodb-data-typesVerified import paths — ran on the pinned version, not inferred.
Demonstrates marshalling/unmarshalling JavaScript objects to DynamoDB format and building a complex `UpdateExpression` with `SET`, `ADD`, `REMOVE`, and `DELETE` clauses, including handling nested attributes and reserved keywords.
Review the README and update code to use the new `updateExpr()` API for generating UpdateExpressions. For marshalling/unmarshalling, ensure you are still using `AttributeValue.wrap` and `AttributeValue.unwrap`.
Always append `.expr()` to the `updateExpr()` method chain, e.g., `updateExpr().set({ key: 'value' }).expr();`Consult the AWS DynamoDB documentation on `UpdateExpressions` to understand the precise behavior of each clause and use the appropriate `updateExpr()` method (`set`, `add`, `remove`, `delete`) for your intended operation.
Use `import { AttributeValue } from 'dynamodb-data-types';` then call `AttributeValue.wrap(data)`.Ensure the attribute exists before attempting `REMOVE` and verify that `DELETE` is only used for set types with appropriate values. Consider using `SET` with `null` if the intent is to clear an attribute's value rather than remove the attribute entirely.
Ensure that the object passed to `.set()` contains valid key-value pairs representing the attributes to be set, and that values are of appropriate JavaScript types that can be marshalled by the library.
No dependency data recorded yet.