{"_id":"@aeinbu/eventstore","_rev":"7-371dc04f539d01023813025b500919cc","name":"@aeinbu/eventstore","description":"A simple filebased eventsourced store","dist-tags":{"latest":"0.2.1"},"versions":{"0.0.1":{"name":"@aeinbu/eventstore","version":"0.0.1","description":"A simple filebased eventsourced store","main":"index.js","scripts":{"test":"node ./tests"},"repository":{"type":"git","url":"git+https://github.com/scriptabuild/eventstore.git"},"keywords":[],"author":{"name":"Arjan Einbu","email":"arjan@einbu.no"},"license":"MIT","bugs":{"url":"https://github.com/scriptabuild/eventstore/issues"},"homepage":"https://github.com/scriptabuild/eventstore#readme","gitHead":"f0fd1c09aa655dc91117bcd01a6676b41d821f1f","_id":"@aeinbu/eventstore@0.0.1","_shasum":"56f541565492c7896814308ed9f3c3966ce7f82a","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aeinbu","email":"arjan@einbu.no"},"dist":{"shasum":"56f541565492c7896814308ed9f3c3966ce7f82a","tarball":"https://registry.npmjs.org/@aeinbu/eventstore/-/eventstore-0.0.1.tgz","integrity":"sha512-oyM89XxhK7X2G3sZoLse7jujWSnWBpu0igzmp8M+r6lG9cHKe6NBAFjejanrOOS9O0mQdIVjz+06MvGfAls6qw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDfvaji8qEVExjUE7jr+gV6nJCRyCgvTBjlRoCJdZSe2wIhAMu+Q14eSMnHEQgD4F7gMslzR0S1QGj9Z6Gcb4nRthTX"}]},"maintainers":[{"name":"aeinbu","email":"arjan@einbu.no"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/eventstore-0.0.1.tgz_1488494741147_0.02176208794116974"}},"0.0.2":{"name":"@aeinbu/eventstore","version":"0.0.2","description":"A simple filebased eventsourced store","main":"index.js","scripts":{"test":"node ./tests"},"repository":{"type":"git","url":"git+https://github.com/scriptabuild/eventstore.git"},"keywords":["eventstore","eventsource","commands"],"author":{"name":"Arjan Einbu","email":"arjan@einbu.no"},"license":"MIT","bugs":{"url":"https://github.com/scriptabuild/eventstore/issues"},"homepage":"https://github.com/scriptabuild/eventstore#readme","gitHead":"7f936100ef0d5bda155d4fe858bb3cb2d4790da2","_id":"@aeinbu/eventstore@0.0.2","_shasum":"679bce3dfb500de36054faea7323a4c2e4ff5060","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"aeinbu","email":"arjan@einbu.no"},"dist":{"shasum":"679bce3dfb500de36054faea7323a4c2e4ff5060","tarball":"https://registry.npmjs.org/@aeinbu/eventstore/-/eventstore-0.0.2.tgz","integrity":"sha512-z/njpIptKAEhUyDsw/FAXmiJ57Km0FlZKwFjfrp/lD2Dud8x9tFYKEWk0AArHRVUVIL/B4HpeBErHMXToHySQg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDgUZXaVkZsrBb7bp6nr1EDmwTQDO7eiwsEt/F1avIAJwIhALUXj2srF2aYtLV6ES49PrTysKoghH1mJv9XejyylDqx"}]},"maintainers":[{"name":"aeinbu","email":"arjan@einbu.no"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/eventstore-0.0.2.tgz_1488496143105_0.05855179624632001"}},"0.1.0":{"name":"@aeinbu/eventstore","version":"0.1.0","description":"A simple filebased eventsourced store","main":"index.js","scripts":{"test":"node ./tests"},"repository":{"type":"git","url":"git+https://github.com/scriptabuild/eventstore.git"},"keywords":["eventstore","eventsource","commands"],"author":{"name":"Arjan Einbu","email":"arjan@einbu.no"},"license":"MIT","bugs":{"url":"https://github.com/scriptabuild/eventstore/issues"},"homepage":"https://github.com/scriptabuild/eventstore#readme","dependencies":{"fs-promise":"^2.0.0"},"devDependencies":{"eslint-plugin-async-await":"0.0.0"},"gitHead":"8ec1c900a9b5c7bc8d9615026c2555a645067b9f","_id":"@aeinbu/eventstore@0.1.0","_shasum":"03e00325ccc9833716ffaaa8cf98c06039362597","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.7.1","_npmUser":{"name":"aeinbu","email":"arjan@einbu.no"},"dist":{"shasum":"03e00325ccc9833716ffaaa8cf98c06039362597","tarball":"https://registry.npmjs.org/@aeinbu/eventstore/-/eventstore-0.1.0.tgz","integrity":"sha512-ceOiLC7efw2/od8wwHSnAviwLH9N7HXkMWAYaTl4CEeAtDzlhooo1xYcXWFKOOpGHzMmn3G12lZhvb5mR4/hgg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCWC9evfZgnuSXrngLCmMGfQxg4kZ1eebMGLKY5Dpev2wIgPPvqQ5n/QRABzf5GQbEaQk9EkERNsbpHCffvW2Uc2mI="}]},"maintainers":[{"name":"aeinbu","email":"arjan@einbu.no"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/eventstore-0.1.0.tgz_1491166874585_0.8433143065776676"}},"0.2.0":{"name":"@aeinbu/eventstore","version":"0.2.0","description":"A simple filebased eventsourced store","main":"index.js","scripts":{"test":"node ./tests"},"repository":{"type":"git","url":"git+https://github.com/scriptabuild/eventstore.git"},"keywords":["eventstore","eventsource","commands"],"author":{"name":"Arjan Einbu","email":"arjan@einbu.no"},"license":"MIT","bugs":{"url":"https://github.com/scriptabuild/eventstore/issues"},"homepage":"https://github.com/scriptabuild/eventstore#readme","dependencies":{},"devDependencies":{"mocha":"^3.2.0"},"gitHead":"e34074b436b8f5ac1c45d892fcfc4070c6d9bdeb","_id":"@aeinbu/eventstore@0.2.0","_shasum":"27e1dcb3b6630b21c61ae3d4252ec4e803402d86","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.9.0","_npmUser":{"name":"aeinbu","email":"arjan@einbu.no"},"dist":{"shasum":"27e1dcb3b6630b21c61ae3d4252ec4e803402d86","tarball":"https://registry.npmjs.org/@aeinbu/eventstore/-/eventstore-0.2.0.tgz","integrity":"sha512-hMUh55Im1skLAC7lqbRCcGlYkV6RwEmvadmyyVqpsZ39zoXadtfbhuxUym42QLEszsOWO7zGShblNMm6Hu/clA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG2fajw9Z3MtkxcowPi1u8ubxImAnDYQQx6ThyLdquENAiAuUW6PkesR3Pc+wL03jQm/aqnDLSV+zkLkO/6qCfun1g=="}]},"maintainers":[{"name":"aeinbu","email":"arjan@einbu.no"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/eventstore-0.2.0.tgz_1492427603638_0.8641532470937818"}},"0.2.1":{"name":"@aeinbu/eventstore","version":"0.2.1","description":"A simple filebased eventsourced store","main":"index.js","scripts":{"test":"node ./tests"},"repository":{"type":"git","url":"git+https://github.com/scriptabuild/eventstore.git"},"keywords":["eventstore","eventsource","commands"],"author":{"name":"Arjan Einbu","email":"arjan@einbu.no"},"license":"MIT","bugs":{"url":"https://github.com/scriptabuild/eventstore/issues"},"homepage":"https://github.com/scriptabuild/eventstore#readme","dependencies":{},"devDependencies":{"mocha":"^3.2.0"},"gitHead":"ee8a842585e7458ca9e745f4e4b95b90a6d77b1b","_id":"@aeinbu/eventstore@0.2.1","_shasum":"bbec148f7f997c600d2c51eaea2b761ce75803b2","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.8.0","_npmUser":{"name":"aeinbu","email":"arjan@einbu.no"},"dist":{"shasum":"bbec148f7f997c600d2c51eaea2b761ce75803b2","tarball":"https://registry.npmjs.org/@aeinbu/eventstore/-/eventstore-0.2.1.tgz","integrity":"sha512-/zKtNN7uDbtPfGl6bJzPE2T88WdhdJ2f1eIn6wZzgSPf59KgWBur1O6fGOks1u+i7R/IG+Pis2X1SjxnnRwN/g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICOQ1bAbF9xH2wg38ja7nyllVDHJQlQJLr1fy+E+K6iFAiA4xhux31dT0DnF4Vd2URnCDecyNV+fHaOQ7McyGST0dw=="}]},"maintainers":[{"name":"aeinbu","email":"arjan@einbu.no"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/eventstore-0.2.1.tgz_1493329555257_0.9815369499847293"},"deprecated":"WARNING: This module has been renamed to @scriptabuild/eventstore. Please install it instead. See https://github.com/scriptabuild/eventstore for more information."}},"readme":"# Eventstore\nA simple filebased eventsourced data store for node.js.\n\nInstead of storing the current state of our data, eventsourcing lets us record our intention while creating/manipulating our data.\n\n## Installation\n\n```bash\nnpm install @aeinbu/eventstore\n```\n\n## Example\n\nExample of an object to be stored with this eventstore:\n\n```javascript\n// contactlist.js\nfunction ContactList(dispatch, configureStore){\n\n\tlet contacts = {};  // This is where the actual data is stored\n\n\t// These are the eventhandlers, that manipulate the data.\n\tconfigureStore({\n\t\teventhandlers:{\n\t\t\tonContactAdded(eventdata){\n\t\t\t\tif(!contacts[eventdata.contact.name])\n\t\t\t\t{\n\t\t\t\t\tcontacts[eventdata.contact.name] = eventdata.contact;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthrow new Error(\"Contact already exists\");\n\t\t\t},\n\t\t\tonContactRemoved(eventdata){\n\t\t\t\tif(contacts[eventdata.contactname])\n\t\t\t\t{\n\t\t\t\t\tdelete contacts[eventdata.contactname];\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthrow new Error(\"Contact doesnt exist\");\t\t\t\n\t\t\t}\n\t\t}\n\t});\n\n\t// These are the command methods that are exposed to the developer using this class\n\tthis.addContact = (contact) => {\n\t\tdispatch(\"contactAdded\", {contact});\n\t};\n\n\tthis.removeContact = (contactname) => {\n\t\tdispatch(\"contactRemoved\", {contactname});\n\t};\n\n\t// This is a query method that is exposed to the developer using this class\n\tthis.getAllContacts = () => {\n\t\treturn Object.keys(contacts).map(key => contacts[key]);\n\t};\n}\n```\n\nUsage of `contactlist` with the eventstore:\n\n```javascript\n// demo.js\nconst defineStore = require(\"@aeinbu/eventstore\");\nconst Contactlist = require(\"./ContactList\");\n\n(async funtion(){\n\tconst folder = \"path/to/store\";\n\tconst createContactlistFn = (dispatch, configureStore) => new Contactlist(dispatch, configureStore);\n\tlet store = await defineStore(folder);\n\tlet rw = store.defineReadWriteModel(\"rw\", createContactlistFn);\n\n\trw.withRetries((contactlist, readyToCommit) => {\n\t\tcontactlist.addContact({name: \"Mickey Mouse\", city: \"Duckburgh\", species: \"Mouse\"});\n\t\tcontactlist.addContact({name: \"Goofey\", city: \"Duckburgh\", species: \"Dog\"});\n\n\t\treadyToCommit();\n\t}); // Everything is saved to log at end of block.\n\n\n\trw.withRetries((contactlist, readyToCommit) => {\n\t\tcontactlist.addContact({name: \"Peter Pan\", city: \"Never Never Land\", species: \"Boy\"});\n\t\tcontactlist.removeContact(\"Goofey\");\n\t}); // Nothing is saved to log. This unit of work was rolled back because no call was made to readyToCommit().\n})();\n```\n\n_See the `tests/` folder for a more complete example, including support for snapshots, multiple models, including read-only models_\n\n## Documentation\n\n- `let storeBase = defineStore(folder)` - Sets up a folder as a database. Is the base for creating models on that folder.\n\n- `storeBase.defineReadModel(action)` - \n\n- `storeBase.defineWriteModel(action)` - \n\n- `storeBase.defineReadWriteModel(action, commitCallback)` - \n","maintainers":[{"name":"aeinbu","email":"arjan@einbu.no"}],"time":{"modified":"2022-06-12T14:20:04.369Z","created":"2017-03-02T22:45:43.071Z","0.0.1":"2017-03-02T22:45:43.071Z","0.0.2":"2017-03-02T23:09:03.885Z","0.1.0":"2017-04-02T21:01:15.115Z","0.2.0":"2017-04-17T11:13:25.626Z","0.2.1":"2017-04-27T21:45:57.146Z"},"homepage":"https://github.com/scriptabuild/eventstore#readme","keywords":["eventstore","eventsource","commands"],"repository":{"type":"git","url":"git+https://github.com/scriptabuild/eventstore.git"},"author":{"name":"Arjan Einbu","email":"arjan@einbu.no"},"bugs":{"url":"https://github.com/scriptabuild/eventstore/issues"},"license":"MIT","readmeFilename":"README.md"}