{"id":19078141,"url":"https://github.com/rfoel/dinamo","last_synced_at":"2025-04-30T04:41:38.743Z","repository":{"id":62096577,"uuid":"541772422","full_name":"rfoel/dinamo","owner":"rfoel","description":"Amazon Dynamo (Amazon DynamoDB) opinionated utilities for Node.js.","archived":false,"fork":false,"pushed_at":"2024-01-26T12:46:51.000Z","size":857,"stargazers_count":6,"open_issues_count":10,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-16T05:34:25.010Z","etag":null,"topics":["aws-sdk","dynamo","dynamodb","hacktoberfest","node","nodejs"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rfoel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-09-26T20:28:32.000Z","updated_at":"2023-07-02T14:48:59.000Z","dependencies_parsed_at":"2024-01-26T13:57:42.121Z","dependency_job_id":null,"html_url":"https://github.com/rfoel/dinamo","commit_stats":{"total_commits":16,"total_committers":2,"mean_commits":8.0,"dds":0.25,"last_synced_commit":"ee7aa12efec5e3bec962b6a8a774b3c0dbd50803"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rfoel%2Fdinamo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rfoel%2Fdinamo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rfoel%2Fdinamo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rfoel%2Fdinamo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rfoel","download_url":"https://codeload.github.com/rfoel/dinamo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251644826,"owners_count":21620630,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-sdk","dynamo","dynamodb","hacktoberfest","node","nodejs"],"created_at":"2024-11-09T02:06:01.443Z","updated_at":"2025-04-30T04:41:38.726Z","avatar_url":"https://github.com/rfoel.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dinamo\n\n[Amazon Dynamo (Amazon DynamoDB)](https://aws.amazon.com/dynamodb/) _opinionated_ utilities for Node.js.\n\n[![NPM version](https://badge.fury.io/js/dinamo.svg)](http://badge.fury.io/js/dinamo)\n\n[![npm](https://nodei.co/npm/dinamo.png)](https://www.npmjs.com/package/dinamo)\n\n## Getting started\n\nFirst install the library:\n\n```sh\nnpm i dinamo @aws-sdk/client-dynamodb @aws-sdk/lib-dynamodb\n```\n\n\u003e Note that `@aws-sdk/client-dynamodb` and `@aws-sdk/lib-dynamodb` are peer dependencies for this library, so instead of bundling it with the package you MUST install it separately.\n\nThen create an instance in your code:\n\n```js\nimport Dinamo from 'dinamo'\n\nconst dinamo = new Dinamo({ tableName: 'my-table' })\n```\n\nIf you are using DynamoDB in a Docker container you can pass the endpoint as a parameter:\n\n```js\nconst dinamo = new Dinamo({\n  endpoint: 'http://localhost:8000',\n  tableName: 'my-table',\n})\n```\n\nYou can also configure the AWS SDK client logger:\n\n```js\nconst dinamo = new Dinamo({\n  logger: console,\n  tableName: 'my-table',\n})\n```\n\n## Usage\n\n### `batchGet`\n\nGets items in batch.\n\n```js\nawait dinamo.batchGet({ keys: [{ id: 'a' }, { id: 'b' }, { id: 'c' }] })\n```\n\n### `decrement`\n\nDecrements an item. Step is optional.\n\n```js\nawait dinamo.decrement({ key: { id: 'a' }, field: 'count', step: 1 })\n```\n\n### `delete`\n\nSoft deletes an item, i.e., adds a flag `deletedAt` with the timestamp of deletion. This is true by default and `query` and `scan` will filter out the deleted items by default too.\n\n```js\nawait dinamo.delete({ key: { id: 'a' }, soft: true })\n```\n\nDeletes an item from the database.\n\n```js\nawait dinamo.delete({ key: { id: 'a' }, soft: false })\n```\n\n### `get`\n\nGets a single item.\n\n```js\nawait dinamo.get({ key: { id: 'a' } })\n```\n\n### `increment`\n\nIncrements an item. Step is optional.\n\n```js\nawait dinamo.increment({ key: { id: 'a' }, field: 'count', step: 1 })\n```\n\n### `put`\n\nPuts an item.\n\n```js\nawait dinamo.put({ item: { id: 'a', foo: 'bar' } })\n```\n\n### `query`\n\nQueries items from the database.\n\n```js\nawait dinamo.query({ key: { id: 'a' } })\n```\n\nWith `indexName`.\n\n```js\nawait dinamo.query({ key: { id: 'a' }, indexName: 'dateIdIndex' })\n```\n\nFiltering items.\n\n```js\nawait dinamo.query({ key: { id: 'a' }, query: { foo: 'bar' } })\n```\n\nDisable filtering soft deletes.\n\n```js\nawait dinamo.query({ key: { id: 'a' }, filterDeleted: false })\n```\n\nLimiting items.\n\n```js\nawait dinamo.query({ key: { id: 'a' }, limit: 10 })\n```\n\nReverse ordering items based on range key.\n\n```js\nawait dinamo.query({ key: { id: 'a' }, scanIndexForward: true })\n```\n\n### `scan`\n\nScans items from the database.\n\n```js\nawait dinamo.scan({ query: { id: 'a' } })\n```\n\nRecursively scan items.\n\n```js\nawait dinamo.scan({ query: { id: 'a' }, recursive: true })\n```\n\nDisable filtering soft deletes\n\n```js\nawait dinamo.scan({ query: { id: 'a' }, filterDeleted: false })\n```\n\n### `update`\n\nUpdates an item.\n\n```js\nawait dinamo.update({ key: { id: 'a' }, item: { foo: 'baz' } })\n```\n\n## Contributing\n\nIssues and pull requests are welcome.\n\n## License\n\n[MIT](https://github.com/rfoell/dinamo/blob/main/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frfoel%2Fdinamo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frfoel%2Fdinamo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frfoel%2Fdinamo/lists"}