{"id":24129565,"url":"https://github.com/luandro/claudia-pouchdb-replication-stream","last_synced_at":"2025-07-04T16:06:56.213Z","repository":{"id":79813199,"uuid":"60652718","full_name":"luandro/claudia-pouchdb-replication-stream","owner":"luandro","description":"AWS Lambda endpoint for streaming bulk couchdb changes to pouchdb","archived":false,"fork":false,"pushed_at":"2016-06-07T23:09:46.000Z","size":2,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-01T05:18:35.675Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/luandro.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":"2016-06-07T23:09:17.000Z","updated_at":"2016-06-07T23:09:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"7756fee6-943e-47ca-a94b-2d65d77e3010","html_url":"https://github.com/luandro/claudia-pouchdb-replication-stream","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/luandro/claudia-pouchdb-replication-stream","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luandro%2Fclaudia-pouchdb-replication-stream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luandro%2Fclaudia-pouchdb-replication-stream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luandro%2Fclaudia-pouchdb-replication-stream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luandro%2Fclaudia-pouchdb-replication-stream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luandro","download_url":"https://codeload.github.com/luandro/claudia-pouchdb-replication-stream/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luandro%2Fclaudia-pouchdb-replication-stream/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263573189,"owners_count":23482605,"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":"2025-01-11T19:33:50.793Z","updated_at":"2025-07-04T16:06:56.191Z","avatar_url":"https://github.com/luandro.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Claudia Pouchdb Replication Stream\n\nThis module provides an express endpoint for streaming bulk couchdb changes to pouchdb. It makes use of the great [PouchDB Replication Stream](https://github.com/nolanlawson/pouchdb-replication-stream) module.\n\n- [Install](#install)\n- [Usage](#usage)\n- [Database Name in Request](#db-name-in-request)\n- [Filtered Replication](#filtered-replication)\n- [Replication Options](#replication-options)\n- [Error Handling](#error-handling)\n\n### Install\n\nInstall with npm:\n\n```bash\nnpm i -S claudia-pouchdb-replication-stream\n```\n\n### Usage\n\nBasic usage enables streaming of one db to the client:\n\n```javascript\nvar ApiBuilder = require('claudia-api-builder');\nvar repStream = require('claudia-pouchdb-replication-stream');\nconst api = new ApiBuilder();\nmodule.exports = api;\n\n\napi.get('/api/couchdb', repStream('http://user:pass@localhost:5984/db'));\n```\n\n### Database Name in Request\n\nIf you have per-user databases, or you want to get changes from different databases based on the request, this will work:\n\n```javascript\napi.get('/api/couchdb/:db', repStream({\n  url     : 'http://user:pass@localhost:5984/',\n  dbReq   : true\n}));\n```\n\n### Filtered Replication\n\nIn order to do filtered replication, there are two options. If the parameters are known beforehand, then this method can be used:\n\n```javascript\napi.get('/api/couchdb', repStream({\n  url           : 'http://user:pass@localhost:5984/',\n  replication   : {\n    filter        : 'myFilterName',\n    query_params  : {\n      prop1       : 'myFilterParameter1'\n    }\n  }\n});\n```\n\nHowever, if the filter options are also dynamic/based on the request, then the request data must be parsed first:\n\n```javascript\napi.get('/api/couchdb/:filterFunc/:filterBy', function(req){\n  var filterFunc = req.pathParams.filterFunc;\n  var filterBy = req.pathParams.filterBy;\n  repStream({\n    url           : 'http://user:pass@localhost:5984/',\n    replication   : {\n      filter        : filterFunc,\n      query_params  : {\n        docName     : filterBy\n      }\n    }\n  })(req, res, next);\n});\n```\n\n### Replication Options\n\nAllowed replication options:\n\n```\nbatch_size\nbatches_limit\nfilter\ndoc_ids\nquery_params\nsince\nview\n```\n\n[PouchDB Replication Options](http://pouchdb.com/api.html#replication)\n[CouchDB Replication Options](http://wiki.apache.org/couchdb/Replication)\n\n### Error Handling\n\nThe default behavior is to send an error response with a `500` error code and\nthe error message. To overwrite this, pass a method to the `error` option:\n\n```javascript\nrepStream({\n  url     : 'http://user:pass@localhost:5984/',\n  error   : function(err){\n    // do what you will with `err` here\n    console.log(err);\n    res.send(err);\n  }\n});\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluandro%2Fclaudia-pouchdb-replication-stream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluandro%2Fclaudia-pouchdb-replication-stream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluandro%2Fclaudia-pouchdb-replication-stream/lists"}