{"id":16181722,"url":"https://github.com/ericclemmons/bookshelf-manager","last_synced_at":"2025-03-19T01:31:16.889Z","repository":{"id":14518206,"uuid":"17232104","full_name":"ericclemmons/bookshelf-manager","owner":"ericclemmons","description":"Easily wire up models to APIs with supported for complex, nested saving.","archived":false,"fork":false,"pushed_at":"2020-05-29T02:05:57.000Z","size":88,"stargazers_count":33,"open_issues_count":5,"forks_count":10,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-10T19:03:17.626Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ericclemmons.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-02-27T01:19:03.000Z","updated_at":"2025-02-28T03:01:50.000Z","dependencies_parsed_at":"2022-09-01T00:12:39.438Z","dependency_job_id":null,"html_url":"https://github.com/ericclemmons/bookshelf-manager","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericclemmons%2Fbookshelf-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericclemmons%2Fbookshelf-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericclemmons%2Fbookshelf-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericclemmons%2Fbookshelf-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ericclemmons","download_url":"https://codeload.github.com/ericclemmons/bookshelf-manager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243960361,"owners_count":20375102,"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-10-10T06:26:56.573Z","updated_at":"2025-03-19T01:31:16.657Z","avatar_url":"https://github.com/ericclemmons.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [Bookshelf Manager][0]\n\n[![Build Status](https://travis-ci.org/ericclemmons/bookshelf-manager.png)](https://travis-ci.org/ericclemmons/bookshelf-manager)\n[![Dependencies](https://david-dm.org/ericclemmons/bookshelf-manager.png)](https://david-dm.org/ericclemmons/bookshelf-manager)\n[![devDependencies](https://david-dm.org/ericclemmons/bookshelf-manager/dev-status.png)](https://david-dm.org/ericclemmons/bookshelf-manager#info=devDependencies\u0026view=table)\n\n\u003e Model \u0026 Collection manager for [Bookshelf.js][1] to make it easy to create \u0026\n\u003e save deep, nested JSON structures from API requests.\n\n## Installation\n\n    npm install bookshelf-manager --save\n\n## Usage\n\n  1. Register as a plugin in Bookshelf:\n\n     ```javascript\n     bookshelf.plugin('bookshelf-manager');\n     ```\n\n      - Optionally, you can pass in an object with a `root` property to read models from a specified directory:\n\n         ```javascript\n         bookshelf.plugin('bookshelf-manager', { root: 'path/to/models' });\n         ```\n\n  2. Register individual models (not required if you passed in a `root` model directory as above):\n\n     ```javascript\n     bookshelf.manager.register(model, modelName);\n     ```\n\n     - Note: Also compatible with models registered with the [Bookshelf Registry](https://github.com/tgriesser/bookshelf/wiki/Plugin:-Model-Registry) plugin.\n\n  3. Use the methods on `bookshelf.manager` to create, fetch, and save models or collections with support for deeply-nested attributes. E.g.:\n\n     ```javascript\n     return bookshelf.manager.create('car', {\n       features: [\n         { name: 'ABS', cost: '1250' },\n         { name: 'GPS', cost: '500' }\n       ],\n       quantity: 1\n     }).then(function(car) {\n       // created car should now have the associated features\n     });\n     ```\n\n\n## API\n\n*In progress...*\n\n\n## Changelog\n\n- v0.3.0 - Add `setHasOne` functionality (#12)\n- v0.2.1 - Several breaking changes occurred with this version due to updating `devDependencies` and `peerDependencies`:\n  - Knex and Bookshelf updated their `bluebird` and `lodash` dependencies\n  - Knex changed how undefined values are inserted\n- v0.1.0 - Reimplement as a plugin for Bookshelf/Knex 0.8.x\n- v0.0.10 - Enforce `belongsToMany` IDs\n- v0.0.9 - Destroy removed `hasMany` models\n- v0.0.8 - Fetch empty collections\n- v0.0.7 - Attempt to use existing, eager-loaded models rather than re-fetch\n- v0.0.6 - Ignore `_pivot_` keys\n- v0.0.5 - Improve error handling for unintialized instances \u0026 missing files\n- v0.0.4 - Improve `.attach` and `.detach`\n- v0.0.3 - Add support for lazy-managed models.\n- v0.0.2 - If instanceof Bookshelf is not provided, instance from `Bookshelf.initialize` is used.\n- v0.0.1 - Initial Release.\n\n\n## [License][2]\n\nCopyright (c) 2013 Eric Clemmons\nLicensed under the MIT license.\n\n[0]: https://github.com/ericclemmons/bookshelf-manager\n[1]: http://bookshelfjs.org/\n[2]: https://raw.github.com/ericclemmons/bookshelf-manager/master/LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericclemmons%2Fbookshelf-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fericclemmons%2Fbookshelf-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericclemmons%2Fbookshelf-manager/lists"}