{"id":25837258,"url":"https://github.com/devtin/duck-storage-di","last_synced_at":"2026-05-14T03:33:31.439Z","repository":{"id":57216941,"uuid":"337500766","full_name":"devtin/duck-storage-di","owner":"devtin","description":"loads duck-storage entities from a path to provide a pleasure-di container","archived":false,"fork":false,"pushed_at":"2021-02-20T14:29:58.000Z","size":195,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-09T17:34:35.315Z","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/devtin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2021-02-09T18:36:46.000Z","updated_at":"2021-02-20T14:30:00.000Z","dependencies_parsed_at":"2022-08-28T21:40:11.425Z","dependency_job_id":null,"html_url":"https://github.com/devtin/duck-storage-di","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devtin%2Fduck-storage-di","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devtin%2Fduck-storage-di/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devtin%2Fduck-storage-di/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devtin%2Fduck-storage-di/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devtin","download_url":"https://codeload.github.com/devtin/duck-storage-di/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241309091,"owners_count":19941726,"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-03-01T02:48:05.537Z","updated_at":"2026-05-14T03:33:31.397Z","avatar_url":"https://github.com/devtin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv\u003e\u003ch1\u003educk-storage-di\u003c/h1\u003e\u003c/div\u003e\n\n\u003cp\u003e\n    \u003ca href=\"https://www.npmjs.com/package/duck-storage-di\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/duck-storage-di.svg\" alt=\"Version\"\u003e\u003c/a\u003e\n\u003ca href=\"http://opensource.org/licenses\" target=\"_blank\"\u003e\u003cimg src=\"http://img.shields.io/badge/License-MIT-brightgreen.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp\u003e\n    loads duck-storage entities from a path to provide a pleasure-di container\n\u003c/p\u003e\n\n## Installation\n\n```sh\n$ npm i duck-storage-di --save\n# or\n$ yarn add duck-storage-di\n```\n\n## Features\n\n- [Loads entities from directory](#loads-entities-from-directory)\n- [Loads methods](#loads-methods)\n\n\n\u003ca name=\"loads-entities-from-directory\"\u003e\u003c/a\u003e\n\n## Loads entities from directory\n\n\n```js\nconst { CustomerRack } = container\nconst customerData = {\n  firstName: 'Martin',\n  lastName: 'Gonzalez',\n  email: 'tin@devtin.io',\n  phoneNumber: 3051234567\n}\nconst customer = await CustomerRack.create(customerData)\nt.like(customer, customerData)\nt.truthy(customer._id)\nt.truthy(customer._v)\n```\n\n\u003ca name=\"loads-methods\"\u003e\u003c/a\u003e\n\n## Loads methods\n\n\n```js\nconst { CustomerRack } = container\n\nconst doc = await CustomerRack.create({\n  firstName: 'Martin',\n  lastName: 'Gonzalez',\n  email: 'tin@devtin.io',\n  phoneNumber: 3051234567\n})\n\nlet eventReceived\n\nCustomerRack.on('method', (payload) =\u003e {\n  eventReceived = payload\n})\n\nconst newDoc = await CustomerRack.apply({ id: doc._id, _v: doc._v, method: 'addLog', payload: 'message' })\nt.truthy(newDoc)\nt.truthy(newDoc.entryResult)\nt.truthy(newDoc.eventsDispatched)\nt.like(eventReceived, newDoc.eventsDispatched[0])\n```\n\n\n\u003cbr\u003e\u003ca name=\"duckStorageDi\"\u003e\u003c/a\u003e\n\n### duckStorageDi(directory, [baseDir], [modelPath], [methodsPath], [suffix], [storageOptions]) ⇒ \u003ccode\u003eObject\u003c/code\u003e\n\n| Param | Type | Default |\n| --- | --- | --- |\n| directory | \u003ccode\u003eString\u003c/code\u003e |  | \n| [baseDir] | \u003ccode\u003eString\u003c/code\u003e | \u003ccode\u003eprocess.cwd()\u003c/code\u003e | \n| [modelPath] | \u003ccode\u003eString\u003c/code\u003e | \u003ccode\u003emodel\u003c/code\u003e | \n| [methodsPath] | \u003ccode\u003eString\u003c/code\u003e | \u003ccode\u003emethods\u003c/code\u003e | \n| [suffix] | \u003ccode\u003eString\u003c/code\u003e | \u003ccode\u003eRack\u003c/code\u003e | \n| [storageOptions] | \u003ccode\u003eObject\u003c/code\u003e |  | \n\n**Returns**: \u003ccode\u003eObject\u003c/code\u003e - container and storage  \n\n* * *\n\n### License\n\n[MIT](https://opensource.org/licenses/MIT)\n\n\u0026copy; 2020-present Martin Rafael Gonzalez \u003ctin@devtin.io\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevtin%2Fduck-storage-di","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevtin%2Fduck-storage-di","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevtin%2Fduck-storage-di/lists"}