{"id":19837334,"url":"https://github.com/e-e-e/hyperdb-stage","last_synced_at":"2025-05-01T18:30:37.196Z","repository":{"id":97158361,"uuid":"144002736","full_name":"e-e-e/hyperdb-stage","owner":"e-e-e","description":"A staging area for hyperdb.","archived":false,"fork":false,"pushed_at":"2018-08-09T11:38:31.000Z","size":106,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-20T15:07:34.758Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/hyperdb-stage","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/e-e-e.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-08T11:15:18.000Z","updated_at":"2018-12-12T09:59:23.000Z","dependencies_parsed_at":"2023-07-23T20:45:36.943Z","dependency_job_id":null,"html_url":"https://github.com/e-e-e/hyperdb-stage","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"4b38f217269dc8879e6e1f7c3ae2af2838cb6fa2"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e-e-e%2Fhyperdb-stage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e-e-e%2Fhyperdb-stage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e-e-e%2Fhyperdb-stage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e-e-e%2Fhyperdb-stage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/e-e-e","download_url":"https://codeload.github.com/e-e-e/hyperdb-stage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251879145,"owners_count":21658693,"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":[],"created_at":"2024-11-12T12:14:06.894Z","updated_at":"2025-05-01T18:30:36.817Z","avatar_url":"https://github.com/e-e-e.png","language":"JavaScript","readme":"# hyperdb-stage\n\n[![Build Status](https://travis-ci.org/e-e-e/hyperdb-stage.svg?branch=master)](https://travis-ci.org/e-e-e/hyperdb-stage) [![Coverage Status](https://coveralls.io/repos/github/e-e-e/hyperdb-stage/badge.svg?branch=master)](https://coveralls.io/github/e-e-e/hyperdb-stage?branch=master)\n\nA staging area for [hyperdb](https://github.com/mafintosh/hyperdb).\n\nThis enables you to interact with the stage as if it is the actual hyperdb instance. Put, delete, get, create a stream of data, or whatever, exactly as you would normally. However any changes you make to the stage will not effect the actual db until you commit them.\n\n**hyperdb-stage is not multi writer enabled.**\n\n## Installation\n\n```\nnpm install hyperdb-stage\n```\n\n## Usage\n\nA super simple example:\n\n```js\nconst hyperdb = require('hyperdb')\nconst createStage = require('hyperdb-stage')\nconst ram = require('random-access-memory')\n\nconst db = hyperdb(() =\u003e ram())\n\ndb.put('a', 'value', () =\u003e {\n  // simply wrap any db in stage to create a staging area\n  const tmp = createStage(db)\n  tmp.put('b', 'next value', () =\u003e {\n    // b is not yet available in the db until you commit\n    tmp.commit(() =\u003e {\n      // b is now committed added to the db\n    })\n  })\n})\n```\n\n## API\n\nStage has mostly the same api as [hyperdb](https://github.com/mafintosh/hyperdb#api).\n\n### Stage specific functions\n\nIn addition to hyperdb there are these special stage methods.\n\n#### `stage = createStage(db)`\n\nTakes a hyperdb instance and returns a staging area.\n\n#### `stage.commit(callback)`\n\nThis commits staged changes to the hyperdb.\n\n**Note:** hyperdb-stage commits the state of the staging area, not its history. Changes are committed in key hash order *not* in the order that they were added. \n\nCallback is fired once all changes have been committed.\n\n#### `stage.revert()`\n\nDestroy all staged changes.\n\n### Unsupported Hyperdb methods\n\nThe Staging area is not intended to be replicated or shared. It is a temporary in memory database for staging changes before committing them to your db instance.\n\nAs such the following methods are unsupported. \n\n- db.key\n- db.discoveryKey\n- db.local\n- db.on()\n- db.version()\n- db.checkout(version)\n- db.authorize(key, [callback])\n- db.authorized(key, [callback])\n- db.replicate([options])\n\n**Note:** You can still access these methods via `staging.db` or on the original hyperdb instance.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fe-e-e%2Fhyperdb-stage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fe-e-e%2Fhyperdb-stage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fe-e-e%2Fhyperdb-stage/lists"}