{"_id":"@antstanley/dynamodb-toolbox","_rev":"3-9ed93f8dadcddd16a1f919d492723cc6","name":"@antstanley/dynamodb-toolbox","dist-tags":{"latest":"0.0.4"},"versions":{"0.0.1":{"name":"@antstanley/dynamodb-toolbox","description":"A simple set of tools for working with Amazon DynamoDB and the DocumentClient.","author":{"name":"Jeremy Daly","email":"jeremy@jeremydaly.com"},"exports":{".":{"import":{"default":"./dist/esm/index.js","types":"./dist/esm/index.d.ts"},"require":{"default":"./dist/cjs/index.js","types":"./dist/cjs/index.d.ts"}}},"type":"module","scripts":{"test":"jest unit","test-cov":"jest unit --coverage","test-ci":"eslint . && jest unit --coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","test-types":"tsd","check-types":"tsc --noEmit","lint":"eslint .","build:cjs":"tsc -p tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > dist/cjs/package.json","build:esm":"tsc -p tsconfig.esm.json && echo '{ \"type\": \"module\" }' > dist/esm/package.json","build":"npm run build:cjs & npm run build:esm","prebuild":"rm -rf dist","prepublishOnly":"npm test && npm run lint && npm run test-types","changelog":"git log $(git describe --tags --abbrev=0)..HEAD --oneline"},"license":"MIT","contributors":[{"name":"ThomasAribart","email":"thomasa@theodo.fr"},{"name":"Naor Peled","email":"me@naor.dev"}],"dependencies":{"deep-copy":"^1.4.2","ts-toolbelt":"^9.6.0"},"repository":{"type":"git","url":"git+https://github.com/jeremydaly/dynamodb-toolbox.git"},"keywords":["serverless","aws","dynamodb","nosql"],"bugs":{"url":"https://github.com/jeremydaly/dynamodb-toolbox/issues"},"homepage":"https://github.com/jeremydaly/dynamodb-toolbox#readme","engines":{"node":">=14.0.0"},"peerDependencies":{"@aws-sdk/lib-dynamodb":"^3.0.0","@aws-sdk/client-dynamodb":"^3.0.0"},"devDependencies":{"@types/jest":"^29.2.1","@types/node":"^14.14.16","@typescript-eslint/eslint-plugin":"^5.43.0","@typescript-eslint/parser":"^5.43.0","@aws-sdk/lib-dynamodb":"^3.287.0","@aws-sdk/client-dynamodb":"^3.287.0","@aws-sdk/util-dynamodb":"^3.287.0","coveralls":"^3.1.0","eslint":"^8.2.0","jest":"^29.2.2","prettier":"^2.2.1","ts-jest":"^29.0.3","tsd":"^0.23.0","typescript":"^4.1.3"},"version":"0.0.1","gitHead":"a9500162816e9900abd8842b8e0a0e54c258ec7c","_id":"@antstanley/dynamodb-toolbox@0.0.1","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-8YYfzbiQOnawNH5LEcgVXw9QOVFpJjyCbbrgHy6MkaKZZo6mojYqBw22s21izTLzcU7j0VTfZLLEyUMud3dhZw==","shasum":"ce0780fa233a50b79def07fad30f37a33763e6ed","tarball":"https://registry.npmjs.org/@antstanley/dynamodb-toolbox/-/dynamodb-toolbox-0.0.1.tgz","fileCount":91,"unpackedSize":520189,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCDd3yt7Q5/jmIDuGEKZpdpqzDCdLrKcj3MyeOlAgQcoQIhANgdatNPZGzUXLXe29ZY4G/sCd3K/V/C7dAmyjfTg+aG"}]},"_npmUser":{"name":"antstanley","email":"ant@serverless.london"},"directories":{},"maintainers":[{"name":"antstanley","email":"ant@serverless.london"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dynamodb-toolbox_0.0.1_1697615984142_0.5517839096967789"},"_hasShrinkwrap":false},"0.0.2":{"name":"@antstanley/dynamodb-toolbox","description":"A simple set of tools for working with Amazon DynamoDB and the DocumentClient.","author":{"name":"Jeremy Daly","email":"jeremy@jeremydaly.com"},"main":"dist/cjs/index.js","types":"dist/cjs/index.d.ts","exports":{".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.js"}}},"type":"module","scripts":{"test":"jest unit","test-cov":"jest unit --coverage","test-ci":"eslint . && jest unit --coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","test-types":"tsd","check-types":"tsc --noEmit","lint":"eslint .","build:cjs":"tsc -p tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > dist/cjs/package.json","build:esm":"tsc -p tsconfig.esm.json && echo '{ \"type\": \"module\" }' > dist/esm/package.json","build":"npm run build:cjs & npm run build:esm","prebuild":"rm -rf dist","prepublishOnly":"npm test && npm run lint && npm run test-types","changelog":"git log $(git describe --tags --abbrev=0)..HEAD --oneline"},"license":"MIT","contributors":[{"name":"ThomasAribart","email":"thomasa@theodo.fr"},{"name":"Naor Peled","email":"me@naor.dev"}],"dependencies":{"deep-copy":"^1.4.2","ts-toolbelt":"^9.6.0"},"repository":{"type":"git","url":"git+https://github.com/jeremydaly/dynamodb-toolbox.git"},"keywords":["serverless","aws","dynamodb","nosql"],"bugs":{"url":"https://github.com/jeremydaly/dynamodb-toolbox/issues"},"homepage":"https://github.com/jeremydaly/dynamodb-toolbox#readme","engines":{"node":">=14.0.0"},"peerDependencies":{"@aws-sdk/lib-dynamodb":"^3.0.0","@aws-sdk/client-dynamodb":"^3.0.0"},"devDependencies":{"@types/jest":"^29.2.1","@types/node":"^14.14.16","@typescript-eslint/eslint-plugin":"^5.43.0","@typescript-eslint/parser":"^5.43.0","@aws-sdk/lib-dynamodb":"^3.287.0","@aws-sdk/client-dynamodb":"^3.287.0","@aws-sdk/util-dynamodb":"^3.287.0","coveralls":"^3.1.0","eslint":"^8.2.0","jest":"^29.2.2","prettier":"^2.2.1","ts-jest":"^29.0.3","tsd":"^0.23.0","typescript":"^4.1.3"},"version":"0.0.2","gitHead":"16f602eb687692ddcb3b4b80df4d54de3ac21383","_id":"@antstanley/dynamodb-toolbox@0.0.2","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-qh7A7MOTHoQMjtVeHqxPTFg12a7abU5lx9MSI7WGr65o+FHY/AH5/Fjq5kp420q9qtftgl+sGDPtQR3ASvKAAw==","shasum":"f97123ebb13d91f4f2a1c0af5b0958701728e73e","tarball":"https://registry.npmjs.org/@antstanley/dynamodb-toolbox/-/dynamodb-toolbox-0.0.2.tgz","fileCount":91,"unpackedSize":520254,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICIFwlfmjqaaGH8AWXZuSbT0lmHYYH+otGQy8M3v0+NkAiEA8xkqRqKMByLgab77gzwP2xN8mGejAQXApmWz0x/0LiM="}]},"_npmUser":{"name":"antstanley","email":"ant@serverless.london"},"directories":{},"maintainers":[{"name":"antstanley","email":"ant@serverless.london"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dynamodb-toolbox_0.0.2_1697998702901_0.48572071168830755"},"_hasShrinkwrap":false},"0.0.3":{"name":"@antstanley/dynamodb-toolbox","description":"A simple set of tools for working with Amazon DynamoDB and the DocumentClient.","author":{"name":"Jeremy Daly","email":"jeremy@jeremydaly.com"},"main":"dist/cjs/index.js","types":"dist/cjs/index.d.ts","exports":{".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.js"}}},"type":"module","scripts":{"test":"jest unit","test-cov":"jest unit --coverage","test-ci":"eslint . && jest unit --coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","test-types":"tsd","check-types":"tsc --noEmit","lint":"eslint .","build:cjs":"tsc -p tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > dist/cjs/package.json","build:esm":"tsc -p tsconfig.esm.json && echo '{ \"type\": \"module\" }' > dist/esm/package.json","build":"npm run build:cjs & npm run build:esm","prebuild":"rm -rf dist","prepublishOnly":"npm test && npm run lint && npm run test-types","changelog":"git log $(git describe --tags --abbrev=0)..HEAD --oneline"},"license":"MIT","contributors":[{"name":"ThomasAribart","email":"thomasa@theodo.fr"},{"name":"Naor Peled","email":"me@naor.dev"}],"dependencies":{"deep-copy":"^1.4.2","ts-toolbelt":"^9.6.0"},"repository":{"type":"git","url":"git+https://github.com/jeremydaly/dynamodb-toolbox.git"},"keywords":["serverless","aws","dynamodb","nosql"],"bugs":{"url":"https://github.com/jeremydaly/dynamodb-toolbox/issues"},"homepage":"https://github.com/jeremydaly/dynamodb-toolbox#readme","engines":{"node":">=14.0.0"},"peerDependencies":{"@aws-sdk/lib-dynamodb":"^3.0.0","@aws-sdk/client-dynamodb":"^3.0.0"},"devDependencies":{"@types/jest":"^29.2.1","@types/node":"^14.14.16","@typescript-eslint/eslint-plugin":"^5.43.0","@typescript-eslint/parser":"^5.43.0","@aws-sdk/lib-dynamodb":"^3.287.0","@aws-sdk/client-dynamodb":"^3.287.0","@aws-sdk/util-dynamodb":"^3.287.0","coveralls":"^3.1.0","eslint":"^8.2.0","jest":"^29.2.2","prettier":"^2.2.1","ts-jest":"^29.0.3","tsd":"^0.23.0","typescript":"^4.1.3"},"version":"0.0.3","gitHead":"16f602eb687692ddcb3b4b80df4d54de3ac21383","_id":"@antstanley/dynamodb-toolbox@0.0.3","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-NRQorf4eAJNdv2S1a4Xo8ub2DJLE+rKdFBzHviO6h8fGKbJYV7m9VjdMe0PBj+lmv9LlFbHQtdeCsovd43hfhA==","shasum":"64fd30b04e07ac7bdf90ae8a99b36c04a49d6737","tarball":"https://registry.npmjs.org/@antstanley/dynamodb-toolbox/-/dynamodb-toolbox-0.0.3.tgz","fileCount":91,"unpackedSize":520274,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBuy7tEhl46vBh/k/oKtoNQoe7P5UqiioRv8YJjKmSyzAiARXNy4za5yh9kY3KjjQ4KQxmoh86maY3K6NJmi+mprUg=="}]},"_npmUser":{"name":"antstanley","email":"ant@serverless.london"},"directories":{},"maintainers":[{"name":"antstanley","email":"ant@serverless.london"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dynamodb-toolbox_0.0.3_1698002810174_0.7593935524997828"},"_hasShrinkwrap":false},"0.0.4":{"name":"@antstanley/dynamodb-toolbox","description":"A simple set of tools for working with Amazon DynamoDB and the DocumentClient.","author":{"name":"Jeremy Daly","email":"jeremy@jeremydaly.com"},"main":"dist/cjs/index.js","types":"dist/cjs/index.d.ts","exports":{".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.js"}}},"type":"module","scripts":{"test":"jest unit","test-cov":"jest unit --coverage","test-ci":"eslint . && jest unit --coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","test-types":"tsd","check-types":"tsc --noEmit","lint":"eslint .","build:cjs":"tsc -p tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > dist/cjs/package.json","build:esm":"tsc -p tsconfig.esm.json && echo '{ \"type\": \"module\" }' > dist/esm/package.json","build":"npm run build:cjs & npm run build:esm","prebuild":"rm -rf dist","prepublishOnly":"npm test && npm run lint && npm run test-types","changelog":"git log $(git describe --tags --abbrev=0)..HEAD --oneline"},"license":"MIT","contributors":[{"name":"ThomasAribart","email":"thomasa@theodo.fr"},{"name":"Naor Peled","email":"me@naor.dev"}],"dependencies":{"deep-copy":"^1.4.2","ts-toolbelt":"^9.6.0"},"repository":{"type":"git","url":"git+https://github.com/jeremydaly/dynamodb-toolbox.git"},"keywords":["serverless","aws","dynamodb","nosql"],"bugs":{"url":"https://github.com/jeremydaly/dynamodb-toolbox/issues"},"homepage":"https://github.com/jeremydaly/dynamodb-toolbox#readme","engines":{"node":">=14.0.0"},"peerDependencies":{"@aws-sdk/lib-dynamodb":"^3.0.0","@aws-sdk/client-dynamodb":"^3.0.0"},"devDependencies":{"@types/jest":"^29.2.1","@types/node":"^14.14.16","@typescript-eslint/eslint-plugin":"^5.43.0","@typescript-eslint/parser":"^5.43.0","@aws-sdk/lib-dynamodb":"^3.287.0","@aws-sdk/client-dynamodb":"^3.287.0","@aws-sdk/util-dynamodb":"^3.287.0","coveralls":"^3.1.0","eslint":"^8.2.0","jest":"^29.2.2","prettier":"^2.2.1","ts-jest":"^29.0.3","tsd":"^0.23.0","typescript":"^4.1.3"},"version":"0.0.4","_id":"@antstanley/dynamodb-toolbox@0.0.4","gitHead":"c7a7a9b13659f00e145f41157956582f68d347d2","_nodeVersion":"18.18.2","_npmVersion":"9.8.1","dist":{"integrity":"sha512-3KXxNbeXaOGdlTbcyK9mK/wnv7weo0NxLlk8ElmIdnQg12mr+PiQPM9Ez9YnF+OxBen18Qf0ThoLu5Nisn4lGA==","shasum":"a300831203808a237e3835cd9f5b47d77e41bb3b","tarball":"https://registry.npmjs.org/@antstanley/dynamodb-toolbox/-/dynamodb-toolbox-0.0.4.tgz","fileCount":93,"unpackedSize":520356,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAeExMHmvSWDfJRKiD6MYUCx5Y3tIk3U7iQOb/ELswzYAiEAg/C+rIHVEuE86Zpcvz/n8ZBq8yDWL2DQKRkYd3ptndY="}]},"_npmUser":{"name":"antstanley","email":"ant@serverless.london"},"directories":{},"maintainers":[{"name":"antstanley","email":"ant@serverless.london"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/dynamodb-toolbox_0.0.4_1698817414298_0.696940325395051"},"_hasShrinkwrap":false}},"time":{"created":"2023-10-18T07:59:43.994Z","0.0.1":"2023-10-18T07:59:44.438Z","modified":"2023-11-01T05:43:34.658Z","0.0.2":"2023-10-22T18:18:23.176Z","0.0.3":"2023-10-22T19:26:50.435Z","0.0.4":"2023-11-01T05:43:34.506Z"},"maintainers":[{"name":"antstanley","email":"ant@serverless.london"}],"description":"A simple set of tools for working with Amazon DynamoDB and the DocumentClient.","homepage":"https://github.com/jeremydaly/dynamodb-toolbox#readme","keywords":["serverless","aws","dynamodb","nosql"],"repository":{"type":"git","url":"git+https://github.com/jeremydaly/dynamodb-toolbox.git"},"contributors":[{"name":"ThomasAribart","email":"thomasa@theodo.fr"},{"name":"Naor Peled","email":"me@naor.dev"}],"author":{"name":"Jeremy Daly","email":"jeremy@jeremydaly.com"},"bugs":{"url":"https://github.com/jeremydaly/dynamodb-toolbox/issues"},"license":"MIT","readme":"# DynamoDB Toolbox <!-- omit in toc -->\n\n[![npm](https://img.shields.io/npm/v/dynamodb-toolbox.svg)](https://www.npmjs.com/package/dynamodb-toolbox)\n[![npm](https://img.shields.io/npm/l/dynamodb-toolbox.svg)](https://www.npmjs.com/package/dynamodb-toolbox)\n[![Coverage Status](https://coveralls.io/repos/github/jeremydaly/dynamodb-toolbox/badge.svg?branch=main)](https://coveralls.io/github/jeremydaly/dynamodb-toolbox?branch=main)\n[![npm](https://img.shields.io/npm/dm/dynamodb-toolbox.svg)](https://www.npmjs.com/package/dynamodb-toolbox)\n\n![dynamodb-toolbox](https://user-images.githubusercontent.com/2053544/69847647-b7910780-1245-11ea-8403-a35a0158f3aa.png)\n\n## Single Table Designs have never been this easy! <!-- omit in toc -->\n\nThe **DynamoDB Toolbox** is a set of tools that makes it easy to work with [Amazon DynamoDB](https://aws.amazon.com/dynamodb/) and the [DocumentClient](https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/dynamodb-example-document-client.html). It's designed with **Single Tables** in mind, but works just as well with multiple tables. It lets you define your Entities (with typings and aliases) and map them to your DynamoDB tables. You can then **generate the API parameters** to `put`, `get`, `delete`, `update`, `query`, `scan`, `batchGet`, and `batchWrite` data by passing in JavaScript objects. The DynamoDB Toolbox will map aliases, validate and coerce types, and even write complex `UpdateExpression`s for you. 😉\n\n## Why single table design?\nLearn more about single table design in [Alex Debrie's blog](https://www.alexdebrie.com/posts/dynamodb-single-table).\n\n## Version 0.9 🙌 <!-- omit in toc -->\n\nFeedback is welcome and much appreciated! (Huge thanks to [@ThomasAribart](https://github.com/ThomasAribart) for all his work on this 🙌)\n\n## Using AWS SDK v2?\n\ndynamodb-toolbox@v0.8 and above is using AWS SDK v3.\nIf you are using AWS SDK v2, please use versions that are lower than 0.8.\n\n## Docs & Community\n\n- [Full Documentation](https://www.dynamodbtoolbox.com/docs)\n- [GitHub Discussions](https://github.com/jeremydaly/dynamodb-toolbox/discussions)\n\n## Quick Start\n\nUsing your favorite package manager, install DynamoDB Toolbox and the aws-sdk v3 dependencies in your project by running one of the following commands:\n\n```bash\n# npm\nnpm i dynamodb-toolbox\nnpm install @aws-sdk/lib-dynamodb @aws-sdk/client-dynamodb\n\n# yarn\nyarn add dynamodb-toolbox\nyarn add @aws-sdk/lib-dynamodb @aws-sdk/client-dynamodb\n```\n\nRequire or import `Table` and `Entity` from `dynamodb-toolbox`:\n\n```typescript\nimport { Table, Entity } from 'dynamodb-toolbox'\n```\n\nCreate a Table (with the DocumentClient using aws-sdk v3):\n\n```typescript\nimport { DynamoDBClient } from '@aws-sdk/client-dynamodb'\nimport { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb'\n\nconst marshallOptions = {\n  // Whether to automatically convert empty strings, blobs, and sets to `null`.\n  convertEmptyValues: false, // if not false explicitly, we set it to true.\n  // Whether to remove undefined values while marshalling.\n  removeUndefinedValues: false, // false, by default.\n  // Whether to convert typeof object to map attribute.\n  convertClassInstanceToMap: false, // false, by default.\n}\n\nconst unmarshallOptions = {\n  // Whether to return numbers as a string instead of converting them to native JavaScript numbers.\n  // NOTE: this is required to be true in order to use the bigint data type.\n  wrapNumbers: false, // false, by default.\n}\n\nconst translateConfig = { marshallOptions, unmarshallOptions }\n\n// Instantiate a DocumentClient\nexport const DocumentClient = DynamoDBDocumentClient.from(new DynamoDBClient({}), translateConfig)\n\n\n// Instantiate a table\nconst MyTable = new Table({\n  // Specify table name (used by DynamoDB)\n  name: 'my-table',\n\n  // Define partition and sort keys\n  partitionKey: 'pk',\n  sortKey: 'sk',\n\n  // Add the DocumentClient\n  DocumentClient\n})\n```\n\nCreate an Entity:\n\n```typescript\nconst Customer = new Entity({\n  // Specify entity name\n  name: 'Customer',\n\n  // Define attributes\n  attributes: {\n    id: { partitionKey: true }, // flag as partitionKey\n    sk: { hidden: true, sortKey: true }, // flag as sortKey and mark hidden\n    age: { type: 'number' }, // set the attribute type\n    name: { type: 'string', map: 'data' }, // map 'name' to table attribute 'data'\n    emailVerified: { type: 'boolean', required: true }, // specify attribute as required\n    co: { alias: 'company' }, // alias table attribute 'co' to 'company'\n    status: ['sk', 0], // composite key mapping\n    date_added: ['sk', 1] // composite key mapping\n  },\n\n  // Assign it to our table\n  table: MyTable\n\n  // In Typescript, the \"as const\" statement is needed for type inference\n} as const)\n```\n\nPut an item:\n\n```typescript\n// Create an item (using table attribute names or aliases)\nconst customer = {\n  id: 123,\n  age: 35,\n  name: 'Jane Smith',\n  emailVerified: true,\n  company: 'ACME',\n  status: 'active',\n  date_added: '2020-04-24'\n}\n\n// Use the 'put' method of Customer:\nawait Customer.put(customer)\n```\n\nThe item will be saved to DynamoDB like this:\n\n```typescript\n{\n  \"pk\": 123,\n  \"sk\": \"active#2020-04-24\",\n  \"age\": 35,\n  \"data\": \"Jane Smith\",\n  \"emailVerified\": true,\n  \"co\": \"ACME\",\n  // Attributes auto-generated by DynamoDB-Toolbox\n  \"_et\": \"customer\", // Entity name (required for parsing)\n  \"_ct\": \"2021-01-01T00:00:00.000Z\", // Item creation date (optional)\n  \"_md\": \"2021-01-01T00:00:00.000Z\" // Item last modification date (optional)\n}\n```\n\nYou can then get the data:\n\n```typescript\n// Specify primary key\nconst primaryKey = {\n  id: 123,\n  status: 'active',\n  date_added: '2020-04-24'\n}\n\n// Use the 'get' method of Customer\nconst response = await Customer.get(primaryKey)\n```\n\nSince v0.4, the method inputs, options and response types are inferred from the Entity definition:\n\n```typescript\nawait Customer.put({\n  id: 123,\n  // ❌ Sort key is required (\"sk\" or both \"status\" and \"date_added\")\n  age: 35,\n  name: ['Jane', 'Smith'], // ❌ name should be a string\n  emailVerified: undefined, // ❌ attribute is marked as required\n  company: 'ACME'\n})\n\nconst { Item: customer } = await Customer.get({\n  id: 123,\n  status: 'active',\n  date_added: '2020-04-24' // ✅ Valid primary key\n})\ntype Customer = typeof customer\n// 🙌 Type is equal to:\ntype ExpectedCustomer =\n  | {\n      id: any\n      age?: number | undefined\n      name?: string | undefined\n      emailVerified: boolean\n      company?: any\n      status: any\n      date_added: any\n      entity: string\n      created: string\n      modified: string\n    }\n  | undefined\n```\n\nSee [Type Inference](https://www.dynamodbtoolbox.com/docs/type-inference) in the documentation for more details.\n\n## Features\n\n- **Table Schemas and DynamoDB Typings:** Define your Table and Entity data models using a simple JavaScript object structure, assign DynamoDB data types, and optionally set defaults.\n- **Magic UpdateExpressions:** Writing complex `UpdateExpression` strings is a major pain, especially if the input data changes the underlying clauses or requires dynamic (or nested) attributes. This library handles everything from simple `SET` clauses, to complex `list` and `set` manipulations, to defaulting values with smartly applied `if_not_exists()` to avoid overwriting data.\n- **Bidirectional Mapping and Aliasing:** When building a single table design, you can define multiple entities that map to the same table. Each entity can reuse fields (like `pk` and`sk`) and map them to different aliases depending on the item type. Your data is automatically mapped correctly when reading and writing data.\n- **Composite Key Generation and Field Mapping:** Doing some fancy data modeling with composite keys? Like setting your `sortKey` to `[country]#[region]#[state]#[county]#[city]#[neighborhood]` model hierarchies? DynamoDB Toolbox lets you map data to these composite keys which will both autogenerate the value _and_ parse them into fields for you.\n- **Type Coercion and Validation:** Automatically coerce values to strings, numbers and booleans to ensure consistent data types in your DynamoDB tables. Validate `list`, `map`, and `set` types against your data. Oh yeah, and `set`s are automatically handled for you. 😉\n- **Powerful Query Builder:** Specify a `partitionKey`, and then easily configure your sortKey conditions, filters, and attribute projections to query your primary or secondary indexes. This library can even handle pagination with a simple `.next()` method.\n- **Simple Table Scans:** Scan through your table or secondary indexes and add filters, projections, parallel scans and more. And don't forget the pagination support with `.next()`.\n- **Filter and Condition Expression Builder:** Build complex Filter and Condition expressions using a standardized `array` and `object` notation. No more appending strings!\n- **Projection Builder:** Specify which attributes and paths should be returned for each entity type, and automatically filter the results.\n- **Secondary Index Support:** Map your secondary indexes (GSIs and LSIs) to your table, and dynamically link your entity attributes.\n- **Batch Operations:** Full support for batch operations with a simpler interface to work with multiple entities and tables.\n- **Transactions:** Full support for transaction with a simpler interface to work with multiple entities and tables.\n- **Default Value Dependency Graphs:** Create dynamic attribute defaults by chaining other dynamic attribute defaults together.\n- **TypeScript Support:** v0.4 of this library provides strong typing support AND type inference 😍. Inferred type can still overriden with [Overlays](#overlays). Some [Utility Types](#utility-types) are also exposed. Additional work is still required to support schema validation & typings.\n\n## Additional References\n\n- [DocumentClient SDK Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/modules/_aws_sdk_lib_dynamodb.html)\n- [Best Practices for DynamoDB](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/best-practices.html)\n- [DynamoDB, explained.](https://www.dynamodbguide.com/)\n- [The DynamoDB Book](https://www.dynamodbbook.com/)\n\n## Contributions and Feedback\n\nContributions, ideas and bug reports are welcome and greatly appreciated. Please add [issues](https://github.com/jeremydaly/dynamodb-toolbox/issues) for suggestions and bug reports or create a pull request. You can also contact me on Twitter: [@jeremy_daly](https://twitter.com/jeremy_daly).\n","readmeFilename":"README.md"}