{"id":31282045,"url":"https://github.com/abdullahzn/dynamo-node","last_synced_at":"2025-09-24T03:06:07.985Z","repository":{"id":20587487,"uuid":"90352114","full_name":"AbdullahZN/dynamo-node","owner":"AbdullahZN","description":"DynamoDB mapper","archived":false,"fork":false,"pushed_at":"2022-12-30T17:25:06.000Z","size":389,"stargazers_count":11,"open_issues_count":11,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-23T07:35:34.838Z","etag":null,"topics":["db","dynamo","dynamodb","dynamodb-orm","mapper","node","nodejs","orm"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AbdullahZN.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-05T08:01:06.000Z","updated_at":"2024-04-04T17:48:20.000Z","dependencies_parsed_at":"2023-01-13T21:02:42.629Z","dependency_job_id":null,"html_url":"https://github.com/AbdullahZN/dynamo-node","commit_stats":null,"previous_names":["abdullahzn/node-dynamo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AbdullahZN/dynamo-node","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AbdullahZN%2Fdynamo-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AbdullahZN%2Fdynamo-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AbdullahZN%2Fdynamo-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AbdullahZN%2Fdynamo-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AbdullahZN","download_url":"https://codeload.github.com/AbdullahZN/dynamo-node/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AbdullahZN%2Fdynamo-node/sbom","scorecard":{"id":7864,"data":{"date":"2025-08-11","repo":{"name":"github.com/AbdullahZN/dynamo-node","commit":"0bdb95e70d29828b571e6ea40f093c5402585e58"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/1 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"34 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-6chw-6frg-f759","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-rrc9-gqf8-8rwg","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-2j2x-2gpw-g8fm","Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546","Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx","Warn: Project is vulnerable to: GHSA-6c8f-qphg-qjgp","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-fhjf-83wg-r2j9","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-g6ww-v8xp-vmwg","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-4g88-fppr-53pp","Warn: Project is vulnerable to: GHSA-4jqc-8m5r-9rpr","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-776f-qx25-q3cc","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-14T13:57:44.327Z","repository_id":20587487,"created_at":"2025-08-14T13:57:44.327Z","updated_at":"2025-08-14T13:57:44.327Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276683939,"owners_count":25685652,"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","status":"online","status_checked_at":"2025-09-24T02:00:09.776Z","response_time":97,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["db","dynamo","dynamodb","dynamodb-orm","mapper","node","nodejs","orm"],"created_at":"2025-09-24T03:04:34.035Z","updated_at":"2025-09-24T03:06:07.979Z","avatar_url":"https://github.com/AbdullahZN.png","language":"JavaScript","readme":"# DynamoDB Mapper\n[![Travis-ci](https://travis-ci.org/AbdullahZN/dynamo-node.svg?branch=master)](https://travis-ci.org/AbdullahZN/dynamo-node)\n\nThis DynamoDB Mapper for node.js aims to provide a simple and complete implementation to work with DynamoDB databases.\nYou can easily select a table and start querying/writing data, from simple requests to conditional ones without prior knowledge.\n\nCurrent features:\n - **Expression Abstraction:** Condition, Attribute values/names, Projections, Filters, KeyConditions\n - **Conditional Requests:** Add, update, delete and query conditionally\n - **Attribute Functions:** begins_with, contains, typeIs, in\n - **Incrementing Decrementing**\n - **List, Set Append/Remove**\n - **Attribute Removal**\n\n#### **Please note this repository is a work in progress. Contributions are welcome.**\n\n## Requirements\n\nInstall package from npm or yarn\n\n```bash\n\u003e npm install dynamo-node || yarn add dynamo-node\n```\n\nYou can either set your AWS credentials as env variables or as a JSON file\n\n```js\n// AWS credentials as JSON file\n{\n  \"accessKeyId\": \"myKey\",\n  \"secretAccessKey\": \"yourSecret\",\n}\n```\n\nRequire module\n```js\nconst DynamoDB = require('dynamo-node')(region [, credit_path ]);\n// e.g with json credentials\nconst DynamoDB = require('dynamo-node')('eu-central-1', './credits.json');\n// e.g with env vars\nprocess.env.DYNAMO_ENV = 'test';\nconst DynamoDB = require('dynamo-node')('eu-central-1');\n```\n\n\n## Usage\n\n---\n\n#### Tables\n\nInits your table, or sets tablename for further creation\n\n```js\n// \"users\" refers to the TableName we want to query from\nconst UserTable = DynamoDB.select('users');\n```\n\n_**Create**_\n\nAttribute types association\n\nS  |  SS | N  | NS  |  B  |  BS | BOOL  |  NULL  | L   |  M\n--|---|---|---|---|---|---|---|---|--\nString  | String Set  | Number  | Number Set  | Binary  | Binary Set  | Boolean  | Null  | List  | Map\n\n\n```js\nUserTable.createTable({\n    KeySchema: [\n        { AttributeName: \"name\", KeyType: \"HASH\"},  //Partition key\n        { AttributeName: \"uid\", KeyType: \"RANGE\" }  //Sort key\n    ],\n    AttributeDefinitions: [\n        { AttributeName: \"uid\", AttributeType: \"N\" },\n        { AttributeName: \"name\", AttributeType: \"S\" }\n    ],\n    ProvisionedThroughput: {\n        ReadCapacityUnits: 10,\n        WriteCapacityUnits: 10\n    }\n});\n```\n\n_**Delete**_\n\n```js\nUserTable.deleteTable();\n```\n\n\n---\n\n#### Items\n\n_**Add**_\n\n```js\nUserTable.add({\n  name: \"abdu\", // Primary Key\n  participants: [\"A\", \"B\", \"C\", \"D\"],\n  last: \"D\"\n});\n```\n\n_**Get**_\n\n```js\nUserTable.get({ name: \"abdu\" });\n```\n\n_**Update**_\n\n```js\n// if \"abdu\" doesn't exist, it will be added (upsert)\nUserTable.update({ name: \"abdu\" }, {\n  friends: [\"abdu\", \"chris\"],\n  points: 450,\n});\n\n// nested properties, assuming clothes is set and is of type Map\nUserTable.update({ name: \"abel\" }, {\n  'clothes.shirts': 10,\n  'clothes.polos': 3\n});\n\nUserTable.update(key, attributes, 'OLD'); // returns item's pre-update state\nUserTable.update(key, attributes, 'UPD'); // default, returns only updated attributes\nUserTable.update(key, attributes, 'NEW'); // returns item's post-update state\n```\n\n_**Delete**_\n\n```js\nUserTable.delete({ name: \"abdu\" });\n```\n\n_**Query**_\n\n```js\nUserTable.query('name', '=', 'abdu');\n\n// Using global secondary index\nUserTable.useIndex('age-index').query('age', '=', 5);\n```\n\n_**Scan**_\n\nReturns all items from table\n\n```js\n// a very expensive task !\nUserTable.scan();\n```\n\n## Conditional Queries\n\n_**Check if attribute exists**_\n\n```js\nconst newUser = { name: \"abel\", age: 34 };\n\nUserTable.exists('name').add(newUser);\nUserTable.exists( ['name', 'age'] ).add(newUser);\n\nUserTable.notExists('name').add(newUser);\nUserTable.notExists( ['name', 'age'] ).add(newUser);\n```\n\n_**Attribute comparison**_\n\n```js\nconst hector = { name: \"hector\" };\n\nUserTable.add({ name: \"hector\", last_connection: 50, age: 10, friends: { nice: 0, bad: 10 } });\n\n// Deletes it\nUserTable\n  .if('last_connection', '\u003e', 30 )\n  .if('last_connection', '\u003c', 100)\n  .if('age', '\u003c\u003e', 90) // different than\n  .delete(hector);\n\n// Updates it\nUserTable\n  .if('last_connection', '=', 50)\n  .if('friends.bad', '\u003e=', 0)\n  .if('age', '\u003c=', 10)\n  .update(hector, { candy: 1 });\n```\n\n_**Attribute functions**_\n\n\n\u003ckbd\u003ebeginsWith\u003c/kbd\u003e\n\n- matches a substring with the beggining of an attribute\n\n```js\n\n// Updates user if nickname attribute begins with a 'm'\nUserTable.where('nickname', 'beginsWith', 'm').update(momo, { nickname: \"lol\" });\n```\n\n\u003ckbd\u003econtains\u003c/kbd\u003e\n\n- String: matches substring\n- List: matches element\n\n```js\n// Updates user if nickname contains 'lol'\nUserTable.where('nickname', 'contains', 'lol').update(momo, { fun: true });\n\n// Updates user if 'homer' is in parents list\nUserTable.where('parents', 'contains', 'homer').update(momo, { cool: true });\n```\n\n\u003ckbd\u003etypeIs\u003c/kbd\u003e\n\n- matches attribute type\n\nPlease refer to \"Attribute types association\" section for the list of type attributes\n\n```js\n// Updates user momo if his friends attribute is N (number)\nUserTable.where('friends', 'typeIs', 'N').update(momo, { friends: 0 });\n```\n\n\u003ckbd\u003einList\u003c/kbd\u003e\n\n- matches attribute with provided array\n\n```js\n// Gets user named 'abel' if he has a friend named 'abdu' or 'chris'\nUserTable.inList('friends', [ 'abdu', 'chris' ]).query('name', '=', 'abel');\n\n```\n\n## Attribute manipulation\n\n_**Increment/Decrement attribute**_\n\n```js\nconst burger = { name: 'burger' };\n\nFoodTable.add({ name: 'burger', sold: 0, sellers: [5,8], ingredients: { cheese: 2 } });\n\nFoodTable.increment('sold', 10).update(burger); // { sold: 10 }\nFoodTable.decrement('sold', 1).update(burger); // { sold: 9 }\n\nFoodTable.increment('ingredients.cheese', 4).update(burger);\nFoodTable.decrement('ingredients.cheese', 1).update(burger);\n```\n\n_**Remove attribute**_\n```js\nFoodTable.removeAttribute(burger, [ 'ingredients.cheese' ]);\nFoodTable.removeAttribute(burger, [ 'sold', 'ingredients' ]);\n// burger is now { name: burger, sellers: [5,8] }\n```\n\n_**Add to/Remove from list attribute**_\n```js\n\n// The provided array of VALUES will be appended to the attribute\nFoodTable.addToList({ sellers: [9] }).update(burger) // { ..., sellers: [5, 8, 9] }\n\n// This time we pass an array of INDEXES from which we want to delete\nFoodTable.removeFromList({ sellers: [1] }).update(burger) // { ..., sellers: [5, 9] }\n```\n---\n\n## Batch Operations\n\n```js\n// No need to provide a table name this time\nconst Batch = DynamoDB.select();\n```\n\n```js\nconst batchGet = {\n    'table1': {\n        // 'name' is the primary key of table1\n        Keys: { 'name': ['myItem', 'myItem2', 'myItem3', 'myItem4'] }\n    },\n    'table2': {\n        // 'pid' is the primary key of table2\n        Keys: { 'pid': [1101, 1110, 1010] }\n    }\n};\nBatch.batchGet(batchGet);\n```\n\n```js\nconst batchPut = {\n    'table1': [ { name: 'a'}, { name: 'b' }, { name: 'c' }, { name: 'd' } ],\n    'table2': [ { pid: 1 }, { pid: 2 }, { pid: 3 }, { pid: 4 } ],\n};\n\nBatch.batchPut(batchPut);\n```\n\n```js\nconst batchDelete = {\n    'table1': [ { name: 'b' }, { name: 'c' } ],\n    'table2': [ { pid: 3 }, { pid: 4 } ],\n};\n\nBatch.batchDelete(batchDelete);\n```\n\n#### Projections\n\nYou can select which attributes you want back from the result when performing get, query or scan operations\n\n```js\nTable.add({ id: 1, status: 2, a, b, c, d });\nTable.add({ id: 2, status: 2, e, f, g, h });\n\n// returns { Items: [{ id: 1 }], Count: 1, ... }\nTable.project('id').query('id', '=', 1);\n\n// returns { Items: [{ id: 1, status: 2 }, { id: 2, status: 2 }], ... }\nTable.project(['id', 'status']).scan();\n\n// returns { status: 2 }\nTable.project(['status']).get({ id: 1 });\n```\n\n#### Return values\n\nAll methods return promises\n\n```js\n// outputs \"Abdu\"\nUserTable.get({ name: \"abdu\" })\n    .then(item =\u003e console.log(item.name));\n\n// outputs \"26\"\nUserTable.update({ name: \"abdu\" }, { age: \"26\" })\n    .then(item =\u003e console.log(item.age));\n\n// both outputs \"{}\"\nUserTable.delete({ name: \"abdu\" })\n    .then(item =\u003e console.log(item));\n\nUserTable.add({ name: \"Chris\", age: \"65\" })\n    .then(item =\u003e console.log(item));\n\n```\n\n---\n\n#### Test \u0026 Development\n\nTests are located in the **./tests** folder\n\nRun tests\n```bash\n\u003e npm run test || yarn test\n```\n\n#### Environment\n\nYou need to set up a specific envvar to start development with dynamo-node and a local dynamo db\n\n```js\nprocess.env.DYNAMO_ENV = 'test';\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabdullahzn%2Fdynamo-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabdullahzn%2Fdynamo-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabdullahzn%2Fdynamo-node/lists"}