{"_id":"@angstone/cement-truth","_rev":"2-b41345addaccfa2848503d59fb1b7a03","name":"@angstone/cement-truth","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@angstone/cement-truth","version":"1.0.0","description":"Store Level Zero Of Cement Framework: an EventStore","main":"dist/index.js","scripts":{"start":"node dist/app.js","clean":"rimraf ./dist","build":"npm run clean && ./node_modules/typescript/bin/tsc","test":"nodemon --config nodemon-test.json","test:overload":"APP_TEST_OVERLOAD=true node_modules/.bin/nodemon --config nodemon-test.json","test:mocha":"mocha","test:coverage":"nyc npm run test:mocha"},"keywords":["cement","backend","eventstore","events","node"],"author":{"name":"ssribeiro"},"license":"MIT","devDependencies":{"@istanbuljs/nyc-config-typescript":"^0.1.3","@types/chai":"^4.2.0","@types/chai-things":"0.0.34","@types/chalk":"^2.2.0","@types/mocha":"^5.2.7","@types/node":"^12.7.1","@types/rimraf":"^2.0.2","@types/sinon":"^7.0.13","@types/sinon-chai":"^3.2.3","chai":"^4.2.0","chai-like":"^1.1.1","chai-things":"^0.2.0","clear-module":"^4.0.0","mocha":"^6.2.0","nodemon":"^1.19.1","nyc":"^14.1.1","prettier":"^1.18.2","sinon":"^7.4.1","sinon-chai":"^3.3.0","ts-node":"^8.3.0","tslint":"^5.18.0","tslint-config-prettier":"^1.18.0","typescript":"^3.5.3"},"dependencies":{"rimraf":"^2.6.3","@angstone/cement-basic":"^1.0.1","events":"^3.0.0","level":"^5.0.1","lexicographic-integer":"^1.1.0","path":"^0.12.7"},"gitHead":"9286620b8a40f37d0f24cf7ce4000e8942aafd03","_id":"@angstone/cement-truth@1.0.0","_nodeVersion":"10.16.2","_npmVersion":"6.9.0","dist":{"integrity":"sha512-0DqK8F076t7IXtKEVdfM8eww89QaxxPxHdzXONMVZy00LWkPCioEekHqMgBV8mXTF4l4oKgzZycN1yW34VPF3g==","shasum":"2431ae3ea180568c2d7bff908075cce069b97492","tarball":"https://registry.npmjs.org/@angstone/cement-truth/-/cement-truth-1.0.0.tgz","fileCount":46,"unpackedSize":39493,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdUznOCRA9TVsSAnZWagAA+IQP+wR/k0SUj7hncBxQ0n8U\nxBQpY2B9LF4TILQ4rZynmQJBvilPIxB6XAgBnsrdowVWzsnALmohLdva9ZJr\n9WxL+CGkLEzQgF06tk7lJfWH3cs3SGYflsAiwQjP8Eq2PgAu7xelTpf9i8sX\n3BOHCdEo9ezhQCHsQ7bXJVQ53sNC7fbgmmBccBXcOUUagrZ4GnPEQg8JxUs1\nra2omRmKXQSsrfmjrjDIuCh/c8I8HKpw41YQ1YtOcItZTLs5IagW7vDfzeDu\nq7difME/GZaKoRYZkAYaT7uNA8018TlcrQEzKJ4d3EsQbIpjL1xS6QgXKnAW\n+R4v32cu+wYwYdMpgLAzaZQGt9vQp2KNb1ErOABjM5CwGfJsoJ7tV391dLVq\nazxN1gApArDPzck44ALpqsW0bOeDpopSuiJXC+TRiO81oceUimzDPnPKlG7X\nRZAkpdgSXseasTpUFZQ13f8h/s9qNB5LRZnkTytM4B9CCjs2h8qwF4zoLxcd\nIHFXVGDLpsG9b5gIgQu6yMNm+tWAMvq2/H2d4EinDX8AeRoXO3UqSjNMJWN+\nxpJwH+s+BbCzCdc0Frb9CZxk6Fx5fI49rgAtiFXRzsbEP0e9afwlcIJtc/4F\nTOuiwcDbEe8t4DtqKdJdF+42BpTYLtv5EmNfjoZFT/dW5Jc2F07fMp+EfGXA\nirQS\r\n=ZflM\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCOS0iN8Dm/S9Bu1TdiXbhT1HFbmqNBjVAmJeoVYGQhCwIgew57y8yjuCy3jowetnIFrHngHpdGmO4LuJoGSbfVtHY="}]},"maintainers":[{"name":"ssribeiro","email":"luan@ssribeiro.com"}],"_npmUser":{"name":"ssribeiro","email":"luan@ssribeiro.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cement-truth_1.0.0_1565735373643_0.96273032305883"},"_hasShrinkwrap":false},"1.0.1":{"name":"@angstone/cement-truth","version":"1.0.1","description":"Store Level Zero Of Cement Framework: an EventStore","main":"dist/index.js","scripts":{"start":"node dist/app.js","clean":"rimraf ./dist","build":"npm run clean && ./node_modules/typescript/bin/tsc","test":"nodemon --config nodemon-test.json","test:overload":"APP_TEST_OVERLOAD=true node_modules/.bin/nodemon --config nodemon-test.json","test:mocha":"mocha","test:coverage":"nyc npm run test:mocha"},"keywords":["cement","backend","eventstore","events","node"],"author":{"name":"ssribeiro"},"license":"MIT","devDependencies":{"@istanbuljs/nyc-config-typescript":"^0.1.3","@types/chai":"^4.2.0","@types/chai-things":"0.0.34","@types/chalk":"^2.2.0","@types/mocha":"^5.2.7","@types/node":"^12.7.1","@types/rimraf":"^2.0.2","@types/sinon":"^7.0.13","@types/sinon-chai":"^3.2.3","chai":"^4.2.0","chai-like":"^1.1.1","chai-things":"^0.2.0","clear-module":"^4.0.0","mocha":"^6.2.0","nodemon":"^1.19.1","nyc":"^14.1.1","prettier":"^1.18.2","sinon":"^7.4.1","sinon-chai":"^3.3.0","ts-node":"^8.3.0","tslint":"^5.18.0","tslint-config-prettier":"^1.18.0","typescript":"^3.5.3"},"dependencies":{"rimraf":"^2.6.3","@angstone/cement-basic":"^1.0.1","events":"^3.0.0","level":"^5.0.1","lexicographic-integer":"^1.1.0","path":"^0.12.7"},"gitHead":"a02290a08bad57ab7286ab2b4726a44ac83a4da1","_id":"@angstone/cement-truth@1.0.1","_npmVersion":"6.4.1","_nodeVersion":"8.12.0","_npmUser":{"name":"ssribeiro","email":"luan@ssribeiro.com"},"dist":{"integrity":"sha512-LQnpZ8/g6+4MZ3twNKURdd7p1tc82stYNuzmork2d5iu6uqgr0gzVLzOHG5xuJvO/66l0ukl7vNdUPsuQ08u4A==","shasum":"5610abbc81463a6729261b0f989224dd67d64adf","tarball":"https://registry.npmjs.org/@angstone/cement-truth/-/cement-truth-1.0.1.tgz","fileCount":46,"unpackedSize":39929,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdU1VRCRA9TVsSAnZWagAACj8P/Rgqv9KnZT0MnndAzjKL\nm5XiiMRpICY5dGnqV1Ta3Wr7zkL33Uo1fF/97MdbYGjWaXBZ1FDqdtpZkcsN\nSKSTiXCoej80M294qeNT7eqsR3aq0LfzeA0Z5T/wFhsAQ73a4nhUbJAiJTI5\nVVcSxVob4xypuYCkcTZIyQ4IzYrNKkYXjRjt8mEojlH2Q6VbTcDQY48w+/YG\n9g2l53j0Vj3ssnsSj27IXiPOMreRcMgzQlb8qDJrZmihy0QErBWciq/KVeev\n9PmGsP+YJP270hBhDqwVyp5nM9nRxtmuGePz0dEO/VoLXaCKBV6SS62gnFQD\nvNJUGzg7/l3Q2OGWCHaaicG6PxdUi+wCrsDBGyu1AhqOXa5DKDHZy2uyuYVV\n0UXgGTK7FS37WHUvCd5pOjygpv7BRscgTmqqlC6JgFO36e4JaRRtGVvWUFyI\nGs9LpoMJXJySc1GWjCbpr54joOjMRXcfSmUE+qVZzeP724OK2G/K/DWLdUDW\n3xSBG4kfg2etQ5nOOBfT8XH2jzGuy5Cbbxv/RVQ42AFrvCjqcxxZ1jyga7Kb\n2cd0zGwVxhtEhnQt2wFn/a4Hd3txinr7YIL8IgA+xzvs6wYcjSjF4VONqgbY\nB0iWieixlmlfRsf8RxU8omuWPXo6cOX2QQYH4Dhbst4AvWKMlidtwqwOnaNT\n/GGw\r\n=16rp\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHdfngjp8DKLhR41bNjtqntiltjsj4r5noREx07brtL0AiBUp5e2JTcoFNkN9krVhkesBqrA0/5GxmgSde5OgEPzxg=="}]},"maintainers":[{"name":"ssribeiro","email":"luan@ssribeiro.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cement-truth_1.0.1_1565742417312_0.5807302835778738"},"_hasShrinkwrap":false}},"time":{"created":"2019-08-13T22:29:33.474Z","1.0.0":"2019-08-13T22:29:33.810Z","modified":"2022-04-04T14:06:29.412Z","1.0.1":"2019-08-14T00:26:57.452Z"},"maintainers":[{"name":"ssribeiro","email":"luan@ssribeiro.com"}],"description":"Store Level Zero Of Cement Framework: an EventStore","keywords":["cement","backend","eventstore","events","node"],"author":{"name":"ssribeiro"},"license":"MIT","readme":"\n# The Cement Truth Module\n\nStore Level Zero Of Cement Framework: an EventStore\n\n## what is that?\n\nIt is an EventStore, called LEVEL ZERO store of the framework.\n\nThis is where, in last instance, the \"truth\" about the data is stored.\n\nAll other store levels can be built based on a safe backup of this.\nThey all are considered just an \"image\" of the data.\n\n## install\n\n```\nnpm install @angstone/cement-truth\n```\n\n## usage\n\n```\nimport { signature } from '@angstone/cement-basic'\nsignature()\n\nimport { error, logger } from '@angstone/cement-basic'\nimport {\n  AGENTS /*, ITruthModule, LeveldbTruthModule */,\n  IEvent,\n  IEventTrusted,\n  ITruthObserver,\n  TruthModule as truth,\n} from '@angstone/cement-truth'\n\n// you can use your own implementation\n// but it already works with own implementation\n// using leveldb\n\n// truth.useTruthModule(YourOwnTruthModule) // YourOwnTruthModule must implements ITruthModule\n// truth.useTruthModule(LeveldbTruthModule) // optional already set\n\n// you can set the default path for leveldb folder storage\n/*\ntruth.config({\n    levelDbPath: './your/db'\n})\n*/\n\n// indeed you can just use it like this:\nconst event: IEvent = {\n  type: 'user signed up', // required\n  agent: AGENTS.SYSTEM_DEVELOPER, // the user, the system, you, the developer REQUIRED\n  payload: {\n    // payload is optional\n    username: 'john',\n    password: '1234',\n  },\n}\n\n// note on agent: You can define your own interface\n// it is stored as json object. the provided IAgent\n// only contains \"name\" field\n\ntruth.registerEvent(event).then(eventNumber => {\n  logger.note(eventNumber)\n})\n// or inside async\n// const eventNumber = await truth.registerEvent(event)\n\n// so you retrieve this way:\nconst someAsyncFunc = async (eventNumber: number) => {\n  const event: IEventTrusted = await truth.retrieveEvent(eventNumber)\n}\n\n// and of course, there is no static truth in this world so..\n// the MAIN FUNCTION:\n\ntruth.retrieveAllEvents().then((truthObserver: ITruthObserver) => {\n  truthObserver.eventStream$.on('event', (event: IEventTrusted) => {\n    // do amazing stuff with the past events with the ones that are about to come\n  })\n  truthObserver.eventStream$.once('live', () => {\n    // now you know that all past was read and the next ones are new in live!\n  })\n})\n```\n","readmeFilename":"README.md"}